@dxos/plugin-navtree 0.8.4-main.1068cf700f → 0.8.4-main.1c7ec43d41
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/NavTreePlugin-3KLPENH6.mjs +54 -0
- package/dist/lib/browser/NavTreePlugin-3KLPENH6.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +98 -114
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/translations.mjs +21 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/types/src/NavTreePlugin.d.ts +1 -0
- package/dist/types/src/NavTreePlugin.d.ts.map +1 -1
- package/dist/types/src/NavTreePlugin.node.d.ts +4 -0
- package/dist/types/src/NavTreePlugin.node.d.ts.map +1 -0
- package/dist/types/src/NavTreePlugin.test.d.ts +2 -0
- package/dist/types/src/NavTreePlugin.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +7 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/keyboard.d.ts +5 -0
- package/dist/types/src/capabilities/keyboard.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +6 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/components/NavTree/NavTree.d.ts +10 -32
- package/dist/types/src/components/NavTree/NavTree.d.ts.map +1 -1
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts +10 -15
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts.map +1 -1
- package/dist/types/src/components/{NavTreeContext.d.ts → NavTreeContext/NavTreeContext.d.ts} +1 -1
- package/dist/types/src/components/NavTreeContext/NavTreeContext.d.ts.map +1 -0
- package/dist/types/src/components/NavTreeContext/index.d.ts +2 -0
- package/dist/types/src/components/NavTreeContext/index.d.ts.map +1 -0
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts +7 -3
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L0Menu.d.ts +4 -1
- package/dist/types/src/components/Sidebar/L0Menu.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L1Panel.d.ts +2 -5
- package/dist/types/src/components/Sidebar/L1Panel.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L1Tabs.d.ts +3 -2
- package/dist/types/src/components/Sidebar/L1Tabs.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.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -3
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/types.d.ts +5 -14
- package/dist/types/src/components/types.d.ts.map +1 -1
- package/dist/types/src/{components/CommandsDialog/CommandsDialog.d.ts → containers/CommandsDialogContent/CommandsDialogContent.d.ts} +1 -1
- package/dist/types/src/containers/CommandsDialogContent/CommandsDialogContent.d.ts.map +1 -0
- package/dist/types/src/containers/CommandsDialogContent/CommandsDialogContent.stories.d.ts +28 -0
- package/dist/types/src/containers/CommandsDialogContent/CommandsDialogContent.stories.d.ts.map +1 -0
- package/dist/types/src/containers/CommandsDialogContent/index.d.ts +2 -0
- package/dist/types/src/containers/CommandsDialogContent/index.d.ts.map +1 -0
- package/dist/types/src/containers/CommandsTrigger/CommandsTrigger.d.ts.map +1 -0
- package/dist/types/src/containers/CommandsTrigger/index.d.ts +2 -0
- package/dist/types/src/containers/CommandsTrigger/index.d.ts.map +1 -0
- package/dist/types/src/containers/NavTreeContainer/NavTreeContainer.d.ts +9 -0
- package/dist/types/src/containers/NavTreeContainer/NavTreeContainer.d.ts.map +1 -0
- package/dist/types/src/containers/NavTreeContainer/index.d.ts +3 -0
- package/dist/types/src/containers/NavTreeContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/NavTreeDocumentTitle/NavTreeDocumentTitle.d.ts.map +1 -0
- package/dist/types/src/containers/NavTreeDocumentTitle/index.d.ts +2 -0
- package/dist/types/src/containers/NavTreeDocumentTitle/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +7 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/experimental/Tree.d.ts +2 -2
- package/dist/types/src/experimental/Tree.d.ts.map +1 -1
- package/dist/types/src/experimental/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +5 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useActions.d.ts +5 -0
- package/dist/types/src/hooks/useActions.d.ts.map +1 -0
- package/dist/types/src/hooks/useLoadDescendents.d.ts +6 -0
- package/dist/types/src/hooks/useLoadDescendents.d.ts.map +1 -0
- package/dist/types/src/hooks/useNavTreeModel.d.ts +7 -0
- package/dist/types/src/hooks/useNavTreeModel.d.ts.map +1 -0
- package/dist/types/src/hooks/useNavTreeState.d.ts +18 -0
- package/dist/types/src/hooks/useNavTreeState.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +3 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/expose.d.ts +5 -0
- package/dist/types/src/operations/expose.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/testing/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/testing/generator.d.ts +3 -3
- package/dist/types/src/testing/generator.d.ts.map +1 -1
- package/dist/types/src/testing/update-state.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +8 -11
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +1 -2
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/src/types/events.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +7 -3
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +62 -43
- package/src/NavTreePlugin.node.ts +17 -0
- package/src/NavTreePlugin.test.ts +27 -0
- package/src/NavTreePlugin.tsx +8 -25
- package/src/capabilities/{app-graph-builder/app-graph-builder.ts → app-graph-builder.ts} +7 -7
- package/src/capabilities/index.ts +11 -5
- package/src/capabilities/{keyboard/keyboard.ts → keyboard.ts} +2 -2
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +9 -11
- package/src/capabilities/{state/state.ts → state.ts} +41 -14
- package/src/components/NavTree/NavTree.stories.tsx +26 -24
- package/src/components/NavTree/NavTree.tsx +64 -22
- package/src/components/{NavTreeContext.tsx → NavTreeContext/NavTreeContext.tsx} +1 -1
- package/src/components/NavTreeContext/index.ts +5 -0
- package/src/components/NavTreeItem/NavTreeItemAction.stories.tsx +7 -9
- package/src/components/NavTreeItem/NavTreeItemAction.tsx +56 -40
- package/src/components/NavTreeItem/NavTreeItemColumns.tsx +43 -17
- package/src/components/Sidebar/L0Menu.tsx +104 -110
- package/src/components/Sidebar/L1Panel.tsx +163 -142
- package/src/components/Sidebar/L1Tabs.tsx +13 -4
- package/src/components/UserAccountAvatar/UserAccountAvatar.stories.tsx +1 -2
- package/src/components/UserAccountAvatar/UserAccountAvatar.tsx +1 -1
- package/src/components/index.ts +0 -3
- package/src/components/types.ts +11 -17
- package/src/containers/CommandsDialogContent/CommandsDialogContent.stories.tsx +46 -0
- package/src/{components/CommandsDialog/CommandsDialog.tsx → containers/CommandsDialogContent/CommandsDialogContent.tsx} +52 -53
- package/src/containers/CommandsDialogContent/index.ts +5 -0
- package/src/{components/CommandsDialog → containers/CommandsTrigger}/CommandsTrigger.tsx +8 -6
- package/src/containers/CommandsTrigger/index.ts +5 -0
- package/src/{components → containers/NavTreeContainer}/NavTreeContainer.tsx +78 -145
- package/src/containers/NavTreeContainer/index.ts +6 -0
- package/src/{components → containers/NavTreeDocumentTitle}/NavTreeDocumentTitle.tsx +2 -2
- package/src/containers/NavTreeDocumentTitle/index.ts +5 -0
- package/src/containers/index.ts +12 -0
- package/src/experimental/Tree.stories.tsx +64 -61
- package/src/experimental/Tree.tsx +3 -3
- package/src/hooks/index.ts +8 -0
- package/src/hooks/useActions.ts +34 -0
- package/src/hooks/useLoadDescendents.ts +23 -0
- package/src/hooks/useNavTreeModel.ts +118 -0
- package/src/hooks/useNavTreeState.ts +35 -0
- package/src/index.ts +8 -2
- package/src/meta.ts +3 -2
- package/src/operations/expose.ts +42 -0
- package/src/operations/index.ts +7 -0
- package/src/testing/app-graph-builder.ts +40 -36
- package/src/testing/generator.ts +25 -25
- package/src/translations.ts +8 -10
- package/src/types/capabilities.ts +4 -4
- package/src/types/events.ts +2 -2
- package/src/util.ts +19 -5
- package/dist/lib/browser/app-graph-builder-XGA4GPGL.mjs +0 -44
- package/dist/lib/browser/app-graph-builder-XGA4GPGL.mjs.map +0 -7
- package/dist/lib/browser/chunk-63YLDLLE.mjs +0 -1373
- package/dist/lib/browser/chunk-63YLDLLE.mjs.map +0 -7
- package/dist/lib/browser/chunk-X2HDG62A.mjs +0 -23
- package/dist/lib/browser/chunk-X2HDG62A.mjs.map +0 -7
- package/dist/lib/browser/chunk-YKTYPINZ.mjs +0 -19
- package/dist/lib/browser/chunk-YKTYPINZ.mjs.map +0 -7
- package/dist/lib/browser/keyboard-46XQHY2O.mjs +0 -53
- package/dist/lib/browser/keyboard-46XQHY2O.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-NNNDII45.mjs +0 -53
- package/dist/lib/browser/operation-resolver-NNNDII45.mjs.map +0 -7
- package/dist/lib/browser/react-surface-APSEG23H.mjs +0 -59
- package/dist/lib/browser/react-surface-APSEG23H.mjs.map +0 -7
- package/dist/lib/browser/state-M5YUCIQU.mjs +0 -121
- package/dist/lib/browser/state-M5YUCIQU.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +0 -6
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/keyboard/index.d.ts +0 -3
- package/dist/types/src/capabilities/keyboard/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/keyboard/keyboard.d.ts +0 -5
- package/dist/types/src/capabilities/keyboard/keyboard.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/index.d.ts +0 -3
- package/dist/types/src/capabilities/state/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/state.d.ts +0 -6
- package/dist/types/src/capabilities/state/state.d.ts.map +0 -1
- 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/NavTreeContainer.d.ts +0 -16
- package/dist/types/src/components/NavTreeContainer.d.ts.map +0 -1
- package/dist/types/src/components/NavTreeContext.d.ts.map +0 -1
- package/dist/types/src/components/NavTreeDocumentTitle.d.ts.map +0 -1
- package/dist/types/src/hooks.d.ts +0 -34
- package/dist/types/src/hooks.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder/index.ts +0 -7
- package/src/capabilities/keyboard/index.ts +0 -7
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -42
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/state/index.ts +0 -7
- package/src/components/CommandsDialog/index.ts +0 -6
- package/src/hooks.ts +0 -73
- /package/dist/types/src/{components/CommandsDialog → containers/CommandsTrigger}/CommandsTrigger.d.ts +0 -0
- /package/dist/types/src/{components → containers/NavTreeDocumentTitle}/NavTreeDocumentTitle.d.ts +0 -0
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
NavTreeCapabilities
|
|
3
|
-
} from "./chunk-X2HDG62A.mjs";
|
|
4
|
-
import {
|
|
5
|
-
meta
|
|
6
|
-
} from "./chunk-YKTYPINZ.mjs";
|
|
7
|
-
|
|
8
|
-
// src/capabilities/state/state.ts
|
|
9
|
-
import { Atom } from "@effect-atom/atom-react";
|
|
10
|
-
import * as Effect from "effect/Effect";
|
|
11
|
-
import { Capabilities, Capability } from "@dxos/app-framework";
|
|
12
|
-
import { AppCapabilities } from "@dxos/app-toolkit";
|
|
13
|
-
import { Path } from "@dxos/react-ui-list";
|
|
14
|
-
var KEY = `${meta.id}/state/v1`;
|
|
15
|
-
var defaultItemState = {
|
|
16
|
-
open: false,
|
|
17
|
-
current: false,
|
|
18
|
-
alternateTree: false
|
|
19
|
-
};
|
|
20
|
-
var defaultStateEntries = [
|
|
21
|
-
[
|
|
22
|
-
"root",
|
|
23
|
-
{
|
|
24
|
-
open: true,
|
|
25
|
-
current: false
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
|
-
[
|
|
29
|
-
"root~dxos.org/plugin/space-spaces",
|
|
30
|
-
{
|
|
31
|
-
open: true,
|
|
32
|
-
current: false
|
|
33
|
-
}
|
|
34
|
-
],
|
|
35
|
-
[
|
|
36
|
-
"root~dxos.org/plugin/files",
|
|
37
|
-
{
|
|
38
|
-
open: true,
|
|
39
|
-
current: false
|
|
40
|
-
}
|
|
41
|
-
]
|
|
42
|
-
];
|
|
43
|
-
var getInitialState = () => {
|
|
44
|
-
const stringified = localStorage.getItem(KEY);
|
|
45
|
-
if (!stringified) {
|
|
46
|
-
return new Map(defaultStateEntries);
|
|
47
|
-
}
|
|
48
|
-
try {
|
|
49
|
-
const cached = JSON.parse(stringified);
|
|
50
|
-
return new Map(cached.map(([key, value]) => [
|
|
51
|
-
key,
|
|
52
|
-
{
|
|
53
|
-
open: value.open,
|
|
54
|
-
current: false
|
|
55
|
-
}
|
|
56
|
-
]));
|
|
57
|
-
} catch {
|
|
58
|
-
return new Map(defaultStateEntries);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
var state_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
62
|
-
const registry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
63
|
-
const layoutAtom = yield* Capability.get(AppCapabilities.Layout);
|
|
64
|
-
const backingState = getInitialState();
|
|
65
|
-
const itemAtomFamily = Atom.family((pathString) => Atom.make(backingState.get(pathString) ?? {
|
|
66
|
-
...defaultItemState
|
|
67
|
-
}).pipe(Atom.keepAlive));
|
|
68
|
-
const getItemAtom = (path) => {
|
|
69
|
-
const pathString = Path.create(...path);
|
|
70
|
-
return itemAtomFamily(pathString);
|
|
71
|
-
};
|
|
72
|
-
const getItem = (path) => {
|
|
73
|
-
return registry.get(getItemAtom(path));
|
|
74
|
-
};
|
|
75
|
-
const setItem = (path, key, next) => {
|
|
76
|
-
const pathString = Path.create(...path);
|
|
77
|
-
const atom = itemAtomFamily(pathString);
|
|
78
|
-
const currentValue = registry.get(atom);
|
|
79
|
-
const newValue = {
|
|
80
|
-
...currentValue,
|
|
81
|
-
[key]: next
|
|
82
|
-
};
|
|
83
|
-
registry.set(atom, newValue);
|
|
84
|
-
backingState.set(pathString, newValue);
|
|
85
|
-
localStorage.setItem(KEY, JSON.stringify(Array.from(backingState.entries())));
|
|
86
|
-
};
|
|
87
|
-
let previous = [];
|
|
88
|
-
const unsubscribe = registry.subscribe(layoutAtom, (layout) => {
|
|
89
|
-
const removed = previous.filter((id) => !layout.active.includes(id));
|
|
90
|
-
previous = layout.active;
|
|
91
|
-
const handleUpdate = () => {
|
|
92
|
-
removed.forEach((id) => {
|
|
93
|
-
const keys = Array.from(backingState.keys()).filter((key) => Path.last(key) === id);
|
|
94
|
-
keys.forEach((key) => {
|
|
95
|
-
setItem(Path.parts(key), "current", false);
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
layout.active.forEach((id) => {
|
|
99
|
-
const keys = Array.from(/* @__PURE__ */ new Set([
|
|
100
|
-
...backingState.keys(),
|
|
101
|
-
id
|
|
102
|
-
])).filter((key) => Path.last(key) === id);
|
|
103
|
-
keys.forEach((key) => {
|
|
104
|
-
setItem(Path.parts(key), "current", true);
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
};
|
|
108
|
-
const timeout = setTimeout(handleUpdate, 500);
|
|
109
|
-
handleUpdate();
|
|
110
|
-
return () => clearTimeout(timeout);
|
|
111
|
-
});
|
|
112
|
-
return Capability.contributes(NavTreeCapabilities.State, {
|
|
113
|
-
getItem,
|
|
114
|
-
getItemAtom,
|
|
115
|
-
setItem
|
|
116
|
-
}, () => Effect.sync(() => unsubscribe()));
|
|
117
|
-
}));
|
|
118
|
-
export {
|
|
119
|
-
state_default as default
|
|
120
|
-
};
|
|
121
|
-
//# sourceMappingURL=state-M5YUCIQU.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/state/state.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Atom } from '@effect-atom/atom-react';\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { AppCapabilities } from '@dxos/app-toolkit';\nimport { Path } from '@dxos/react-ui-list';\n\nimport { meta } from '../../meta';\nimport { type NavTreeCapabilities as NC, NavTreeCapabilities } from '../../types';\n\nconst KEY = `${meta.id}/state/v1`;\n\n/** Default item state for new entries. */\nconst defaultItemState: NC.NavTreeItemState = { open: false, current: false, alternateTree: false };\n\n/** Default state entries for initial tree structure. */\n// TODO(thure): Initialize these dynamically.\nconst defaultStateEntries: [string, NC.NavTreeItemState][] = [\n ['root', { open: true, current: false }],\n ['root~dxos.org/plugin/space-spaces', { open: true, current: false }],\n ['root~dxos.org/plugin/files', { open: true, current: false }],\n];\n\nconst getInitialState = (): Map<string, NC.NavTreeItemState> => {\n const stringified = localStorage.getItem(KEY);\n if (!stringified) {\n return new Map(defaultStateEntries);\n }\n\n try {\n const cached: [string, { open: boolean; current: boolean }][] = JSON.parse(stringified);\n return new Map(cached.map(([key, value]) => [key, { open: value.open, current: false }]));\n } catch {\n return new Map(defaultStateEntries);\n }\n};\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const registry = yield* Capability.get(Capabilities.AtomRegistry);\n const layoutAtom = yield* Capability.get(AppCapabilities.Layout);\n\n // Backing state for persistence (not reactive).\n const backingState = getInitialState();\n\n // Per-path atom family for fine-grained reactivity.\n // keepAlive prevents atoms from being garbage collected when components unmount,\n // ensuring state is preserved across deletion/restoration cycles.\n const itemAtomFamily = Atom.family((pathString: string) =>\n Atom.make<NC.NavTreeItemState>(backingState.get(pathString) ?? { ...defaultItemState }).pipe(Atom.keepAlive),\n );\n\n const getItemAtom = (path: string[]): Atom.Atom<NC.NavTreeItemState> => {\n const pathString = Path.create(...path);\n return itemAtomFamily(pathString);\n };\n\n const getItem = (path: string[]): NC.NavTreeItemState => {\n return registry.get(getItemAtom(path));\n };\n\n const setItem = (path: string[], key: 'open' | 'current' | 'alternateTree', next: boolean) => {\n const pathString = Path.create(...path);\n const atom = itemAtomFamily(pathString);\n const currentValue = registry.get(atom);\n const newValue = { ...currentValue, [key]: next };\n\n // Update the atom.\n registry.set(atom, newValue);\n\n // Update backing state and persist to localStorage.\n backingState.set(pathString, newValue);\n localStorage.setItem(KEY, JSON.stringify(Array.from(backingState.entries())));\n };\n\n // Subscribe to layout changes to update current state.\n let previous: string[] = [];\n const unsubscribe = registry.subscribe(layoutAtom, (layout) => {\n const removed = previous.filter((id) => !layout.active.includes(id));\n previous = layout.active;\n\n const handleUpdate = () => {\n // Mark removed items as not current.\n removed.forEach((id) => {\n const keys = Array.from(backingState.keys()).filter((key) => Path.last(key) === id);\n keys.forEach((key) => {\n setItem(Path.parts(key), 'current', false);\n });\n });\n\n // Mark active items as current.\n layout.active.forEach((id: string) => {\n const keys = Array.from(new Set([...backingState.keys(), id])).filter((key) => Path.last(key) === id);\n keys.forEach((key) => {\n setItem(Path.parts(key), 'current', true);\n });\n });\n };\n\n // TODO(wittjosiah): This is setTimeout because there's a race between the keys being initialized.\n // Keys are initialized on the first render of an item in the navtree.\n // This could be avoided if the location was a path as well and not just an id.\n const timeout = setTimeout(handleUpdate, 500);\n handleUpdate();\n return () => clearTimeout(timeout);\n });\n\n return Capability.contributes(\n NavTreeCapabilities.State,\n {\n getItem,\n getItemAtom,\n setItem,\n },\n () => Effect.sync(() => unsubscribe()),\n );\n }),\n);\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": ["Atom", "Effect", "Capabilities", "Capability", "AppCapabilities", "Path", "KEY", "meta", "id", "defaultItemState", "open", "current", "alternateTree", "defaultStateEntries", "getInitialState", "stringified", "localStorage", "getItem", "Map", "cached", "JSON", "parse", "map", "key", "value", "Capability", "makeModule", "fnUntraced", "registry", "get", "Capabilities", "AtomRegistry", "layoutAtom", "AppCapabilities", "Layout", "backingState", "itemAtomFamily", "Atom", "family", "pathString", "make", "pipe", "keepAlive", "getItemAtom", "path", "Path", "create", "setItem", "next", "atom", "currentValue", "newValue", "set", "stringify", "Array", "from", "entries", "previous", "unsubscribe", "subscribe", "layout", "removed", "filter", "active", "includes", "handleUpdate", "forEach", "keys", "last", "parts", "Set", "timeout", "setTimeout", "clearTimeout", "contributes", "NavTreeCapabilities", "State", "sync"]
|
|
7
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as Effect from 'effect/Effect';
|
|
2
|
-
import { Capability } from '@dxos/app-framework';
|
|
3
|
-
import { GraphBuilder } from '@dxos/plugin-graph';
|
|
4
|
-
declare const _default: (props?: void | undefined) => Effect.Effect<Capability.Capability<Capability.InterfaceDef<GraphBuilder.BuilderExtensions>>, never, never>;
|
|
5
|
-
export default _default;
|
|
6
|
-
//# sourceMappingURL=app-graph-builder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"app-graph-builder.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/app-graph-builder/app-graph-builder.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD,OAAO,EAAE,YAAY,EAAe,MAAM,oBAAoB,CAAC;;AAI/D,wBA4BE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/app-graph-builder/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,eAAe,qIAA0E,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/keyboard/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,QAAQ,8FAA0D,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as Effect from 'effect/Effect';
|
|
2
|
-
import { Capability } from '@dxos/app-framework';
|
|
3
|
-
declare const _default: (props?: void | undefined) => Effect.Effect<Capability.Capability<Capability.InterfaceDef<null>>, Error, Capability.Service>;
|
|
4
|
-
export default _default;
|
|
5
|
-
//# sourceMappingURL=keyboard.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/keyboard/keyboard.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAgB,UAAU,EAAE,MAAM,qBAAqB,CAAC;;AAS/D,wBAkDE"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { Capability } from '@dxos/app-framework';
|
|
2
|
-
export declare const OperationResolver: Capability.LazyCapability<void, Capability.Capability<Capability.InterfaceDef<import("@dxos/app-framework/Capabilities").OperationResolver[]>>, Error>;
|
|
3
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/operation-resolver/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,iBAAiB,wJAA6E,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as Effect from 'effect/Effect';
|
|
2
|
-
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
3
|
-
declare const _default: (props?: void | undefined) => Effect.Effect<Capability.Capability<Capability.InterfaceDef<Capabilities.OperationResolver[]>>, never, never>;
|
|
4
|
-
export default _default;
|
|
5
|
-
//# sourceMappingURL=operation-resolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operation-resolver.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/operation-resolver/operation-resolver.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;;AAQ/D,wBA2BE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/react-surface/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,YAAY,iJAAmE,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as Effect from 'effect/Effect';
|
|
2
|
-
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
3
|
-
declare const _default: (props?: void | undefined) => Effect.Effect<Capability.Capability<Capability.InterfaceDef<Capabilities.ReactSurface>>, never, never>;
|
|
4
|
-
export default _default;
|
|
5
|
-
//# sourceMappingURL=react-surface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react-surface.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/react-surface/react-surface.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;;AAO/D,wBAwCE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/state/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,eAAO,MAAM,KAAK,+IAAoD,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as Effect from 'effect/Effect';
|
|
2
|
-
import { Capability } from '@dxos/app-framework';
|
|
3
|
-
import { type NavTreeCapabilities as NC } from '../../types';
|
|
4
|
-
declare const _default: (props?: void | undefined) => Effect.Effect<Capability.Capability<Capability.InterfaceDef<NC.NavTreeStateStore>>, Error, Capability.Service>;
|
|
5
|
-
export default _default;
|
|
6
|
-
//# sourceMappingURL=state.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../../src/capabilities/state/state.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAgB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAK/D,OAAO,EAAE,KAAK,mBAAmB,IAAI,EAAE,EAAuB,MAAM,aAAa,CAAC;;AA6BlF,wBAgFE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CommandsDialog.d.ts","sourceRoot":"","sources":["../../../../../src/components/CommandsDialog/CommandsDialog.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAe7D,MAAM,MAAM,0BAA0B,GAAG;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAGF,eAAO,MAAM,qBAAqB,mGAuGjC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CommandsTrigger.d.ts","sourceRoot":"","sources":["../../../../../src/components/CommandsDialog/CommandsTrigger.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,eAAO,MAAM,eAAe,yBAY3B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/CommandsDialog/index.ts"],"names":[],"mappings":"AAIA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type NavTreeContextValue } from './types';
|
|
3
|
-
export declare const NODE_TYPE = "dxos/app-graph/node";
|
|
4
|
-
export type NavTreeContainerProps = {
|
|
5
|
-
popoverAnchorId?: string;
|
|
6
|
-
topbar?: boolean;
|
|
7
|
-
} & Pick<NavTreeContextValue, 'tab'>;
|
|
8
|
-
export declare const NavTreeContainer$: React.ForwardRefExoticComponent<{
|
|
9
|
-
popoverAnchorId?: string;
|
|
10
|
-
topbar?: boolean;
|
|
11
|
-
} & Pick<NavTreeContextValue, "tab"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
-
export declare const NavTreeContainer: React.NamedExoticComponent<{
|
|
13
|
-
popoverAnchorId?: string;
|
|
14
|
-
topbar?: boolean;
|
|
15
|
-
} & Pick<NavTreeContextValue, "tab"> & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
-
//# sourceMappingURL=NavTreeContainer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NavTreeContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/NavTreeContainer.tsx"],"names":[],"mappings":"AAMA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAoBjF,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAGnD,eAAO,MAAM,SAAS,wBAAwB,CAAC;AA0D/C,MAAM,MAAM,qBAAqB,GAAG;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,GAAG,IAAI,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;AAErC,eAAO,MAAM,iBAAiB;sBAJV,MAAM;aACf,OAAO;2EAsPjB,CAAC;AAEF,eAAO,MAAM,gBAAgB;sBAzPT,MAAM;aACf,OAAO;2EAwPqC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NavTreeContext.d.ts","sourceRoot":"","sources":["../../../../src/components/NavTreeContext.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,eAAO,MAAM,cAAc,qDAAkD,CAAC;AAE9E,eAAO,MAAM,iBAAiB,2BAAiF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NavTreeDocumentTitle.d.ts","sourceRoot":"","sources":["../../../../src/components/NavTreeDocumentTitle.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAM5C,eAAO,MAAM,oBAAoB,GAAI,UAAU;IAAE,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAA;CAAE,SAMlE,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { type Atom } from '@effect-atom/atom-react';
|
|
2
|
-
import { type Node } from '@dxos/app-graph';
|
|
3
|
-
import { NavTreeCapabilities } from './types';
|
|
4
|
-
export declare const useLoadDescendents: (root?: Node.Node) => void;
|
|
5
|
-
export type UseNavTreeStateResult = {
|
|
6
|
-
getItem: (path: string[]) => NavTreeCapabilities.NavTreeItemState;
|
|
7
|
-
getItemAtom: (path: string[]) => Atom.Atom<NavTreeCapabilities.NavTreeItemState>;
|
|
8
|
-
setItem: (path: string[], key: 'open' | 'current' | 'alternateTree', next: boolean) => void;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Hook that provides access to navtree state functions.
|
|
12
|
-
* For reactive subscriptions, use `useNavTreeItemState` or `useAtomValue(getItemAtom(path))`.
|
|
13
|
-
*/
|
|
14
|
-
export declare const useNavTreeState: () => UseNavTreeStateResult;
|
|
15
|
-
/**
|
|
16
|
-
* Hook that subscribes to a single navtree item's state.
|
|
17
|
-
* Use this for fine-grained reactivity.
|
|
18
|
-
*/
|
|
19
|
-
export declare const useNavTreeItemState: (path: string[]) => NavTreeCapabilities.NavTreeItemState;
|
|
20
|
-
/**
|
|
21
|
-
* Hook that subscribes to the open state for a tree item.
|
|
22
|
-
* Designed to be passed to Tree component as useIsOpen prop.
|
|
23
|
-
*/
|
|
24
|
-
export declare const useIsOpen: (path: string[], _item?: any) => boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Hook that subscribes to the current state for a tree item.
|
|
27
|
-
* Designed to be passed to Tree component as useIsCurrent prop.
|
|
28
|
-
*/
|
|
29
|
-
export declare const useIsCurrent: (path: string[], _item?: any) => boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Hook that subscribes to the alternateTree state for a tree item.
|
|
32
|
-
*/
|
|
33
|
-
export declare const useIsAlternateTree: (path: string[], _item?: any) => boolean;
|
|
34
|
-
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/hooks.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,IAAI,EAAgB,MAAM,yBAAyB,CAAC;AAIlE,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAG5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,eAAO,MAAM,kBAAkB,GAAI,OAAO,IAAI,CAAC,IAAI,SAUlD,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,mBAAmB,CAAC,gBAAgB,CAAC;IAClE,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IACjF,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,eAAe,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAC7F,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAO,qBAElC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,EAAE,KAAG,mBAAmB,CAAC,gBAMxE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,EAAE,QAAQ,GAAG,KAAG,OAEvD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,EAAE,EAAE,QAAQ,GAAG,KAAG,OAE1D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,EAAE,QAAQ,GAAG,KAAG,OAEhE,CAAC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
|
|
7
|
-
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
-
import { AppCapabilities, LayoutOperation } from '@dxos/app-toolkit';
|
|
9
|
-
import { log } from '@dxos/log';
|
|
10
|
-
import { OperationResolver } from '@dxos/operation';
|
|
11
|
-
import { Graph } from '@dxos/plugin-graph';
|
|
12
|
-
|
|
13
|
-
import { NavTreeCapabilities } from '../../types';
|
|
14
|
-
|
|
15
|
-
export default Capability.makeModule(
|
|
16
|
-
Effect.fnUntraced(function* () {
|
|
17
|
-
return Capability.contributes(Capabilities.OperationResolver, [
|
|
18
|
-
OperationResolver.make({
|
|
19
|
-
operation: LayoutOperation.Expose,
|
|
20
|
-
handler: Effect.fnUntraced(function* ({ subject }) {
|
|
21
|
-
const { graph } = yield* Capability.get(AppCapabilities.AppGraph);
|
|
22
|
-
const { getItem, setItem } = yield* Capability.get(NavTreeCapabilities.State);
|
|
23
|
-
yield* Effect.tryPromise(() => Graph.waitForPath(graph, { target: subject }, { timeout: 1_000 })).pipe(
|
|
24
|
-
Effect.andThen((path) => {
|
|
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
|
-
}),
|
|
33
|
-
Effect.catchAll(() => {
|
|
34
|
-
log('Path to node not found', { subject });
|
|
35
|
-
return Effect.void;
|
|
36
|
-
}),
|
|
37
|
-
);
|
|
38
|
-
}),
|
|
39
|
-
}),
|
|
40
|
-
]);
|
|
41
|
-
}),
|
|
42
|
-
);
|
package/src/hooks.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Atom, useAtomValue } from '@effect-atom/atom-react';
|
|
6
|
-
import { useEffect, useMemo } from 'react';
|
|
7
|
-
|
|
8
|
-
import { useCapability } from '@dxos/app-framework/ui';
|
|
9
|
-
import { type Node } from '@dxos/app-graph';
|
|
10
|
-
|
|
11
|
-
import { useNavTreeContext } from './components';
|
|
12
|
-
import { NavTreeCapabilities } from './types';
|
|
13
|
-
|
|
14
|
-
export const useLoadDescendents = (root?: Node.Node) => {
|
|
15
|
-
const { loadDescendents } = useNavTreeContext();
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
const frame = requestAnimationFrame(() => {
|
|
18
|
-
if (root) {
|
|
19
|
-
void loadDescendents?.(root);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
return () => cancelAnimationFrame(frame);
|
|
23
|
-
}, [root]);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export type UseNavTreeStateResult = {
|
|
27
|
-
getItem: (path: string[]) => NavTreeCapabilities.NavTreeItemState;
|
|
28
|
-
getItemAtom: (path: string[]) => Atom.Atom<NavTreeCapabilities.NavTreeItemState>;
|
|
29
|
-
setItem: (path: string[], key: 'open' | 'current' | 'alternateTree', next: boolean) => void;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Hook that provides access to navtree state functions.
|
|
34
|
-
* For reactive subscriptions, use `useNavTreeItemState` or `useAtomValue(getItemAtom(path))`.
|
|
35
|
-
*/
|
|
36
|
-
export const useNavTreeState = (): UseNavTreeStateResult => {
|
|
37
|
-
return useCapability(NavTreeCapabilities.State);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Hook that subscribes to a single navtree item's state.
|
|
42
|
-
* Use this for fine-grained reactivity.
|
|
43
|
-
*/
|
|
44
|
-
export const useNavTreeItemState = (path: string[]): NavTreeCapabilities.NavTreeItemState => {
|
|
45
|
-
const { getItemAtom } = useCapability(NavTreeCapabilities.State);
|
|
46
|
-
// Memoize the path to avoid creating new atoms on every render.
|
|
47
|
-
const pathKey = useMemo(() => path.join('~'), [path]);
|
|
48
|
-
const atom = useMemo(() => getItemAtom(path), [getItemAtom, pathKey]);
|
|
49
|
-
return useAtomValue(atom);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Hook that subscribes to the open state for a tree item.
|
|
54
|
-
* Designed to be passed to Tree component as useIsOpen prop.
|
|
55
|
-
*/
|
|
56
|
-
export const useIsOpen = (path: string[], _item?: any): boolean => {
|
|
57
|
-
return useNavTreeItemState(path).open;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Hook that subscribes to the current state for a tree item.
|
|
62
|
-
* Designed to be passed to Tree component as useIsCurrent prop.
|
|
63
|
-
*/
|
|
64
|
-
export const useIsCurrent = (path: string[], _item?: any): boolean => {
|
|
65
|
-
return useNavTreeItemState(path).current;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Hook that subscribes to the alternateTree state for a tree item.
|
|
70
|
-
*/
|
|
71
|
-
export const useIsAlternateTree = (path: string[], _item?: any): boolean => {
|
|
72
|
-
return useNavTreeItemState(path).alternateTree ?? false;
|
|
73
|
-
};
|
|
File without changes
|
/package/dist/types/src/{components → containers/NavTreeDocumentTitle}/NavTreeDocumentTitle.d.ts
RENAMED
|
File without changes
|