@dxos/plugin-search 0.8.4-main.bc674ce → 0.8.4-main.c351d160a8
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/README.md +0 -1
- package/dist/lib/browser/SearchDialog-KJL6C2OF.mjs +108 -0
- package/dist/lib/browser/SearchDialog-KJL6C2OF.mjs.map +7 -0
- package/dist/lib/browser/SearchMain-VOEEHUCW.mjs +97 -0
- package/dist/lib/browser/SearchMain-VOEEHUCW.mjs.map +7 -0
- package/dist/lib/browser/{app-graph-builder-KZ3V2E5U.mjs → app-graph-builder-FHVM5QV7.mjs} +11 -14
- package/dist/lib/browser/app-graph-builder-FHVM5QV7.mjs.map +7 -0
- package/dist/lib/browser/{chunk-I7YWQSUZ.mjs → chunk-I3633KKK.mjs} +4 -4
- package/dist/lib/browser/{chunk-I7YWQSUZ.mjs.map → chunk-I3633KKK.mjs.map} +1 -1
- package/dist/lib/browser/{chunk-ZRJJXRGF.mjs → chunk-NB4JZIOE.mjs} +1 -1
- package/dist/lib/browser/{chunk-ZRJJXRGF.mjs.map → chunk-NB4JZIOE.mjs.map} +1 -1
- package/dist/lib/browser/{chunk-HRIWTRJV.mjs → chunk-PZ67KFRU.mjs} +3 -3
- package/dist/lib/browser/{chunk-HRIWTRJV.mjs.map → chunk-PZ67KFRU.mjs.map} +1 -1
- package/dist/lib/browser/index.mjs +15 -14
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{operation-resolver-6MBOKZQH.mjs → operation-resolver-H4X6BNWR.mjs} +7 -6
- package/dist/lib/browser/operation-resolver-H4X6BNWR.mjs.map +7 -0
- package/dist/lib/browser/react-surface-EZX43GMG.mjs +60 -0
- package/dist/lib/browser/react-surface-EZX43GMG.mjs.map +7 -0
- package/dist/types/src/SearchPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface/react-surface.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/constants.d.ts +2 -0
- package/dist/types/src/constants.d.ts.map +1 -0
- package/dist/types/src/{components → containers/SearchDialog}/SearchDialog.d.ts +0 -1
- package/dist/types/src/containers/SearchDialog/SearchDialog.d.ts.map +1 -0
- package/dist/types/src/containers/SearchDialog/index.d.ts +3 -0
- package/dist/types/src/containers/SearchDialog/index.d.ts.map +1 -0
- package/dist/types/src/containers/SearchMain/SearchMain.d.ts.map +1 -0
- package/dist/types/src/containers/SearchMain/index.d.ts +3 -0
- package/dist/types/src/containers/SearchMain/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +5 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/types/action.d.ts +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +43 -41
- package/src/SearchPlugin.tsx +7 -6
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +8 -8
- package/src/capabilities/operation-resolver/operation-resolver.ts +4 -3
- package/src/capabilities/react-surface/react-surface.tsx +11 -19
- package/src/components/index.ts +0 -4
- package/src/constants.ts +7 -0
- package/src/{components → containers/SearchDialog}/SearchDialog.tsx +33 -43
- package/src/containers/SearchDialog/index.ts +6 -0
- package/src/containers/SearchMain/SearchMain.tsx +100 -0
- package/src/containers/SearchMain/index.ts +7 -0
- package/src/containers/index.ts +10 -0
- package/src/meta.ts +2 -2
- package/src/search/exa.ts +1 -1
- package/src/types/action.tsx +2 -2
- package/dist/lib/browser/app-graph-builder-KZ3V2E5U.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-6MBOKZQH.mjs.map +0 -7
- package/dist/lib/browser/react-surface-RVLK6KJ5.mjs +0 -368
- package/dist/lib/browser/react-surface-RVLK6KJ5.mjs.map +0 -7
- package/dist/types/src/components/SearchDialog.d.ts.map +0 -1
- package/dist/types/src/components/SearchMain.d.ts.map +0 -1
- package/dist/types/src/components/SearchMain.stories.d.ts +0 -31
- package/dist/types/src/components/SearchMain.stories.d.ts.map +0 -1
- package/dist/types/src/components/SpaceMain.d.ts +0 -9
- package/dist/types/src/components/SpaceMain.d.ts.map +0 -1
- package/src/components/SearchMain.stories.tsx +0 -90
- package/src/components/SearchMain.tsx +0 -83
- package/src/components/SpaceMain.tsx +0 -169
- /package/dist/types/src/{components → containers/SearchMain}/SearchMain.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-search",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.c351d160a8",
|
|
4
4
|
"description": "Search plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -28,56 +28,58 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"exa-js": "^1.5.12",
|
|
30
30
|
"main-thread-scheduling": "^14.1.1",
|
|
31
|
-
"@dxos/
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/app-
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/echo-
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/plugin-
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/react-
|
|
50
|
-
"@dxos/react-ui-
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/react-ui-
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
31
|
+
"@dxos/ai": "0.8.4-main.c351d160a8",
|
|
32
|
+
"@dxos/app-framework": "0.8.4-main.c351d160a8",
|
|
33
|
+
"@dxos/app-toolkit": "0.8.4-main.c351d160a8",
|
|
34
|
+
"@dxos/assistant": "0.8.4-main.c351d160a8",
|
|
35
|
+
"@dxos/async": "0.8.4-main.c351d160a8",
|
|
36
|
+
"@dxos/debug": "0.8.4-main.c351d160a8",
|
|
37
|
+
"@dxos/blueprints": "0.8.4-main.c351d160a8",
|
|
38
|
+
"@dxos/echo-protocol": "0.8.4-main.c351d160a8",
|
|
39
|
+
"@dxos/echo-query": "0.8.4-main.c351d160a8",
|
|
40
|
+
"@dxos/echo": "0.8.4-main.c351d160a8",
|
|
41
|
+
"@dxos/effect": "0.8.4-main.c351d160a8",
|
|
42
|
+
"@dxos/invariant": "0.8.4-main.c351d160a8",
|
|
43
|
+
"@dxos/log": "0.8.4-main.c351d160a8",
|
|
44
|
+
"@dxos/operation": "0.8.4-main.c351d160a8",
|
|
45
|
+
"@dxos/plugin-deck": "0.8.4-main.c351d160a8",
|
|
46
|
+
"@dxos/plugin-client": "0.8.4-main.c351d160a8",
|
|
47
|
+
"@dxos/plugin-graph": "0.8.4-main.c351d160a8",
|
|
48
|
+
"@dxos/plugin-space": "0.8.4-main.c351d160a8",
|
|
49
|
+
"@dxos/react-client": "0.8.4-main.c351d160a8",
|
|
50
|
+
"@dxos/react-ui-menu": "0.8.4-main.c351d160a8",
|
|
51
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.c351d160a8",
|
|
52
|
+
"@dxos/react-ui-searchlist": "0.8.4-main.c351d160a8",
|
|
53
|
+
"@dxos/react-ui-components": "0.8.4-main.c351d160a8",
|
|
54
|
+
"@dxos/schema": "0.8.4-main.c351d160a8",
|
|
55
|
+
"@dxos/react-ui-stack": "0.8.4-main.c351d160a8",
|
|
56
|
+
"@dxos/types": "0.8.4-main.c351d160a8",
|
|
57
|
+
"@dxos/util": "0.8.4-main.c351d160a8"
|
|
56
58
|
},
|
|
57
59
|
"devDependencies": {
|
|
58
|
-
"@effect-atom/atom-react": "^0.
|
|
59
|
-
"@effect/platform": "0.
|
|
60
|
+
"@effect-atom/atom-react": "^0.5.0",
|
|
61
|
+
"@effect/platform": "0.94.4",
|
|
60
62
|
"@types/react": "~19.2.7",
|
|
61
63
|
"@types/react-dom": "~19.2.3",
|
|
62
|
-
"effect": "3.19.
|
|
64
|
+
"effect": "3.19.16",
|
|
63
65
|
"react": "~19.2.3",
|
|
64
66
|
"react-dom": "~19.2.3",
|
|
65
|
-
"vite": "7.1.
|
|
66
|
-
"@dxos/plugin-
|
|
67
|
-
"@dxos/plugin-
|
|
68
|
-
"@dxos/random": "0.8.4-main.
|
|
69
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
70
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
71
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
67
|
+
"vite": "^7.1.11",
|
|
68
|
+
"@dxos/plugin-testing": "0.8.4-main.c351d160a8",
|
|
69
|
+
"@dxos/plugin-preview": "0.8.4-main.c351d160a8",
|
|
70
|
+
"@dxos/random": "0.8.4-main.c351d160a8",
|
|
71
|
+
"@dxos/react-ui": "0.8.4-main.c351d160a8",
|
|
72
|
+
"@dxos/storybook-utils": "0.8.4-main.c351d160a8",
|
|
73
|
+
"@dxos/ui-theme": "0.8.4-main.c351d160a8"
|
|
72
74
|
},
|
|
73
75
|
"peerDependencies": {
|
|
74
|
-
"@effect-atom/atom-react": "^0.
|
|
75
|
-
"@effect/platform": "0.
|
|
76
|
-
"effect": "3.19.
|
|
76
|
+
"@effect-atom/atom-react": "^0.5.0",
|
|
77
|
+
"@effect/platform": "0.94.4",
|
|
78
|
+
"effect": "3.19.16",
|
|
77
79
|
"react": "~19.2.3",
|
|
78
80
|
"react-dom": "~19.2.3",
|
|
79
|
-
"@dxos/ui
|
|
80
|
-
"@dxos/
|
|
81
|
+
"@dxos/react-ui": "0.8.4-main.c351d160a8",
|
|
82
|
+
"@dxos/ui-theme": "0.8.4-main.c351d160a8"
|
|
81
83
|
},
|
|
82
84
|
"publishConfig": {
|
|
83
85
|
"access": "public"
|
package/src/SearchPlugin.tsx
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { AppPlugin } from '@dxos/app-toolkit';
|
|
6
7
|
|
|
7
8
|
import { AppGraphBuilder, OperationResolver, ReactSurface } from './capabilities';
|
|
8
9
|
import { SEARCH_RESULT, meta } from './meta';
|
|
@@ -10,8 +11,8 @@ import { translations } from './translations';
|
|
|
10
11
|
import { type SearchResult } from './types';
|
|
11
12
|
|
|
12
13
|
export const SearchPlugin = Plugin.define(meta).pipe(
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
AppPlugin.addAppGraphModule({ activate: AppGraphBuilder }),
|
|
15
|
+
AppPlugin.addMetadataModule({
|
|
15
16
|
metadata: {
|
|
16
17
|
id: SEARCH_RESULT,
|
|
17
18
|
metadata: {
|
|
@@ -28,8 +29,8 @@ export const SearchPlugin = Plugin.define(meta).pipe(
|
|
|
28
29
|
},
|
|
29
30
|
},
|
|
30
31
|
}),
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
AppPlugin.addOperationResolverModule({ activate: OperationResolver }),
|
|
33
|
+
AppPlugin.addSurfaceModule({ activate: ReactSurface }),
|
|
34
|
+
AppPlugin.addTranslationsModule({ translations }),
|
|
34
35
|
Plugin.make,
|
|
35
36
|
);
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
-
import { Capability
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities, COMPANION_PREFIX, getSpaceIdFromPath } from '@dxos/app-toolkit';
|
|
8
9
|
import { Operation } from '@dxos/operation';
|
|
9
10
|
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
10
|
-
import {
|
|
11
|
+
import { DECK_COMPANION_TYPE } from '@dxos/plugin-deck/types';
|
|
11
12
|
import { GraphBuilder, NodeMatcher } from '@dxos/plugin-graph';
|
|
12
|
-
import { parseId } from '@dxos/react-client/echo';
|
|
13
13
|
|
|
14
14
|
import { meta } from '../../meta';
|
|
15
15
|
import { SearchOperation } from '../../types';
|
|
@@ -18,18 +18,18 @@ export default Capability.makeModule(
|
|
|
18
18
|
Effect.fnUntraced(function* () {
|
|
19
19
|
const extensions = yield* Effect.all([
|
|
20
20
|
GraphBuilder.createExtension({
|
|
21
|
-
id: `${meta.id}
|
|
21
|
+
id: `${meta.id}.space-search`,
|
|
22
22
|
match: NodeMatcher.whenRoot,
|
|
23
23
|
connector: Effect.fnUntraced(function* (node, get) {
|
|
24
24
|
const client = yield* Capability.get(ClientCapabilities.Client);
|
|
25
|
-
const layoutAtom = get(yield* Capability.atom(
|
|
25
|
+
const layoutAtom = get(yield* Capability.atom(AppCapabilities.Layout))[0];
|
|
26
26
|
const layout = layoutAtom ? get(layoutAtom) : undefined;
|
|
27
|
-
const
|
|
27
|
+
const spaceId = layout?.workspace ? getSpaceIdFromPath(layout.workspace) : undefined;
|
|
28
28
|
const space = spaceId ? client.spaces.get(spaceId) : null;
|
|
29
29
|
|
|
30
30
|
return [
|
|
31
31
|
{
|
|
32
|
-
id:
|
|
32
|
+
id: `${COMPANION_PREFIX}search`,
|
|
33
33
|
type: DECK_COMPANION_TYPE,
|
|
34
34
|
data: space,
|
|
35
35
|
properties: {
|
|
@@ -65,6 +65,6 @@ export default Capability.makeModule(
|
|
|
65
65
|
}),
|
|
66
66
|
]);
|
|
67
67
|
|
|
68
|
-
return Capability.contributes(
|
|
68
|
+
return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);
|
|
69
69
|
}),
|
|
70
70
|
);
|
|
@@ -4,18 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
8
9
|
import { Operation, OperationResolver } from '@dxos/operation';
|
|
9
10
|
|
|
10
11
|
import { SearchOperation } from '../../types';
|
|
11
12
|
|
|
12
13
|
export default Capability.makeModule(
|
|
13
14
|
Effect.fnUntraced(function* () {
|
|
14
|
-
return Capability.contributes(
|
|
15
|
+
return Capability.contributes(Capabilities.OperationResolver, [
|
|
15
16
|
OperationResolver.make({
|
|
16
17
|
operation: SearchOperation.OpenSearch,
|
|
17
18
|
handler: Effect.fnUntraced(function* () {
|
|
18
|
-
yield* Operation.invoke(
|
|
19
|
+
yield* Operation.invoke(LayoutOperation.UpdateComplementary, { subject: 'search' });
|
|
19
20
|
}),
|
|
20
21
|
}),
|
|
21
22
|
]);
|
|
@@ -5,18 +5,19 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
9
10
|
import { useActiveSpace } from '@dxos/plugin-space';
|
|
10
|
-
import { type Space,
|
|
11
|
+
import { type Space, isSpace } from '@dxos/react-client/echo';
|
|
11
12
|
|
|
12
|
-
import { SEARCH_DIALOG
|
|
13
|
+
import { SEARCH_DIALOG } from '../../constants';
|
|
14
|
+
import { SearchDialog, type SearchDialogProps, SearchMain } from '../../containers';
|
|
13
15
|
import { SearchContextProvider } from '../../hooks';
|
|
14
|
-
import { meta } from '../../meta';
|
|
15
16
|
|
|
16
17
|
export default Capability.makeModule(() =>
|
|
17
18
|
Effect.succeed(
|
|
18
|
-
Capability.contributes(
|
|
19
|
-
|
|
19
|
+
Capability.contributes(Capabilities.ReactSurface, [
|
|
20
|
+
Surface.create({
|
|
20
21
|
id: SEARCH_DIALOG,
|
|
21
22
|
role: 'dialog',
|
|
22
23
|
filter: (data): data is { props: SearchDialogProps } => data.component === SEARCH_DIALOG,
|
|
@@ -26,8 +27,8 @@ export default Capability.makeModule(() =>
|
|
|
26
27
|
</SearchContextProvider>
|
|
27
28
|
),
|
|
28
29
|
}),
|
|
29
|
-
|
|
30
|
-
id: `${SEARCH_DIALOG}
|
|
30
|
+
Surface.create({
|
|
31
|
+
id: `${SEARCH_DIALOG}.search-input`,
|
|
31
32
|
role: 'search-input',
|
|
32
33
|
component: () => {
|
|
33
34
|
const space = useActiveSpace();
|
|
@@ -39,8 +40,8 @@ export default Capability.makeModule(() =>
|
|
|
39
40
|
);
|
|
40
41
|
},
|
|
41
42
|
}),
|
|
42
|
-
|
|
43
|
-
id: `${SEARCH_DIALOG}
|
|
43
|
+
Surface.create({
|
|
44
|
+
id: `${SEARCH_DIALOG}.search`,
|
|
44
45
|
role: 'deck-companion--search',
|
|
45
46
|
filter: (data): data is { subject: Space } => isSpace(data.subject),
|
|
46
47
|
component: ({ data }) => {
|
|
@@ -56,15 +57,6 @@ export default Capability.makeModule(() =>
|
|
|
56
57
|
);
|
|
57
58
|
},
|
|
58
59
|
}),
|
|
59
|
-
Common.createSurface({
|
|
60
|
-
id: `${meta.id}/space-article`,
|
|
61
|
-
role: 'article',
|
|
62
|
-
position: 'hoist',
|
|
63
|
-
filter: (data): data is { subject: Space } =>
|
|
64
|
-
// TODO(wittjosiah): Need to avoid shotgun parsing space state everywhere.
|
|
65
|
-
isSpace(data.subject) && data.subject.state.get() === SpaceState.SPACE_READY,
|
|
66
|
-
component: ({ data }) => <SpaceMain space={data.subject} />,
|
|
67
|
-
}),
|
|
68
60
|
]),
|
|
69
61
|
),
|
|
70
62
|
);
|
package/src/components/index.ts
CHANGED
package/src/constants.ts
ADDED
|
@@ -5,20 +5,19 @@
|
|
|
5
5
|
import * as Option from 'effect/Option';
|
|
6
6
|
import React, { forwardRef, useCallback, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
9
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
10
|
+
import { useAppGraph, useLayout } from '@dxos/app-toolkit/ui';
|
|
10
11
|
import { Obj } from '@dxos/echo';
|
|
11
12
|
import { Graph, type Node } from '@dxos/plugin-graph';
|
|
12
13
|
import { useClient } from '@dxos/react-client';
|
|
13
14
|
import { Filter, useQuery } from '@dxos/react-client/echo';
|
|
14
15
|
import { Button, Dialog, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
15
16
|
import { SearchList } from '@dxos/react-ui-searchlist';
|
|
16
|
-
import {
|
|
17
|
+
import { mx, osTranslations } from '@dxos/ui-theme';
|
|
17
18
|
|
|
18
|
-
import { useSearchResults } from '
|
|
19
|
-
import { meta } from '
|
|
20
|
-
|
|
21
|
-
export const SEARCH_DIALOG = `${meta.id}/SearchDialog`;
|
|
19
|
+
import { useSearchResults } from '../../hooks';
|
|
20
|
+
import { meta } from '../../meta';
|
|
22
21
|
|
|
23
22
|
type SearchListResultProps = {
|
|
24
23
|
node: Node.Node;
|
|
@@ -36,7 +35,7 @@ const SearchListResult = forwardRef<HTMLDivElement, SearchListResultProps>(({ no
|
|
|
36
35
|
value={node!.id}
|
|
37
36
|
label={label}
|
|
38
37
|
icon={node?.properties.icon}
|
|
39
|
-
classNames='flex gap-2 items-center
|
|
38
|
+
classNames='flex gap-2 items-center px-2'
|
|
40
39
|
onSelect={handleSelect}
|
|
41
40
|
ref={forwardedRef}
|
|
42
41
|
/>
|
|
@@ -63,14 +62,14 @@ export const SearchDialog = ({ pivotId }: SearchDialogProps) => {
|
|
|
63
62
|
|
|
64
63
|
const handleSelect = useCallback(
|
|
65
64
|
async (nodeId: string) => {
|
|
66
|
-
await invokePromise(
|
|
65
|
+
await invokePromise(LayoutOperation.UpdateDialog, { state: false });
|
|
67
66
|
|
|
68
67
|
// If node is already present in the active parts, scroll to it and close the dialog.
|
|
69
68
|
const index = layout.active.findIndex((id) => id === nodeId);
|
|
70
69
|
if (index !== -1) {
|
|
71
|
-
await invokePromise(
|
|
70
|
+
await invokePromise(LayoutOperation.ScrollIntoView, { subject: nodeId });
|
|
72
71
|
} else {
|
|
73
|
-
await invokePromise(
|
|
72
|
+
await invokePromise(LayoutOperation.Open, {
|
|
74
73
|
subject: [nodeId],
|
|
75
74
|
pivotId,
|
|
76
75
|
positioning: 'end',
|
|
@@ -88,42 +87,33 @@ export const SearchDialog = ({ pivotId }: SearchDialogProps) => {
|
|
|
88
87
|
<Dialog.Content>
|
|
89
88
|
<Dialog.Title>{t('search dialog title')}</Dialog.Title>
|
|
90
89
|
<SearchList.Root onSearch={handleSearch}>
|
|
91
|
-
<
|
|
92
|
-
role='combobox'
|
|
93
|
-
aria-expanded='true'
|
|
94
|
-
aria-label={t('search placeholder')}
|
|
95
|
-
className='flex flex-col grow overflow-hidden'
|
|
96
|
-
>
|
|
90
|
+
<SearchList.Content classNames='max-h-[24rem] overflow-auto'>
|
|
97
91
|
<SearchList.Input placeholder={t('search placeholder')} />
|
|
98
|
-
<SearchList.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
resultObjects
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
.map((node) => <SearchListResult key={node.value.id} node={node.value} onSelect={handleSelect} />)
|
|
106
|
-
) : (
|
|
107
|
-
<p className='pli-1'>{t(pending ? 'pending results message' : 'empty results message')}</p>
|
|
108
|
-
)
|
|
92
|
+
<SearchList.Viewport>
|
|
93
|
+
{queryString.length > 0 ? (
|
|
94
|
+
resultObjects.length > 0 ? (
|
|
95
|
+
resultObjects
|
|
96
|
+
.map((object) => Graph.getNode(graph, Obj.getDXN(object).toString()))
|
|
97
|
+
.filter(Option.isSome)
|
|
98
|
+
.map((node) => <SearchListResult key={node.value.id} node={node.value} onSelect={handleSelect} />)
|
|
109
99
|
) : (
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
100
|
+
<p className='px-1'>{t(pending ? 'pending results message' : 'empty results message')}</p>
|
|
101
|
+
)
|
|
102
|
+
) : (
|
|
103
|
+
<>
|
|
104
|
+
{closed.length > 0 && (
|
|
105
|
+
<h2 className={mx('my-1', 'text-description')}>{t('recently closed heading')}</h2>
|
|
106
|
+
)}
|
|
107
|
+
{closed.filter(Option.isSome).map((node) => (
|
|
108
|
+
<SearchListResult key={node.value.id} node={node.value} onSelect={handleSelect} />
|
|
109
|
+
))}
|
|
110
|
+
</>
|
|
111
|
+
)}
|
|
112
|
+
</SearchList.Viewport>
|
|
113
|
+
</SearchList.Content>
|
|
122
114
|
</SearchList.Root>
|
|
123
115
|
<Dialog.Close asChild>
|
|
124
|
-
<Button variant='primary'
|
|
125
|
-
{t('close label', { ns: osTranslations })}
|
|
126
|
-
</Button>
|
|
116
|
+
<Button variant='primary'>{t('close label', { ns: osTranslations })}</Button>
|
|
127
117
|
</Dialog.Close>
|
|
128
118
|
</Dialog.Content>
|
|
129
119
|
);
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
8
|
+
import { useObjectMenuItems } from '@dxos/app-toolkit/ui';
|
|
9
|
+
import { Entity, Query } from '@dxos/echo';
|
|
10
|
+
import { Filter, type Space, useQuery } from '@dxos/react-client/echo';
|
|
11
|
+
import { Card, Panel, ScrollArea, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
12
|
+
import { Menu } from '@dxos/react-ui-menu';
|
|
13
|
+
import { Mosaic, type MosaicStackTileComponent } from '@dxos/react-ui-mosaic';
|
|
14
|
+
import { SearchList } from '@dxos/react-ui-searchlist';
|
|
15
|
+
import { Text } from '@dxos/schema';
|
|
16
|
+
|
|
17
|
+
import { useGlobalSearch, useGlobalSearchResults, useWebSearch } from '../../hooks';
|
|
18
|
+
import { meta } from '../../meta';
|
|
19
|
+
import { type SearchResult } from '../../types';
|
|
20
|
+
|
|
21
|
+
export const SearchMain = ({ space }: { space?: Space }) => {
|
|
22
|
+
const { t } = useTranslation(meta.id);
|
|
23
|
+
const { setMatch } = useGlobalSearch();
|
|
24
|
+
const [query, setQuery] = useState<string>();
|
|
25
|
+
// TODO(burdon): Option to search across spaces.
|
|
26
|
+
const objects = useQuery(
|
|
27
|
+
space?.db,
|
|
28
|
+
query === undefined
|
|
29
|
+
? Query.select(Filter.nothing())
|
|
30
|
+
: // TODO(dmaretskyi): Final version would walk the ancestry of the object until we find a non-system type.
|
|
31
|
+
Query.all(
|
|
32
|
+
Query.select(Filter.text(query, { type: 'full-text' })).select(Filter.not(Filter.type(Text.Text))),
|
|
33
|
+
Query.select(Filter.text(query, { type: 'full-text' }))
|
|
34
|
+
.select(Filter.type(Text.Text))
|
|
35
|
+
.referencedBy('org.dxos.type.document', 'content'),
|
|
36
|
+
),
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
const results = useGlobalSearchResults(objects);
|
|
40
|
+
const { results: webResults } = useWebSearch({ query });
|
|
41
|
+
const allResults = useMemo(
|
|
42
|
+
() => [...results, ...webResults].filter(({ object }) => object && Entity.getLabel(object)),
|
|
43
|
+
[results, webResults],
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const handleSearch = useCallback(
|
|
47
|
+
(text: string) => {
|
|
48
|
+
setQuery(text);
|
|
49
|
+
setMatch?.(text);
|
|
50
|
+
},
|
|
51
|
+
[setMatch],
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<SearchList.Root onSearch={handleSearch}>
|
|
56
|
+
<Panel.Root className='dx-document'>
|
|
57
|
+
<Panel.Toolbar asChild>
|
|
58
|
+
<Toolbar.Root>
|
|
59
|
+
<SearchList.Input placeholder={t('search placeholder')} />
|
|
60
|
+
</Toolbar.Root>
|
|
61
|
+
</Panel.Toolbar>
|
|
62
|
+
<Panel.Content asChild>
|
|
63
|
+
<SearchList.Content>
|
|
64
|
+
<Mosaic.Container asChild>
|
|
65
|
+
<ScrollArea.Root orientation='vertical'>
|
|
66
|
+
<ScrollArea.Viewport>
|
|
67
|
+
<Mosaic.Stack items={allResults} getId={(result) => result.object!.id} Tile={SearchResultTile} />
|
|
68
|
+
</ScrollArea.Viewport>
|
|
69
|
+
</ScrollArea.Root>
|
|
70
|
+
</Mosaic.Container>
|
|
71
|
+
{allResults.length === 0 && <SearchList.Empty>{t('empty results message')}</SearchList.Empty>}
|
|
72
|
+
</SearchList.Content>
|
|
73
|
+
</Panel.Content>
|
|
74
|
+
</Panel.Root>
|
|
75
|
+
</SearchList.Root>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const SearchResultTile: MosaicStackTileComponent<SearchResult> = (props) => {
|
|
80
|
+
const data = props.data;
|
|
81
|
+
const object = data.object!;
|
|
82
|
+
const objectMenuItems = useObjectMenuItems(object);
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<Menu.Root>
|
|
86
|
+
<Card.Root key={data.id}>
|
|
87
|
+
<Card.Toolbar>
|
|
88
|
+
<Card.DragHandle />
|
|
89
|
+
<Card.Title>{data.label ?? (data.object && Entity.getLabel(data.object))}</Card.Title>
|
|
90
|
+
{/* TODO(wittjosiah): Reconcile with Card.Menu. */}
|
|
91
|
+
<Menu.Trigger asChild disabled={!objectMenuItems?.length}>
|
|
92
|
+
<Toolbar.IconButton iconOnly variant='ghost' icon='ph--dots-three-vertical--regular' label='Actions' />
|
|
93
|
+
</Menu.Trigger>
|
|
94
|
+
<Menu.Content items={objectMenuItems} />
|
|
95
|
+
</Card.Toolbar>
|
|
96
|
+
<Surface.Surface role='card--content' data={{ subject: data.object }} limit={1} />
|
|
97
|
+
</Card.Root>
|
|
98
|
+
</Menu.Root>
|
|
99
|
+
);
|
|
100
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type ComponentType, lazy } from 'react';
|
|
6
|
+
|
|
7
|
+
export type { SearchDialogProps } from './SearchDialog';
|
|
8
|
+
|
|
9
|
+
export const SearchDialog: ComponentType<any> = lazy(() => import('./SearchDialog'));
|
|
10
|
+
export const SearchMain: ComponentType<any> = lazy(() => import('./SearchMain'));
|
package/src/meta.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { type Plugin } from '@dxos/app-framework';
|
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
8
|
export const meta: Plugin.Meta = {
|
|
9
|
-
id: 'dxos.
|
|
9
|
+
id: 'org.dxos.plugin.search',
|
|
10
10
|
name: 'Search',
|
|
11
11
|
description: trim`
|
|
12
12
|
Full-text search engine for finding content across all spaces and object types.
|
|
@@ -17,4 +17,4 @@ export const meta: Plugin.Meta = {
|
|
|
17
17
|
tags: ['labs'],
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
export const SEARCH_RESULT = `${meta.id}
|
|
20
|
+
export const SEARCH_RESULT = `${meta.id}.result`;
|
package/src/search/exa.ts
CHANGED
|
@@ -181,7 +181,7 @@ const DATA_EXTRACTION_INSTRUCTIONS = trim`
|
|
|
181
181
|
// return terms;
|
|
182
182
|
// };
|
|
183
183
|
|
|
184
|
-
const sanitizeObjects = (entries: { data: any; schema: Type.
|
|
184
|
+
const sanitizeObjects = (entries: { data: any; schema: Type.AnyObj }[]) => {
|
|
185
185
|
const idMap = new Map<string, string>();
|
|
186
186
|
|
|
187
187
|
return entries
|
package/src/types/action.tsx
CHANGED
|
@@ -8,11 +8,11 @@ import { Operation } from '@dxos/operation';
|
|
|
8
8
|
|
|
9
9
|
import { meta } from '../meta';
|
|
10
10
|
|
|
11
|
-
const SEARCH_OPERATION = `${meta.id}
|
|
11
|
+
const SEARCH_OPERATION = `${meta.id}.operation`;
|
|
12
12
|
|
|
13
13
|
export namespace SearchOperation {
|
|
14
14
|
export const OpenSearch = Operation.make({
|
|
15
|
-
meta: { key: `${SEARCH_OPERATION}
|
|
15
|
+
meta: { key: `${SEARCH_OPERATION}.open-search`, name: 'Open Search' },
|
|
16
16
|
schema: { input: Schema.Void, output: Schema.Void },
|
|
17
17
|
});
|
|
18
18
|
}
|
|
@@ -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 { ClientCapabilities } from '@dxos/plugin-client';\nimport { ATTENDABLE_PATH_SEPARATOR, DECK_COMPANION_TYPE } from '@dxos/plugin-deck/types';\nimport { GraphBuilder, NodeMatcher } from '@dxos/plugin-graph';\nimport { parseId } from '@dxos/react-client/echo';\n\nimport { meta } from '../../meta';\nimport { SearchOperation } from '../../types';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const extensions = yield* Effect.all([\n GraphBuilder.createExtension({\n id: `${meta.id}/space-search`,\n match: NodeMatcher.whenRoot,\n connector: Effect.fnUntraced(function* (node, get) {\n const client = yield* Capability.get(ClientCapabilities.Client);\n const layoutAtom = get(yield* Capability.atom(Common.Capability.Layout))[0];\n const layout = layoutAtom ? get(layoutAtom) : undefined;\n const { spaceId } = parseId(layout?.workspace);\n const space = spaceId ? client.spaces.get(spaceId) : null;\n\n return [\n {\n id: [node.id, 'search'].join(ATTENDABLE_PATH_SEPARATOR),\n type: DECK_COMPANION_TYPE,\n data: space,\n properties: {\n label: ['search label', { ns: meta.id }],\n icon: 'ph--magnifying-glass--regular',\n disposition: 'hidden',\n },\n },\n ];\n }),\n }),\n GraphBuilder.createExtension({\n id: meta.id,\n match: NodeMatcher.whenRoot,\n actions: () =>\n Effect.succeed([\n {\n id: SearchOperation.OpenSearch.meta.key,\n data: Effect.fnUntraced(function* () {\n yield* Operation.invoke(SearchOperation.OpenSearch);\n return false;\n }),\n properties: {\n label: ['search action label', { ns: meta.id }],\n icon: 'ph--magnifying-glass--regular',\n keyBinding: {\n macos: 'shift+meta+f',\n windows: 'shift+alt+f',\n },\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,0BAA0B;AACnC,SAASC,2BAA2BC,2BAA2B;AAC/D,SAASC,cAAcC,mBAAmB;AAC1C,SAASC,eAAe;AAKxB,IAAA,4BAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAChB,QAAMC,aAAa,OAAcC,WAAI;IACnCC,aAAaC,gBAAgB;MAC3BC,IAAI,GAAGC,KAAKD,EAAE;MACdE,OAAOC,YAAYC;MACnBC,WAAkBV,kBAAW,WAAWW,MAAMC,KAAG;AAC/C,cAAMC,SAAS,OAAOf,WAAWc,IAAIE,mBAAmBC,MAAM;AAC9D,cAAMC,aAAaJ,IAAI,OAAOd,WAAWmB,KAAKC,OAAOpB,WAAWqB,MAAM,CAAA,EAAG,CAAA;AACzE,cAAMC,SAASJ,aAAaJ,IAAII,UAAAA,IAAcK;AAC9C,cAAM,EAAEC,QAAO,IAAKC,QAAQH,QAAQI,SAAAA;AACpC,cAAMC,QAAQH,UAAUT,OAAOa,OAAOd,IAAIU,OAAAA,IAAW;AAErD,eAAO;UACL;YACEjB,IAAI;cAACM,KAAKN;cAAI;cAAUsB,KAAKC,yBAAAA;YAC7BC,MAAMC;YACNC,MAAMN;YACNO,YAAY;cACVC,OAAO;gBAAC;gBAAgB;kBAAEC,IAAI5B,KAAKD;gBAAG;;cACtC8B,MAAM;cACNC,aAAa;YACf;UACF;;MAEJ,CAAA;IACF,CAAA;IACAjC,aAAaC,gBAAgB;MAC3BC,IAAIC,KAAKD;MACTE,OAAOC,YAAYC;MACnB4B,SAAS,MACAC,eAAQ;QACb;UACEjC,IAAIkC,gBAAgBC,WAAWlC,KAAKmC;UACpCV,MAAa/B,kBAAW,aAAA;AACtB,mBAAO0C,UAAUC,OAAOJ,gBAAgBC,UAAU;AAClD,mBAAO;UACT,CAAA;UACAR,YAAY;YACVC,OAAO;cAAC;cAAuB;gBAAEC,IAAI5B,KAAKD;cAAG;;YAC7C8B,MAAM;YACNS,YAAY;cACVC,OAAO;cACPC,SAAS;YACX;UACF;QACF;OACD;IACL,CAAA;GACD;AAED,SAAOhD,WAAWiD,YAAY7B,OAAOpB,WAAWkD,iBAAiB/C,UAAAA;AACnE,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "Capability", "Common", "Operation", "ClientCapabilities", "ATTENDABLE_PATH_SEPARATOR", "DECK_COMPANION_TYPE", "GraphBuilder", "NodeMatcher", "parseId", "Capability", "makeModule", "fnUntraced", "extensions", "all", "GraphBuilder", "createExtension", "id", "meta", "match", "NodeMatcher", "whenRoot", "connector", "node", "get", "client", "ClientCapabilities", "Client", "layoutAtom", "atom", "Common", "Layout", "layout", "undefined", "spaceId", "parseId", "workspace", "space", "spaces", "join", "ATTENDABLE_PATH_SEPARATOR", "type", "DECK_COMPANION_TYPE", "data", "properties", "label", "ns", "icon", "disposition", "actions", "succeed", "SearchOperation", "OpenSearch", "key", "Operation", "invoke", "keyBinding", "macos", "windows", "contributes", "AppGraphBuilder"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/operation-resolver/operation-resolver.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, OperationResolver } from '@dxos/operation';\n\nimport { SearchOperation } from '../../types';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n return Capability.contributes(Common.Capability.OperationResolver, [\n OperationResolver.make({\n operation: SearchOperation.OpenSearch,\n handler: Effect.fnUntraced(function* () {\n yield* Operation.invoke(Common.LayoutOperation.UpdateComplementary, { subject: 'search' });\n }),\n }),\n ]);\n }),\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,YAAYC,cAAc;AACnC,SAASC,WAAWC,yBAAyB;AAI7C,IAAA,6BAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAChB,SAAOF,WAAWG,YAAYC,OAAOJ,WAAWK,mBAAmB;IACjEA,kBAAkBC,KAAK;MACrBC,WAAWC,gBAAgBC;MAC3BC,SAAgBR,kBAAW,aAAA;AACzB,eAAOS,UAAUC,OAAOR,OAAOS,gBAAgBC,qBAAqB;UAAEC,SAAS;QAAS,CAAA;MAC1F,CAAA;IACF,CAAA;GACD;AACH,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "Capability", "Common", "Operation", "OperationResolver", "Capability", "makeModule", "fnUntraced", "contributes", "Common", "OperationResolver", "make", "operation", "SearchOperation", "OpenSearch", "handler", "Operation", "invoke", "LayoutOperation", "UpdateComplementary", "subject"]
|
|
7
|
-
}
|