@dxos/plugin-navtree 0.8.4-main.b97322e → 0.8.4-main.bc674ce
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-RSMA6I22.mjs +43 -0
- package/dist/lib/browser/app-graph-builder-RSMA6I22.mjs.map +7 -0
- package/dist/lib/browser/chunk-6YPQ625I.mjs +1293 -0
- package/dist/lib/browser/chunk-6YPQ625I.mjs.map +7 -0
- package/dist/lib/browser/chunk-AGQDZBPL.mjs +23 -0
- package/dist/lib/browser/chunk-AGQDZBPL.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 +84 -96
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{keyboard-QRS6WOQH.mjs → keyboard-32EH3N4K.mjs} +20 -19
- package/dist/lib/browser/keyboard-32EH3N4K.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-IB75DC5O.mjs +52 -0
- package/dist/lib/browser/operation-resolver-IB75DC5O.mjs.map +7 -0
- package/dist/lib/browser/react-surface-F6CVMS3Y.mjs +58 -0
- package/dist/lib/browser/react-surface-F6CVMS3Y.mjs.map +7 -0
- package/dist/lib/browser/state-EVYQOUI3.mjs +120 -0
- package/dist/lib/browser/state-EVYQOUI3.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 -105
- 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 +32 -3
- package/dist/types/src/components/NavTree/NavTree.d.ts.map +1 -1
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts +29 -4
- 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 +33 -4
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts +2 -2
- package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L0Menu.d.ts +6 -4
- package/dist/types/src/components/Sidebar/L0Menu.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L1Panel.d.ts +5 -6
- package/dist/types/src/components/Sidebar/L1Panel.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L1Tabs.d.ts +12 -0
- package/dist/types/src/components/Sidebar/L1Tabs.d.ts.map +1 -0
- package/dist/types/src/components/Sidebar/index.d.ts +1 -0
- package/dist/types/src/components/Sidebar/index.d.ts.map +1 -1
- package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.d.ts.map +1 -1
- package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.d.ts +8 -5
- package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/types.d.ts +8 -8
- package/dist/types/src/components/types.d.ts.map +1 -1
- package/dist/types/src/experimental/Tree.d.ts +1 -2
- package/dist/types/src/experimental/Tree.d.ts.map +1 -1
- package/dist/types/src/experimental/Tree.stories.d.ts +7 -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 +3 -4
- 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/translations.d.ts +1 -0
- package/dist/types/src/translations.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} +10 -9
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/dist/types/src/util.d.ts +8 -9
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +55 -53
- package/src/NavTreePlugin.tsx +65 -83
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +41 -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 +65 -0
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +41 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +54 -0
- package/src/capabilities/state/index.ts +7 -0
- package/src/capabilities/state/state.ts +121 -0
- package/src/components/CommandsDialog/CommandsDialog.tsx +109 -98
- package/src/components/CommandsDialog/CommandsTrigger.tsx +6 -15
- package/src/components/NavTree/NavTree.stories.tsx +98 -93
- package/src/components/NavTree/NavTree.tsx +12 -18
- package/src/components/NavTreeContainer.tsx +280 -256
- package/src/components/NavTreeDocumentTitle.tsx +5 -4
- package/src/components/NavTreeItem/NavTreeItemAction.stories.tsx +20 -12
- package/src/components/NavTreeItem/NavTreeItemAction.tsx +25 -18
- package/src/components/NavTreeItem/NavTreeItemColumns.tsx +38 -32
- package/src/components/Sidebar/L0Menu.tsx +114 -139
- package/src/components/Sidebar/L1Panel.tsx +76 -99
- package/src/components/Sidebar/L1Tabs.tsx +33 -0
- package/src/components/Sidebar/index.ts +1 -0
- package/src/components/UserAccountAvatar/UserAccountAvatar.stories.tsx +9 -8
- package/src/components/UserAccountAvatar/UserAccountAvatar.tsx +20 -12
- package/src/components/index.ts +1 -0
- package/src/components/types.ts +9 -8
- package/src/experimental/Tree.stories.tsx +28 -30
- package/src/experimental/Tree.tsx +7 -24
- package/src/hooks.ts +54 -2
- package/src/index.ts +1 -2
- package/src/meta.ts +11 -8
- package/src/testing/app-graph-builder.ts +159 -234
- package/src/testing/generator.ts +20 -18
- package/src/testing/update-state.ts +6 -6
- package/src/translations.ts +1 -0
- package/src/types/capabilities.ts +21 -0
- package/src/types/events.ts +11 -0
- package/src/types/index.ts +7 -0
- package/src/{types.ts → types/schema.ts} +9 -8
- package/src/util.ts +14 -35
- package/dist/lib/browser/app-graph-builder-5J4LRWDX.mjs +0 -45
- package/dist/lib/browser/app-graph-builder-5J4LRWDX.mjs.map +0 -7
- package/dist/lib/browser/chunk-ERDGQTH5.mjs +0 -16
- package/dist/lib/browser/chunk-ERDGQTH5.mjs.map +0 -7
- package/dist/lib/browser/chunk-SICQTLXC.mjs +0 -1442
- package/dist/lib/browser/chunk-SICQTLXC.mjs.map +0 -7
- package/dist/lib/browser/chunk-WCARAZ7J.mjs +0 -15
- package/dist/lib/browser/chunk-WCARAZ7J.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-3XYN2CBU.mjs +0 -47
- package/dist/lib/browser/intent-resolver-3XYN2CBU.mjs.map +0 -7
- package/dist/lib/browser/keyboard-QRS6WOQH.mjs.map +0 -7
- package/dist/lib/browser/react-surface-WURHCBQQ.mjs +0 -51
- package/dist/lib/browser/react-surface-WURHCBQQ.mjs.map +0 -7
- package/dist/lib/browser/state-54DY3DOY.mjs +0 -117
- package/dist/lib/browser/state-54DY3DOY.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 -52
- 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 -104
- package/src/events.ts +0 -11
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intent-resolver.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/intent-resolver.ts"],"names":[],"mappings":"AAMA,OAAO,EAAe,KAAK,aAAa,EAAE,YAAY,EAAgC,MAAM,qBAAqB,CAAC;yBAKlG,SAAS,aAAa;AAAtC,wBAyBI"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/keyboard.ts"],"names":[],"mappings":"AAIA,OAAO,EAAgD,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;yBAQvF,SAAS,aAAa;AAAtC,wBA8CE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react-surface.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/react-surface.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAA8B,MAAM,qBAAqB,CAAC;;AAM/E,wBAgCK"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { type PluginContext } from '@dxos/app-framework';
|
|
2
|
-
import { type Live } from '@dxos/echo';
|
|
3
|
-
declare const _default: (context: PluginContext) => import("@dxos/app-framework").Capability<{
|
|
4
|
-
state: Map<string, Live<{
|
|
5
|
-
open: boolean;
|
|
6
|
-
current: boolean;
|
|
7
|
-
alternateTree?: boolean;
|
|
8
|
-
}>>;
|
|
9
|
-
getItem: (path: string[]) => Live<{
|
|
10
|
-
open: boolean;
|
|
11
|
-
current: boolean;
|
|
12
|
-
alternateTree?: boolean;
|
|
13
|
-
}>;
|
|
14
|
-
setItem: (path: string[], key: "open" | "current" | "alternateTree", next: boolean) => void;
|
|
15
|
-
isOpen: (path: string[], item: import("../types").NavTreeItemGraphNode) => boolean;
|
|
16
|
-
isCurrent: (path: string[], item: import("../types").NavTreeItemGraphNode) => boolean;
|
|
17
|
-
isAlternateTree: (path: string[], item: import("../types").NavTreeItemGraphNode) => boolean;
|
|
18
|
-
}>;
|
|
19
|
-
export default _default;
|
|
20
|
-
//# sourceMappingURL=state.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/state.ts"],"names":[],"mappings":"AAMA,OAAO,EAA6B,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;yBAwBvB,SAAS,aAAa;;;;qBAnBL,CAAC;;;;;qBAKjB,CAAC;;;;;;;AAclB,wBAwEE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/events.ts"],"names":[],"mappings":"AAQA,yBAAiB,aAAa,CAAC;IACtB,MAAM,UAAU,+CAA0C,CAAC;CACnE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,UAAU,EAAE,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE9D,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,GAAG,EACH,OAAO,CACL,cAAc,GAAG;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,sBAAsB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACpC,oBAAoB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,mBAAmB,EAAE,CAAC,SAAS,EAAE,oBAAoB,EAAE,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;IAC/E,MAAM,EAAE,CAAC,UAAU,EAAE,oBAAoB,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;IACjF,eAAe,EAAE,CAAC,UAAU,EAAE,oBAAoB,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;IAC1F,aAAa,EAAE,CAAC,UAAU,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,oBAAoB,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;CAClH,CACF,CACF,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAC1C,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,gBAAgB,GAAG;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,GAAG;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;CAClC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IAGvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Rx } from '@effect-rx/rx-react';
|
|
6
|
-
import { Option, pipe } from 'effect';
|
|
7
|
-
|
|
8
|
-
import { Capabilities, contributes, type PluginContext, createIntent, LayoutAction } from '@dxos/app-framework';
|
|
9
|
-
import { createExtension, ROOT_ID } from '@dxos/plugin-graph';
|
|
10
|
-
|
|
11
|
-
import { COMMANDS_DIALOG, NAVTREE_PLUGIN } from '../meta';
|
|
12
|
-
|
|
13
|
-
export default (context: PluginContext) =>
|
|
14
|
-
contributes(
|
|
15
|
-
Capabilities.AppGraphBuilder,
|
|
16
|
-
createExtension({
|
|
17
|
-
id: NAVTREE_PLUGIN,
|
|
18
|
-
actions: (node) =>
|
|
19
|
-
Rx.make((get) =>
|
|
20
|
-
pipe(
|
|
21
|
-
get(node),
|
|
22
|
-
Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),
|
|
23
|
-
Option.map(() => [
|
|
24
|
-
{
|
|
25
|
-
id: COMMANDS_DIALOG,
|
|
26
|
-
data: async () => {
|
|
27
|
-
const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
28
|
-
await dispatch(
|
|
29
|
-
createIntent(LayoutAction.UpdateDialog, {
|
|
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
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
]),
|
|
48
|
-
Option.getOrElse(() => []),
|
|
49
|
-
),
|
|
50
|
-
),
|
|
51
|
-
}),
|
|
52
|
-
);
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { defineCapability } from '@dxos/app-framework';
|
|
6
|
-
import { type Live } from '@dxos/live-object';
|
|
7
|
-
|
|
8
|
-
import { NAVTREE_PLUGIN } from '../meta';
|
|
9
|
-
import { type NavTreeItemGraphNode } from '../types';
|
|
10
|
-
|
|
11
|
-
export namespace NavTreeCapabilities {
|
|
12
|
-
export const State = defineCapability<{
|
|
13
|
-
state: Map<string, Live<{ open: boolean; current: boolean; alternateTree?: boolean }>>;
|
|
14
|
-
getItem: (path: string[]) => Live<{ open: boolean; current: boolean; alternateTree?: boolean }>;
|
|
15
|
-
setItem: (path: string[], key: 'open' | 'current' | 'alternateTree', next: boolean) => void;
|
|
16
|
-
isOpen: (path: string[], item: NavTreeItemGraphNode) => boolean;
|
|
17
|
-
isCurrent: (path: string[], item: NavTreeItemGraphNode) => boolean;
|
|
18
|
-
isAlternateTree: (path: string[], item: NavTreeItemGraphNode) => boolean;
|
|
19
|
-
}>(`${NAVTREE_PLUGIN}/capability/state`);
|
|
20
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Schema } from 'effect';
|
|
6
|
-
|
|
7
|
-
import { contributes, type PluginContext, Capabilities, createResolver, LayoutAction } from '@dxos/app-framework';
|
|
8
|
-
import { log } from '@dxos/log';
|
|
9
|
-
|
|
10
|
-
import { NavTreeCapabilities } from './capabilities';
|
|
11
|
-
|
|
12
|
-
export default (context: PluginContext) =>
|
|
13
|
-
contributes(
|
|
14
|
-
Capabilities.IntentResolver,
|
|
15
|
-
createResolver({
|
|
16
|
-
intent: LayoutAction.UpdateLayout,
|
|
17
|
-
filter: (data): data is Schema.Schema.Type<typeof LayoutAction.Expose.fields.input> =>
|
|
18
|
-
Schema.is(LayoutAction.Expose.fields.input)(data),
|
|
19
|
-
resolve: async ({ subject }) => {
|
|
20
|
-
const { graph } = context.getCapability(Capabilities.AppGraph);
|
|
21
|
-
const { getItem, setItem } = context.getCapability(NavTreeCapabilities.State);
|
|
22
|
-
|
|
23
|
-
try {
|
|
24
|
-
const path = await graph.waitForPath({ target: subject }, { timeout: 1_000 });
|
|
25
|
-
[...Array(path.length)].forEach((_, index) => {
|
|
26
|
-
const subpath = path.slice(0, index);
|
|
27
|
-
const value = getItem(subpath);
|
|
28
|
-
if (!value.open) {
|
|
29
|
-
setItem(subpath, 'open', true);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
} catch {
|
|
33
|
-
log('Path to node not found', { subject });
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
}),
|
|
37
|
-
);
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Capabilities as AppCapabilities, contributes, type PluginContext } from '@dxos/app-framework';
|
|
6
|
-
import { debounce } from '@dxos/async';
|
|
7
|
-
import { Keyboard } from '@dxos/keyboard';
|
|
8
|
-
import { isAction, type Node } from '@dxos/plugin-graph';
|
|
9
|
-
import { getHostPlatform } from '@dxos/util';
|
|
10
|
-
|
|
11
|
-
import { KEY_BINDING } from '../meta';
|
|
12
|
-
|
|
13
|
-
export default (context: PluginContext) => {
|
|
14
|
-
const { graph } = context.getCapability(AppCapabilities.AppGraph);
|
|
15
|
-
|
|
16
|
-
// TODO(wittjosiah): Factor out.
|
|
17
|
-
// TODO(wittjosiah): Handle removal of actions.
|
|
18
|
-
const visitor = (node: Node, path: string[]) => {
|
|
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({ parent: node, caller: KEY_BINDING });
|
|
39
|
-
},
|
|
40
|
-
data: node.properties.label,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const eventHandler = debounce(() => {
|
|
46
|
-
graph.traverse({ visitor });
|
|
47
|
-
}, 500);
|
|
48
|
-
|
|
49
|
-
const unsubscribe = graph.onNodeChanged.on(eventHandler);
|
|
50
|
-
|
|
51
|
-
// TODO(burdon): Create context and plugin.
|
|
52
|
-
Keyboard.singleton.initialize();
|
|
53
|
-
Keyboard.singleton.setCurrentContext(graph.root.id);
|
|
54
|
-
|
|
55
|
-
return contributes(AppCapabilities.Null, null, () => {
|
|
56
|
-
unsubscribe();
|
|
57
|
-
Keyboard.singleton.destroy();
|
|
58
|
-
});
|
|
59
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
|
|
8
|
-
import { isGraphNode } from '@dxos/plugin-graph';
|
|
9
|
-
|
|
10
|
-
import { CommandsDialogContent, CommandsTrigger, NavTreeDocumentTitle, NavTreeContainer } from '../components';
|
|
11
|
-
import { COMMANDS_DIALOG, NAVTREE_PLUGIN } from '../meta';
|
|
12
|
-
|
|
13
|
-
export default () =>
|
|
14
|
-
contributes(Capabilities.ReactSurface, [
|
|
15
|
-
createSurface({
|
|
16
|
-
id: COMMANDS_DIALOG,
|
|
17
|
-
role: 'dialog',
|
|
18
|
-
filter: (data): data is { props: { selected?: string } } => data.component === COMMANDS_DIALOG,
|
|
19
|
-
component: ({ data }) => <CommandsDialogContent {...data.props} />,
|
|
20
|
-
}),
|
|
21
|
-
createSurface({
|
|
22
|
-
id: `${NAVTREE_PLUGIN}/navigation`,
|
|
23
|
-
role: 'navigation',
|
|
24
|
-
filter: (data): data is { popoverAnchorId?: string; topbar: boolean; current: string } =>
|
|
25
|
-
typeof data.current === 'string',
|
|
26
|
-
component: ({ data }) => (
|
|
27
|
-
<NavTreeContainer
|
|
28
|
-
tab={data.current}
|
|
29
|
-
popoverAnchorId={data.popoverAnchorId as string | undefined}
|
|
30
|
-
topbar={data.topbar as boolean}
|
|
31
|
-
/>
|
|
32
|
-
),
|
|
33
|
-
}),
|
|
34
|
-
createSurface({
|
|
35
|
-
id: `${NAVTREE_PLUGIN}/document-title`,
|
|
36
|
-
role: 'document-title',
|
|
37
|
-
component: ({ data }) => <NavTreeDocumentTitle node={isGraphNode(data.subject) ? data.subject : undefined} />,
|
|
38
|
-
}),
|
|
39
|
-
createSurface({
|
|
40
|
-
id: `${NAVTREE_PLUGIN}/search-input`,
|
|
41
|
-
role: 'search-input',
|
|
42
|
-
position: 'fallback',
|
|
43
|
-
component: () => <CommandsTrigger />,
|
|
44
|
-
}),
|
|
45
|
-
]);
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { effect, untracked } from '@preact/signals-core';
|
|
6
|
-
|
|
7
|
-
import { Capabilities, contributes, type PluginContext } from '@dxos/app-framework';
|
|
8
|
-
import { type Live } from '@dxos/echo';
|
|
9
|
-
import { live } from '@dxos/live-object';
|
|
10
|
-
import { Path } from '@dxos/react-ui-list';
|
|
11
|
-
|
|
12
|
-
import { NavTreeCapabilities } from './capabilities';
|
|
13
|
-
import { NAVTREE_PLUGIN } from '../meta';
|
|
14
|
-
|
|
15
|
-
const KEY = `${NAVTREE_PLUGIN}/state/v1`;
|
|
16
|
-
|
|
17
|
-
const getInitialState = () => {
|
|
18
|
-
const stringified = localStorage.getItem(KEY);
|
|
19
|
-
if (!stringified) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
try {
|
|
24
|
-
const cached: [string, { open: boolean; current: boolean }][] = JSON.parse(stringified);
|
|
25
|
-
return cached.map(([key, value]): [string, Live<{ open: boolean; current: boolean }>] => [
|
|
26
|
-
key,
|
|
27
|
-
live({ open: value.open, current: false }),
|
|
28
|
-
]);
|
|
29
|
-
} catch {}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export default (context: PluginContext) => {
|
|
33
|
-
const layout = context.getCapability(Capabilities.Layout);
|
|
34
|
-
|
|
35
|
-
// TODO(wittjosiah): This currently needs to be not a Live at the root.
|
|
36
|
-
// If it is a Live then React errors when initializing new paths because of state change during render.
|
|
37
|
-
// Ideally this could be a Live but be able to access and update the root level without breaking render.
|
|
38
|
-
// Wrapping accesses and updates in `untracked` didn't seem to work in all cases.
|
|
39
|
-
const state = new Map<string, Live<{ open: boolean; current: boolean; alternateTree?: boolean }>>(
|
|
40
|
-
getInitialState() ?? [
|
|
41
|
-
// TODO(thure): Initialize these dynamically.
|
|
42
|
-
['root', live({ open: true, current: false })],
|
|
43
|
-
['root~dxos.org/plugin/space-spaces', live({ open: true, current: false })],
|
|
44
|
-
['root~dxos.org/plugin/files', live({ open: true, current: false })],
|
|
45
|
-
],
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
const getItem = (_path: string[]) => {
|
|
49
|
-
const path = Path.create(..._path);
|
|
50
|
-
const value = state.get(path) ?? live({ open: false, current: false, alternateTree: false });
|
|
51
|
-
if (!state.has(path)) {
|
|
52
|
-
state.set(path, value);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return value;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const setItem = (path: string[], key: 'open' | 'current' | 'alternateTree', next: boolean) => {
|
|
59
|
-
const value = getItem(path);
|
|
60
|
-
value[key] = next;
|
|
61
|
-
|
|
62
|
-
localStorage.setItem(KEY, JSON.stringify(Array.from(state.entries())));
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const isOpen = (path: string[]) => getItem(path).open;
|
|
66
|
-
const isCurrent = (path: string[]) => getItem(path).current;
|
|
67
|
-
const isAlternateTree = (path: string[]) => {
|
|
68
|
-
const item = getItem(path);
|
|
69
|
-
return item.alternateTree ?? false;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
let previous: string[] = [];
|
|
73
|
-
const unsubscribe = effect(() => {
|
|
74
|
-
const removed = previous.filter((id) => !layout.active.includes(id));
|
|
75
|
-
previous = layout.active;
|
|
76
|
-
|
|
77
|
-
const handleUpdate = () => {
|
|
78
|
-
removed.forEach((id) => {
|
|
79
|
-
const keys = Array.from(state.keys()).filter((key) => Path.last(key) === id);
|
|
80
|
-
keys.forEach((key) => {
|
|
81
|
-
setItem(Path.parts(key), 'current', false);
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
layout.active.forEach((id) => {
|
|
86
|
-
const keys = Array.from(new Set([...state.keys(), id])).filter((key) => Path.last(key) === id);
|
|
87
|
-
keys.forEach((key) => {
|
|
88
|
-
setItem(Path.parts(key), 'current', true);
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
// TODO(wittjosiah): This is setTimeout because there's a race between the keys be initialized.
|
|
94
|
-
// Keys are initialized on the first render of an item in the navtree.
|
|
95
|
-
// This could be avoided if the location was a path as well and not just an id.
|
|
96
|
-
const timeout = setTimeout(handleUpdate, 500);
|
|
97
|
-
untracked(() => handleUpdate());
|
|
98
|
-
return () => clearTimeout(timeout);
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
return contributes(NavTreeCapabilities.State, { state, getItem, setItem, isOpen, isCurrent, isAlternateTree }, () =>
|
|
102
|
-
unsubscribe(),
|
|
103
|
-
);
|
|
104
|
-
};
|
package/src/events.ts
DELETED