@perses-dev/heatmap-chart-plugin 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +23 -0
  3. package/__mf/css/async/341.2a93d99b.css +1 -0
  4. package/__mf/css/async/759.2a93d99b.css +1 -0
  5. package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
  6. package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
  7. package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
  8. package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
  9. package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
  10. package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
  11. package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
  12. package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
  13. package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
  14. package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
  15. package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
  16. package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
  17. package/__mf/js/HeatMapChart.81916a67.js +5 -0
  18. package/__mf/js/async/173.c3418567.js +2 -0
  19. package/__mf/js/async/173.c3418567.js.LICENSE.txt +19 -0
  20. package/__mf/js/async/293.f3a89fef.js +1 -0
  21. package/__mf/js/async/469.15f49b0f.js +71 -0
  22. package/__mf/js/async/469.15f49b0f.js.LICENSE.txt +21 -0
  23. package/__mf/js/async/482.cd2ab58b.js +83 -0
  24. package/__mf/js/async/482.cd2ab58b.js.LICENSE.txt +61 -0
  25. package/__mf/js/async/774.0d1a003f.js +1 -0
  26. package/__mf/js/async/790.930331af.js +1 -0
  27. package/__mf/js/async/863.e810bfc4.js +2 -0
  28. package/__mf/js/async/863.e810bfc4.js.LICENSE.txt +9 -0
  29. package/__mf/js/async/934.6f607fed.js +2 -0
  30. package/__mf/js/async/934.6f607fed.js.LICENSE.txt +37 -0
  31. package/__mf/js/async/964.944e7b15.js +2 -0
  32. package/__mf/js/async/964.944e7b15.js.LICENSE.txt +9 -0
  33. package/__mf/js/async/981.75e172bb.js +2 -0
  34. package/__mf/js/async/981.75e172bb.js.LICENSE.txt +8 -0
  35. package/__mf/js/async/__federation_expose_HeatMapChart.ab402c3a.js +23 -0
  36. package/__mf/js/main.24d16ad6.js +5 -0
  37. package/lib/HeatMapChart.d.ts +8 -0
  38. package/lib/HeatMapChart.d.ts.map +1 -0
  39. package/lib/HeatMapChart.js +34 -0
  40. package/lib/HeatMapChart.js.map +1 -0
  41. package/lib/bootstrap.d.ts +2 -0
  42. package/lib/bootstrap.d.ts.map +1 -0
  43. package/lib/bootstrap.js +19 -0
  44. package/lib/bootstrap.js.map +1 -0
  45. package/lib/cjs/HeatMapChart.js +40 -0
  46. package/lib/cjs/bootstrap.js +26 -0
  47. package/lib/cjs/components/HeatMapChart.js +149 -0
  48. package/lib/cjs/components/HeatMapChartOptionsEditorSettings.js +85 -0
  49. package/lib/cjs/components/HeatMapChartPanel.js +178 -0
  50. package/lib/cjs/components/HeatMapTooltip.js +58 -0
  51. package/lib/cjs/components/index.js +32 -0
  52. package/lib/cjs/env.d.js +14 -0
  53. package/lib/cjs/getPluginModule.js +27 -0
  54. package/lib/cjs/heat-map-chart-model.js +56 -0
  55. package/lib/cjs/index-federation.js +55 -0
  56. package/lib/cjs/index.js +47 -0
  57. package/lib/cjs/setup-tests.js +19 -0
  58. package/lib/cjs/utils/data-transform.js +34 -0
  59. package/lib/cjs/utils/get-formatted-axis-label.js +48 -0
  60. package/lib/cjs/utils/index.js +32 -0
  61. package/lib/cjs/utils/thresholds.js +22 -0
  62. package/lib/components/HeatMapChart.d.ts +27 -0
  63. package/lib/components/HeatMapChart.d.ts.map +1 -0
  64. package/lib/components/HeatMapChart.js +141 -0
  65. package/lib/components/HeatMapChart.js.map +1 -0
  66. package/lib/components/HeatMapChartOptionsEditorSettings.d.ts +4 -0
  67. package/lib/components/HeatMapChartOptionsEditorSettings.d.ts.map +1 -0
  68. package/lib/components/HeatMapChartOptionsEditorSettings.js +72 -0
  69. package/lib/components/HeatMapChartOptionsEditorSettings.js.map +1 -0
  70. package/lib/components/HeatMapChartPanel.d.ts +7 -0
  71. package/lib/components/HeatMapChartPanel.d.ts.map +1 -0
  72. package/lib/components/HeatMapChartPanel.js +165 -0
  73. package/lib/components/HeatMapChartPanel.js.map +1 -0
  74. package/lib/components/HeatMapTooltip.d.ts +16 -0
  75. package/lib/components/HeatMapTooltip.d.ts.map +1 -0
  76. package/lib/components/HeatMapTooltip.js +50 -0
  77. package/lib/components/HeatMapTooltip.js.map +1 -0
  78. package/lib/components/index.d.ts +4 -0
  79. package/lib/components/index.d.ts.map +1 -0
  80. package/lib/components/index.js +17 -0
  81. package/lib/components/index.js.map +1 -0
  82. package/lib/env.d.js +15 -0
  83. package/lib/env.d.js.map +1 -0
  84. package/lib/getPluginModule.d.ts +6 -0
  85. package/lib/getPluginModule.d.ts.map +1 -0
  86. package/lib/getPluginModule.js +16 -0
  87. package/lib/getPluginModule.js.map +1 -0
  88. package/lib/heat-map-chart-model.d.ts +27 -0
  89. package/lib/heat-map-chart-model.d.ts.map +1 -0
  90. package/lib/heat-map-chart-model.js +30 -0
  91. package/lib/heat-map-chart-model.js.map +1 -0
  92. package/lib/index-federation.d.ts +1 -0
  93. package/lib/index-federation.d.ts.map +1 -0
  94. package/lib/index-federation.js +15 -0
  95. package/lib/index-federation.js.map +1 -0
  96. package/lib/index.d.ts +5 -0
  97. package/lib/index.d.ts.map +1 -0
  98. package/lib/index.js +18 -0
  99. package/lib/index.js.map +1 -0
  100. package/lib/setup-tests.d.ts +2 -0
  101. package/lib/setup-tests.d.ts.map +1 -0
  102. package/lib/setup-tests.js +17 -0
  103. package/lib/setup-tests.js.map +1 -0
  104. package/lib/utils/data-transform.d.ts +5 -0
  105. package/lib/utils/data-transform.d.ts.map +1 -0
  106. package/lib/utils/data-transform.js +18 -0
  107. package/lib/utils/data-transform.js.map +1 -0
  108. package/lib/utils/get-formatted-axis-label.d.ts +2 -0
  109. package/lib/utils/get-formatted-axis-label.d.ts.map +1 -0
  110. package/lib/utils/get-formatted-axis-label.js +41 -0
  111. package/lib/utils/get-formatted-axis-label.js.map +1 -0
  112. package/lib/utils/index.d.ts +4 -0
  113. package/lib/utils/index.d.ts.map +1 -0
  114. package/lib/utils/index.js +17 -0
  115. package/lib/utils/index.js.map +1 -0
  116. package/lib/utils/thresholds.d.ts +4 -0
  117. package/lib/utils/thresholds.d.ts.map +1 -0
  118. package/lib/utils/thresholds.js +14 -0
  119. package/lib/utils/thresholds.js.map +1 -0
  120. package/mf-manifest.json +169 -0
  121. package/mf-stats.json +202 -0
  122. package/package.json +52 -0
