@dxos/plugin-search 0.8.4-main.c4373fc → 0.8.4-main.c85a9c8dae
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-E6336HCX.mjs +110 -0
- package/dist/lib/browser/SearchDialog-E6336HCX.mjs.map +7 -0
- package/dist/lib/browser/SearchMain-24ZNJB24.mjs +100 -0
- package/dist/lib/browser/SearchMain-24ZNJB24.mjs.map +7 -0
- package/dist/lib/browser/SpaceMain-IGCYHL7R.mjs +154 -0
- package/dist/lib/browser/SpaceMain-IGCYHL7R.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-NUJ2FOVQ.mjs +82 -0
- package/dist/lib/browser/app-graph-builder-NUJ2FOVQ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-5N6LDSFF.mjs → chunk-HRIWTRJV.mjs} +6 -2
- package/dist/lib/browser/chunk-HRIWTRJV.mjs.map +7 -0
- package/dist/lib/browser/chunk-I7YWQSUZ.mjs +26 -0
- package/dist/lib/browser/chunk-I7YWQSUZ.mjs.map +7 -0
- package/dist/lib/browser/chunk-NB4JZIOE.mjs +282 -0
- package/dist/lib/browser/chunk-NB4JZIOE.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +52 -57
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-QEGN4ZKN.mjs +26 -0
- package/dist/lib/browser/operation-resolver-QEGN4ZKN.mjs.map +7 -0
- package/dist/lib/browser/react-surface-FLO4YTFP.mjs +73 -0
- package/dist/lib/browser/react-surface-FLO4YTFP.mjs.map +7 -0
- package/dist/types/src/SearchPlugin.d.ts +2 -1
- package/dist/types/src/SearchPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +3 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/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 +6 -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/SpaceMain/SpaceMain.d.ts +6 -0
- package/dist/types/src/containers/SpaceMain/SpaceMain.d.ts.map +1 -0
- package/dist/types/src/containers/SpaceMain/index.d.ts +3 -0
- package/dist/types/src/containers/SpaceMain/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +6 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/sync.d.ts +3 -2
- package/dist/types/src/hooks/sync.d.ts.map +1 -1
- package/dist/types/src/hooks/useGlobalSearch.d.ts +7 -3
- package/dist/types/src/hooks/useGlobalSearch.d.ts.map +1 -1
- package/dist/types/src/hooks/useSearchResults.d.ts +3 -2
- package/dist/types/src/hooks/useSearchResults.d.ts.map +1 -1
- package/dist/types/src/hooks/useWebSearch.d.ts +6 -3
- package/dist/types/src/hooks/useWebSearch.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/search/exa.d.ts +3 -1
- package/dist/types/src/search/exa.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -1
- package/dist/types/src/types/action.d.ts +13 -10
- package/dist/types/src/types/action.d.ts.map +1 -1
- package/dist/types/src/types/search.d.ts +3 -7
- package/dist/types/src/types/search.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +56 -46
- package/src/SearchPlugin.tsx +25 -42
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +71 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/index.ts +3 -5
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +24 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +72 -0
- package/src/components/index.ts +0 -4
- package/src/constants.ts +7 -0
- package/src/containers/SearchDialog/SearchDialog.tsx +120 -0
- package/src/containers/SearchDialog/index.ts +7 -0
- package/src/containers/SearchMain/SearchMain.tsx +103 -0
- package/src/containers/SearchMain/index.ts +7 -0
- package/src/containers/SpaceMain/SpaceMain.tsx +180 -0
- package/src/containers/SpaceMain/index.ts +7 -0
- package/src/containers/index.ts +11 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/sync.test.ts +6 -4
- package/src/hooks/sync.ts +25 -30
- package/src/hooks/useGlobalSearch.tsx +31 -12
- package/src/hooks/useSearchResults.ts +7 -4
- package/src/hooks/useWebSearch.ts +20 -9
- package/src/meta.ts +7 -3
- package/src/search/exa.test.ts +9 -11
- package/src/search/exa.ts +6 -5
- package/src/translations.ts +1 -1
- package/src/types/action.tsx +8 -6
- package/src/types/command-score.d.ts +16 -0
- package/src/types/search.ts +3 -9
- package/dist/lib/browser/app-graph-builder-YME7SN7O.mjs +0 -78
- package/dist/lib/browser/app-graph-builder-YME7SN7O.mjs.map +0 -7
- package/dist/lib/browser/chunk-5N6LDSFF.mjs.map +0 -7
- package/dist/lib/browser/chunk-WN3TVQLV.mjs +0 -190
- package/dist/lib/browser/chunk-WN3TVQLV.mjs.map +0 -7
- package/dist/lib/browser/chunk-YJGHPWUO.mjs +0 -21
- package/dist/lib/browser/chunk-YJGHPWUO.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-XNVR4XRX.mjs +0 -22
- package/dist/lib/browser/intent-resolver-XNVR4XRX.mjs.map +0 -7
- package/dist/lib/browser/react-surface-YOGLADC4.mjs +0 -470
- package/dist/lib/browser/react-surface-YOGLADC4.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/components/Search.stories.d.ts +0 -19
- package/dist/types/src/components/Search.stories.d.ts.map +0 -1
- package/dist/types/src/components/SearchDialog.d.ts.map +0 -1
- package/dist/types/src/components/SearchMain.d.ts +0 -7
- package/dist/types/src/components/SearchMain.d.ts.map +0 -1
- package/dist/types/src/components/SearchResults/SearchResults.d.ts +0 -20
- package/dist/types/src/components/SearchResults/SearchResults.d.ts.map +0 -1
- package/dist/types/src/components/SearchResults/SearchResults.stories.d.ts +0 -16
- package/dist/types/src/components/SearchResults/SearchResults.stories.d.ts.map +0 -1
- package/dist/types/src/components/SearchResults/index.d.ts +0 -2
- package/dist/types/src/components/SearchResults/index.d.ts.map +0 -1
- package/dist/types/src/components/Searchbar/Searchbar.d.ts +0 -14
- package/dist/types/src/components/Searchbar/Searchbar.d.ts.map +0 -1
- package/dist/types/src/components/Searchbar/Searchbar.stories.d.ts +0 -13
- package/dist/types/src/components/Searchbar/Searchbar.stories.d.ts.map +0 -1
- package/dist/types/src/components/Searchbar/index.d.ts +0 -2
- package/dist/types/src/components/Searchbar/index.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -80
- package/src/capabilities/intent-resolver.ts +0 -18
- package/src/capabilities/react-surface.tsx +0 -59
- package/src/components/Search.stories.tsx +0 -67
- package/src/components/SearchDialog.tsx +0 -124
- package/src/components/SearchMain.tsx +0 -68
- package/src/components/SearchResults/SearchResults.stories.tsx +0 -58
- package/src/components/SearchResults/SearchResults.tsx +0 -86
- package/src/components/SearchResults/index.ts +0 -5
- package/src/components/Searchbar/Searchbar.stories.tsx +0 -28
- package/src/components/Searchbar/Searchbar.tsx +0 -67
- package/src/components/Searchbar/index.ts +0 -5
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-search",
|
|
3
|
-
"version": "0.8.4-main.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.8.4-main.c85a9c8dae",
|
|
4
|
+
"description": "Search plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
13
|
"sideEffects": true,
|
|
@@ -12,64 +16,70 @@
|
|
|
12
16
|
".": {
|
|
13
17
|
"source": "./src/index.ts",
|
|
14
18
|
"types": "./dist/types/src/index.d.ts",
|
|
15
|
-
"browser": "./dist/lib/browser/index.mjs"
|
|
19
|
+
"browser": "./dist/lib/browser/index.mjs",
|
|
20
|
+
"node": "./dist/lib/node-esm/index.mjs"
|
|
16
21
|
}
|
|
17
22
|
},
|
|
18
23
|
"types": "dist/types/src/index.d.ts",
|
|
19
|
-
"typesVersions": {
|
|
20
|
-
"*": {}
|
|
21
|
-
},
|
|
22
24
|
"files": [
|
|
23
25
|
"dist",
|
|
24
26
|
"src"
|
|
25
27
|
],
|
|
26
28
|
"dependencies": {
|
|
27
|
-
"@preact-signals/safe-react": "^0.9.0",
|
|
28
29
|
"exa-js": "^1.5.12",
|
|
29
30
|
"main-thread-scheduling": "^14.1.1",
|
|
30
|
-
"@dxos/ai": "0.8.4-main.
|
|
31
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/plugin-
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/plugin-
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/react-ui-
|
|
31
|
+
"@dxos/ai": "0.8.4-main.c85a9c8dae",
|
|
32
|
+
"@dxos/app-framework": "0.8.4-main.c85a9c8dae",
|
|
33
|
+
"@dxos/app-toolkit": "0.8.4-main.c85a9c8dae",
|
|
34
|
+
"@dxos/assistant": "0.8.4-main.c85a9c8dae",
|
|
35
|
+
"@dxos/async": "0.8.4-main.c85a9c8dae",
|
|
36
|
+
"@dxos/debug": "0.8.4-main.c85a9c8dae",
|
|
37
|
+
"@dxos/blueprints": "0.8.4-main.c85a9c8dae",
|
|
38
|
+
"@dxos/echo": "0.8.4-main.c85a9c8dae",
|
|
39
|
+
"@dxos/echo-query": "0.8.4-main.c85a9c8dae",
|
|
40
|
+
"@dxos/effect": "0.8.4-main.c85a9c8dae",
|
|
41
|
+
"@dxos/invariant": "0.8.4-main.c85a9c8dae",
|
|
42
|
+
"@dxos/echo-protocol": "0.8.4-main.c85a9c8dae",
|
|
43
|
+
"@dxos/plugin-deck": "0.8.4-main.c85a9c8dae",
|
|
44
|
+
"@dxos/operation": "0.8.4-main.c85a9c8dae",
|
|
45
|
+
"@dxos/plugin-client": "0.8.4-main.c85a9c8dae",
|
|
46
|
+
"@dxos/plugin-graph": "0.8.4-main.c85a9c8dae",
|
|
47
|
+
"@dxos/plugin-space": "0.8.4-main.c85a9c8dae",
|
|
48
|
+
"@dxos/react-client": "0.8.4-main.c85a9c8dae",
|
|
49
|
+
"@dxos/react-ui-menu": "0.8.4-main.c85a9c8dae",
|
|
50
|
+
"@dxos/react-ui-components": "0.8.4-main.c85a9c8dae",
|
|
51
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.c85a9c8dae",
|
|
52
|
+
"@dxos/react-ui-searchlist": "0.8.4-main.c85a9c8dae",
|
|
53
|
+
"@dxos/react-ui-stack": "0.8.4-main.c85a9c8dae",
|
|
54
|
+
"@dxos/schema": "0.8.4-main.c85a9c8dae",
|
|
55
|
+
"@dxos/types": "0.8.4-main.c85a9c8dae",
|
|
56
|
+
"@dxos/util": "0.8.4-main.c85a9c8dae",
|
|
57
|
+
"@dxos/log": "0.8.4-main.c85a9c8dae"
|
|
50
58
|
},
|
|
51
59
|
"devDependencies": {
|
|
52
|
-
"@effect-
|
|
53
|
-
"@effect/platform": "0.
|
|
54
|
-
"@types/react": "~19.2.
|
|
55
|
-
"@types/react-dom": "~19.2.
|
|
56
|
-
"effect": "3.
|
|
57
|
-
"react": "~19.2.
|
|
58
|
-
"react-dom": "~19.2.
|
|
59
|
-
"vite": "7.1.
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
60
|
+
"@effect-atom/atom-react": "^0.5.0",
|
|
61
|
+
"@effect/platform": "0.94.4",
|
|
62
|
+
"@types/react": "~19.2.7",
|
|
63
|
+
"@types/react-dom": "~19.2.3",
|
|
64
|
+
"effect": "3.19.16",
|
|
65
|
+
"react": "~19.2.3",
|
|
66
|
+
"react-dom": "~19.2.3",
|
|
67
|
+
"vite": "^7.1.11",
|
|
68
|
+
"@dxos/plugin-preview": "0.8.4-main.c85a9c8dae",
|
|
69
|
+
"@dxos/plugin-testing": "0.8.4-main.c85a9c8dae",
|
|
70
|
+
"@dxos/random": "0.8.4-main.c85a9c8dae",
|
|
71
|
+
"@dxos/storybook-utils": "0.8.4-main.c85a9c8dae",
|
|
72
|
+
"@dxos/ui-theme": "0.8.4-main.c85a9c8dae",
|
|
73
|
+
"@dxos/react-ui": "0.8.4-main.c85a9c8dae"
|
|
64
74
|
},
|
|
65
75
|
"peerDependencies": {
|
|
66
|
-
"@effect-
|
|
67
|
-
"@effect/platform": "
|
|
68
|
-
"effect": "
|
|
69
|
-
"react": "
|
|
70
|
-
"react-dom": "
|
|
71
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
72
|
-
"@dxos/
|
|
76
|
+
"@effect-atom/atom-react": "^0.5.0",
|
|
77
|
+
"@effect/platform": "0.94.4",
|
|
78
|
+
"effect": "3.19.16",
|
|
79
|
+
"react": "~19.2.3",
|
|
80
|
+
"react-dom": "~19.2.3",
|
|
81
|
+
"@dxos/react-ui": "0.8.4-main.c85a9c8dae",
|
|
82
|
+
"@dxos/ui-theme": "0.8.4-main.c85a9c8dae"
|
|
73
83
|
},
|
|
74
84
|
"publishConfig": {
|
|
75
85
|
"access": "public"
|
package/src/SearchPlugin.tsx
CHANGED
|
@@ -2,52 +2,35 @@
|
|
|
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
|
-
import { AppGraphBuilder,
|
|
8
|
+
import { AppGraphBuilder, OperationResolver, ReactSurface } from './capabilities';
|
|
8
9
|
import { SEARCH_RESULT, meta } from './meta';
|
|
9
10
|
import { translations } from './translations';
|
|
10
11
|
import { type SearchResult } from './types';
|
|
11
12
|
|
|
12
|
-
export const SearchPlugin =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
case 'node':
|
|
28
|
-
return { id: item.id, label: item.label, data: item.object };
|
|
29
|
-
case 'object':
|
|
30
|
-
return item.object;
|
|
31
|
-
case 'view-object':
|
|
32
|
-
return item;
|
|
33
|
-
}
|
|
34
|
-
},
|
|
13
|
+
export const SearchPlugin = Plugin.define(meta).pipe(
|
|
14
|
+
AppPlugin.addAppGraphModule({ activate: AppGraphBuilder }),
|
|
15
|
+
AppPlugin.addMetadataModule({
|
|
16
|
+
metadata: {
|
|
17
|
+
id: SEARCH_RESULT,
|
|
18
|
+
metadata: {
|
|
19
|
+
parse: (item: SearchResult, type: string) => {
|
|
20
|
+
switch (type) {
|
|
21
|
+
case 'node':
|
|
22
|
+
return { id: item.id, label: item.label, data: item.object };
|
|
23
|
+
case 'object':
|
|
24
|
+
return item.object;
|
|
25
|
+
case 'view-object':
|
|
26
|
+
return item;
|
|
27
|
+
}
|
|
35
28
|
},
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
defineModule({
|
|
39
|
-
id: `${meta.id}/module/app-graph-builder`,
|
|
40
|
-
activatesOn: Events.SetupAppGraph,
|
|
41
|
-
activate: AppGraphBuilder,
|
|
42
|
-
}),
|
|
43
|
-
defineModule({
|
|
44
|
-
id: `${meta.id}/module/intent-resolver`,
|
|
45
|
-
activatesOn: Events.SetupIntentResolver,
|
|
46
|
-
activate: IntentResolver,
|
|
47
|
-
}),
|
|
48
|
-
defineModule({
|
|
49
|
-
id: `${meta.id}/module/react-surface`,
|
|
50
|
-
activatesOn: Events.SetupReactSurface,
|
|
51
|
-
activate: ReactSurface,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
52
31
|
}),
|
|
53
|
-
|
|
32
|
+
AppPlugin.addOperationResolverModule({ activate: OperationResolver }),
|
|
33
|
+
AppPlugin.addSurfaceModule({ activate: ReactSurface }),
|
|
34
|
+
AppPlugin.addTranslationsModule({ translations }),
|
|
35
|
+
Plugin.make,
|
|
36
|
+
);
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
|
+
import { Operation } from '@dxos/operation';
|
|
10
|
+
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
11
|
+
import { ATTENDABLE_PATH_SEPARATOR, DECK_COMPANION_TYPE } from '@dxos/plugin-deck/types';
|
|
12
|
+
import { GraphBuilder, NodeMatcher } from '@dxos/plugin-graph';
|
|
13
|
+
import { parseId } from '@dxos/react-client/echo';
|
|
14
|
+
|
|
15
|
+
import { meta } from '../../meta';
|
|
16
|
+
import { SearchOperation } from '../../types';
|
|
17
|
+
|
|
18
|
+
export default Capability.makeModule(
|
|
19
|
+
Effect.fnUntraced(function* () {
|
|
20
|
+
const extensions = yield* Effect.all([
|
|
21
|
+
GraphBuilder.createExtension({
|
|
22
|
+
id: `${meta.id}/space-search`,
|
|
23
|
+
match: NodeMatcher.whenRoot,
|
|
24
|
+
connector: Effect.fnUntraced(function* (node, get) {
|
|
25
|
+
const client = yield* Capability.get(ClientCapabilities.Client);
|
|
26
|
+
const layoutAtom = get(yield* Capability.atom(AppCapabilities.Layout))[0];
|
|
27
|
+
const layout = layoutAtom ? get(layoutAtom) : undefined;
|
|
28
|
+
const { spaceId } = parseId(layout?.workspace);
|
|
29
|
+
const space = spaceId ? client.spaces.get(spaceId) : null;
|
|
30
|
+
|
|
31
|
+
return [
|
|
32
|
+
{
|
|
33
|
+
id: [node.id, 'search'].join(ATTENDABLE_PATH_SEPARATOR),
|
|
34
|
+
type: DECK_COMPANION_TYPE,
|
|
35
|
+
data: space,
|
|
36
|
+
properties: {
|
|
37
|
+
label: ['search label', { ns: meta.id }],
|
|
38
|
+
icon: 'ph--magnifying-glass--regular',
|
|
39
|
+
disposition: 'hidden',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
}),
|
|
44
|
+
}),
|
|
45
|
+
GraphBuilder.createExtension({
|
|
46
|
+
id: meta.id,
|
|
47
|
+
match: NodeMatcher.whenRoot,
|
|
48
|
+
actions: () =>
|
|
49
|
+
Effect.succeed([
|
|
50
|
+
{
|
|
51
|
+
id: SearchOperation.OpenSearch.meta.key,
|
|
52
|
+
data: Effect.fnUntraced(function* () {
|
|
53
|
+
yield* Operation.invoke(SearchOperation.OpenSearch);
|
|
54
|
+
return false;
|
|
55
|
+
}),
|
|
56
|
+
properties: {
|
|
57
|
+
label: ['search action label', { ns: meta.id }],
|
|
58
|
+
icon: 'ph--magnifying-glass--regular',
|
|
59
|
+
keyBinding: {
|
|
60
|
+
macos: 'shift+meta+f',
|
|
61
|
+
windows: 'shift+alt+f',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
]),
|
|
66
|
+
}),
|
|
67
|
+
]);
|
|
68
|
+
|
|
69
|
+
return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);
|
|
70
|
+
}),
|
|
71
|
+
);
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
export const IntentResolver = lazy(() => import('./intent-resolver'));
|
|
9
|
-
export const ReactSurface = lazy(() => import('./react-surface'));
|
|
5
|
+
export * from './app-graph-builder';
|
|
6
|
+
export * from './operation-resolver';
|
|
7
|
+
export * from './react-surface';
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { LayoutOperation } from '@dxos/app-toolkit';
|
|
9
|
+
import { Operation, OperationResolver } from '@dxos/operation';
|
|
10
|
+
|
|
11
|
+
import { SearchOperation } from '../../types';
|
|
12
|
+
|
|
13
|
+
export default Capability.makeModule(
|
|
14
|
+
Effect.fnUntraced(function* () {
|
|
15
|
+
return Capability.contributes(Capabilities.OperationResolver, [
|
|
16
|
+
OperationResolver.make({
|
|
17
|
+
operation: SearchOperation.OpenSearch,
|
|
18
|
+
handler: Effect.fnUntraced(function* () {
|
|
19
|
+
yield* Operation.invoke(LayoutOperation.UpdateComplementary, { subject: 'search' });
|
|
20
|
+
}),
|
|
21
|
+
}),
|
|
22
|
+
]);
|
|
23
|
+
}),
|
|
24
|
+
);
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
10
|
+
import { useActiveSpace } from '@dxos/plugin-space';
|
|
11
|
+
import { type Space, SpaceState, isSpace } from '@dxos/react-client/echo';
|
|
12
|
+
|
|
13
|
+
import { SEARCH_DIALOG } from '../../constants';
|
|
14
|
+
import { SearchDialog, type SearchDialogProps, SearchMain, SpaceMain } from '../../containers';
|
|
15
|
+
import { SearchContextProvider } from '../../hooks';
|
|
16
|
+
import { meta } from '../../meta';
|
|
17
|
+
|
|
18
|
+
export default Capability.makeModule(() =>
|
|
19
|
+
Effect.succeed(
|
|
20
|
+
Capability.contributes(Capabilities.ReactSurface, [
|
|
21
|
+
Surface.create({
|
|
22
|
+
id: SEARCH_DIALOG,
|
|
23
|
+
role: 'dialog',
|
|
24
|
+
filter: (data): data is { props: SearchDialogProps } => data.component === SEARCH_DIALOG,
|
|
25
|
+
component: ({ data }) => (
|
|
26
|
+
<SearchContextProvider>
|
|
27
|
+
<SearchDialog {...data.props} />
|
|
28
|
+
</SearchContextProvider>
|
|
29
|
+
),
|
|
30
|
+
}),
|
|
31
|
+
Surface.create({
|
|
32
|
+
id: `${SEARCH_DIALOG}/search-input`,
|
|
33
|
+
role: 'search-input',
|
|
34
|
+
component: () => {
|
|
35
|
+
const space = useActiveSpace();
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<SearchContextProvider>
|
|
39
|
+
<SearchMain space={space} />
|
|
40
|
+
</SearchContextProvider>
|
|
41
|
+
);
|
|
42
|
+
},
|
|
43
|
+
}),
|
|
44
|
+
Surface.create({
|
|
45
|
+
id: `${SEARCH_DIALOG}/search`,
|
|
46
|
+
role: 'deck-companion--search',
|
|
47
|
+
filter: (data): data is { subject: Space } => isSpace(data.subject),
|
|
48
|
+
component: ({ data }) => {
|
|
49
|
+
const space = data.subject;
|
|
50
|
+
if (!space) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<SearchContextProvider>
|
|
56
|
+
<SearchMain space={space} />
|
|
57
|
+
</SearchContextProvider>
|
|
58
|
+
);
|
|
59
|
+
},
|
|
60
|
+
}),
|
|
61
|
+
Surface.create({
|
|
62
|
+
id: `${meta.id}/space-article`,
|
|
63
|
+
role: 'article',
|
|
64
|
+
position: 'hoist',
|
|
65
|
+
filter: (data): data is { subject: Space } =>
|
|
66
|
+
// TODO(wittjosiah): Need to avoid shotgun parsing space state everywhere.
|
|
67
|
+
isSpace(data.subject) && data.subject.state.get() === SpaceState.SPACE_READY,
|
|
68
|
+
component: ({ data }) => <SpaceMain space={data.subject} />,
|
|
69
|
+
}),
|
|
70
|
+
]),
|
|
71
|
+
),
|
|
72
|
+
);
|
package/src/components/index.ts
CHANGED
package/src/constants.ts
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Option from 'effect/Option';
|
|
6
|
+
import React, { forwardRef, useCallback, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
9
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
10
|
+
import { useAppGraph, useLayout } from '@dxos/app-toolkit/ui';
|
|
11
|
+
import { Obj } from '@dxos/echo';
|
|
12
|
+
import { Graph, type Node } from '@dxos/plugin-graph';
|
|
13
|
+
import { useClient } from '@dxos/react-client';
|
|
14
|
+
import { Filter, useQuery } from '@dxos/react-client/echo';
|
|
15
|
+
import { Button, Dialog, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
16
|
+
import { SearchList } from '@dxos/react-ui-searchlist';
|
|
17
|
+
import { mx, osTranslations } from '@dxos/ui-theme';
|
|
18
|
+
|
|
19
|
+
import { useSearchResults } from '../../hooks';
|
|
20
|
+
import { meta } from '../../meta';
|
|
21
|
+
|
|
22
|
+
type SearchListResultProps = {
|
|
23
|
+
node: Node.Node;
|
|
24
|
+
onSelect?: (nodeId: string) => void;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const SearchListResult = forwardRef<HTMLDivElement, SearchListResultProps>(({ node, onSelect }, forwardedRef) => {
|
|
28
|
+
const { t } = useTranslation(meta.id);
|
|
29
|
+
const label = toLocalizedString(node?.properties.label ?? 'never', t);
|
|
30
|
+
const handleSelect = useCallback(() => {
|
|
31
|
+
onSelect?.(node!.id);
|
|
32
|
+
}, [node, onSelect]);
|
|
33
|
+
return (
|
|
34
|
+
<SearchList.Item
|
|
35
|
+
value={node!.id}
|
|
36
|
+
label={label}
|
|
37
|
+
icon={node?.properties.icon}
|
|
38
|
+
classNames='flex gap-2 items-center px-2'
|
|
39
|
+
onSelect={handleSelect}
|
|
40
|
+
ref={forwardedRef}
|
|
41
|
+
/>
|
|
42
|
+
);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export type SearchDialogProps = {
|
|
46
|
+
pivotId: string;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const SearchDialog = ({ pivotId }: SearchDialogProps) => {
|
|
50
|
+
const { t } = useTranslation(meta.id);
|
|
51
|
+
const { graph } = useAppGraph();
|
|
52
|
+
const layout = useLayout();
|
|
53
|
+
const closed = (Array.isArray(layout.inactive) ? layout.inactive : [layout.inactive])
|
|
54
|
+
.map((id) => (graph ? Graph.getNode(graph, id) : Option.none()))
|
|
55
|
+
.filter(Boolean);
|
|
56
|
+
const [queryString, setQueryString] = useState('');
|
|
57
|
+
const client = useClient();
|
|
58
|
+
const dangerouslyLoadAllObjects = useQuery(client.spaces, Filter.everything());
|
|
59
|
+
const [pending, results] = useSearchResults(queryString, dangerouslyLoadAllObjects);
|
|
60
|
+
const resultObjects = Array.from(results.keys());
|
|
61
|
+
const { invokePromise } = useOperationInvoker();
|
|
62
|
+
|
|
63
|
+
const handleSelect = useCallback(
|
|
64
|
+
async (nodeId: string) => {
|
|
65
|
+
await invokePromise(LayoutOperation.UpdateDialog, { state: false });
|
|
66
|
+
|
|
67
|
+
// If node is already present in the active parts, scroll to it and close the dialog.
|
|
68
|
+
const index = layout.active.findIndex((id) => id === nodeId);
|
|
69
|
+
if (index !== -1) {
|
|
70
|
+
await invokePromise(LayoutOperation.ScrollIntoView, { subject: nodeId });
|
|
71
|
+
} else {
|
|
72
|
+
await invokePromise(LayoutOperation.Open, {
|
|
73
|
+
subject: [nodeId],
|
|
74
|
+
pivotId,
|
|
75
|
+
positioning: 'end',
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
[pivotId, invokePromise, layout],
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const handleSearch = useCallback((query: string) => {
|
|
83
|
+
setQueryString(query);
|
|
84
|
+
}, []);
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<Dialog.Content>
|
|
88
|
+
<Dialog.Title>{t('search dialog title')}</Dialog.Title>
|
|
89
|
+
<SearchList.Root onSearch={handleSearch}>
|
|
90
|
+
<SearchList.Content classNames='max-h-[24rem] overflow-auto'>
|
|
91
|
+
<SearchList.Input placeholder={t('search placeholder')} />
|
|
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} />)
|
|
99
|
+
) : (
|
|
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>
|
|
114
|
+
</SearchList.Root>
|
|
115
|
+
<Dialog.Close asChild>
|
|
116
|
+
<Button variant='primary'>{t('close label', { ns: osTranslations })}</Button>
|
|
117
|
+
</Dialog.Close>
|
|
118
|
+
</Dialog.Content>
|
|
119
|
+
);
|
|
120
|
+
};
|