@dxos/react-ui-menu 0.7.5-feature-compute.4d9d99a
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/LICENSE +8 -0
- package/README.md +3 -0
- package/dist/lib/browser/index.mjs +438 -0
- package/dist/lib/browser/index.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -0
- package/dist/lib/node/index.cjs +465 -0
- package/dist/lib/node/index.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -0
- package/dist/lib/node-esm/index.mjs +440 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/types/src/components/ActionLabel.d.ts +7 -0
- package/dist/types/src/components/ActionLabel.d.ts.map +1 -0
- package/dist/types/src/components/DropdownMenu.d.ts +20 -0
- package/dist/types/src/components/DropdownMenu.d.ts.map +1 -0
- package/dist/types/src/components/MenuContext.d.ts +13 -0
- package/dist/types/src/components/MenuContext.d.ts.map +1 -0
- package/dist/types/src/components/ToolbarMenu.d.ts +20 -0
- package/dist/types/src/components/ToolbarMenu.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +4 -0
- package/dist/types/src/components/index.d.ts.map +1 -0
- package/dist/types/src/defs.d.ts +45 -0
- package/dist/types/src/defs.d.ts.map +1 -0
- package/dist/types/src/hooks.d.ts +17 -0
- package/dist/types/src/hooks.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +5 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/testing/Menus.stories.d.ts +25 -0
- package/dist/types/src/testing/Menus.stories.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +26 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +8 -0
- package/dist/types/src/translations.d.ts.map +1 -0
- package/dist/types/src/util.d.ts +45 -0
- package/dist/types/src/util.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +55 -0
- package/src/components/ActionLabel.tsx +30 -0
- package/src/components/DropdownMenu.tsx +112 -0
- package/src/components/MenuContext.tsx +57 -0
- package/src/components/ToolbarMenu.tsx +185 -0
- package/src/components/index.ts +7 -0
- package/src/defs.ts +54 -0
- package/src/hooks.ts +72 -0
- package/src/index.ts +8 -0
- package/src/testing/Menus.stories.tsx +67 -0
- package/src/testing/index.ts +111 -0
- package/src/translations.ts +13 -0
- package/src/util.ts +71 -0
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// packages/ui/react-ui-menu/src/components/DropdownMenu.tsx
|
|
4
|
+
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
5
|
+
import React3, { useCallback } from "react";
|
|
6
|
+
import { DropdownMenu as NaturalDropdownMenu, Icon } from "@dxos/react-ui";
|
|
7
|
+
|
|
8
|
+
// packages/ui/react-ui-menu/src/components/ActionLabel.tsx
|
|
9
|
+
import React from "react";
|
|
10
|
+
import { keySymbols } from "@dxos/keyboard";
|
|
11
|
+
import { toLocalizedString, useTranslation } from "@dxos/react-ui";
|
|
12
|
+
import { mx, descriptionText } from "@dxos/react-ui-theme";
|
|
13
|
+
|
|
14
|
+
// packages/ui/react-ui-menu/src/translations.ts
|
|
15
|
+
var translationKey = "menus";
|
|
16
|
+
var translations_default = [
|
|
17
|
+
{
|
|
18
|
+
"en-US": {
|
|
19
|
+
[translationKey]: {}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
// packages/ui/react-ui-menu/src/util.ts
|
|
25
|
+
import { ACTION_GROUP_TYPE, ACTION_TYPE, actionGroupSymbol } from "@dxos/app-graph";
|
|
26
|
+
import { getHostPlatform } from "@dxos/util";
|
|
27
|
+
var getShortcut = (action) => {
|
|
28
|
+
return typeof action.properties?.keyBinding === "string" ? action.properties.keyBinding : action.properties?.keyBinding?.[getHostPlatform()];
|
|
29
|
+
};
|
|
30
|
+
var noop = () => {
|
|
31
|
+
};
|
|
32
|
+
var createMenuAction = (id, properties) => ({
|
|
33
|
+
id,
|
|
34
|
+
type: ACTION_TYPE,
|
|
35
|
+
properties,
|
|
36
|
+
data: noop
|
|
37
|
+
});
|
|
38
|
+
var createMenuItemGroup = (id, properties) => ({
|
|
39
|
+
id,
|
|
40
|
+
type: ACTION_GROUP_TYPE,
|
|
41
|
+
properties,
|
|
42
|
+
data: actionGroupSymbol
|
|
43
|
+
});
|
|
44
|
+
var createGapSeparator = (id = "gap", source = "root") => ({
|
|
45
|
+
nodes: [
|
|
46
|
+
{
|
|
47
|
+
id,
|
|
48
|
+
type: "@dxos/react-ui-toolbar/separator",
|
|
49
|
+
properties: {
|
|
50
|
+
variant: "gap"
|
|
51
|
+
},
|
|
52
|
+
data: void 0
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
edges: [
|
|
56
|
+
{
|
|
57
|
+
source,
|
|
58
|
+
target: id
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
var createLineSeparator = (id = "line", source = "root") => ({
|
|
63
|
+
nodes: [
|
|
64
|
+
{
|
|
65
|
+
id,
|
|
66
|
+
type: "@dxos/react-ui-toolbar/separator",
|
|
67
|
+
properties: {
|
|
68
|
+
variant: "line"
|
|
69
|
+
},
|
|
70
|
+
data: void 0
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
edges: [
|
|
74
|
+
{
|
|
75
|
+
source,
|
|
76
|
+
target: id
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// packages/ui/react-ui-menu/src/components/ActionLabel.tsx
|
|
82
|
+
var ActionLabel = ({ action }) => {
|
|
83
|
+
const shortcut = getShortcut(action);
|
|
84
|
+
const { t } = useTranslation(translationKey);
|
|
85
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", {
|
|
86
|
+
className: "grow truncate"
|
|
87
|
+
}, toLocalizedString(action.properties.label, t)), shortcut && /* @__PURE__ */ React.createElement("span", {
|
|
88
|
+
className: mx("shrink-0", descriptionText)
|
|
89
|
+
}, keySymbols(shortcut).join("")));
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// packages/ui/react-ui-menu/src/components/MenuContext.tsx
|
|
93
|
+
import { createContextScope } from "@radix-ui/react-context";
|
|
94
|
+
import React2, { useMemo } from "react";
|
|
95
|
+
var MENU_NAME = "GraphMenu";
|
|
96
|
+
var [createMenuContext, createMenuScope] = createContextScope(MENU_NAME, []);
|
|
97
|
+
var [MenuContextProvider, useMenu] = createMenuContext(MENU_NAME);
|
|
98
|
+
var menuContextDefaults = {
|
|
99
|
+
iconSize: 5,
|
|
100
|
+
onAction: () => {
|
|
101
|
+
},
|
|
102
|
+
resolveGroupItems: () => null
|
|
103
|
+
};
|
|
104
|
+
var useMenuScope = createMenuScope();
|
|
105
|
+
var MenuProvider = ({ children, resolveGroupItems = menuContextDefaults.resolveGroupItems, onAction = menuContextDefaults.onAction, iconSize = menuContextDefaults.iconSize, attendableId }) => {
|
|
106
|
+
const { scope } = useMenuScope(void 0);
|
|
107
|
+
return /* @__PURE__ */ React2.createElement(MenuContextProvider, {
|
|
108
|
+
resolveGroupItems,
|
|
109
|
+
onAction,
|
|
110
|
+
iconSize,
|
|
111
|
+
attendableId,
|
|
112
|
+
scope
|
|
113
|
+
}, children);
|
|
114
|
+
};
|
|
115
|
+
var useMenuItems = (group, propsItems, consumerName = "useMenuItemConsumer", __menuScope) => {
|
|
116
|
+
const { resolveGroupItems } = useMenu(consumerName, __menuScope);
|
|
117
|
+
return useMemo(() => propsItems ?? resolveGroupItems?.(group) ?? void 0, [
|
|
118
|
+
propsItems,
|
|
119
|
+
group,
|
|
120
|
+
resolveGroupItems
|
|
121
|
+
]);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// packages/ui/react-ui-menu/src/components/DropdownMenu.tsx
|
|
125
|
+
var DropdownMenuItem = ({ item, onClick, __menuScope }) => {
|
|
126
|
+
const action = item;
|
|
127
|
+
const handleClick = useCallback((event) => onClick(action, event), [
|
|
128
|
+
action,
|
|
129
|
+
onClick
|
|
130
|
+
]);
|
|
131
|
+
const { iconSize } = useMenu("DropdownMenuItem", __menuScope);
|
|
132
|
+
return /* @__PURE__ */ React3.createElement(NaturalDropdownMenu.Item, {
|
|
133
|
+
onClick: handleClick,
|
|
134
|
+
classNames: "gap-2",
|
|
135
|
+
disabled: action.properties?.disabled,
|
|
136
|
+
...action.properties?.testId && {
|
|
137
|
+
"data-testid": action.properties.testId
|
|
138
|
+
}
|
|
139
|
+
}, action.properties?.icon && /* @__PURE__ */ React3.createElement(Icon, {
|
|
140
|
+
icon: action.properties.icon,
|
|
141
|
+
size: iconSize
|
|
142
|
+
}), /* @__PURE__ */ React3.createElement(ActionLabel, {
|
|
143
|
+
action
|
|
144
|
+
}));
|
|
145
|
+
};
|
|
146
|
+
var DropdownMenuRoot = ({ items: propsItems, group, open, defaultOpen, onOpenChange, suppressNextTooltip, children, __menuScope, ...naturalProps }) => {
|
|
147
|
+
const [optionsMenuOpen, setOptionsMenuOpen] = useControllableState({
|
|
148
|
+
prop: open,
|
|
149
|
+
defaultProp: defaultOpen,
|
|
150
|
+
onChange: onOpenChange
|
|
151
|
+
});
|
|
152
|
+
const { onAction } = useMenu("DropdownMenuRoot", __menuScope);
|
|
153
|
+
const handleActionClick = useCallback((action, event) => {
|
|
154
|
+
if (action.properties?.disabled) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
event.stopPropagation();
|
|
158
|
+
if (suppressNextTooltip) {
|
|
159
|
+
suppressNextTooltip.current = true;
|
|
160
|
+
}
|
|
161
|
+
setOptionsMenuOpen(false);
|
|
162
|
+
onAction?.(action);
|
|
163
|
+
}, [
|
|
164
|
+
onAction
|
|
165
|
+
]);
|
|
166
|
+
const items = useMenuItems(group, propsItems);
|
|
167
|
+
return /* @__PURE__ */ React3.createElement(NaturalDropdownMenu.Root, {
|
|
168
|
+
open: optionsMenuOpen,
|
|
169
|
+
onOpenChange: (nextOpen) => {
|
|
170
|
+
if (!nextOpen && suppressNextTooltip) {
|
|
171
|
+
suppressNextTooltip.current = true;
|
|
172
|
+
}
|
|
173
|
+
return setOptionsMenuOpen(nextOpen);
|
|
174
|
+
},
|
|
175
|
+
...naturalProps
|
|
176
|
+
}, 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, {
|
|
177
|
+
key: item.id,
|
|
178
|
+
item,
|
|
179
|
+
onClick: handleActionClick
|
|
180
|
+
}))), /* @__PURE__ */ React3.createElement(NaturalDropdownMenu.Arrow, null))));
|
|
181
|
+
};
|
|
182
|
+
var DropdownMenu = {
|
|
183
|
+
Root: DropdownMenuRoot,
|
|
184
|
+
Trigger: NaturalDropdownMenu.Trigger,
|
|
185
|
+
VirtualTrigger: NaturalDropdownMenu.VirtualTrigger
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
// packages/ui/react-ui-menu/src/components/ToolbarMenu.tsx
|
|
189
|
+
import React4, { useCallback as useCallback2, useRef } from "react";
|
|
190
|
+
import { Icon as Icon2, Toolbar as NaturalToolbar } from "@dxos/react-ui";
|
|
191
|
+
import { useAttention } from "@dxos/react-ui-attention";
|
|
192
|
+
|
|
193
|
+
// packages/ui/react-ui-menu/src/defs.ts
|
|
194
|
+
import { ACTION_GROUP_TYPE as ACTION_GROUP_TYPE2 } from "@dxos/app-graph";
|
|
195
|
+
var MenuSeparatorType = "@dxos/react-ui-toolbar/separator";
|
|
196
|
+
var isSeparator = (node) => node.type === MenuSeparatorType;
|
|
197
|
+
var isMenuGroup = (node) => node.type === ACTION_GROUP_TYPE2;
|
|
198
|
+
|
|
199
|
+
// packages/ui/react-ui-menu/src/components/ToolbarMenu.tsx
|
|
200
|
+
var ActionToolbarItem = ({ action, __menuScope }) => {
|
|
201
|
+
const { onAction, iconSize } = useMenu("ActionToolbarItem", __menuScope);
|
|
202
|
+
const handleClick = useCallback2(() => {
|
|
203
|
+
onAction?.(action);
|
|
204
|
+
}, [
|
|
205
|
+
action,
|
|
206
|
+
onAction
|
|
207
|
+
]);
|
|
208
|
+
const { icon, iconOnly = true, disabled, testId, hidden, classNames } = action.properties;
|
|
209
|
+
const Root = icon ? NaturalToolbar.IconButton : NaturalToolbar.Button;
|
|
210
|
+
const rootProps = icon ? {
|
|
211
|
+
icon,
|
|
212
|
+
size: iconSize,
|
|
213
|
+
iconOnly,
|
|
214
|
+
label: /* @__PURE__ */ React4.createElement(ActionLabel, {
|
|
215
|
+
action
|
|
216
|
+
})
|
|
217
|
+
} : {
|
|
218
|
+
children: /* @__PURE__ */ React4.createElement(ActionLabel, {
|
|
219
|
+
action
|
|
220
|
+
})
|
|
221
|
+
};
|
|
222
|
+
return hidden ? null : /* @__PURE__ */ React4.createElement(Root, {
|
|
223
|
+
key: action.id,
|
|
224
|
+
disabled,
|
|
225
|
+
onClick: handleClick,
|
|
226
|
+
variant: "ghost",
|
|
227
|
+
...testId && {
|
|
228
|
+
"data-testid": testId
|
|
229
|
+
},
|
|
230
|
+
...rootProps,
|
|
231
|
+
classNames
|
|
232
|
+
});
|
|
233
|
+
};
|
|
234
|
+
var DropdownMenuToolbarItem = ({ group, items: propsItems, __menuScope }) => {
|
|
235
|
+
const { iconOnly, disabled, testId } = group.properties;
|
|
236
|
+
const suppressNextTooltip = useRef(false);
|
|
237
|
+
const { iconSize } = useMenu("DropdownMenuToolbarItem", __menuScope);
|
|
238
|
+
const items = useMenuItems(group, propsItems, "DropdownMenuToolbarItem", __menuScope);
|
|
239
|
+
const activeItem = items?.find((item) => !!item.properties.checked);
|
|
240
|
+
const icon = group.properties.applyActive && // TODO(thure): Handle other menu item types.
|
|
241
|
+
activeItem?.properties.icon || group.properties.icon;
|
|
242
|
+
const Root = icon ? NaturalToolbar.IconButton : NaturalToolbar.Button;
|
|
243
|
+
const label = /* @__PURE__ */ React4.createElement(ActionLabel, {
|
|
244
|
+
action: group.properties.applyActive && activeItem ? activeItem : group
|
|
245
|
+
});
|
|
246
|
+
const rootProps = icon ? {
|
|
247
|
+
icon,
|
|
248
|
+
size: iconSize,
|
|
249
|
+
iconOnly,
|
|
250
|
+
label,
|
|
251
|
+
caretDown: true,
|
|
252
|
+
suppressNextTooltip
|
|
253
|
+
} : {
|
|
254
|
+
children: /* @__PURE__ */ React4.createElement(React4.Fragment, null, label, /* @__PURE__ */ React4.createElement(Icon2, {
|
|
255
|
+
size: 3,
|
|
256
|
+
icon: "ph--caret-down--bold",
|
|
257
|
+
classNames: "mis-1"
|
|
258
|
+
}))
|
|
259
|
+
};
|
|
260
|
+
return /* @__PURE__ */ React4.createElement(DropdownMenu.Root, {
|
|
261
|
+
group,
|
|
262
|
+
items,
|
|
263
|
+
suppressNextTooltip
|
|
264
|
+
}, /* @__PURE__ */ React4.createElement(DropdownMenu.Trigger, {
|
|
265
|
+
asChild: true
|
|
266
|
+
}, /* @__PURE__ */ React4.createElement(Root, {
|
|
267
|
+
variant: "ghost",
|
|
268
|
+
disabled,
|
|
269
|
+
...rootProps,
|
|
270
|
+
...testId && {
|
|
271
|
+
"data-testid": testId
|
|
272
|
+
}
|
|
273
|
+
})));
|
|
274
|
+
};
|
|
275
|
+
var ToggleGroupItem = ({ action, __menuScope }) => {
|
|
276
|
+
const { iconSize, onAction } = useMenu("ToggleGroupItem", __menuScope);
|
|
277
|
+
const { icon, iconOnly = true, disabled, testId, hidden, classNames } = action.properties;
|
|
278
|
+
const handleClick = useCallback2(() => {
|
|
279
|
+
onAction?.(action);
|
|
280
|
+
}, [
|
|
281
|
+
action,
|
|
282
|
+
onAction
|
|
283
|
+
]);
|
|
284
|
+
const Root = icon ? NaturalToolbar.ToggleGroupIconItem : NaturalToolbar.ToggleGroupItem;
|
|
285
|
+
const rootProps = icon ? {
|
|
286
|
+
icon,
|
|
287
|
+
size: iconSize,
|
|
288
|
+
iconOnly,
|
|
289
|
+
label: /* @__PURE__ */ React4.createElement(ActionLabel, {
|
|
290
|
+
action
|
|
291
|
+
})
|
|
292
|
+
} : {
|
|
293
|
+
children: /* @__PURE__ */ React4.createElement(ActionLabel, {
|
|
294
|
+
action
|
|
295
|
+
})
|
|
296
|
+
};
|
|
297
|
+
return hidden ? null : /* @__PURE__ */ React4.createElement(Root, {
|
|
298
|
+
key: action.id,
|
|
299
|
+
value: action.id,
|
|
300
|
+
disabled,
|
|
301
|
+
onClick: handleClick,
|
|
302
|
+
variant: "ghost",
|
|
303
|
+
...testId && {
|
|
304
|
+
"data-testid": testId
|
|
305
|
+
},
|
|
306
|
+
...rootProps,
|
|
307
|
+
classNames
|
|
308
|
+
});
|
|
309
|
+
};
|
|
310
|
+
var ToggleGroupToolbarItem = ({ group, items: propsItems, __menuScope }) => {
|
|
311
|
+
const items = useMenuItems(group, propsItems, "ToggleGroupToolbarItem", __menuScope);
|
|
312
|
+
const { selectCardinality, value } = group.properties;
|
|
313
|
+
return (
|
|
314
|
+
// TODO(thure): The type here is difficult to manage, what do?
|
|
315
|
+
// @ts-ignore
|
|
316
|
+
/* @__PURE__ */ React4.createElement(
|
|
317
|
+
NaturalToolbar.ToggleGroup,
|
|
318
|
+
{
|
|
319
|
+
type: selectCardinality,
|
|
320
|
+
value
|
|
321
|
+
},
|
|
322
|
+
// TODO(thure): Handle other menu item types.
|
|
323
|
+
items.map((action) => /* @__PURE__ */ React4.createElement(ToggleGroupItem, {
|
|
324
|
+
key: action.id,
|
|
325
|
+
action
|
|
326
|
+
}))
|
|
327
|
+
)
|
|
328
|
+
);
|
|
329
|
+
};
|
|
330
|
+
var ToolbarMenu = ({ __menuScope, classNames, ...props }) => {
|
|
331
|
+
const items = useMenuItems(void 0, void 0, "ToolbarMenu", __menuScope);
|
|
332
|
+
const { attendableId } = useMenu("ToolbarMenu", __menuScope);
|
|
333
|
+
const { hasAttention } = useAttention(attendableId);
|
|
334
|
+
return /* @__PURE__ */ React4.createElement(NaturalToolbar.Root, {
|
|
335
|
+
...props,
|
|
336
|
+
classNames: [
|
|
337
|
+
"p-0 pointer-fine:p-1 attention-surface",
|
|
338
|
+
!hasAttention && "opacity-20",
|
|
339
|
+
classNames
|
|
340
|
+
]
|
|
341
|
+
}, items?.map((item, i) => isSeparator(item) ? /* @__PURE__ */ React4.createElement(NaturalToolbar.Separator, {
|
|
342
|
+
key: i,
|
|
343
|
+
variant: item.properties.variant
|
|
344
|
+
}) : isMenuGroup(item) ? item.properties.variant === "dropdownMenu" ? (
|
|
345
|
+
// TODO(thure): Figure out type narrowing that doesn’t require so much use of `as`.
|
|
346
|
+
/* @__PURE__ */ React4.createElement(DropdownMenuToolbarItem, {
|
|
347
|
+
key: item.id,
|
|
348
|
+
group: item
|
|
349
|
+
})
|
|
350
|
+
) : (
|
|
351
|
+
// TODO(thure): Figure out type narrowing that doesn’t require so much use of `as`.
|
|
352
|
+
/* @__PURE__ */ React4.createElement(ToggleGroupToolbarItem, {
|
|
353
|
+
key: item.id,
|
|
354
|
+
group: item
|
|
355
|
+
})
|
|
356
|
+
) : (
|
|
357
|
+
// TODO(thure): Figure out type narrowing that doesn’t require so much use of `as`.
|
|
358
|
+
/* @__PURE__ */ React4.createElement(ActionToolbarItem, {
|
|
359
|
+
key: item.id,
|
|
360
|
+
action: item
|
|
361
|
+
})
|
|
362
|
+
)));
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
// packages/ui/react-ui-menu/src/hooks.ts
|
|
366
|
+
import { useSignalEffect } from "@preact/signals-react";
|
|
367
|
+
import { useCallback as useCallback3, useState } from "react";
|
|
368
|
+
import { Graph } from "@dxos/app-graph";
|
|
369
|
+
var edgesArrayToRecord = (edges) => {
|
|
370
|
+
return Object.fromEntries(Object.entries(edges.reduce((acc, { source, target }) => {
|
|
371
|
+
if (!acc[source]) {
|
|
372
|
+
acc[source] = {
|
|
373
|
+
inbound: [],
|
|
374
|
+
outbound: []
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
if (!acc[target]) {
|
|
378
|
+
acc[target] = {
|
|
379
|
+
inbound: [],
|
|
380
|
+
outbound: []
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
const sourceEdges = acc[source];
|
|
384
|
+
if (!sourceEdges.outbound.includes(target)) {
|
|
385
|
+
sourceEdges.outbound.push(target);
|
|
386
|
+
}
|
|
387
|
+
const targetEdges = acc[target];
|
|
388
|
+
if (!targetEdges.inbound.includes(source)) {
|
|
389
|
+
targetEdges.inbound.push(source);
|
|
390
|
+
}
|
|
391
|
+
return acc;
|
|
392
|
+
}, {})).map(([id, { outbound }]) => [
|
|
393
|
+
id,
|
|
394
|
+
outbound
|
|
395
|
+
]));
|
|
396
|
+
};
|
|
397
|
+
var useMenuActions = (actionCreator) => {
|
|
398
|
+
const initialMenuGraphProps = actionCreator();
|
|
399
|
+
const [graph] = useState(new Graph({
|
|
400
|
+
nodes: initialMenuGraphProps.nodes,
|
|
401
|
+
edges: edgesArrayToRecord(initialMenuGraphProps.edges)
|
|
402
|
+
}));
|
|
403
|
+
useSignalEffect(() => {
|
|
404
|
+
const menuGraphProps = actionCreator();
|
|
405
|
+
graph._addNodes(menuGraphProps.nodes);
|
|
406
|
+
graph._addEdges(menuGraphProps.edges);
|
|
407
|
+
});
|
|
408
|
+
const resolveGroupItems = useCallback3((sourceNode = graph.root) => {
|
|
409
|
+
if (graph) {
|
|
410
|
+
return graph.nodes(sourceNode, {
|
|
411
|
+
filter: (n) => true
|
|
412
|
+
}) || null;
|
|
413
|
+
} else {
|
|
414
|
+
return null;
|
|
415
|
+
}
|
|
416
|
+
}, [
|
|
417
|
+
graph
|
|
418
|
+
]);
|
|
419
|
+
return {
|
|
420
|
+
resolveGroupItems
|
|
421
|
+
};
|
|
422
|
+
};
|
|
423
|
+
export {
|
|
424
|
+
DropdownMenu,
|
|
425
|
+
MenuProvider,
|
|
426
|
+
MenuSeparatorType,
|
|
427
|
+
ToolbarMenu,
|
|
428
|
+
createGapSeparator,
|
|
429
|
+
createLineSeparator,
|
|
430
|
+
createMenuAction,
|
|
431
|
+
createMenuItemGroup,
|
|
432
|
+
createMenuScope,
|
|
433
|
+
isMenuGroup,
|
|
434
|
+
isSeparator,
|
|
435
|
+
menuContextDefaults,
|
|
436
|
+
useMenu,
|
|
437
|
+
useMenuActions,
|
|
438
|
+
useMenuItems
|
|
439
|
+
};
|
|
440
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/DropdownMenu.tsx", "../../../src/components/ActionLabel.tsx", "../../../src/translations.ts", "../../../src/util.ts", "../../../src/components/MenuContext.tsx", "../../../src/components/ToolbarMenu.tsx", "../../../src/defs.ts", "../../../src/hooks.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport React, { type MouseEvent, type MutableRefObject, useCallback } from 'react';\n\nimport { DropdownMenu as NaturalDropdownMenu, Icon, type DropdownMenuRootProps } from '@dxos/react-ui';\n\nimport { ActionLabel } from './ActionLabel';\nimport { type MenuScopedProps, useMenu, useMenuItems } from './MenuContext';\nimport { type MenuAction, type MenuItem, type MenuItemGroup } from '../defs';\n\nexport type DropdownMenuProps = DropdownMenuRootProps & {\n group?: MenuItemGroup;\n items?: MenuItem[];\n suppressNextTooltip?: MutableRefObject<boolean>;\n};\n\nconst DropdownMenuItem = ({\n item,\n onClick,\n __menuScope,\n}: MenuScopedProps<{\n item: MenuItem;\n onClick: (action: MenuAction, event: MouseEvent) => void;\n}>) => {\n // TODO(thure): handle other items.\n const action = item as MenuAction;\n const handleClick = useCallback((event: MouseEvent) => onClick(action, event), [action, onClick]);\n const { iconSize } = useMenu('DropdownMenuItem', __menuScope);\n return (\n <NaturalDropdownMenu.Item\n onClick={handleClick}\n classNames='gap-2'\n disabled={action.properties?.disabled}\n {...(action.properties?.testId && { 'data-testid': action.properties.testId })}\n >\n {action.properties?.icon && <Icon icon={action.properties!.icon} size={iconSize} />}\n <ActionLabel action={action} />\n </NaturalDropdownMenu.Item>\n );\n};\n\nconst DropdownMenuRoot = ({\n items: propsItems,\n group,\n open,\n defaultOpen,\n onOpenChange,\n suppressNextTooltip,\n children,\n __menuScope,\n ...naturalProps\n}: MenuScopedProps<DropdownMenuProps>) => {\n const [optionsMenuOpen, setOptionsMenuOpen] = useControllableState({\n prop: open,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n const { onAction } = useMenu('DropdownMenuRoot', __menuScope);\n\n const handleActionClick = useCallback(\n (action: MenuAction, event: MouseEvent) => {\n if (action.properties?.disabled) {\n return;\n }\n event.stopPropagation();\n // TODO(thure): Why does Dialog’s modal-ness cause issues if we don’t explicitly close the menu here?\n if (suppressNextTooltip) {\n suppressNextTooltip.current = true;\n }\n setOptionsMenuOpen(false);\n onAction?.(action);\n },\n [onAction],\n );\n\n const items = useMenuItems(group, propsItems);\n\n return (\n <NaturalDropdownMenu.Root\n {...{\n open: optionsMenuOpen,\n onOpenChange: (nextOpen: boolean) => {\n if (!nextOpen && suppressNextTooltip) {\n suppressNextTooltip.current = true;\n }\n return setOptionsMenuOpen(nextOpen);\n },\n }}\n {...naturalProps}\n >\n {children}\n <NaturalDropdownMenu.Portal>\n <NaturalDropdownMenu.Content>\n <NaturalDropdownMenu.Viewport>\n {items?.map((item) => <DropdownMenuItem key={item.id} item={item} onClick={handleActionClick} />)}\n </NaturalDropdownMenu.Viewport>\n <NaturalDropdownMenu.Arrow />\n </NaturalDropdownMenu.Content>\n </NaturalDropdownMenu.Portal>\n </NaturalDropdownMenu.Root>\n );\n};\n\nexport const DropdownMenu = {\n Root: DropdownMenuRoot,\n Trigger: NaturalDropdownMenu.Trigger,\n VirtualTrigger: NaturalDropdownMenu.VirtualTrigger,\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type Action, type ActionGroup } from '@dxos/app-graph';\nimport { keySymbols } from '@dxos/keyboard';\nimport { toLocalizedString, useTranslation } from '@dxos/react-ui';\nimport { mx, descriptionText } from '@dxos/react-ui-theme';\n\nimport { type MenuActionProperties } from '../defs';\nimport { translationKey } from '../translations';\nimport { getShortcut } from '../util';\n\nexport const ActionLabel = ({\n action,\n}: {\n action: Action<MenuActionProperties> | ActionGroup<Omit<MenuActionProperties, 'variant'>>;\n}) => {\n const shortcut = getShortcut(action);\n const { t } = useTranslation(translationKey);\n\n return (\n <>\n <span className='grow truncate'>{toLocalizedString(action.properties!.label, t)}</span>\n {shortcut && <span className={mx('shrink-0', descriptionText)}>{keySymbols(shortcut).join('')}</span>}\n </>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport const translationKey = 'menus';\n\nexport default [\n {\n 'en-US': {\n [translationKey]: {},\n },\n },\n] as const;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { ACTION_GROUP_TYPE, ACTION_TYPE, actionGroupSymbol, type ActionLike } from '@dxos/app-graph';\nimport { getHostPlatform } from '@dxos/util';\n\nimport {\n type MenuAction,\n type MenuActionProperties,\n type MenuItemGroup,\n type MenuItemGroupProperties,\n type MenuSeparator,\n} from './defs';\n\nexport const getShortcut = (action: ActionLike) => {\n return typeof action.properties?.keyBinding === 'string'\n ? action.properties.keyBinding\n : action.properties?.keyBinding?.[getHostPlatform()];\n};\n\nexport const fallbackIcon = 'ph--placeholder--regular';\n\n// TODO(thure,wittjosiah): This is probably a smell; consider the whether react-ui-menu should use action nodes if the\n// callback in `data` is never used. See https://github.com/dxos/dxos/pull/8506#discussion_r1925855118\nconst noop = () => {};\n\nexport const createMenuAction = <P extends {} = {}>(id: string, properties: P & MenuActionProperties) =>\n ({\n id,\n type: ACTION_TYPE,\n properties,\n data: noop,\n }) satisfies MenuAction;\n\nexport const createMenuItemGroup = <\n P extends MenuItemGroupProperties = MenuItemGroupProperties & Partial<MenuActionProperties>,\n>(\n id: string,\n properties: P,\n) =>\n ({\n id,\n type: ACTION_GROUP_TYPE,\n properties,\n data: actionGroupSymbol,\n }) satisfies MenuItemGroup;\n\nexport const createGapSeparator = (id: string = 'gap', source: string = 'root') => ({\n nodes: [\n {\n id,\n type: '@dxos/react-ui-toolbar/separator',\n properties: { variant: 'gap' },\n data: undefined as never,\n } satisfies MenuSeparator,\n ],\n edges: [{ source, target: id }],\n});\n\nexport const createLineSeparator = (id: string = 'line', source: string = 'root') => ({\n nodes: [\n {\n id,\n type: '@dxos/react-ui-toolbar/separator',\n properties: { variant: 'line' },\n data: undefined as never,\n } satisfies MenuSeparator,\n ],\n edges: [{ source, target: id }],\n});\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContextScope, type Scope } from '@radix-ui/react-context';\nimport React, { type PropsWithChildren, useMemo } from 'react';\n\nimport { type MenuContextValue, type MenuItem, type MenuItemGroup } from '../defs';\n\nexport type MenuScopedProps<P> = P & { __menuScope?: Scope };\n\nconst MENU_NAME = 'GraphMenu';\n\nconst [createMenuContext, createMenuScope] = createContextScope(MENU_NAME, []);\n\nconst [MenuContextProvider, useMenu] = createMenuContext<MenuContextValue>(MENU_NAME);\n\nexport const menuContextDefaults: MenuContextValue = {\n iconSize: 5,\n onAction: () => {},\n resolveGroupItems: () => null,\n};\n\nconst useMenuScope = createMenuScope();\n\nconst MenuProvider = ({\n children,\n resolveGroupItems = menuContextDefaults.resolveGroupItems,\n onAction = menuContextDefaults.onAction,\n iconSize = menuContextDefaults.iconSize,\n attendableId,\n}: PropsWithChildren<Partial<MenuContextValue>>) => {\n const { scope } = useMenuScope(undefined);\n return (\n <MenuContextProvider\n resolveGroupItems={resolveGroupItems}\n onAction={onAction}\n iconSize={iconSize}\n attendableId={attendableId}\n scope={scope}\n >\n {children}\n </MenuContextProvider>\n );\n};\n\nexport const useMenuItems = (\n group?: MenuItemGroup,\n propsItems?: MenuItem[],\n consumerName: string = 'useMenuItemConsumer',\n __menuScope?: Scope,\n) => {\n const { resolveGroupItems } = useMenu(consumerName, __menuScope);\n return useMemo(() => propsItems ?? resolveGroupItems?.(group) ?? undefined, [propsItems, group, resolveGroupItems]);\n};\n\nexport { useMenu, createMenuScope, MenuProvider };\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback, useRef } from 'react';\n\nimport { Icon, type IconButtonProps, Toolbar as NaturalToolbar, type ToolbarRootProps } from '@dxos/react-ui';\nimport { useAttention } from '@dxos/react-ui-attention';\n\nimport { ActionLabel } from './ActionLabel';\nimport { DropdownMenu } from './DropdownMenu';\nimport { type MenuScopedProps, useMenu, useMenuItems } from './MenuContext';\nimport {\n type MenuAction,\n type MenuItem,\n isMenuGroup,\n isSeparator,\n type MenuItemGroup,\n type MenuActionProperties,\n type MenuMultipleSelectActionGroup,\n type MenuSingleSelectActionGroup,\n} from '../defs';\n\nexport type ToolbarMenuDropdownMenuActionGroup = Omit<MenuActionProperties, 'variant' | 'icon'> & {\n variant: 'dropdownMenu';\n icon: string;\n applyActive?: boolean;\n};\n\nexport type ToolbarMenuToggleGroupActionGroup = Omit<MenuActionProperties, 'variant'> & {\n variant: 'toggleGroup';\n};\n\nexport type ToolbarMenuActionGroupProperties = (\n | ToolbarMenuDropdownMenuActionGroup\n | ToolbarMenuToggleGroupActionGroup\n) &\n (MenuSingleSelectActionGroup | MenuMultipleSelectActionGroup);\n\nexport type ToolbarMenuProps = ToolbarRootProps;\n\nexport type ToolbarMenuActionGroupProps = {\n group: MenuItemGroup<ToolbarMenuActionGroupProperties>;\n items?: MenuItem[];\n};\n\nconst ActionToolbarItem = ({ action, __menuScope }: MenuScopedProps<{ action: MenuAction }>) => {\n const { onAction, iconSize } = useMenu('ActionToolbarItem', __menuScope);\n const handleClick = useCallback(() => {\n onAction?.(action);\n }, [action, onAction]);\n const { icon, iconOnly = true, disabled, testId, hidden, classNames } = action.properties;\n const Root = icon ? NaturalToolbar.IconButton : NaturalToolbar.Button;\n const rootProps = icon\n ? { icon, size: iconSize, iconOnly, label: <ActionLabel action={action} /> }\n : { children: <ActionLabel action={action} /> };\n return hidden ? null : (\n <Root\n key={action.id}\n disabled={disabled}\n onClick={handleClick}\n variant='ghost'\n {...(testId && { 'data-testid': testId })}\n {...(rootProps as IconButtonProps)}\n classNames={classNames}\n />\n );\n};\n\nconst DropdownMenuToolbarItem = ({\n group,\n items: propsItems,\n __menuScope,\n}: MenuScopedProps<ToolbarMenuActionGroupProps>) => {\n const { iconOnly, disabled, testId } = group.properties;\n const suppressNextTooltip = useRef(false);\n const { iconSize } = useMenu('DropdownMenuToolbarItem', __menuScope);\n const items = useMenuItems(group, propsItems, 'DropdownMenuToolbarItem', __menuScope);\n const activeItem = items?.find((item) => !!(item as MenuAction).properties.checked);\n const icon =\n ((group.properties as any).applyActive &&\n // TODO(thure): Handle other menu item types.\n (activeItem as MenuAction)?.properties.icon) ||\n group.properties.icon;\n const Root = icon ? NaturalToolbar.IconButton : NaturalToolbar.Button;\n const label = (\n <ActionLabel action={(group.properties as any).applyActive && activeItem ? (activeItem as MenuAction) : group} />\n );\n const rootProps = icon\n ? { icon, size: iconSize, iconOnly, label, caretDown: true, suppressNextTooltip }\n : {\n children: (\n <>\n {label}\n <Icon size={3} icon='ph--caret-down--bold' classNames='mis-1' />\n </>\n ),\n };\n return (\n <DropdownMenu.Root group={group} items={items} suppressNextTooltip={suppressNextTooltip}>\n <DropdownMenu.Trigger asChild>\n <Root\n variant='ghost'\n disabled={disabled}\n {...(rootProps as IconButtonProps)}\n {...(testId && { 'data-testid': testId })}\n />\n </DropdownMenu.Trigger>\n </DropdownMenu.Root>\n );\n};\n\nconst ToggleGroupItem = ({ action, __menuScope }: MenuScopedProps<{ action: MenuAction }>) => {\n const { iconSize, onAction } = useMenu('ToggleGroupItem', __menuScope);\n const { icon, iconOnly = true, disabled, testId, hidden, classNames } = action.properties;\n const handleClick = useCallback(() => {\n onAction?.(action);\n }, [action, onAction]);\n const Root = icon ? NaturalToolbar.ToggleGroupIconItem : NaturalToolbar.ToggleGroupItem;\n const rootProps = icon\n ? { icon, size: iconSize, iconOnly, label: <ActionLabel action={action} /> }\n : { children: <ActionLabel action={action} /> };\n return hidden ? null : (\n <Root\n key={action.id}\n value={action.id as any}\n disabled={disabled}\n onClick={handleClick}\n variant='ghost'\n {...(testId && { 'data-testid': testId })}\n {...(rootProps as IconButtonProps)}\n classNames={classNames}\n />\n );\n};\n\nconst ToggleGroupToolbarItem = ({\n group,\n items: propsItems,\n __menuScope,\n}: MenuScopedProps<ToolbarMenuActionGroupProps>) => {\n const items = useMenuItems(group, propsItems, 'ToggleGroupToolbarItem', __menuScope);\n const { selectCardinality, value } = group.properties;\n return (\n // TODO(thure): The type here is difficult to manage, what do?\n // @ts-ignore\n <NaturalToolbar.ToggleGroup type={selectCardinality} value={value}>\n {\n // TODO(thure): Handle other menu item types.\n (items as MenuAction[]).map((action) => (\n <ToggleGroupItem key={action.id} action={action} />\n ))\n }\n </NaturalToolbar.ToggleGroup>\n );\n};\n\nexport const ToolbarMenu = ({ __menuScope, classNames, ...props }: MenuScopedProps<ToolbarMenuProps>) => {\n const items = useMenuItems(undefined, undefined, 'ToolbarMenu', __menuScope);\n const { attendableId } = useMenu('ToolbarMenu', __menuScope);\n const { hasAttention } = useAttention(attendableId);\n return (\n <NaturalToolbar.Root\n {...props}\n classNames={['p-0 pointer-fine:p-1 attention-surface', !hasAttention && 'opacity-20', classNames]}\n >\n {items?.map((item: MenuItem, i: number) =>\n isSeparator(item) ? (\n <NaturalToolbar.Separator key={i} variant={item.properties.variant} />\n ) : isMenuGroup(item) ? (\n item.properties.variant === 'dropdownMenu' ? (\n // TODO(thure): Figure out type narrowing that doesn’t require so much use of `as`.\n <DropdownMenuToolbarItem key={item.id} group={item as MenuItemGroup<ToolbarMenuActionGroupProperties>} />\n ) : (\n // TODO(thure): Figure out type narrowing that doesn’t require so much use of `as`.\n <ToggleGroupToolbarItem key={item.id} group={item as MenuItemGroup<ToolbarMenuActionGroupProperties>} />\n )\n ) : (\n // TODO(thure): Figure out type narrowing that doesn’t require so much use of `as`.\n <ActionToolbarItem key={item.id} action={item as MenuAction} />\n ),\n )}\n </NaturalToolbar.Root>\n );\n};\n", "//\n// Copyright 2025 DXOS.org\n//\nimport { type Node, type Action, type ActionGroup, ACTION_GROUP_TYPE } from '@dxos/app-graph';\nimport { type ToolbarSeparatorProps, type Label, type IconButtonProps, type ClassNameValue } from '@dxos/react-ui';\n\nexport type MenuActionProperties = {\n label: Label;\n icon?: string;\n value?: string;\n disabled?: boolean;\n hidden?: boolean;\n iconOnly?: boolean;\n testId?: string;\n variant?: 'action' | 'toggle';\n checked?: boolean;\n classNames?: ClassNameValue;\n};\n\nexport type MenuItemGroupProperties = {\n label: Label;\n icon?: string;\n iconOnly?: boolean;\n};\n\nexport type MenuAction<P extends {} = {}> = Action<P & MenuActionProperties>;\n\nexport type MenuActionHandler<A extends Node = MenuAction> = (action: A) => void;\n\nexport const MenuSeparatorType = '@dxos/react-ui-toolbar/separator' as const;\n\nexport type MenuSeparator = Node<never, Pick<ToolbarSeparatorProps, 'variant'>> & {\n type: typeof MenuSeparatorType;\n};\n\nexport const isSeparator = (node: Node): node is MenuSeparator => node.type === MenuSeparatorType;\n\nexport type MenuSingleSelectActionGroup = { selectCardinality: 'single'; value: string };\nexport type MenuMultipleSelectActionGroup = { selectCardinality: 'multiple'; value: string[] };\n\nexport type MenuItemGroup<P extends Record<string, any> = Record<string, any>> = ActionGroup<P>;\n\nexport const isMenuGroup = (node: Node): node is MenuItemGroup => node.type === ACTION_GROUP_TYPE;\n\nexport type MenuItem = MenuSeparator | MenuAction | MenuItemGroup;\n\nexport type MenuItemsResolver = (group?: MenuItemGroup) => MenuItem[] | null;\n\nexport type MenuContextValue<A extends Node = MenuAction> = {\n resolveGroupItems: MenuItemsResolver;\n iconSize: IconButtonProps['size'];\n onAction: MenuActionHandler<A>;\n attendableId?: string;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useSignalEffect } from '@preact/signals-react';\nimport { useCallback, useState } from 'react';\n\nimport { Graph, type NodeArg, type Node } from '@dxos/app-graph';\n\nimport { type MenuItem, type MenuItemGroup } from './defs';\n\ntype Edge = { source: string; target: string };\n\nconst edgesArrayToRecord = (edges: { source: string; target: string }[]): Record<string, string[]> => {\n return Object.fromEntries(\n Object.entries(\n edges.reduce((acc: Record<string, { inbound: string[]; outbound: string[] }>, { source, target }) => {\n if (!acc[source]) {\n acc[source] = { inbound: [], outbound: [] };\n }\n if (!acc[target]) {\n acc[target] = { inbound: [], outbound: [] };\n }\n\n const sourceEdges = acc[source];\n if (!sourceEdges.outbound.includes(target)) {\n sourceEdges.outbound.push(target);\n }\n\n const targetEdges = acc[target];\n if (!targetEdges.inbound.includes(source)) {\n targetEdges.inbound.push(source);\n }\n\n return acc;\n }, {}),\n ).map(([id, { outbound }]): [string, string[]] => [id, outbound]),\n );\n};\n\nexport type ActionGraphNodes = NodeArg<any>[];\nexport type ActionGraphEdges = Edge[];\nexport type ActionGraphProps = { nodes: ActionGraphNodes; edges: ActionGraphEdges };\n\nexport const useMenuActions = (actionCreator: () => ActionGraphProps) => {\n const initialMenuGraphProps = actionCreator();\n\n const [graph] = useState(\n new Graph({ nodes: initialMenuGraphProps.nodes as Node[], edges: edgesArrayToRecord(initialMenuGraphProps.edges) }),\n );\n\n useSignalEffect(() => {\n const menuGraphProps = actionCreator();\n // @ts-ignore\n graph._addNodes(menuGraphProps.nodes);\n // @ts-ignore\n graph._addEdges(menuGraphProps.edges);\n });\n\n const resolveGroupItems = useCallback(\n (sourceNode: MenuItemGroup = graph.root as MenuItemGroup) => {\n if (graph) {\n return (graph.nodes(sourceNode, { filter: (n): n is any => true }) || null) as MenuItem[] | null;\n } else {\n return null;\n }\n },\n [graph],\n );\n\n return { resolveGroupItems };\n};\n"],
|
|
5
|
+
"mappings": ";;;AAIA,SAASA,4BAA4B;AACrC,OAAOC,UAA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CAACM,YAAYL,QAAQG,SAASL,MAAAA,GAAS;AACzCO,kBAAYL,QAAQI,KAAKN,MAAAA;IAC3B;AAEA,WAAOD;EACT,GAAG,CAAC,CAAA,CAAA,EACJS,IAAI,CAAC,CAACC,IAAI,EAAEN,SAAQ,CAAE,MAA0B;IAACM;IAAIN;GAAS,CAAA;AAEpE;AAMO,IAAMO,iBAAiB,CAACC,kBAAAA;AAC7B,QAAMC,wBAAwBD,cAAAA;AAE9B,QAAM,CAACE,KAAAA,IAASC,SACd,IAAIC,MAAM;IAAEC,OAAOJ,sBAAsBI;IAAiBtB,OAAOD,mBAAmBmB,sBAAsBlB,KAAK;EAAE,CAAA,CAAA;AAGnHuB,kBAAgB,MAAA;AACd,UAAMC,iBAAiBP,cAAAA;AAEvBE,UAAMM,UAAUD,eAAeF,KAAK;AAEpCH,UAAMO,UAAUF,eAAexB,KAAK;EACtC,CAAA;AAEA,QAAM2B,oBAAoBC,aACxB,CAACC,aAA4BV,MAAMW,SAAqB;AACtD,QAAIX,OAAO;AACT,aAAQA,MAAMG,MAAMO,YAAY;QAAEE,QAAQ,CAACC,MAAgB;MAAK,CAAA,KAAM;IACxE,OAAO;AACL,aAAO;IACT;EACF,GACA;IAACb;GAAM;AAGT,SAAO;IAAEQ;EAAkB;AAC7B;",
|
|
6
|
+
"names": ["useControllableState", "React", "useCallback", "DropdownMenu", "NaturalDropdownMenu", "Icon", "React", "keySymbols", "toLocalizedString", "useTranslation", "mx", "descriptionText", "translationKey", "ACTION_GROUP_TYPE", "ACTION_TYPE", "actionGroupSymbol", "getHostPlatform", "getShortcut", "action", "properties", "keyBinding", "getHostPlatform", "noop", "createMenuAction", "id", "properties", "type", "ACTION_TYPE", "data", "createMenuItemGroup", "ACTION_GROUP_TYPE", "actionGroupSymbol", "createGapSeparator", "source", "nodes", "variant", "undefined", "edges", "target", "createLineSeparator", "ActionLabel", "action", "shortcut", "getShortcut", "t", "useTranslation", "translationKey", "span", "className", "toLocalizedString", "properties", "label", "mx", "descriptionText", "keySymbols", "join", "createContextScope", "React", "useMemo", "MENU_NAME", "createMenuContext", "createMenuScope", "createContextScope", "MenuContextProvider", "useMenu", "menuContextDefaults", "iconSize", "onAction", "resolveGroupItems", "useMenuScope", "MenuProvider", "children", "attendableId", "scope", "undefined", "React", "useMenuItems", "group", "propsItems", "consumerName", "__menuScope", "useMemo", "DropdownMenuItem", "item", "onClick", "__menuScope", "action", "handleClick", "useCallback", "event", "iconSize", "useMenu", "React", "NaturalDropdownMenu", "Item", "classNames", "disabled", "properties", "testId", "icon", "Icon", "size", "ActionLabel", "DropdownMenuRoot", "items", "propsItems", "group", "open", "defaultOpen", "onOpenChange", "suppressNextTooltip", "children", "naturalProps", "optionsMenuOpen", "setOptionsMenuOpen", "useControllableState", "prop", "defaultProp", "onChange", "onAction", "handleActionClick", "stopPropagation", "current", "useMenuItems", "Root", "nextOpen", "Portal", "Content", "Viewport", "map", "key", "id", "Arrow", "DropdownMenu", "Trigger", "VirtualTrigger", "React", "useCallback", "useRef", "Icon", "Toolbar", "NaturalToolbar", "useAttention", "ACTION_GROUP_TYPE", "MenuSeparatorType", "isSeparator", "node", "type", "isMenuGroup", "ACTION_GROUP_TYPE", "ActionToolbarItem", "action", "__menuScope", "onAction", "iconSize", "useMenu", "handleClick", "useCallback", "icon", "iconOnly", "disabled", "testId", "hidden", "classNames", "properties", "Root", "NaturalToolbar", "IconButton", "Button", "rootProps", "size", "label", "React", "ActionLabel", "children", "key", "id", "onClick", "variant", "DropdownMenuToolbarItem", "group", "items", "propsItems", "suppressNextTooltip", "useRef", "useMenuItems", "activeItem", "find", "item", "checked", "applyActive", "caretDown", "Icon", "DropdownMenu", "Trigger", "asChild", "ToggleGroupItem", "ToggleGroupIconItem", "value", "ToggleGroupToolbarItem", "selectCardinality", "ToggleGroup", "type", "map", "ToolbarMenu", "props", "undefined", "attendableId", "hasAttention", "useAttention", "i", "isSeparator", "Separator", "isMenuGroup", "useSignalEffect", "useCallback", "useState", "Graph", "edgesArrayToRecord", "edges", "Object", "fromEntries", "entries", "reduce", "acc", "source", "target", "inbound", "outbound", "sourceEdges", "includes", "push", "targetEdges", "map", "id", "useMenuActions", "actionCreator", "initialMenuGraphProps", "graph", "useState", "Graph", "nodes", "useSignalEffect", "menuGraphProps", "_addNodes", "_addEdges", "resolveGroupItems", "useCallback", "sourceNode", "root", "filter", "n"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"packages/ui/react-ui-menu/src/translations.ts":{"bytes":909,"imports":[],"format":"esm"},"packages/ui/react-ui-menu/src/util.ts":{"bytes":6574,"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-menu/src/components/ActionLabel.tsx":{"bytes":3310,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/keyboard","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-menu/src/translations.ts","kind":"import-statement","original":"../translations"},{"path":"packages/ui/react-ui-menu/src/util.ts","kind":"import-statement","original":"../util"}],"format":"esm"},"packages/ui/react-ui-menu/src/components/MenuContext.tsx":{"bytes":5456,"imports":[{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-menu/src/components/DropdownMenu.tsx":{"bytes":11213,"imports":[{"path":"@radix-ui/react-use-controllable-state","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-menu/src/components/ActionLabel.tsx","kind":"import-statement","original":"./ActionLabel"},{"path":"packages/ui/react-ui-menu/src/components/MenuContext.tsx","kind":"import-statement","original":"./MenuContext"}],"format":"esm"},"packages/ui/react-ui-menu/src/defs.ts":{"bytes":3442,"imports":[{"path":"@dxos/app-graph","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-menu/src/components/ToolbarMenu.tsx":{"bytes":21829,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-attention","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-menu/src/components/ActionLabel.tsx","kind":"import-statement","original":"./ActionLabel"},{"path":"packages/ui/react-ui-menu/src/components/DropdownMenu.tsx","kind":"import-statement","original":"./DropdownMenu"},{"path":"packages/ui/react-ui-menu/src/components/MenuContext.tsx","kind":"import-statement","original":"./MenuContext"},{"path":"packages/ui/react-ui-menu/src/defs.ts","kind":"import-statement","original":"../defs"}],"format":"esm"},"packages/ui/react-ui-menu/src/components/index.ts":{"bytes":718,"imports":[{"path":"packages/ui/react-ui-menu/src/components/DropdownMenu.tsx","kind":"import-statement","original":"./DropdownMenu"},{"path":"packages/ui/react-ui-menu/src/components/ToolbarMenu.tsx","kind":"import-statement","original":"./ToolbarMenu"},{"path":"packages/ui/react-ui-menu/src/components/MenuContext.tsx","kind":"import-statement","original":"./MenuContext"}],"format":"esm"},"packages/ui/react-ui-menu/src/hooks.ts":{"bytes":7464,"imports":[{"path":"@preact/signals-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-menu/src/index.ts":{"bytes":1113,"imports":[{"path":"packages/ui/react-ui-menu/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/ui/react-ui-menu/src/defs.ts","kind":"import-statement","original":"./defs"},{"path":"packages/ui/react-ui-menu/src/hooks.ts","kind":"import-statement","original":"./hooks"},{"path":"packages/ui/react-ui-menu/src/util.ts","kind":"import-statement","original":"./util"}],"format":"esm"}},"outputs":{"packages/ui/react-ui-menu/dist/lib/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":31232},"packages/ui/react-ui-menu/dist/lib/node-esm/index.mjs":{"imports":[{"path":"@radix-ui/react-use-controllable-state","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/keyboard","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"@dxos/util","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-attention","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true},{"path":"@preact/signals-react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/app-graph","kind":"import-statement","external":true}],"exports":["DropdownMenu","MenuProvider","MenuSeparatorType","ToolbarMenu","createGapSeparator","createLineSeparator","createMenuAction","createMenuItemGroup","createMenuScope","isMenuGroup","isSeparator","menuContextDefaults","useMenu","useMenuActions","useMenuItems"],"entryPoint":"packages/ui/react-ui-menu/src/index.ts","inputs":{"packages/ui/react-ui-menu/src/components/DropdownMenu.tsx":{"bytesInOutput":2542},"packages/ui/react-ui-menu/src/components/ActionLabel.tsx":{"bytesInOutput":667},"packages/ui/react-ui-menu/src/translations.ts":{"bytesInOutput":118},"packages/ui/react-ui-menu/src/util.ts":{"bytesInOutput":1125},"packages/ui/react-ui-menu/src/components/MenuContext.tsx":{"bytesInOutput":1119},"packages/ui/react-ui-menu/src/components/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-menu/src/components/ToolbarMenu.tsx":{"bytesInOutput":5542},"packages/ui/react-ui-menu/src/defs.ts":{"bytesInOutput":258},"packages/ui/react-ui-menu/src/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-menu/src/hooks.ts":{"bytesInOutput":1519}},"bytes":13907}}}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type Action, type ActionGroup } from '@dxos/app-graph';
|
|
3
|
+
import { type MenuActionProperties } from '../defs';
|
|
4
|
+
export declare const ActionLabel: ({ action, }: {
|
|
5
|
+
action: Action<MenuActionProperties> | ActionGroup<Omit<MenuActionProperties, "variant">>;
|
|
6
|
+
}) => React.JSX.Element;
|
|
7
|
+
//# sourceMappingURL=ActionLabel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionLabel.d.ts","sourceRoot":"","sources":["../../../../src/components/ActionLabel.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAKhE,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAIpD,eAAO,MAAM,WAAW,gBAErB;IACD,MAAM,EAAE,MAAM,CAAC,oBAAoB,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,CAAC,CAAC;CAC3F,sBAUA,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { type MutableRefObject } from 'react';
|
|
2
|
+
import { type DropdownMenuRootProps } from '@dxos/react-ui';
|
|
3
|
+
import { type MenuScopedProps } from './MenuContext';
|
|
4
|
+
import { type MenuItem, type MenuItemGroup } from '../defs';
|
|
5
|
+
export type DropdownMenuProps = DropdownMenuRootProps & {
|
|
6
|
+
group?: MenuItemGroup;
|
|
7
|
+
items?: MenuItem[];
|
|
8
|
+
suppressNextTooltip?: MutableRefObject<boolean>;
|
|
9
|
+
};
|
|
10
|
+
export declare const DropdownMenu: {
|
|
11
|
+
Root: ({ items: propsItems, group, open, defaultOpen, onOpenChange, suppressNextTooltip, children, __menuScope, ...naturalProps }: MenuScopedProps<DropdownMenuProps>) => React.JSX.Element;
|
|
12
|
+
Trigger: React.ForwardRefExoticComponent<import("@dxos/react-ui").DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
13
|
+
VirtualTrigger: {
|
|
14
|
+
(props: import("@dxos/react-ui").DropdownMenuVirtualTriggerProps & {
|
|
15
|
+
__scopeDropdownMenu?: import("@radix-ui/react-context").Scope;
|
|
16
|
+
}): React.JSX.Element;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=DropdownMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropdownMenu.d.ts","sourceRoot":"","sources":["../../../../src/components/DropdownMenu.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAAmB,KAAK,gBAAgB,EAAe,MAAM,OAAO,CAAC;AAEnF,OAAO,EAA6C,KAAK,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAGvG,OAAO,EAAE,KAAK,eAAe,EAAyB,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAmB,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7E,MAAM,MAAM,iBAAiB,GAAG,qBAAqB,GAAG;IACtD,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,mBAAmB,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;CACjD,CAAC;AA0FF,eAAO,MAAM,YAAY;uIArDtB,eAAe,CAAC,iBAAiB,CAAC;;;;;YA0D+pB,MAAO,GAAG,CAAC,OAAO;;;CADrtB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Scope } from '@radix-ui/react-context';
|
|
2
|
+
import React, { type PropsWithChildren } from 'react';
|
|
3
|
+
import { type MenuContextValue, type MenuItem, type MenuItemGroup } from '../defs';
|
|
4
|
+
export type MenuScopedProps<P> = P & {
|
|
5
|
+
__menuScope?: Scope;
|
|
6
|
+
};
|
|
7
|
+
declare const createMenuScope: import("@radix-ui/react-context").CreateScope;
|
|
8
|
+
declare const useMenu: (consumerName: string, scope: Scope<MenuContextValue | undefined>) => MenuContextValue;
|
|
9
|
+
export declare const menuContextDefaults: MenuContextValue;
|
|
10
|
+
declare const MenuProvider: ({ children, resolveGroupItems, onAction, iconSize, attendableId, }: PropsWithChildren<Partial<MenuContextValue>>) => React.JSX.Element;
|
|
11
|
+
export declare const useMenuItems: (group?: MenuItemGroup, propsItems?: MenuItem[], consumerName?: string, __menuScope?: Scope) => MenuItem[] | undefined;
|
|
12
|
+
export { useMenu, createMenuScope, MenuProvider };
|
|
13
|
+
//# sourceMappingURL=MenuContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuContext.d.ts","sourceRoot":"","sources":["../../../../src/components/MenuContext.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAsB,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAW,MAAM,OAAO,CAAC;AAE/D,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAEnF,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,WAAW,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAI7D,QAAA,MAA0B,eAAe,+CAAqC,CAAC;AAE/E,QAAA,MAA4B,OAAO,wFAAkD,CAAC;AAEtF,eAAO,MAAM,mBAAmB,EAAE,gBAIjC,CAAC;AAIF,QAAA,MAAM,YAAY,uEAMf,iBAAiB,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,sBAa9C,CAAC;AAEF,eAAO,MAAM,YAAY,WACf,aAAa,eACR,QAAQ,EAAE,iBACT,MAAM,gBACN,KAAK,2BAIpB,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ToolbarRootProps } from '@dxos/react-ui';
|
|
3
|
+
import { type MenuScopedProps } from './MenuContext';
|
|
4
|
+
import { type MenuItem, type MenuItemGroup, type MenuActionProperties, type MenuMultipleSelectActionGroup, type MenuSingleSelectActionGroup } from '../defs';
|
|
5
|
+
export type ToolbarMenuDropdownMenuActionGroup = Omit<MenuActionProperties, 'variant' | 'icon'> & {
|
|
6
|
+
variant: 'dropdownMenu';
|
|
7
|
+
icon: string;
|
|
8
|
+
applyActive?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type ToolbarMenuToggleGroupActionGroup = Omit<MenuActionProperties, 'variant'> & {
|
|
11
|
+
variant: 'toggleGroup';
|
|
12
|
+
};
|
|
13
|
+
export type ToolbarMenuActionGroupProperties = (ToolbarMenuDropdownMenuActionGroup | ToolbarMenuToggleGroupActionGroup) & (MenuSingleSelectActionGroup | MenuMultipleSelectActionGroup);
|
|
14
|
+
export type ToolbarMenuProps = ToolbarRootProps;
|
|
15
|
+
export type ToolbarMenuActionGroupProps = {
|
|
16
|
+
group: MenuItemGroup<ToolbarMenuActionGroupProperties>;
|
|
17
|
+
items?: MenuItem[];
|
|
18
|
+
};
|
|
19
|
+
export declare const ToolbarMenu: ({ __menuScope, classNames, ...props }: MenuScopedProps<ToolbarMenuProps>) => React.JSX.Element;
|
|
20
|
+
//# sourceMappingURL=ToolbarMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolbarMenu.d.ts","sourceRoot":"","sources":["../../../../src/components/ToolbarMenu.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAyD,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAK9G,OAAO,EAAE,KAAK,eAAe,EAAyB,MAAM,eAAe,CAAC;AAC5E,OAAO,EAEL,KAAK,QAAQ,EAGb,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,6BAA6B,EAClC,KAAK,2BAA2B,EACjC,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,kCAAkC,GAAG,IAAI,CAAC,oBAAoB,EAAE,SAAS,GAAG,MAAM,CAAC,GAAG;IAChG,OAAO,EAAE,cAAc,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,GAAG;IACtF,OAAO,EAAE,aAAa,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG,CAC3C,kCAAkC,GAClC,iCAAiC,CACpC,GACC,CAAC,2BAA2B,GAAG,6BAA6B,CAAC,CAAC;AAEhE,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAEhD,MAAM,MAAM,2BAA2B,GAAG;IACxC,KAAK,EAAE,aAAa,CAAC,gCAAgC,CAAC,CAAC;IACvD,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;CACpB,CAAC;AAiHF,eAAO,MAAM,WAAW,0CAA2C,eAAe,CAAC,gBAAgB,CAAC,sBA2BnG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|