@dxos/plugin-navtree 0.8.4-main.937b3ca → 0.8.4-main.9be5663bfe
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 +137 -72
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/NavTreePlugin.d.ts.map +1 -1
- 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 -14
- 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 +3 -6
- 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.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 -13
- 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 +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/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.stories.d.ts +18 -4
- 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.d.ts → hooks/useNavTreeState.d.ts} +2 -14
- package/dist/types/src/hooks/useNavTreeState.d.ts.map +1 -0
- 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/translations.d.ts +9 -10
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/events.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +6 -2
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +54 -43
- package/src/NavTreePlugin.tsx +26 -27
- package/src/capabilities/{app-graph-builder/app-graph-builder.ts → app-graph-builder.ts} +10 -9
- package/src/capabilities/index.ts +11 -5
- package/src/capabilities/{keyboard/keyboard.ts → keyboard.ts} +7 -6
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +15 -15
- package/src/capabilities/{state/state.ts → state.ts} +43 -15
- package/src/components/NavTree/NavTree.stories.tsx +31 -28
- 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 -39
- package/src/components/NavTreeItem/NavTreeItemColumns.tsx +43 -17
- package/src/components/Sidebar/L0Menu.tsx +104 -113
- package/src/components/Sidebar/L1Panel.tsx +253 -94
- package/src/components/Sidebar/L1Tabs.tsx +13 -4
- package/src/components/UserAccountAvatar/UserAccountAvatar.stories.tsx +2 -3
- package/src/components/UserAccountAvatar/UserAccountAvatar.tsx +1 -1
- package/src/components/index.ts +0 -3
- package/src/components/types.ts +12 -17
- package/src/containers/CommandsDialogContent/CommandsDialogContent.stories.tsx +45 -0
- package/src/{components/CommandsDialog/CommandsDialog.tsx → containers/CommandsDialogContent/CommandsDialogContent.tsx} +23 -21
- 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/{components → containers/NavTreeContainer}/NavTreeContainer.tsx +85 -142
- 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 +81 -84
- 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.ts → hooks/useNavTreeState.ts} +3 -34
- package/src/meta.ts +2 -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 +9 -10
- package/src/types/capabilities.ts +2 -2
- package/src/types/events.ts +4 -3
- package/src/util.ts +19 -5
- package/dist/lib/browser/app-graph-builder-RSMA6I22.mjs +0 -43
- package/dist/lib/browser/app-graph-builder-RSMA6I22.mjs.map +0 -7
- package/dist/lib/browser/chunk-6YPQ625I.mjs +0 -1293
- package/dist/lib/browser/chunk-6YPQ625I.mjs.map +0 -7
- package/dist/lib/browser/chunk-AGQDZBPL.mjs +0 -23
- package/dist/lib/browser/chunk-AGQDZBPL.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-32EH3N4K.mjs +0 -52
- package/dist/lib/browser/keyboard-32EH3N4K.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-IB75DC5O.mjs +0 -52
- package/dist/lib/browser/operation-resolver-IB75DC5O.mjs.map +0 -7
- package/dist/lib/browser/react-surface-F6CVMS3Y.mjs +0 -58
- package/dist/lib/browser/react-surface-F6CVMS3Y.mjs.map +0 -7
- package/dist/lib/browser/state-EVYQOUI3.mjs +0 -120
- package/dist/lib/browser/state-EVYQOUI3.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.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 -41
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/state/index.ts +0 -7
- package/src/components/CommandsDialog/CommandsTrigger.tsx +0 -26
- package/src/components/CommandsDialog/index.ts +0 -6
- /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
|
@@ -7,8 +7,8 @@ import * as Effect from 'effect/Effect';
|
|
|
7
7
|
|
|
8
8
|
import { type BuilderExtensions } from '@dxos/app-graph';
|
|
9
9
|
import { log } from '@dxos/log';
|
|
10
|
-
import { GraphBuilder, NodeMatcher } from '@dxos/plugin-graph';
|
|
11
|
-
import {
|
|
10
|
+
import { GraphBuilder, Node, NodeMatcher } from '@dxos/plugin-graph';
|
|
11
|
+
import { random } from '@dxos/random';
|
|
12
12
|
|
|
13
13
|
export const storybookGraphBuilders = (): BuilderExtensions => {
|
|
14
14
|
const propertiesCache = new Map<string, Record<string, unknown>>();
|
|
@@ -31,13 +31,13 @@ export const storybookGraphBuilders = (): BuilderExtensions => {
|
|
|
31
31
|
actions: () =>
|
|
32
32
|
Effect.succeed(
|
|
33
33
|
Array.from({ length: 5 }, (_, i) => ({
|
|
34
|
-
id: `
|
|
34
|
+
id: `action-${i}`,
|
|
35
35
|
data: Effect.fnUntraced(function* () {
|
|
36
36
|
log.info('action', { id: 'app-menu', index: i });
|
|
37
37
|
}),
|
|
38
38
|
properties: {
|
|
39
39
|
label: `Action ${i}`,
|
|
40
|
-
icon:
|
|
40
|
+
icon: random.properties.icon(),
|
|
41
41
|
disposition: 'menu',
|
|
42
42
|
},
|
|
43
43
|
})),
|
|
@@ -49,7 +49,7 @@ export const storybookGraphBuilders = (): BuilderExtensions => {
|
|
|
49
49
|
match: NodeMatcher.whenRoot,
|
|
50
50
|
connector: () =>
|
|
51
51
|
Effect.succeed([
|
|
52
|
-
{
|
|
52
|
+
Node.make({
|
|
53
53
|
id: 'user-account',
|
|
54
54
|
type: 'user-account',
|
|
55
55
|
properties: {
|
|
@@ -57,37 +57,37 @@ export const storybookGraphBuilders = (): BuilderExtensions => {
|
|
|
57
57
|
icon: 'ph--user--regular',
|
|
58
58
|
disposition: 'user-account',
|
|
59
59
|
userId: '1234567890ABCDEF',
|
|
60
|
-
hue:
|
|
61
|
-
emoji:
|
|
60
|
+
hue: random.properties.hue(),
|
|
61
|
+
emoji: random.properties.emoji(),
|
|
62
62
|
status: 'active',
|
|
63
63
|
},
|
|
64
64
|
nodes: [
|
|
65
|
-
{
|
|
65
|
+
Node.make({
|
|
66
66
|
id: 'profile',
|
|
67
67
|
type: 'profile',
|
|
68
68
|
properties: {
|
|
69
69
|
label: 'Profile',
|
|
70
70
|
icon: 'ph--user--regular',
|
|
71
71
|
},
|
|
72
|
-
},
|
|
73
|
-
{
|
|
72
|
+
}),
|
|
73
|
+
Node.make({
|
|
74
74
|
id: 'devices',
|
|
75
75
|
type: 'devices',
|
|
76
76
|
properties: {
|
|
77
77
|
label: 'Devices',
|
|
78
78
|
icon: 'ph--devices--regular',
|
|
79
79
|
},
|
|
80
|
-
},
|
|
81
|
-
{
|
|
80
|
+
}),
|
|
81
|
+
Node.make({
|
|
82
82
|
id: 'security',
|
|
83
83
|
type: 'security',
|
|
84
84
|
properties: {
|
|
85
85
|
label: 'Security',
|
|
86
86
|
icon: 'ph--key--regular',
|
|
87
87
|
},
|
|
88
|
-
},
|
|
88
|
+
}),
|
|
89
89
|
],
|
|
90
|
-
},
|
|
90
|
+
}),
|
|
91
91
|
]),
|
|
92
92
|
}),
|
|
93
93
|
// Create space (workspace) nodes directly under root.
|
|
@@ -111,16 +111,18 @@ export const storybookGraphBuilders = (): BuilderExtensions => {
|
|
|
111
111
|
return value;
|
|
112
112
|
});
|
|
113
113
|
|
|
114
|
-
return Array.from({ length: get(count) }, (_, i) =>
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
|
+
}),
|
|
122
124
|
}),
|
|
123
|
-
|
|
125
|
+
);
|
|
124
126
|
}),
|
|
125
127
|
}),
|
|
126
128
|
// Create space actions.
|
|
@@ -130,13 +132,13 @@ export const storybookGraphBuilders = (): BuilderExtensions => {
|
|
|
130
132
|
actions: () =>
|
|
131
133
|
Effect.succeed(
|
|
132
134
|
Array.from({ length: 5 }, (_, i) => ({
|
|
133
|
-
id: `
|
|
135
|
+
id: `action-${i}`,
|
|
134
136
|
data: Effect.fnUntraced(function* () {
|
|
135
137
|
log.info('action', { id: 'space-actions', index: i });
|
|
136
138
|
}),
|
|
137
|
-
properties: getProperties(`
|
|
139
|
+
properties: getProperties(`action-${i}`, {
|
|
138
140
|
label: `Action ${i}`,
|
|
139
|
-
icon:
|
|
141
|
+
icon: random.properties.icon(),
|
|
140
142
|
}),
|
|
141
143
|
})),
|
|
142
144
|
),
|
|
@@ -162,14 +164,16 @@ export const storybookGraphBuilders = (): BuilderExtensions => {
|
|
|
162
164
|
return value;
|
|
163
165
|
});
|
|
164
166
|
|
|
165
|
-
return Array.from({ length: get(count) }, (_, i) =>
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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
|
+
}),
|
|
171
175
|
}),
|
|
172
|
-
|
|
176
|
+
);
|
|
173
177
|
}),
|
|
174
178
|
}),
|
|
175
179
|
// Create object actions.
|
|
@@ -179,13 +183,13 @@ export const storybookGraphBuilders = (): BuilderExtensions => {
|
|
|
179
183
|
actions: () =>
|
|
180
184
|
Effect.succeed(
|
|
181
185
|
Array.from({ length: 5 }, (_, i) => ({
|
|
182
|
-
id: `
|
|
186
|
+
id: `action-${i}`,
|
|
183
187
|
data: Effect.fnUntraced(function* () {
|
|
184
188
|
log.info('action', { id: 'object-actions', index: i });
|
|
185
189
|
}),
|
|
186
|
-
properties: getProperties(`
|
|
190
|
+
properties: getProperties(`action-${i}`, {
|
|
187
191
|
label: `Action ${i}`,
|
|
188
|
-
icon:
|
|
192
|
+
icon: random.properties.icon(),
|
|
189
193
|
}),
|
|
190
194
|
})),
|
|
191
195
|
),
|
package/src/testing/generator.ts
CHANGED
|
@@ -7,7 +7,7 @@ import * as Schema from 'effect/Schema';
|
|
|
7
7
|
import { type Node } from '@dxos/app-graph';
|
|
8
8
|
import { Obj, Type } from '@dxos/echo';
|
|
9
9
|
import { TestSchema } from '@dxos/echo/testing';
|
|
10
|
-
import {
|
|
10
|
+
import { random } from '@dxos/random';
|
|
11
11
|
import { range } from '@dxos/util';
|
|
12
12
|
|
|
13
13
|
// TODO(burdon): Reconcile with @dxos/plugin-debug, @dxos/react-ui/testing.
|
|
@@ -17,12 +17,12 @@ import { range } from '@dxos/util';
|
|
|
17
17
|
export type TestItem = { id: string; type: string } & Record<string, any>;
|
|
18
18
|
|
|
19
19
|
type ObjectDataGenerator = {
|
|
20
|
-
createSchema?: () => Type.
|
|
20
|
+
createSchema?: () => Type.AnyObj;
|
|
21
21
|
createData: () => any;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
type ObjectFactory<T> = {
|
|
25
|
-
schema?: Type.
|
|
25
|
+
schema?: Type.AnyObj; // TODO(burdon): Support both typed and expando schema.
|
|
26
26
|
createObject: () => T;
|
|
27
27
|
};
|
|
28
28
|
|
|
@@ -43,16 +43,16 @@ export const Priority = [1, 2, 3, 4, 5];
|
|
|
43
43
|
export const defaultGenerators: { [type: string]: ObjectDataGenerator } = {
|
|
44
44
|
document: {
|
|
45
45
|
createData: () => ({
|
|
46
|
-
title:
|
|
47
|
-
body:
|
|
46
|
+
title: random.lorem.sentence(3),
|
|
47
|
+
body: random.lorem.sentences({ min: 1, max: random.number.int({ min: 1, max: 3 }) }),
|
|
48
48
|
}),
|
|
49
49
|
},
|
|
50
50
|
|
|
51
51
|
image: {
|
|
52
52
|
createData: () => ({
|
|
53
|
-
title:
|
|
54
|
-
image:
|
|
55
|
-
body:
|
|
53
|
+
title: random.lorem.sentence(3),
|
|
54
|
+
image: random.helpers.arrayElement(data.images),
|
|
55
|
+
body: random.datatype.boolean() ? random.lorem.sentences() : undefined,
|
|
56
56
|
}),
|
|
57
57
|
},
|
|
58
58
|
|
|
@@ -65,16 +65,16 @@ export const defaultGenerators: { [type: string]: ObjectDataGenerator } = {
|
|
|
65
65
|
priority: Schema.Number,
|
|
66
66
|
}).pipe(
|
|
67
67
|
Type.object({
|
|
68
|
-
typename: 'example.
|
|
68
|
+
typename: 'com.example.type.project',
|
|
69
69
|
version: '0.1.0',
|
|
70
70
|
}),
|
|
71
71
|
),
|
|
72
72
|
|
|
73
73
|
createData: () => ({
|
|
74
|
-
title:
|
|
75
|
-
repo:
|
|
76
|
-
status:
|
|
77
|
-
priority:
|
|
74
|
+
title: random.commerce.productName(),
|
|
75
|
+
repo: random.datatype.boolean({ probability: 0.3 }) ? random.internet.url() : undefined,
|
|
76
|
+
status: random.helpers.arrayElement(Status),
|
|
77
|
+
priority: random.helpers.arrayElement(Priority),
|
|
78
78
|
}),
|
|
79
79
|
},
|
|
80
80
|
};
|
|
@@ -94,12 +94,12 @@ export class TestObjectGenerator {
|
|
|
94
94
|
}, {});
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
get schema(): Type.
|
|
97
|
+
get schema(): Type.AnyObj[] {
|
|
98
98
|
return Object.values(this.factories).map((f) => f.schema!);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
createObject({ types }: { types?: string[] } = {}) {
|
|
102
|
-
const type =
|
|
102
|
+
const type = random.helpers.arrayElement(types ?? Object.keys(this.factories));
|
|
103
103
|
const factory = this.factories[type];
|
|
104
104
|
return factory?.createObject();
|
|
105
105
|
}
|
|
@@ -136,7 +136,7 @@ export const createTree = () => {
|
|
|
136
136
|
nodes: [...Array(4)].map(() => {
|
|
137
137
|
const l0 = generator.createObject();
|
|
138
138
|
return {
|
|
139
|
-
id:
|
|
139
|
+
id: random.string.uuid(),
|
|
140
140
|
data: null,
|
|
141
141
|
type: 'category',
|
|
142
142
|
properties: {
|
|
@@ -148,7 +148,7 @@ export const createTree = () => {
|
|
|
148
148
|
...[...Array(4)].map(() => {
|
|
149
149
|
const l1 = generator.createObject();
|
|
150
150
|
return {
|
|
151
|
-
id:
|
|
151
|
+
id: random.string.uuid(),
|
|
152
152
|
data: null,
|
|
153
153
|
type: 'document',
|
|
154
154
|
properties: {
|
|
@@ -157,20 +157,20 @@ export const createTree = () => {
|
|
|
157
157
|
},
|
|
158
158
|
nodes: [
|
|
159
159
|
{
|
|
160
|
-
id: `${
|
|
160
|
+
id: `${random.string.uuid()}__a1`,
|
|
161
161
|
data: () => {},
|
|
162
162
|
type: 'action',
|
|
163
163
|
properties: {
|
|
164
|
-
label:
|
|
164
|
+
label: random.lorem.words(2),
|
|
165
165
|
icon: 'ph--boat--regular',
|
|
166
166
|
},
|
|
167
167
|
},
|
|
168
168
|
{
|
|
169
|
-
id: `${
|
|
169
|
+
id: `${random.string.uuid()}__a2`,
|
|
170
170
|
data: () => {},
|
|
171
171
|
type: 'action',
|
|
172
172
|
properties: {
|
|
173
|
-
label:
|
|
173
|
+
label: random.lorem.words(2),
|
|
174
174
|
icon: 'ph--train-simple--regular',
|
|
175
175
|
},
|
|
176
176
|
},
|
|
@@ -178,20 +178,20 @@ export const createTree = () => {
|
|
|
178
178
|
} satisfies Node.NodeArg<any>;
|
|
179
179
|
}),
|
|
180
180
|
{
|
|
181
|
-
id: `${
|
|
181
|
+
id: `${random.string.uuid()}__a1`,
|
|
182
182
|
data: () => {},
|
|
183
183
|
type: 'action',
|
|
184
184
|
properties: {
|
|
185
|
-
label:
|
|
185
|
+
label: random.lorem.words(2),
|
|
186
186
|
icon: 'ph--boat--regular',
|
|
187
187
|
},
|
|
188
188
|
},
|
|
189
189
|
{
|
|
190
|
-
id: `${
|
|
190
|
+
id: `${random.string.uuid()}__a2`,
|
|
191
191
|
data: () => {},
|
|
192
192
|
type: 'action',
|
|
193
193
|
properties: {
|
|
194
|
-
label:
|
|
194
|
+
label: random.lorem.words(2),
|
|
195
195
|
icon: 'ph--train-simple--regular',
|
|
196
196
|
},
|
|
197
197
|
},
|
package/src/translations.ts
CHANGED
|
@@ -4,21 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
6
|
|
|
7
|
-
import { meta } from '
|
|
7
|
+
import { meta } from '#meta';
|
|
8
8
|
|
|
9
9
|
export const translations = [
|
|
10
10
|
{
|
|
11
11
|
'en-US': {
|
|
12
12
|
[meta.id]: {
|
|
13
|
-
'app
|
|
14
|
-
'open
|
|
15
|
-
'open
|
|
16
|
-
'commands
|
|
17
|
-
'command
|
|
18
|
-
'node
|
|
19
|
-
'tree
|
|
20
|
-
'
|
|
21
|
-
'button back': 'Back to Space',
|
|
13
|
+
'app-menu.label': 'App menu',
|
|
14
|
+
'open-settings.label': 'Settings',
|
|
15
|
+
'open-commands.label': 'Search commands',
|
|
16
|
+
'commands-dialog.title': 'Commands',
|
|
17
|
+
'command-list-input.placeholder': 'Search for commands…',
|
|
18
|
+
'node-actions-menu-invoker.label': 'More options',
|
|
19
|
+
'tree-item-actions.label': 'More actions',
|
|
20
|
+
'button-back.button': 'Back to Space',
|
|
22
21
|
},
|
|
23
22
|
},
|
|
24
23
|
},
|
|
@@ -6,7 +6,7 @@ import { type Atom } from '@effect-atom/atom-react';
|
|
|
6
6
|
|
|
7
7
|
import { Capability } from '@dxos/app-framework';
|
|
8
8
|
|
|
9
|
-
import { meta } from '
|
|
9
|
+
import { meta } from '#meta';
|
|
10
10
|
|
|
11
11
|
export namespace NavTreeCapabilities {
|
|
12
12
|
export type NavTreeItemState = { open: boolean; current: boolean; alternateTree?: boolean };
|
|
@@ -17,5 +17,5 @@ export namespace NavTreeCapabilities {
|
|
|
17
17
|
setItem: (path: string[], key: 'open' | 'current' | 'alternateTree', next: boolean) => void;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
export const State = Capability.make<NavTreeStateStore>(`${meta.id}
|
|
20
|
+
export const State = Capability.make<NavTreeStateStore>(`${meta.id}.capability.state`);
|
|
21
21
|
}
|
package/src/types/events.ts
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type ActivationEvent
|
|
5
|
+
import { type ActivationEvent } from '@dxos/app-framework';
|
|
6
|
+
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
6
7
|
|
|
7
|
-
import { meta } from '
|
|
8
|
+
import { meta } from '#meta';
|
|
8
9
|
|
|
9
10
|
export namespace NavTreeEvents {
|
|
10
|
-
export const StateReady: ActivationEvent.ActivationEvent =
|
|
11
|
+
export const StateReady: ActivationEvent.ActivationEvent = AppActivationEvents.createStateEvent(meta.id);
|
|
11
12
|
}
|
package/src/util.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { Graph, Node } from '@dxos/plugin-graph';
|
|
6
6
|
import { isNonNullable } from '@dxos/util';
|
|
7
7
|
|
|
8
|
-
import { type NavTreeItemGraphNode } from '
|
|
8
|
+
import { type NavTreeItemGraphNode } from '#types';
|
|
9
9
|
|
|
10
10
|
export const getParent = (
|
|
11
11
|
graph: Graph.ReadableGraph,
|
|
@@ -13,9 +13,9 @@ export const getParent = (
|
|
|
13
13
|
path: string[],
|
|
14
14
|
): NavTreeItemGraphNode | undefined => {
|
|
15
15
|
const parentId = path[path.length - 2];
|
|
16
|
-
return Graph.getConnections(graph, node.id, 'inbound').find(
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
return Graph.getConnections(graph, node.id, Node.childRelation('inbound')).find(
|
|
17
|
+
(n: Node.Node) => n.id === parentId,
|
|
18
|
+
) as NavTreeItemGraphNode | undefined;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export const getPersistenceParent = (
|
|
@@ -80,7 +80,7 @@ export const getChildren = (
|
|
|
80
80
|
node: NavTreeItemGraphNode,
|
|
81
81
|
path: readonly string[] = [],
|
|
82
82
|
): NavTreeItemGraphNode[] => {
|
|
83
|
-
return Graph.getConnections(graph, node.id, '
|
|
83
|
+
return Graph.getConnections(graph, node.id, 'child')
|
|
84
84
|
.map((n: Node.Node) => {
|
|
85
85
|
// Break cycles.
|
|
86
86
|
const nextPath = [...path, node.id];
|
|
@@ -89,6 +89,20 @@ export const getChildren = (
|
|
|
89
89
|
.filter(isNonNullable) as NavTreeItemGraphNode[];
|
|
90
90
|
};
|
|
91
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Determines whether a node should be visible based on its disposition.
|
|
94
|
+
*/
|
|
95
|
+
export const filterItems = (node: Node.Node, disposition?: string) => {
|
|
96
|
+
if (!disposition && (node.properties.disposition === 'hidden' || node.properties.disposition === 'alternate-tree')) {
|
|
97
|
+
return false;
|
|
98
|
+
} else if (!disposition) {
|
|
99
|
+
const action = Node.isAction(node);
|
|
100
|
+
return !action || node.properties.disposition === 'item';
|
|
101
|
+
} else {
|
|
102
|
+
return node.properties.disposition === disposition;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
92
106
|
export const l0ItemType = (item: Node.Node) => {
|
|
93
107
|
if (Node.isActionLike(item)) {
|
|
94
108
|
return 'action';
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
COMMANDS_DIALOG,
|
|
3
|
-
meta
|
|
4
|
-
} from "./chunk-YKTYPINZ.mjs";
|
|
5
|
-
|
|
6
|
-
// src/capabilities/app-graph-builder/app-graph-builder.ts
|
|
7
|
-
import * as Effect from "effect/Effect";
|
|
8
|
-
import { Capability, Common } from "@dxos/app-framework";
|
|
9
|
-
import { Operation } from "@dxos/operation";
|
|
10
|
-
import { GraphBuilder, NodeMatcher } from "@dxos/plugin-graph";
|
|
11
|
-
var app_graph_builder_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
12
|
-
const extensions = yield* GraphBuilder.createExtension({
|
|
13
|
-
id: meta.id,
|
|
14
|
-
match: NodeMatcher.whenRoot,
|
|
15
|
-
actions: () => Effect.succeed([
|
|
16
|
-
{
|
|
17
|
-
id: COMMANDS_DIALOG,
|
|
18
|
-
data: () => Operation.invoke(Common.LayoutOperation.UpdateDialog, {
|
|
19
|
-
subject: COMMANDS_DIALOG,
|
|
20
|
-
blockAlign: "start"
|
|
21
|
-
}),
|
|
22
|
-
properties: {
|
|
23
|
-
label: [
|
|
24
|
-
"open commands label",
|
|
25
|
-
{
|
|
26
|
-
ns: meta.id
|
|
27
|
-
}
|
|
28
|
-
],
|
|
29
|
-
icon: "ph--magnifying-glass--regular",
|
|
30
|
-
keyBinding: {
|
|
31
|
-
macos: "meta+k",
|
|
32
|
-
windows: "ctrl+k"
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
])
|
|
37
|
-
});
|
|
38
|
-
return Capability.contributes(Common.Capability.AppGraphBuilder, extensions);
|
|
39
|
-
}));
|
|
40
|
-
export {
|
|
41
|
-
app_graph_builder_default as default
|
|
42
|
-
};
|
|
43
|
-
//# sourceMappingURL=app-graph-builder-RSMA6I22.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/app-graph-builder/app-graph-builder.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability, Common } from '@dxos/app-framework';\nimport { Operation } from '@dxos/operation';\nimport { GraphBuilder, NodeMatcher } from '@dxos/plugin-graph';\n\nimport { COMMANDS_DIALOG, meta } from '../../meta';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const extensions = yield* GraphBuilder.createExtension({\n id: meta.id,\n match: NodeMatcher.whenRoot,\n actions: () =>\n Effect.succeed([\n {\n id: COMMANDS_DIALOG,\n data: () =>\n Operation.invoke(Common.LayoutOperation.UpdateDialog, {\n subject: COMMANDS_DIALOG,\n blockAlign: 'start',\n }),\n properties: {\n label: ['open commands label', { ns: meta.id }],\n icon: 'ph--magnifying-glass--regular',\n keyBinding: {\n macos: 'meta+k',\n windows: 'ctrl+k',\n },\n },\n },\n ]),\n });\n\n return Capability.contributes(Common.Capability.AppGraphBuilder, extensions);\n }),\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,YAAYC,cAAc;AACnC,SAASC,iBAAiB;AAC1B,SAASC,cAAcC,mBAAmB;AAI1C,IAAA,4BAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAChB,QAAMC,aAAa,OAAOC,aAAaC,gBAAgB;IACrDC,IAAIC,KAAKD;IACTE,OAAOC,YAAYC;IACnBC,SAAS,MACAC,eAAQ;MACb;QACEN,IAAIO;QACJC,MAAM,MACJC,UAAUC,OAAOC,OAAOC,gBAAgBC,cAAc;UACpDC,SAASP;UACTQ,YAAY;QACd,CAAA;QACFC,YAAY;UACVC,OAAO;YAAC;YAAuB;cAAEC,IAAIjB,KAAKD;YAAG;;UAC7CmB,MAAM;UACNC,YAAY;YACVC,OAAO;YACPC,SAAS;UACX;QACF;MACF;KACD;EACL,CAAA;AAEA,SAAO5B,WAAW6B,YAAYZ,OAAOjB,WAAW8B,iBAAiB3B,UAAAA;AACnE,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "Capability", "Common", "Operation", "GraphBuilder", "NodeMatcher", "Capability", "makeModule", "fnUntraced", "extensions", "GraphBuilder", "createExtension", "id", "meta", "match", "NodeMatcher", "whenRoot", "actions", "succeed", "COMMANDS_DIALOG", "data", "Operation", "invoke", "Common", "LayoutOperation", "UpdateDialog", "subject", "blockAlign", "properties", "label", "ns", "icon", "keyBinding", "macos", "windows", "contributes", "AppGraphBuilder"]
|
|
7
|
-
}
|