@perses-dev/components 0.55.0-beta.6 → 0.55.0-beta.8

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 (59) hide show
  1. package/dist/ColorPicker/ColorPicker.d.ts.map +1 -1
  2. package/dist/Dialog/Dialog.d.ts.map +1 -1
  3. package/dist/Dialog/DiscardChangesConfirmationDialog.d.ts.map +1 -1
  4. package/dist/Drawer/Drawer.d.ts.map +1 -1
  5. package/dist/EChart/EChart.d.ts +3 -3
  6. package/dist/EChart/EChart.d.ts.map +1 -1
  7. package/dist/EChart/timezone-formatter.d.ts.map +1 -1
  8. package/dist/InfoTooltip/InfoTooltip.d.ts.map +1 -1
  9. package/dist/Legend/LegendColorBadge.d.ts +2 -1
  10. package/dist/Legend/LegendColorBadge.d.ts.map +1 -1
  11. package/dist/LinksEditor/LinkEditorForm.d.ts.map +1 -1
  12. package/dist/OptionsEditorLayout/OptionsEditorColumn.d.ts.map +1 -1
  13. package/dist/OptionsEditorLayout/OptionsEditorControl.d.ts.map +1 -1
  14. package/dist/OptionsEditorLayout/OptionsEditorGrid.d.ts.map +1 -1
  15. package/dist/OptionsEditorLayout/OptionsEditorGroup.d.ts.map +1 -1
  16. package/dist/Table/hooks/useTableKeyboardNav.js +3 -3
  17. package/dist/Table/hooks/useTableKeyboardNav.js.map +1 -1
  18. package/dist/ThresholdsEditor/ThresholdsEditor.js +1 -1
  19. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
  20. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts.map +1 -1
  21. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts.map +1 -1
  22. package/dist/TimeRangeSelector/TimeRangeSelector.js +1 -8
  23. package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -1
  24. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts +1 -1
  25. package/dist/TimeSeriesTooltip/TimeChartTooltip.d.ts.map +1 -1
  26. package/dist/TimeSeriesTooltip/TooltipContent.js +1 -1
  27. package/dist/TimeSeriesTooltip/TooltipContent.js.map +1 -1
  28. package/dist/TimeSeriesTooltip/TooltipHeader.d.ts +1 -1
  29. package/dist/TimeSeriesTooltip/TooltipHeader.d.ts.map +1 -1
  30. package/dist/TimeSeriesTooltip/nearby-series.js +1 -1
  31. package/dist/TimeSeriesTooltip/nearby-series.js.map +1 -1
  32. package/dist/TimeSeriesTooltip/tooltip-model.d.ts +1 -1
  33. package/dist/TimeSeriesTooltip/tooltip-model.d.ts.map +1 -1
  34. package/dist/model/legend.d.ts +3 -3
  35. package/dist/model/legend.d.ts.map +1 -1
  36. package/dist/model/temperature.d.ts.map +1 -1
  37. package/dist/model/transforms.d.ts.map +1 -1
  38. package/dist/model/units.d.ts +41 -41
  39. package/dist/theme/palette/background.d.ts +1 -1
  40. package/dist/theme/palette/background.d.ts.map +1 -1
  41. package/dist/theme/palette/error.d.ts.map +1 -1
  42. package/dist/theme/palette/grey.d.ts +1 -1
  43. package/dist/theme/palette/grey.d.ts.map +1 -1
  44. package/dist/theme/palette/primary.d.ts.map +1 -1
  45. package/dist/theme/palette/secondary.d.ts.map +1 -1
  46. package/dist/theme/palette/success.d.ts.map +1 -1
  47. package/dist/theme/palette/text.d.ts +1 -1
  48. package/dist/theme/palette/text.d.ts.map +1 -1
  49. package/dist/theme/palette/warning.d.ts.map +1 -1
  50. package/dist/theme/types/fonts.d.js +14 -0
  51. package/dist/theme/types/fonts.d.js.map +1 -0
  52. package/dist/utils/format.d.ts.map +1 -1
  53. package/dist/utils/regexp.js +3 -1
  54. package/dist/utils/regexp.js.map +1 -1
  55. package/dist/utils/transform-data.js +1 -1
  56. package/dist/utils/transform-data.js.map +1 -1
  57. package/dist/utils/variable-interpolation.js +1 -1
  58. package/dist/utils/variable-interpolation.js.map +1 -1
  59. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/TimeSeriesTooltip/nearby-series.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 { TimeSeries, TimeSeriesValueTuple } from '@perses-dev/spec';\nimport type { BarSeriesOption } from 'echarts/charts';\nimport type { ECharts as EChartsInstance } from 'echarts/core';\n\nimport type { EChartsDataFormat, TimeChartSeriesMapping, DatapointInfo, FormatOptions } from '../model';\nimport { OPTIMIZED_MODE_SERIES_LIMIT, formatValue } from '../model';\nimport { batchDispatchNearbySeriesActions, getPointInGrid, getClosestTimestamp } from '../utils';\nimport type { CursorCoordinates, CursorData } from './tooltip-model';\nimport { EMPTY_TOOLTIP_DATA } from './tooltip-model';\nimport type { Candidate, GetYBufferParams, IsWithinPercentageRangeParams, NearbySeriesArray } from './types';\nimport {\n calculateBarBandwidth,\n calculateBarSegmentBounds,\n calculateBarYBounds,\n calculateVisualYForSeries,\n getPixelXFromGrid,\n} from './utils';\n\nexport type { NearbySeriesArray, NearbySeriesInfo } from './types';\n\n// increase multipliers to show more series in tooltip\nexport const INCREASE_NEARBY_SERIES_MULTIPLIER = 5.5; // adjusts how many series show in tooltip (higher == more series shown)\nexport const DYNAMIC_NEARBY_SERIES_MULTIPLIER = 30; // used for adjustment after series number divisor\nexport const SHOW_FEWER_SERIES_LIMIT = 5;\n\nfunction gatherCandidates(\n data: TimeSeries[],\n seriesMapping: TimeChartSeriesMapping,\n closestTimestamp: number,\n cursorX: number,\n cursorY: number,\n cursorXPixel: number | null,\n cursorPixelY: number | undefined,\n yBuffer: number,\n yBufferPixels: number | null,\n chart: EChartsInstance,\n): Candidate[] {\n const candidates: Candidate[] = [];\n const totalSeries = data.length;\n\n const stackTotals = new Map<string, number>();\n\n let sortedTimestamps: number[] = [];\n const firstValues = data[0]?.values;\n if (firstValues && firstValues.length > 0) {\n const seen = new Set<number>();\n for (const [ts] of firstValues) {\n if (!seen.has(ts)) {\n seen.add(ts);\n sortedTimestamps.push(ts);\n }\n }\n sortedTimestamps = sortedTimestamps.sort((a, b) => a - b);\n }\n\n // Bar-only indexes: ECharts groups bars independently of lines, so bar-relative index and count must exclude line series.\n const barSeriesIndexes: number[] = [];\n for (let i = 0; i < totalSeries; i++) {\n if ((seriesMapping[i]?.type ?? 'line') === 'bar') barSeriesIndexes.push(i);\n }\n\n // Computed once outside the loop — both depend only on the timestamp, not the series index.\n let barBandwidth: number | null = null;\n let barCenterPixelX: number | null = null;\n if (barSeriesIndexes.length > 0 && cursorXPixel !== null) {\n barBandwidth = calculateBarBandwidth(closestTimestamp, sortedTimestamps, chart);\n barCenterPixelX = getPixelXFromGrid(closestTimestamp, chart);\n }\n\n for (let seriesIdx = 0; seriesIdx < totalSeries; seriesIdx++) {\n const currentSeries = seriesMapping[seriesIdx];\n if (!currentSeries) continue;\n\n const currentDataset = data[seriesIdx];\n if (!currentDataset) continue;\n\n const currentDatasetValues: TimeSeriesValueTuple[] | undefined = currentDataset.values;\n if (!currentDatasetValues || !Array.isArray(currentDatasetValues)) continue;\n\n const seriesType = currentSeries.type ?? 'line';\n const currentSeriesName = currentSeries.name ? currentSeries.name.toString() : '';\n const seriesId = currentSeries.id ? currentSeries.id.toString() : '';\n const markerColor = (currentSeries.color ?? '#000').toString();\n\n let datumIdx = -1;\n let xValue = 0;\n let yValue: number | null | undefined;\n for (let i = 0; i < currentDatasetValues.length; i++) {\n const tuple = currentDatasetValues[i];\n if (!tuple) continue;\n if (tuple[0] === closestTimestamp) {\n datumIdx = i;\n xValue = tuple[0];\n yValue = tuple[1];\n break;\n }\n }\n if (datumIdx === -1) continue;\n\n if (yValue === null || yValue === undefined) continue;\n\n let isCandidate = false;\n let visualY = yValue;\n let distance = Infinity;\n\n if (seriesType === 'line') {\n visualY = calculateVisualYForSeries(seriesIdx, yValue, seriesMapping, stackTotals);\n\n if (cursorPixelY !== undefined && yBufferPixels !== null) {\n try {\n const dataPointPixel = chart.convertToPixel({ seriesIndex: seriesIdx }, [datumIdx, visualY]);\n if (dataPointPixel && dataPointPixel[1] !== undefined) {\n const pixelDistance = Math.abs(cursorPixelY - dataPointPixel[1]);\n isCandidate = pixelDistance <= yBufferPixels;\n distance = pixelDistance;\n } else {\n const verticalDistance = Math.abs(visualY - cursorY);\n isCandidate = verticalDistance <= yBuffer;\n distance = verticalDistance;\n }\n } catch {\n const verticalDistance = Math.abs(visualY - cursorY);\n isCandidate = verticalDistance <= yBuffer;\n distance = verticalDistance;\n }\n } else {\n const verticalDistance = Math.abs(visualY - cursorY);\n isCandidate = verticalDistance <= yBuffer;\n distance = verticalDistance;\n }\n } else if (seriesType === 'bar') {\n if (cursorXPixel === null || barBandwidth === null || barCenterPixelX === null) continue;\n\n const barRelativeIdx = barSeriesIndexes.indexOf(seriesIdx);\n if (barRelativeIdx === -1) continue;\n\n const segmentBounds = calculateBarSegmentBounds(\n barRelativeIdx,\n barBandwidth,\n barCenterPixelX,\n barSeriesIndexes.length,\n );\n\n const isWithinXBounds = cursorXPixel >= segmentBounds.left && cursorXPixel <= segmentBounds.right;\n if (!isWithinXBounds) continue;\n\n const stackId = (currentSeries as BarSeriesOption).stack;\n let isHoveringYBounds = true;\n\n if (stackId) {\n const stackIdStr = stackId.toString();\n const visualYBottom = stackTotals.get(stackIdStr) ?? 0;\n visualY = calculateVisualYForSeries(seriesIdx, yValue, seriesMapping, stackTotals);\n const yBounds = calculateBarYBounds(visualYBottom, visualY, chart);\n\n if (yBounds) {\n const cursorYPixel = chart.convertToPixel('grid', [0, cursorY]);\n if (cursorYPixel && cursorYPixel[1] !== undefined) {\n isHoveringYBounds = cursorYPixel[1] >= yBounds.top && cursorYPixel[1] <= yBounds.bottom;\n }\n }\n } else {\n visualY = yValue;\n }\n\n if (!isHoveringYBounds) continue;\n\n const segmentCenter = (segmentBounds.left + segmentBounds.right) / 2;\n distance = Math.abs(cursorXPixel - segmentCenter);\n isCandidate = true;\n }\n\n if (isCandidate) {\n candidates.push({\n seriesIdx,\n datumIdx,\n seriesId,\n seriesName: currentSeriesName,\n date: closestTimestamp,\n markerColor,\n x: xValue,\n y: yValue,\n visualY,\n distance,\n });\n }\n }\n\n return candidates;\n}\n\nfunction findClosestCandidate(candidates: Candidate[]): Candidate | null {\n if (candidates.length === 0) return null;\n let winner: Candidate | null = null;\n for (const candidate of candidates) {\n if (winner === null || candidate.distance < winner.distance) {\n winner = candidate;\n }\n }\n return winner;\n}\n\nfunction processCandidates(\n candidates: Candidate[],\n winner: Candidate | null,\n format: FormatOptions | undefined,\n seriesFormatMap: Map<string, FormatOptions> | undefined,\n chart: EChartsInstance,\n nonCandidateSeriesIndexes: number[],\n): NearbySeriesArray {\n const nearbySeriesIndexes: number[] = [];\n const emphasizedSeriesIndexes: number[] = [];\n const nonEmphasizedSeriesIndexes: number[] = [...nonCandidateSeriesIndexes];\n const emphasizedDatapoints: DatapointInfo[] = [];\n const duplicateDatapoints: DatapointInfo[] = [];\n const yValueCounts: Map<number, number> = new Map();\n\n const result: NearbySeriesArray = [];\n\n for (const candidate of candidates) {\n const seriesFormat = seriesFormatMap?.get(candidate.seriesId) ?? format;\n // Use raw y, not visualY — visualY is for proximity detection only.\n const displayY = candidate.y;\n const formattedY = formatValue(displayY, seriesFormat);\n const isClosestToCursor = winner !== null && candidate.seriesIdx === winner.seriesIdx;\n\n if (isClosestToCursor) {\n emphasizedSeriesIndexes.push(candidate.seriesIdx);\n\n const duplicateValuesCount = yValueCounts.get(displayY) ?? 0;\n yValueCounts.set(displayY, duplicateValuesCount + 1);\n if (duplicateValuesCount > 0) {\n duplicateDatapoints.push({\n seriesIndex: candidate.seriesIdx,\n dataIndex: candidate.datumIdx,\n seriesName: candidate.seriesName,\n yValue: displayY,\n });\n }\n\n emphasizedDatapoints.push({\n seriesIndex: candidate.seriesIdx,\n dataIndex: candidate.datumIdx,\n seriesName: candidate.seriesName,\n yValue: displayY,\n });\n } else {\n nonEmphasizedSeriesIndexes.push(candidate.seriesIdx);\n }\n\n result.push({\n seriesIdx: candidate.seriesIdx,\n datumIdx: candidate.datumIdx,\n seriesName: candidate.seriesName,\n date: candidate.date,\n x: candidate.x,\n y: displayY,\n formattedY,\n markerColor: candidate.markerColor,\n isClosestToCursor,\n });\n\n nearbySeriesIndexes.push(candidate.seriesIdx);\n }\n\n batchDispatchNearbySeriesActions(\n chart,\n nearbySeriesIndexes,\n emphasizedSeriesIndexes,\n nonEmphasizedSeriesIndexes,\n emphasizedDatapoints,\n duplicateDatapoints,\n );\n\n return result;\n}\n\n/**\n * Returns formatted series data for the points that are close to the user's cursor.\n * Adjust xBuffer and yBuffer to increase or decrease number of series shown.\n */\nexport function checkforNearbyTimeSeries(\n data: TimeSeries[],\n seriesMapping: TimeChartSeriesMapping,\n pointInGrid: number[],\n yBuffer: number,\n chart: EChartsInstance,\n format?: FormatOptions,\n seriesFormatMap?: Map<string, FormatOptions>,\n // in the case of multi-axis, we need the cursor Y position in pixel space\n cursorPixelY?: number,\n cursorXPixel?: number | null,\n): NearbySeriesArray {\n const cursorX: number | null = pointInGrid[0] ?? null;\n const cursorY: number | null = pointInGrid[1] ?? null;\n\n if (cursorX === null || cursorY === null) return EMPTY_TOOLTIP_DATA;\n if (chart.dispatchAction === undefined) return EMPTY_TOOLTIP_DATA;\n if (!Array.isArray(data)) return EMPTY_TOOLTIP_DATA;\n\n // All series share the same x-axis timestamps (enforced by getCommonTimeScale).\n const firstTimeSeriesValues = data[0]?.values;\n const closestTimestamp = getClosestTimestamp(firstTimeSeriesValues, cursorX);\n if (closestTimestamp === null) return EMPTY_TOOLTIP_DATA;\n\n let yBufferPixels: number | null = null;\n if (cursorPixelY !== undefined) {\n const cursorPoint = chart.convertToPixel('grid', [0, cursorY]);\n const bufferPoint = chart.convertToPixel('grid', [0, cursorY + yBuffer]);\n if (cursorPoint && bufferPoint && cursorPoint[1] !== undefined && bufferPoint[1] !== undefined) {\n yBufferPixels = Math.abs(bufferPoint[1] - cursorPoint[1]);\n }\n }\n\n const resolvedCursorXPixel = cursorXPixel ?? getPixelXFromGrid(closestTimestamp, chart);\n\n const candidates = gatherCandidates(\n data,\n seriesMapping,\n closestTimestamp,\n cursorX,\n cursorY,\n resolvedCursorXPixel,\n cursorPixelY,\n yBuffer,\n yBufferPixels,\n chart,\n );\n\n const winner = findClosestCandidate(candidates);\n\n const candidateIndexes = new Set<number>();\n for (const candidate of candidates) candidateIndexes.add(candidate.seriesIdx);\n const nonCandidateSeriesIndexes: number[] = [];\n for (let idx = 0; idx < data.length; idx++) {\n if (!candidateIndexes.has(idx)) nonCandidateSeriesIndexes.push(idx);\n }\n\n return processCandidates(candidates, winner, format, seriesFormatMap, chart, nonCandidateSeriesIndexes);\n}\n\n/**\n * [DEPRECATED] Returns formatted series data for the points that are close to the user's cursor\n * Adjust yBuffer to increase or decrease number of series shown\n */\nexport function legacyCheckforNearbySeries(\n data: EChartsDataFormat,\n pointInGrid: number[],\n yBuffer: number,\n chart?: EChartsInstance,\n format?: FormatOptions,\n): NearbySeriesArray {\n const currentNearbySeriesData: NearbySeriesArray = [];\n const cursorX: number | null = pointInGrid[0] ?? null;\n const cursorY: number | null = pointInGrid[1] ?? null;\n\n if (cursorX === null || cursorY === null) {\n return currentNearbySeriesData;\n }\n\n const nearbySeriesIndexes: number[] = [];\n const emphasizedSeriesIndexes: number[] = [];\n const nonEmphasizedSeriesIndexes: number[] = [];\n const totalSeries = data.timeSeries.length;\n if (Array.isArray(data.xAxis) && Array.isArray(data.timeSeries)) {\n for (let seriesIdx = 0; seriesIdx < totalSeries; seriesIdx++) {\n const currentSeries = data.timeSeries[seriesIdx];\n if (currentSeries === undefined) break;\n if (currentNearbySeriesData.length >= OPTIMIZED_MODE_SERIES_LIMIT) break;\n\n const currentSeriesName = currentSeries.name ? currentSeries.name.toString() : '';\n const markerColor = currentSeries.color ?? '#000';\n if (Array.isArray(currentSeries.data)) {\n for (let datumIdx = 0; datumIdx < currentSeries.data.length; datumIdx++) {\n const xValue = data.xAxis[datumIdx] ?? 0;\n const yValue = currentSeries.data[datumIdx];\n // ensure null values not displayed in tooltip\n if (yValue !== undefined && yValue !== null && cursorX === datumIdx) {\n if (yValue !== '-' && cursorY <= yValue + yBuffer && cursorY >= yValue - yBuffer) {\n // show fewer bold series in tooltip when many total series\n const minPercentRange = totalSeries > SHOW_FEWER_SERIES_LIMIT ? 2 : 5;\n const percentRangeToCheck = Math.max(minPercentRange, 100 / totalSeries);\n const isClosestToCursor = isWithinPercentageRange({\n valueToCheck: cursorY,\n baseValue: yValue,\n percentage: percentRangeToCheck,\n });\n if (isClosestToCursor) {\n emphasizedSeriesIndexes.push(seriesIdx);\n } else {\n nonEmphasizedSeriesIndexes.push(seriesIdx);\n // ensure series not close to cursor are not highlighted\n if (chart?.dispatchAction !== undefined) {\n chart.dispatchAction({\n type: 'downplay',\n seriesIndex: seriesIdx,\n });\n }\n }\n\n // determine whether to convert timestamp to ms, see: https://stackoverflow.com/a/23982005/17575201\n const xValueMilliSeconds = xValue > 99999999999 ? xValue : xValue * 1000;\n const formattedY = formatValue(yValue, format);\n currentNearbySeriesData.push({\n seriesIdx: seriesIdx,\n datumIdx: datumIdx,\n seriesName: currentSeriesName,\n date: xValueMilliSeconds,\n x: xValue,\n y: yValue,\n formattedY: formattedY,\n markerColor: markerColor.toString(),\n isClosestToCursor,\n });\n nearbySeriesIndexes.push(seriesIdx);\n }\n }\n }\n }\n }\n }\n if (chart?.dispatchAction !== undefined) {\n // Clears emphasis state of all lines that are not emphasized.\n // Emphasized is a subset of just the nearby series that are closest to cursor.\n chart.dispatchAction({\n type: 'downplay',\n seriesIndex: nonEmphasizedSeriesIndexes,\n });\n\n // https://echarts.apache.org/en/api.html#action.highlight\n if (emphasizedSeriesIndexes.length > 0) {\n // Fadeout opacity of all series not closest to cursor.\n chart.dispatchAction({\n type: 'highlight',\n seriesIndex: emphasizedSeriesIndexes,\n notBlur: false, // ensure blur IS triggered, this is default but setting so it is explicit\n escapeConnect: true, // shared crosshair should not emphasize series on adjacent charts\n });\n } else {\n // When no emphasized series with bold text, notBlur allows opacity fadeout to not trigger.\n chart.dispatchAction({\n type: 'highlight',\n seriesIndex: nearbySeriesIndexes,\n notBlur: true, // do not trigger blur state when cursor is not immediately close to any series\n escapeConnect: true, // shared crosshair should not emphasize series on adjacent charts\n });\n }\n }\n\n return currentNearbySeriesData;\n}\n\n/**\n * Uses mouse position to determine whether user is hovering over a chart canvas\n * If yes, convert from pixel values to logical cartesian coordinates and return all nearby series\n */\nexport function getNearbySeriesData({\n mousePos,\n pinnedPos,\n data,\n seriesMapping,\n chart,\n format,\n seriesFormatMap,\n showAllSeries = false,\n}: {\n mousePos: CursorData['coords'];\n pinnedPos: CursorCoordinates | null;\n data: TimeSeries[];\n seriesMapping: TimeChartSeriesMapping;\n chart?: EChartsInstance;\n format?: FormatOptions;\n seriesFormatMap?: Map<string, FormatOptions>;\n showAllSeries?: boolean;\n}): NearbySeriesArray {\n if (chart === undefined || mousePos === null) return EMPTY_TOOLTIP_DATA;\n\n // prevents multiple tooltips showing from adjacent charts unless tooltip is pinned\n let cursorTargetMatchesChart = false;\n if (mousePos.target !== null) {\n const currentParent = (<HTMLElement>mousePos.target).parentElement;\n if (currentParent !== null) {\n const currentGrandparent = currentParent.parentElement;\n if (currentGrandparent !== null) {\n const chartDom = chart.getDom();\n if (chartDom === currentGrandparent) {\n cursorTargetMatchesChart = true;\n }\n }\n }\n }\n\n // allows moving cursor inside tooltip without it fading away\n if (pinnedPos !== null) {\n mousePos = pinnedPos;\n cursorTargetMatchesChart = true;\n }\n\n if (cursorTargetMatchesChart === false || data === null || chart['_model'] === undefined) return EMPTY_TOOLTIP_DATA;\n\n if (mousePos.plotCanvas.x === undefined || mousePos.plotCanvas.y === undefined) return EMPTY_TOOLTIP_DATA;\n\n const cursorPixelY = mousePos.plotCanvas.y;\n const cursorXPixel = mousePos.plotCanvas.x;\n const pointInGrid = getPointInGrid(cursorXPixel, cursorPixelY, chart);\n if (pointInGrid !== null) {\n const chartModel = chart['_model'];\n const yAxisScale = chartModel.getComponent('yAxis').axis.scale;\n const isLogScale = yAxisScale.type === 'log';\n let yInterval = yAxisScale._interval;\n // For log scales, convert from log-space extent to actual data range and use 1% as the interval.\n if (isLogScale && yAxisScale.base) {\n const logBase = yAxisScale.base;\n const extent = yAxisScale._extent;\n // e.g. extent [0, 2] → 10^0..10^2\n const actualMin = logBase ** extent[0];\n const actualMax = logBase ** extent[1];\n yInterval = (actualMax - actualMin) / 100;\n }\n const totalSeries = data.length;\n const yBuffer = getYBuffer({ yInterval, totalSeries, showAllSeries });\n\n const hasMultipleYAxes = seriesMapping.some((series) => series.yAxisIndex !== undefined && series.yAxisIndex > 0);\n\n return checkforNearbyTimeSeries(\n data,\n seriesMapping,\n pointInGrid,\n yBuffer,\n chart,\n format,\n seriesFormatMap,\n hasMultipleYAxes ? cursorPixelY : undefined,\n cursorXPixel,\n );\n }\n\n // no nearby series found\n return EMPTY_TOOLTIP_DATA;\n}\n\n/*\n * Check if two numbers are within a specified percentage range\n */\nexport function isWithinPercentageRange({\n valueToCheck,\n baseValue,\n percentage,\n}: IsWithinPercentageRangeParams): boolean {\n const range = (percentage / 100) * baseValue;\n const lowerBound = baseValue - range;\n const upperBound = baseValue + range;\n return valueToCheck >= lowerBound && valueToCheck <= upperBound;\n}\n\n/*\n * Get range to check within for nearby series to show in tooltip.\n */\nexport function getYBuffer({ yInterval, totalSeries, showAllSeries = false }: GetYBufferParams): number {\n if (showAllSeries) {\n return yInterval * 10; // roughly correlates with grid so entire canvas is searched\n }\n // never let nearby series range be less than roughly the size of a single tick\n const yBufferMin = yInterval * 0.3;\n\n // tooltip trigger area gets smaller with more series\n if (totalSeries > SHOW_FEWER_SERIES_LIMIT) {\n const adjustedBuffer = (yInterval * DYNAMIC_NEARBY_SERIES_MULTIPLIER) / totalSeries;\n return Math.max(yBufferMin, adjustedBuffer);\n }\n // increase multiplier to expand nearby series range\n return Math.max(yBufferMin, yInterval * INCREASE_NEARBY_SERIES_MULTIPLIER);\n}\n"],"names":["OPTIMIZED_MODE_SERIES_LIMIT","formatValue","batchDispatchNearbySeriesActions","getPointInGrid","getClosestTimestamp","EMPTY_TOOLTIP_DATA","calculateBarBandwidth","calculateBarSegmentBounds","calculateBarYBounds","calculateVisualYForSeries","getPixelXFromGrid","INCREASE_NEARBY_SERIES_MULTIPLIER","DYNAMIC_NEARBY_SERIES_MULTIPLIER","SHOW_FEWER_SERIES_LIMIT","gatherCandidates","data","seriesMapping","closestTimestamp","cursorX","cursorY","cursorXPixel","cursorPixelY","yBuffer","yBufferPixels","chart","candidates","totalSeries","length","stackTotals","Map","sortedTimestamps","firstValues","values","seen","Set","ts","has","add","push","sort","a","b","barSeriesIndexes","i","type","barBandwidth","barCenterPixelX","seriesIdx","currentSeries","currentDataset","currentDatasetValues","Array","isArray","seriesType","currentSeriesName","name","toString","seriesId","id","markerColor","color","datumIdx","xValue","yValue","tuple","undefined","isCandidate","visualY","distance","Infinity","dataPointPixel","convertToPixel","seriesIndex","pixelDistance","Math","abs","verticalDistance","barRelativeIdx","indexOf","segmentBounds","isWithinXBounds","left","right","stackId","stack","isHoveringYBounds","stackIdStr","visualYBottom","get","yBounds","cursorYPixel","top","bottom","segmentCenter","seriesName","date","x","y","findClosestCandidate","winner","candidate","processCandidates","format","seriesFormatMap","nonCandidateSeriesIndexes","nearbySeriesIndexes","emphasizedSeriesIndexes","nonEmphasizedSeriesIndexes","emphasizedDatapoints","duplicateDatapoints","yValueCounts","result","seriesFormat","displayY","formattedY","isClosestToCursor","duplicateValuesCount","set","dataIndex","checkforNearbyTimeSeries","pointInGrid","dispatchAction","firstTimeSeriesValues","cursorPoint","bufferPoint","resolvedCursorXPixel","candidateIndexes","idx","legacyCheckforNearbySeries","currentNearbySeriesData","timeSeries","xAxis","minPercentRange","percentRangeToCheck","max","isWithinPercentageRange","valueToCheck","baseValue","percentage","xValueMilliSeconds","notBlur","escapeConnect","getNearbySeriesData","mousePos","pinnedPos","showAllSeries","cursorTargetMatchesChart","target","currentParent","parentElement","currentGrandparent","chartDom","getDom","plotCanvas","chartModel","yAxisScale","getComponent","axis","scale","isLogScale","yInterval","_interval","base","logBase","extent","_extent","actualMin","actualMax","getYBuffer","hasMultipleYAxes","some","series","yAxisIndex","range","lowerBound","upperBound","yBufferMin","adjustedBuffer"],"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;AAOjC,SAASA,2BAA2B,EAAEC,WAAW,QAAQ,oBAAW;AACpE,SAASC,gCAAgC,EAAEC,cAAc,EAAEC,mBAAmB,QAAQ,oBAAW;AAEjG,SAASC,kBAAkB,QAAQ,qBAAkB;AAErD,SACEC,qBAAqB,EACrBC,yBAAyB,EACzBC,mBAAmB,EACnBC,yBAAyB,EACzBC,iBAAiB,QACZ,aAAU;AAIjB,sDAAsD;AACtD,OAAO,MAAMC,oCAAoC,IAAI,CAAC,wEAAwE;AAC9H,OAAO,MAAMC,mCAAmC,GAAG,CAAC,kDAAkD;AACtG,OAAO,MAAMC,0BAA0B,EAAE;AAEzC,SAASC,iBACPC,IAAkB,EAClBC,aAAqC,EACrCC,gBAAwB,EACxBC,OAAe,EACfC,OAAe,EACfC,YAA2B,EAC3BC,YAAgC,EAChCC,OAAe,EACfC,aAA4B,EAC5BC,KAAsB;IAEtB,MAAMC,aAA0B,EAAE;IAClC,MAAMC,cAAcX,KAAKY,MAAM;IAE/B,MAAMC,cAAc,IAAIC;IAExB,IAAIC,mBAA6B,EAAE;IACnC,MAAMC,cAAchB,IAAI,CAAC,EAAE,EAAEiB;IAC7B,IAAID,eAAeA,YAAYJ,MAAM,GAAG,GAAG;QACzC,M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MwB,mBAAmBzJ,cAAc0J,IAAI,CAAC,CAACC,SAAWA,OAAOC,UAAU,KAAK3G,aAAa0G,OAAOC,UAAU,GAAG;QAE/G,OAAOrD,yBACLxG,MACAC,eACAwG,aACAlG,SACAE,OACA8E,QACAC,iBACAkE,mBAAmBpJ,eAAe4C,WAClC7C;IAEJ;IAEA,yBAAyB;IACzB,OAAOf;AACT;AAEA;;CAEC,GACD,OAAO,SAASkI,wBAAwB,EACtCC,YAAY,EACZC,SAAS,EACTC,UAAU,EACoB;IAC9B,MAAMmC,QAAQ,AAACnC,aAAa,MAAOD;IACnC,MAAMqC,aAAarC,YAAYoC;IAC/B,MAAME,aAAatC,YAAYoC;IAC/B,OAAOrC,gBAAgBsC,cAActC,gBAAgBuC;AACvD;AAEA;;CAEC,GACD,OAAO,SAASP,WAAW,EAAER,SAAS,EAAEtI,WAAW,EAAEuH,gBAAgB,KAAK,EAAoB;IAC5F,IAAIA,eAAe;QACjB,OAAOe,YAAY,IAAI,4DAA4D;IACrF;IACA,+EAA+E;IAC/E,MAAMgB,aAAahB,YAAY;IAE/B,qDAAqD;IACrD,IAAItI,cAAcb,yBAAyB;QACzC,MAAMoK,iBAAiB,AAACjB,YAAYpJ,mCAAoCc;QACxE,OAAOgD,KAAK4D,GAAG,CAAC0C,YAAYC;IAC9B;IACA,oDAAoD;IACpD,OAAOvG,KAAK4D,GAAG,CAAC0C,YAAYhB,YAAYrJ;AAC1C"}
