@dxos/plugin-navtree 0.8.4-main.406dc2a → 0.8.4-main.52d7546f51
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/app-graph-builder-XGA4GPGL.mjs +44 -0
- package/dist/lib/browser/app-graph-builder-XGA4GPGL.mjs.map +7 -0
- package/dist/lib/browser/chunk-63YLDLLE.mjs +1373 -0
- package/dist/lib/browser/chunk-63YLDLLE.mjs.map +7 -0
- package/dist/lib/browser/chunk-X2HDG62A.mjs +23 -0
- package/dist/lib/browser/chunk-X2HDG62A.mjs.map +7 -0
- package/dist/lib/browser/chunk-YKTYPINZ.mjs +19 -0
- package/dist/lib/browser/chunk-YKTYPINZ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +83 -91
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{keyboard-AHSAWKXA.mjs → keyboard-46XQHY2O.mjs} +21 -19
- package/dist/lib/browser/keyboard-46XQHY2O.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-NNNDII45.mjs +53 -0
- package/dist/lib/browser/operation-resolver-NNNDII45.mjs.map +7 -0
- package/dist/lib/browser/react-surface-APSEG23H.mjs +59 -0
- package/dist/lib/browser/react-surface-APSEG23H.mjs.map +7 -0
- package/dist/lib/browser/state-M5YUCIQU.mjs +121 -0
- package/dist/lib/browser/state-M5YUCIQU.mjs.map +7 -0
- package/dist/types/src/NavTreePlugin.d.ts +2 -1
- package/dist/types/src/NavTreePlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +5 -108
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/keyboard/index.d.ts +3 -0
- package/dist/types/src/capabilities/keyboard/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/keyboard/keyboard.d.ts +5 -0
- package/dist/types/src/capabilities/keyboard/keyboard.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/index.d.ts +3 -0
- package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/state.d.ts +6 -0
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
- package/dist/types/src/components/CommandsDialog/CommandsDialog.d.ts +3 -2
- package/dist/types/src/components/CommandsDialog/CommandsDialog.d.ts.map +1 -1
- package/dist/types/src/components/CommandsDialog/CommandsTrigger.d.ts.map +1 -1
- package/dist/types/src/components/NavTree/NavTree.d.ts +30 -1
- package/dist/types/src/components/NavTree/NavTree.d.ts.map +1 -1
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts +4 -1
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeContainer.d.ts +8 -1
- package/dist/types/src/components/NavTreeContainer.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeDocumentTitle.d.ts +1 -1
- package/dist/types/src/components/NavTreeDocumentTitle.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts +6 -6
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts +2 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L0Menu.d.ts +4 -4
- package/dist/types/src/components/Sidebar/L0Menu.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L1Panel.d.ts +2 -2
- package/dist/types/src/components/Sidebar/L1Panel.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L1Tabs.d.ts +2 -2
- package/dist/types/src/components/Sidebar/L1Tabs.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/types.d.ts +7 -7
- package/dist/types/src/components/types.d.ts.map +1 -1
- package/dist/types/src/experimental/Tree.stories.d.ts +15 -4
- package/dist/types/src/experimental/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/hooks.d.ts +32 -1
- package/dist/types/src/hooks.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/testing/app-graph-builder.d.ts +2 -3
- package/dist/types/src/testing/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/testing/generator.d.ts +5 -6
- package/dist/types/src/testing/generator.d.ts.map +1 -1
- package/dist/types/src/testing/update-state.d.ts +2 -2
- package/dist/types/src/testing/update-state.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +16 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +4 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/{types.d.ts → types/schema.d.ts} +7 -7
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/dist/types/src/util.d.ts +7 -7
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +54 -52
- package/src/NavTreePlugin.tsx +53 -72
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +42 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/index.ts +5 -9
- package/src/capabilities/keyboard/index.ts +7 -0
- package/src/capabilities/keyboard/keyboard.ts +66 -0
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +42 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +55 -0
- package/src/capabilities/state/index.ts +7 -0
- package/src/capabilities/state/state.ts +122 -0
- package/src/components/CommandsDialog/CommandsDialog.tsx +107 -97
- package/src/components/CommandsDialog/CommandsTrigger.tsx +4 -13
- package/src/components/NavTree/NavTree.stories.tsx +36 -44
- package/src/components/NavTree/NavTree.tsx +5 -15
- package/src/components/NavTreeContainer.tsx +255 -263
- package/src/components/NavTreeDocumentTitle.tsx +3 -2
- package/src/components/NavTreeItem/NavTreeItemAction.stories.tsx +17 -7
- package/src/components/NavTreeItem/NavTreeItemAction.tsx +18 -12
- package/src/components/NavTreeItem/NavTreeItemColumns.tsx +5 -5
- package/src/components/Sidebar/L0Menu.tsx +69 -98
- package/src/components/Sidebar/L1Panel.tsx +151 -72
- package/src/components/Sidebar/L1Tabs.tsx +6 -31
- package/src/components/UserAccountAvatar/UserAccountAvatar.stories.tsx +1 -1
- package/src/components/index.ts +1 -0
- package/src/components/types.ts +7 -7
- package/src/experimental/Tree.stories.tsx +45 -54
- package/src/experimental/Tree.tsx +3 -3
- package/src/hooks.ts +54 -2
- package/src/index.ts +1 -2
- package/src/meta.ts +7 -2
- package/src/testing/app-graph-builder.ts +159 -235
- package/src/testing/generator.ts +19 -17
- package/src/testing/update-state.ts +6 -6
- package/src/types/capabilities.ts +21 -0
- package/src/types/events.ts +12 -0
- package/src/types/index.ts +7 -0
- package/src/{types.ts → types/schema.ts} +6 -6
- package/src/util.ts +13 -16
- package/dist/lib/browser/app-graph-builder-YAPMENYT.mjs +0 -46
- package/dist/lib/browser/app-graph-builder-YAPMENYT.mjs.map +0 -7
- package/dist/lib/browser/chunk-IMFXKPSB.mjs +0 -1482
- package/dist/lib/browser/chunk-IMFXKPSB.mjs.map +0 -7
- package/dist/lib/browser/chunk-LPAREX6J.mjs +0 -15
- package/dist/lib/browser/chunk-LPAREX6J.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZENLR72O.mjs +0 -14
- package/dist/lib/browser/chunk-ZENLR72O.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-TCQXGF6U.mjs +0 -47
- package/dist/lib/browser/intent-resolver-TCQXGF6U.mjs.map +0 -7
- package/dist/lib/browser/keyboard-AHSAWKXA.mjs.map +0 -7
- package/dist/lib/browser/react-surface-AH2TP73M.mjs +0 -51
- package/dist/lib/browser/react-surface-AH2TP73M.mjs.map +0 -7
- package/dist/lib/browser/state-2Q623V7U.mjs +0 -117
- package/dist/lib/browser/state-2Q623V7U.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -21
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/keyboard.d.ts +0 -4
- package/dist/types/src/capabilities/keyboard.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/state.d.ts +0 -20
- package/dist/types/src/capabilities/state.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -53
- package/src/capabilities/capabilities.ts +0 -20
- package/src/capabilities/intent-resolver.ts +0 -37
- package/src/capabilities/keyboard.ts +0 -59
- package/src/capabilities/react-surface.tsx +0 -45
- package/src/capabilities/state.ts +0 -105
- package/src/events.ts +0 -11
package/src/util.ts
CHANGED
|
@@ -2,22 +2,24 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Graph, Node } from '@dxos/plugin-graph';
|
|
6
6
|
import { isNonNullable } from '@dxos/util';
|
|
7
7
|
|
|
8
8
|
import { type NavTreeItemGraphNode } from './types';
|
|
9
9
|
|
|
10
10
|
export const getParent = (
|
|
11
|
-
graph: ReadableGraph,
|
|
11
|
+
graph: Graph.ReadableGraph,
|
|
12
12
|
node: NavTreeItemGraphNode,
|
|
13
13
|
path: string[],
|
|
14
14
|
): NavTreeItemGraphNode | undefined => {
|
|
15
15
|
const parentId = path[path.length - 2];
|
|
16
|
-
return
|
|
16
|
+
return Graph.getConnections(graph, node.id, 'inbound').find((n: Node.Node) => n.id === parentId) as
|
|
17
|
+
| NavTreeItemGraphNode
|
|
18
|
+
| undefined;
|
|
17
19
|
};
|
|
18
20
|
|
|
19
21
|
export const getPersistenceParent = (
|
|
20
|
-
graph: ReadableGraph,
|
|
22
|
+
graph: Graph.ReadableGraph,
|
|
21
23
|
node: NavTreeItemGraphNode,
|
|
22
24
|
path: string[],
|
|
23
25
|
persistenceClass: string,
|
|
@@ -31,7 +33,7 @@ export const getPersistenceParent = (
|
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
export const resolveMigrationOperation = (
|
|
34
|
-
graph: ReadableGraph,
|
|
36
|
+
graph: Graph.ReadableGraph,
|
|
35
37
|
activeNode: NavTreeItemGraphNode,
|
|
36
38
|
destinationPath: string[],
|
|
37
39
|
destinationRelatedNode?: NavTreeItemGraphNode,
|
|
@@ -60,7 +62,7 @@ export const resolveMigrationOperation = (
|
|
|
60
62
|
};
|
|
61
63
|
|
|
62
64
|
// TODO(wittjosiah): Move into node implementation?
|
|
63
|
-
export const sortActions = (actions: Action[]): Action[] =>
|
|
65
|
+
export const sortActions = (actions: Node.Action[]): Node.Action[] =>
|
|
64
66
|
actions.sort((a, b) => {
|
|
65
67
|
if (a.properties.disposition === b.properties.disposition) {
|
|
66
68
|
return 0;
|
|
@@ -74,13 +76,12 @@ export const sortActions = (actions: Action[]): Action[] =>
|
|
|
74
76
|
});
|
|
75
77
|
|
|
76
78
|
export const getChildren = (
|
|
77
|
-
graph: ReadableGraph,
|
|
79
|
+
graph: Graph.ReadableGraph,
|
|
78
80
|
node: NavTreeItemGraphNode,
|
|
79
81
|
path: readonly string[] = [],
|
|
80
82
|
): NavTreeItemGraphNode[] => {
|
|
81
|
-
return graph
|
|
82
|
-
.
|
|
83
|
-
.map((n) => {
|
|
83
|
+
return Graph.getConnections(graph, node.id, 'outbound')
|
|
84
|
+
.map((n: Node.Node) => {
|
|
84
85
|
// Break cycles.
|
|
85
86
|
const nextPath = [...path, node.id];
|
|
86
87
|
return nextPath.includes(n.id) ? undefined : (n as NavTreeItemGraphNode);
|
|
@@ -88,13 +89,9 @@ export const getChildren = (
|
|
|
88
89
|
.filter(isNonNullable) as NavTreeItemGraphNode[];
|
|
89
90
|
};
|
|
90
91
|
|
|
91
|
-
export const l0ItemType = (item: Node
|
|
92
|
-
if (item
|
|
93
|
-
return 'collection';
|
|
94
|
-
} else if (isActionLike(item)) {
|
|
92
|
+
export const l0ItemType = (item: Node.Node) => {
|
|
93
|
+
if (Node.isActionLike(item)) {
|
|
95
94
|
return 'action';
|
|
96
|
-
} else if (item.properties.disposition === 'navigation') {
|
|
97
|
-
return 'link';
|
|
98
95
|
} else {
|
|
99
96
|
return 'tab';
|
|
100
97
|
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
COMMANDS_DIALOG,
|
|
3
|
-
meta
|
|
4
|
-
} from "./chunk-ZENLR72O.mjs";
|
|
5
|
-
|
|
6
|
-
// src/capabilities/app-graph-builder.ts
|
|
7
|
-
import { Rx } from "@effect-rx/rx-react";
|
|
8
|
-
import * as Function from "effect/Function";
|
|
9
|
-
import * as Option from "effect/Option";
|
|
10
|
-
import { Capabilities, LayoutAction, contributes, createIntent } from "@dxos/app-framework";
|
|
11
|
-
import { ROOT_ID, createExtension } from "@dxos/plugin-graph";
|
|
12
|
-
var app_graph_builder_default = ((context) => contributes(Capabilities.AppGraphBuilder, createExtension({
|
|
13
|
-
id: meta.id,
|
|
14
|
-
actions: (node) => Rx.make((get) => Function.pipe(get(node), Option.flatMap((node2) => node2.id === ROOT_ID ? Option.some(node2) : Option.none()), Option.map(() => [
|
|
15
|
-
{
|
|
16
|
-
id: COMMANDS_DIALOG,
|
|
17
|
-
data: async () => {
|
|
18
|
-
const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
19
|
-
await dispatch(createIntent(LayoutAction.UpdateDialog, {
|
|
20
|
-
part: "dialog",
|
|
21
|
-
subject: COMMANDS_DIALOG,
|
|
22
|
-
options: {
|
|
23
|
-
blockAlign: "start"
|
|
24
|
-
}
|
|
25
|
-
}));
|
|
26
|
-
},
|
|
27
|
-
properties: {
|
|
28
|
-
label: [
|
|
29
|
-
"open commands label",
|
|
30
|
-
{
|
|
31
|
-
ns: meta.id
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
|
-
icon: "ph--magnifying-glass--regular",
|
|
35
|
-
keyBinding: {
|
|
36
|
-
macos: "meta+k",
|
|
37
|
-
windows: "ctrl+k"
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
]), Option.getOrElse(() => [])))
|
|
42
|
-
})));
|
|
43
|
-
export {
|
|
44
|
-
app_graph_builder_default as default
|
|
45
|
-
};
|
|
46
|
-
//# sourceMappingURL=app-graph-builder-YAPMENYT.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/app-graph-builder.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Rx } from '@effect-rx/rx-react';\nimport * as Function from 'effect/Function';\nimport * as Option from 'effect/Option';\n\nimport { Capabilities, LayoutAction, type PluginContext, contributes, createIntent } from '@dxos/app-framework';\nimport { ROOT_ID, createExtension } from '@dxos/plugin-graph';\n\nimport { COMMANDS_DIALOG, meta } from '../meta';\n\nexport default (context: PluginContext) =>\n contributes(\n Capabilities.AppGraphBuilder,\n createExtension({\n id: meta.id,\n actions: (node) =>\n Rx.make((get) =>\n Function.pipe(\n get(node),\n Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),\n Option.map(() => [\n {\n id: COMMANDS_DIALOG,\n data: async () => {\n const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);\n await dispatch(\n createIntent(LayoutAction.UpdateDialog, {\n part: 'dialog',\n subject: COMMANDS_DIALOG,\n options: {\n blockAlign: 'start',\n },\n }),\n );\n },\n properties: {\n label: ['open commands label', { ns: meta.id }],\n icon: 'ph--magnifying-glass--regular',\n keyBinding: {\n macos: 'meta+k',\n windows: 'ctrl+k',\n },\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n );\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,SAASA,UAAU;AACnB,YAAYC,cAAc;AAC1B,YAAYC,YAAY;AAExB,SAASC,cAAcC,cAAkCC,aAAaC,oBAAoB;AAC1F,SAASC,SAASC,uBAAuB;AAIzC,IAAA,6BAAe,CAACC,YACdC,YACEC,aAAaC,iBACbC,gBAAgB;EACdC,IAAIC,KAAKD;EACTE,SAAS,CAACC,SACRC,GAAGC,KAAK,CAACC,QACEC,cACPD,IAAIH,IAAAA,GACGK,eAAQ,CAACL,UAAUA,MAAKH,OAAOS,UAAiBC,YAAKP,KAAAA,IAAeQ,YAAI,CAAA,GACxEC,WAAI,MAAM;IACf;MACEZ,IAAIa;MACJC,MAAM,YAAA;AACJ,cAAM,EAAEC,iBAAiBC,SAAQ,IAAKrB,QAAQsB,cAAcpB,aAAaqB,gBAAgB;AACzF,cAAMF,SACJG,aAAaC,aAAaC,cAAc;UACtCC,MAAM;UACNC,SAASV;UACTW,SAAS;YACPC,YAAY;UACd;QACF,CAAA,CAAA;MAEJ;MACAC,YAAY;QACVC,OAAO;UAAC;UAAuB;YAAEC,IAAI3B,KAAKD;UAAG;;QAC7C6B,MAAM;QACNC,YAAY;UACVC,OAAO;UACPC,SAAS;QACX;MACF;IACF;GACD,GACMC,iBAAU,MAAM,CAAA,CAAE,CAAA,CAAA;AAGjC,CAAA,CAAA;",
|
|
6
|
-
"names": ["Rx", "Function", "Option", "Capabilities", "LayoutAction", "contributes", "createIntent", "ROOT_ID", "createExtension", "context", "contributes", "Capabilities", "AppGraphBuilder", "createExtension", "id", "meta", "actions", "node", "Rx", "make", "get", "pipe", "flatMap", "ROOT_ID", "some", "none", "map", "COMMANDS_DIALOG", "data", "dispatchPromise", "dispatch", "getCapability", "IntentDispatcher", "createIntent", "LayoutAction", "UpdateDialog", "part", "subject", "options", "blockAlign", "properties", "label", "ns", "icon", "keyBinding", "macos", "windows", "getOrElse"]
|
|
7
|
-
}
|