@parca/profile 0.16.351 → 0.16.353

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 (55) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/Callgraph/index.d.ts +1 -0
  3. package/dist/GraphTooltip/ExpandOnHoverValue.d.ts +1 -0
  4. package/dist/GraphTooltip/index.d.ts +1 -0
  5. package/dist/GraphTooltipArrow/DockedGraphTooltip/index.d.ts +1 -0
  6. package/dist/GraphTooltipArrow/ExpandOnHoverValue.d.ts +1 -0
  7. package/dist/MatchersInput/SuggestionItem.d.ts +1 -0
  8. package/dist/MatchersInput/SuggestionsList.d.ts +1 -0
  9. package/dist/MatchersInput/index.d.ts +1 -0
  10. package/dist/MetricsCircle/index.d.ts +1 -0
  11. package/dist/MetricsGraph/MetricsContextMenu/index.d.ts +1 -0
  12. package/dist/MetricsGraph/MetricsInfoPanel/index.d.ts +1 -0
  13. package/dist/MetricsGraph/MetricsTooltip/index.d.ts +1 -0
  14. package/dist/MetricsGraph/index.d.ts +1 -0
  15. package/dist/MetricsSeries/index.d.ts +1 -0
  16. package/dist/ProfileExplorer/ProfileExplorerCompare.d.ts +1 -0
  17. package/dist/ProfileExplorer/ProfileExplorerSingle.d.ts +1 -0
  18. package/dist/ProfileExplorer/index.d.ts +1 -0
  19. package/dist/ProfileExplorer/index.js +3 -2
  20. package/dist/ProfileIcicleGraph/ActionButtons/GroupByDropdown.d.ts +1 -0
  21. package/dist/ProfileIcicleGraph/ActionButtons/RuntimeFilterDropdown.d.ts +1 -0
  22. package/dist/ProfileIcicleGraph/ActionButtons/SortBySelect.d.ts +1 -0
  23. package/dist/ProfileIcicleGraph/IcicleGraph/ColorStackLegend.d.ts +1 -0
  24. package/dist/ProfileIcicleGraph/IcicleGraph/useNodeColor.js +5 -4
  25. package/dist/ProfileIcicleGraph/IcicleGraphArrow/ContextMenu.d.ts +1 -0
  26. package/dist/ProfileIcicleGraph/IcicleGraphArrow/index.js +7 -7
  27. package/dist/ProfileMetricsGraph/index.d.ts +1 -0
  28. package/dist/ProfileSelector/CompareButton.d.ts +1 -0
  29. package/dist/ProfileSelector/index.d.ts +1 -0
  30. package/dist/ProfileSource.d.ts +1 -0
  31. package/dist/ProfileTypeSelector/index.d.ts +1 -0
  32. package/dist/ProfileView/FilterByFunctionButton.d.ts +1 -0
  33. package/dist/ProfileView/ViewSelector.d.ts +1 -0
  34. package/dist/ProfileView/index.d.ts +1 -0
  35. package/dist/ProfileViewWithData.d.ts +1 -0
  36. package/dist/SourceView/Highlighter.js +3 -2
  37. package/dist/SourceView/LineNo.d.ts +1 -0
  38. package/dist/SourceView/lang-detector/index.js +1 -1
  39. package/dist/Table/ColumnsVisibility.d.ts +1 -0
  40. package/dist/components/DiffLegend.d.ts +1 -0
  41. package/dist/components/ProfileShareButton/ResultBox.d.ts +1 -0
  42. package/dist/components/ProfileShareButton/index.d.ts +1 -0
  43. package/package.json +6 -6
  44. package/src/ProfileExplorer/index.tsx +3 -2
  45. package/src/ProfileIcicleGraph/IcicleGraph/useNodeColor.ts +11 -4
  46. package/src/ProfileIcicleGraph/IcicleGraphArrow/index.tsx +10 -15
  47. package/src/ProfileIcicleGraph/benchmarks/ProfileIcicleGraph-10M.benchmark.tsx +2 -2
  48. package/src/ProfileIcicleGraph/benchmarks/ProfileIcicleGraph-1M.benchmark.tsx +2 -2
  49. package/src/ProfileIcicleGraph/benchmarks/ProfileIcicleGraph-20M.benchmark.tsx +2 -2
  50. package/src/SourceView/Highlighter.tsx +4 -2
  51. package/src/SourceView/lang-detector/index.ts +1 -1
  52. package/src/TopTable/benchmarks/TopTable-10M.benchmark.tsx +2 -2
  53. package/src/TopTable/benchmarks/TopTable-1M.benchmark.tsx +2 -2
  54. package/src/TopTable/benchmarks/TopTable-20M.benchmark.tsx +2 -2
  55. package/typings.d.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 0.16.353 (2024-03-06)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
