@dxos/plugin-search 0.8.4-main.a4bbb77 → 0.8.4-main.abd8ff62ef

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.
Files changed (146) hide show
  1. package/README.md +0 -1
  2. package/dist/lib/browser/SearchPlugin-PB5MWMS6.mjs +41 -0
  3. package/dist/lib/browser/SearchPlugin-PB5MWMS6.mjs.map +7 -0
  4. package/dist/lib/browser/index.mjs +281 -89
  5. package/dist/lib/browser/index.mjs.map +4 -4
  6. package/dist/lib/browser/meta.json +1 -1
  7. package/dist/lib/browser/translations.mjs +23 -0
  8. package/dist/lib/browser/translations.mjs.map +7 -0
  9. package/dist/types/src/SearchPlugin.d.ts +3 -1
  10. package/dist/types/src/SearchPlugin.d.ts.map +1 -1
  11. package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
  12. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  13. package/dist/types/src/capabilities/index.d.ts +5 -3
  14. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  15. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  16. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  17. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  18. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  19. package/dist/types/src/components/SearchResultStack/SearchResultStack.d.ts +9 -0
  20. package/dist/types/src/components/SearchResultStack/SearchResultStack.d.ts.map +1 -0
  21. package/dist/types/src/components/SearchResultStack/index.d.ts +2 -0
  22. package/dist/types/src/components/SearchResultStack/index.d.ts.map +1 -0
  23. package/dist/types/src/components/index.d.ts +1 -3
  24. package/dist/types/src/components/index.d.ts.map +1 -1
  25. package/dist/types/src/constants.d.ts +2 -0
  26. package/dist/types/src/constants.d.ts.map +1 -0
  27. package/dist/types/src/containers/SearchArticle/SearchArticle.d.ts +4 -0
  28. package/dist/types/src/containers/SearchArticle/SearchArticle.d.ts.map +1 -0
  29. package/dist/types/src/{components/Searchbar/Searchbar.stories.d.ts → containers/SearchArticle/SearchArticle.stories.d.ts} +3 -2
  30. package/dist/types/src/containers/SearchArticle/SearchArticle.stories.d.ts.map +1 -0
  31. package/dist/types/src/containers/SearchArticle/index.d.ts +2 -0
  32. package/dist/types/src/containers/SearchArticle/index.d.ts.map +1 -0
  33. package/dist/types/src/containers/SearchDialog/SearchDialog.d.ts +7 -0
  34. package/dist/types/src/containers/SearchDialog/SearchDialog.d.ts.map +1 -0
  35. package/dist/types/src/{components/SearchResults/SearchResults.stories.d.ts → containers/SearchDialog/SearchDialog.stories.d.ts} +4 -4
  36. package/dist/types/src/containers/SearchDialog/SearchDialog.stories.d.ts.map +1 -0
  37. package/dist/types/src/containers/SearchDialog/index.d.ts +2 -0
  38. package/dist/types/src/containers/SearchDialog/index.d.ts.map +1 -0
  39. package/dist/types/src/containers/index.d.ts +4 -0
  40. package/dist/types/src/containers/index.d.ts.map +1 -0
  41. package/dist/types/src/hooks/index.d.ts +1 -0
  42. package/dist/types/src/hooks/index.d.ts.map +1 -1
  43. package/dist/types/src/hooks/sync.d.ts +4 -3
  44. package/dist/types/src/hooks/sync.d.ts.map +1 -1
  45. package/dist/types/src/hooks/useGlobalSearch.d.ts +8 -4
  46. package/dist/types/src/hooks/useGlobalSearch.d.ts.map +1 -1
  47. package/dist/types/src/hooks/useSearchResults.d.ts +3 -2
  48. package/dist/types/src/hooks/useSearchResults.d.ts.map +1 -1
  49. package/dist/types/src/hooks/useWebSearch.d.ts +7 -4
  50. package/dist/types/src/hooks/useWebSearch.d.ts.map +1 -1
  51. package/dist/types/src/index.d.ts +3 -2
  52. package/dist/types/src/index.d.ts.map +1 -1
  53. package/dist/types/src/meta.d.ts +2 -2
  54. package/dist/types/src/meta.d.ts.map +1 -1
  55. package/dist/types/src/operations/definitions.d.ts +3 -0
  56. package/dist/types/src/operations/definitions.d.ts.map +1 -0
  57. package/dist/types/src/operations/index.d.ts +4 -0
  58. package/dist/types/src/operations/index.d.ts.map +1 -0
  59. package/dist/types/src/operations/open-search.d.ts +5 -0
  60. package/dist/types/src/operations/open-search.d.ts.map +1 -0
  61. package/dist/types/src/search/exa.d.ts +4 -2
  62. package/dist/types/src/search/exa.d.ts.map +1 -1
  63. package/dist/types/src/translations.d.ts +15 -10
  64. package/dist/types/src/translations.d.ts.map +1 -1
  65. package/dist/types/src/types/index.d.ts +0 -1
  66. package/dist/types/src/types/index.d.ts.map +1 -1
  67. package/dist/types/src/types/search.d.ts +1 -20
  68. package/dist/types/src/types/search.d.ts.map +1 -1
  69. package/dist/types/tsconfig.tsbuildinfo +1 -1
  70. package/package.json +73 -47
  71. package/src/SearchPlugin.tsx +30 -45
  72. package/src/capabilities/app-graph-builder.ts +56 -69
  73. package/src/capabilities/index.ts +8 -4
  74. package/src/capabilities/operation-handler.ts +16 -0
  75. package/src/capabilities/react-surface.tsx +65 -52
  76. package/src/components/SearchResultStack/SearchResultStack.tsx +118 -0
  77. package/src/components/SearchResultStack/index.ts +5 -0
  78. package/src/components/index.ts +1 -3
  79. package/src/constants.ts +7 -0
  80. package/src/containers/SearchArticle/SearchArticle.stories.tsx +79 -0
  81. package/src/containers/SearchArticle/SearchArticle.tsx +60 -0
  82. package/src/containers/SearchArticle/index.ts +5 -0
  83. package/src/containers/SearchDialog/SearchDialog.stories.tsx +108 -0
  84. package/src/containers/SearchDialog/SearchDialog.tsx +93 -0
  85. package/src/containers/SearchDialog/index.ts +5 -0
  86. package/src/containers/index.ts +8 -0
  87. package/src/hooks/index.ts +2 -0
  88. package/src/hooks/sync.test.ts +9 -7
  89. package/src/hooks/sync.ts +28 -32
  90. package/src/hooks/useGlobalSearch.tsx +32 -13
  91. package/src/hooks/useSearchResults.ts +7 -4
  92. package/src/hooks/useWebSearch.ts +24 -13
  93. package/src/index.ts +10 -3
  94. package/src/meta.ts +9 -5
  95. package/src/operations/definitions.ts +17 -0
  96. package/src/operations/index.ts +9 -0
  97. package/src/operations/open-search.ts +24 -0
  98. package/src/search/exa.test.ts +9 -11
  99. package/src/search/exa.ts +10 -7
  100. package/src/translations.ts +10 -9
  101. package/src/types/command-score.d.ts +16 -0
  102. package/src/types/index.ts +0 -1
  103. package/src/types/search.ts +1 -25
  104. package/dist/lib/browser/app-graph-builder-GWNVDUTC.mjs +0 -77
  105. package/dist/lib/browser/app-graph-builder-GWNVDUTC.mjs.map +0 -7
  106. package/dist/lib/browser/chunk-5N6LDSFF.mjs +0 -18
  107. package/dist/lib/browser/chunk-5N6LDSFF.mjs.map +0 -7
  108. package/dist/lib/browser/chunk-NDOA4O75.mjs +0 -21
  109. package/dist/lib/browser/chunk-NDOA4O75.mjs.map +0 -7
  110. package/dist/lib/browser/chunk-YJGLEPHU.mjs +0 -190
  111. package/dist/lib/browser/chunk-YJGLEPHU.mjs.map +0 -7
  112. package/dist/lib/browser/intent-resolver-2JXJD6Q3.mjs +0 -22
  113. package/dist/lib/browser/intent-resolver-2JXJD6Q3.mjs.map +0 -7
  114. package/dist/lib/browser/react-surface-GWNMYPYS.mjs +0 -468
  115. package/dist/lib/browser/react-surface-GWNMYPYS.mjs.map +0 -7
  116. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  117. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  118. package/dist/types/src/components/Search.stories.d.ts +0 -19
  119. package/dist/types/src/components/Search.stories.d.ts.map +0 -1
  120. package/dist/types/src/components/SearchDialog.d.ts +0 -7
  121. package/dist/types/src/components/SearchDialog.d.ts.map +0 -1
  122. package/dist/types/src/components/SearchMain.d.ts +0 -7
  123. package/dist/types/src/components/SearchMain.d.ts.map +0 -1
  124. package/dist/types/src/components/SearchResults/SearchResults.d.ts +0 -20
  125. package/dist/types/src/components/SearchResults/SearchResults.d.ts.map +0 -1
  126. package/dist/types/src/components/SearchResults/SearchResults.stories.d.ts.map +0 -1
  127. package/dist/types/src/components/SearchResults/index.d.ts +0 -2
  128. package/dist/types/src/components/SearchResults/index.d.ts.map +0 -1
  129. package/dist/types/src/components/Searchbar/Searchbar.d.ts +0 -14
  130. package/dist/types/src/components/Searchbar/Searchbar.d.ts.map +0 -1
  131. package/dist/types/src/components/Searchbar/Searchbar.stories.d.ts.map +0 -1
  132. package/dist/types/src/components/Searchbar/index.d.ts +0 -2
  133. package/dist/types/src/components/Searchbar/index.d.ts.map +0 -1
  134. package/dist/types/src/types/action.d.ts +0 -13
  135. package/dist/types/src/types/action.d.ts.map +0 -1
  136. package/src/capabilities/intent-resolver.ts +0 -18
  137. package/src/components/Search.stories.tsx +0 -67
  138. package/src/components/SearchDialog.tsx +0 -124
  139. package/src/components/SearchMain.tsx +0 -68
  140. package/src/components/SearchResults/SearchResults.stories.tsx +0 -58
  141. package/src/components/SearchResults/SearchResults.tsx +0 -86
  142. package/src/components/SearchResults/index.ts +0 -5
  143. package/src/components/Searchbar/Searchbar.stories.tsx +0 -28
  144. package/src/components/Searchbar/Searchbar.tsx +0 -67
  145. package/src/components/Searchbar/index.ts +0 -5
  146. package/src/types/action.tsx +0 -16
