@parca/profile 0.17.10 → 0.17.11

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
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.17.11](https://github.com/parca-dev/parca/compare/@parca/profile@0.17.10...@parca/profile@0.17.11) (2025-06-16)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
6
10
  ## 0.17.10 (2025-06-14)
7
11
 
8
12
  **Note:** Version bump only for package @parca/profile
@@ -12,7 +12,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
14
  import { useEffect, useRef, useState } from 'react';
15
- import { USER_PREFERENCES, useUserPreference } from '@parca/hooks';
15
+ import { useURLState } from '@parca/components';
16
16
  function calculateTruncatedText(text, textElement, maxWidth) {
17
17
  // Create a temporary element for measurement
18
18
  const tempElement = textElement.cloneNode();
@@ -47,7 +47,8 @@ function calculateTruncatedText(text, textElement, maxWidth) {
47
47
  function TextWithEllipsis({ text, x, y, width }) {
48
48
  const textRef = useRef(null);
49
49
  const [displayText, setDisplayText] = useState(text);
50
- const [showFunctionNameFromLeft] = useUserPreference(USER_PREFERENCES.SHOW_FUNCTION_NAME_FROM_LEFT.key);
50
+ const [alignFunctionName] = useURLState('align_function_name');
51
+ const showFunctionNameFromLeft = alignFunctionName === 'left' || alignFunctionName === undefined;
51
52
  useEffect(() => {
52
53
  const textElement = textRef.current;
53
54
  if (textElement === null)
@@ -1 +1 @@
1
- {"version":3,"file":"MultiLevelDropdown.d.ts","sourceRoot":"","sources":["../../../../src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAOzC,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AA6H1C,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACnC,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAsJzD,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"MultiLevelDropdown.d.ts","sourceRoot":"","sources":["../../../../src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAOzC,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AA6H1C,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACnC,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAkKzD,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -66,6 +66,8 @@ const MultiLevelDropdown = ({ onSelect, profileType }) => {
66
66
  const [invertStack = '', setInvertStack] = useURLState('invert_call_stack');
67
67
  const isInvert = invertStack === 'true';
68
68
  const isColorStackLegendEnabled = colorStackLegend === 'true';
69
+ const [alignFunctionName, setAlignFunctionName] = useURLState('align_function_name');
70
+ const isLeftAligned = alignFunctionName === 'left' || alignFunctionName === undefined;
69
71
  // By default, we want delta profiles (CPU) to be relatively compared.
70
72
  // For non-delta profiles, like goroutines or memory, we want the profiles to be compared absolutely.
71
73
  const compareAbsoluteDefault = profileType?.delta === false ? 'true' : 'false';
@@ -114,6 +116,15 @@ const MultiLevelDropdown = ({ onSelect, profileType }) => {
114
116
  hide: false,
115
117
  icon: isInvert ? 'ph:sort-ascending' : 'ph:sort-descending',
116
118
  },
119
+ {
120
+ label: isLeftAligned ? 'Right-align function names' : 'Left-align function names',
121
+ onclick: () => setAlignFunctionName(isLeftAligned ? 'right' : 'left'),
122
+ id: 'h-align-function-names',
123
+ hide: false,
124
+ icon: isLeftAligned
125
+ ? 'ic:outline-align-horizontal-right'
126
+ : 'ic:outline-align-horizontal-left',
127
+ },
117
128
  {
118
129
  label: isCompareAbsolute ? 'Compare Relative' : 'Compare Absolute',
119
130
  onclick: () => setCompareAbsolute(isCompareAbsolute ? 'false' : 'true'),
@@ -138,7 +149,7 @@ const MultiLevelDropdown = ({ onSelect, profileType }) => {
138
149
  icon: 'ph:eye-closed',
139
150
  },
140
151
  ];
141
- return (_jsx("div", { className: "relative inline-block text-left", id: "h-visualisation-toolbar-actions", children: _jsx(Menu, { children: ({ open, close }) => (_jsxs(_Fragment, { children: [_jsxs(Menu.Button, { className: "inline-flex dark:bg-gray-900 dark:border-gray-600 justify-center w-full px-4 py-2 text-sm font-normal text-gray-600 dark:text-gray-200 bg-white rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75 border border-gray-200 pr-[1.7rem]", children: [_jsx("span", { children: "More" }), _jsx("span", { className: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2 text-gray-400", children: _jsx(Icon, { icon: "heroicons:chevron-down-20-solid", "aria-hidden": "true" }) })] }), open && (_jsxs(Menu.Items, { className: "absolute z-30 left-0 w-56 mt-2 py-2 origin-top-right bg-white rounded-md shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none border dark:bg-gray-900 dark:border-gray-600", children: [_jsx("span", { className: "text-xs text-gray-400 capitalize px-4 py-3", children: "actions" }), menuItems
152
+ return (_jsx("div", { className: "relative inline-block text-left", id: "h-visualisation-toolbar-actions", children: _jsx(Menu, { children: ({ open, close }) => (_jsxs(_Fragment, { children: [_jsxs(Menu.Button, { className: "inline-flex dark:bg-gray-900 dark:border-gray-600 justify-center w-full px-4 py-2 text-sm font-normal text-gray-600 dark:text-gray-200 bg-white rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75 border border-gray-200 pr-[1.7rem]", children: [_jsx("span", { children: "More" }), _jsx("span", { className: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2 text-gray-400", children: _jsx(Icon, { icon: "heroicons:chevron-down-20-solid", "aria-hidden": "true" }) })] }), open && (_jsxs(Menu.Items, { className: "absolute z-30 left-0 w-64 mt-2 py-2 origin-top-right bg-white rounded-md shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none border dark:bg-gray-900 dark:border-gray-600", children: [_jsx("span", { className: "text-xs text-gray-400 capitalize px-4 py-3", children: "actions" }), menuItems
142
153
  .filter(item => item.hide !== undefined && !item.hide)
143
154
  .map((item, index) => (_jsx(MenuItem, { ...item, onSelect: onSelect, closeDropdown: close, activeValueForSortBy: storeSortBy, activeValueForColorBy: colorBy === undefined || colorBy === '' ? 'binary' : colorBy }, index)))] }))] })) }) }));
144
155
  };
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.17.10",
3
+ "version": "0.17.11",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
6
  "@headlessui/react": "^1.7.19",
7
7
  "@iconify/react": "^4.0.0",
8
8
  "@parca/client": "0.16.130",
9
- "@parca/components": "0.16.340",
9
+ "@parca/components": "0.16.341",
10
10
  "@parca/dynamicsize": "0.16.65",
11
- "@parca/hooks": "0.0.89",
11
+ "@parca/hooks": "0.0.90",
12
12
  "@parca/icons": "0.16.72",
13
13
  "@parca/parser": "0.16.79",
14
14
  "@parca/store": "0.16.174",
@@ -77,5 +77,5 @@
77
77
  "access": "public",
78
78
  "registry": "https://registry.npmjs.org/"
79
79
  },
80
- "gitHead": "311a3e15d4813761b8e2d28e66dcec340cf69335"
80
+ "gitHead": "43148de87e3e645cf0c5225356438891000d7d96"
81
81
  }
@@ -13,7 +13,7 @@
13
13
 
14
14
  import {useEffect, useRef, useState} from 'react';
15
15
 
16
- import {USER_PREFERENCES, useUserPreference} from '@parca/hooks';
16
+ import {useURLState} from '@parca/components';
17
17
 
18
18
  interface Props {
19
19
  text: string;
@@ -66,9 +66,9 @@ function calculateTruncatedText(
66
66
  function TextWithEllipsis({text, x, y, width}: Props): JSX.Element {
67
67
  const textRef = useRef<SVGTextElement>(null);
68
68
  const [displayText, setDisplayText] = useState(text);
69
- const [showFunctionNameFromLeft] = useUserPreference<boolean>(
70
- USER_PREFERENCES.SHOW_FUNCTION_NAME_FROM_LEFT.key
71
- );
69
+ const [alignFunctionName] = useURLState('align_function_name');
70
+
71
+ const showFunctionNameFromLeft = alignFunctionName === 'left' || alignFunctionName === undefined;
72
72
 
73
73
  useEffect(() => {
74
74
  const textElement = textRef.current;
@@ -167,6 +167,9 @@ const MultiLevelDropdown: React.FC<MultiLevelDropdownProps> = ({onSelect, profil
167
167
  const isInvert = invertStack === 'true';
168
168
  const isColorStackLegendEnabled = colorStackLegend === 'true';
169
169
 
170
+ const [alignFunctionName, setAlignFunctionName] = useURLState('align_function_name');
171
+ const isLeftAligned = alignFunctionName === 'left' || alignFunctionName === undefined;
172
+
170
173
  // By default, we want delta profiles (CPU) to be relatively compared.
171
174
  // For non-delta profiles, like goroutines or memory, we want the profiles to be compared absolutely.
172
175
  const compareAbsoluteDefault = profileType?.delta === false ? 'true' : 'false';
@@ -225,6 +228,15 @@ const MultiLevelDropdown: React.FC<MultiLevelDropdownProps> = ({onSelect, profil
225
228
  hide: false,
226
229
  icon: isInvert ? 'ph:sort-ascending' : 'ph:sort-descending',
227
230
  },
231
+ {
232
+ label: isLeftAligned ? 'Right-align function names' : 'Left-align function names',
233
+ onclick: () => setAlignFunctionName(isLeftAligned ? 'right' : 'left'),
234
+ id: 'h-align-function-names',
235
+ hide: false,
236
+ icon: isLeftAligned
237
+ ? 'ic:outline-align-horizontal-right'
238
+ : 'ic:outline-align-horizontal-left',
239
+ },
228
240
  {
229
241
  label: isCompareAbsolute ? 'Compare Relative' : 'Compare Absolute',
230
242
  onclick: () => setCompareAbsolute(isCompareAbsolute ? 'false' : 'true'),
@@ -275,7 +287,7 @@ const MultiLevelDropdown: React.FC<MultiLevelDropdownProps> = ({onSelect, profil
275
287
  </span>
276
288
  </Menu.Button>
277
289
  {open && (
278
- <Menu.Items className="absolute z-30 left-0 w-56 mt-2 py-2 origin-top-right bg-white rounded-md shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none border dark:bg-gray-900 dark:border-gray-600">
290
+ <Menu.Items className="absolute z-30 left-0 w-64 mt-2 py-2 origin-top-right bg-white rounded-md shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none border dark:bg-gray-900 dark:border-gray-600">
279
291
  <span className="text-xs text-gray-400 capitalize px-4 py-3">actions</span>
280
292
  {menuItems
281
293
  .filter(item => item.hide !== undefined && !item.hide)