10
+ ## 0.16.352 (2024-02-29)
11
+
12
+ **Note:** Version bump only for package @parca/profile
13
+
6
14
  ## [0.16.351](https://github.com/parca-dev/parca/compare/@parca/profile@0.16.350...@parca/profile@0.16.351) (2024-02-28)
7
15
 
8
16
  **Note:** Version bump only for package @parca/profile
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { Callgraph as CallgraphType } from '@parca/client';
2
3
  export interface Props {
3
4
  data: CallgraphType;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  interface Props {
2
3
  value: string | number | undefined;
3
4
  displayValue?: string | number | undefined;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { CallgraphNode, CallgraphNodeMeta, FlamegraphNode, FlamegraphNodeMeta, FlamegraphRootNode } from '@parca/client';
2
3
  import { Location, Mapping, Function as ParcaFunction } from '@parca/client/dist/parca/metastore/v1alpha1/metastore';
3
4
  interface ExtendedCallgraphNodeMeta extends CallgraphNodeMeta {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { Table } from 'apache-arrow';
2
3
  interface Props {
3
4
  table: Table<any>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  interface Props {
2
3
  value: string | number | undefined;
3
4
  displayValue?: string | number | undefined;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  interface Props {
2
3
  isHighlighted: boolean;
3
4
  onHighlight: () => void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare class Suggestion {
2
3
  type: string;
3
4
  typeahead: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { LabelsResponse, QueryServiceClient } from '@parca/client';
2
3
  import { Query } from '@parca/parser';
3
4
  interface MatchersInputProps {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  interface MetricsCircleProps {
2
3
  cx: number;
3
4
  cy: number;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { HighlightedSeries } from '../';
2
3
  interface MetricsContextMenuProps {
3
4
  menuId: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  interface MetricsInfoPanelProps {
2
3
  isInfoPanelOpen: boolean;
3
4
  onInfoIconClick: () => void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { HighlightedSeries } from '../';
2
3
  interface Props {
3
4
  x: number;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { Label, MetricsSeries as MetricsSeriesPb } from '@parca/client';
2
3
  import { DateTimeRange } from '@parca/components';
3
4
  import { MergedProfileSelection } from '..';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import * as d3 from 'd3';
2
3
  interface MetricsSeriesProps {
3
4
  data: any;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { QueryServiceClient } from '@parca/client';
2
3
  import type { NavigateFunction } from '@parca/utilities';
3
4
  import { ProfileSelection } from '..';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { QueryServiceClient } from '@parca/client';
2
3
  import type { NavigateFunction } from '@parca/utilities';
3
4
  import { ProfileSelection } from '..';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { QueryServiceClient } from '@parca/client';
2
3
  import { type NavigateFunction } from '@parca/utilities';
3
4
  interface ProfileExplorerProps {
@@ -14,7 +14,7 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
14
14
  import { useEffect, useState } from 'react';
15
15
  import { Provider } from 'react-redux';
16
16
  import { DateTimeRange, KeyDownProvider, useParcaContext } from '@parca/components';
17
- import { store } from '@parca/store';
17
+ import { createStore } from '@parca/store';
18
18
  import { capitalizeOnlyFirstLetter } from '@parca/utilities';
19
19
  import { ProfileSelectionFromParams, SuffixParams } from '..';
20
20
  import { useProfileTypes } from '../ProfileSelector';
@@ -258,7 +258,8 @@ const ProfileExplorerApp = ({ queryClient, queryParams, navigateTo, }) => {
258
258
  return (_jsx(ProfileExplorerCompare, { queryClient: queryClient, queryA: queryA, queryB: queryB, profileA: profileA, profileB: profileB, selectQueryA: selectQueryA, selectQueryB: selectQueryB, selectProfileA: selectProfileA, selectProfileB: selectProfileB, closeProfile: closeProfile, navigateTo: navigateTo }));
259
259
  };
260
260
  const ProfileExplorer = ({ queryClient, queryParams, navigateTo, }) => {
261
- const { store: reduxStore } = store();
261
+ const { additionalFlamegraphColorProfiles } = useParcaContext();
262
+ const { store: reduxStore } = createStore(additionalFlamegraphColorProfiles);
262
263
  return (_jsx(Provider, { store: reduxStore, children: _jsx(KeyDownProvider, { children: _jsx(ProfileExplorerApp, { queryClient: queryClient, queryParams: queryParams, navigateTo: navigateTo }) }) }));
263
264
  };
264
265
  export default ProfileExplorer;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare const GroupByDropdown: ({ groupBy, toggleGroupBy, }: {
2
3
  groupBy: string[];
3
4
  toggleGroupBy: (key: string) => void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare const RuntimeFilterDropdown: ({ showRuntimeRuby, toggleShowRuntimeRuby, showRuntimePython, toggleShowRuntimePython, showInterpretedOnly, toggleShowInterpretedOnly, }: {
2
3
  showRuntimeRuby: boolean;
3
4
  toggleShowRuntimeRuby: () => void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare const SortBySelect: ({ sortBy, setSortBy, compareMode, }: {
2
3
  sortBy: string;
3
4
  setSortBy: (key: string) => void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { NavigateFunction } from '@parca/utilities';
2
3
  interface Props {
3
4
  navigateTo?: NavigateFunction;
@@ -11,11 +11,12 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  import { useMemo } from 'react';
14
- import { EVERYTHING_ELSE, selectDarkMode, selectStackColors, useAppSelector } from '@parca/store';
15
- import { COLOR_PROFILES, diffColor } from '@parca/utilities';
14
+ import { EVERYTHING_ELSE, selectColorProfiles, selectDarkMode, selectStackColors, useAppSelector, } from '@parca/store';
15
+ import { diffColor } from '@parca/utilities';
16
16
  const useNodeColor = ({ data, compareMode }) => {
17
17
  const colors = useAppSelector(selectStackColors);
18
18
  const isDarkMode = useAppSelector(selectDarkMode);
19
+ const colorProfiles = useAppSelector(selectColorProfiles);
19
20
  const color = useMemo(() => {
20
21
  if (compareMode) {
21
22
  const diff = data.diff;
@@ -23,9 +24,9 @@ const useNodeColor = ({ data, compareMode }) => {
23
24
  return diffColor(diff, cumulative, isDarkMode);
24
25
  }
25
26
  const color = colors[data.feature ?? EVERYTHING_ELSE] ??
26
- (!isDarkMode ? COLOR_PROFILES.default.colors[0][0] : COLOR_PROFILES.default.colors[0][1]);
27
+ (!isDarkMode ? colorProfiles.default.colors[0][0] : colorProfiles.default.colors[0][1]);
27
28
  return color;
28
- }, [data, colors, isDarkMode, compareMode]);
29
+ }, [data, colors, isDarkMode, compareMode, colorProfiles]);
29
30
  return color;
30
31
  };
31
32
  export default useNodeColor;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { Table } from 'apache-arrow';
2
3
  import { type NavigateFunction } from '@parca/utilities';
3
4
  interface ContextMenuProps {
@@ -14,9 +14,9 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
14
14
  import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
15
15
  import { tableFromIPC } from 'apache-arrow';
16
16
  import { useContextMenu } from 'react-contexify';
17
- import { USER_PREFERENCES, useUserPreference } from '@parca/hooks';
18
- import { getColorForFeature, getColorForSimilarNodes, selectDarkMode, setHoveringNode, useAppDispatch, useAppSelector, } from '@parca/store';
19
- import { getLastItem, scaleLinear, selectQueryParam, } from '@parca/utilities';
17
+ import { USER_PREFERENCES, useCurrentColorProfile, useUserPreference } from '@parca/hooks';
18
+ import { getColorForFeature, selectDarkMode, setHoveringNode, useAppDispatch, useAppSelector, } from '@parca/store';
19
+ import { getLastItem, scaleLinear, selectQueryParam } from '@parca/utilities';
20
20
  import GraphTooltipArrow from '../../GraphTooltipArrow';
21
21
  import GraphTooltipArrowContent from '../../GraphTooltipArrow/Content';
22
22
  import { DockedGraphTooltip } from '../../GraphTooltipArrow/DockedGraphTooltip';
@@ -42,7 +42,6 @@ export const FIELD_DIFF = 'diff';
42
42
  export const IcicleGraphArrow = memo(function IcicleGraphArrow({ arrow, total, filtered, width, setCurPath, curPath, sampleUnit, navigateTo, sortBy, }) {
43
43
  const [isContextMenuOpen, setIsContextMenuOpen] = useState(false);
44
44
  const dispatch = useAppDispatch();
45
- const [colorProfile] = useUserPreference(USER_PREFERENCES.FLAMEGRAPH_COLOR_PROFILE.key);
46
45
  const [highlightSimilarStacksPreference] = useUserPreference(USER_PREFERENCES.HIGHLIGHT_SIMILAR_STACKS.key);
47
46
  const [dockedMetainfo] = useUserPreference(USER_PREFERENCES.GRAPH_METAINFO_DOCKED.key);
48
47
  const isDarkMode = useAppSelector(selectDarkMode);
@@ -58,7 +57,8 @@ export const IcicleGraphArrow = memo(function IcicleGraphArrow({ arrow, total, f
58
57
  const currentSearchString = selectQueryParam('search_string') ?? '';
59
58
  const { compareMode } = useProfileViewContext();
60
59
  const isColorStackLegendEnabled = selectQueryParam('color_stack_legend') === 'true';
61
- const colorForSimilarNodes = getColorForSimilarNodes(colorProfile);
60
+ const currentColorProfile = useCurrentColorProfile();
61
+ const colorForSimilarNodes = currentColorProfile.colorForSimilarNodes;
62
62
  const mappings = useMemo(() => {
63
63
  // Read the mappings from the dictionary that contains all mapping strings.
64
64
  // This is great, as might only have a dozen or so mappings,
@@ -110,10 +110,10 @@ export const IcicleGraphArrow = memo(function IcicleGraphArrow({ arrow, total, f
110
110
  const mappingColors = useMemo(() => {
111
111
  const colors = {};
112
112
  Object.entries(mappingFeatures).forEach(([_, feature]) => {
113
- colors[feature.name] = getColorForFeature(feature.name, isDarkMode, colorProfile);
113
+ colors[feature.name] = getColorForFeature(feature.name, isDarkMode, currentColorProfile.colors);
114
114
  });
115
115
  return colors;
116
- }, [colorProfile, isDarkMode, mappingFeatures]);
116
+ }, [isDarkMode, mappingFeatures, currentColorProfile]);
117
117
  useEffect(() => {
118
118
  if (ref.current != null) {
119
119
  setHeight(ref?.current.getBoundingClientRect().height);
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { RpcError } from '@protobuf-ts/runtime-rpc';
2
3
  import { Label, QueryRangeResponse, QueryServiceClient } from '@parca/client';
3
4
  import { DateTimeRange } from '@parca/components';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare const CompareButton: ({ disabled, onClick, }: {
2
3
  disabled: boolean;
3
4
  onClick: () => void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { RpcError } from '@protobuf-ts/runtime-rpc';
2
3
  import { ProfileTypesResponse, QueryServiceClient } from '@parca/client';
3
4
  import { ProfileSelection } from '..';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { Label, ProfileDiffSelection, QueryRequest } from '@parca/client';
2
3
  import { ProfileType, Query } from '@parca/parser';
3
4
  export interface ProfileSource {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { RpcError } from '@protobuf-ts/runtime-rpc';
2
3
  import { ProfileType, ProfileTypesResponse } from '@parca/client';
3
4
  import { type SelectElement } from '@parca/components';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { NavigateFunction } from '@parca/utilities';
2
3
  declare const FilterByFunctionButton: ({ navigateTo, }: {
3
4
  navigateTo: NavigateFunction | undefined;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { NavigateFunction } from '@parca/utilities';
2
3
  interface Props {
3
4
  position: number;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { Callgraph as CallgraphType, Flamegraph, FlamegraphArrow, QueryServiceClient, Source, TableArrow, Top } from '@parca/client';
2
3
  import { ProfileSource } from '../ProfileSource';
3
4
  type NavigateFunction = (path: string, queryParams: any, options?: {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { QueryServiceClient } from '@parca/client';
2
3
  import { type NavigateFunction } from '@parca/utilities';
3
4
  import { ProfileSource } from './ProfileSource';
@@ -14,8 +14,9 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
14
14
  import { useId, useMemo } from 'react';
15
15
  import cx from 'classnames';
16
16
  import { scaleLinear } from 'd3-scale';
17
- import SyntaxHighlighter, { createElement } from 'react-syntax-highlighter';
18
- import { atomOneDark, atomOneLight } from 'react-syntax-highlighter/dist/esm/styles/hljs';
17
+ import createElement from 'react-syntax-highlighter/dist/cjs/create-element';
18
+ import SyntaxHighlighter from 'react-syntax-highlighter/dist/cjs/default-highlight';
19
+ import { atomOneDark, atomOneLight } from 'react-syntax-highlighter/dist/cjs/styles/hljs';
19
20
  import { Tooltip } from 'react-tooltip';
20
21
  import { useParcaContext } from '@parca/components';
21
22
  import { valueFormatter } from '@parca/utilities';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  interface Props {
2
3
  value: number;
3
4
  isCurrent?: boolean;
@@ -10,7 +10,7 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- import * as hljsLangs from 'react-syntax-highlighter/dist/esm/languages/hljs';
13
+ import * as hljsLangs from 'react-syntax-highlighter/dist/cjs/languages/hljs';
14
14
  import _extLangMap from './ext-to-lang.json';
15
15
  const extLangMap = _extLangMap;
16
16
  export const langaugeFromFile = (file) => {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { type VisibilityState } from '@tanstack/react-table';
2
3
  import { ColumnDef } from '.';
3
4
  declare const ColumnsVisibility: ({ columns, visibility, setVisibility, }: {
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare const DiffLegend: () => JSX.Element;
2
3
  export default DiffLegend;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  interface Props {
2
3
  value: string;
3
4
  className?: string;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { QueryRequest, QueryServiceClient } from '@parca/client';
2
3
  interface Props {
3
4
  queryRequest: QueryRequest;
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.16.351",
3
+ "version": "0.16.353",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
6
  "@parca/client": "^0.16.106",
7
- "@parca/components": "^0.16.259",
7
+ "@parca/components": "^0.16.260",
8
8
  "@parca/dynamicsize": "^0.16.61",
9
- "@parca/hooks": "^0.0.44",
9
+ "@parca/hooks": "^0.0.45",
10
10
  "@parca/parser": "^0.16.69",
11
- "@parca/store": "^0.16.133",
12
- "@parca/utilities": "^0.0.61",
11
+ "@parca/store": "^0.16.134",
12
+ "@parca/utilities": "^0.0.62",
13
13
  "@tanstack/react-query": "^4.0.5",
14
14
  "@types/react-beautiful-dnd": "^13.1.8",
15
15
  "apache-arrow": "^12.0.0",
@@ -50,5 +50,5 @@
50
50
  "access": "public",
51
51
  "registry": "https://registry.npmjs.org/"
52
52
  },
53
- "gitHead": "f92df4afcaf89ccbf154cb3df4f9272b12b98622"
53
+ "gitHead": "b5d2f03ac76f9059da8ec256475545d0db0e11a8"
54
54
  }
@@ -17,7 +17,7 @@ import {Provider} from 'react-redux';
17
17
 
18
18
  import {QueryServiceClient} from '@parca/client';
19
19
  import {DateTimeRange, KeyDownProvider, useParcaContext} from '@parca/components';
20
- import {store} from '@parca/store';
20
+ import {createStore} from '@parca/store';
21
21
  import {capitalizeOnlyFirstLetter, type NavigateFunction} from '@parca/utilities';
22
22
 
23
23
  import {ProfileSelection, ProfileSelectionFromParams, SuffixParams} from '..';
@@ -406,7 +406,8 @@ const ProfileExplorer = ({
406
406
  queryParams,
407
407
  navigateTo,
408
408
  }: ProfileExplorerProps): JSX.Element => {
409
- const {store: reduxStore} = store();
409
+ const {additionalFlamegraphColorProfiles} = useParcaContext();
410
+ const {store: reduxStore} = createStore(additionalFlamegraphColorProfiles);
410
411
 
411
412
  return (
412
413
  <Provider store={reduxStore}>
@@ -13,8 +13,14 @@
13
13
 
14
14
  import {useMemo} from 'react';
15
15
 
16
- import {EVERYTHING_ELSE, selectDarkMode, selectStackColors, useAppSelector} from '@parca/store';
17
- import {COLOR_PROFILES, diffColor} from '@parca/utilities';
16
+ import {
17
+ EVERYTHING_ELSE,
18
+ selectColorProfiles,
19
+ selectDarkMode,
20
+ selectStackColors,
21
+ useAppSelector,
22
+ } from '@parca/store';
23
+ import {diffColor} from '@parca/utilities';
18
24
 
19
25
  import type {ColoredFlamegraphNode} from './useColoredGraph';
20
26
 
@@ -26,6 +32,7 @@ interface Props {
26
32
  const useNodeColor = ({data, compareMode}: Props): string => {
27
33
  const colors = useAppSelector(selectStackColors);
28
34
  const isDarkMode = useAppSelector(selectDarkMode);
35
+ const colorProfiles = useAppSelector(selectColorProfiles);
29
36
 
30
37
  const color: string = useMemo(() => {
31
38
  if (compareMode) {
@@ -36,10 +43,10 @@ const useNodeColor = ({data, compareMode}: Props): string => {
36
43
 
37
44
  const color =
38
45
  colors[data.feature ?? EVERYTHING_ELSE] ??
39
- (!isDarkMode ? COLOR_PROFILES.default.colors[0][0] : COLOR_PROFILES.default.colors[0][1]);
46
+ (!isDarkMode ? colorProfiles.default.colors[0][0] : colorProfiles.default.colors[0][1]);
40
47
 
41
48
  return color;
42
- }, [data, colors, isDarkMode, compareMode]);
49
+ }, [data, colors, isDarkMode, compareMode, colorProfiles]);
43
50
 
44
51
  return color;
45
52
  };
@@ -17,22 +17,15 @@ import {Dictionary, Table, Vector, tableFromIPC} from 'apache-arrow';
17
17
  import {useContextMenu} from 'react-contexify';
18
18
 
19
19
  import {FlamegraphArrow} from '@parca/client';
20
- import {USER_PREFERENCES, useUserPreference} from '@parca/hooks';
20
+ import {USER_PREFERENCES, useCurrentColorProfile, useUserPreference} from '@parca/hooks';
21
21
  import {
22
22
  getColorForFeature,
23
- getColorForSimilarNodes,
24
23
  selectDarkMode,
25
24
  setHoveringNode,
26
25
  useAppDispatch,
27
26
  useAppSelector,
28
27
  } from '@parca/store';
29
- import {
30
- getLastItem,
31
- scaleLinear,
32
- selectQueryParam,
33
- type ColorProfileName,
34
- type NavigateFunction,
35
- } from '@parca/utilities';
28
+ import {getLastItem, scaleLinear, selectQueryParam, type NavigateFunction} from '@parca/utilities';
36
29
 
37
30
  import GraphTooltipArrow from '../../GraphTooltipArrow';
38
31
  import GraphTooltipArrowContent from '../../GraphTooltipArrow/Content';
@@ -83,9 +76,6 @@ export const IcicleGraphArrow = memo(function IcicleGraphArrow({
83
76
  }: IcicleGraphArrowProps): React.JSX.Element {
84
77
  const [isContextMenuOpen, setIsContextMenuOpen] = useState<boolean>(false);
85
78
  const dispatch = useAppDispatch();
86
- const [colorProfile] = useUserPreference<ColorProfileName>(
87
- USER_PREFERENCES.FLAMEGRAPH_COLOR_PROFILE.key
88
- );
89
79
  const [highlightSimilarStacksPreference] = useUserPreference<boolean>(
90
80
  USER_PREFERENCES.HIGHLIGHT_SIMILAR_STACKS.key
91
81
  );
@@ -106,7 +96,8 @@ export const IcicleGraphArrow = memo(function IcicleGraphArrow({
106
96
  const currentSearchString = (selectQueryParam('search_string') as string) ?? '';
107
97
  const {compareMode} = useProfileViewContext();
108
98
  const isColorStackLegendEnabled = selectQueryParam('color_stack_legend') === 'true';
109
- const colorForSimilarNodes = getColorForSimilarNodes(colorProfile);
99
+ const currentColorProfile = useCurrentColorProfile();
100
+ const colorForSimilarNodes = currentColorProfile.colorForSimilarNodes;
110
101
 
111
102
  const mappings = useMemo(() => {
112
103
  // Read the mappings from the dictionary that contains all mapping strings.
@@ -165,10 +156,14 @@ export const IcicleGraphArrow = memo(function IcicleGraphArrow({
165
156
  const mappingColors = useMemo(() => {
166
157
  const colors: mappingColors = {};
167
158
  Object.entries(mappingFeatures).forEach(([_, feature]) => {
168
- colors[feature.name] = getColorForFeature(feature.name, isDarkMode, colorProfile);
159
+ colors[feature.name] = getColorForFeature(
160
+ feature.name,
161
+ isDarkMode,
162
+ currentColorProfile.colors
163
+ );
169
164
  });
170
165
  return colors;
171
- }, [colorProfile, isDarkMode, mappingFeatures]);
166
+ }, [isDarkMode, mappingFeatures, currentColorProfile]);
172
167
 
173
168
  useEffect(() => {
174
169
  if (ref.current != null) {
@@ -14,11 +14,11 @@
14
14
  import React from 'react';
15
15
  import ProfileIcicleGraph from '..';
16
16
  import {Provider} from 'react-redux';
17
- import {store} from '@parca/store';
17
+ import {createStore} from '@parca/store';
18
18
  import parca10mGraphData from './benchdata/parca-10m.json';
19
19
  import {Flamegraph} from '@parca/client';
20
20
 
21
- const {store: reduxStore} = store();
21
+ const {store: reduxStore} = createStore();
22
22
 
23
23
  const parca10mGraph = parca10mGraphData as Flamegraph;
24
24
 
@@ -14,11 +14,11 @@
14
14
  import React from 'react';
15
15
  import ProfileIcicleGraph from '../';
16
16
  import {Provider} from 'react-redux';
17
- import {store} from '@parca/store';
17
+ import {createStore} from '@parca/store';
18
18
  import {Flamegraph} from '@parca/client';
19
19
  import parca1mGraphData from './benchdata/parca-1m.json';
20
20
 
21
- const {store: reduxStore} = store();
21
+ const {store: reduxStore} = createStore();
22
22
 
23
23
  const parca1mGraph = parca1mGraphData as Flamegraph;
24
24
 
@@ -14,11 +14,11 @@
14
14
  import React from 'react';
15
15
  import ProfileIcicleGraph from '..';
16
16
  import {Provider} from 'react-redux';
17
- import {store} from '@parca/store';
17
+ import {createStore} from '@parca/store';
18
18
  import parca20mGraphData from './benchdata/parca-20m.json';
19
19
  import {Flamegraph} from '@parca/client';
20
20
 
21
- const {store: reduxStore} = store();
21
+ const {store: reduxStore} = createStore();
22
22
 
23
23
  const parca20mGraph = parca20mGraphData as Flamegraph;
24
24
 
@@ -16,8 +16,10 @@ import {MouseEventHandler, useId, useMemo} from 'react';
16
16
  import {Vector} from 'apache-arrow';
17
17
  import cx from 'classnames';
18
18
  import {scaleLinear} from 'd3-scale';
19
- import SyntaxHighlighter, {createElement, type createElementProps} from 'react-syntax-highlighter';
20
- import {atomOneDark, atomOneLight} from 'react-syntax-highlighter/dist/esm/styles/hljs';
19
+ import {type createElementProps} from 'react-syntax-highlighter';
20
+ import createElement from 'react-syntax-highlighter/dist/cjs/create-element';
21
+ import SyntaxHighlighter from 'react-syntax-highlighter/dist/cjs/default-highlight';
22
+ import {atomOneDark, atomOneLight} from 'react-syntax-highlighter/dist/cjs/styles/hljs';
21
23
  import {Tooltip} from 'react-tooltip';
22
24
 
23
25
  import {useParcaContext} from '@parca/components';
@@ -11,7 +11,7 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
 
14
- import * as hljsLangs from 'react-syntax-highlighter/dist/esm/languages/hljs';
14
+ import * as hljsLangs from 'react-syntax-highlighter/dist/cjs/languages/hljs';
15
15
 
16
16
  import _extLangMap from './ext-to-lang.json';
17
17
 
@@ -14,11 +14,11 @@
14
14
  import React from 'react';
15
15
  import TopTable from '..';
16
16
  import {Provider} from 'react-redux';
17
- import {store} from '@parca/store';
17
+ import {createStore} from '@parca/store';
18
18
  import parca10mGraphData from './benchdata/parca-toptable-10m.json';
19
19
  import {Top} from '@parca/client';
20
20
 
21
- const {store: reduxStore} = store();
21
+ const {store: reduxStore} = createStore();
22
22
 
23
23
  const parca10mGraph = parca10mGraphData as Top;
24
24
 
@@ -14,11 +14,11 @@
14
14
  import React from 'react';
15
15
  import TopTable from '..';
16
16
  import {Provider} from 'react-redux';
17
- import {store} from '@parca/store';
17
+ import {createStore} from '@parca/store';
18
18
  import {Top} from '@parca/client';
19
19
  import parca1mGraphData from './benchdata/parca-toptable-1m.json';
20
20
 
21
- const {store: reduxStore} = store();
21
+ const {store: reduxStore} = createStore();
22
22
 
23
23
  const parca1mGraph = parca1mGraphData as Top;
24
24
 
@@ -14,11 +14,11 @@
14
14
  import React from 'react';
15
15
  import TopTable from '..';
16
16
  import {Provider} from 'react-redux';
17
- import {store} from '@parca/store';
17
+ import {createStore} from '@parca/store';
18
18
  import parca20mGraphData from './benchdata/parca-toptable-20m.json';
19
19
  import {Top} from '@parca/client';
20
20
 
21
- const {store: reduxStore} = store();
21
+ const {store: reduxStore} = createStore();
22
22
 
23
23
  const parca20mGraph = parca20mGraphData as Top;
24
24
 
package/typings.d.ts CHANGED
@@ -13,4 +13,4 @@
13
13
 
14
14
  declare module '*.svg';
15
15
  declare module 'react-map-interaction';
16
- declare module 'react-syntax-highlighter/dist/esm/languages/hljs';
16
+ declare module 'react-syntax-highlighter/dist/cjs/languages/hljs';