@dxos/plugin-navtree 0.8.4-main.f9ba587 → 0.8.4-main.fcfe5033a5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/index.mjs +168 -115
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- 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.d.ts +4 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +7 -105
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/keyboard.d.ts +3 -2
- package/dist/types/src/capabilities/keyboard.d.ts.map +1 -1
- 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 +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +4 -18
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/components/NavTree/NavTree.d.ts +12 -5
- package/dist/types/src/components/NavTree/NavTree.d.ts.map +1 -1
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts +26 -5
- 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 +13 -9
- 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 +10 -5
- package/dist/types/src/components/Sidebar/L0Menu.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L1Panel.d.ts +4 -8
- package/dist/types/src/components/Sidebar/L1Panel.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L1Tabs.d.ts +13 -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 +1 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/types.d.ts +8 -16
- package/dist/types/src/components/types.d.ts.map +1 -1
- package/dist/types/src/containers/CommandsDialogContent/CommandsDialogContent.d.ts +6 -0
- package/dist/types/src/containers/CommandsDialogContent/CommandsDialogContent.d.ts.map +1 -0
- package/dist/types/src/containers/CommandsDialogContent/CommandsDialogContent.stories.d.ts +29 -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/{components → containers/NavTreeDocumentTitle}/NavTreeDocumentTitle.d.ts +1 -1
- 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 +4 -5
- package/dist/types/src/experimental/Tree.d.ts.map +1 -1
- package/dist/types/src/experimental/Tree.stories.d.ts +23 -6
- 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 +22 -0
- package/dist/types/src/hooks/useNavTreeState.d.ts.map +1 -0
- 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/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 +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 +9 -9
- 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 +12 -9
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +67 -56
- package/src/NavTreePlugin.tsx +66 -85
- package/src/capabilities/app-graph-builder.ts +34 -44
- package/src/capabilities/index.ts +10 -8
- package/src/capabilities/keyboard.ts +58 -51
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +46 -38
- package/src/capabilities/state.ts +129 -84
- package/src/components/NavTree/NavTree.stories.tsx +110 -102
- package/src/components/NavTree/NavTree.tsx +71 -35
- 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 +25 -19
- package/src/components/NavTreeItem/NavTreeItemAction.tsx +73 -49
- package/src/components/NavTreeItem/NavTreeItemColumns.tsx +70 -38
- package/src/components/Sidebar/L0Menu.tsx +176 -210
- package/src/components/Sidebar/L1Panel.tsx +271 -135
- package/src/components/Sidebar/L1Tabs.tsx +42 -0
- package/src/components/Sidebar/index.ts +1 -0
- package/src/components/UserAccountAvatar/UserAccountAvatar.stories.tsx +9 -9
- package/src/components/UserAccountAvatar/UserAccountAvatar.tsx +20 -12
- package/src/components/index.ts +2 -4
- package/src/components/types.ts +15 -19
- package/src/containers/CommandsDialogContent/CommandsDialogContent.stories.tsx +45 -0
- package/src/containers/CommandsDialogContent/CommandsDialogContent.tsx +127 -0
- package/src/containers/CommandsDialogContent/index.ts +5 -0
- package/src/containers/CommandsTrigger/CommandsTrigger.tsx +28 -0
- package/src/containers/CommandsTrigger/index.ts +5 -0
- package/src/containers/NavTreeContainer/NavTreeContainer.tsx +280 -0
- package/src/containers/NavTreeContainer/index.ts +6 -0
- package/src/{components → containers/NavTreeDocumentTitle}/NavTreeDocumentTitle.tsx +5 -4
- package/src/containers/NavTreeDocumentTitle/index.ts +5 -0
- package/src/containers/index.ts +12 -0
- package/src/experimental/Tree.stories.tsx +110 -115
- package/src/experimental/Tree.tsx +16 -34
- 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 +42 -0
- package/src/index.ts +1 -2
- package/src/meta.ts +11 -8
- package/src/operations/expose.ts +42 -0
- package/src/operations/index.ts +7 -0
- package/src/testing/app-graph-builder.ts +167 -238
- package/src/testing/generator.ts +41 -39
- package/src/testing/update-state.ts +6 -6
- package/src/translations.ts +9 -9
- package/src/types/capabilities.ts +21 -0
- package/src/types/events.ts +12 -0
- package/src/types/index.ts +7 -0
- package/src/{types.ts → types/schema.ts} +9 -8
- package/src/util.ts +26 -33
- 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-TZA65AKW.mjs +0 -1428
- package/dist/lib/browser/chunk-TZA65AKW.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 +0 -51
- package/dist/lib/browser/keyboard-QRS6WOQH.mjs.map +0 -7
- package/dist/lib/browser/react-surface-N2HPMYCU.mjs +0 -51
- package/dist/lib/browser/react-surface-N2HPMYCU.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/lib/node-esm/app-graph-builder-GY7GCTGU.mjs +0 -46
- package/dist/lib/node-esm/app-graph-builder-GY7GCTGU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CY7QWR4R.mjs +0 -1429
- package/dist/lib/node-esm/chunk-CY7QWR4R.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-P2JGW3WR.mjs +0 -18
- package/dist/lib/node-esm/chunk-P2JGW3WR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-V3QXFDDP.mjs +0 -16
- package/dist/lib/node-esm/chunk-V3QXFDDP.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -150
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-R7UNPSZY.mjs +0 -48
- package/dist/lib/node-esm/intent-resolver-R7UNPSZY.mjs.map +0 -7
- package/dist/lib/node-esm/keyboard-MOZWHFUM.mjs +0 -52
- package/dist/lib/node-esm/keyboard-MOZWHFUM.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-EW5FDMW4.mjs +0 -52
- package/dist/lib/node-esm/react-surface-EW5FDMW4.mjs.map +0 -7
- package/dist/lib/node-esm/state-Z3OTRC2I.mjs +0 -118
- package/dist/lib/node-esm/state-Z3OTRC2I.mjs.map +0 -7
- 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/components/CommandsDialog/CommandsDialog.d.ts +0 -5
- 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 -9
- 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/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/hooks.d.ts +0 -3
- package/dist/types/src/hooks.d.ts.map +0 -1
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/capabilities/capabilities.ts +0 -20
- package/src/capabilities/intent-resolver.ts +0 -37
- package/src/components/CommandsDialog/CommandsDialog.tsx +0 -118
- package/src/components/CommandsDialog/CommandsTrigger.tsx +0 -37
- package/src/components/CommandsDialog/index.ts +0 -6
- package/src/components/NavTreeContainer.tsx +0 -314
- package/src/events.ts +0 -11
- package/src/hooks.ts +0 -21
- /package/dist/types/src/{components/CommandsDialog → containers/CommandsTrigger}/CommandsTrigger.d.ts +0 -0
package/src/meta.ts
CHANGED
|
@@ -2,16 +2,19 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
6
7
|
|
|
7
|
-
export const
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
|
+
id: 'org.dxos.plugin.navtree',
|
|
10
|
+
name: 'Navtree',
|
|
11
|
+
description: trim`
|
|
12
|
+
Hierarchical navigation tree for browsing spaces, folders, and objects.
|
|
13
|
+
Provides sidebar navigation with collapsible sections and quick access to workspace content.
|
|
14
|
+
`,
|
|
15
|
+
};
|
|
8
16
|
|
|
9
17
|
// TODO(wittjosiah): Factor out.
|
|
10
18
|
export const KEY_BINDING = 'KeyBinding';
|
|
11
19
|
// TODO(wittjosiah): Factor out.
|
|
12
|
-
export const COMMANDS_DIALOG = `${
|
|
13
|
-
|
|
14
|
-
export const meta: PluginMeta = {
|
|
15
|
-
id: NAVTREE_PLUGIN,
|
|
16
|
-
name: 'Navtree',
|
|
17
|
-
};
|
|
20
|
+
export const COMMANDS_DIALOG = `${meta.id}.commands-dialog`;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Option from 'effect/Option';
|
|
7
|
+
|
|
8
|
+
import { Capability } from '@dxos/app-framework';
|
|
9
|
+
import { AppCapabilities, LayoutOperation } from '@dxos/app-toolkit';
|
|
10
|
+
import { log } from '@dxos/log';
|
|
11
|
+
import { Operation } from '@dxos/operation';
|
|
12
|
+
import { Graph } from '@dxos/plugin-graph';
|
|
13
|
+
import { expandAttendableId } from '@dxos/react-ui-attention';
|
|
14
|
+
|
|
15
|
+
import { NavTreeCapabilities } from '../types';
|
|
16
|
+
|
|
17
|
+
const handler: Operation.WithHandler<typeof LayoutOperation.Expose> = LayoutOperation.Expose.pipe(
|
|
18
|
+
Operation.withHandler(
|
|
19
|
+
Effect.fnUntraced(function* ({ subject }) {
|
|
20
|
+
const { graph } = yield* Capability.get(AppCapabilities.AppGraph);
|
|
21
|
+
const { getItem, setItem } = yield* Capability.get(NavTreeCapabilities.State);
|
|
22
|
+
|
|
23
|
+
const prefixes = expandAttendableId(subject);
|
|
24
|
+
|
|
25
|
+
for (const qualifiedId of prefixes) {
|
|
26
|
+
Graph.expand(graph, qualifiedId, 'child');
|
|
27
|
+
|
|
28
|
+
const treePath = prefixes.slice(0, prefixes.indexOf(qualifiedId) + 1);
|
|
29
|
+
const state = getItem(treePath);
|
|
30
|
+
if (!state.open) {
|
|
31
|
+
setItem(treePath, 'open', true);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (Option.isNone(Graph.getNode(graph, subject))) {
|
|
36
|
+
log('Node not found after expansion', { subject });
|
|
37
|
+
}
|
|
38
|
+
}),
|
|
39
|
+
),
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
export default handler;
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
5
|
+
import { Atom } from '@effect-atom/atom-react';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
7
|
|
|
8
|
-
import { type
|
|
8
|
+
import { type BuilderExtensions } from '@dxos/app-graph';
|
|
9
9
|
import { log } from '@dxos/log';
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { GraphBuilder, Node, NodeMatcher } from '@dxos/plugin-graph';
|
|
11
|
+
import { random } from '@dxos/random';
|
|
12
12
|
|
|
13
|
-
export const storybookGraphBuilders = (
|
|
13
|
+
export const storybookGraphBuilders = (): BuilderExtensions => {
|
|
14
14
|
const propertiesCache = new Map<string, Record<string, unknown>>();
|
|
15
15
|
const getProperties = (id: string, defaults: Record<string, unknown>) => {
|
|
16
16
|
const cached = propertiesCache.get(id);
|
|
@@ -22,249 +22,178 @@ export const storybookGraphBuilders = (context: PluginContext): BuilderExtension
|
|
|
22
22
|
return defaults;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
disposition: 'menu',
|
|
45
|
-
},
|
|
46
|
-
})),
|
|
47
|
-
];
|
|
48
|
-
}),
|
|
49
|
-
Option.getOrElse(() => []),
|
|
25
|
+
return Effect.runSync(
|
|
26
|
+
Effect.all([
|
|
27
|
+
// Create app menu actions.
|
|
28
|
+
GraphBuilder.createExtension({
|
|
29
|
+
id: 'app-menu',
|
|
30
|
+
match: NodeMatcher.whenRoot,
|
|
31
|
+
actions: () =>
|
|
32
|
+
Effect.succeed(
|
|
33
|
+
Array.from({ length: 5 }, (_, i) => ({
|
|
34
|
+
id: `action-${i}`,
|
|
35
|
+
data: Effect.fnUntraced(function* () {
|
|
36
|
+
log.info('action', { id: 'app-menu', index: i });
|
|
37
|
+
}),
|
|
38
|
+
properties: {
|
|
39
|
+
label: `Action ${i}`,
|
|
40
|
+
icon: random.properties.icon(),
|
|
41
|
+
disposition: 'menu',
|
|
42
|
+
},
|
|
43
|
+
})),
|
|
50
44
|
),
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
45
|
+
}),
|
|
46
|
+
// Create user account node.
|
|
47
|
+
GraphBuilder.createExtension({
|
|
48
|
+
id: 'user-account',
|
|
49
|
+
match: NodeMatcher.whenRoot,
|
|
50
|
+
connector: () =>
|
|
51
|
+
Effect.succeed([
|
|
52
|
+
Node.make({
|
|
53
|
+
id: 'user-account',
|
|
54
|
+
type: 'user-account',
|
|
55
|
+
properties: {
|
|
56
|
+
label: 'User profile',
|
|
57
|
+
icon: 'ph--user--regular',
|
|
58
|
+
disposition: 'user-account',
|
|
59
|
+
userId: '1234567890ABCDEF',
|
|
60
|
+
hue: random.properties.hue(),
|
|
61
|
+
emoji: random.properties.emoji(),
|
|
62
|
+
status: 'active',
|
|
63
|
+
},
|
|
64
|
+
nodes: [
|
|
65
|
+
Node.make({
|
|
66
|
+
id: 'profile',
|
|
67
|
+
type: 'profile',
|
|
66
68
|
properties: {
|
|
67
|
-
label: '
|
|
69
|
+
label: 'Profile',
|
|
68
70
|
icon: 'ph--user--regular',
|
|
69
|
-
disposition: 'user-account',
|
|
70
|
-
userId: '1234567890ABCDEF',
|
|
71
|
-
hue: faker.properties.hue(),
|
|
72
|
-
emoji: faker.properties.emoji(),
|
|
73
|
-
status: 'active',
|
|
74
71
|
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
properties: {
|
|
88
|
-
label: 'Devices',
|
|
89
|
-
icon: 'ph--devices--regular',
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
id: 'security',
|
|
94
|
-
type: 'security',
|
|
95
|
-
properties: {
|
|
96
|
-
label: 'Security',
|
|
97
|
-
icon: 'ph--key--regular',
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
],
|
|
101
|
-
},
|
|
102
|
-
];
|
|
103
|
-
}),
|
|
104
|
-
Option.getOrElse(() => []),
|
|
105
|
-
),
|
|
106
|
-
),
|
|
107
|
-
}),
|
|
108
|
-
// TODO(wittjosiah): This group node probably is unnecessary now with the flat L0 structure.
|
|
109
|
-
// Create spaces group node.
|
|
110
|
-
createExtension({
|
|
111
|
-
id: 'spaces-root',
|
|
112
|
-
position: 'hoist',
|
|
113
|
-
connector: (node) =>
|
|
114
|
-
Rx.make((get) =>
|
|
115
|
-
pipe(
|
|
116
|
-
get(node),
|
|
117
|
-
Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),
|
|
118
|
-
Option.map(() => {
|
|
119
|
-
return [
|
|
120
|
-
{
|
|
121
|
-
id: 'spaces-root',
|
|
122
|
-
type: 'spaces-root',
|
|
72
|
+
}),
|
|
73
|
+
Node.make({
|
|
74
|
+
id: 'devices',
|
|
75
|
+
type: 'devices',
|
|
76
|
+
properties: {
|
|
77
|
+
label: 'Devices',
|
|
78
|
+
icon: 'ph--devices--regular',
|
|
79
|
+
},
|
|
80
|
+
}),
|
|
81
|
+
Node.make({
|
|
82
|
+
id: 'security',
|
|
83
|
+
type: 'security',
|
|
123
84
|
properties: {
|
|
124
|
-
label: '
|
|
125
|
-
icon: 'ph--
|
|
126
|
-
role: 'branch',
|
|
127
|
-
disposition: 'collection',
|
|
85
|
+
label: 'Security',
|
|
86
|
+
icon: 'ph--key--regular',
|
|
128
87
|
},
|
|
129
|
-
},
|
|
130
|
-
]
|
|
88
|
+
}),
|
|
89
|
+
],
|
|
131
90
|
}),
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
91
|
+
]),
|
|
92
|
+
}),
|
|
93
|
+
// Create space (workspace) nodes directly under root.
|
|
94
|
+
GraphBuilder.createExtension({
|
|
95
|
+
id: 'spaces',
|
|
96
|
+
match: NodeMatcher.whenRoot,
|
|
97
|
+
connector: (_, get) =>
|
|
98
|
+
Effect.sync(() => {
|
|
99
|
+
const count = Atom.make((get) => {
|
|
100
|
+
let value = 3;
|
|
101
|
+
const interval = setInterval(() => {
|
|
102
|
+
if (value >= 10) {
|
|
103
|
+
clearInterval(interval);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
147
106
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
107
|
+
value++;
|
|
108
|
+
get.setSelf(value);
|
|
109
|
+
}, 5000);
|
|
110
|
+
get.addFinalizer(() => clearInterval(interval));
|
|
111
|
+
return value;
|
|
112
|
+
});
|
|
154
113
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
Option.map((node) => {
|
|
186
|
-
return [
|
|
187
|
-
...Array.from({ length: 5 }, (_, i) => ({
|
|
188
|
-
id: `${node.id}/action-${i}`,
|
|
189
|
-
data: () => {
|
|
190
|
-
log.info('action', { id: node.id, index: i });
|
|
191
|
-
},
|
|
192
|
-
properties: getProperties(`${node.id}/action-${i}`, {
|
|
193
|
-
label: `Action ${i}`,
|
|
194
|
-
icon: faker.properties.icon(),
|
|
195
|
-
}),
|
|
196
|
-
})),
|
|
197
|
-
];
|
|
198
|
-
}),
|
|
199
|
-
Option.getOrElse(() => []),
|
|
114
|
+
return Array.from({ length: get(count) }, (_, i) =>
|
|
115
|
+
Node.make({
|
|
116
|
+
id: `space-${i}`,
|
|
117
|
+
type: 'space',
|
|
118
|
+
properties: getProperties(`space-${i}`, {
|
|
119
|
+
label: `Space ${i}`,
|
|
120
|
+
icon: random.properties.icon(),
|
|
121
|
+
hue: random.properties.hue(),
|
|
122
|
+
disposition: 'workspace',
|
|
123
|
+
}),
|
|
124
|
+
}),
|
|
125
|
+
);
|
|
126
|
+
}),
|
|
127
|
+
}),
|
|
128
|
+
// Create space actions.
|
|
129
|
+
GraphBuilder.createExtension({
|
|
130
|
+
id: 'space-actions',
|
|
131
|
+
match: NodeMatcher.whenNodeType('space'),
|
|
132
|
+
actions: () =>
|
|
133
|
+
Effect.succeed(
|
|
134
|
+
Array.from({ length: 5 }, (_, i) => ({
|
|
135
|
+
id: `action-${i}`,
|
|
136
|
+
data: Effect.fnUntraced(function* () {
|
|
137
|
+
log.info('action', { id: 'space-actions', index: i });
|
|
138
|
+
}),
|
|
139
|
+
properties: getProperties(`action-${i}`, {
|
|
140
|
+
label: `Action ${i}`,
|
|
141
|
+
icon: random.properties.icon(),
|
|
142
|
+
}),
|
|
143
|
+
})),
|
|
200
144
|
),
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
145
|
+
}),
|
|
146
|
+
// Create object nodes.
|
|
147
|
+
GraphBuilder.createExtension({
|
|
148
|
+
id: 'objects',
|
|
149
|
+
match: NodeMatcher.whenNodeType('space'),
|
|
150
|
+
connector: (_, get) =>
|
|
151
|
+
Effect.sync(() => {
|
|
152
|
+
const count = Atom.make((get) => {
|
|
153
|
+
let value = 3;
|
|
154
|
+
const interval = setInterval(() => {
|
|
155
|
+
if (value >= 20) {
|
|
156
|
+
clearInterval(interval);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
214
159
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
160
|
+
value++;
|
|
161
|
+
get.setSelf(value);
|
|
162
|
+
}, 5000);
|
|
163
|
+
get.addFinalizer(() => clearInterval(interval));
|
|
164
|
+
return value;
|
|
165
|
+
});
|
|
221
166
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
Option.flatMap((node) => (node.type === 'object' ? Option.some(node) : Option.none())),
|
|
251
|
-
Option.map((node) => {
|
|
252
|
-
return [
|
|
253
|
-
...Array.from({ length: 5 }, (_, i) => ({
|
|
254
|
-
id: `${node.id}/action-${i}`,
|
|
255
|
-
data: () => {
|
|
256
|
-
log.info('action', { id: node.id, index: i });
|
|
257
|
-
},
|
|
258
|
-
properties: getProperties(`${node.id}/action-${i}`, {
|
|
259
|
-
label: `Action ${i}`,
|
|
260
|
-
icon: faker.properties.icon(),
|
|
261
|
-
}),
|
|
262
|
-
})),
|
|
263
|
-
];
|
|
264
|
-
}),
|
|
265
|
-
Option.getOrElse(() => []),
|
|
167
|
+
return Array.from({ length: get(count) }, (_, i) =>
|
|
168
|
+
Node.make({
|
|
169
|
+
id: `object-${i}`,
|
|
170
|
+
type: 'object',
|
|
171
|
+
properties: getProperties(`object-${i}`, {
|
|
172
|
+
label: `Object ${i}`,
|
|
173
|
+
icon: random.properties.icon(),
|
|
174
|
+
}),
|
|
175
|
+
}),
|
|
176
|
+
);
|
|
177
|
+
}),
|
|
178
|
+
}),
|
|
179
|
+
// Create object actions.
|
|
180
|
+
GraphBuilder.createExtension({
|
|
181
|
+
id: 'object-actions',
|
|
182
|
+
match: NodeMatcher.whenNodeType('object'),
|
|
183
|
+
actions: () =>
|
|
184
|
+
Effect.succeed(
|
|
185
|
+
Array.from({ length: 5 }, (_, i) => ({
|
|
186
|
+
id: `action-${i}`,
|
|
187
|
+
data: Effect.fnUntraced(function* () {
|
|
188
|
+
log.info('action', { id: 'object-actions', index: i });
|
|
189
|
+
}),
|
|
190
|
+
properties: getProperties(`action-${i}`, {
|
|
191
|
+
label: `Action ${i}`,
|
|
192
|
+
icon: random.properties.icon(),
|
|
193
|
+
}),
|
|
194
|
+
})),
|
|
266
195
|
),
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
196
|
+
}),
|
|
197
|
+
]),
|
|
198
|
+
);
|
|
270
199
|
};
|