package/package.json CHANGED
@@ -1,76 +1,102 @@
1
1
  {
2
2
  "name": "@dxos/plugin-search",
3
- "version": "0.8.4-main.a4bbb77",
4
- "description": "Braneframe sketch plugin",
3
+ "version": "0.8.4-main.abd8ff62ef",
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,
10
14
  "type": "module",
15
+ "imports": {
16
+ "#capabilities": "./src/capabilities/index.ts",
17
+ "#components": "./src/components/index.ts",
18
+ "#containers": "./src/containers/index.ts",
19
+ "#hooks": "./src/hooks/index.ts",
20
+ "#meta": "./src/meta.ts",
21
+ "#operations": "./src/operations/index.ts",
22
+ "#translations": "./src/translations.ts",
23
+ "#types": "./src/types/index.ts"
24
+ },
11
25
  "exports": {
12
26
  ".": {
13
27
  "source": "./src/index.ts",
14
28
  "types": "./dist/types/src/index.d.ts",
15
- "browser": "./dist/lib/browser/index.mjs"
29
+ "browser": "./dist/lib/browser/index.mjs",
30
+ "node": "./dist/lib/node-esm/index.mjs"
31
+ },
32
+ "./translations": {
33
+ "source": "./src/translations.ts",
34
+ "types": "./dist/types/src/translations.d.ts",
35
+ "browser": "./dist/lib/browser/translations.mjs",
36
+ "node": "./dist/lib/node-esm/translations.mjs"
16
37
  }
17
38
  },
18
39
  "types": "dist/types/src/index.d.ts",
19
- "typesVersions": {
20
- "*": {}
21
- },
22
40
  "files": [
23
41
  "dist",
24
42
  "src"
25
43
  ],
26
44
  "dependencies": {
27
- "@preact-signals/safe-react": "^0.9.0",
28
45
  "exa-js": "^1.5.12",
29
46
  "main-thread-scheduling": "^14.1.1",
30
- "@dxos/ai": "0.8.4-main.a4bbb77",
31
- "@dxos/app-framework": "0.8.4-main.a4bbb77",
32
- "@dxos/assistant": "0.8.4-main.a4bbb77",
33
- "@dxos/debug": "0.8.4-main.a4bbb77",
34
- "@dxos/blueprints": "0.8.4-main.a4bbb77",
35
- "@dxos/echo": "0.8.4-main.a4bbb77",
36
- "@dxos/echo-protocol": "0.8.4-main.a4bbb77",
37
- "@dxos/echo-schema": "0.8.4-main.a4bbb77",
38
- "@dxos/effect": "0.8.4-main.a4bbb77",
39
- "@dxos/invariant": "0.8.4-main.a4bbb77",
40
- "@dxos/live-object": "0.8.4-main.a4bbb77",
41
- "@dxos/log": "0.8.4-main.a4bbb77",
42
- "@dxos/plugin-client": "0.8.4-main.a4bbb77",
43
- "@dxos/plugin-deck": "0.8.4-main.a4bbb77",
44
- "@dxos/plugin-graph": "0.8.4-main.a4bbb77",
45
- "@dxos/plugin-space": "0.8.4-main.a4bbb77",
46
- "@dxos/react-client": "0.8.4-main.a4bbb77",
47
- "@dxos/react-ui-searchlist": "0.8.4-main.a4bbb77",
48
- "@dxos/schema": "0.8.4-main.a4bbb77",
49
- "@dxos/react-ui-stack": "0.8.4-main.a4bbb77",
50
- "@dxos/util": "0.8.4-main.a4bbb77"
47
+ "@dxos/app-toolkit": "0.8.4-main.abd8ff62ef",
48
+ "@dxos/ai": "0.8.4-main.abd8ff62ef",
49
+ "@dxos/app-framework": "0.8.4-main.abd8ff62ef",
50
+ "@dxos/async": "0.8.4-main.abd8ff62ef",
51
+ "@dxos/assistant": "0.8.4-main.abd8ff62ef",
52
+ "@dxos/compute": "0.8.4-main.abd8ff62ef",
53
+ "@dxos/debug": "0.8.4-main.abd8ff62ef",
54
+ "@dxos/echo": "0.8.4-main.abd8ff62ef",
55
+ "@dxos/echo-protocol": "0.8.4-main.abd8ff62ef",
56
+ "@dxos/echo-query": "0.8.4-main.abd8ff62ef",
57
+ "@dxos/invariant": "0.8.4-main.abd8ff62ef",
58
+ "@dxos/effect": "0.8.4-main.abd8ff62ef",
59
+ "@dxos/log": "0.8.4-main.abd8ff62ef",
60
+ "@dxos/plugin-client": "0.8.4-main.abd8ff62ef",
61
+ "@dxos/plugin-graph": "0.8.4-main.abd8ff62ef",
62
+ "@dxos/plugin-deck": "0.8.4-main.abd8ff62ef",
63
+ "@dxos/react-client": "0.8.4-main.abd8ff62ef",
64
+ "@dxos/plugin-space": "0.8.4-main.abd8ff62ef",
65
+ "@dxos/react-ui-attention": "0.8.4-main.abd8ff62ef",
66
+ "@dxos/react-ui-components": "0.8.4-main.abd8ff62ef",
67
+ "@dxos/react-ui-list": "0.8.4-main.abd8ff62ef",
68
+ "@dxos/react-ui-mosaic": "0.8.4-main.abd8ff62ef",
69
+ "@dxos/schema": "0.8.4-main.abd8ff62ef",
70
+ "@dxos/react-ui-search": "0.8.4-main.abd8ff62ef",
71
+ "@dxos/react-ui-stack": "0.8.4-main.abd8ff62ef",
72
+ "@dxos/types": "0.8.4-main.abd8ff62ef",
73
+ "@dxos/util": "0.8.4-main.abd8ff62ef",
74
+ "@dxos/react-ui-menu": "0.8.4-main.abd8ff62ef"
51
75
  },
52
76
  "devDependencies": {
53
- "@effect-rx/rx-react": "0.42.4",
54
- "@effect/platform": "0.92.1",
55
- "@types/react": "~19.2.0",
56
- "@types/react-dom": "~19.2.0",
57
- "effect": "3.18.3",
58
- "react": "~19.2.0",
59
- "react-dom": "~19.2.0",
60
- "vite": "7.1.9",
61
- "@dxos/random": "0.8.4-main.a4bbb77",
62
- "@dxos/react-ui": "0.8.4-main.a4bbb77",
63
- "@dxos/react-ui-theme": "0.8.4-main.a4bbb77",
64
- "@dxos/storybook-utils": "0.8.4-main.a4bbb77"
77
+ "@effect-atom/atom-react": "^0.5.0",
78
+ "@effect/platform": "0.94.4",
79
+ "@types/react": "~19.2.7",
80
+ "@types/react-dom": "~19.2.3",
81
+ "effect": "3.20.0",
82
+ "react": "~19.2.3",
83
+ "react-dom": "~19.2.3",
84
+ "vite": "^8.0.10",
85
+ "@dxos/plugin-testing": "0.8.4-main.abd8ff62ef",
86
+ "@dxos/plugin-preview": "0.8.4-main.abd8ff62ef",
87
+ "@dxos/react-ui": "0.8.4-main.abd8ff62ef",
88
+ "@dxos/random": "0.8.4-main.abd8ff62ef",
89
+ "@dxos/storybook-utils": "0.8.4-main.abd8ff62ef",
90
+ "@dxos/ui-theme": "0.8.4-main.abd8ff62ef"
65
91
  },
66
92
  "peerDependencies": {
67
- "@effect-rx/rx-react": "^0.34.1",
68
- "@effect/platform": "^0.80.12",
69
- "effect": "^3.13.3",
70
- "react": "^19.0.0",
71
- "react-dom": "^19.0.0",
72
- "@dxos/react-ui": "0.8.4-main.a4bbb77",
73
- "@dxos/react-ui-theme": "0.8.4-main.a4bbb77"
93
+ "@effect-atom/atom-react": "^0.5.0",
94
+ "@effect/platform": "0.94.4",
95
+ "effect": "3.20.0",
96
+ "react": "~19.2.3",
97
+ "react-dom": "~19.2.3",
98
+ "@dxos/react-ui": "0.8.4-main.abd8ff62ef",
99
+ "@dxos/ui-theme": "0.8.4-main.abd8ff62ef"
74
100
  },
75
101
  "publishConfig": {
76
102
  "access": "public"
@@ -2,52 +2,37 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { Capabilities, Events, contributes, defineModule, definePlugin } from '@dxos/app-framework';
5
+ import { Plugin } from '@dxos/app-framework';
6
+ import { AppPlugin } from '@dxos/app-toolkit';
6
7
 
7
- import { AppGraphBuilder, IntentResolver, ReactSurface } from './capabilities';
8
- import { SEARCH_RESULT, meta } from './meta';
9
- import { translations } from './translations';
10
- import { type SearchResult } from './types';
8
+ import { AppGraphBuilder, OperationHandler, ReactSurface } from '#capabilities';
9
+ import { SEARCH_RESULT, meta } from '#meta';
10
+ import { translations } from '#translations';
11
+ import { type SearchResult } from '#types';
11
12
 
12
- export const SearchPlugin = definePlugin(meta, () => [
13
- defineModule({
14
- id: `${meta.id}/module/translations`,
15
- activatesOn: Events.SetupTranslations,
16
- activate: () => contributes(Capabilities.Translations, translations),
17
- }),
18
- defineModule({
19
- id: `${meta.id}/module/metadata`,
20
- activatesOn: Events.SetupMetadata,
21
- activate: () =>
22
- contributes(Capabilities.Metadata, {
23
- id: SEARCH_RESULT,
24
- metadata: {
25
- parse: (item: SearchResult, type: string) => {
26
- switch (type) {
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,
29
+ },
30
+ },
47
31
  }),
48
- defineModule({
49
- id: `${meta.id}/module/react-surface`,
50
- activatesOn: Events.SetupReactSurface,
51
- activate: ReactSurface,
52
- }),
53
- ]);
32
+ AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),
33
+ AppPlugin.addSurfaceModule({ activate: ReactSurface }),
34
+ AppPlugin.addTranslationsModule({ translations }),
35
+ Plugin.make,
36
+ );
37
+
38
+ export default SearchPlugin;
@@ -2,78 +2,65 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Rx } from '@effect-rx/rx-react';
6
- import { Option, pipe } from 'effect';
5
+ import * as Effect from 'effect/Effect';
7
6
 
8
- import { Capabilities, type PluginContext, contributes, createIntent } from '@dxos/app-framework';
9
- import { ClientCapabilities } from '@dxos/plugin-client';
10
- import { ATTENDABLE_PATH_SEPARATOR, DECK_COMPANION_TYPE } from '@dxos/plugin-deck/types';
11
- import { ROOT_ID, createExtension, rxFromSignal } from '@dxos/plugin-graph';
12
- import { parseId } from '@dxos/react-client/echo';
7
+ import { Capability } from '@dxos/app-framework';
8
+ import { AppCapabilities, AppNode, getSpaceIdFromPath } from '@dxos/app-toolkit';
9
+ import { Operation } from '@dxos/compute';
10
+ import { ClientCapabilities } from '@dxos/plugin-client/types';
11
+ import { GraphBuilder, NodeMatcher } from '@dxos/plugin-graph';
12
+ import { linkedSegment } from '@dxos/react-ui-attention';
13
13
 
14
- import { meta } from '../meta';
15
- import { SearchAction } from '../types';
14
+ import { meta } from '#meta';
15
+ import { SearchOperation } from '#operations';
16
16
 
17
- export default (context: PluginContext) =>
18
- contributes(Capabilities.AppGraphBuilder, [
19
- createExtension({
20
- id: `${meta.id}/space-search`,
21
- connector: (node) =>
22
- Rx.make((get) =>
23
- pipe(
24
- get(node),
25
- Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),
26
- Option.map((node) => {
27
- const workspace = get(rxFromSignal(() => context.getCapability(Capabilities.Layout).workspace));
28
- const client = context.getCapability(ClientCapabilities.Client);
29
- const { spaceId } = parseId(workspace);
30
- const space = spaceId ? client.spaces.get(spaceId) : null;
17
+ export default Capability.makeModule(
18
+ Effect.fnUntraced(function* () {
19
+ const extensions = yield* Effect.all([
20
+ GraphBuilder.createExtension({
21
+ id: 'space-search',
22
+ match: NodeMatcher.whenRoot,
23
+ connector: Effect.fnUntraced(function* (node, get) {
24
+ const client = yield* Capability.get(ClientCapabilities.Client);
25
+ const layoutAtom = get(yield* Capability.atom(AppCapabilities.Layout))[0];
26
+ const layout = layoutAtom ? get(layoutAtom) : undefined;
27
+ const spaceId = layout?.workspace ? getSpaceIdFromPath(layout.workspace) : undefined;
28
+ const space = spaceId ? client.spaces.get(spaceId) : null;
31
29
 
32
- return [
33
- {
34
- id: [node.id, 'search'].join(ATTENDABLE_PATH_SEPARATOR),
35
- type: DECK_COMPANION_TYPE,
36
- data: space,
37
- properties: {
38
- label: ['search label', { ns: meta.id }],
39
- icon: 'ph--magnifying-glass--regular',
40
- disposition: 'hidden',
41
- },
42
- },
43
- ];
30
+ return [
31
+ AppNode.makeDeckCompanion({
32
+ id: linkedSegment('search'),
33
+ label: ['search.label', { ns: meta.id }],
34
+ icon: 'ph--magnifying-glass--regular',
35
+ data: space,
44
36
  }),
45
- Option.getOrElse(() => []),
46
- ),
47
- ),
48
- }),
49
- createExtension({
50
- id: meta.id,
51
- actions: (node) =>
52
- Rx.make((get) =>
53
- pipe(
54
- get(node),
55
- Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),
56
- Option.map(() => {
57
- return [
58
- {
59
- id: SearchAction.OpenSearch._tag,
60
- data: async () => {
61
- const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
62
- await dispatch(createIntent(SearchAction.OpenSearch));
63
- },
64
- properties: {
65
- label: ['search action label', { ns: meta.id }],
66
- icon: 'ph--magnifying-glass--regular',
67
- keyBinding: {
68
- macos: 'shift+meta+f',
69
- windows: 'shift+alt+f',
70
- },
71
- },
37
+ ];
38
+ }),
39
+ }),
40
+ GraphBuilder.createExtension({
41
+ id: 'root',
42
+ match: NodeMatcher.whenRoot,
43
+ actions: () =>
44
+ Effect.succeed([
45
+ {
46
+ id: SearchOperation.OpenSearch.meta.key,
47
+ data: Effect.fnUntraced(function* () {
48
+ yield* Operation.invoke(SearchOperation.OpenSearch);
49
+ return false;
50
+ }),
51
+ properties: {
52
+ label: ['search-action.label', { ns: meta.id }],
53
+ icon: 'ph--magnifying-glass--regular',
54
+ keyBinding: {
55
+ macos: 'shift+meta+f',
56
+ windows: 'shift+alt+f',
72
57
  },
73
- ];
74
- }),
75
- Option.getOrElse(() => []),
76
- ),
77
- ),
78
- }),
79
- ]);
58
+ },
59
+ },
60
+ ]),
61
+ }),
62
+ ]);
63
+
64
+ return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);
65
+ }),
66
+ );
@@ -2,8 +2,12 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { lazy } from '@dxos/app-framework';
5
+ import { Capability } from '@dxos/app-framework';
6
+ import { OperationHandlerSet } from '@dxos/compute';
6
7
 
7
- export const AppGraphBuilder = lazy(() => import('./app-graph-builder'));
8
- export const IntentResolver = lazy(() => import('./intent-resolver'));
9
- export const ReactSurface = lazy(() => import('./react-surface'));
8
+ export const AppGraphBuilder = Capability.lazy('AppGraphBuilder', () => import('./app-graph-builder'));
9
+ export const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(
10
+ 'OperationHandler',
11
+ () => import('./operation-handler'),
12
+ );
13
+ export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
@@ -0,0 +1,16 @@
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 type { OperationHandlerSet } from '@dxos/compute';
9
+
10
+ import { SearchOperationHandlerSet } from '#operations';
11
+
12
+ export default Capability.makeModule<OperationHandlerSet.OperationHandlerSet>(
13
+ Effect.fnUntraced(function* () {
14
+ return Capability.contributes(Capabilities.OperationHandler, SearchOperationHandlerSet);
15
+ }),
16
+ );
@@ -2,58 +2,71 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import React from 'react';
5
+ import * as Effect from 'effect/Effect';
6
+ import React, { type ComponentProps } from 'react';
6
7
 
7
- import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
8
- import { useActiveSpace } from '@dxos/plugin-space';
8
+ import { Capabilities, Capability } from '@dxos/app-framework';
9
+ import { Surface } from '@dxos/app-framework/ui';
10
+ import { AppSurface, useActiveSpace } from '@dxos/app-toolkit/ui';
9
11
  import { type Space, isSpace } from '@dxos/react-client/echo';
10
12
 
11
- import { SEARCH_DIALOG, SearchDialog, type SearchDialogProps, SearchMain } from '../components';
12
- import { SearchContextProvider } from '../hooks';
13
-
14
- export default () =>
15
- contributes(Capabilities.ReactSurface, [
16
- createSurface({
17
- id: SEARCH_DIALOG,
18
- role: 'dialog',
19
- filter: (data): data is { props: SearchDialogProps } => data.component === SEARCH_DIALOG,
20
- component: ({ data }) => (
21
- <SearchContextProvider>
22
- <SearchDialog {...data.props} />
23
- </SearchContextProvider>
24
- ),
25
- }),
26
- createSurface({
27
- id: `${SEARCH_DIALOG}/search-input`,
28
- role: 'search-input',
29
- component: () => {
30
- const space = useActiveSpace();
31
- if (!space) {
32
- return null;
33
- }
34
-
35
- return (
36
- <SearchContextProvider>
37
- <SearchMain space={space} />
38
- </SearchContextProvider>
39
- );
40
- },
41
- }),
42
- createSurface({
43
- id: `${SEARCH_DIALOG}/search`,
44
- role: 'deck-companion--search',
45
- filter: (data): data is { subject: Space } => isSpace(data.subject),
46
- component: ({ data }) => {
47
- const space = data.subject;
48
- if (!space) {
49
- return null;
50
- }
51
-
52
- return (
53
- <SearchContextProvider>
54
- <SearchMain space={space} />
55
- </SearchContextProvider>
56
- );
57
- },
58
- }),
59
- ]);
13
+ import { SearchArticle, SearchDialog } from '#containers';
14
+ import { SearchContextProvider } from '#hooks';
15
+
16
+ import { SEARCH_DIALOG } from '../constants';
17
+
18
+ export default Capability.makeModule(() =>
19
+ Effect.succeed(
20
+ Capability.contributes(Capabilities.ReactSurface, [
21
+ Surface.create({
22
+ id: SEARCH_DIALOG,
23
+ filter: AppSurface.component<ComponentProps<typeof SearchDialog>>(AppSurface.Dialog, SEARCH_DIALOG),
24
+ component: ({ data }) => {
25
+ const space = useActiveSpace();
26
+ if (!space) {
27
+ return null;
28
+ }
29
+
30
+ return (
31
+ <SearchContextProvider>
32
+ <SearchDialog {...data.props} space={space} />
33
+ </SearchContextProvider>
34
+ );
35
+ },
36
+ }),
37
+ Surface.create({
38
+ id: `${SEARCH_DIALOG}.search-input`,
39
+ role: 'search-input',
40
+ component: () => {
41
+ const space = useActiveSpace();
42
+ if (!space) {
43
+ return null;
44
+ }
45
+
46
+ return (
47
+ <SearchContextProvider>
48
+ <SearchArticle space={space} />
49
+ </SearchContextProvider>
50
+ );
51
+ },
52
+ }),
53
+ Surface.create({
54
+ id: `${SEARCH_DIALOG}.search`,
55
+ role: 'deck-companion--search',
56
+ filter: (data): data is { subject: Space } => isSpace(data.subject),
57
+ component: ({ data }) => {
58
+ const space = data.subject;
59
+ if (!space) {
60
+ return null;
61
+ }
62
+
63
+ return (
64
+ <SearchContextProvider>
65
+ <SearchArticle space={space} />
66
+ </SearchContextProvider>
67
+ );
68
+ },
69
+ }),
70
+ ]),
71
+ ),
72
+ );
@@ -0,0 +1,118 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import React, { type KeyboardEvent, forwardRef, useCallback, useMemo, useState } from 'react';
6
+
7
+ import { Surface } from '@dxos/app-framework/ui';
8
+ import { AppSurface, useObjectMenuItems } from '@dxos/app-toolkit/ui';
9
+ import { Entity } from '@dxos/echo';
10
+ import { Card, Toolbar } from '@dxos/react-ui';
11
+ import { ScrollArea } from '@dxos/react-ui';
12
+ import { Menu } from '@dxos/react-ui-menu';
13
+ import { type MosaicTileProps, Mosaic, useMosaicContainer, Focus } from '@dxos/react-ui-mosaic';
14
+ import { type SearchResult } from '@dxos/react-ui-search';
15
+ import { composable, composableProps } from '@dxos/ui-theme';
16
+
17
+ //
18
+ // SearchResultStack
19
+ //
20
+
21
+ export type SearchResultStackProps = {
22
+ results: SearchResult[];
23
+ };
24
+
25
+ export const SearchResultStack = composable<HTMLDivElement, SearchResultStackProps>(
26
+ ({ results, ...props }, forwardedRef) => {
27
+ const [viewport, setViewport] = useState<HTMLElement | null>(null);
28
+ const items = useMemo(() => results.map((result) => ({ result })), [results]);
29
+
30
+ const handleKeyDown = useCallback((event: KeyboardEvent<HTMLDivElement>) => {
31
+ if (event.key === 'Enter') {
32
+ event.preventDefault();
33
+ (document.activeElement as HTMLElement | null)?.click();
34
+ }
35
+ }, []);
36
+
37
+ return (
38
+ <Focus.Group asChild {...composableProps(props)} onKeyDown={handleKeyDown} ref={forwardedRef}>
39
+ <Mosaic.Container asChild>
40
+ <ScrollArea.Root orientation='vertical' padding centered>
41
+ <ScrollArea.Viewport ref={setViewport}>
42
+ <Mosaic.VirtualStack
43
+ Tile={SearchResultTile}
44
+ classNames='my-2'
45
+ gap={8}
46
+ items={items}
47
+ draggable={false}
48
+ getId={(item) => item.result.id}
49
+ getScrollElement={() => viewport}
50
+ estimateSize={() => 150}
51
+ />
52
+ </ScrollArea.Viewport>
53
+ </ScrollArea.Root>
54
+ </Mosaic.Container>
55
+ </Focus.Group>
56
+ );
57
+ },
58
+ );
59
+
60
+ SearchResultStack.displayName = 'SearchResultStack';
61
+
62
+ //
63
+ // SearchResultTile
64
+ //
65
+
66
+ type SearchResultTileData = {
67
+ result: SearchResult;
68
+ };
69
+
70
+ type SearchResultTileProps = Pick<MosaicTileProps<SearchResultTileData>, 'location' | 'data' | 'current'>;
71
+
72
+ /**
73
+ * Search result tile that uses Surface to render object content.
74
+ */
75
+ const SearchResultTile = forwardRef<HTMLDivElement, SearchResultTileProps>(
76
+ ({ data, location, current }, forwardedRef) => {
77
+ const { result } = data;
78
+ const menuItems = useObjectMenuItems(result.object);
79
+ const { setCurrentId } = useMosaicContainer('SearchResultTile');
80
+
81
+ const handleCurrentChange = useCallback(() => {
82
+ setCurrentId(result.id);
83
+ }, [result.id, setCurrentId]);
84
+
85
+ return (
86
+ <Menu.Root>
87
+ <Mosaic.Tile
88
+ asChild
89
+ classNames='dx-hover dx-current dx-selected'
90
+ id={result.id}
91
+ data={data}
92
+ location={location}
93
+ >
94
+ <Focus.Item asChild current={current} onCurrentChange={handleCurrentChange}>
95
+ <Card.Root ref={forwardedRef} role='button' classNames='cursor-pointer'>
96
+ <Card.Toolbar>
97
+ <Card.IconBlock />
98
+ <Card.Title>{result.label ?? (result.object && Entity.getLabel(result.object))}</Card.Title>
99
+ <Menu.Trigger asChild disabled={!menuItems?.length}>
100
+ <Toolbar.IconButton
101
+ iconOnly
102
+ variant='ghost'
103
+ icon='ph--dots-three-vertical--regular'
104
+ label='Actions'
105
+ />
106
+ </Menu.Trigger>
107
+ <Menu.Content items={menuItems} />
108
+ </Card.Toolbar>
109
+ <Surface.Surface type={AppSurface.Card} data={{ subject: result.object }} limit={1} />
110
+ </Card.Root>
111
+ </Focus.Item>
112
+ </Mosaic.Tile>
113
+ </Menu.Root>
114
+ );
115
+ },
116
+ );
117
+
118
+ SearchResultTile.displayName = 'SearchResultTile';