1
+ {"version":3,"sources":["../../src/TimeSeriesTooltip/nearby-series.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 { TimeSeries, TimeSeriesValueTuple } from '@perses-dev/spec';\nimport type { BarSeriesOption } from 'echarts/charts';\nimport type { ECharts as EChartsInstance } from 'echarts/core';\n\nimport type { EChartsDataFormat, TimeChartSeriesMapping, DatapointInfo, FormatOptions } from '../model';\nimport { OPTIMIZED_MODE_SERIES_LIMIT, formatValue } from '../model';\nimport { batchDispatchNearbySeriesActions, getPointInGrid, getClosestTimestamp } from '../utils';\nimport type { CursorCoordinates, CursorData } from './tooltip-model';\nimport { EMPTY_TOOLTIP_DATA } from './tooltip-model';\nimport type { Candidate, GetYBufferParams, IsWithinPercentageRangeParams, NearbySeriesArray } from './types';\nimport {\n calculateBarBandwidth,\n calculateBarSegmentBounds,\n calculateBarYBounds,\n calculateVisualYForSeries,\n getPixelXFromGrid,\n} from './utils';\n\nexport type { NearbySeriesArray, NearbySeriesInfo } from './types';\n\n// increase multipliers to show more series in tooltip\nexport const INCREASE_NEARBY_SERIES_MULTIPLIER = 5.5; // adjusts how many series show in tooltip (higher == more series shown)\nexport const DYNAMIC_NEARBY_SERIES_MULTIPLIER = 30; // used for adjustment after series number divisor\nexport const SHOW_FEWER_SERIES_LIMIT = 5;\n\nfunction gatherCandidates(\n data: TimeSeries[],\n seriesMapping: TimeChartSeriesMapping,\n closestTimestamp: number,\n cursorX: number,\n cursorY: number,\n cursorXPixel: number | null,\n cursorPixelY: number | undefined,\n yBuffer: number,\n yBufferPixels: number | null,\n chart: EChartsInstance,\n): Candidate[] {\n const candidates: Candidate[] = [];\n const totalSeries = data.length;\n\n const stackTotals = new Map<string, number>();\n\n let sortedTimestamps: number[] = [];\n const firstValues = data[0]?.values;\n if (firstValues && firstValues.length > 0) {\n const seen = new Set<number>();\n for (const [ts] of firstValues) {\n if (!seen.has(ts)) {\n seen.add(ts);\n sortedTimestamps.push(ts);\n }\n }\n sortedTimestamps = sortedTimestamps.toSorted((a, b) => a - b);\n }\n\n // Bar-only indexes: ECharts groups bars independently of lines, so bar-relative index and count must exclude line series.\n const barSeriesIndexes: number[] = [];\n for (let i = 0; i < totalSeries; i++) {\n if ((seriesMapping[i]?.type ?? 'line') === 'bar') barSeriesIndexes.push(i);\n }\n\n // Computed once outside the loop — both depend only on the timestamp, not the series index.\n let barBandwidth: number | null = null;\n let barCenterPixelX: number | null = null;\n if (barSeriesIndexes.length > 0 && cursorXPixel !== null) {\n barBandwidth = calculateBarBandwidth(closestTimestamp, sortedTimestamps, chart);\n barCenterPixelX = getPixelXFromGrid(closestTimestamp, chart);\n }\n\n for (let seriesIdx = 0; seriesIdx < totalSeries; seriesIdx++) {\n const currentSeries = seriesMapping[seriesIdx];\n if (!currentSeries) continue;\n\n const currentDataset = data[seriesIdx];\n if (!currentDataset) continue;\n\n const currentDatasetValues: TimeSeriesValueTuple[] | undefined = currentDataset.values;\n if (!currentDatasetValues || !Array.isArray(currentDatasetValues)) continue;\n\n const seriesType = currentSeries.type ?? 'line';\n const currentSeriesName = currentSeries.name ? currentSeries.name.toString() : '';\n const seriesId = currentSeries.id ? currentSeries.id.toString() : '';\n const markerColor = (currentSeries.color ?? '#000').toString();\n\n let datumIdx = -1;\n let xValue = 0;\n let yValue: number | null | undefined;\n for (let i = 0; i < currentDatasetValues.length; i++) {\n const tuple = currentDatasetValues[i];\n if (!tuple) continue;\n if (tuple[0] === closestTimestamp) {\n datumIdx = i;\n xValue = tuple[0];\n yValue = tuple[1];\n break;\n }\n }\n if (datumIdx === -1) continue;\n\n if (yValue === null || yValue === undefined) continue;\n\n let isCandidate = false;\n let visualY = yValue;\n let distance = Infinity;\n\n if (seriesType === 'line') {\n visualY = calculateVisualYForSeries(seriesIdx, yValue, seriesMapping, stackTotals);\n\n if (cursorPixelY !== undefined && yBufferPixels !== null) {\n try {\n const dataPointPixel = chart.convertToPixel({ seriesIndex: seriesIdx }, [datumIdx, visualY]);\n if (dataPointPixel && dataPointPixel[1] !== undefined) {\n const pixelDistance = Math.abs(cursorPixelY - dataPointPixel[1]);\n isCandidate = pixelDistance <= yBufferPixels;\n distance = pixelDistance;\n } else {\n const verticalDistance = Math.abs(visualY - cursorY);\n isCandidate = verticalDistance <= yBuffer;\n distance = verticalDistance;\n }\n } catch {\n const verticalDistance = Math.abs(visualY - cursorY);\n isCandidate = verticalDistance <= yBuffer;\n distance = verticalDistance;\n }\n } else {\n const verticalDistance = Math.abs(visualY - cursorY);\n isCandidate = verticalDistance <= yBuffer;\n distance = verticalDistance;\n }\n } else if (seriesType === 'bar') {\n if (cursorXPixel === null || barBandwidth === null || barCenterPixelX === null) continue;\n\n const barRelativeIdx = barSeriesIndexes.indexOf(seriesIdx);\n if (barRelativeIdx === -1) continue;\n\n const segmentBounds = calculateBarSegmentBounds(\n barRelativeIdx,\n barBandwidth,\n barCenterPixelX,\n barSeriesIndexes.length,\n );\n\n const isWithinXBounds = cursorXPixel >= segmentBounds.left && cursorXPixel <= segmentBounds.right;\n if (!isWithinXBounds) continue;\n\n const stackId = (currentSeries as BarSeriesOption).stack;\n let isHoveringYBounds = true;\n\n if (stackId) {\n const stackIdStr = stackId.toString();\n const visualYBottom = stackTotals.get(stackIdStr) ?? 0;\n visualY = calculateVisualYForSeries(seriesIdx, yValue, seriesMapping, stackTotals);\n const yBounds = calculateBarYBounds(visualYBottom, visualY, chart);\n\n if (yBounds) {\n const cursorYPixel = chart.convertToPixel('grid', [0, cursorY]);\n if (cursorYPixel && cursorYPixel[1] !== undefined) {\n isHoveringYBounds = cursorYPixel[1] >= yBounds.top && cursorYPixel[1] <= yBounds.bottom;\n }\n }\n } else {\n visualY = yValue;\n }\n\n if (!isHoveringYBounds) continue;\n\n const segmentCenter = (segmentBounds.left + segmentBounds.right) / 2;\n distance = Math.abs(cursorXPixel - segmentCenter);\n isCandidate = true;\n }\n\n if (isCandidate) {\n candidates.push({\n seriesIdx,\n datumIdx,\n seriesId,\n seriesName: currentSeriesName,\n date: closestTimestamp,\n markerColor,\n x: xValue,\n y: yValue,\n visualY,\n distance,\n });\n }\n }\n\n return candidates;\n}\n\nfunction findClosestCandidate(candidates: Candidate[]): Candidate | null {\n if (candidates.length === 0) return null;\n let winner: Candidate | null = null;\n for (const candidate of candidates) {\n if (winner === null || candidate.distance < winner.distance) {\n winner = candidate;\n }\n }\n return winner;\n}\n\nfunction processCandidates(\n candidates: Candidate[],\n winner: Candidate | null,\n format: FormatOptions | undefined,\n seriesFormatMap: Map<string, FormatOptions> | undefined,\n chart: EChartsInstance,\n nonCandidateSeriesIndexes: number[],\n): NearbySeriesArray {\n const nearbySeriesIndexes: number[] = [];\n const emphasizedSeriesIndexes: number[] = [];\n const nonEmphasizedSeriesIndexes: number[] = [...nonCandidateSeriesIndexes];\n const emphasizedDatapoints: DatapointInfo[] = [];\n const duplicateDatapoints: DatapointInfo[] = [];\n const yValueCounts: Map<number, number> = new Map();\n\n const result: NearbySeriesArray = [];\n\n for (const candidate of candidates) {\n const seriesFormat = seriesFormatMap?.get(candidate.seriesId) ?? format;\n // Use raw y, not visualY — visualY is for proximity detection only.\n const displayY = candidate.y;\n const formattedY = formatValue(displayY, seriesFormat);\n const isClosestToCursor = winner !== null && candidate.seriesIdx === winner.seriesIdx;\n\n if (isClosestToCursor) {\n emphasizedSeriesIndexes.push(candidate.seriesIdx);\n\n const duplicateValuesCount = yValueCounts.get(displayY) ?? 0;\n yValueCounts.set(displayY, duplicateValuesCount + 1);\n if (duplicateValuesCount > 0) {\n duplicateDatapoints.push({\n seriesIndex: candidate.seriesIdx,\n dataIndex: candidate.datumIdx,\n seriesName: candidate.seriesName,\n yValue: displayY,\n });\n }\n\n emphasizedDatapoints.push({\n seriesIndex: candidate.seriesIdx,\n dataIndex: candidate.datumIdx,\n seriesName: candidate.seriesName,\n yValue: displayY,\n });\n } else {\n nonEmphasizedSeriesIndexes.push(candidate.seriesIdx);\n }\n\n result.push({\n seriesIdx: candidate.seriesIdx,\n datumIdx: candidate.datumIdx,\n seriesName: candidate.seriesName,\n date: candidate.date,\n x: candidate.x,\n y: displayY,\n formattedY,\n markerColor: candidate.markerColor,\n isClosestToCursor,\n });\n\n nearbySeriesIndexes.push(candidate.seriesIdx);\n }\n\n batchDispatchNearbySeriesActions(\n chart,\n nearbySeriesIndexes,\n emphasizedSeriesIndexes,\n nonEmphasizedSeriesIndexes,\n emphasizedDatapoints,\n duplicateDatapoints,\n );\n\n return result;\n}\n\n/**\n * Returns formatted series data for the points that are close to the user's cursor.\n * Adjust xBuffer and yBuffer to increase or decrease number of series shown.\n */\nexport function checkforNearbyTimeSeries(\n data: TimeSeries[],\n seriesMapping: TimeChartSeriesMapping,\n pointInGrid: number[],\n yBuffer: number,\n chart: EChartsInstance,\n format?: FormatOptions,\n seriesFormatMap?: Map<string, FormatOptions>,\n // in the case of multi-axis, we need the cursor Y position in pixel space\n cursorPixelY?: number,\n cursorXPixel?: number | null,\n): NearbySeriesArray {\n const cursorX: number | null = pointInGrid[0] ?? null;\n const cursorY: number | null = pointInGrid[1] ?? null;\n\n if (cursorX === null || cursorY === null) return EMPTY_TOOLTIP_DATA;\n if (chart.dispatchAction === undefined) return EMPTY_TOOLTIP_DATA;\n if (!Array.isArray(data)) return EMPTY_TOOLTIP_DATA;\n\n // All series share the same x-axis timestamps (enforced by getCommonTimeScale).\n const firstTimeSeriesValues = data[0]?.values;\n const closestTimestamp = getClosestTimestamp(firstTimeSeriesValues, cursorX);\n if (closestTimestamp === null) return EMPTY_TOOLTIP_DATA;\n\n let yBufferPixels: number | null = null;\n if (cursorPixelY !== undefined) {\n const cursorPoint = chart.convertToPixel('grid', [0, cursorY]);\n const bufferPoint = chart.convertToPixel('grid', [0, cursorY + yBuffer]);\n if (cursorPoint && bufferPoint && cursorPoint[1] !== undefined && bufferPoint[1] !== undefined) {\n yBufferPixels = Math.abs(bufferPoint[1] - cursorPoint[1]);\n }\n }\n\n const resolvedCursorXPixel = cursorXPixel ?? getPixelXFromGrid(closestTimestamp, chart);\n\n const candidates = gatherCandidates(\n data,\n seriesMapping,\n closestTimestamp,\n cursorX,\n cursorY,\n resolvedCursorXPixel,\n cursorPixelY,\n yBuffer,\n yBufferPixels,\n chart,\n );\n\n const winner = findClosestCandidate(candidates);\n\n const candidateIndexes = new Set<number>();\n for (const candidate of candidates) candidateIndexes.add(candidate.seriesIdx);\n const nonCandidateSeriesIndexes: number[] = [];\n for (let idx = 0; idx < data.length; idx++) {\n if (!candidateIndexes.has(idx)) nonCandidateSeriesIndexes.push(idx);\n }\n\n return processCandidates(candidates, winner, format, seriesFormatMap, chart, nonCandidateSeriesIndexes);\n}\n\n/**\n * [DEPRECATED] Returns formatted series data for the points that are close to the user's cursor\n * Adjust yBuffer to increase or decrease number of series shown\n */\nexport function legacyCheckforNearbySeries(\n data: EChartsDataFormat,\n pointInGrid: number[],\n yBuffer: number,\n chart?: EChartsInstance,\n format?: FormatOptions,\n): NearbySeriesArray {\n const currentNearbySeriesData: NearbySeriesArray = [];\n const cursorX: number | null = pointInGrid[0] ?? null;\n const cursorY: number | null = pointInGrid[1] ?? null;\n\n if (cursorX === null || cursorY === null) {\n return currentNearbySeriesData;\n }\n\n const nearbySeriesIndexes: number[] = [];\n const emphasizedSeriesIndexes: number[] = [];\n const nonEmphasizedSeriesIndexes: number[] = [];\n const totalSeries = data.timeSeries.length;\n if (Array.isArray(data.xAxis) && Array.isArray(data.timeSeries)) {\n for (let seriesIdx = 0; seriesIdx < totalSeries; seriesIdx++) {\n const currentSeries = data.timeSeries[seriesIdx];\n if (currentSeries === undefined) break;\n if (currentNearbySeriesData.length >= OPTIMIZED_MODE_SERIES_LIMIT) break;\n\n const currentSeriesName = currentSeries.name ? currentSeries.name.toString() : '';\n const markerColor = currentSeries.color ?? '#000';\n if (Array.isArray(currentSeries.data)) {\n for (let datumIdx = 0; datumIdx < currentSeries.data.length; datumIdx++) {\n const xValue = data.xAxis[datumIdx] ?? 0;\n const yValue = currentSeries.data[datumIdx];\n // ensure null values not displayed in tooltip\n if (yValue !== undefined && yValue !== null && cursorX === datumIdx) {\n if (yValue !== '-' && cursorY <= yValue + yBuffer && cursorY >= yValue - yBuffer) {\n // show fewer bold series in tooltip when many total series\n const minPercentRange = totalSeries > SHOW_FEWER_SERIES_LIMIT ? 2 : 5;\n const percentRangeToCheck = Math.max(minPercentRange, 100 / totalSeries);\n const isClosestToCursor = isWithinPercentageRange({\n valueToCheck: cursorY,\n baseValue: yValue,\n percentage: percentRangeToCheck,\n });\n if (isClosestToCursor) {\n emphasizedSeriesIndexes.push(seriesIdx);\n } else {\n nonEmphasizedSeriesIndexes.push(seriesIdx);\n // ensure series not close to cursor are not highlighted\n if (chart?.dispatchAction !== undefined) {\n chart.dispatchAction({\n type: 'downplay',\n seriesIndex: seriesIdx,\n });\n }\n }\n\n // determine whether to convert timestamp to ms, see: https://stackoverflow.com/a/23982005/17575201\n const xValueMilliSeconds = xValue > 99999999999 ? xValue : xValue * 1000;\n const formattedY = formatValue(yValue, format);\n currentNearbySeriesData.push({\n seriesIdx: seriesIdx,\n datumIdx: datumIdx,\n seriesName: currentSeriesName,\n date: xValueMilliSeconds,\n x: xValue,\n y: yValue,\n formattedY: formattedY,\n markerColor: markerColor.toString(),\n isClosestToCursor,\n });\n nearbySeriesIndexes.push(seriesIdx);\n }\n }\n }\n }\n }\n }\n if (chart?.dispatchAction !== undefined) {\n // Clears emphasis state of all lines that are not emphasized.\n // Emphasized is a subset of just the nearby series that are closest to cursor.\n chart.dispatchAction({\n type: 'downplay',\n seriesIndex: nonEmphasizedSeriesIndexes,\n });\n\n // https://echarts.apache.org/en/api.html#action.highlight\n if (emphasizedSeriesIndexes.length > 0) {\n // Fadeout opacity of all series not closest to cursor.\n chart.dispatchAction({\n type: 'highlight',\n seriesIndex: emphasizedSeriesIndexes,\n notBlur: false, // ensure blur IS triggered, this is default but setting so it is explicit\n escapeConnect: true, // shared crosshair should not emphasize series on adjacent charts\n });\n } else {\n // When no emphasized series with bold text, notBlur allows opacity fadeout to not trigger.\n chart.dispatchAction({\n type: 'highlight',\n seriesIndex: nearbySeriesIndexes,\n notBlur: true, // do not trigger blur state when cursor is not immediately close to any series\n escapeConnect: true, // shared crosshair should not emphasize series on adjacent charts\n });\n }\n }\n\n return currentNearbySeriesData;\n}\n\n/**\n * Uses mouse position to determine whether user is hovering over a chart canvas\n * If yes, convert from pixel values to logical cartesian coordinates and return all nearby series\n */\nexport function getNearbySeriesData({\n mousePos,\n pinnedPos,\n data,\n seriesMapping,\n chart,\n format,\n seriesFormatMap,\n showAllSeries = false,\n}: {\n mousePos: CursorData['coords'];\n pinnedPos: CursorCoordinates | null;\n data: TimeSeries[];\n seriesMapping: TimeChartSeriesMapping;\n chart?: EChartsInstance;\n format?: FormatOptions;\n seriesFormatMap?: Map<string, FormatOptions>;\n showAllSeries?: boolean;\n}): NearbySeriesArray {\n if (chart === undefined || mousePos === null) return EMPTY_TOOLTIP_DATA;\n\n // prevents multiple tooltips showing from adjacent charts unless tooltip is pinned\n let cursorTargetMatchesChart = false;\n if (mousePos.target !== null) {\n const currentParent = (<HTMLElement>mousePos.target).parentElement;\n if (currentParent !== null) {\n const currentGrandparent = currentParent.parentElement;\n if (currentGrandparent !== null) {\n const chartDom = chart.getDom();\n if (chartDom === currentGrandparent) {\n cursorTargetMatchesChart = true;\n }\n }\n }\n }\n\n // allows moving cursor inside tooltip without it fading away\n if (pinnedPos !== null) {\n mousePos = pinnedPos;\n cursorTargetMatchesChart = true;\n }\n\n if (cursorTargetMatchesChart === false || data === null || chart['_model'] === undefined) return EMPTY_TOOLTIP_DATA;\n\n if (mousePos.plotCanvas.x === undefined || mousePos.plotCanvas.y === undefined) return EMPTY_TOOLTIP_DATA;\n\n const cursorPixelY = mousePos.plotCanvas.y;\n const cursorXPixel = mousePos.plotCanvas.x;\n const pointInGrid = getPointInGrid(cursorXPixel, cursorPixelY, chart);\n if (pointInGrid !== null) {\n const chartModel = chart['_model'];\n const yAxisScale = chartModel.getComponent('yAxis').axis.scale;\n const isLogScale = yAxisScale.type === 'log';\n let yInterval = yAxisScale._interval;\n // For log scales, convert from log-space extent to actual data range and use 1% as the interval.\n if (isLogScale && yAxisScale.base) {\n const logBase = yAxisScale.base;\n const extent = yAxisScale._extent;\n // e.g. extent [0, 2] → 10^0..10^2\n const actualMin = logBase ** extent[0];\n const actualMax = logBase ** extent[1];\n yInterval = (actualMax - actualMin) / 100;\n }\n const totalSeries = data.length;\n const yBuffer = getYBuffer({ yInterval, totalSeries, showAllSeries });\n\n const hasMultipleYAxes = seriesMapping.some((series) => series.yAxisIndex !== undefined && series.yAxisIndex > 0);\n\n return checkforNearbyTimeSeries(\n data,\n seriesMapping,\n pointInGrid,\n yBuffer,\n chart,\n format,\n seriesFormatMap,\n hasMultipleYAxes ? cursorPixelY : undefined,\n cursorXPixel,\n );\n }\n\n // no nearby series found\n return EMPTY_TOOLTIP_DATA;\n}\n\n/*\n * Check if two numbers are within a specified percentage range\n */\nexport function isWithinPercentageRange({\n valueToCheck,\n baseValue,\n percentage,\n}: IsWithinPercentageRangeParams): boolean {\n const range = (percentage / 100) * baseValue;\n const lowerBound = baseValue - range;\n const upperBound = baseValue + range;\n return valueToCheck >= lowerBound && valueToCheck <= upperBound;\n}\n\n/*\n * Get range to check within for nearby series to show in tooltip.\n */\nexport function getYBuffer({ yInterval, totalSeries, showAllSeries = false }: GetYBufferParams): number {\n if (showAllSeries) {\n return yInterval * 10; // roughly correlates with grid so entire canvas is searched\n }\n // never let nearby series range be less than roughly the size of a single tick\n const yBufferMin = yInterval * 0.3;\n\n // tooltip trigger area gets smaller with more series\n if (totalSeries > SHOW_FEWER_SERIES_LIMIT) {\n const adjustedBuffer = (yInterval * DYNAMIC_NEARBY_SERIES_MULTIPLIER) / totalSeries;\n return Math.max(yBufferMin, adjustedBuffer);\n }\n // increase multiplier to expand nearby series range\n return Math.max(yBufferMin, yInterval * INCREASE_NEARBY_SERIES_MULTIPLIER);\n}\n"],"names":["OPTIMIZED_MODE_SERIES_LIMIT","formatValue","batchDispatchNearbySeriesActions","getPointInGrid","getClosestTimestamp","EMPTY_TOOLTIP_DATA","calculateBarBandwidth","calculateBarSegmentBounds","calculateBarYBounds","calculateVisualYForSeries","getPixelXFromGrid","INCREASE_NEARBY_SERIES_MULTIPLIER","DYNAMIC_NEARBY_SERIES_MULTIPLIER","SHOW_FEWER_SERIES_LIMIT","gatherCandidates","data","seriesMapping","closestTimestamp","cursorX","cursorY","cursorXPixel","cursorPixelY","yBuffer","yBufferPixels","chart","candidates","totalSeries","length","stackTotals","Map","sortedTimestamps","firstValues","values","seen","Set","ts","has","add","push","toSorted","a","b","barSeriesIndexes","i","type","barBandwidth","barCenterPixelX","seriesIdx","currentSeries","currentDataset","currentDatasetValues","Array","isArray","seriesType","currentSeriesName","name","toString","seriesId","id","markerColor","color","datumIdx","xValue","yValue","tuple","undefined","isCandidate","visualY","distance","Infinity","dataPointPixel","convertToPixel","seriesIndex","pixelDistance","Math","abs","verticalDistance","barRelativeIdx","indexOf","segmentBounds","isWithinXBounds","left","right","stackId","stack","isHoveringYBounds","stackIdStr","visualYBottom","get","yBounds","cursorYPixel","top","bottom","segmentCenter","seriesName","date","x","y","findClosestCandidate","winner","candidate","processCandidates","format","seriesFormatMap","nonCandidateSeriesIndexes","nearbySeriesIndexes","emphasizedSeriesIndexes","nonEmphasizedSeriesIndexes","emphasizedDatapoints","duplicateDatapoints","yValueCounts","result","seriesFormat","displayY","formattedY","isClosestToCursor","duplicateValuesCount","set","dataIndex","checkforNearbyTimeSeries","pointInGrid","dispatchAction","firstTimeSeriesValues","cursorPoint","bufferPoint","resolvedCursorXPixel","candidateIndexes","idx","legacyCheckforNearbySeries","currentNearbySeriesData","timeSeries","xAxis","minPercentRange","percentRangeToCheck","max","isWithinPercentageRange","valueToCheck","baseValue","percentage","xValueMilliSeconds","notBlur","escapeConnect","getNearbySeriesData","mousePos","pinnedPos","showAllSeries","cursorTargetMatchesChart","target","currentParent","parentElement","currentGrandparent","chartDom","getDom","plotCanvas","chartModel","yAxisScale","getComponent","axis","scale","isLogScale","yInterval","_interval","base","logBase","extent","_extent","actualMin","actualMax","getYBuffer","hasMultipleYAxes","some","series","yAxisIndex","range","low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D,OAAO,SAASkI,wBAAwB,EACtCC,YAAY,EACZC,SAAS,EACTC,UAAU,EACoB;IAC9B,MAAMmC,QAAQ,AAACnC,aAAa,MAAOD;IACnC,MAAMqC,aAAarC,YAAYoC;IAC/B,MAAME,aAAatC,YAAYoC;IAC/B,OAAOrC,gBAAgBsC,cAActC,gBAAgBuC;AACvD;AAEA;;CAEC,GACD,OAAO,SAASP,WAAW,EAAER,SAAS,EAAEtI,WAAW,EAAEuH,gBAAgB,KAAK,EAAoB;IAC5F,IAAIA,eAAe;QACjB,OAAOe,YAAY,IAAI,4DAA4D;IACrF;IACA,+EAA+E;IAC/E,MAAMgB,aAAahB,YAAY;IAE/B,qDAAqD;IACrD,IAAItI,cAAcb,yBAAyB;QACzC,MAAMoK,iBAAiB,AAACjB,YAAYpJ,mCAAoCc;QACxE,OAAOgD,KAAK4D,GAAG,CAAC0C,YAAYC;IAC9B;IACA,oDAAoD;IACpD,OAAOvG,KAAK4D,GAAG,CAAC0C,YAAYhB,YAAYrJ;AAC1C"}
@@ -58,7 +58,7 @@ type ZREventProperties = {
58
58
  zrByTouch?: boolean;
59
59
  };
60
60
  export type ZRRawMouseEvent = MouseEvent & ZREventProperties;
61
- export declare const useMousePosition: () => CursorData["coords"];
61
+ export declare const useMousePosition: () => CursorData['coords'];
62
62
  export type TooltipConfig = {
63
63
  wrapLabels: boolean;
64
64
  hidden?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip-model.d.ts","sourceRoot":"","sources":["../../src/TimeSeriesTooltip/tooltip-model.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,eAAO,MAAM,iBAAiB,MAAM,CAAC;AACrC,eAAO,MAAM,iBAAiB,MAAM,CAAC;AACrC,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC,eAAO,MAAM,wBAAwB,QAA0B,CAAC;AAChE,eAAO,MAAM,+BAA+B,OAAO,CAAC;AACpD,eAA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CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,UAAU,CAAC;IACnB,UAAU,EAAE,YAAY,CAAC;IACzB,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,aAAa,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACxC,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,KAAK,iBAAiB,GAAG;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,cAAc,GAAG,gBAAgB,CAAC;IACnD,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,iBAAiB,CAAC;AAE7D,eAAO,MAAM,gBAAgB,QAAO,UAAU,CAAC,QAAQ,CAkCtD,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,aAGpC,CAAC;AAEF,eAAO,MAAM,qBAAqB,uBAAuB,CAAC;AAE1D,eAAO,MAAM,uBAAuB,yBAAyB,CAAC"}
@@ -1,8 +1,8 @@
1
- export declare const legendPositions: readonly ["bottom", "right"];
1
+ export declare const legendPositions: readonly ['bottom', 'right'];
2
2
  export type LegendPositions = (typeof legendPositions)[number];
3
- export declare const legendModes: readonly ["list", "table"];
3
+ export declare const legendModes: readonly ['list', 'table'];
4
4
  export type LegendMode = (typeof legendModes)[number];
5
- export declare const legendSizes: readonly ["small", "medium"];
5
+ export declare const legendSizes: readonly ['small', 'medium'];
6
6
  export type LegendSize = (typeof legendSizes)[number];
7
7
  export interface LegendOptionsBase {
8
8
  position: LegendPositions;
@@ -1 +1 @@
1
- {"version":3,"file":"legend.d.ts","sourceRoot":"","sources":["../../src/model/legend.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,eAAe,8BAA+B,CAAC;AAC5D,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D,eAAO,MAAM,WAAW,4BAA6B,CAAC;AACtD,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD,eAAO,MAAM,WAAW,8BAA+B,CAAC;AACxD,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAGtD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,eAAe,CAAC;IAC1B,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAExE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAE3D;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAE3D;AAED,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,iBAAiB,CAItD,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,QAAQ,CAAC,EAAE,eAAe,GAAG,QAAQ,GAAG,OAAO,CAQhF;AAED,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,OAAO,CAMjE;AAED,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,UA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":["../../src/model/temperature.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAK3D,KAAK,gBAAgB,GAAG,SAAS,GAAG,YAAY,CAAC;AAEjD,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,gBAAgB,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,eAGtC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE,UAAU,CAAC,CASlF,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,OAAO,MAAM,EAAE,yBAAyB,wBAAwB,KAAG,MAwBpG,CAAC"}
1
+ {"version":3,"file":"temperature.d.ts","sourceRoot":"","sources":["../../src/model/temperature.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAK3D,KAAK,gBAAgB,GAAG,SAAS,GAAG,YAAY,CAAC;AAEjD,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,gBAAgB,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,eAGtC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE,UAAU,CAAC,CASlF,CAAC;AAEF,eAAO,MAAM,iBAAiB,UAAW,MAAM,2BAA2B,wBAAwB,KAAG,MAwBpG,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"transforms.d.ts","sourceRoot":"","sources":["../../src/model/transforms.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,mBAAmB,C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qB,CAAC;IAC5B,IAAI,EAAE,mBAAmB,GAAG;QAC1B,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,kBAAkB,GAAG,eAAe,CAAC;QAChE,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,mBAAmB,GAAG;QAC1B,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,qBAAqB,CAAC;IAC5B,IAAI,EAAE,mBAAmB,GAAG;QAC1B,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,mBAAmB,CAAC;CAC3B;AAED,MAAM,MAAM,SAAS,GACjB,0BAA0B,GAC1B,qBAAqB,GACrB,4BAA4B,GAC5B,oBAAoB,GACpB,4BAA4B,CAAC;AAGjC,eAAO,MAAM,cAAc;IACzB,iBAAiB;IACjB,YAAY;IACZ,mBAAmB;IACnB,WAAW;IACX,mBAAmB;CACpB,CAAC"}
@@ -17,67 +17,67 @@ import type { UnitGroup, UnitGroupConfig, UnitConfig } from './types';
17
17
  */
18
18
  export declare const UNIT_GROUP_CONFIG: Readonly<Record<UnitGroup, UnitGroupConfig>>;
19
19
  export declare const UNIT_CONFIG: {
20
- readonly "datetime-local": UnitConfig;
21
- readonly "datetime-iso": UnitConfig;
22
- readonly "datetime-us": UnitConfig;
23
- readonly "date-iso": UnitConfig;
24
- readonly "date-us": UnitConfig;
25
- readonly "date-local": UnitConfig;
26
- readonly "time-local": UnitConfig;
27
- readonly "time-iso": UnitConfig;
28
- readonly "time-us": UnitConfig;
29
- readonly "relative-time": UnitConfig;
30
- readonly "unix-timestamp": UnitConfig;
31
- readonly "unix-timestamp-ms": UnitConfig;
32
- readonly celsius: UnitConfig;
33
- readonly fahrenheit: UnitConfig;
20
+ readonly "%": UnitConfig;
34
21
  readonly aud: UnitConfig;
22
+ readonly bits: UnitConfig;
23
+ readonly "bits/sec": UnitConfig;
24
+ readonly bytes: UnitConfig;
25
+ readonly "bytes/sec": UnitConfig;
35
26
  readonly cad: UnitConfig;
27
+ readonly celsius: UnitConfig;
36
28
  readonly chf: UnitConfig;
37
29
  readonly cny: UnitConfig;
30
+ readonly "counts/sec": UnitConfig;
31
+ readonly "date-iso": UnitConfig;
32
+ readonly "date-local": UnitConfig;
33
+ readonly "date-us": UnitConfig;
34
+ readonly "datetime-iso": UnitConfig;
35
+ readonly "datetime-local": UnitConfig;
36
+ readonly "datetime-us": UnitConfig;
37
+ readonly days: UnitConfig;
38
+ readonly decbits: UnitConfig;
39
+ readonly "decbits/sec": UnitConfig;
40
+ readonly decbytes: UnitConfig;
41
+ readonly "decbytes/sec": UnitConfig;
42
+ readonly decimal: UnitConfig;
38
43
  readonly eur: UnitConfig;
44
+ readonly "events/sec": UnitConfig;
45
+ readonly fahrenheit: UnitConfig;
39
46
  readonly gbp: UnitConfig;
40
47
  readonly hkd: UnitConfig;
48
+ readonly hours: UnitConfig;
41
49
  readonly inr: UnitConfig;
42
50
  readonly jpy: UnitConfig;
43
51
  readonly krw: UnitConfig;
52
+ readonly "messages/sec": UnitConfig;
53
+ readonly microseconds: UnitConfig;
54
+ readonly milliseconds: UnitConfig;
55
+ readonly minutes: UnitConfig;
56
+ readonly months: UnitConfig;
57
+ readonly nanoseconds: UnitConfig;
44
58
  readonly nok: UnitConfig;
45
59
  readonly nzd: UnitConfig;
46
- readonly sek: UnitConfig;
47
- readonly sgd: UnitConfig;
48
- readonly usd: UnitConfig;
49
- readonly "bits/sec": UnitConfig;
50
- readonly "decbits/sec": UnitConfig;
51
- readonly "bytes/sec": UnitConfig;
52
- readonly "decbytes/sec": UnitConfig;
53
- readonly "counts/sec": UnitConfig;
54
- readonly "events/sec": UnitConfig;
55
- readonly "messages/sec": UnitConfig;
56
60
  readonly "ops/sec": UnitConfig;
57
61
  readonly "packets/sec": UnitConfig;
62
+ readonly percent: UnitConfig;
63
+ readonly "percent-decimal": UnitConfig;
58
64
  readonly "reads/sec": UnitConfig;
59
65
  readonly "records/sec": UnitConfig;
66
+ readonly "relative-time": UnitConfig;
60
67
  readonly "requests/sec": UnitConfig;
61
68
  readonly "rows/sec": UnitConfig;
69
+ readonly seconds: UnitConfig;
70
+ readonly sek: UnitConfig;
71
+ readonly sgd: UnitConfig;
72
+ readonly "time-iso": UnitConfig;
73
+ readonly "time-local": UnitConfig;
74
+ readonly "time-us": UnitConfig;
75
+ readonly "unix-timestamp": UnitConfig;
76
+ readonly "unix-timestamp-ms": UnitConfig;
77
+ readonly usd: UnitConfig;
78
+ readonly weeks: UnitConfig;
62
79
  readonly "writes/sec": UnitConfig;
63
- readonly bits: UnitConfig;
64
- readonly decbits: UnitConfig;
65
- readonly bytes: UnitConfig;
66
- readonly decbytes: UnitConfig;
67
- readonly decimal: UnitConfig;
68
- readonly percent: UnitConfig;
69
- readonly "percent-decimal": UnitConfig;
70
- readonly "%": UnitConfig;
71
80
  readonly years: UnitConfig;
72
- readonly months: UnitConfig;
73
- readonly weeks: UnitConfig;
74
- readonly days: UnitConfig;
75
- readonly hours: UnitConfig;
76
- readonly minutes: UnitConfig;
77
- readonly seconds: UnitConfig;
78
- readonly nanoseconds: UnitConfig;
79
- readonly microseconds: UnitConfig;
80
- readonly milliseconds: UnitConfig;
81
81
  };
82
82
  export type FormatOptions = TimeFormatOptions | PercentFormatOptions | DecimalFormatOptions | BytesFormatOptions | BitsFormatOptions | ThroughputFormatOptions | CurrencyFormatOptions | TemperatureFormatOptions | DateFormatOptions;
83
83
  type HasDecimalPlaces<UnitOpt> = UnitOpt extends {
@@ -1,3 +1,3 @@
1
1
  import type { PaletteMode, PaletteOptions } from '@mui/material';
2
- export declare const background: (mode: PaletteMode) => PaletteOptions["background"];
2
+ export declare const background: (mode: PaletteMode) => PaletteOptions['background'];
3
3
  //# sourceMappingURL=background.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"background.d.ts","sourceRoot":"","sources":["../../../src/theme/palette/background.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAIjE,eAAO,MAAM,UAAU,GAAI,MAAM,WAAW,KAAG,cAAc,CAAC,YAAY,CAwBzE,CAAC"}
1
+ {"version":3,"file":"background.d.ts","sourceRoot":"","sources":["../../../src/theme/palette/background.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAIjE,eAAO,MAAM,UAAU,SAAU,WAAW,KAAG,cAAc,CAAC,YAAY,CAwBzE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/theme/palette/error.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAI5E,eAAO,MAAM,KAAK,GAAI,MAAM,WAAW,KAAG,yBAYzC,CAAC"}
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/theme/palette/error.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAI5E,eAAO,MAAM,KAAK,SAAU,WAAW,KAAG,yBAYzC,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import type { PaletteOptions, PaletteMode } from '@mui/material';
2
- export declare const greyOption: (mode: PaletteMode) => PaletteOptions["grey"];
2
+ export declare const greyOption: (mode: PaletteMode) => PaletteOptions['grey'];
3
3
  //# sourceMappingURL=grey.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"grey.d.ts","sourceRoot":"","sources":["../../../src/theme/palette/grey.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAIjE,eAAO,MAAM,UAAU,GAAI,MAAM,WAAW,KAAG,cAAc,CAAC,MAAM,CA6BnE,CAAC"}
1
+ {"version":3,"file":"grey.d.ts","sourceRoot":"","sources":["../../../src/theme/palette/grey.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAIjE,eAAO,MAAM,UAAU,SAAU,WAAW,KAAG,cAAc,CAAC,MAAM,CA6BnE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"primary.d.ts","sourceRoot":"","sources":["../../../src/theme/palette/primary.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAI5E,eAAO,MAAM,OAAO,GAAI,MAAM,WAAW,KAAG,yBAY3C,CAAC"}
1
+ {"version":3,"file":"primary.d.ts","sourceRoot":"","sources":["../../../src/theme/palette/primary.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAI5E,eAAO,MAAM,OAAO,SAAU,WAAW,KAAG,yBAY3C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"secondary.d.ts","sourceRoot":"","sources":["../../../src/theme/palette/secondary.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5E,eAAO,MAAM,SAAS,GAAI,MAAM,WAAW,KAAG,yBAY7C,CAAC"}
1
+ {"version":3,"file":"secondary.d.ts","sourceRoot":"","sources":["../../../src/theme/palette/secondary.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5E,eAAO,MAAM,SAAS,SAAU,WAAW,KAAG,yBAY7C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"success.d.ts","sourceRoot":"","sources":["../../../src/theme/palette/success.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAI5E,eAAO,MAAM,OAAO,GAAI,MAAM,WAAW,KAAG,yBAY3C,CAAC"}
1
+ {"version":3,"file":"success.d.ts","sourceRoot":"","sources":["../../../src/theme/palette/success.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAI5E,eAAO,MAAM,OAAO,SAAU,WAAW,KAAG,yBAY3C,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import type { PaletteOptions, PaletteMode } from '@mui/material';
2
- export declare const text: (mode: PaletteMode) => PaletteOptions["text"];
2
+ export declare const text: (mode: PaletteMode) => PaletteOptions['text'];
3
3
  //# sourceMappingURL=text.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/theme/palette/text.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAIjE,eAAO,MAAM,IAAI,GAAI,MAAM,WAAW,KAAG,cAAc,CAAC,MAAM,CAsB7D,CAAC"}
1
+ {"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/theme/palette/text.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAIjE,eAAO,MAAM,IAAI,SAAU,WAAW,KAAG,cAAc,CAAC,MAAM,CAsB7D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"warning.d.ts","sourceRoot":"","sources":["../../../src/theme/palette/warning.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAI5E,eAAO,MAAM,OAAO,GAAI,MAAM,WAAW,KAAG,yBAY3C,CAAC"}
1
+ {"version":3,"file":"warning.d.ts","sourceRoot":"","sources":["../../../src/theme/palette/warning.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAI5E,eAAO,MAAM,OAAO,SAAU,WAAW,KAAG,yBAY3C,CAAC"}
@@ -0,0 +1,14 @@
1
+ // Copyright The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+
14
+ //# sourceMappingURL=fonts.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/theme/types/fonts.d.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\ndeclare module '@fontsource/inter/*.css';\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"}
@@ -1 +1 @@
1
- {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/utils/format.ts"],"names":[],"mappings":"AAgBA,wBAAgB,6BAA6B,CAC3C,iBAAiB,EAAE,IAAI,CAAC,qBAAqB,EAC7C,QAAQ,CAAC,EAAE,MAAM,GAChB,IAAI,CAAC,qBAAqB,CAgB5B;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAY9F;AAED,wBAAgB,YAAY,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CA0BtD;AAGD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GACjD,MAAM,GACN;IACE,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,wCAAwC,CAAC;IAC/C,GAAG,EAAE,WAAW,CAAC;CAClB,CA8BJ;AAED,UAAU,iBAAiB;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,cAAc,GACzB,SAAS,MAAM,EACf,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,KACpD,iBASF,CAAC"}
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/utils/format.ts"],"names":[],"mappings":"AAgBA,wBAAgB,6BAA6B,CAC3C,iBAAiB,EAAE,IAAI,CAAC,qBAAqB,EAC7C,QAAQ,CAAC,EAAE,MAAM,GAChB,IAAI,CAAC,qBAAqB,CAgB5B;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAY9F;AAED,wBAAgB,YAAY,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CA0BtD;AAGD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GACjD,MAAM,GACN;IACE,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,wCAAwC,CAAC;IAC/C,GAAG,EAAE,WAAW,CAAC;CAClB,CA8BJ;AAED,UAAU,iBAAiB;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,cAAc,YAChB,MAAM,iBACA,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,KACpD,iBASF,CAAC"}
@@ -35,7 +35,9 @@
35
35
  try {
36
36
  return new RegExp(pattern, flags);
37
37
  } catch (error) {
38
- throw new Error(`Failed to create RegExp ${error}`);
38
+ throw new Error(`Failed to create RegExp ${error}`, {
39
+ cause: error
40
+ });
39
41
  }
40
42
  }
41
43
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/regexp.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\n/**\n * Checks if a string is a regex pattern.\n */\nexport function isRegexPattern(input: string | null | undefined): boolean {\n return Boolean(input?.startsWith('/'));\n}\n\n/**\n * Converts a string to RegExp. Handles both regular strings and regex patterns.\n * For regular strings, creates exact match regex.\n * For patterns like \"/pattern/flags\", creates corresponding RegExp.\n */\nexport function createRegexFromString(input: string): RegExp {\n if (!input) {\n throw new Error('Input string cannot be empty');\n }\n\n if (!isRegexPattern(input)) {\n return new RegExp(`^${input}$`);\n }\n\n const regexPattern = /^\\/(.+)\\/([gimy]*)$/;\n const matches = input.match(regexPattern);\n\n if (!matches) {\n throw new Error(`Invalid regular expression format: ${input}`);\n }\n\n const [, pattern = '', flags = ''] = matches;\n\n try {\n return new RegExp(pattern, flags);\n } catch (error) {\n throw new Error(`Failed to create RegExp ${error}`);\n }\n}\n"],"names":["isRegexPattern","input","Boolean","startsWith","createRegexFromString","Error","RegExp","regexPattern","matches","match","pattern","flags","error"],"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;;CAEC,GACD,OAAO,SAASA,eAAeC,KAAgC;IAC7D,OAAOC,QAAQD,OAAOE,WAAW;AACnC;AAEA;;;;CAIC,GACD,OAAO,SAASC,sBAAsBH,KAAa;IACjD,IAAI,CAACA,OAAO;QACV,MAAM,IAAII,MAAM;IAClB;IAEA,IAAI,CAACL,eAAeC,QAAQ;QAC1B,OAAO,IAAIK,OAAO,CAAC,CAAC,EAAEL,MAAM,CAAC,CAAC;IAChC;IAEA,MAAMM,eAAe;IACrB,MAAMC,UAAUP,MAAMQ,KAAK,CAACF;IAE5B,IAAI,CAACC,SAAS;QACZ,MAAM,IAAIH,MAAM,CAAC,mCAAmC,EAAEJ,OAAO;IAC/D;IAEA,MAAM,GAAGS,UAAU,EAAE,EAAEC,QAAQ,EAAE,CAAC,GAAGH;IAErC,IAAI;QACF,OAAO,IAAIF,OAAOI,SAASC;IAC7B,EAAE,OAAOC,OAAO;QACd,MAAM,IAAIP,MAAM,CAAC,wBAAwB,EAAEO,OAAO;IACpD;AACF"}
1
+ {"version":3,"sources":["../../src/utils/regexp.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\n/**\n * Checks if a string is a regex pattern.\n */\nexport function isRegexPattern(input: string | null | undefined): boolean {\n return Boolean(input?.startsWith('/'));\n}\n\n/**\n * Converts a string to RegExp. Handles both regular strings and regex patterns.\n * For regular strings, creates exact match regex.\n * For patterns like \"/pattern/flags\", creates corresponding RegExp.\n */\nexport function createRegexFromString(input: string): RegExp {\n if (!input) {\n throw new Error('Input string cannot be empty');\n }\n\n if (!isRegexPattern(input)) {\n return new RegExp(`^${input}$`);\n }\n\n const regexPattern = /^\\/(.+)\\/([gimy]*)$/;\n const matches = input.match(regexPattern);\n\n if (!matches) {\n throw new Error(`Invalid regular expression format: ${input}`);\n }\n\n const [, pattern = '', flags = ''] = matches;\n\n try {\n return new RegExp(pattern, flags);\n } catch (error) {\n throw new Error(`Failed to create RegExp ${error}`, { cause: error });\n }\n}\n"],"names":["isRegexPattern","input","Boolean","startsWith","createRegexFromString","Error","RegExp","regexPattern","matches","match","pattern","flags","error","cause"],"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;;CAEC,GACD,OAAO,SAASA,eAAeC,KAAgC;IAC7D,OAAOC,QAAQD,OAAOE,WAAW;AACnC;AAEA;;;;CAIC,GACD,OAAO,SAASC,sBAAsBH,KAAa;IACjD,IAAI,CAACA,OAAO;QACV,MAAM,IAAII,MAAM;IAClB;IAEA,IAAI,CAACL,eAAeC,QAAQ;QAC1B,OAAO,IAAIK,OAAO,CAAC,CAAC,EAAEL,MAAM,CAAC,CAAC;IAChC;IAEA,MAAMM,eAAe;IACrB,MAAMC,UAAUP,MAAMQ,KAAK,CAACF;IAE5B,IAAI,CAACC,SAAS;QACZ,MAAM,IAAIH,MAAM,CAAC,mCAAmC,EAAEJ,OAAO;IAC/D;IAEA,MAAM,GAAGS,UAAU,EAAE,EAAEC,QAAQ,EAAE,CAAC,GAAGH;IAErC,IAAI;QACF,OAAO,IAAIF,OAAOI,SAASC;IAC7B,EAAE,OAAOC,OAAO;QACd,MAAM,IAAIP,MAAM,CAAC,wBAAwB,EAAEO,OAAO,EAAE;YAAEC,OAAOD;QAAM;IACrE;AACF"}
@@ -203,7 +203,7 @@
203
203
  }
204
204
  // Ordering data column alphabetically
205
205
  result = result.map((row)=>{
206
- return Object.keys(row).sort().reduce((obj, key)=>{
206
+ return Object.keys(row).toSorted().reduce((obj, key)=>{
207
207
  obj[key] = row[key];
208
208
  return obj;
209
209
  }, {});
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/transform-data.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 { Transform } from '../model';\n\n/*\n * Join: Regroup rows with equal cell value in a column.\n * If there are multiple line with same value, next row values override the current one\n *\n * Example: Join on 'mount' column\n * INPUT:\n * | timestamp | value #1 | value #3 | mount |\n * |------------|----------|----------|-----------|\n * | 1630000000 | 1 | | / |\n * | 1630000000 | 2 | | /boot/efi |\n * | 1630000000 | | 3 | / |\n * | 1630000000 | | 4 | /boot/efi |\n *\n * OUTPUT:\n * | timestamp | value #1 | value #3 | mount |\n * |------------|----------|----------|-----------|\n * | 1630000000 | 1 | 3 | / |\n * | 1630000000 | 2 | 4 | /boot/efi |\n */\nexport function applyJoinTransform(\n data: Array<Record<string, unknown>>,\n columns: string[],\n): Array<Record<string, unknown>> {\n // If column is undefined or empty, return data as is\n if (columns.length === 0) {\n return data;\n }\n\n const rowHashed: { [key: string]: Record<string, unknown> } = {};\n\n for (const row of data) {\n const rowHash = Object.keys(row)\n .filter((k) => columns.includes(k))\n .map((k) => row[k])\n .join('|');\n\n const rowHashedValue = rowHashed[rowHash];\n if (rowHashedValue) {\n rowHashed[rowHash] = { ...rowHashedValue, ...row };\n } else {\n rowHashed[rowHash] = { ...row };\n }\n }\n return Object.values(rowHashed);\n}\n\n/*\n * Merges selected columns into a single column.\n *\n * Example: Merge columns 'value #1' and 'value #2' into a single column 'MERGED'\n * INPUT:\n * +------------+----------+----------+-----------+-----------+\n * | timestamp | value #1 | value #2 | mount #1 | mount #2 |\n * +------------+----------+----------+-----------+-----------+\n * | 1630000000 | 1 | | / | |\n * | 1630000000 | 2 | | /boot/efi | |\n * | 1630000000 | | 3 | | / |\n * | 1630000000 | | 4 | | /boot/efi |\n * +------------+----------+----------+-----------+-----------+\n *\n * OUTPUT:\n * +------------+--------+-----------+-----------+\n * | timestamp | MERGED | mount #1 | mount #2 |\n * +------------+--------+-----------+-----------+\n * | 1630000000 | 1 | / | |\n * | 1630000000 | 2 | /boot/efi | |\n * | 1630000000 | 2 | | / |\n * | 1630000000 | 3 | | /boot/efi |\n * +------------+--------+-----------+-----------+\n */\nexport function applyMergeColumnsTransform(\n data: Array<Record<string, unknown>>,\n selectedColumns: string[],\n outputName: string,\n): Array<Record<string, unknown>> {\n const result: Array<Record<string, unknown>> = [];\n\n for (const row of data) {\n const columns = Object.keys(row).filter((k) => selectedColumns.includes(k));\n\n const selectedColumnValues: Record<string, unknown> = {};\n\n for (const column of columns) {\n selectedColumnValues[column] = row[column];\n delete row[column];\n }\n\n for (const column of columns) {\n result.push({ ...row, [outputName]: selectedColumnValues[column] });\n }\n\n if (columns.length === 0) {\n result.push(row);\n }\n }\n\n return result;\n}\n\n/*\n * Merge Indexed Columns: All indexed columns are merged to one column\n *\n * Example: Join on 'value' column\n * INPUT:\n * | timestamp #1 | timestamp #2 | value #1 | value #2 | instance #1 | instance #2 |\n * |--------------|--------------|----------|----------|-------------|-------------|\n * | 1630000000 | | 55 | | toto | |\n * | 1630000000 | | 33 | | toto | |\n * | 1630000000 | | 45 | | toto | |\n * | | 1630000000 | | 112 | | titi |\n * | | 1630000000 | | 20 | | titi |\n * | | 1630000000 | | 10 | | titi |\n *\n * OUTPUT:\n * | timestamp #1 | timestamp #2 | value | instance #1 | instance #2 |\n * |--------------|--------------|-------|-------------|-------------|\n * | 1630000000 | | 55 | toto | |\n * | 1630000000 | | 33 | toto | |\n * | 1630000000 | | 45 | toto | |\n * | | 1630000000 | 112 | | titi |\n * | | 1630000000 | 20 | | titi |\n * | | 1630000000 | 10 | | titi |\n */\nexport function applyMergeIndexedColumnsTransform(\n data: Array<Record<string, unknown>>,\n column: string,\n): Array<Record<string, unknown>> {\n const result: Array<Record<string, unknown>> = [];\n\n for (const entry of data) {\n const indexedColumns = Object.keys(entry).filter((k) =>\n new RegExp('^((' + column + ' #\\\\d+)|(' + column + '))$').test(k),\n );\n const indexedColumnValues: Record<string, unknown> = {};\n\n for (const indexedColumn of indexedColumns) {\n indexedColumnValues[indexedColumn] = entry[indexedColumn];\n delete entry[indexedColumn];\n }\n\n for (const indexedColumn of indexedColumns) {\n result.push({ ...entry, [column]: indexedColumnValues[indexedColumn] });\n }\n\n if (indexedColumns.length === 0) {\n result.push(entry);\n }\n }\n\n return result;\n}\n\n/*\n * Merge Indexed Columns: All indexed columns are merged to one column\n *\n * INPUT:\n * | timestamp | value #1 | value #2 | mount #1 | mount #2 | instance #1 | instance #2 | env #1 | env #2 |\n * |------------|----------|----------|-----------|-----------|-------------|-------------|--------|--------|\n * | 1630000000 | 1 | | / | | test:44 | | prd | |\n * | 1630000000 | 2 | | /boot/efi | | test:44 | | prd | |\n * | 1630000000 | | 5 | | / | | test:44 | | prd |\n * | 1630000000 | | 6 | | /boot/efi | | test:44 | | prd |\n *\n * OUTPUT:\n * | timestamp | value #1 | value #2 | mount | instance | env |\n * |------------|----------|----------|-----------|----------|-----|\n * | 1630000000 | 1 | 5 | / | test:44 | prd |\n * | 1630000000 | 2 | 6 | /boot/efi | test:44 | prd |\n */\nexport function applyMergeSeriesTransform(data: Array<Record<string, unknown>>): Array<Record<string, unknown>> {\n let result: Array<Record<string, unknown>> = [...data];\n\n const labelColumns = Array.from(\n new Set(\n data\n .flatMap(Object.keys)\n .map((label) => label.replace(/ #\\d+/, ''))\n .filter((label) => label !== 'value'),\n ),\n );\n\n for (const label of labelColumns) {\n result = applyMergeIndexedColumnsTransform(result, label);\n }\n\n result = applyJoinTransform(result, labelColumns);\n\n return result;\n}\n\n/*\n * Transforms query data with the given transforms\n */\nexport function transformData(\n data: Array<Record<string, unknown>>,\n transforms: Transform[],\n): Array<Record<string, unknown>> {\n let result: Array<Record<string, unknown>> = data;\n\n // Apply transforms by their orders\n for (const transform of transforms ?? []) {\n if (transform.spec.disabled) continue;\n\n switch (transform.kind) {\n case 'JoinByColumnValue': {\n if (transform.spec.columns && transform.spec.columns.length > 0) {\n result = applyJoinTransform(result, transform.spec.columns);\n }\n break;\n }\n case 'MergeIndexedColumns': {\n if (transform.spec.column) {\n result = applyMergeIndexedColumnsTransform(result, transform.spec.column);\n }\n break;\n }\n case 'MergeColumns': {\n if (transform.spec.columns && transform.spec.columns.length > 0 && transform.spec.name) {\n result = applyMergeColumnsTransform(result, transform.spec.columns, transform.spec.name);\n }\n break;\n }\n case 'MergeSeries': {\n result = applyMergeSeriesTransform(result);\n break;\n }\n }\n }\n\n // Ordering data column alphabetically\n result = result.map((row) => {\n return Object.keys(row)\n .sort()\n .reduce((obj: Record<string, unknown>, key: string) => {\n obj[key] = row[key];\n return obj;\n }, {});\n });\n return result;\n}\n"],"names":["applyJoinTransform","data","columns","length","rowHashed","row","rowHash","Object","keys","filter","k","includes","map","join","rowHashedValue","values","applyMergeColumnsTransform","selectedColumns","outputName","result","selectedColumnValues","column","push","applyMergeIndexedColumnsTransform","entry","indexedColumns","RegExp","test","indexedColumnValues","indexedColumn","applyMergeSeriesTransform","labelColumns","Array","from","Set","flatMap","label","replace","transformData","transforms","transform","spec","disabled","kind","name","sort","reduce","obj","key"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,SAASA,mBACdC,IAAoC,EACpCC,OAAiB;IAEjB,qDAAqD;IACrD,IAAIA,QAAQC,MAAM,KAAK,GAAG;QACxB,OAAOF;IACT;IAEA,MAAMG,YAAwD,CAAC;IAE/D,KAAK,MAAMC,OAAOJ,KAAM;QACtB,MAAMK,UAAUC,OAAOC,IAAI,CAACH,KACzBI,MAAM,CAAC,CAACC,IAAMR,QAAQS,QAAQ,CAACD,IAC/BE,GAAG,CAAC,CAACF,IAAML,GAAG,CAACK,EAAE,EACjBG,IAAI,CAAC;QAER,MAAMC,iBAAiBV,SAAS,CAACE,QAAQ;QACzC,IAAIQ,gBAAgB;YAClBV,SAAS,CAACE,QAAQ,GAAG;gBAAE,GAAGQ,cAAc;gBAAE,GAAGT,GAAG;YAAC;QACnD,OAAO;YACLD,SAAS,CAACE,QAAQ,GAAG;gBAAE,GAAGD,GAAG;YAAC;QAChC;IACF;IACA,OAAOE,OAAOQ,MAAM,CAACX;AACvB;AAEA;;;;;;;;;;;;;;;;;;;;;;;CAuBC,GACD,OAAO,SAASY,2BACdf,IAAoC,EACpCgB,eAAyB,EACzBC,UAAkB;IAElB,MAAMC,SAAyC,EAAE;IAEjD,KAAK,MAAMd,OAAOJ,KAAM;QACtB,MAAMC,UAAUK,OAAOC,IAAI,CAACH,KAAKI,MAAM,CAAC,CAACC,IAAMO,gBAAgBN,QAAQ,CAACD;QAExE,MAAMU,uBAAgD,CAAC;QAEvD,KAAK,MAAMC,UAAUnB,QAAS;YAC5Bk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AACC,KAA8BC;YACrCD,GAAG,CAACC,IAAI,GAAG3C,GAAG,CAAC2C,IAAI;YACnB,OAAOD;QACT,GAAG,CAAC;IACR;IACA,OAAO5B;AACT"}
1
+ {"version":3,"sources":["../../src/utils/transform-data.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 { Transform } from '../model';\n\n/*\n * Join: Regroup rows with equal cell value in a column.\n * If there are multiple line with same value, next row values override the current one\n *\n * Example: Join on 'mount' column\n * INPUT:\n * | timestamp | value #1 | value #3 | mount |\n * |------------|----------|----------|-----------|\n * | 1630000000 | 1 | | / |\n * | 1630000000 | 2 | | /boot/efi |\n * | 1630000000 | | 3 | / |\n * | 1630000000 | | 4 | /boot/efi |\n *\n * OUTPUT:\n * | timestamp | value #1 | value #3 | mount |\n * |------------|----------|----------|-----------|\n * | 1630000000 | 1 | 3 | / |\n * | 1630000000 | 2 | 4 | /boot/efi |\n */\nexport function applyJoinTransform(\n data: Array<Record<string, unknown>>,\n columns: string[],\n): Array<Record<string, unknown>> {\n // If column is undefined or empty, return data as is\n if (columns.length === 0) {\n return data;\n }\n\n const rowHashed: { [key: string]: Record<string, unknown> } = {};\n\n for (const row of data) {\n const rowHash = Object.keys(row)\n .filter((k) => columns.includes(k))\n .map((k) => row[k])\n .join('|');\n\n const rowHashedValue = rowHashed[rowHash];\n if (rowHashedValue) {\n rowHashed[rowHash] = { ...rowHashedValue, ...row };\n } else {\n rowHashed[rowHash] = { ...row };\n }\n }\n return Object.values(rowHashed);\n}\n\n/*\n * Merges selected columns into a single column.\n *\n * Example: Merge columns 'value #1' and 'value #2' into a single column 'MERGED'\n * INPUT:\n * +------------+----------+----------+-----------+-----------+\n * | timestamp | value #1 | value #2 | mount #1 | mount #2 |\n * +------------+----------+----------+-----------+-----------+\n * | 1630000000 | 1 | | / | |\n * | 1630000000 | 2 | | /boot/efi | |\n * | 1630000000 | | 3 | | / |\n * | 1630000000 | | 4 | | /boot/efi |\n * +------------+----------+----------+-----------+-----------+\n *\n * OUTPUT:\n * +------------+--------+-----------+-----------+\n * | timestamp | MERGED | mount #1 | mount #2 |\n * +------------+--------+-----------+-----------+\n * | 1630000000 | 1 | / | |\n * | 1630000000 | 2 | /boot/efi | |\n * | 1630000000 | 2 | | / |\n * | 1630000000 | 3 | | /boot/efi |\n * +------------+--------+-----------+-----------+\n */\nexport function applyMergeColumnsTransform(\n data: Array<Record<string, unknown>>,\n selectedColumns: string[],\n outputName: string,\n): Array<Record<string, unknown>> {\n const result: Array<Record<string, unknown>> = [];\n\n for (const row of data) {\n const columns = Object.keys(row).filter((k) => selectedColumns.includes(k));\n\n const selectedColumnValues: Record<string, unknown> = {};\n\n for (const column of columns) {\n selectedColumnValues[column] = row[column];\n delete row[column];\n }\n\n for (const column of columns) {\n result.push({ ...row, [outputName]: selectedColumnValues[column] });\n }\n\n if (columns.length === 0) {\n result.push(row);\n }\n }\n\n return result;\n}\n\n/*\n * Merge Indexed Columns: All indexed columns are merged to one column\n *\n * Example: Join on 'value' column\n * INPUT:\n * | timestamp #1 | timestamp #2 | value #1 | value #2 | instance #1 | instance #2 |\n * |--------------|--------------|----------|----------|-------------|-------------|\n * | 1630000000 | | 55 | | toto | |\n * | 1630000000 | | 33 | | toto | |\n * | 1630000000 | | 45 | | toto | |\n * | | 1630000000 | | 112 | | titi |\n * | | 1630000000 | | 20 | | titi |\n * | | 1630000000 | | 10 | | titi |\n *\n * OUTPUT:\n * | timestamp #1 | timestamp #2 | value | instance #1 | instance #2 |\n * |--------------|--------------|-------|-------------|-------------|\n * | 1630000000 | | 55 | toto | |\n * | 1630000000 | | 33 | toto | |\n * | 1630000000 | | 45 | toto | |\n * | | 1630000000 | 112 | | titi |\n * | | 1630000000 | 20 | | titi |\n * | | 1630000000 | 10 | | titi |\n */\nexport function applyMergeIndexedColumnsTransform(\n data: Array<Record<string, unknown>>,\n column: string,\n): Array<Record<string, unknown>> {\n const result: Array<Record<string, unknown>> = [];\n\n for (const entry of data) {\n const indexedColumns = Object.keys(entry).filter((k) =>\n new RegExp('^((' + column + ' #\\\\d+)|(' + column + '))$').test(k),\n );\n const indexedColumnValues: Record<string, unknown> = {};\n\n for (const indexedColumn of indexedColumns) {\n indexedColumnValues[indexedColumn] = entry[indexedColumn];\n delete entry[indexedColumn];\n }\n\n for (const indexedColumn of indexedColumns) {\n result.push({ ...entry, [column]: indexedColumnValues[indexedColumn] });\n }\n\n if (indexedColumns.length === 0) {\n result.push(entry);\n }\n }\n\n return result;\n}\n\n/*\n * Merge Indexed Columns: All indexed columns are merged to one column\n *\n * INPUT:\n * | timestamp | value #1 | value #2 | mount #1 | mount #2 | instance #1 | instance #2 | env #1 | env #2 |\n * |------------|----------|----------|-----------|-----------|-------------|-------------|--------|--------|\n * | 1630000000 | 1 | | / | | test:44 | | prd | |\n * | 1630000000 | 2 | | /boot/efi | | test:44 | | prd | |\n * | 1630000000 | | 5 | | / | | test:44 | | prd |\n * | 1630000000 | | 6 | | /boot/efi | | test:44 | | prd |\n *\n * OUTPUT:\n * | timestamp | value #1 | value #2 | mount | instance | env |\n * |------------|----------|----------|-----------|----------|-----|\n * | 1630000000 | 1 | 5 | / | test:44 | prd |\n * | 1630000000 | 2 | 6 | /boot/efi | test:44 | prd |\n */\nexport function applyMergeSeriesTransform(data: Array<Record<string, unknown>>): Array<Record<string, unknown>> {\n let result: Array<Record<string, unknown>> = [...data];\n\n const labelColumns = Array.from(\n new Set(\n data\n .flatMap(Object.keys)\n .map((label) => label.replace(/ #\\d+/, ''))\n .filter((label) => label !== 'value'),\n ),\n );\n\n for (const label of labelColumns) {\n result = applyMergeIndexedColumnsTransform(result, label);\n }\n\n result = applyJoinTransform(result, labelColumns);\n\n return result;\n}\n\n/*\n * Transforms query data with the given transforms\n */\nexport function transformData(\n data: Array<Record<string, unknown>>,\n transforms: Transform[],\n): Array<Record<string, unknown>> {\n let result: Array<Record<string, unknown>> = data;\n\n // Apply transforms by their orders\n for (const transform of transforms ?? []) {\n if (transform.spec.disabled) continue;\n\n switch (transform.kind) {\n case 'JoinByColumnValue': {\n if (transform.spec.columns && transform.spec.columns.length > 0) {\n result = applyJoinTransform(result, transform.spec.columns);\n }\n break;\n }\n case 'MergeIndexedColumns': {\n if (transform.spec.column) {\n result = applyMergeIndexedColumnsTransform(result, transform.spec.column);\n }\n break;\n }\n case 'MergeColumns': {\n if (transform.spec.columns && transform.spec.columns.length > 0 && transform.spec.name) {\n result = applyMergeColumnsTransform(result, transform.spec.columns, transform.spec.name);\n }\n break;\n }\n case 'MergeSeries': {\n result = applyMergeSeriesTransform(result);\n break;\n }\n }\n }\n\n // Ordering data column alphabetically\n result = result.map((row) => {\n return Object.keys(row)\n .toSorted()\n .reduce((obj: Record<string, unknown>, key: string) => {\n obj[key] = row[key];\n return obj;\n }, {});\n });\n return result;\n}\n"],"names":["applyJoinTransform","data","columns","length","rowHashed","row","rowHash","Object","keys","filter","k","includes","map","join","rowHashedValue","values","applyMergeColumnsTransform","selectedColumns","outputName","result","selectedColumnValues","column","push","applyMergeIndexedColumnsTransform","entry","indexedColumns","RegExp","test","indexedColumnValues","indexedColumn","applyMergeSeriesTransform","labelColumns","Array","from","Set","flatMap","label","replace","transformData","transforms","transform","spec","disabled","kind","name","toSorted","reduce","obj","key"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,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nC,KAAK,MAAMuC,aAAaD,cAAc,EAAE,CAAE;QACxC,IAAIC,UAAUC,IAAI,CAACC,QAAQ,EAAE;QAE7B,OAAQF,UAAUG,IAAI;YACpB,KAAK;gBAAqB;oBACxB,IAAIH,UAAUC,IAAI,CAACvC,OAAO,IAAIsC,UAAUC,IAAI,CAACvC,OAAO,CAACC,MAAM,GAAG,GAAG;wBAC/DgB,SAASnB,mBAAmBmB,QAAQqB,UAAUC,IAAI,CAACvC,OAAO;oBAC5D;oBACA;gBACF;YACA,KAAK;gBAAuB;oBAC1B,IAAIsC,UAAUC,IAAI,CAACpB,MAAM,EAAE;wBACzBF,SAASI,kCAAkCJ,QAAQqB,UAAUC,IAAI,CAACpB,MAAM;oBAC1E;oBACA;gBACF;YACA,KAAK;gBAAgB;oBACnB,IAAImB,UAAUC,IAAI,CAACvC,OAAO,IAAIsC,UAAUC,IAAI,CAACvC,OAAO,CAACC,MAAM,GAAG,KAAKqC,UAAUC,IAAI,CAACG,IAAI,EAAE;wBACtFzB,SAASH,2BAA2BG,QAAQqB,UAAUC,IAAI,CAACvC,OAAO,EAAEsC,UAAUC,IAAI,CAACG,IAAI;oBACzF;oBACA;gBACF;YACA,KAAK;gBAAe;oBAClBzB,SAASW,0BAA0BX;oBACnC;gBACF;QACF;IACF;IAEA,sCAAsC;IACtCA,SAASA,OAAOP,GAAG,CAAC,CAACP;QACnB,OAAOE,OAAOC,IAAI,CAACH,KAChBwC,QAAQ,GACRC,MAAM,CAAC,CAACC,KAA8BC;YACrCD,GAAG,CAACC,IAAI,GAAG3C,GAAG,CAAC2C,IAAI;YACnB,OAAOD;QACT,GAAG,CAAC;IACR;IACA,OAAO5B;AACT"}
@@ -170,7 +170,7 @@ const VARIABLE_REGEX = /\$(\w+)|\${(\w+)(?:\.([^:^}]+))?(?::([^}]+))?}/gm;
170
170
  variables// Sorting variables by their length.
171
171
  // In order to not have a variable name have contained in another variable name.
172
172
  // i.e.: $__range replacing $__range_ms => '3600_ms' instead of '3600000'
173
- .sort((a, b)=>b.length - a.length).forEach((v)=>{
173
+ .toSorted((a, b)=>b.length - a.length).forEach((v)=>{
174
174
  const variable = variableState[v];
175
175
  if (variable && variable.value !== undefined) {
176
176
  finalText = replaceVariable(finalText, v, variable?.value, variablesMap.get(v));