@@ -0,0 +1,165 @@
1
+ // Copyright 2025 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { Stack, Typography } from '@mui/material';
15
+ import merge from 'lodash/merge';
16
+ import { useMemo } from 'react';
17
+ import { DEFAULT_FORMAT } from '../heat-map-chart-model';
18
+ import { generateCompleteTimestamps, getCommonTimeScaleForQueries } from '../utils';
19
+ import { HeatMapChart } from './HeatMapChart';
20
+ const HEATMAP_MIN_HEIGHT = 200;
21
+ const HEATMAP_ITEM_MIN_HEIGHT = 2;
22
+ export function HeatMapChartPanel(props) {
23
+ const { spec: pluginSpec, contentDimensions, queryResults } = props;
24
+ // ensures all default format properties set if undef
25
+ const yAxisFormat = merge({}, DEFAULT_FORMAT, pluginSpec.yAxisFormat);
26
+ const countFormat = merge({}, DEFAULT_FORMAT, pluginSpec.countFormat);
27
+ const { data, xAxisCategories, yAxisCategories, countMin, countMax, timeScale } = useMemo(()=>{
28
+ if (!queryResults || queryResults.length === 0) {
29
+ return {
30
+ data: [],
31
+ xAxisCategories: [],
32
+ yAxisCategories: [],
33
+ countMin: 0,
34
+ countMax: 0,
35
+ timeScale: undefined
36
+ };
37
+ }
38
+ if (queryResults.length != 1 || queryResults[0].data.series.length != 1 || queryResults[0].data.series[0].histograms === undefined) {
39
+ return {
40
+ data: [],
41
+ xAxisCategories: [],
42
+ yAxisCategories: [],
43
+ countMin: 0,
44
+ countMax: 0,
45
+ timeScale: undefined
46
+ };
47
+ }
48
+ const series = queryResults[0].data.series[0];
49
+ const timeScale = getCommonTimeScaleForQueries(queryResults);
50
+ const xAxisCategories = generateCompleteTimestamps(timeScale);
51
+ // Dummy value that will be replaced at the first iteration
52
+ let lowestBound = Infinity;
53
+ let highestBound = -Infinity;
54
+ let countMin = Infinity;
55
+ let countMax = -Infinity;
56
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
57
+ for (const [_, histogram] of series?.histograms ?? []){
58
+ for (const bucket of histogram?.buckets ?? []){
59
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
60
+ const [_, lowerBound, upperBound, count] = bucket;
61
+ const lowerBoundFloat = parseFloat(lowerBound);
62
+ const upperBoundFloat = parseFloat(upperBound);
63
+ const countFloat = parseFloat(count);
64
+ if (lowerBoundFloat < lowestBound) {
65
+ lowestBound = lowerBoundFloat;
66
+ }
67
+ if (upperBoundFloat > highestBound) {
68
+ highestBound = upperBoundFloat;
69
+ }
70
+ if (countFloat < countMin) {
71
+ countMin = countFloat;
72
+ }
73
+ if (countFloat > countMax) {
74
+ countMax = countFloat;
75
+ }
76
+ }
77
+ }
78
+ const height = contentDimensions?.height ?? HEATMAP_MIN_HEIGHT;
79
+ const totalRange = highestBound - lowestBound;
80
+ const rangePerItem = totalRange * HEATMAP_ITEM_MIN_HEIGHT / height;
81
+ const totalItems = Math.ceil(height / HEATMAP_ITEM_MIN_HEIGHT);
82
+ // Generating value of the Y axis based on the height divided by the size of a cell (item)
83
+ const yAxisCategories = Array.from({
84
+ length: totalItems
85
+ }, (_, index)=>(lowestBound + index * rangePerItem).toFixed(3));
86
+ const data = [];
87
+ // Logic for filling all cells where a bucket is present
88
+ for (const [time, histogram] of series?.histograms ?? []){
89
+ const itemIndexOnXaxis = xAxisCategories.findIndex((v)=>v === time * 1000);
90
+ for (const bucket of histogram?.buckets ?? []){
91
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
92
+ const [_, lowerBound, upperBound, count] = bucket;
93
+ const yLowerBoundItem = Math.floor((parseFloat(lowerBound) - lowestBound) / rangePerItem);
94
+ const yUpperBoundItem = Math.ceil((parseFloat(upperBound) - lowestBound) / rangePerItem);
95
+ for(let i = 0; i < yUpperBoundItem - yLowerBoundItem; i++){
96
+ // TODO: some bucket may have overlapping cells, we could use avg value. Probably will need to move to a matrix data structure for performance reasons
97
+ data.push({
98
+ value: [
99
+ itemIndexOnXaxis,
100
+ yLowerBoundItem + i,
101
+ parseFloat(count)
102
+ ],
103
+ label: count
104
+ });
105
+ }
106
+ }
107
+ }
108
+ return {
109
+ data,
110
+ xAxisCategories,
111
+ yAxisCategories,
112
+ countMin,
113
+ countMax,
114
+ timeScale
115
+ };
116
+ }, [
117
+ contentDimensions?.height,
118
+ queryResults
119
+ ]);
120
+ // TODO: add support for multiple queries
121
+ if (queryResults.length > 1) {
122
+ return /*#__PURE__*/ _jsx(Stack, {
123
+ justifyContent: "center",
124
+ height: "100%",
125
+ children: /*#__PURE__*/ _jsx(Typography, {
126
+ variant: "body2",
127
+ textAlign: "center",
128
+ children: "Only one query at a time is supported for now"
129
+ })
130
+ });
131
+ }
132
+ // Mo data message handled inside chart component
133
+ if (data.length === 0) {
134
+ return /*#__PURE__*/ _jsx(Stack, {
135
+ justifyContent: "center",
136
+ height: "100%",
137
+ children: /*#__PURE__*/ _jsx(Typography, {
138
+ variant: "body2",
139
+ textAlign: "center",
140
+ children: "No data available (only native histograms are supported for now)"
141
+ })
142
+ });
143
+ }
144
+ if (contentDimensions === undefined) return null;
145
+ return /*#__PURE__*/ _jsx(Stack, {
146
+ direction: "row",
147
+ justifyContent: "center",
148
+ alignItems: "center",
149
+ children: /*#__PURE__*/ _jsx(HeatMapChart, {
150
+ width: contentDimensions.width,
151
+ height: contentDimensions.height,
152
+ data: data,
153
+ xAxisCategories: xAxisCategories,
154
+ yAxisCategories: yAxisCategories,
155
+ yAxisFormat: yAxisFormat,
156
+ countFormat: countFormat,
157
+ countMin: countMin,
158
+ countMax: countMax,
159
+ timeScale: timeScale,
160
+ showVisualMap: pluginSpec.showVisualMap
161
+ })
162
+ });
163
+ }
164
+
165
+ //# sourceMappingURL=HeatMapChartPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/HeatMapChartPanel.tsx"],"sourcesContent":["// Copyright 2025 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 { Stack, Typography } from '@mui/material';\nimport { TimeScale, TimeSeries, TimeSeriesData } from '@perses-dev/core';\nimport { PanelProps } from '@perses-dev/plugin-system';\nimport merge from 'lodash/merge';\nimport { ReactElement, useMemo } from 'react';\nimport { DEFAULT_FORMAT, HeatMapChartOptions } from '../heat-map-chart-model';\nimport { generateCompleteTimestamps, getCommonTimeScaleForQueries } from '../utils';\nimport { HeatMapChart, HeatMapDataItem } from './HeatMapChart';\n\nconst HEATMAP_MIN_HEIGHT = 200;\nconst HEATMAP_ITEM_MIN_HEIGHT = 2;\n\nexport type HeatMapChartPanelProps = PanelProps<HeatMapChartOptions, TimeSeriesData>;\n\nexport function HeatMapChartPanel(props: HeatMapChartPanelProps): ReactElement | null {\n const { spec: pluginSpec, contentDimensions, queryResults } = props;\n\n // ensures all default format properties set if undef\n const yAxisFormat = merge({}, DEFAULT_FORMAT, pluginSpec.yAxisFormat);\n const countFormat = merge({}, DEFAULT_FORMAT, pluginSpec.countFormat);\n\n const {\n data,\n xAxisCategories,\n yAxisCategories,\n countMin,\n countMax,\n timeScale,\n }: {\n data: HeatMapDataItem[];\n xAxisCategories: number[];\n yAxisCategories: string[];\n countMin: number;\n countMax: number;\n timeScale?: TimeScale;\n } = useMemo(() => {\n if (!queryResults || queryResults.length === 0) {\n return {\n data: [],\n xAxisCategories: [],\n yAxisCategories: [],\n countMin: 0,\n countMax: 0,\n timeScale: undefined,\n };\n }\n\n if (\n queryResults.length != 1 ||\n queryResults[0]!.data.series.length != 1 ||\n queryResults[0]!.data.series[0]!.histograms === undefined\n ) {\n return {\n data: [],\n xAxisCategories: [],\n yAxisCategories: [],\n countMin: 0,\n countMax: 0,\n timeScale: undefined,\n };\n }\n\n const series: TimeSeries = queryResults[0]!.data.series[0]!;\n\n const timeScale = getCommonTimeScaleForQueries(queryResults);\n const xAxisCategories: number[] = generateCompleteTimestamps(timeScale);\n\n // Dummy value that will be replaced at the first iteration\n let lowestBound = Infinity;\n let highestBound = -Infinity;\n let countMin = Infinity;\n let countMax = -Infinity;\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n for (const [_, histogram] of series?.histograms ?? []) {\n for (const bucket of histogram?.buckets ?? []) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [_, lowerBound, upperBound, count] = bucket;\n const lowerBoundFloat = parseFloat(lowerBound);\n const upperBoundFloat = parseFloat(upperBound);\n const countFloat = parseFloat(count);\n if (lowerBoundFloat < lowestBound) {\n lowestBound = lowerBoundFloat;\n }\n if (upperBoundFloat > highestBound) {\n highestBound = upperBoundFloat;\n }\n if (countFloat < countMin) {\n countMin = countFloat;\n }\n if (countFloat > countMax) {\n countMax = countFloat;\n }\n }\n }\n\n const height = contentDimensions?.height ?? HEATMAP_MIN_HEIGHT;\n const totalRange = highestBound - lowestBound;\n const rangePerItem = (totalRange * HEATMAP_ITEM_MIN_HEIGHT) / height;\n const totalItems = Math.ceil(height / HEATMAP_ITEM_MIN_HEIGHT);\n\n // Generating value of the Y axis based on the height divided by the size of a cell (item)\n const yAxisCategories: string[] = Array.from({ length: totalItems }, (_, index) =>\n (lowestBound + index * rangePerItem).toFixed(3)\n );\n\n const data: HeatMapDataItem[] = [];\n // Logic for filling all cells where a bucket is present\n for (const [time, histogram] of series?.histograms ?? []) {\n const itemIndexOnXaxis = xAxisCategories.findIndex((v) => v === time * 1000);\n\n for (const bucket of histogram?.buckets ?? []) {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [_, lowerBound, upperBound, count] = bucket;\n const yLowerBoundItem = Math.floor((parseFloat(lowerBound) - lowestBound) / rangePerItem);\n const yUpperBoundItem = Math.ceil((parseFloat(upperBound) - lowestBound) / rangePerItem);\n\n for (let i = 0; i < yUpperBoundItem - yLowerBoundItem; i++) {\n // TODO: some bucket may have overlapping cells, we could use avg value. Probably will need to move to a matrix data structure for performance reasons\n data.push({\n value: [itemIndexOnXaxis, yLowerBoundItem + i, parseFloat(count)],\n label: count,\n });\n }\n }\n }\n return {\n data,\n xAxisCategories,\n yAxisCategories,\n countMin,\n countMax,\n timeScale,\n };\n }, [contentDimensions?.height, queryResults]);\n\n // TODO: add support for multiple queries\n if (queryResults.length > 1) {\n return (\n <Stack justifyContent=\"center\" height=\"100%\">\n <Typography variant=\"body2\" textAlign=\"center\">\n Only one query at a time is supported for now\n </Typography>\n </Stack>\n );\n }\n\n // Mo data message handled inside chart component\n if (data.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 return (\n <Stack direction=\"row\" justifyContent=\"center\" alignItems=\"center\">\n <HeatMapChart\n width={contentDimensions.width}\n height={contentDimensions.height}\n data={data}\n xAxisCategories={xAxisCategories}\n yAxisCategories={yAxisCategories}\n yAxisFormat={yAxisFormat}\n countFormat={countFormat}\n countMin={countMin}\n countMax={countMax}\n timeScale={timeScale}\n showVisualMap={pluginSpec.showVisualMap}\n />\n </Stack>\n );\n}\n"],"names":["Stack","Typography","merge","useMemo","DEFAULT_FORMAT","generateCompleteTimestamps","getCommonTimeScaleForQueries","HeatMapChart","HEATMAP_MIN_HEIGHT","HEATMAP_ITEM_MIN_HEIGHT","HeatMapChartPanel","props","spec","pluginSpec","contentDimensions","queryResults","yAxisFormat","countFormat","data","xAxisCategories","yAxisCategories","countMin","countMax","timeScale","length","undefined","series","histograms","lowestBound","Infinity","highestBound","_","histogram","bucket","buckets","lowerBound","upperBound","count","lowerBoundFloat","parseFloat","upperBoundFloat","countFloat","height","totalRange","rangePerItem","totalItems","Math","ceil","Array","from","index","toFixed","time","itemIndexOnXaxis","findIndex","v","yLowerBoundItem","floor","yUpperBoundItem","i","push","value","label","justifyContent","variant","textAlign","direction","alignItems","width","showVisualMap"],"mappings":"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"}
@@ -0,0 +1,16 @@
1
+ import { Theme } from '@mui/material';
2
+ import { FormatOptions } from '@perses-dev/core';
3
+ import { HeatMapData } from './HeatMapChart';
4
+ interface CustomTooltipProps {
5
+ data: HeatMapData;
6
+ label: string;
7
+ marker: string;
8
+ xAxisCategories: number[];
9
+ yAxisCategories: string[];
10
+ theme: Theme;
11
+ yAxisFormat?: FormatOptions;
12
+ countFormat?: FormatOptions;
13
+ }
14
+ export declare function generateTooltipHTML({ data, label, marker, xAxisCategories, yAxisCategories, theme, yAxisFormat, countFormat, }: CustomTooltipProps): string;
15
+ export {};
16
+ //# sourceMappingURL=HeatMapTooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeatMapTooltip.d.ts","sourceRoot":"","sources":["../../../src/components/HeatMapTooltip.ts"],"names":[],"mappings":"AAaA,OAAO,EAAO,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAe,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,UAAU,kBAAkB;IAC1B,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,WAAW,CAAC,EAAE,aAAa,CAAC;CAC7B;AAED,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,KAAK,EACL,MAAM,EACN,eAAe,EACf,eAAe,EACf,KAAK,EACL,WAAW,EACX,WAAW,GACZ,EAAE,kBAAkB,GAAG,MAAM,CAwC7B"}
@@ -0,0 +1,50 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { css } from '@mui/material';
14
+ import { getDateAndTime } from '@perses-dev/components';
15
+ import { formatValue } from '@perses-dev/core';
16
+ export function generateTooltipHTML({ data, label, marker, xAxisCategories, yAxisCategories, theme, yAxisFormat, countFormat }) {
17
+ const [x, y] = data;
18
+ const xAxisLabel = xAxisCategories[x];
19
+ const { formattedDate, formattedTime } = getDateAndTime(xAxisLabel);
20
+ const tooltipHeader = css`
21
+ border-bottom: 1px solid ${theme.palette.grey[500]};
22
+ padding-bottom: 8px;
23
+ `;
24
+ const tooltipContentStyles = css`
25
+ display: flex;
26
+ justify-content: space-between;
27
+ padding-top: 8px;
28
+ `;
29
+ const labelStyles = css`
30
+ margin-right: 16px;
31
+ `;
32
+ const lowerBound = parseFloat(yAxisCategories[y]);
33
+ const upperBound = yAxisCategories[y + 1] ? parseFloat(yAxisCategories[y + 1]) : parseFloat(yAxisCategories[y]) + parseFloat(yAxisCategories[y]) - parseFloat(yAxisCategories[y - 1]); // Top cell, upper bound need to be calculated from previous cell
34
+ return `
35
+ <div>
36
+ <div style="${tooltipHeader.styles}">${formattedDate} ${formattedTime}</div>
37
+ <div style="${tooltipContentStyles.styles}">
38
+ <div style="${labelStyles.styles}">
39
+ ${marker}
40
+ <strong>${formatValue(lowerBound, yAxisFormat)} - ${formatValue(upperBound, yAxisFormat)}</strong>
41
+ </div>
42
+ <div>
43
+ ${formatValue(parseFloat(label), countFormat)}
44
+ </div>
45
+ </div>
46
+ </div>
47
+ `;
48
+ }
49
+
50
+ //# sourceMappingURL=HeatMapTooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/HeatMapTooltip.ts"],"sourcesContent":["// Copyright 2024 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 { css, Theme } from '@mui/material';\nimport { getDateAndTime } from '@perses-dev/components';\nimport { FormatOptions, formatValue } from '@perses-dev/core';\nimport { HeatMapData } from './HeatMapChart';\n\ninterface CustomTooltipProps {\n data: HeatMapData;\n label: string;\n marker: string;\n xAxisCategories: number[];\n yAxisCategories: string[];\n theme: Theme;\n yAxisFormat?: FormatOptions;\n countFormat?: FormatOptions;\n}\n\nexport function generateTooltipHTML({\n data,\n label,\n marker,\n xAxisCategories,\n yAxisCategories,\n theme,\n yAxisFormat,\n countFormat,\n}: CustomTooltipProps): string {\n const [x, y] = data;\n const xAxisLabel = xAxisCategories[x];\n\n const { formattedDate, formattedTime } = getDateAndTime(xAxisLabel);\n\n const tooltipHeader = css`\n border-bottom: 1px solid ${theme.palette.grey[500]};\n padding-bottom: 8px;\n `;\n\n const tooltipContentStyles = css`\n display: flex;\n justify-content: space-between;\n padding-top: 8px;\n `;\n\n const labelStyles = css`\n margin-right: 16px;\n `;\n\n const lowerBound = parseFloat(yAxisCategories[y]!);\n const upperBound = yAxisCategories[y + 1]\n ? parseFloat(yAxisCategories[y + 1]!)\n : parseFloat(yAxisCategories[y]!) + parseFloat(yAxisCategories[y]!) - parseFloat(yAxisCategories[y - 1]!); // Top cell, upper bound need to be calculated from previous cell\n\n return `\n <div>\n <div style=\"${tooltipHeader.styles}\">${formattedDate} ${formattedTime}</div>\n <div style=\"${tooltipContentStyles.styles}\">\n <div style=\"${labelStyles.styles}\">\n ${marker}\n <strong>${formatValue(lowerBound, yAxisFormat)} - ${formatValue(upperBound, yAxisFormat)}</strong>\n </div>\n <div>\n ${formatValue(parseFloat(label), countFormat)}\n </div>\n </div>\n </div>\n `;\n}\n"],"names":["css","getDateAndTime","formatValue","generateTooltipHTML","data","label","marker","xAxisCategories","yAxisCategories","theme","yAxisFormat","countFormat","x","y","xAxisLabel","formattedDate","formattedTime","tooltipHeader","palette","grey","tooltipContentStyles","labelStyles","lowerBound","parseFloat","upperBound","styles"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,GAAG,QAAe,gBAAgB;AAC3C,SAASC,cAAc,QAAQ,yBAAyB;AACxD,SAAwBC,WAAW,QAAQ,mBAAmB;AAc9D,OAAO,SAASC,oBAAoB,EAClCC,IAAI,EACJC,KAAK,EACLC,MAAM,EACNC,eAAe,EACfC,eAAe,EACfC,KAAK,EACLC,WAAW,EACXC,WAAW,EACQ;IACnB,MAAM,CAACC,GAAGC,EAAE,GAAGT;IACf,MAAMU,aAAaP,eAAe,CAACK,EAAE;IAErC,MAAM,EAAEG,aAAa,EAAEC,aAAa,EAAE,GAAGf,eAAea;IAExD,MAAMG,gBAAgBjB,GAAG,CAAC;6BACC,EAAES,MAAMS,OAAO,CAACC,IAAI,CAAC,IAAI,CAAC;;EAErD,CAAC;IAED,MAAMC,uBAAuBpB,GAAG,CAAC;;;;EAIjC,CAAC;IAED,MAAMqB,cAAcrB,GAAG,CAAC;;EAExB,CAAC;IAED,MAAMsB,aAAaC,WAAWf,eAAe,CAACK,EAAE;IAChD,MAAMW,aAAahB,eAAe,CAACK,IAAI,EAAE,GACrCU,WAAWf,eAAe,CAACK,IAAI,EAAE,IACjCU,WAAWf,eAAe,CAACK,EAAE,IAAKU,WAAWf,eAAe,CAACK,EAAE,IAAKU,WAAWf,eAAe,CAACK,IAAI,EAAE,GAAI,iEAAiE;IAE9K,OAAO,CAAC;;kBAEQ,EAAEI,cAAcQ,MAAM,CAAC,EAAE,EAAEV,cAAc,CAAC,EAAEC,cAAc;kBAC1D,EAAEI,qBAAqBK,MAAM,CAAC;oBAC5B,EAAEJ,YAAYI,MAAM,CAAC;UAC/B,EAAEnB,OAAO;kBACD,EAAEJ,YAAYoB,YAAYZ,aAAa,GAAG,EAAER,YAAYsB,YAAYd,aAAa;;;UAGzF,EAAER,YAAYqB,WAAWlB,QAAQM,aAAa;;;;EAItD,CAAC;AACH"}
@@ -0,0 +1,4 @@
1
+ export * from './HeatMapChartOptionsEditorSettings';
2
+ export * from './HeatMapChartPanel';
3
+ export * from './HeatMapChart';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,qCAAqC,CAAC;AACpD,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,17 @@
1
+ // Copyright 2025 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export * from './HeatMapChartOptionsEditorSettings';
14
+ export * from './HeatMapChartPanel';
15
+ export * from './HeatMapChart';
16
+
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/index.ts"],"sourcesContent":["// Copyright 2025 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 './HeatMapChartOptionsEditorSettings';\nexport * from './HeatMapChartPanel';\nexport * from './HeatMapChart';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,sCAAsC;AACpD,cAAc,sBAAsB;AACpC,cAAc,iBAAiB"}
package/lib/env.d.js ADDED
@@ -0,0 +1,15 @@
1
+ // Copyright 2025 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ /// <reference types="@rsbuild/core/types" />
14
+
15
+ //# sourceMappingURL=env.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/env.d.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/// <reference types=\"@rsbuild/core/types\" />\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,6CAA6C"}
@@ -0,0 +1,6 @@
1
+ import { PluginModuleResource } from '@perses-dev/plugin-system';
2
+ /**
3
+ * Returns the plugin module information from package.json
4
+ */
5
+ export declare function getPluginModule(): PluginModuleResource;
6
+ //# sourceMappingURL=getPluginModule.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,16 @@
1
+ import packageJson from '../package.json';
2
+ /**
3
+ * Returns the plugin module information from package.json
4
+ */ export function getPluginModule() {
5
+ const { name, version, perses } = packageJson;
6
+ return {
7
+ kind: 'PluginModule',
8
+ metadata: {
9
+ name,
10
+ version
11
+ },
12
+ spec: perses
13
+ };
14
+ }
15
+
16
+ //# sourceMappingURL=getPluginModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/getPluginModule.ts"],"sourcesContent":["import { 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":"AACA,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"}
@@ -0,0 +1,27 @@
1
+ import { Definition, FormatOptions } from '@perses-dev/core';
2
+ import { OptionsEditorProps } from '@perses-dev/plugin-system';
3
+ export declare const DEFAULT_FORMAT: FormatOptions;
4
+ export declare const DEFAULT_MIN_PERCENT = 0;
5
+ export declare const DEFAULT_MAX_PERCENT = 100;
6
+ export declare const DEFAULT_MIN_PERCENT_DECIMAL = 0;
7
+ export declare const DEFAULT_MAX_PERCENT_DECIMAL = 1;
8
+ /**
9
+ * The schema for a HeatMapChart panel.
10
+ */
11
+ export interface HeatMapChartDefinition extends Definition<HeatMapChartOptions> {
12
+ kind: 'HeatMapChart';
13
+ }
14
+ /**
15
+ * The Options object type supported by the HeatMapChart panel plugin.
16
+ */
17
+ export interface HeatMapChartOptions {
18
+ yAxisFormat?: FormatOptions;
19
+ countFormat?: FormatOptions;
20
+ showVisualMap?: boolean;
21
+ }
22
+ export type HeatMapChartOptionsEditorProps = OptionsEditorProps<HeatMapChartOptions>;
23
+ /**
24
+ * Creates the initial/empty options for a HeatMapChart panel.
25
+ */
26
+ export declare function createInitialHeatMapChartOptions(): HeatMapChartOptions;
27
+ //# sourceMappingURL=heat-map-chart-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"heat-map-chart-model.d.ts","sourceRoot":"","sources":["../../src/heat-map-chart-model.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,eAAO,MAAM,cAAc,EAAE,aAAmC,CAAC;AACjE,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,mBAAmB,MAAM,CAAC;AACvC,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAC7C,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,UAAU,CAAC,mBAAmB,CAAC;IAC7E,IAAI,EAAE,cAAc,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,MAAM,8BAA8B,GAAG,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;AAErF;;GAEG;AACH,wBAAgB,gCAAgC,IAAI,mBAAmB,CAMtE"}
@@ -0,0 +1,30 @@
1
+ // Copyright 2025 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export const DEFAULT_FORMAT = {
14
+ unit: 'decimal'
15
+ };
16
+ export const DEFAULT_MIN_PERCENT = 0;
17
+ export const DEFAULT_MAX_PERCENT = 100;
18
+ export const DEFAULT_MIN_PERCENT_DECIMAL = 0;
19
+ export const DEFAULT_MAX_PERCENT_DECIMAL = 1;
20
+ /**
21
+ * Creates the initial/empty options for a HeatMapChart panel.
22
+ */ export function createInitialHeatMapChartOptions() {
23
+ return {
24
+ yAxisFormat: DEFAULT_FORMAT,
25
+ countFormat: DEFAULT_FORMAT,
26
+ showVisualMap: true
27
+ };
28
+ }
29
+
30
+ //# sourceMappingURL=heat-map-chart-model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/heat-map-chart-model.ts"],"sourcesContent":["// Copyright 2025 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 { Definition, FormatOptions } from '@perses-dev/core';\nimport { OptionsEditorProps } from '@perses-dev/plugin-system';\n\nexport const DEFAULT_FORMAT: FormatOptions = { unit: 'decimal' };\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/**\n * The schema for a HeatMapChart panel.\n */\nexport interface HeatMapChartDefinition extends Definition<HeatMapChartOptions> {\n kind: 'HeatMapChart';\n}\n\n/**\n * The Options object type supported by the HeatMapChart panel plugin.\n */\nexport interface HeatMapChartOptions {\n yAxisFormat?: FormatOptions;\n countFormat?: FormatOptions;\n showVisualMap?: boolean;\n}\n\nexport type HeatMapChartOptionsEditorProps = OptionsEditorProps<HeatMapChartOptions>;\n\n/**\n * Creates the initial/empty options for a HeatMapChart panel.\n */\nexport function createInitialHeatMapChartOptions(): HeatMapChartOptions {\n return {\n yAxisFormat: DEFAULT_FORMAT,\n countFormat: DEFAULT_FORMAT,\n showVisualMap: true,\n };\n}\n"],"names":["DEFAULT_FORMAT","unit","DEFAULT_MIN_PERCENT","DEFAULT_MAX_PERCENT","DEFAULT_MIN_PERCENT_DECIMAL","DEFAULT_MAX_PERCENT_DECIMAL","createInitialHeatMapChartOptions","yAxisFormat","countFormat","showVisualMap"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAKjC,OAAO,MAAMA,iBAAgC;IAAEC,MAAM;AAAU,EAAE;AACjE,OAAO,MAAMC,sBAAsB,EAAE;AACrC,OAAO,MAAMC,sBAAsB,IAAI;AACvC,OAAO,MAAMC,8BAA8B,EAAE;AAC7C,OAAO,MAAMC,8BAA8B,EAAE;AAoB7C;;CAEC,GACD,OAAO,SAASC;IACd,OAAO;QACLC,aAAaP;QACbQ,aAAaR;QACbS,eAAe;IACjB;AACF"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index-federation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-federation.d.ts","sourceRoot":"","sources":["../../src/index-federation.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ // Copyright 2025 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import('./bootstrap');
14
+
15
+ //# sourceMappingURL=index-federation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index-federation.ts"],"sourcesContent":["// Copyright 2025 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('./bootstrap');\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,MAAM,CAAC"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export { getPluginModule } from './getPluginModule';
2
+ export { HeatMapChartPanel } from './components';
3
+ export * from './heat-map-chart-model';
4
+ export * from './HeatMapChart';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,18 @@
1
+ // Copyright 2025 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ export { getPluginModule } from './getPluginModule';
14
+ export { HeatMapChartPanel } from './components';
15
+ export * from './heat-map-chart-model';
16
+ export * from './HeatMapChart';
17
+
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// Copyright 2025 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 { HeatMapChartPanel } from './components';\nexport * from './heat-map-chart-model';\nexport * from './HeatMapChart';\n"],"names":["getPluginModule","HeatMapChartPanel"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,eAAe,QAAQ,oBAAoB;AACpD,SAASC,iBAAiB,QAAQ,eAAe;AACjD,cAAc,yBAAyB;AACvC,cAAc,iBAAiB"}
@@ -0,0 +1,2 @@
1
+ import '@testing-library/jest-dom';
2
+ //# sourceMappingURL=setup-tests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-tests.d.ts","sourceRoot":"","sources":["../../src/setup-tests.ts"],"names":[],"mappings":"AAaA,OAAO,2BAA2B,CAAC"}
@@ -0,0 +1,17 @@
1
+ // Copyright 2025 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import '@testing-library/jest-dom';
14
+ // Always mock e-charts during tests since we don't have a proper canvas in jsdom
15
+ jest.mock('echarts/core');
16
+
17
+ //# sourceMappingURL=setup-tests.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/setup-tests.ts"],"sourcesContent":["// Copyright 2025 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,oCAAoC;AACpC,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"}
@@ -0,0 +1,5 @@
1
+ import { TimeScale, TimeSeriesData } from '@perses-dev/core';
2
+ import { PanelData } from '@perses-dev/plugin-system';
3
+ export declare function getCommonTimeScaleForQueries(queries: Array<PanelData<TimeSeriesData>>): TimeScale | undefined;
4
+ export declare function generateCompleteTimestamps(timescale?: TimeScale): number[];
5
+ //# sourceMappingURL=data-transform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-transform.d.ts","sourceRoot":"","sources":["../../../src/utils/data-transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,SAAS,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,GAAG,SAAS,GAAG,SAAS,CAG7G;AAED,wBAAgB,0BAA0B,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,MAAM,EAAE,CAU1E"}
@@ -0,0 +1,18 @@
1
+ import { getCommonTimeScale } from '@perses-dev/core';
2
+ export function getCommonTimeScaleForQueries(queries) {
3
+ const seriesData = queries.map((query)=>query.data);
4
+ return getCommonTimeScale(seriesData);
5
+ }
6
+ export function generateCompleteTimestamps(timescale) {
7
+ if (!timescale) {
8
+ return [];
9
+ }
10
+ const { startMs, endMs, stepMs } = timescale;
11
+ const timestamps = [];
12
+ for(let time = startMs; time <= endMs; time += stepMs){
13
+ timestamps.push(time);
14
+ }
15
+ return timestamps;
16
+ }
17
+
18
+ //# sourceMappingURL=data-transform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/data-transform.ts"],"sourcesContent":["import { getCommonTimeScale, TimeScale, TimeSeriesData } from '@perses-dev/core';\nimport { PanelData } from '@perses-dev/plugin-system';\n\nexport function getCommonTimeScaleForQueries(queries: Array<PanelData<TimeSeriesData>>): TimeScale | undefined {\n const seriesData = queries.map((query) => query.data);\n return getCommonTimeScale(seriesData);\n}\n\nexport function generateCompleteTimestamps(timescale?: TimeScale): number[] {\n if (!timescale) {\n return [];\n }\n const { startMs, endMs, stepMs } = timescale;\n const timestamps: number[] = [];\n for (let time = startMs; time <= endMs; time += stepMs) {\n timestamps.push(time);\n }\n return timestamps;\n}\n"],"names":["getCommonTimeScale","getCommonTimeScaleForQueries","queries","seriesData","map","query","data","generateCompleteTimestamps","timescale","startMs","endMs","stepMs","timestamps","time","push"],"mappings":"AAAA,SAASA,kBAAkB,QAAmC,mBAAmB;AAGjF,OAAO,SAASC,6BAA6BC,OAAyC;IACpF,MAAMC,aAAaD,QAAQE,GAAG,CAAC,CAACC,QAAUA,MAAMC,IAAI;IACpD,OAAON,mBAAmBG;AAC5B;AAEA,OAAO,SAASI,2BAA2BC,SAAqB;IAC9D,IAAI,CAACA,WAAW;QACd,OAAO,EAAE;IACX;IACA,MAAM,EAAEC,OAAO,EAAEC,KAAK,EAAEC,MAAM,EAAE,GAAGH;IACnC,MAAMI,aAAuB,EAAE;IAC/B,IAAK,IAAIC,OAAOJ,SAASI,QAAQH,OAAOG,QAAQF,OAAQ;QACtDC,WAAWE,IAAI,CAACD;IAClB;IACA,OAAOD;AACT"}
@@ -0,0 +1,2 @@
1
+ export declare function getFormattedHeatmapAxisLabel(rangeMs: number, timezone: string): (value: number) => string;
2
+ //# sourceMappingURL=get-formatted-axis-label.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-formatted-axis-label.d.ts","sourceRoot":"","sources":["../../../src/utils/get-formatted-axis-label.ts"],"names":[],"mappings":"AAgBA,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAC3D,OAAO,MAAM,KAAG,MAAM,CA6BxC"}
@@ -0,0 +1,41 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { formatWithTimeZone } from '@perses-dev/components';
14
+ // https://echarts.apache.org/en/option.html#xAxis.axisLabel.formatter
15
+ export function getFormattedHeatmapAxisLabel(rangeMs, timezone) {
16
+ return function(value) {
17
+ const dayMs = 86400000;
18
+ const monthMs = 2629440000;
19
+ const yearMs = 31536000000;
20
+ const timeStamp = new Date(Number(value));
21
+ // more than 5 years
22
+ if (rangeMs > yearMs * 5) {
23
+ return formatWithTimeZone(timeStamp, 'yyy', timezone);
24
+ }
25
+ // more than 2 years
26
+ if (rangeMs > yearMs * 2) {
27
+ return formatWithTimeZone(timeStamp, 'MMM yyy', timezone);
28
+ }
29
+ // between 5 days to 6 months
30
+ if (rangeMs > dayMs * 10 && rangeMs < monthMs * 6) {
31
+ return formatWithTimeZone(timeStamp, 'dd.MM', timezone); // 12-01
32
+ }
33
+ // between 2 and 10 days
34
+ if (rangeMs > dayMs * 2 && rangeMs <= dayMs * 10) {
35
+ return formatWithTimeZone(timeStamp, 'dd.MM HH:mm', timezone); // 12-01; // 12-01 12:30
36
+ }
37
+ return formatWithTimeZone(timeStamp, 'HH:mm', timezone);
38
+ };
39
+ }
40
+
41
+ //# sourceMappingURL=get-formatted-axis-label.js.map