@dxos/react-ui-menu 0.8.2-main.fbd8ed0 → 0.8.2-staging.42af850

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.
@@ -1,9 +1,14 @@
1
+ // packages/ui/react-ui-menu/src/index.ts
2
+ import { rxFromSignal } from "@dxos/app-graph";
3
+
1
4
  // packages/ui/react-ui-menu/src/components/DropdownMenu.tsx
5
+ import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
2
6
  import { useControllableState } from "@radix-ui/react-use-controllable-state";
3
7
  import React3, { useCallback } from "react";
4
8
  import { DropdownMenu as NaturalDropdownMenu, Icon } from "@dxos/react-ui";
5
9
 
6
10
  // packages/ui/react-ui-menu/src/components/ActionLabel.tsx
11
+ import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
7
12
  import React from "react";
8
13
  import { keySymbols } from "@dxos/keyboard";
9
14
  import { toLocalizedString, useTranslation } from "@dxos/react-ui";
@@ -76,13 +81,18 @@ var createLineSeparator = (id = "line", source = "root") => ({
76
81
 
77
82
  // packages/ui/react-ui-menu/src/components/ActionLabel.tsx
78
83
  var ActionLabel = ({ action }) => {
79
- const shortcut = getShortcut(action);
80
- const { t } = useTranslation(translationKey);
81
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", {
82
- className: "grow truncate"
83
- }, toLocalizedString(action.properties.label, t)), shortcut && /* @__PURE__ */ React.createElement("span", {
84
- className: mx("shrink-0", descriptionText)
85
- }, keySymbols(shortcut).join("")));
84
+ var _effect = _useSignals();
85
+ try {
86
+ const shortcut = getShortcut(action);
87
+ const { t } = useTranslation(translationKey);
88
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", {
89
+ className: "grow truncate"
90
+ }, toLocalizedString(action.properties.label, t)), shortcut && /* @__PURE__ */ React.createElement("span", {
91
+ className: mx("shrink-0", descriptionText)
92
+ }, keySymbols(shortcut).join("")));
93
+ } finally {
94
+ _effect.f();
95
+ }
86
96
  };
