@dxos/plugin-navtree 0.8.2-main.fbd8ed0 → 0.8.2-staging.7ac8446
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-P7AY3K72.mjs → app-graph-builder-26D3MUCA.mjs} +6 -7
- package/dist/lib/browser/app-graph-builder-26D3MUCA.mjs.map +7 -0
- package/dist/lib/browser/{chunk-TLQLMZXU.mjs → chunk-4RQJXI4D.mjs} +1 -1
- package/dist/lib/browser/chunk-4RQJXI4D.mjs.map +7 -0
- package/dist/lib/browser/{chunk-UM2C5XK3.mjs → chunk-DN43QXSX.mjs} +365 -444
- package/dist/lib/browser/chunk-DN43QXSX.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +10 -5
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-PW7B76HO.mjs → intent-resolver-BZMUS24C.mjs} +7 -7
- package/dist/lib/browser/intent-resolver-BZMUS24C.mjs.map +7 -0
- package/dist/lib/browser/keyboard-IQXHKUWM.mjs +46 -0
- package/dist/lib/browser/keyboard-IQXHKUWM.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-M3CAS7ZP.mjs → react-surface-3HCM3SHJ.mjs} +3 -3
- package/dist/lib/browser/{state-3UBYOTQT.mjs → state-M5UJ3MHL.mjs} +12 -18
- package/dist/lib/browser/state-M5UJ3MHL.mjs.map +7 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +179 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +4 -7
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +183 -38
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/keyboard.d.ts +2 -2
- package/dist/types/src/capabilities/keyboard.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +6 -9
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/components/CommandsDialog.d.ts.map +1 -0
- package/dist/types/src/components/CommandsTrigger.d.ts.map +1 -0
- package/dist/types/src/components/L0Menu.d.ts +10 -0
- package/dist/types/src/components/L0Menu.d.ts.map +1 -0
- package/dist/types/src/components/L1Panels.d.ts +14 -0
- package/dist/types/src/components/L1Panels.d.ts.map +1 -0
- package/dist/types/src/components/NavTree.d.ts +5 -0
- package/dist/types/src/components/NavTree.d.ts.map +1 -0
- package/dist/types/src/components/NavTree.stories.d.ts +7 -0
- package/dist/types/src/components/NavTree.stories.d.ts.map +1 -0
- package/dist/types/src/components/NavTreeContainer.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeContext.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeDocumentTitle.d.ts.map +1 -1
- package/dist/types/src/components/{NavTreeItem/NavTreeItemAction.d.ts → NavTreeItemAction.d.ts} +3 -2
- package/dist/types/src/components/NavTreeItemAction.d.ts.map +1 -0
- package/dist/types/src/components/NavTreeItemAction.stories.d.ts +41 -0
- package/dist/types/src/components/NavTreeItemAction.stories.d.ts.map +1 -0
- package/dist/types/src/components/NavTreeItemColumns.d.ts +4 -0
- package/dist/types/src/components/NavTreeItemColumns.d.ts.map +1 -0
- package/dist/types/src/components/{UserAccountAvatar/UserAccountAvatar.d.ts → UserAccountAvatar.d.ts} +1 -1
- package/dist/types/src/components/UserAccountAvatar.d.ts.map +1 -0
- package/dist/types/src/components/{UserAccountAvatar/UserAccountAvatar.stories.d.ts → UserAccountAvatar.stories.d.ts} +2 -1
- package/dist/types/src/components/UserAccountAvatar.stories.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/types.d.ts +14 -20
- package/dist/types/src/components/types.d.ts.map +1 -1
- package/dist/types/src/experimental/Tree.d.ts.map +1 -1
- package/dist/types/src/hooks.d.ts.map +1 -1
- package/dist/types/src/stories/Graph.stories.d.ts +7 -0
- package/dist/types/src/stories/Graph.stories.d.ts.map +1 -0
- package/dist/types/src/stories/StorybookNavTree.d.ts +4 -0
- package/dist/types/src/stories/StorybookNavTree.d.ts.map +1 -0
- package/dist/types/src/testing/generator.d.ts +6 -7
- package/dist/types/src/testing/generator.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +0 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/update-state.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +0 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +10 -7
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +31 -40
- package/src/NavTreePlugin.tsx +2 -2
- package/src/capabilities/app-graph-builder.ts +28 -38
- package/src/capabilities/capabilities.ts +4 -5
- package/src/capabilities/intent-resolver.ts +7 -8
- package/src/capabilities/keyboard.ts +32 -37
- package/src/capabilities/state.ts +17 -23
- package/src/components/{CommandsDialog/CommandsDialog.tsx → CommandsDialog.tsx} +7 -8
- package/src/components/{CommandsDialog/CommandsTrigger.tsx → CommandsTrigger.tsx} +1 -1
- package/src/components/{Sidebar/L0Menu.tsx → L0Menu.tsx} +131 -188
- package/src/components/L1Panels.tsx +115 -0
- package/src/components/NavTree.stories.tsx +107 -0
- package/src/components/NavTree.tsx +51 -0
- package/src/components/NavTreeContainer.tsx +74 -94
- package/src/components/NavTreeContext.tsx +1 -1
- package/src/components/{NavTreeItem/NavTreeItemAction.stories.tsx → NavTreeItemAction.stories.tsx} +6 -12
- package/src/components/{NavTreeItem/NavTreeItemAction.tsx → NavTreeItemAction.tsx} +18 -23
- package/src/components/NavTreeItemColumns.tsx +71 -0
- package/src/components/{UserAccountAvatar/UserAccountAvatar.stories.tsx → UserAccountAvatar.stories.tsx} +5 -5
- package/src/components/{UserAccountAvatar/UserAccountAvatar.tsx → UserAccountAvatar.tsx} +7 -7
- package/src/components/index.ts +1 -0
- package/src/components/types.ts +15 -20
- package/src/hooks.ts +11 -12
- package/src/stories/Graph.stories.tsx +130 -0
- package/src/stories/StorybookNavTree.tsx +63 -0
- package/src/testing/generator.ts +12 -15
- package/src/testing/index.ts +0 -1
- package/src/translations.ts +0 -1
- package/src/util.ts +32 -10
- package/dist/lib/browser/app-graph-builder-P7AY3K72.mjs.map +0 -7
- package/dist/lib/browser/chunk-TLQLMZXU.mjs.map +0 -7
- package/dist/lib/browser/chunk-UM2C5XK3.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-PW7B76HO.mjs.map +0 -7
- package/dist/lib/browser/keyboard-DDFATRUG.mjs +0 -51
- package/dist/lib/browser/keyboard-DDFATRUG.mjs.map +0 -7
- package/dist/lib/browser/state-3UBYOTQT.mjs.map +0 -7
- package/dist/types/src/components/CommandsDialog/CommandsDialog.d.ts.map +0 -1
- package/dist/types/src/components/CommandsDialog/CommandsTrigger.d.ts.map +0 -1
- package/dist/types/src/components/CommandsDialog/index.d.ts +0 -3
- package/dist/types/src/components/CommandsDialog/index.d.ts.map +0 -1
- package/dist/types/src/components/NavTree/NavTree.d.ts +0 -8
- package/dist/types/src/components/NavTree/NavTree.d.ts.map +0 -1
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts +0 -8
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts.map +0 -1
- package/dist/types/src/components/NavTree/index.d.ts +0 -2
- package/dist/types/src/components/NavTree/index.d.ts.map +0 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts.map +0 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts +0 -8
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts.map +0 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts +0 -4
- package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts.map +0 -1
- package/dist/types/src/components/NavTreeItem/index.d.ts +0 -3
- package/dist/types/src/components/NavTreeItem/index.d.ts.map +0 -1
- package/dist/types/src/components/Sidebar/L0Menu.d.ts +0 -13
- package/dist/types/src/components/Sidebar/L0Menu.d.ts.map +0 -1
- package/dist/types/src/components/Sidebar/L1Panel.d.ts +0 -15
- package/dist/types/src/components/Sidebar/L1Panel.d.ts.map +0 -1
- package/dist/types/src/components/Sidebar/index.d.ts +0 -3
- package/dist/types/src/components/Sidebar/index.d.ts.map +0 -1
- package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.d.ts.map +0 -1
- package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.d.ts.map +0 -1
- package/dist/types/src/components/UserAccountAvatar/index.d.ts +0 -2
- package/dist/types/src/components/UserAccountAvatar/index.d.ts.map +0 -1
- package/dist/types/src/testing/app-graph-builder.d.ts +0 -3
- package/dist/types/src/testing/app-graph-builder.d.ts.map +0 -1
- package/src/components/CommandsDialog/index.ts +0 -6
- package/src/components/NavTree/NavTree.stories.tsx +0 -159
- package/src/components/NavTree/NavTree.tsx +0 -62
- package/src/components/NavTree/index.ts +0 -5
- package/src/components/NavTreeItem/NavTreeItemColumns.tsx +0 -73
- package/src/components/NavTreeItem/index.ts +0 -6
- package/src/components/Sidebar/L1Panel.tsx +0 -175
- package/src/components/Sidebar/index.ts +0 -6
- package/src/components/UserAccountAvatar/index.ts +0 -5
- package/src/testing/app-graph-builder.ts +0 -224
- /package/dist/lib/browser/{react-surface-M3CAS7ZP.mjs.map → react-surface-3HCM3SHJ.mjs.map} +0 -0
- /package/dist/types/src/components/{CommandsDialog/CommandsDialog.d.ts → CommandsDialog.d.ts} +0 -0
- /package/dist/types/src/components/{CommandsDialog/CommandsTrigger.d.ts → CommandsTrigger.d.ts} +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type
|
|
1
|
+
import { S } from '@dxos/echo-schema';
|
|
2
|
+
import { type ReactiveObject } from '@dxos/live-object';
|
|
3
3
|
export type TestItem = {
|
|
4
4
|
id: string;
|
|
5
5
|
type: string;
|
|
6
6
|
} & Record<string, any>;
|
|
7
7
|
type ObjectDataGenerator = {
|
|
8
|
-
createSchema?: () =>
|
|
8
|
+
createSchema?: () => S.Schema.AnyNoContext;
|
|
9
9
|
createData: () => any;
|
|
10
10
|
};
|
|
11
|
-
type ObjectFactory<T extends
|
|
12
|
-
schema?:
|
|
11
|
+
type ObjectFactory<T extends ReactiveObject<any>> = {
|
|
12
|
+
schema?: S.Schema.AnyNoContext;
|
|
13
13
|
createObject: () => T;
|
|
14
14
|
};
|
|
15
15
|
type ObjectFactoryMap = {
|
|
@@ -29,7 +29,7 @@ export declare class TestObjectGenerator {
|
|
|
29
29
|
types?: string[];
|
|
30
30
|
factories?: ObjectFactoryMap;
|
|
31
31
|
});
|
|
32
|
-
get schema():
|
|
32
|
+
get schema(): S.Schema.AnyNoContext[];
|
|
33
33
|
createObject({ types }?: {
|
|
34
34
|
types?: string[];
|
|
35
35
|
}): any;
|
|
@@ -53,7 +53,6 @@ export declare const createTree: () => {
|
|
|
53
53
|
properties: {
|
|
54
54
|
label: any;
|
|
55
55
|
icon: string;
|
|
56
|
-
disposition: string;
|
|
57
56
|
};
|
|
58
57
|
nodes: ({
|
|
59
58
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../src/testing/generator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../../src/testing/generator.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAe,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAU,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAQhE,MAAM,MAAM,QAAQ,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE1E,KAAK,mBAAmB,GAAG;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;IAC3C,UAAU,EAAE,MAAM,GAAG,CAAC;CACvB,CAAC;AAEF,KAAK,aAAa,CAAC,CAAC,SAAS,cAAc,CAAC,GAAG,CAAC,IAAI;IAClD,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;IAC/B,YAAY,EAAE,MAAM,CAAC,CAAC;CACvB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAA;CAAE,CAAC;AAW/D,eAAO,MAAM,MAAM,UAAgC,CAAC;AACpD,eAAO,MAAM,QAAQ,UAAkB,CAAC;AAExC,eAAO,MAAM,iBAAiB,EAAE;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,CAAA;CAgCpE,CAAC;AAEF;;GAEG;AACH,qBAAa,mBAAmB;IAC9B,SAAgB,SAAS,EAAE,gBAAgB,CAAC;gBAEhC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,SAAS,CAAC,EAAE,gBAAgB,CAAA;KAAO;IASzF,IAAI,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,YAAY,EAAE,CAEpC;IAED,YAAY,CAAC,EAAE,KAAK,EAAE,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;KAAO;IAMjD,aAAa,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;CAGtE;AAeD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8EtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-state.d.ts","sourceRoot":"","sources":["../../../../src/testing/update-state.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,oDAAoD,CAAC;AAEtF,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAmBpD,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"update-state.d.ts","sourceRoot":"","sources":["../../../../src/testing/update-state.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,oDAAoD,CAAC;AAEtF,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAmBpD,eAAO,MAAM,WAAW,4CAKrB;IACD,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IACpB,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,EAAE,QAAQ,CAAC;IACjB,MAAM,EAAE,QAAQ,CAAC;CAClB,SAgCA,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"translations.d.ts","sourceRoot":"","sources":["../../../src/translations.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAMA,wBAcE"}
|
package/dist/types/src/util.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { type Action, type Node, type
|
|
1
|
+
import { type Action, type Node, type NodeFilter, type Graph } from '@dxos/app-graph';
|
|
2
2
|
import { type FlattenedActions, type NavTreeItemGraphNode } from './types';
|
|
3
|
-
export declare const getParent: (graph:
|
|
4
|
-
export declare const getPersistenceParent: (graph:
|
|
5
|
-
export declare const resolveMigrationOperation: (graph:
|
|
3
|
+
export declare const getParent: (graph: Graph, node: NavTreeItemGraphNode, path: string[]) => NavTreeItemGraphNode | undefined;
|
|
4
|
+
export declare const getPersistenceParent: (graph: Graph, node: NavTreeItemGraphNode, path: string[], persistenceClass: string) => NavTreeItemGraphNode | null;
|
|
5
|
+
export declare const resolveMigrationOperation: (graph: Graph, activeNode: NavTreeItemGraphNode, destinationPath: string[], destinationRelatedNode?: NavTreeItemGraphNode) => "transfer" | "copy" | "reject";
|
|
6
6
|
export declare const sortActions: (actions: Action[]) => Action[];
|
|
7
|
-
export declare const getChildren: (graph:
|
|
8
|
-
export declare const getActions: (graph:
|
|
9
|
-
export declare const
|
|
7
|
+
export declare const getChildren: (graph: Graph, node: NavTreeItemGraphNode, filter?: NodeFilter, path?: readonly string[]) => NavTreeItemGraphNode[];
|
|
8
|
+
export declare const getActions: (graph: Graph, node: Node) => FlattenedActions;
|
|
9
|
+
export declare const expandChildrenAndActions: (graph: Graph, node: Node) => Promise<[void, [void, void]]>;
|
|
10
|
+
export declare const expandChildren: (graph: Graph, node: Node) => Promise<void>;
|
|
11
|
+
export declare const expandActions: (graph: Graph, node: Node) => Promise<[void, void]>;
|
|
12
|
+
export declare const l0ItemType: (item: Node<any>) => "link" | "tab" | "collection" | "action";
|
|
10
13
|
//# sourceMappingURL=util.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/util.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/util.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,IAAI,EACT,KAAK,UAAU,EACf,KAAK,KAAK,EAKX,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE3E,eAAO,MAAM,SAAS,UACb,KAAK,QACN,oBAAoB,QACpB,MAAM,EAAE,KACb,oBAAoB,GAAG,SAGzB,CAAC;AAEF,eAAO,MAAM,oBAAoB,UACxB,KAAK,QACN,oBAAoB,QACpB,MAAM,EAAE,oBACI,MAAM,KACvB,oBAAoB,GAAG,IAOzB,CAAC;AAEF,eAAO,MAAM,yBAAyB,UAC7B,KAAK,cACA,oBAAoB,mBACf,MAAM,EAAE,2BACA,oBAAoB,KAC5C,UAAU,GAAG,MAAM,GAAG,QAsBxB,CAAC;AAGF,eAAO,MAAM,WAAW,YAAa,MAAM,EAAE,KAAG,MAAM,EAWlD,CAAC;AAEL,eAAO,MAAM,WAAW,UACf,KAAK,QACN,oBAAoB,WACjB,UAAU,SACb,SAAS,MAAM,EAAE,KACtB,oBAAoB,EAStB,CAAC;AAEF,eAAO,MAAM,UAAU,UAAW,KAAK,QAAQ,IAAI,KAAG,gBAgBrD,CAAC;AAEF,eAAO,MAAM,wBAAwB,UAAW,KAAK,QAAQ,IAAI,kCAEhE,CAAC;AAEF,eAAO,MAAM,cAAc,UAAW,KAAK,QAAQ,IAAI,kBAEtD,CAAC;AAEF,eAAO,MAAM,aAAa,UAAW,KAAK,QAAQ,IAAI,0BAErD,CAAC;AAEF,eAAO,MAAM,UAAU,SAAU,IAAI,CAAC,GAAG,CAAC,6CAUzC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"5.
|
|
1
|
+
{"version":"5.7.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-navtree",
|
|
3
|
-
"version": "0.8.2-
|
|
3
|
+
"version": "0.8.2-staging.7ac8446",
|
|
4
4
|
"description": "DXOS Surface plugin for a tree view visualization of the graph.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -29,58 +29,49 @@
|
|
|
29
29
|
"@radix-ui/react-dismissable-layer": "1.1.5",
|
|
30
30
|
"@radix-ui/react-use-controllable-state": "1.1.0",
|
|
31
31
|
"date-fns": "^3.3.1",
|
|
32
|
-
"
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/app-graph": "0.8.2-
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/echo": "0.8.2-
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/keyboard": "0.8.2-
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/plugin-deck": "0.8.2-
|
|
45
|
-
"@dxos/plugin-graph": "0.8.2-
|
|
46
|
-
"@dxos/plugin-
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/react-
|
|
50
|
-
"@dxos/react-ui-
|
|
51
|
-
"@dxos/react-ui-
|
|
52
|
-
"@dxos/react-ui-
|
|
53
|
-
"@dxos/react-ui-
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/util": "0.8.2-main.fbd8ed0"
|
|
32
|
+
"@dxos/app-framework": "0.8.2-staging.7ac8446",
|
|
33
|
+
"@dxos/async": "0.8.2-staging.7ac8446",
|
|
34
|
+
"@dxos/app-graph": "0.8.2-staging.7ac8446",
|
|
35
|
+
"@dxos/debug": "0.8.2-staging.7ac8446",
|
|
36
|
+
"@dxos/invariant": "0.8.2-staging.7ac8446",
|
|
37
|
+
"@dxos/echo-schema": "0.8.2-staging.7ac8446",
|
|
38
|
+
"@dxos/local-storage": "0.8.2-staging.7ac8446",
|
|
39
|
+
"@dxos/keyboard": "0.8.2-staging.7ac8446",
|
|
40
|
+
"@dxos/log": "0.8.2-staging.7ac8446",
|
|
41
|
+
"@dxos/plugin-client": "0.8.2-staging.7ac8446",
|
|
42
|
+
"@dxos/live-object": "0.8.2-staging.7ac8446",
|
|
43
|
+
"@dxos/plugin-observability": "0.8.2-staging.7ac8446",
|
|
44
|
+
"@dxos/plugin-deck": "0.8.2-staging.7ac8446",
|
|
45
|
+
"@dxos/plugin-graph": "0.8.2-staging.7ac8446",
|
|
46
|
+
"@dxos/plugin-theme": "0.8.2-staging.7ac8446",
|
|
47
|
+
"@dxos/react-client": "0.8.2-staging.7ac8446",
|
|
48
|
+
"@dxos/protocols": "0.8.2-staging.7ac8446",
|
|
49
|
+
"@dxos/react-ui-list": "0.8.2-staging.7ac8446",
|
|
50
|
+
"@dxos/react-ui-searchlist": "0.8.2-staging.7ac8446",
|
|
51
|
+
"@dxos/react-ui-stack": "0.8.2-staging.7ac8446",
|
|
52
|
+
"@dxos/react-ui-menu": "0.8.2-staging.7ac8446",
|
|
53
|
+
"@dxos/react-ui-tabs": "0.8.2-staging.7ac8446",
|
|
54
|
+
"@dxos/util": "0.8.2-staging.7ac8446"
|
|
56
55
|
},
|
|
57
56
|
"devDependencies": {
|
|
58
|
-
"@effect-rx/rx-react": "^0.34.1",
|
|
59
|
-
"@effect/platform": "0.80.12",
|
|
60
57
|
"@phosphor-icons/react": "^2.1.5",
|
|
61
58
|
"@types/react": "~18.2.0",
|
|
62
59
|
"@types/react-dom": "~18.2.0",
|
|
63
60
|
"react": "~18.2.0",
|
|
64
61
|
"react-dom": "~18.2.0",
|
|
65
62
|
"vite": "5.4.7",
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/
|
|
70
|
-
"@dxos/
|
|
71
|
-
"@dxos/react-ui-theme": "0.8.2-main.fbd8ed0",
|
|
72
|
-
"@dxos/react-ui": "0.8.2-main.fbd8ed0",
|
|
73
|
-
"@dxos/storybook-utils": "0.8.2-main.fbd8ed0"
|
|
63
|
+
"@dxos/echo-signals": "0.8.2-staging.7ac8446",
|
|
64
|
+
"@dxos/random": "0.8.2-staging.7ac8446",
|
|
65
|
+
"@dxos/react-ui": "0.8.2-staging.7ac8446",
|
|
66
|
+
"@dxos/react-ui-theme": "0.8.2-staging.7ac8446",
|
|
67
|
+
"@dxos/storybook-utils": "0.8.2-staging.7ac8446"
|
|
74
68
|
},
|
|
75
69
|
"peerDependencies": {
|
|
76
|
-
"@effect-rx/rx-react": "^0.34.1",
|
|
77
|
-
"@effect/platform": "0.80.12",
|
|
78
70
|
"@phosphor-icons/react": "^2.1.5",
|
|
79
|
-
"effect": "^3.13.3",
|
|
80
71
|
"react": "~18.2.0",
|
|
81
72
|
"react-dom": "~18.2.0",
|
|
82
|
-
"@dxos/react-ui": "0.8.2-
|
|
83
|
-
"@dxos/react-ui-theme": "0.8.2-
|
|
73
|
+
"@dxos/react-ui": "0.8.2-staging.7ac8446",
|
|
74
|
+
"@dxos/react-ui-theme": "0.8.2-staging.7ac8446"
|
|
84
75
|
},
|
|
85
76
|
"publishConfig": {
|
|
86
77
|
"access": "public"
|
package/src/NavTreePlugin.tsx
CHANGED
|
@@ -57,8 +57,8 @@ export const NavTreePlugin = () =>
|
|
|
57
57
|
id: `${meta.id}/module/expose`,
|
|
58
58
|
activatesOn: allOf(Events.DispatcherReady, Events.LayoutReady, NavTreeEvents.StateReady),
|
|
59
59
|
activate: async (context) => {
|
|
60
|
-
const layout = context.
|
|
61
|
-
const { dispatchPromise: dispatch } = context.
|
|
60
|
+
const layout = context.requestCapability(Capabilities.Layout);
|
|
61
|
+
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
62
62
|
if (dispatch && layout.active.length === 1) {
|
|
63
63
|
await dispatch(createIntent(LayoutAction.Expose, { part: 'navigation', subject: layout.active[0] }));
|
|
64
64
|
}
|
|
@@ -2,51 +2,41 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import { Capabilities, contributes, type PluginContext, createIntent, LayoutAction } from '@dxos/app-framework';
|
|
9
|
-
import { createExtension, ROOT_ID } from '@dxos/plugin-graph';
|
|
5
|
+
import { Capabilities, contributes, type PluginsContext, createIntent, LayoutAction } from '@dxos/app-framework';
|
|
6
|
+
import { createExtension, type Node } from '@dxos/plugin-graph';
|
|
10
7
|
|
|
11
8
|
import { COMMANDS_DIALOG, NAVTREE_PLUGIN } from '../meta';
|
|
12
9
|
|
|
13
|
-
export default (context:
|
|
10
|
+
export default (context: PluginsContext) =>
|
|
14
11
|
contributes(
|
|
15
12
|
Capabilities.AppGraphBuilder,
|
|
16
13
|
createExtension({
|
|
17
14
|
id: NAVTREE_PLUGIN,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
part: 'dialog',
|
|
31
|
-
subject: COMMANDS_DIALOG,
|
|
32
|
-
options: {
|
|
33
|
-
blockAlign: 'start',
|
|
34
|
-
},
|
|
35
|
-
}),
|
|
36
|
-
);
|
|
37
|
-
},
|
|
38
|
-
properties: {
|
|
39
|
-
label: ['open commands label', { ns: NAVTREE_PLUGIN }],
|
|
40
|
-
icon: 'ph--magnifying-glass--regular',
|
|
41
|
-
keyBinding: {
|
|
42
|
-
macos: 'meta+k',
|
|
43
|
-
windows: 'ctrl+k',
|
|
44
|
-
},
|
|
15
|
+
filter: (node): node is Node<null> => node.id === 'root',
|
|
16
|
+
actions: () => [
|
|
17
|
+
{
|
|
18
|
+
id: COMMANDS_DIALOG,
|
|
19
|
+
data: async () => {
|
|
20
|
+
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
21
|
+
await dispatch(
|
|
22
|
+
createIntent(LayoutAction.UpdateDialog, {
|
|
23
|
+
part: 'dialog',
|
|
24
|
+
subject: COMMANDS_DIALOG,
|
|
25
|
+
options: {
|
|
26
|
+
blockAlign: 'start',
|
|
45
27
|
},
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
28
|
+
}),
|
|
29
|
+
);
|
|
30
|
+
},
|
|
31
|
+
properties: {
|
|
32
|
+
label: ['open commands label', { ns: NAVTREE_PLUGIN }],
|
|
33
|
+
icon: 'ph--magnifying-glass--regular',
|
|
34
|
+
keyBinding: {
|
|
35
|
+
macos: 'meta+k',
|
|
36
|
+
windows: 'ctrl+k',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
],
|
|
51
41
|
}),
|
|
52
42
|
);
|
|
@@ -3,18 +3,17 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { defineCapability } from '@dxos/app-framework';
|
|
6
|
-
import { type
|
|
6
|
+
import { type ReactiveObject } from '@dxos/live-object';
|
|
7
7
|
|
|
8
8
|
import { NAVTREE_PLUGIN } from '../meta';
|
|
9
9
|
import { type NavTreeItemGraphNode } from '../types';
|
|
10
10
|
|
|
11
11
|
export namespace NavTreeCapabilities {
|
|
12
12
|
export const State = defineCapability<{
|
|
13
|
-
state: Map<string,
|
|
14
|
-
getItem: (path: string[]) =>
|
|
15
|
-
setItem: (path: string[], key: 'open' | 'current'
|
|
13
|
+
state: Map<string, ReactiveObject<{ open: boolean; current: boolean }>>;
|
|
14
|
+
getItem: (path: string[]) => ReactiveObject<{ open: boolean; current: boolean }>;
|
|
15
|
+
setItem: (path: string[], key: 'open' | 'current', next: boolean) => void;
|
|
16
16
|
isOpen: (path: string[], item: NavTreeItemGraphNode) => boolean;
|
|
17
17
|
isCurrent: (path: string[], item: NavTreeItemGraphNode) => boolean;
|
|
18
|
-
isAlternateTree: (path: string[], item: NavTreeItemGraphNode) => boolean;
|
|
19
18
|
}>(`${NAVTREE_PLUGIN}/capability/state`);
|
|
20
19
|
}
|
|
@@ -2,23 +2,22 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import { contributes, type PluginContext, Capabilities, createResolver, LayoutAction } from '@dxos/app-framework';
|
|
5
|
+
import { contributes, type PluginsContext, Capabilities, createResolver, LayoutAction } from '@dxos/app-framework';
|
|
6
|
+
import { S } from '@dxos/echo-schema';
|
|
8
7
|
import { log } from '@dxos/log';
|
|
9
8
|
|
|
10
9
|
import { NavTreeCapabilities } from './capabilities';
|
|
11
10
|
|
|
12
|
-
export default (context:
|
|
11
|
+
export default (context: PluginsContext) =>
|
|
13
12
|
contributes(
|
|
14
13
|
Capabilities.IntentResolver,
|
|
15
14
|
createResolver({
|
|
16
15
|
intent: LayoutAction.UpdateLayout,
|
|
17
|
-
filter: (data): data is
|
|
18
|
-
|
|
16
|
+
filter: (data): data is S.Schema.Type<typeof LayoutAction.Expose.fields.input> =>
|
|
17
|
+
S.is(LayoutAction.Expose.fields.input)(data),
|
|
19
18
|
resolve: async ({ subject }) => {
|
|
20
|
-
const { graph } = context.
|
|
21
|
-
const { getItem, setItem } = context.
|
|
19
|
+
const { graph } = context.requestCapability(Capabilities.AppGraph);
|
|
20
|
+
const { getItem, setItem } = context.requestCapability(NavTreeCapabilities.State);
|
|
22
21
|
|
|
23
22
|
try {
|
|
24
23
|
const path = await graph.waitForPath({ target: subject }, { timeout: 1_000 });
|
|
@@ -2,51 +2,46 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Capabilities as AppCapabilities, contributes, type
|
|
6
|
-
import { debounce } from '@dxos/async';
|
|
5
|
+
import { Capabilities as AppCapabilities, contributes, type PluginsContext } from '@dxos/app-framework';
|
|
7
6
|
import { Keyboard } from '@dxos/keyboard';
|
|
8
|
-
import { isAction
|
|
7
|
+
import { isAction } from '@dxos/plugin-graph';
|
|
9
8
|
import { getHostPlatform } from '@dxos/util';
|
|
10
9
|
|
|
11
10
|
import { KEY_BINDING } from '../meta';
|
|
12
11
|
|
|
13
|
-
export default (context:
|
|
14
|
-
const { graph } = context.
|
|
12
|
+
export default (context: PluginsContext) => {
|
|
13
|
+
const { graph } = context.requestCapability(AppCapabilities.AppGraph);
|
|
15
14
|
|
|
16
15
|
// TODO(wittjosiah): Factor out.
|
|
17
16
|
// TODO(wittjosiah): Handle removal of actions.
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
graph.traverse({ visitor });
|
|
47
|
-
}, 500);
|
|
48
|
-
|
|
49
|
-
const unsubscribe = graph.onNodeChanged.on(eventHandler);
|
|
17
|
+
const unsubscribe = graph.subscribeTraverse({
|
|
18
|
+
visitor: (node, path) => {
|
|
19
|
+
let shortcut: string | undefined;
|
|
20
|
+
if (typeof node.properties.keyBinding === 'object') {
|
|
21
|
+
const availablePlatforms = Object.keys(node.properties.keyBinding);
|
|
22
|
+
const platform = getHostPlatform();
|
|
23
|
+
shortcut = availablePlatforms.includes(platform)
|
|
24
|
+
? node.properties.keyBinding[platform]
|
|
25
|
+
: platform === 'ios'
|
|
26
|
+
? node.properties.keyBinding.macos // Fallback to macos if ios-specific bindings not provided.
|
|
27
|
+
: platform === 'linux' || platform === 'unknown'
|
|
28
|
+
? node.properties.keyBinding.windows // Fallback to windows if platform-specific bindings not provided.
|
|
29
|
+
: undefined;
|
|
30
|
+
} else {
|
|
31
|
+
shortcut = node.properties.keyBinding;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (shortcut && isAction(node)) {
|
|
35
|
+
Keyboard.singleton.getContext(path.slice(0, -1).join('/')).bind({
|
|
36
|
+
shortcut,
|
|
37
|
+
handler: () => {
|
|
38
|
+
void node.data({ node, caller: KEY_BINDING });
|
|
39
|
+
},
|
|
40
|
+
data: node.properties.label,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
});
|
|
50
45
|
|
|
51
46
|
// TODO(burdon): Create context and plugin.
|
|
52
47
|
Keyboard.singleton.initialize();
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
import { effect } from '@preact/signals-core';
|
|
6
6
|
|
|
7
|
-
import { Capabilities, contributes, type
|
|
8
|
-
import { type
|
|
7
|
+
import { Capabilities, contributes, type PluginsContext } from '@dxos/app-framework';
|
|
8
|
+
import { type ReactiveObject, create } from '@dxos/live-object';
|
|
9
9
|
import { Path } from '@dxos/react-ui-list';
|
|
10
10
|
|
|
11
11
|
import { NavTreeCapabilities } from './capabilities';
|
|
12
12
|
import { NAVTREE_PLUGIN } from '../meta';
|
|
13
13
|
|
|
14
|
-
const KEY = `${NAVTREE_PLUGIN}/state
|
|
14
|
+
const KEY = `${NAVTREE_PLUGIN}/state`;
|
|
15
15
|
|
|
16
16
|
const getInitialState = () => {
|
|
17
17
|
const stringified = localStorage.getItem(KEY);
|
|
@@ -24,34 +24,34 @@ const getInitialState = () => {
|
|
|
24
24
|
return cached.map(
|
|
25
25
|
([key, value]): [
|
|
26
26
|
string,
|
|
27
|
-
|
|
27
|
+
ReactiveObject<{
|
|
28
28
|
open: boolean;
|
|
29
29
|
current: boolean;
|
|
30
30
|
}>,
|
|
31
|
-
] => [key,
|
|
31
|
+
] => [key, create({ open: value.open, current: false })],
|
|
32
32
|
);
|
|
33
33
|
} catch {}
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
export default (context:
|
|
37
|
-
const layout = context.
|
|
36
|
+
export default (context: PluginsContext) => {
|
|
37
|
+
const layout = context.requestCapability(Capabilities.Layout);
|
|
38
38
|
|
|
39
|
-
// TODO(wittjosiah): This currently needs to be not a
|
|
40
|
-
// If it is a
|
|
41
|
-
// Ideally this could be a
|
|
39
|
+
// TODO(wittjosiah): This currently needs to be not a ReactiveObject at the root.
|
|
40
|
+
// If it is a ReactiveObject then React errors when initializing new paths because of state change during render.
|
|
41
|
+
// Ideally this could be a ReactiveObject but be able to access and update the root level without breaking render.
|
|
42
42
|
// Wrapping accesses and updates in `untracked` didn't seem to work in all cases.
|
|
43
|
-
const state = new Map<string,
|
|
43
|
+
const state = new Map<string, ReactiveObject<{ open: boolean; current: boolean }>>(
|
|
44
44
|
getInitialState() ?? [
|
|
45
45
|
// TODO(thure): Initialize these dynamically.
|
|
46
|
-
['root',
|
|
47
|
-
['root~dxos.org/plugin/space-spaces',
|
|
48
|
-
['root~dxos.org/plugin/files',
|
|
46
|
+
['root', create({ open: true, current: false })],
|
|
47
|
+
['root~dxos.org/plugin/space-spaces', create({ open: true, current: false })],
|
|
48
|
+
['root~dxos.org/plugin/files', create({ open: true, current: false })],
|
|
49
49
|
],
|
|
50
50
|
);
|
|
51
51
|
|
|
52
52
|
const getItem = (_path: string[]) => {
|
|
53
53
|
const path = Path.create(..._path);
|
|
54
|
-
const value = state.get(path) ??
|
|
54
|
+
const value = state.get(path) ?? create({ open: false, current: false });
|
|
55
55
|
if (!state.has(path)) {
|
|
56
56
|
state.set(path, value);
|
|
57
57
|
}
|
|
@@ -59,7 +59,7 @@ export default (context: PluginContext) => {
|
|
|
59
59
|
return value;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
const setItem = (path: string[], key: 'open' | 'current'
|
|
62
|
+
const setItem = (path: string[], key: 'open' | 'current', next: boolean) => {
|
|
63
63
|
const value = getItem(path);
|
|
64
64
|
value[key] = next;
|
|
65
65
|
|
|
@@ -68,10 +68,6 @@ export default (context: PluginContext) => {
|
|
|
68
68
|
|
|
69
69
|
const isOpen = (path: string[]) => getItem(path).open;
|
|
70
70
|
const isCurrent = (path: string[]) => getItem(path).current;
|
|
71
|
-
const isAlternateTree = (path: string[]) => {
|
|
72
|
-
const item = getItem(path);
|
|
73
|
-
return item.alternateTree ?? false;
|
|
74
|
-
};
|
|
75
71
|
|
|
76
72
|
let previous: string[] = [];
|
|
77
73
|
const unsubscribe = effect(() => {
|
|
@@ -97,7 +93,5 @@ export default (context: PluginContext) => {
|
|
|
97
93
|
});
|
|
98
94
|
});
|
|
99
95
|
|
|
100
|
-
return contributes(NavTreeCapabilities.State, { state, getItem, setItem, isOpen, isCurrent
|
|
101
|
-
unsubscribe(),
|
|
102
|
-
);
|
|
96
|
+
return contributes(NavTreeCapabilities.State, { state, getItem, setItem, isOpen, isCurrent }, () => unsubscribe());
|
|
103
97
|
};
|
|
@@ -5,15 +5,14 @@
|
|
|
5
5
|
import React, { useMemo, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { createIntent, LayoutAction, useAppGraph, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
|
-
import { type ActionLike,
|
|
8
|
+
import { type ActionLike, isActionGroup, isAction } from '@dxos/app-graph';
|
|
9
9
|
import { Keyboard, keySymbols } from '@dxos/keyboard';
|
|
10
|
-
import { useActions } from '@dxos/plugin-graph';
|
|
11
10
|
import { Button, Dialog, Icon, useTranslation, toLocalizedString } from '@dxos/react-ui';
|
|
12
11
|
import { SearchList } from '@dxos/react-ui-searchlist';
|
|
13
12
|
import { descriptionText, mx } from '@dxos/react-ui-theme';
|
|
14
13
|
import { getHostPlatform } from '@dxos/util';
|
|
15
14
|
|
|
16
|
-
import { KEY_BINDING, NAVTREE_PLUGIN } from '
|
|
15
|
+
import { KEY_BINDING, NAVTREE_PLUGIN } from '../meta';
|
|
17
16
|
|
|
18
17
|
// TODO(wittjosiah): This probably deserves its own plugin but for now it lives here w/ other navigation UI.
|
|
19
18
|
export const CommandsDialogContent = ({ selected: initial }: { selected?: string }) => {
|
|
@@ -29,7 +28,7 @@ export const CommandsDialogContent = ({ selected: initial }: { selected?: string
|
|
|
29
28
|
const current = Keyboard.singleton.getCurrentContext();
|
|
30
29
|
const actionMap = new Set<string>();
|
|
31
30
|
const actions: ActionLike[] = [];
|
|
32
|
-
graph
|
|
31
|
+
graph?.traverse({
|
|
33
32
|
visitor: (node, path) => {
|
|
34
33
|
if (
|
|
35
34
|
(isAction(node) || isActionGroup(node)) &&
|
|
@@ -48,12 +47,12 @@ export const CommandsDialogContent = ({ selected: initial }: { selected?: string
|
|
|
48
47
|
.localeCompare(toLocalizedString(b.properties.label, t)?.toLowerCase());
|
|
49
48
|
});
|
|
50
49
|
|
|
50
|
+
// console.log(JSON.stringify(actions, undefined, 2));
|
|
51
51
|
return actions;
|
|
52
52
|
}, [graph]);
|
|
53
53
|
|
|
54
54
|
const group = allActions.find(({ id }) => id === selected);
|
|
55
|
-
const
|
|
56
|
-
const actions = isActionGroup(group) ? groupActions : allActions;
|
|
55
|
+
const actions = isActionGroup(group) ? graph.actions(group) : allActions;
|
|
57
56
|
|
|
58
57
|
return (
|
|
59
58
|
<Dialog.Content classNames={['md:max-is-[30rem] overflow-hidden mbs-12']}>
|
|
@@ -85,8 +84,8 @@ export const CommandsDialogContent = ({ selected: initial }: { selected?: string
|
|
|
85
84
|
|
|
86
85
|
void dispatch(createIntent(LayoutAction.UpdateDialog, { part: 'dialog', options: { state: false } }));
|
|
87
86
|
setTimeout(() => {
|
|
88
|
-
const node = graph.
|
|
89
|
-
void (node && isAction(action) && action.data({
|
|
87
|
+
const node = graph.nodes(group ?? action, { relation: 'inbound' })[0];
|
|
88
|
+
void (node && isAction(action) && action.data({ node, caller: KEY_BINDING }));
|
|
90
89
|
});
|
|
91
90
|
}}
|
|
92
91
|
classNames='flex items-center gap-2'
|
|
@@ -9,7 +9,7 @@ import { createIntent, LayoutAction, useIntentDispatcher } from '@dxos/app-frame
|
|
|
9
9
|
import { Button, useTranslation } from '@dxos/react-ui';
|
|
10
10
|
import { getSize } from '@dxos/react-ui-theme';
|
|
11
11
|
|
|
12
|
-
import { COMMANDS_DIALOG, NAVTREE_PLUGIN } from '
|
|
12
|
+
import { COMMANDS_DIALOG, NAVTREE_PLUGIN } from '../meta';
|
|
13
13
|
|
|
14
14
|
// TODO(thure): Refactor to be handled by a more appropriate plugin.
|
|
15
15
|
export const CommandsTrigger = () => {
|