@dxos/plugin-navtree 0.7.2 → 0.7.3-staging.0905f03
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/dist/lib/browser/index.mjs +163 -178
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/NavTreePlugin.d.ts +1 -1
- package/dist/types/src/NavTreePlugin.d.ts.map +1 -1
- package/dist/types/src/components/NavTree.d.ts +3 -3
- package/dist/types/src/components/NavTree.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeContainer.d.ts +1 -1
- package/dist/types/src/components/NavTreeContainer.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/testing/generator.d.ts +2 -2
- package/dist/types/src/testing/generator.d.ts.map +1 -1
- package/package.json +29 -28
- package/src/NavTreePlugin.tsx +13 -35
- package/src/components/NavTree.stories.tsx +1 -1
- package/src/components/NavTree.tsx +7 -7
- package/src/components/NavTreeContainer.tsx +35 -15
- package/src/components/index.ts +0 -1
- package/src/stories/Graph.stories.tsx +1 -1
- package/src/testing/generator.ts +6 -9
- package/dist/types/src/components/NavBarStart.d.ts +0 -7
- package/dist/types/src/components/NavBarStart.d.ts.map +0 -1
- package/src/components/NavBarStart.tsx +0 -46
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
|
|
7
7
|
// packages/plugins/plugin-navtree/src/NavTreePlugin.tsx
|
|
8
8
|
import { effect } from "@preact/signals-core";
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
9
|
+
import React9 from "react";
|
|
10
|
+
import { LayoutAction as LayoutAction4, NavigationAction as NavigationAction2, parseGraphPlugin, parseIntentPlugin, parseLayoutPlugin, parseNavigationPlugin as parseNavigationPlugin2, resolvePlugin } from "@dxos/app-framework";
|
|
11
11
|
import { createExtension, isAction as isAction5, isGraphNode } from "@dxos/app-graph";
|
|
12
|
-
import { create } from "@dxos/echo-schema";
|
|
13
12
|
import { Keyboard as Keyboard2 } from "@dxos/keyboard";
|
|
13
|
+
import { create } from "@dxos/live-object";
|
|
14
14
|
import { Path } from "@dxos/react-ui-mosaic";
|
|
15
15
|
import { getHostPlatform as getHostPlatform3 } from "@dxos/util";
|
|
16
16
|
|
|
@@ -118,46 +118,17 @@ var CommandsDialogContent = ({ selected: initial }) => {
|
|
|
118
118
|
}))));
|
|
119
119
|
};
|
|
120
120
|
|
|
121
|
-
// packages/plugins/plugin-navtree/src/components/NavBarStart.tsx
|
|
122
|
-
import React2, { Fragment } from "react";
|
|
123
|
-
import { getGraph } from "@dxos/app-graph";
|
|
124
|
-
import { Popover, toLocalizedString as toLocalizedString2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
125
|
-
import { StackItem } from "@dxos/react-ui-stack";
|
|
126
|
-
var TREE_ITEM_MAIN_HEADING = "TreeItemMainHeading";
|
|
127
|
-
var NavBarStart = ({ activeNode, popoverAnchorId }) => {
|
|
128
|
-
const { t } = useTranslation2(NAVTREE_PLUGIN);
|
|
129
|
-
const ActionRoot = popoverAnchorId === `dxos.org/ui/${TREE_ITEM_MAIN_HEADING}/${activeNode.id}` || popoverAnchorId === `dxos.org/ui/${KEY_BINDING}/${activeNode.id}` ? Popover.Anchor : Fragment;
|
|
130
|
-
const graph = getGraph(activeNode);
|
|
131
|
-
const actions = graph.actions(activeNode);
|
|
132
|
-
const label = toLocalizedString2(activeNode.properties?.label, t);
|
|
133
|
-
const menuTriggerLabel = t("node actions menu invoker label");
|
|
134
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(ActionRoot, null, /* @__PURE__ */ React2.createElement(StackItem.Sigil, {
|
|
135
|
-
icon: activeNode.properties?.icon ?? "ph--dots-three-vertical--regular",
|
|
136
|
-
attendableId: activeNode.id,
|
|
137
|
-
triggerLabel: menuTriggerLabel,
|
|
138
|
-
actions: [
|
|
139
|
-
actions
|
|
140
|
-
],
|
|
141
|
-
onAction: (action) => typeof action.data === "function" && action.data({
|
|
142
|
-
node: action,
|
|
143
|
-
caller: TREE_ITEM_MAIN_HEADING
|
|
144
|
-
})
|
|
145
|
-
})), /* @__PURE__ */ React2.createElement(StackItem.HeadingLabel, {
|
|
146
|
-
attendableId: activeNode.id
|
|
147
|
-
}, label));
|
|
148
|
-
};
|
|
149
|
-
|
|
150
121
|
// packages/plugins/plugin-navtree/src/components/NavTree.tsx
|
|
151
|
-
import
|
|
122
|
+
import React3, { Fragment, useCallback, useEffect } from "react";
|
|
152
123
|
import { isAction as isAction2 } from "@dxos/app-graph";
|
|
153
|
-
import { Popover
|
|
124
|
+
import { Popover, toLocalizedString as toLocalizedString3, Treegrid, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
154
125
|
import { Tree } from "@dxos/react-ui-list";
|
|
155
126
|
|
|
156
127
|
// packages/plugins/plugin-navtree/src/components/NavTreeItemAction.tsx
|
|
157
128
|
import { useControllableState } from "@radix-ui/react-use-controllable-state";
|
|
158
|
-
import
|
|
129
|
+
import React2, { useRef, useState as useState2 } from "react";
|
|
159
130
|
import { keySymbols as keySymbols2 } from "@dxos/keyboard";
|
|
160
|
-
import { Button as Button2, Dialog as Dialog2, DropdownMenu, ContextMenu, Tooltip, useTranslation as
|
|
131
|
+
import { Button as Button2, Dialog as Dialog2, DropdownMenu, ContextMenu, Tooltip, useTranslation as useTranslation2, toLocalizedString as toLocalizedString2, Icon as Icon2 } from "@dxos/react-ui";
|
|
161
132
|
import { SearchList as SearchList2 } from "@dxos/react-ui-searchlist";
|
|
162
133
|
import { descriptionText as descriptionText2, hoverableControlItem, hoverableOpenControlItem, mx as mx2 } from "@dxos/react-ui-theme";
|
|
163
134
|
import { getHostPlatform as getHostPlatform2 } from "@dxos/util";
|
|
@@ -166,13 +137,13 @@ var getShortcut = (action) => {
|
|
|
166
137
|
};
|
|
167
138
|
var fallbackIcon = "ph--placeholder--regular";
|
|
168
139
|
var NavTreeItemActionDropdownMenu = ({ label, icon, testId, defaultMenuOpen, menuActions, menuOpen, suppressNextTooltip, onChangeMenuOpen, onAction }) => {
|
|
169
|
-
const { t } =
|
|
140
|
+
const { t } = useTranslation2(NAVTREE_PLUGIN);
|
|
170
141
|
const [optionsMenuOpen, setOptionsMenuOpen] = useControllableState({
|
|
171
142
|
prop: menuOpen,
|
|
172
143
|
defaultProp: defaultMenuOpen,
|
|
173
144
|
onChange: onChangeMenuOpen
|
|
174
145
|
});
|
|
175
|
-
return /* @__PURE__ */
|
|
146
|
+
return /* @__PURE__ */ React2.createElement(DropdownMenu.Root, {
|
|
176
147
|
open: optionsMenuOpen,
|
|
177
148
|
onOpenChange: (nextOpen) => {
|
|
178
149
|
if (!nextOpen && suppressNextTooltip) {
|
|
@@ -180,26 +151,26 @@ var NavTreeItemActionDropdownMenu = ({ label, icon, testId, defaultMenuOpen, men
|
|
|
180
151
|
}
|
|
181
152
|
return setOptionsMenuOpen(nextOpen);
|
|
182
153
|
}
|
|
183
|
-
}, /* @__PURE__ */
|
|
154
|
+
}, /* @__PURE__ */ React2.createElement(Tooltip.Trigger, {
|
|
184
155
|
asChild: true
|
|
185
|
-
}, /* @__PURE__ */
|
|
156
|
+
}, /* @__PURE__ */ React2.createElement(DropdownMenu.Trigger, {
|
|
186
157
|
asChild: true
|
|
187
|
-
}, /* @__PURE__ */
|
|
158
|
+
}, /* @__PURE__ */ React2.createElement(Button2, {
|
|
188
159
|
variant: "ghost",
|
|
189
160
|
density: "fine",
|
|
190
161
|
classNames: mx2("shrink-0 !pli-2 pointer-fine:!pli-1", hoverableControlItem, hoverableOpenControlItem),
|
|
191
162
|
"data-testid": testId,
|
|
192
163
|
"aria-label": t("tree item actions label")
|
|
193
|
-
}, /* @__PURE__ */
|
|
164
|
+
}, /* @__PURE__ */ React2.createElement("span", {
|
|
194
165
|
className: "sr-only"
|
|
195
|
-
},
|
|
166
|
+
}, toLocalizedString2(label, t)), /* @__PURE__ */ React2.createElement(Icon2, {
|
|
196
167
|
icon: icon ?? fallbackIcon,
|
|
197
168
|
size: 4
|
|
198
|
-
})))), /* @__PURE__ */
|
|
169
|
+
})))), /* @__PURE__ */ React2.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Content, {
|
|
199
170
|
classNames: "z-[31]"
|
|
200
|
-
}, /* @__PURE__ */
|
|
171
|
+
}, /* @__PURE__ */ React2.createElement(DropdownMenu.Viewport, null, menuActions?.map((action) => {
|
|
201
172
|
const shortcut = getShortcut(action);
|
|
202
|
-
return /* @__PURE__ */
|
|
173
|
+
return /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
|
|
203
174
|
key: action.id,
|
|
204
175
|
onClick: (event) => {
|
|
205
176
|
if (action.properties?.disabled) {
|
|
@@ -217,26 +188,26 @@ var NavTreeItemActionDropdownMenu = ({ label, icon, testId, defaultMenuOpen, men
|
|
|
217
188
|
...action.properties?.testId && {
|
|
218
189
|
"data-testid": action.properties.testId
|
|
219
190
|
}
|
|
220
|
-
}, action.properties?.icon && /* @__PURE__ */
|
|
191
|
+
}, action.properties?.icon && /* @__PURE__ */ React2.createElement(Icon2, {
|
|
221
192
|
icon: action.properties.icon,
|
|
222
193
|
size: 4
|
|
223
|
-
}), /* @__PURE__ */
|
|
194
|
+
}), /* @__PURE__ */ React2.createElement("span", {
|
|
224
195
|
className: "grow truncate"
|
|
225
|
-
},
|
|
196
|
+
}, toLocalizedString2(action.properties.label, t)), shortcut && /* @__PURE__ */ React2.createElement("span", {
|
|
226
197
|
className: mx2("shrink-0", descriptionText2)
|
|
227
198
|
}, keySymbols2(shortcut).join("")));
|
|
228
|
-
})), /* @__PURE__ */
|
|
199
|
+
})), /* @__PURE__ */ React2.createElement(DropdownMenu.Arrow, null))));
|
|
229
200
|
};
|
|
230
201
|
var NavTreeItemActionSearchList = ({ menuActions, icon, label, testId, suppressNextTooltip, onAction }) => {
|
|
231
|
-
const { t } =
|
|
202
|
+
const { t } = useTranslation2(NAVTREE_PLUGIN);
|
|
232
203
|
const [optionsMenuOpen, setOptionsMenuOpen] = useState2(false);
|
|
233
204
|
const button = useRef(null);
|
|
234
205
|
const sortedActions = menuActions?.sort(({ properties: p1 }, { properties: p2 }) => {
|
|
235
|
-
const t1 =
|
|
236
|
-
const t2 =
|
|
206
|
+
const t1 = toLocalizedString2(p1.label, t).toLowerCase();
|
|
207
|
+
const t2 = toLocalizedString2(p2.label, t).toLowerCase();
|
|
237
208
|
return t1.localeCompare(t2);
|
|
238
209
|
});
|
|
239
|
-
return /* @__PURE__ */
|
|
210
|
+
return /* @__PURE__ */ React2.createElement(Dialog2.Root, {
|
|
240
211
|
open: optionsMenuOpen,
|
|
241
212
|
onOpenChange: (nextOpen) => {
|
|
242
213
|
if (!nextOpen && suppressNextTooltip) {
|
|
@@ -244,11 +215,11 @@ var NavTreeItemActionSearchList = ({ menuActions, icon, label, testId, suppressN
|
|
|
244
215
|
}
|
|
245
216
|
return setOptionsMenuOpen(nextOpen);
|
|
246
217
|
}
|
|
247
|
-
}, /* @__PURE__ */
|
|
218
|
+
}, /* @__PURE__ */ React2.createElement(Tooltip.Trigger, {
|
|
248
219
|
asChild: true
|
|
249
|
-
}, /* @__PURE__ */
|
|
220
|
+
}, /* @__PURE__ */ React2.createElement(Dialog2.Trigger, {
|
|
250
221
|
asChild: true
|
|
251
|
-
}, /* @__PURE__ */
|
|
222
|
+
}, /* @__PURE__ */ React2.createElement(Button2, {
|
|
252
223
|
variant: "ghost",
|
|
253
224
|
density: "fine",
|
|
254
225
|
classNames: mx2("shrink-0 !pli-2 pointer-fine:!pli-1", hoverableControlItem, hoverableOpenControlItem),
|
|
@@ -266,22 +237,22 @@ var NavTreeItemActionSearchList = ({ menuActions, icon, label, testId, suppressN
|
|
|
266
237
|
}
|
|
267
238
|
},
|
|
268
239
|
ref: button
|
|
269
|
-
}, /* @__PURE__ */
|
|
240
|
+
}, /* @__PURE__ */ React2.createElement(Icon2, {
|
|
270
241
|
icon: icon ?? fallbackIcon,
|
|
271
242
|
size: 4
|
|
272
|
-
})))), /* @__PURE__ */
|
|
243
|
+
})))), /* @__PURE__ */ React2.createElement(Dialog2.Portal, null, /* @__PURE__ */ React2.createElement(Dialog2.Overlay, null, /* @__PURE__ */ React2.createElement(Dialog2.Content, {
|
|
273
244
|
classNames: "z-[31] is-full max-is-[24rem] pli-2 plb-1"
|
|
274
|
-
}, /* @__PURE__ */
|
|
245
|
+
}, /* @__PURE__ */ React2.createElement(SearchList2.Root, {
|
|
275
246
|
label: t("tree item searchlist input placeholder")
|
|
276
|
-
}, /* @__PURE__ */
|
|
247
|
+
}, /* @__PURE__ */ React2.createElement(SearchList2.Input, {
|
|
277
248
|
placeholder: t("tree item searchlist input placeholder"),
|
|
278
249
|
classNames: "pli-3"
|
|
279
|
-
}), /* @__PURE__ */
|
|
250
|
+
}), /* @__PURE__ */ React2.createElement(SearchList2.Content, {
|
|
280
251
|
classNames: "min-bs-[12rem] bs-[50dvh] max-bs-[30rem] overflow-auto"
|
|
281
252
|
}, sortedActions?.map((action) => {
|
|
282
|
-
const label2 =
|
|
253
|
+
const label2 = toLocalizedString2(action.properties.label, t);
|
|
283
254
|
const shortcut = getShortcut(action);
|
|
284
|
-
return /* @__PURE__ */
|
|
255
|
+
return /* @__PURE__ */ React2.createElement(SearchList2.Item, {
|
|
285
256
|
// TODO(burdon): Value should be id since label is not unique.
|
|
286
257
|
value: label2,
|
|
287
258
|
key: action.id,
|
|
@@ -300,28 +271,28 @@ var NavTreeItemActionSearchList = ({ menuActions, icon, label, testId, suppressN
|
|
|
300
271
|
...action.properties?.testId && {
|
|
301
272
|
"data-testid": action.properties.testId
|
|
302
273
|
}
|
|
303
|
-
}, action.properties?.icon && /* @__PURE__ */
|
|
274
|
+
}, action.properties?.icon && /* @__PURE__ */ React2.createElement(Icon2, {
|
|
304
275
|
icon: action.properties?.icon,
|
|
305
276
|
size: 4
|
|
306
|
-
}), /* @__PURE__ */
|
|
277
|
+
}), /* @__PURE__ */ React2.createElement("span", {
|
|
307
278
|
className: "grow truncate"
|
|
308
|
-
}, label2), shortcut && /* @__PURE__ */
|
|
279
|
+
}, label2), shortcut && /* @__PURE__ */ React2.createElement("span", {
|
|
309
280
|
className: mx2("shrink-0", descriptionText2)
|
|
310
281
|
}, keySymbols2(shortcut).join("")));
|
|
311
|
-
})), /* @__PURE__ */
|
|
282
|
+
})), /* @__PURE__ */ React2.createElement("div", {
|
|
312
283
|
role: "none",
|
|
313
284
|
className: "flex items-center plb-2 pli-3"
|
|
314
|
-
}, /* @__PURE__ */
|
|
285
|
+
}, /* @__PURE__ */ React2.createElement("span", {
|
|
315
286
|
className: descriptionText2
|
|
316
|
-
},
|
|
287
|
+
}, toLocalizedString2(label, t))))))));
|
|
317
288
|
};
|
|
318
289
|
var NavTreeItemMonolithicAction = ({ parent, properties: { disabled, caller, testId, label, icon } = {
|
|
319
290
|
label: "never"
|
|
320
291
|
}, data: invoke }) => {
|
|
321
|
-
const { t } =
|
|
322
|
-
return /* @__PURE__ */
|
|
292
|
+
const { t } = useTranslation2(NAVTREE_PLUGIN);
|
|
293
|
+
return /* @__PURE__ */ React2.createElement(Tooltip.Trigger, {
|
|
323
294
|
asChild: true
|
|
324
|
-
}, /* @__PURE__ */
|
|
295
|
+
}, /* @__PURE__ */ React2.createElement(Button2, {
|
|
325
296
|
variant: "ghost",
|
|
326
297
|
density: "fine",
|
|
327
298
|
classNames: mx2("shrink-0 !pli-2 pointer-fine:!pli-1", hoverableControlItem, hoverableOpenControlItem),
|
|
@@ -339,20 +310,20 @@ var NavTreeItemMonolithicAction = ({ parent, properties: { disabled, caller, tes
|
|
|
339
310
|
});
|
|
340
311
|
},
|
|
341
312
|
"data-testid": testId
|
|
342
|
-
}, /* @__PURE__ */
|
|
313
|
+
}, /* @__PURE__ */ React2.createElement("span", {
|
|
343
314
|
className: "sr-only"
|
|
344
|
-
},
|
|
315
|
+
}, toLocalizedString2(label, t)), /* @__PURE__ */ React2.createElement(Icon2, {
|
|
345
316
|
icon: icon ?? fallbackIcon,
|
|
346
317
|
size: 4
|
|
347
318
|
})));
|
|
348
319
|
};
|
|
349
320
|
var NavTreeItemAction = ({ monolithic, menuActions, parent: node, ...props }) => {
|
|
350
|
-
const { t } =
|
|
321
|
+
const { t } = useTranslation2(NAVTREE_PLUGIN);
|
|
351
322
|
const suppressNextTooltip = useRef(false);
|
|
352
323
|
const [triggerTooltipOpen, setTriggerTooltipOpen] = useState2(false);
|
|
353
324
|
const monolithicAction = menuActions?.length === 1 && menuActions[0];
|
|
354
|
-
const baseLabel =
|
|
355
|
-
return /* @__PURE__ */
|
|
325
|
+
const baseLabel = toLocalizedString2(monolithicAction ? monolithicAction.properties.label : props.label, t);
|
|
326
|
+
return /* @__PURE__ */ React2.createElement(Tooltip.Root, {
|
|
356
327
|
open: triggerTooltipOpen,
|
|
357
328
|
onOpenChange: (nextOpen) => {
|
|
358
329
|
if (suppressNextTooltip.current) {
|
|
@@ -362,13 +333,13 @@ var NavTreeItemAction = ({ monolithic, menuActions, parent: node, ...props }) =>
|
|
|
362
333
|
setTriggerTooltipOpen(nextOpen);
|
|
363
334
|
}
|
|
364
335
|
}
|
|
365
|
-
}, baseLabel && /* @__PURE__ */
|
|
336
|
+
}, baseLabel && /* @__PURE__ */ React2.createElement(Tooltip.Portal, null, /* @__PURE__ */ React2.createElement(Tooltip.Content, {
|
|
366
337
|
classNames: "z-[31]",
|
|
367
338
|
side: "bottom"
|
|
368
|
-
}, baseLabel, /* @__PURE__ */
|
|
339
|
+
}, baseLabel, /* @__PURE__ */ React2.createElement(Tooltip.Arrow, null))), monolithic && menuActions?.length === 1 ? /* @__PURE__ */ React2.createElement(NavTreeItemMonolithicAction, {
|
|
369
340
|
parent: node,
|
|
370
341
|
...menuActions[0]
|
|
371
|
-
}) : props.menuType === "searchList" ? /* @__PURE__ */
|
|
342
|
+
}) : props.menuType === "searchList" ? /* @__PURE__ */ React2.createElement(NavTreeItemActionSearchList, {
|
|
372
343
|
...props,
|
|
373
344
|
menuActions,
|
|
374
345
|
suppressNextTooltip,
|
|
@@ -378,7 +349,7 @@ var NavTreeItemAction = ({ monolithic, menuActions, parent: node, ...props }) =>
|
|
|
378
349
|
} : {
|
|
379
350
|
node
|
|
380
351
|
})
|
|
381
|
-
}) : /* @__PURE__ */
|
|
352
|
+
}) : /* @__PURE__ */ React2.createElement(NavTreeItemActionDropdownMenu, {
|
|
382
353
|
...props,
|
|
383
354
|
parent: node,
|
|
384
355
|
menuActions,
|
|
@@ -394,39 +365,39 @@ var NavTreeItemAction = ({ monolithic, menuActions, parent: node, ...props }) =>
|
|
|
394
365
|
|
|
395
366
|
// packages/plugins/plugin-navtree/src/components/NavTree.tsx
|
|
396
367
|
var NAV_TREE_ITEM = "NavTreeItem";
|
|
397
|
-
var NavTree = ({ getActions: getActions2, loadDescendents,
|
|
368
|
+
var NavTree = ({ getActions: getActions2, loadDescendents, renderItemEnd: renderItemEnd2, popoverAnchorId, ...props }) => {
|
|
398
369
|
const renderColumns = useCallback(({ item, path, menuOpen, setMenuOpen }) => {
|
|
399
|
-
return /* @__PURE__ */
|
|
370
|
+
return /* @__PURE__ */ React3.createElement(NavTreeColumns, {
|
|
400
371
|
path,
|
|
401
372
|
node: item,
|
|
402
373
|
getActions: getActions2,
|
|
403
374
|
menuOpen,
|
|
404
375
|
setMenuOpen,
|
|
405
376
|
loadDescendents,
|
|
406
|
-
|
|
377
|
+
renderItemEnd: renderItemEnd2,
|
|
407
378
|
popoverAnchorId
|
|
408
379
|
});
|
|
409
380
|
}, [
|
|
410
|
-
|
|
381
|
+
renderItemEnd2,
|
|
411
382
|
popoverAnchorId,
|
|
412
383
|
loadDescendents
|
|
413
384
|
]);
|
|
414
|
-
return /* @__PURE__ */
|
|
385
|
+
return /* @__PURE__ */ React3.createElement(Tree, {
|
|
415
386
|
...props,
|
|
416
387
|
draggable: true,
|
|
417
388
|
gridTemplateColumns: "[tree-row-start] 1fr min-content min-content min-content [tree-row-end]",
|
|
418
389
|
renderColumns
|
|
419
390
|
});
|
|
420
391
|
};
|
|
421
|
-
var NavTreeColumns = ({ path, node, getActions: getActions2, menuOpen, setMenuOpen, loadDescendents,
|
|
422
|
-
const { t } =
|
|
392
|
+
var NavTreeColumns = ({ path, node, getActions: getActions2, menuOpen, setMenuOpen, loadDescendents, renderItemEnd: ItemEnd, popoverAnchorId }) => {
|
|
393
|
+
const { t } = useTranslation3(NAVTREE_PLUGIN);
|
|
423
394
|
const level = path.length - 2;
|
|
424
395
|
const { actions: _actions, groupedActions } = getActions2(node);
|
|
425
396
|
const [primaryAction, ...secondaryActions] = _actions.toSorted((a, b) => a.properties?.disposition === "toolbar" ? -1 : 1);
|
|
426
397
|
const actions = (primaryAction?.properties?.disposition === "toolbar" ? secondaryActions : _actions).flatMap((action) => isAction2(action) ? [
|
|
427
398
|
action
|
|
428
399
|
] : []).filter((action) => !action.properties?.hidden);
|
|
429
|
-
const ActionRoot = popoverAnchorId === `dxos.org/ui/${NAV_TREE_ITEM}/${node.id}` ?
|
|
400
|
+
const ActionRoot = popoverAnchorId === `dxos.org/ui/${NAV_TREE_ITEM}/${node.id}` ? Popover.Anchor : Fragment;
|
|
430
401
|
useEffect(() => {
|
|
431
402
|
const frame = requestAnimationFrame(() => {
|
|
432
403
|
void loadDescendents?.(node);
|
|
@@ -438,9 +409,9 @@ var NavTreeColumns = ({ path, node, getActions: getActions2, menuOpen, setMenuOp
|
|
|
438
409
|
}, [
|
|
439
410
|
primaryAction
|
|
440
411
|
]);
|
|
441
|
-
return /* @__PURE__ */
|
|
412
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, primaryAction?.properties?.disposition === "toolbar" ? /* @__PURE__ */ React3.createElement(NavTreeItemAction, {
|
|
442
413
|
testId: primaryAction.properties?.testId,
|
|
443
|
-
label:
|
|
414
|
+
label: toLocalizedString3(primaryAction.properties?.label, t),
|
|
444
415
|
icon: primaryAction.properties?.icon ?? "ph--placeholder--regular",
|
|
445
416
|
parent: node,
|
|
446
417
|
monolithic: isAction2(primaryAction),
|
|
@@ -449,7 +420,7 @@ var NavTreeColumns = ({ path, node, getActions: getActions2, menuOpen, setMenuOp
|
|
|
449
420
|
] : groupedActions[primaryAction.id],
|
|
450
421
|
menuType: primaryAction.properties?.menuType,
|
|
451
422
|
caller: NAV_TREE_ITEM
|
|
452
|
-
}) : /* @__PURE__ */
|
|
423
|
+
}) : /* @__PURE__ */ React3.createElement(Treegrid.Cell, null), /* @__PURE__ */ React3.createElement(ActionRoot, null, actions.length > 0 ? /* @__PURE__ */ React3.createElement(NavTreeItemAction, {
|
|
453
424
|
testId: `navtree.treeItem.actionsLevel${level}`,
|
|
454
425
|
label: t("tree item actions label"),
|
|
455
426
|
icon: "ph--dots-three-vertical--regular",
|
|
@@ -459,7 +430,7 @@ var NavTreeColumns = ({ path, node, getActions: getActions2, menuOpen, setMenuOp
|
|
|
459
430
|
caller: NAV_TREE_ITEM,
|
|
460
431
|
menuOpen,
|
|
461
432
|
onChangeMenuOpen: setMenuOpen
|
|
462
|
-
}) : /* @__PURE__ */
|
|
433
|
+
}) : /* @__PURE__ */ React3.createElement(Treegrid.Cell, null)), ItemEnd && /* @__PURE__ */ React3.createElement(ItemEnd, {
|
|
463
434
|
node
|
|
464
435
|
}));
|
|
465
436
|
};
|
|
@@ -468,8 +439,8 @@ var NavTreeColumns = ({ path, node, getActions: getActions2, menuOpen, setMenuOp
|
|
|
468
439
|
import { monitorForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
469
440
|
import { extractInstruction } from "@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item";
|
|
470
441
|
import { untracked } from "@preact/signals-core";
|
|
471
|
-
import
|
|
472
|
-
import { NavigationAction, Surface, useIntentDispatcher as useIntentDispatcher3 } from "@dxos/app-framework";
|
|
442
|
+
import React5, { memo, useCallback as useCallback2, useEffect as useEffect2 } from "react";
|
|
443
|
+
import { LayoutAction as LayoutAction2, NavigationAction, Surface, useIntentDispatcher as useIntentDispatcher3 } from "@dxos/app-framework";
|
|
473
444
|
import { isAction as isAction4, isActionLike } from "@dxos/app-graph";
|
|
474
445
|
import { useGraph as useGraph2 } from "@dxos/plugin-graph";
|
|
475
446
|
import { isEchoObject, isSpace } from "@dxos/react-client/echo";
|
|
@@ -481,10 +452,10 @@ import { arrayMove } from "@dxos/util";
|
|
|
481
452
|
// packages/plugins/plugin-navtree/src/components/NavTreeFooter.tsx
|
|
482
453
|
import { ArrowSquareOut, GearSix, Warning } from "@phosphor-icons/react";
|
|
483
454
|
import { formatDistance } from "date-fns/formatDistance";
|
|
484
|
-
import
|
|
455
|
+
import React4 from "react";
|
|
485
456
|
import { SettingsAction, parseNavigationPlugin, useResolvePlugin, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
486
457
|
import { useConfig } from "@dxos/react-client";
|
|
487
|
-
import { Button as Button3, Link, Message, Popover as
|
|
458
|
+
import { Button as Button3, Link, Message, Popover as Popover2, Tooltip as Tooltip2, Trans, useDefaultValue, useSidebars, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
488
459
|
import { LayoutControls } from "@dxos/react-ui-stack";
|
|
489
460
|
import { getSize, mx as mx3 } from "@dxos/react-ui-theme";
|
|
490
461
|
var buttonStyles = "pli-1.5 text-xs font-normal";
|
|
@@ -493,7 +464,7 @@ var VERSION_REGEX = /([\d.]+)/;
|
|
|
493
464
|
var NavTreeFooter = (props) => {
|
|
494
465
|
const layoutPart = useDefaultValue(props.layoutPart, () => "sidebar");
|
|
495
466
|
const config = useConfig();
|
|
496
|
-
const { t } =
|
|
467
|
+
const { t } = useTranslation4(NAVTREE_PLUGIN);
|
|
497
468
|
const { navigationSidebarOpen } = useSidebars(NAVTREE_PLUGIN);
|
|
498
469
|
const dispatch = useIntentDispatcher2();
|
|
499
470
|
const { version, timestamp, commitHash } = config.values.runtime?.app?.build ?? {};
|
|
@@ -501,64 +472,64 @@ var NavTreeFooter = (props) => {
|
|
|
501
472
|
const [_, v] = version?.match(VERSION_REGEX) ?? [];
|
|
502
473
|
const releaseUrl = config.values.runtime?.app?.env?.DX_ENVIRONMENT === "production" ? `${repo}/releases/tag/v${version}` : `${repo}/commit/${commitHash}`;
|
|
503
474
|
const previewUrl = "https://docs.dxos.org/composer#technology-preview";
|
|
504
|
-
return /* @__PURE__ */
|
|
475
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
505
476
|
role: "none",
|
|
506
477
|
className: mx3("flex bs-[--rail-size] pbe-[env(safe-area-inset-bottom)] box-content justify-end", layoutPart === "complementary" && "md:justify-end flex-row-reverse")
|
|
507
|
-
}, /* @__PURE__ */
|
|
478
|
+
}, /* @__PURE__ */ React4.createElement(Popover2.Root, null, /* @__PURE__ */ React4.createElement(Popover2.Trigger, {
|
|
508
479
|
asChild: true
|
|
509
|
-
}, /* @__PURE__ */
|
|
480
|
+
}, /* @__PURE__ */ React4.createElement(Button3, {
|
|
510
481
|
variant: "ghost",
|
|
511
482
|
classNames: buttonStyles,
|
|
512
483
|
...!navigationSidebarOpen && {
|
|
513
484
|
tabIndex: -1
|
|
514
485
|
}
|
|
515
|
-
}, "v", v)), /* @__PURE__ */
|
|
486
|
+
}, "v", v)), /* @__PURE__ */ React4.createElement(Popover2.Portal, null, /* @__PURE__ */ React4.createElement(Popover2.Content, {
|
|
516
487
|
side: "top",
|
|
517
488
|
role: "message",
|
|
518
489
|
classNames: "z-[12] bg-warning-500 max-is-[min(calc(100vw-16px),40ch)]"
|
|
519
|
-
}, /* @__PURE__ */
|
|
490
|
+
}, /* @__PURE__ */ React4.createElement(Message.Root, {
|
|
520
491
|
valence: "warning",
|
|
521
492
|
className: "rounded-be-none p-5"
|
|
522
|
-
}, /* @__PURE__ */
|
|
493
|
+
}, /* @__PURE__ */ React4.createElement(Message.Title, null, /* @__PURE__ */ React4.createElement(Warning, {
|
|
523
494
|
weight: "duotone",
|
|
524
495
|
className: "inline mie-2 is-6 bs-6"
|
|
525
|
-
}), /* @__PURE__ */
|
|
496
|
+
}), /* @__PURE__ */ React4.createElement("span", null, t("warning title"))), /* @__PURE__ */ React4.createElement(Message.Body, null, t("technology preview message"), /* @__PURE__ */ React4.createElement("br", null), /* @__PURE__ */ React4.createElement(Link, {
|
|
526
497
|
href: previewUrl,
|
|
527
498
|
target: "_blank",
|
|
528
499
|
rel: "noreferrer",
|
|
529
500
|
variant: "neutral"
|
|
530
|
-
}, t("learn more label"), /* @__PURE__ */
|
|
501
|
+
}, t("learn more label"), /* @__PURE__ */ React4.createElement(ArrowSquareOut, {
|
|
531
502
|
className: "inline mis-1",
|
|
532
503
|
weight: "bold"
|
|
533
|
-
})))), /* @__PURE__ */
|
|
504
|
+
})))), /* @__PURE__ */ React4.createElement("div", {
|
|
534
505
|
role: "none",
|
|
535
506
|
className: "plb-4 pli-5 space-b-2 text-baseText"
|
|
536
|
-
}, timestamp && /* @__PURE__ */
|
|
507
|
+
}, timestamp && /* @__PURE__ */ React4.createElement("p", null, t("released message", {
|
|
537
508
|
released: formatDistance(new Date(timestamp), /* @__PURE__ */ new Date(), {
|
|
538
509
|
addSuffix: true
|
|
539
510
|
})
|
|
540
|
-
}), /* @__PURE__ */
|
|
511
|
+
}), /* @__PURE__ */ React4.createElement("br", null), /* @__PURE__ */ React4.createElement(Link, {
|
|
541
512
|
href: releaseUrl,
|
|
542
513
|
target: "_blank",
|
|
543
514
|
rel: "noreferrer",
|
|
544
515
|
variant: "neutral"
|
|
545
|
-
}, t("see release label"), /* @__PURE__ */
|
|
516
|
+
}, t("see release label"), /* @__PURE__ */ React4.createElement(ArrowSquareOut, {
|
|
546
517
|
className: "inline mis-1",
|
|
547
518
|
weight: "bold"
|
|
548
|
-
}))), /* @__PURE__ */
|
|
519
|
+
}))), /* @__PURE__ */ React4.createElement("p", null, /* @__PURE__ */ React4.createElement(Trans, {
|
|
549
520
|
t,
|
|
550
521
|
i18nKey: "powered by dxos message",
|
|
551
522
|
components: {
|
|
552
|
-
dxos: /* @__PURE__ */
|
|
523
|
+
dxos: /* @__PURE__ */ React4.createElement(Link, {
|
|
553
524
|
href: "https://dxos.org",
|
|
554
525
|
target: "_blank",
|
|
555
526
|
rel: "noreferrer",
|
|
556
527
|
variant: "neutral"
|
|
557
528
|
})
|
|
558
529
|
}
|
|
559
|
-
}))), /* @__PURE__ */
|
|
530
|
+
}))), /* @__PURE__ */ React4.createElement(Popover2.Arrow, null)))), /* @__PURE__ */ React4.createElement(Tooltip2.Root, null, /* @__PURE__ */ React4.createElement(Tooltip2.Trigger, {
|
|
560
531
|
asChild: true
|
|
561
|
-
}, /* @__PURE__ */
|
|
532
|
+
}, /* @__PURE__ */ React4.createElement(Button3, {
|
|
562
533
|
variant: "ghost",
|
|
563
534
|
classNames: buttonStyles,
|
|
564
535
|
"data-testid": "treeView.openSettings",
|
|
@@ -569,13 +540,13 @@ var NavTreeFooter = (props) => {
|
|
|
569
540
|
onClick: () => dispatch({
|
|
570
541
|
action: SettingsAction.OPEN
|
|
571
542
|
})
|
|
572
|
-
}, /* @__PURE__ */
|
|
543
|
+
}, /* @__PURE__ */ React4.createElement("span", {
|
|
573
544
|
className: "sr-only"
|
|
574
|
-
}, t("open settings label")), /* @__PURE__ */
|
|
545
|
+
}, t("open settings label")), /* @__PURE__ */ React4.createElement(GearSix, {
|
|
575
546
|
className: mx3(getSize(5), "rotate-90")
|
|
576
|
-
}))), /* @__PURE__ */
|
|
547
|
+
}))), /* @__PURE__ */ React4.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React4.createElement(Tooltip2.Content, {
|
|
577
548
|
classNames: "z-[12]"
|
|
578
|
-
}, t("open settings label"), /* @__PURE__ */
|
|
549
|
+
}, t("open settings label"), /* @__PURE__ */ React4.createElement(Tooltip2.Arrow, null)))), navigationPlugin?.meta.id === "dxos.org/plugin/deck" && /* @__PURE__ */ React4.createElement(LayoutControls, {
|
|
579
550
|
variant: "hide-disabled",
|
|
580
551
|
capabilities: {
|
|
581
552
|
incrementStart: false,
|
|
@@ -676,14 +647,14 @@ var expandActions = (graph, node) => {
|
|
|
676
647
|
|
|
677
648
|
// packages/plugins/plugin-navtree/src/components/NavTreeContainer.tsx
|
|
678
649
|
var NODE_TYPE = "dxos/app-graph/node";
|
|
679
|
-
var
|
|
680
|
-
role: "
|
|
650
|
+
var renderItemEnd = ({ node }) => /* @__PURE__ */ React5.createElement(Surface, {
|
|
651
|
+
role: "navtree-item-end",
|
|
681
652
|
data: {
|
|
682
653
|
object: node.data,
|
|
683
654
|
id: node.id
|
|
684
655
|
}
|
|
685
656
|
});
|
|
686
|
-
var NavTreeContainer = /* @__PURE__ */ memo(({ popoverAnchorId, ...props }) => {
|
|
657
|
+
var NavTreeContainer = /* @__PURE__ */ memo(({ isCurrent, popoverAnchorId, ...props }) => {
|
|
687
658
|
const { closeNavigationSidebar } = useSidebars2(NAVTREE_PLUGIN);
|
|
688
659
|
const [isLg] = useMediaQuery("lg", {
|
|
689
660
|
ssr: false
|
|
@@ -747,7 +718,7 @@ var NavTreeContainer = /* @__PURE__ */ memo(({ popoverAnchorId, ...props }) => {
|
|
|
747
718
|
return false;
|
|
748
719
|
}
|
|
749
720
|
}, []);
|
|
750
|
-
const handleSelect = useCallback2(({ item: node }) => {
|
|
721
|
+
const handleSelect = useCallback2(({ item: node, path, option }) => {
|
|
751
722
|
if (!node.data) {
|
|
752
723
|
return;
|
|
753
724
|
}
|
|
@@ -761,16 +732,37 @@ var NavTreeContainer = /* @__PURE__ */ memo(({ popoverAnchorId, ...props }) => {
|
|
|
761
732
|
}));
|
|
762
733
|
return;
|
|
763
734
|
}
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
735
|
+
const current = isCurrent(path, node);
|
|
736
|
+
if (!current) {
|
|
737
|
+
void dispatch({
|
|
738
|
+
action: NavigationAction.OPEN,
|
|
739
|
+
data: {
|
|
740
|
+
activeParts: {
|
|
741
|
+
main: [
|
|
742
|
+
node.id
|
|
743
|
+
]
|
|
744
|
+
}
|
|
771
745
|
}
|
|
772
|
-
}
|
|
773
|
-
})
|
|
746
|
+
});
|
|
747
|
+
} else if (option) {
|
|
748
|
+
void dispatch({
|
|
749
|
+
action: NavigationAction.CLOSE,
|
|
750
|
+
data: {
|
|
751
|
+
activeParts: {
|
|
752
|
+
main: [
|
|
753
|
+
node.id
|
|
754
|
+
]
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
});
|
|
758
|
+
} else {
|
|
759
|
+
void dispatch({
|
|
760
|
+
action: LayoutAction2.SCROLL_INTO_VIEW,
|
|
761
|
+
data: {
|
|
762
|
+
id: node.id
|
|
763
|
+
}
|
|
764
|
+
});
|
|
765
|
+
}
|
|
774
766
|
const defaultAction = graph.actions(node).find((action) => action.properties?.disposition === "default");
|
|
775
767
|
if (isAction4(defaultAction)) {
|
|
776
768
|
void defaultAction.data();
|
|
@@ -781,6 +773,7 @@ var NavTreeContainer = /* @__PURE__ */ memo(({ popoverAnchorId, ...props }) => {
|
|
|
781
773
|
}, [
|
|
782
774
|
graph,
|
|
783
775
|
dispatch,
|
|
776
|
+
isCurrent,
|
|
784
777
|
isLg,
|
|
785
778
|
closeNavigationSidebar
|
|
786
779
|
]);
|
|
@@ -834,41 +827,42 @@ var NavTreeContainer = /* @__PURE__ */ memo(({ popoverAnchorId, ...props }) => {
|
|
|
834
827
|
}, [
|
|
835
828
|
graph
|
|
836
829
|
]);
|
|
837
|
-
return /* @__PURE__ */
|
|
830
|
+
return /* @__PURE__ */ React5.createElement(ElevationProvider, {
|
|
838
831
|
elevation: "chrome"
|
|
839
|
-
}, /* @__PURE__ */
|
|
832
|
+
}, /* @__PURE__ */ React5.createElement("div", {
|
|
840
833
|
role: "none",
|
|
841
834
|
className: "grid grid-cols-1 grid-rows-[var(--rail-size)_1fr_min-content] bs-full overflow-hidden"
|
|
842
|
-
}, /* @__PURE__ */
|
|
835
|
+
}, /* @__PURE__ */ React5.createElement("div", {
|
|
843
836
|
role: "none",
|
|
844
837
|
className: "border-be border-separator"
|
|
845
|
-
}, /* @__PURE__ */
|
|
838
|
+
}, /* @__PURE__ */ React5.createElement(Surface, {
|
|
846
839
|
role: "search-input",
|
|
847
840
|
limit: 1
|
|
848
|
-
})), /* @__PURE__ */
|
|
841
|
+
})), /* @__PURE__ */ React5.createElement("div", {
|
|
849
842
|
role: "none",
|
|
850
843
|
className: "border-be border-separator !overflow-y-auto"
|
|
851
|
-
}, /* @__PURE__ */
|
|
844
|
+
}, /* @__PURE__ */ React5.createElement(NavTree, {
|
|
852
845
|
id: graph.root.id,
|
|
853
846
|
getActions: getActions2,
|
|
854
847
|
getItems,
|
|
855
848
|
getProps,
|
|
849
|
+
isCurrent,
|
|
856
850
|
loadDescendents,
|
|
857
|
-
|
|
851
|
+
renderItemEnd,
|
|
858
852
|
popoverAnchorId,
|
|
859
853
|
canDrop,
|
|
860
854
|
onSelect: handleSelect,
|
|
861
855
|
...props
|
|
862
|
-
})), /* @__PURE__ */
|
|
856
|
+
})), /* @__PURE__ */ React5.createElement(NavTreeFooter, null)));
|
|
863
857
|
});
|
|
864
858
|
|
|
865
859
|
// packages/plugins/plugin-navtree/src/components/NavTreeDocumentTitle.tsx
|
|
866
860
|
import { useEffect as useEffect3 } from "react";
|
|
867
|
-
import { toLocalizedString as
|
|
861
|
+
import { toLocalizedString as toLocalizedString4, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
868
862
|
var NavTreeDocumentTitle = ({ node }) => {
|
|
869
|
-
const { t } =
|
|
863
|
+
const { t } = useTranslation5(NAVTREE_PLUGIN);
|
|
870
864
|
useEffect3(() => {
|
|
871
|
-
document.title = node ?
|
|
865
|
+
document.title = node ? toLocalizedString4(node.properties.label, t) : t("current app name", {
|
|
872
866
|
ns: "appkit"
|
|
873
867
|
});
|
|
874
868
|
}, [
|
|
@@ -878,14 +872,14 @@ var NavTreeDocumentTitle = ({ node }) => {
|
|
|
878
872
|
};
|
|
879
873
|
|
|
880
874
|
// packages/plugins/plugin-navtree/src/components/NotchStart.tsx
|
|
881
|
-
import
|
|
875
|
+
import React7 from "react";
|
|
882
876
|
import { useIntentDispatcher as useIntentDispatcher4, useResolvePlugin as useResolvePlugin2 } from "@dxos/app-framework";
|
|
883
877
|
import { ClientAction } from "@dxos/plugin-client/meta";
|
|
884
878
|
import { parseObservabilityPlugin } from "@dxos/plugin-observability";
|
|
885
879
|
import { useIdentity } from "@dxos/react-client/halo";
|
|
886
880
|
|
|
887
881
|
// packages/plugins/plugin-navtree/src/components/HaloButton.tsx
|
|
888
|
-
import
|
|
882
|
+
import React6 from "react";
|
|
889
883
|
import { ConnectionState, useNetworkStatus } from "@dxos/react-client/mesh";
|
|
890
884
|
import { Avatar } from "@dxos/react-ui";
|
|
891
885
|
import { focusRing, mx as mx5 } from "@dxos/react-ui-theme";
|
|
@@ -895,20 +889,20 @@ var HaloButton = (props) => {
|
|
|
895
889
|
const { onClick, identityKey, internal, size = 8 } = props;
|
|
896
890
|
const fallbackValue = hexToFallback(identityKey ?? "0");
|
|
897
891
|
const { swarm: connectionState } = useNetworkStatus();
|
|
898
|
-
return /* @__PURE__ */
|
|
892
|
+
return /* @__PURE__ */ React6.createElement("button", {
|
|
899
893
|
className: mx5(focusRing, "rounded grid place-items-center"),
|
|
900
894
|
onClick
|
|
901
|
-
}, /* @__PURE__ */
|
|
895
|
+
}, /* @__PURE__ */ React6.createElement(Avatar.Root, {
|
|
902
896
|
size,
|
|
903
897
|
variant: "circle",
|
|
904
898
|
status: connectionState === ConnectionState.OFFLINE ? "error" : internal ? "internal" : "active",
|
|
905
899
|
hue: props.hue || fallbackValue.hue
|
|
906
|
-
}, /* @__PURE__ */
|
|
900
|
+
}, /* @__PURE__ */ React6.createElement(Avatar.Frame, {
|
|
907
901
|
"data-testid": "treeView.haloButton",
|
|
908
902
|
"data-joyride": "welcome/halo"
|
|
909
|
-
}, internal ? /* @__PURE__ */
|
|
903
|
+
}, internal ? /* @__PURE__ */ React6.createElement(Avatar.Image, {
|
|
910
904
|
href: INTERNAL
|
|
911
|
-
}) : /* @__PURE__ */
|
|
905
|
+
}) : /* @__PURE__ */ React6.createElement(Avatar.Fallback, {
|
|
912
906
|
text: props.emoji || fallbackValue.emoji
|
|
913
907
|
}))));
|
|
914
908
|
};
|
|
@@ -918,7 +912,7 @@ var NotchStart = () => {
|
|
|
918
912
|
const identity = useIdentity();
|
|
919
913
|
const observabilityPlugin = useResolvePlugin2(parseObservabilityPlugin);
|
|
920
914
|
const dispatch = useIntentDispatcher4();
|
|
921
|
-
return /* @__PURE__ */
|
|
915
|
+
return /* @__PURE__ */ React7.createElement(HaloButton, {
|
|
922
916
|
size: 8,
|
|
923
917
|
identityKey: identity?.identityKey.toHex(),
|
|
924
918
|
hue: identity?.profile?.data?.hue,
|
|
@@ -932,26 +926,26 @@ var NotchStart = () => {
|
|
|
932
926
|
|
|
933
927
|
// packages/plugins/plugin-navtree/src/components/CommandsTrigger.tsx
|
|
934
928
|
import { MagnifyingGlass } from "@phosphor-icons/react";
|
|
935
|
-
import
|
|
936
|
-
import { LayoutAction as
|
|
937
|
-
import { Button as Button4, useTranslation as
|
|
929
|
+
import React8 from "react";
|
|
930
|
+
import { LayoutAction as LayoutAction3, useIntent } from "@dxos/app-framework";
|
|
931
|
+
import { Button as Button4, useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
938
932
|
import { getSize as getSize2 } from "@dxos/react-ui-theme";
|
|
939
933
|
var CommandsTrigger = () => {
|
|
940
934
|
const { dispatch } = useIntent();
|
|
941
|
-
const { t } =
|
|
942
|
-
return /* @__PURE__ */
|
|
935
|
+
const { t } = useTranslation6(NAVTREE_PLUGIN);
|
|
936
|
+
return /* @__PURE__ */ React8.createElement(Button4, {
|
|
943
937
|
classNames: "w-full h-full !rounded-none",
|
|
944
938
|
onClick: () => dispatch({
|
|
945
|
-
action:
|
|
939
|
+
action: LayoutAction3.SET_LAYOUT,
|
|
946
940
|
data: {
|
|
947
941
|
element: "dialog",
|
|
948
942
|
component: `${NAVTREE_PLUGIN}/Commands`,
|
|
949
943
|
dialogBlockAlign: "start"
|
|
950
944
|
}
|
|
951
945
|
})
|
|
952
|
-
}, /* @__PURE__ */
|
|
946
|
+
}, /* @__PURE__ */ React8.createElement("span", {
|
|
953
947
|
className: "text-description font-normal grow text-start"
|
|
954
|
-
}, t("command list input placeholder")), /* @__PURE__ */
|
|
948
|
+
}, t("command list input placeholder")), /* @__PURE__ */ React8.createElement(MagnifyingGlass, {
|
|
955
949
|
className: getSize2(5)
|
|
956
950
|
}));
|
|
957
951
|
};
|
|
@@ -991,7 +985,10 @@ var getInitialState = () => {
|
|
|
991
985
|
const cached = JSON.parse(stringified);
|
|
992
986
|
return cached.map(([key, value]) => [
|
|
993
987
|
key,
|
|
994
|
-
create(
|
|
988
|
+
create({
|
|
989
|
+
open: value.open,
|
|
990
|
+
current: false
|
|
991
|
+
})
|
|
995
992
|
]);
|
|
996
993
|
} catch {
|
|
997
994
|
}
|
|
@@ -1150,41 +1147,29 @@ var NavTreePlugin = () => {
|
|
|
1150
1147
|
switch (data.component) {
|
|
1151
1148
|
case `${NAVTREE_PLUGIN}/Commands`: {
|
|
1152
1149
|
const selected = typeof data.subject === "string" ? data.subject : void 0;
|
|
1153
|
-
return /* @__PURE__ */
|
|
1150
|
+
return /* @__PURE__ */ React9.createElement(CommandsDialogContent, {
|
|
1154
1151
|
selected
|
|
1155
1152
|
});
|
|
1156
1153
|
}
|
|
1157
1154
|
}
|
|
1158
1155
|
switch (role) {
|
|
1159
1156
|
case "navigation":
|
|
1160
|
-
return /* @__PURE__ */
|
|
1157
|
+
return /* @__PURE__ */ React9.createElement(NavTreeContainer, {
|
|
1161
1158
|
isOpen,
|
|
1162
1159
|
isCurrent,
|
|
1163
1160
|
onOpenChange: handleOpenChange,
|
|
1164
1161
|
popoverAnchorId: data.popoverAnchorId
|
|
1165
1162
|
});
|
|
1166
1163
|
case "document-title": {
|
|
1167
|
-
return /* @__PURE__ */
|
|
1164
|
+
return /* @__PURE__ */ React9.createElement(NavTreeDocumentTitle, {
|
|
1168
1165
|
node: isGraphNode(data.activeNode) ? data.activeNode : void 0
|
|
1169
1166
|
});
|
|
1170
1167
|
}
|
|
1171
|
-
case "navbar-start": {
|
|
1172
|
-
if (data.activeNode) {
|
|
1173
|
-
return {
|
|
1174
|
-
node: /* @__PURE__ */ React10.createElement(NavBarStart, {
|
|
1175
|
-
activeNode: data.activeNode,
|
|
1176
|
-
popoverAnchorId: data.popoverAnchorId
|
|
1177
|
-
}),
|
|
1178
|
-
disposition: "hoist"
|
|
1179
|
-
};
|
|
1180
|
-
}
|
|
1181
|
-
break;
|
|
1182
|
-
}
|
|
1183
1168
|
case "notch-start":
|
|
1184
|
-
return /* @__PURE__ */
|
|
1169
|
+
return /* @__PURE__ */ React9.createElement(NotchStart, null);
|
|
1185
1170
|
case "search-input":
|
|
1186
1171
|
return {
|
|
1187
|
-
node: /* @__PURE__ */
|
|
1172
|
+
node: /* @__PURE__ */ React9.createElement(CommandsTrigger, null),
|
|
1188
1173
|
disposition: "fallback"
|
|
1189
1174
|
};
|
|
1190
1175
|
}
|
|
@@ -1226,7 +1211,7 @@ var NavTreePlugin = () => {
|
|
|
1226
1211
|
id: "dxos.org/plugin/navtree/open-commands",
|
|
1227
1212
|
data: async () => {
|
|
1228
1213
|
await intentPlugin?.provides.intent.dispatch({
|
|
1229
|
-
action:
|
|
1214
|
+
action: LayoutAction4.SET_LAYOUT,
|
|
1230
1215
|
data: {
|
|
1231
1216
|
element: "dialog",
|
|
1232
1217
|
component: `${NAVTREE_PLUGIN}/Commands`,
|