87
97
  var actionLabel = (action, t) => {
88
98
  const shortcut = getShortcut(action);
@@ -90,6 +100,7 @@ var actionLabel = (action, t) => {
90
100
  };
91
101
 
92
102
  // packages/ui/react-ui-menu/src/components/MenuContext.tsx
103
+ import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
93
104
  import { createContextScope } from "@radix-ui/react-context";
94
105
  import React2, { useMemo } from "react";
95
106
  var MENU_NAME = "GraphMenu";
@@ -101,13 +112,18 @@ var menuContextDefaults = {
101
112
  };
102
113
  var useMenuScope = createMenuScope();
103
114
  var MenuProvider = ({ children, useGroupItems = menuContextDefaults.useGroupItems, iconSize = menuContextDefaults.iconSize, attendableId }) => {
104
- const { scope } = useMenuScope(void 0);
105
- return /* @__PURE__ */ React2.createElement(MenuContextProvider, {
106
- useGroupItems,
107
- iconSize,
108
- attendableId,
109
- scope
110
- }, children);
115
+ var _effect = _useSignals2();
116
+ try {
117
+ const { scope } = useMenuScope(void 0);
118
+ return /* @__PURE__ */ React2.createElement(MenuContextProvider, {
119
+ useGroupItems,
120
+ iconSize,
121
+ attendableId,
122
+ scope
123
+ }, children);
124
+ } finally {
125
+ _effect.f();
126
+ }
111
127
  };
112
128
  var useMenuItems = (group, propsItems, consumerName = "useMenuItemConsumer", __menuScope) => {
113
129
  const { useGroupItems } = useMenu(consumerName, __menuScope);
@@ -120,65 +136,66 @@ var useMenuItems = (group, propsItems, consumerName = "useMenuItemConsumer", __m
120
136
 
121
137
  // packages/ui/react-ui-menu/src/components/DropdownMenu.tsx
122
138
  var DropdownMenuItem = ({ item, onClick, __menuScope }) => {
123
- const action = item;
124
- const handleClick = useCallback((event) => onClick(action, event), [
125
- action,
126
- onClick
127
- ]);
128
- const { iconSize } = useMenu("DropdownMenuItem", __menuScope);
129
- return /* @__PURE__ */ React3.createElement(NaturalDropdownMenu.Item, {
130
- onClick: handleClick,
131
- classNames: "gap-2",
132
- disabled: action.properties?.disabled,
133
- ...action.properties?.testId && {
134
- "data-testid": action.properties.testId
135
- }
136
- }, action.properties?.icon && /* @__PURE__ */ React3.createElement(Icon, {
137
- icon: action.properties.icon,
138
- size: iconSize
139
- }), /* @__PURE__ */ React3.createElement(ActionLabel, {
140
- action
141
- }));
139
+ var _effect = _useSignals3();
140
+ try {
141
+ const action = item;
142
+ const handleClick = useCallback((event) => onClick(action, event), [
143
+ action,
144
+ onClick
145
+ ]);
146
+ const { iconSize } = useMenu("DropdownMenuItem", __menuScope);
147
+ return /* @__PURE__ */ React3.createElement(NaturalDropdownMenu.Item, {
148
+ onClick: handleClick,
149
+ classNames: "gap-2",
150
+ disabled: action.properties?.disabled,
151
+ ...action.properties?.testId && {
152
+ "data-testid": action.properties.testId
153
+ }
154
+ }, action.properties?.icon && /* @__PURE__ */ React3.createElement(Icon, {
155
+ icon: action.properties.icon,
156
+ size: iconSize
157
+ }), /* @__PURE__ */ React3.createElement(ActionLabel, {
158
+ action
159
+ }));
160
+ } finally {
161
+ _effect.f();
162
+ }
142
163
  };
143
- var DropdownMenuRoot = ({ items: propsItems, group, open, defaultOpen, onOpenChange, suppressNextTooltip, caller, children, __menuScope, ...naturalProps }) => {
144
- const [optionsMenuOpen, setOptionsMenuOpen] = useControllableState({
145
- prop: open,
146
- defaultProp: defaultOpen,
147
- onChange: onOpenChange
148
- });
149
- const handleActionClick = useCallback((action, event) => {
150
- if (action.properties?.disabled) {
151
- return;
152
- }
153
- event.stopPropagation();
154
- if (suppressNextTooltip) {
155
- suppressNextTooltip.current = true;
156
- }
157
- setOptionsMenuOpen(false);
158
- void action.data?.({
159
- parent: group,
160
- caller
164
+ var DropdownMenuRoot = ({ items: propsItems, group, open, defaultOpen, onOpenChange, caller, children, __menuScope, ...naturalProps }) => {
165
+ var _effect = _useSignals3();
166
+ try {
167
+ const [optionsMenuOpen, setOptionsMenuOpen] = useControllableState({
168
+ prop: open,
169
+ defaultProp: defaultOpen,
170
+ onChange: onOpenChange
161
171
  });
162
- }, [
163
- suppressNextTooltip,
164
- group,
165
- caller
166
- ]);
167
- const items = useMenuItems(group, propsItems);
168
- return /* @__PURE__ */ React3.createElement(NaturalDropdownMenu.Root, {
169
- open: optionsMenuOpen,
170
- onOpenChange: (nextOpen) => {
171
- if (!nextOpen && suppressNextTooltip) {
172
- suppressNextTooltip.current = true;
172
+ const handleActionClick = useCallback((action, event) => {
173
+ if (action.properties?.disabled) {
174
+ return;
173
175
  }
174
- return setOptionsMenuOpen(nextOpen);
175
- },
176
- ...naturalProps
177
- }, children, /* @__PURE__ */ React3.createElement(NaturalDropdownMenu.Portal, null, /* @__PURE__ */ React3.createElement(NaturalDropdownMenu.Content, null, /* @__PURE__ */ React3.createElement(NaturalDropdownMenu.Viewport, null, items?.map((item) => /* @__PURE__ */ React3.createElement(DropdownMenuItem, {
178
- key: item.id,
179
- item,
180
- onClick: handleActionClick
181
- }))), /* @__PURE__ */ React3.createElement(NaturalDropdownMenu.Arrow, null))));
176
+ event.stopPropagation();
177
+ setOptionsMenuOpen(false);
178
+ void action.data?.({
179
+ parent: group,
180
+ caller
181
+ });
182
+ }, [
183
+ group,
184
+ caller
185
+ ]);
186
+ const items = useMenuItems(group, propsItems);
187
+ return /* @__PURE__ */ React3.createElement(NaturalDropdownMenu.Root, {
188
+ open: optionsMenuOpen,
189
+ onOpenChange: setOptionsMenuOpen,
190
+ ...naturalProps
191
+ }, children, /* @__PURE__ */ React3.createElement(NaturalDropdownMenu.Portal, null, /* @__PURE__ */ React3.createElement(NaturalDropdownMenu.Content, null, /* @__PURE__ */ React3.createElement(NaturalDropdownMenu.Viewport, null, items?.map((item) => /* @__PURE__ */ React3.createElement(DropdownMenuItem, {
192
+ key: item.id,
193
+ item,
194
+ onClick: handleActionClick
195
+ }))), /* @__PURE__ */ React3.createElement(NaturalDropdownMenu.Arrow, null))));
196
+ } finally {
197
+ _effect.f();
198
+ }
182
199
  };
183
200
  var DropdownMenu = {
184
201
  Root: DropdownMenuRoot,
@@ -187,7 +204,8 @@ var DropdownMenu = {
187
204
  };
188
205
 
189
206
  // packages/ui/react-ui-menu/src/components/ToolbarMenu.tsx
190
- import React4, { useCallback as useCallback2, useRef } from "react";
207
+ import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
208
+ import React4, { useCallback as useCallback2 } from "react";
191
209
  import { Icon as Icon2, Toolbar as NaturalToolbar, useTranslation as useTranslation2 } from "@dxos/react-ui";
192
210
  import { useAttention } from "@dxos/react-ui-attention";
193
211
 
@@ -199,171 +217,192 @@ var isMenuGroup = (node) => node.type === ACTION_GROUP_TYPE2;
199
217
 
200
218
  // packages/ui/react-ui-menu/src/components/ToolbarMenu.tsx
201
219
  var ActionToolbarItem = ({ action, __menuScope }) => {
202
- const { iconSize } = useMenu("ActionToolbarItem", __menuScope);
203
- const { t } = useTranslation2(translationKey);
204
- const handleClick = useCallback2(() => action.data?.(), [
205
- action
206
- ]);
207
- const { icon, iconOnly = true, disabled, testId, hidden, classNames } = action.properties;
208
- const Root = icon ? NaturalToolbar.IconButton : NaturalToolbar.Button;
209
- const rootProps = icon ? {
210
- icon,
211
- size: iconSize,
212
- iconOnly,
213
- label: actionLabel(action, t)
214
- } : {
215
- children: /* @__PURE__ */ React4.createElement(ActionLabel, {
220
+ var _effect = _useSignals4();
221
+ try {
222
+ const { iconSize } = useMenu("ActionToolbarItem", __menuScope);
223
+ const { t } = useTranslation2(translationKey);
224
+ const handleClick = useCallback2(() => action.data?.(), [
216
225
  action
217
- })
218
- };
219
- return hidden ? null : /* @__PURE__ */ React4.createElement(Root, {
220
- key: action.id,
221
- disabled,
222
- onClick: handleClick,
223
- variant: "ghost",
224
- ...testId && {
225
- "data-testid": testId
226
- },
227
- ...rootProps,
228
- classNames
229
- });
226
+ ]);
227
+ const { icon, iconOnly = true, disabled, testId, hidden, classNames } = action.properties;
228
+ const Root = icon ? NaturalToolbar.IconButton : NaturalToolbar.Button;
229
+ const rootProps = icon ? {
230
+ icon,
231
+ size: iconSize,
232
+ iconOnly,
233
+ label: actionLabel(action, t)
234
+ } : {
235
+ children: /* @__PURE__ */ React4.createElement(ActionLabel, {
236
+ action
237
+ })
238
+ };
239
+ return hidden ? null : /* @__PURE__ */ React4.createElement(Root, {
240
+ key: action.id,
241
+ disabled,
242
+ onClick: handleClick,
243
+ variant: "ghost",
244
+ ...testId && {
245
+ "data-testid": testId
246
+ },
247
+ ...rootProps,
248
+ classNames
249
+ });
250
+ } finally {
251
+ _effect.f();
252
+ }
230
253
  };
231
254
  var DropdownMenuToolbarItem = ({ group, items: propsItems, __menuScope }) => {
232
- const { iconOnly, disabled, testId } = group.properties;
233
- const suppressNextTooltip = useRef(false);
234
- const { t } = useTranslation2(translationKey);
235
- const { iconSize } = useMenu("DropdownMenuToolbarItem", __menuScope);
236
- const items = useMenuItems(group, propsItems, "DropdownMenuToolbarItem", __menuScope);
237
- const activeItem = items?.find((item) => !!item.properties.checked);
238
- const icon = group.properties.applyActive && // TODO(thure): Handle other menu item types.
239
- activeItem?.properties.icon || group.properties.icon;
240
- const Root = icon ? NaturalToolbar.IconButton : NaturalToolbar.Button;
241
- const labelAction = group.properties.applyActive && activeItem ? activeItem : group;
242
- const rootProps = icon ? {
243
- icon,
244
- size: iconSize,
245
- iconOnly,
246
- label: actionLabel(labelAction, t),
247
- caretDown: true,
248
- suppressNextTooltip
249
- } : {
250
- children: /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(ActionLabel, {
251
- action: labelAction
252
- }), /* @__PURE__ */ React4.createElement(Icon2, {
253
- size: 3,
254
- icon: "ph--caret-down--bold",
255
- classNames: "mis-1"
256
- }))
257
- };
258
- return /* @__PURE__ */ React4.createElement(DropdownMenu.Root, {
259
- group,
260
- items,
261
- suppressNextTooltip
262
- }, /* @__PURE__ */ React4.createElement(DropdownMenu.Trigger, {
263
- asChild: true
264
- }, /* @__PURE__ */ React4.createElement(Root, {
265
- variant: "ghost",
266
- disabled,
267
- ...rootProps,
268
- ...testId && {
269
- "data-testid": testId
270
- }
271
- })));
255
+ var _effect = _useSignals4();
256
+ try {
257
+ const { iconOnly, disabled, testId } = group.properties;
258
+ const { t } = useTranslation2(translationKey);
259
+ const { iconSize } = useMenu("DropdownMenuToolbarItem", __menuScope);
260
+ const items = useMenuItems(group, propsItems, "DropdownMenuToolbarItem", __menuScope);
261
+ const activeItem = items?.find((item) => !!item.properties.checked);
262
+ const icon = group.properties.applyActive && // TODO(thure): Handle other menu item types.
263
+ activeItem?.properties.icon || group.properties.icon;
264
+ const Root = icon ? NaturalToolbar.IconButton : NaturalToolbar.Button;
265
+ const labelAction = group.properties.applyActive && activeItem ? activeItem : group;
266
+ const rootProps = icon ? {
267
+ icon,
268
+ size: iconSize,
269
+ iconOnly,
270
+ label: actionLabel(labelAction, t),
271
+ caretDown: true
272
+ } : {
273
+ children: /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(ActionLabel, {
274
+ action: labelAction
275
+ }), /* @__PURE__ */ React4.createElement(Icon2, {
276
+ size: 3,
277
+ icon: "ph--caret-down--bold",
278
+ classNames: "mis-1"
279
+ }))
280
+ };
281
+ return /* @__PURE__ */ React4.createElement(DropdownMenu.Root, {
282
+ group,
283
+ items
284
+ }, /* @__PURE__ */ React4.createElement(DropdownMenu.Trigger, {
285
+ asChild: true
286
+ }, /* @__PURE__ */ React4.createElement(Root, {
287
+ variant: "ghost",
288
+ disabled,
289
+ ...rootProps,
290
+ ...testId && {
291
+ "data-testid": testId
292
+ }
293
+ })));
294
+ } finally {
295
+ _effect.f();
296
+ }
272
297
  };
273
298
  var ToggleGroupItem = ({ group, action, __menuScope }) => {
274
- const { iconSize } = useMenu("ToggleGroupItem", __menuScope);
275
- const { t } = useTranslation2(translationKey);
276
- const { icon, iconOnly = true, disabled, testId, hidden, classNames } = action.properties;
277
- const handleClick = useCallback2(() => action.data?.({
278
- parent: group
279
- }), [
280
- action,
281
- group
282
- ]);
283
- const Root = icon ? NaturalToolbar.ToggleGroupIconItem : NaturalToolbar.ToggleGroupItem;
284
- const rootProps = icon ? {
285
- icon,
286
- size: iconSize,
287
- iconOnly,
288
- label: actionLabel(action, t)
289
- } : {
290
- children: /* @__PURE__ */ React4.createElement(ActionLabel, {
291
- action
292
- })
293
- };
294
- return hidden ? null : /* @__PURE__ */ React4.createElement(Root, {
295
- key: action.id,
296
- value: action.id,
297
- disabled,
298
- onClick: handleClick,
299
- variant: "ghost",
300
- ...testId && {
301
- "data-testid": testId
302
- },
303
- ...rootProps,
304
- classNames
305
- });
299
+ var _effect = _useSignals4();
300
+ try {
301
+ const { iconSize } = useMenu("ToggleGroupItem", __menuScope);
302
+ const { t } = useTranslation2(translationKey);
303
+ const { icon, iconOnly = true, disabled, testId, hidden, classNames } = action.properties;
304
+ const handleClick = useCallback2(() => action.data?.({
305
+ parent: group
306
+ }), [
307
+ action,
308
+ group
309
+ ]);
310
+ const Root = icon ? NaturalToolbar.ToggleGroupIconItem : NaturalToolbar.ToggleGroupItem;
311
+ const rootProps = icon ? {
312
+ icon,
313
+ size: iconSize,
314
+ iconOnly,
315
+ label: actionLabel(action, t)
316
+ } : {
317
+ children: /* @__PURE__ */ React4.createElement(ActionLabel, {
318
+ action
319
+ })
320
+ };
321
+ return hidden ? null : /* @__PURE__ */ React4.createElement(Root, {
322
+ key: action.id,
323
+ value: action.id,
324
+ disabled,
325
+ onClick: handleClick,
326
+ variant: "ghost",
327
+ ...testId && {
328
+ "data-testid": testId
329
+ },
330
+ ...rootProps,
331
+ classNames
332
+ });
333
+ } finally {
334
+ _effect.f();
335
+ }
306
336
  };
307
337
  var ToggleGroupToolbarItem = ({ group, items: propsItems, __menuScope }) => {
308
- const items = useMenuItems(group, propsItems, "ToggleGroupToolbarItem", __menuScope);
309
- const { selectCardinality, value } = group.properties;
310
- return (
311
- // TODO(thure): The type here is difficult to manage, what do?
312
- // @ts-ignore
313
- /* @__PURE__ */ React4.createElement(
314
- NaturalToolbar.ToggleGroup,
315
- {
316
- type: selectCardinality,
317
- value
318
- },
319
- // TODO(thure): Handle other menu item types.
320
- items.map((action) => /* @__PURE__ */ React4.createElement(ToggleGroupItem, {
321
- key: action.id,
322
- group,
323
- action
324
- }))
325
- )
326
- );
338
+ var _effect = _useSignals4();
339
+ try {
340
+ const items = useMenuItems(group, propsItems, "ToggleGroupToolbarItem", __menuScope);
341
+ const { selectCardinality, value } = group.properties;
342
+ return (
343
+ // TODO(thure): The type here is difficult to manage, what do?
344
+ // @ts-ignore
345
+ /* @__PURE__ */ React4.createElement(
346
+ NaturalToolbar.ToggleGroup,
347
+ {
348
+ type: selectCardinality,
349
+ value
350
+ },
351
+ // TODO(thure): Handle other menu item types.
352
+ items.map((action) => /* @__PURE__ */ React4.createElement(ToggleGroupItem, {
353
+ key: action.id,
354
+ group,
355
+ action
356
+ }))
357
+ )
358
+ );
359
+ } finally {
360
+ _effect.f();
361
+ }
327
362
  };
328
363
  var ToolbarMenu = ({ __menuScope, classNames, ...props }) => {
329
- const items = useMenuItems(void 0, void 0, "ToolbarMenu", __menuScope);
330
- const { attendableId } = useMenu("ToolbarMenu", __menuScope);
331
- const { hasAttention } = useAttention(attendableId);
332
- return /* @__PURE__ */ React4.createElement(NaturalToolbar.Root, {
333
- ...props,
334
- classNames: [
335
- "p-1",
336
- !hasAttention && "[&>*]:opacity-20 !bg-transparent",
337
- classNames
338
- ]
339
- }, items?.map((item, i) => isSeparator(item) ? /* @__PURE__ */ React4.createElement(NaturalToolbar.Separator, {
340
- key: i,
341
- variant: item.properties.variant
342
- }) : isMenuGroup(item) ? item.properties.variant === "dropdownMenu" ? (
343
- // TODO(thure): Figure out type narrowing that doesn’t require so much use of `as`.
344
- /* @__PURE__ */ React4.createElement(DropdownMenuToolbarItem, {
345
- key: item.id,
346
- group: item
347
- })
348
- ) : (
349
- // TODO(thure): Figure out type narrowing that doesn’t require so much use of `as`.
350
- /* @__PURE__ */ React4.createElement(ToggleGroupToolbarItem, {
351
- key: item.id,
352
- group: item
353
- })
354
- ) : (
355
- // TODO(thure): Figure out type narrowing that doesn’t require so much use of `as`.
356
- /* @__PURE__ */ React4.createElement(ActionToolbarItem, {
357
- key: item.id,
358
- action: item
359
- })
360
- )));
364
+ var _effect = _useSignals4();
365
+ try {
366
+ const items = useMenuItems(void 0, void 0, "ToolbarMenu", __menuScope);
367
+ const { attendableId } = useMenu("ToolbarMenu", __menuScope);
368
+ const { hasAttention } = useAttention(attendableId);
369
+ return /* @__PURE__ */ React4.createElement(NaturalToolbar.Root, {
370
+ ...props,
371
+ classNames: [
372
+ "p-1",
373
+ attendableId && !hasAttention && "[&>*]:opacity-20 !bg-transparent",
374
+ classNames
375
+ ]
376
+ }, items?.map((item, i) => isSeparator(item) ? /* @__PURE__ */ React4.createElement(NaturalToolbar.Separator, {
377
+ key: i,
378
+ variant: item.properties.variant
379
+ }) : isMenuGroup(item) ? item.properties.variant === "dropdownMenu" ? (
380
+ // TODO(thure): Figure out type narrowing that doesn’t require so much use of `as`.
381
+ /* @__PURE__ */ React4.createElement(DropdownMenuToolbarItem, {
382
+ key: item.id,
383
+ group: item
384
+ })
385
+ ) : (
386
+ // TODO(thure): Figure out type narrowing that doesn’t require so much use of `as`.
387
+ /* @__PURE__ */ React4.createElement(ToggleGroupToolbarItem, {
388
+ key: item.id,
389
+ group: item
390
+ })
391
+ ) : (
392
+ // TODO(thure): Figure out type narrowing that doesn’t require so much use of `as`.
393
+ /* @__PURE__ */ React4.createElement(ActionToolbarItem, {
394
+ key: item.id,
395
+ action: item
396
+ })
397
+ )));
398
+ } finally {
399
+ _effect.f();
400
+ }
361
401
  };
362
402
 
363
403
  // packages/ui/react-ui-menu/src/hooks/useMenuActions.ts
364
404
  import { RegistryContext, useRxValue } from "@effect-rx/rx-react";
365
- import { useSignalEffect } from "@preact/signals-react";
366
- import { useCallback as useCallback3, useContext, useState } from "react";
405
+ import { useCallback as useCallback3, useContext, useEffect, useState } from "react";
367
406
  import { Graph, ROOT_ID } from "@dxos/app-graph";
368
407
  var edgesArrayToRecord = (edges) => {
369
408
  return Object.fromEntries(Object.entries(edges.reduce((acc, { source, target }) => {
@@ -390,19 +429,20 @@ var edgesArrayToRecord = (edges) => {
390
429
  return acc;
391
430
  }, {})));
392
431
  };
393
- var useMenuActions = (actionCreator) => {
432
+ var useMenuActions = (props) => {
394
433
  const registry = useContext(RegistryContext);
395
- const initialMenuGraphProps = actionCreator();
434
+ const menuGraphProps = useRxValue(props);
396
435
  const [graph] = useState(new Graph({
397
436
  registry,
398
- nodes: initialMenuGraphProps.nodes,
399
- edges: edgesArrayToRecord(initialMenuGraphProps.edges)
437
+ nodes: menuGraphProps.nodes,
438
+ edges: edgesArrayToRecord(menuGraphProps.edges)
400
439
  }));
401
- useSignalEffect(() => {
402
- const menuGraphProps = actionCreator();
440
+ useEffect(() => {
403
441
  graph.addNodes(menuGraphProps.nodes);
404
442
  graph.addEdges(menuGraphProps.edges);
405
- });
443
+ }, [
444
+ menuGraphProps
445
+ ]);
406
446
  const useGroupItems = useCallback3((sourceNode) => {
407
447
  const items = useRxValue(graph.connections(sourceNode?.id || ROOT_ID));
408
448
  return items;
@@ -426,6 +466,7 @@ export {
426
466
  isMenuGroup,
427
467
  isSeparator,
428
468
  menuContextDefaults,
469
+ rxFromSignal,
429
470
  useMenu,
430
471
  useMenuActions,
431
472
  useMenuItems