@dxos/plugin-search 0.8.4-main.72ec0f3 → 0.8.4-main.7996785055

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 (163) hide show
  1. package/README.md +0 -1
  2. package/dist/lib/browser/SearchDialog-DVLB2VC2.mjs +84 -0
  3. package/dist/lib/browser/SearchDialog-DVLB2VC2.mjs.map +7 -0
  4. package/dist/lib/browser/SearchMain-25GWFGDM.mjs +92 -0
  5. package/dist/lib/browser/SearchMain-25GWFGDM.mjs.map +7 -0
  6. package/dist/lib/browser/app-graph-builder-GTD4XFXW.mjs +79 -0
  7. package/dist/lib/browser/app-graph-builder-GTD4XFXW.mjs.map +7 -0
  8. package/dist/lib/browser/{chunk-ZEP4O5SU.mjs → chunk-CMFZ7CJK.mjs} +49 -58
  9. package/dist/lib/browser/chunk-CMFZ7CJK.mjs.map +7 -0
  10. package/dist/lib/browser/chunk-OGXI46DO.mjs +27 -0
  11. package/dist/lib/browser/chunk-OGXI46DO.mjs.map +7 -0
  12. package/dist/lib/browser/chunk-RX3VHGKJ.mjs +8 -0
  13. package/dist/lib/browser/chunk-RX3VHGKJ.mjs.map +7 -0
  14. package/dist/lib/browser/{chunk-GN2FSWTM.mjs → chunk-VZK2I4SR.mjs} +10 -3
  15. package/dist/lib/browser/chunk-VZK2I4SR.mjs.map +7 -0
  16. package/dist/lib/browser/chunk-W4E6FT6J.mjs +11 -0
  17. package/dist/lib/browser/chunk-W4E6FT6J.mjs.map +7 -0
  18. package/dist/lib/browser/index.mjs +47 -56
  19. package/dist/lib/browser/index.mjs.map +4 -4
  20. package/dist/lib/browser/meta.json +1 -1
  21. package/dist/lib/browser/open-search-HJI2ZI7N.mjs +23 -0
  22. package/dist/lib/browser/open-search-HJI2ZI7N.mjs.map +7 -0
  23. package/dist/lib/browser/operation-handler-GY2ZUYKH.mjs +16 -0
  24. package/dist/lib/browser/operation-handler-GY2ZUYKH.mjs.map +7 -0
  25. package/dist/lib/browser/react-surface-Y5BHTAJX.mjs +58 -0
  26. package/dist/lib/browser/react-surface-Y5BHTAJX.mjs.map +7 -0
  27. package/dist/types/src/SearchPlugin.d.ts +2 -1
  28. package/dist/types/src/SearchPlugin.d.ts.map +1 -1
  29. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
  30. package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
  31. package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
  32. package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
  33. package/dist/types/src/capabilities/index.d.ts +3 -3
  34. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  35. package/dist/types/src/capabilities/operation-handler/index.d.ts +4 -0
  36. package/dist/types/src/capabilities/operation-handler/index.d.ts.map +1 -0
  37. package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts +6 -0
  38. package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts.map +1 -0
  39. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  40. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  41. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  42. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  43. package/dist/types/src/components/index.d.ts +0 -3
  44. package/dist/types/src/components/index.d.ts.map +1 -1
  45. package/dist/types/src/constants.d.ts +2 -0
  46. package/dist/types/src/constants.d.ts.map +1 -0
  47. package/dist/types/src/containers/SearchDialog/SearchDialog.d.ts +6 -0
  48. package/dist/types/src/containers/SearchDialog/SearchDialog.d.ts.map +1 -0
  49. package/dist/types/src/containers/SearchDialog/SearchDialog.stories.d.ts +35 -0
  50. package/dist/types/src/containers/SearchDialog/SearchDialog.stories.d.ts.map +1 -0
  51. package/dist/types/src/containers/SearchDialog/index.d.ts +3 -0
  52. package/dist/types/src/containers/SearchDialog/index.d.ts.map +1 -0
  53. package/dist/types/src/containers/SearchMain/SearchMain.d.ts.map +1 -0
  54. package/dist/types/src/containers/SearchMain/index.d.ts +3 -0
  55. package/dist/types/src/containers/SearchMain/index.d.ts.map +1 -0
  56. package/dist/types/src/containers/index.d.ts +5 -0
  57. package/dist/types/src/containers/index.d.ts.map +1 -0
  58. package/dist/types/src/hooks/sync.d.ts +3 -2
  59. package/dist/types/src/hooks/sync.d.ts.map +1 -1
  60. package/dist/types/src/hooks/useGlobalSearch.d.ts +7 -3
  61. package/dist/types/src/hooks/useGlobalSearch.d.ts.map +1 -1
  62. package/dist/types/src/hooks/useSearchResults.d.ts +3 -2
  63. package/dist/types/src/hooks/useSearchResults.d.ts.map +1 -1
  64. package/dist/types/src/hooks/useWebSearch.d.ts +6 -3
  65. package/dist/types/src/hooks/useWebSearch.d.ts.map +1 -1
  66. package/dist/types/src/meta.d.ts +2 -2
  67. package/dist/types/src/meta.d.ts.map +1 -1
  68. package/dist/types/src/operations/definitions.d.ts +3 -0
  69. package/dist/types/src/operations/definitions.d.ts.map +1 -0
  70. package/dist/types/src/operations/index.d.ts +4 -0
  71. package/dist/types/src/operations/index.d.ts.map +1 -0
  72. package/dist/types/src/operations/open-search.d.ts +5 -0
  73. package/dist/types/src/operations/open-search.d.ts.map +1 -0
  74. package/dist/types/src/search/exa.d.ts +3 -1
  75. package/dist/types/src/search/exa.d.ts.map +1 -1
  76. package/dist/types/src/translations.d.ts +7 -1
  77. package/dist/types/src/translations.d.ts.map +1 -1
  78. package/dist/types/src/types/index.d.ts +0 -1
  79. package/dist/types/src/types/index.d.ts.map +1 -1
  80. package/dist/types/src/types/search.d.ts +3 -7
  81. package/dist/types/src/types/search.d.ts.map +1 -1
  82. package/dist/types/tsconfig.tsbuildinfo +1 -1
  83. package/package.json +56 -47
  84. package/src/SearchPlugin.tsx +25 -42
  85. package/src/capabilities/app-graph-builder/app-graph-builder.ts +70 -0
  86. package/src/capabilities/app-graph-builder/index.ts +7 -0
  87. package/src/capabilities/index.ts +3 -5
  88. package/src/capabilities/operation-handler/index.ts +11 -0
  89. package/src/capabilities/operation-handler/operation-handler.ts +16 -0
  90. package/src/capabilities/react-surface/index.ts +7 -0
  91. package/src/capabilities/react-surface/react-surface.tsx +62 -0
  92. package/src/components/index.ts +0 -4
  93. package/src/constants.ts +7 -0
  94. package/src/containers/SearchDialog/SearchDialog.stories.tsx +53 -0
  95. package/src/containers/SearchDialog/SearchDialog.tsx +104 -0
  96. package/src/containers/SearchDialog/index.ts +6 -0
  97. package/src/containers/SearchMain/SearchMain.tsx +92 -0
  98. package/src/containers/SearchMain/index.ts +7 -0
  99. package/src/containers/index.ts +10 -0
  100. package/src/hooks/sync.test.ts +6 -4
  101. package/src/hooks/sync.ts +22 -27
  102. package/src/hooks/useGlobalSearch.tsx +31 -12
  103. package/src/hooks/useSearchResults.ts +5 -2
  104. package/src/hooks/useWebSearch.ts +20 -9
  105. package/src/meta.ts +4 -4
  106. package/src/operations/definitions.ts +17 -0
  107. package/src/operations/index.ts +9 -0
  108. package/src/operations/open-search.ts +25 -0
  109. package/src/search/exa.test.ts +7 -7
  110. package/src/search/exa.ts +4 -3
  111. package/src/translations.ts +3 -1
  112. package/src/types/command-score.d.ts +16 -0
  113. package/src/types/index.ts +0 -1
  114. package/src/types/search.ts +3 -9
  115. package/dist/lib/browser/app-graph-builder-HQR6P4C7.mjs +0 -78
  116. package/dist/lib/browser/app-graph-builder-HQR6P4C7.mjs.map +0 -7
  117. package/dist/lib/browser/chunk-GN2FSWTM.mjs.map +0 -7
  118. package/dist/lib/browser/chunk-TCVYYI44.mjs +0 -21
  119. package/dist/lib/browser/chunk-TCVYYI44.mjs.map +0 -7
  120. package/dist/lib/browser/chunk-ZEP4O5SU.mjs.map +0 -7
  121. package/dist/lib/browser/intent-resolver-UYQA6UUQ.mjs +0 -22
  122. package/dist/lib/browser/intent-resolver-UYQA6UUQ.mjs.map +0 -7
  123. package/dist/lib/browser/react-surface-H5CKQVII.mjs +0 -307
  124. package/dist/lib/browser/react-surface-H5CKQVII.mjs.map +0 -7
  125. package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
  126. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  127. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  128. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  129. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  130. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  131. package/dist/types/src/components/Search.stories.d.ts +0 -16
  132. package/dist/types/src/components/Search.stories.d.ts.map +0 -1
  133. package/dist/types/src/components/SearchDialog.d.ts +0 -7
  134. package/dist/types/src/components/SearchDialog.d.ts.map +0 -1
  135. package/dist/types/src/components/SearchMain.d.ts.map +0 -1
  136. package/dist/types/src/components/SearchResults/SearchResults.d.ts +0 -20
  137. package/dist/types/src/components/SearchResults/SearchResults.d.ts.map +0 -1
  138. package/dist/types/src/components/SearchResults/SearchResults.stories.d.ts +0 -16
  139. package/dist/types/src/components/SearchResults/SearchResults.stories.d.ts.map +0 -1
  140. package/dist/types/src/components/SearchResults/index.d.ts +0 -2
  141. package/dist/types/src/components/SearchResults/index.d.ts.map +0 -1
  142. package/dist/types/src/components/Searchbar/Searchbar.d.ts +0 -10
  143. package/dist/types/src/components/Searchbar/Searchbar.d.ts.map +0 -1
  144. package/dist/types/src/components/Searchbar/Searchbar.stories.d.ts +0 -13
  145. package/dist/types/src/components/Searchbar/Searchbar.stories.d.ts.map +0 -1
  146. package/dist/types/src/components/Searchbar/index.d.ts +0 -2
  147. package/dist/types/src/components/Searchbar/index.d.ts.map +0 -1
  148. package/dist/types/src/types/action.d.ts +0 -13
  149. package/dist/types/src/types/action.d.ts.map +0 -1
  150. package/src/capabilities/app-graph-builder.ts +0 -80
  151. package/src/capabilities/intent-resolver.ts +0 -18
  152. package/src/capabilities/react-surface.tsx +0 -56
  153. package/src/components/Search.stories.tsx +0 -64
  154. package/src/components/SearchDialog.tsx +0 -136
  155. package/src/components/SearchMain.tsx +0 -62
  156. package/src/components/SearchResults/SearchResults.stories.tsx +0 -59
  157. package/src/components/SearchResults/SearchResults.tsx +0 -83
  158. package/src/components/SearchResults/index.ts +0 -5
  159. package/src/components/Searchbar/Searchbar.stories.tsx +0 -28
  160. package/src/components/Searchbar/Searchbar.tsx +0 -48
  161. package/src/components/Searchbar/index.ts +0 -5
  162. package/src/types/action.tsx +0 -16
  163. /package/dist/types/src/{components → containers/SearchMain}/SearchMain.d.ts +0 -0
package/package.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "@dxos/plugin-search",
3
- "version": "0.8.4-main.72ec0f3",
4
- "description": "Braneframe sketch plugin",
3
+ "version": "0.8.4-main.7996785055",
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,65 +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.72ec0f3",
31
- "@dxos/app-framework": "0.8.4-main.72ec0f3",
32
- "@dxos/blueprints": "0.8.4-main.72ec0f3",
33
- "@dxos/assistant": "0.8.4-main.72ec0f3",
34
- "@dxos/echo": "0.8.4-main.72ec0f3",
35
- "@dxos/debug": "0.8.4-main.72ec0f3",
36
- "@dxos/echo-protocol": "0.8.4-main.72ec0f3",
37
- "@dxos/effect": "0.8.4-main.72ec0f3",
38
- "@dxos/invariant": "0.8.4-main.72ec0f3",
39
- "@dxos/log": "0.8.4-main.72ec0f3",
40
- "@dxos/live-object": "0.8.4-main.72ec0f3",
41
- "@dxos/plugin-client": "0.8.4-main.72ec0f3",
42
- "@dxos/plugin-deck": "0.8.4-main.72ec0f3",
43
- "@dxos/plugin-graph": "0.8.4-main.72ec0f3",
44
- "@dxos/plugin-space": "0.8.4-main.72ec0f3",
45
- "@dxos/react-client": "0.8.4-main.72ec0f3",
46
- "@dxos/react-ui-stack": "0.8.4-main.72ec0f3",
47
- "@dxos/react-ui-searchlist": "0.8.4-main.72ec0f3",
48
- "@dxos/schema": "0.8.4-main.72ec0f3",
49
- "@dxos/util": "0.8.4-main.72ec0f3",
50
- "@dxos/types": "0.8.4-main.72ec0f3"
31
+ "@dxos/ai": "0.8.4-main.7996785055",
32
+ "@dxos/app-framework": "0.8.4-main.7996785055",
33
+ "@dxos/app-toolkit": "0.8.4-main.7996785055",
34
+ "@dxos/assistant": "0.8.4-main.7996785055",
35
+ "@dxos/blueprints": "0.8.4-main.7996785055",
36
+ "@dxos/debug": "0.8.4-main.7996785055",
37
+ "@dxos/async": "0.8.4-main.7996785055",
38
+ "@dxos/echo": "0.8.4-main.7996785055",
39
+ "@dxos/echo-protocol": "0.8.4-main.7996785055",
40
+ "@dxos/effect": "0.8.4-main.7996785055",
41
+ "@dxos/echo-query": "0.8.4-main.7996785055",
42
+ "@dxos/invariant": "0.8.4-main.7996785055",
43
+ "@dxos/operation": "0.8.4-main.7996785055",
44
+ "@dxos/plugin-client": "0.8.4-main.7996785055",
45
+ "@dxos/log": "0.8.4-main.7996785055",
46
+ "@dxos/plugin-space": "0.8.4-main.7996785055",
47
+ "@dxos/plugin-deck": "0.8.4-main.7996785055",
48
+ "@dxos/react-client": "0.8.4-main.7996785055",
49
+ "@dxos/plugin-graph": "0.8.4-main.7996785055",
50
+ "@dxos/react-ui-components": "0.8.4-main.7996785055",
51
+ "@dxos/react-ui-mosaic": "0.8.4-main.7996785055",
52
+ "@dxos/react-ui-search": "0.8.4-main.7996785055",
53
+ "@dxos/react-ui-menu": "0.8.4-main.7996785055",
54
+ "@dxos/react-ui-stack": "0.8.4-main.7996785055",
55
+ "@dxos/types": "0.8.4-main.7996785055",
56
+ "@dxos/util": "0.8.4-main.7996785055",
57
+ "@dxos/schema": "0.8.4-main.7996785055"
51
58
  },
52
59
  "devDependencies": {
53
- "@effect-atom/atom-react": "^0.3.4",
54
- "@effect/platform": "0.92.1",
55
- "@types/react": "~19.2.2",
56
- "@types/react-dom": "~19.2.2",
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.72ec0f3",
62
- "@dxos/react-ui-theme": "0.8.4-main.72ec0f3",
63
- "@dxos/storybook-utils": "0.8.4-main.72ec0f3",
64
- "@dxos/react-ui": "0.8.4-main.72ec0f3"
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.20.0",
65
+ "react": "~19.2.3",
66
+ "react-dom": "~19.2.3",
67
+ "vite": "^7.1.11",
68
+ "@dxos/plugin-testing": "0.8.4-main.7996785055",
69
+ "@dxos/random": "0.8.4-main.7996785055",
70
+ "@dxos/react-ui": "0.8.4-main.7996785055",
71
+ "@dxos/storybook-utils": "0.8.4-main.7996785055",
72
+ "@dxos/plugin-preview": "0.8.4-main.7996785055",
73
+ "@dxos/ui-theme": "0.8.4-main.7996785055"
65
74
  },
66
75
  "peerDependencies": {
67
- "@effect-atom/atom-react": "^0.3.4",
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.72ec0f3",
73
- "@dxos/react-ui-theme": "0.8.4-main.72ec0f3"
76
+ "@effect-atom/atom-react": "^0.5.0",
77
+ "@effect/platform": "0.94.4",
78
+ "effect": "3.20.0",
79
+ "react": "~19.2.3",
80
+ "react-dom": "~19.2.3",
81
+ "@dxos/react-ui": "0.8.4-main.7996785055",
82
+ "@dxos/ui-theme": "0.8.4-main.7996785055"
74
83
  },
75
84
  "publishConfig": {
76
85
  "access": "public"
@@ -2,52 +2,35 @@
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 { AppGraphBuilder, OperationHandler, 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 = 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,
47
- }),
48
- defineModule({
49
- id: `${meta.id}/module/react-surface`,
50
- activatesOn: Events.SetupReactSurface,
51
- activate: ReactSurface,
29
+ },
30
+ },
52
31
  }),
53
- ]);
32
+ AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),
33
+ AppPlugin.addSurfaceModule({ activate: ReactSurface }),
34
+ AppPlugin.addTranslationsModule({ translations }),
35
+ Plugin.make,
36
+ );
@@ -0,0 +1,70 @@
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, companionSegment, getSpaceIdFromPath } from '@dxos/app-toolkit';
9
+ import { Operation } from '@dxos/operation';
10
+ import { ClientCapabilities } from '@dxos/plugin-client';
11
+ import { DECK_COMPANION_TYPE } from '@dxos/plugin-deck/types';
12
+ import { GraphBuilder, NodeMatcher } from '@dxos/plugin-graph';
13
+
14
+ import { meta } from '../../meta';
15
+ import { SearchOperation } from '../../operations';
16
+
17
+ export default Capability.makeModule(
18
+ Effect.fnUntraced(function* () {
19
+ const extensions = yield* Effect.all([
20
+ GraphBuilder.createExtension({
21
+ id: `${meta.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;
29
+
30
+ return [
31
+ {
32
+ id: companionSegment('search'),
33
+ type: DECK_COMPANION_TYPE,
34
+ data: space,
35
+ properties: {
36
+ label: ['search label', { ns: meta.id }],
37
+ icon: 'ph--magnifying-glass--regular',
38
+ disposition: 'hidden',
39
+ },
40
+ },
41
+ ];
42
+ }),
43
+ }),
44
+ GraphBuilder.createExtension({
45
+ id: meta.id,
46
+ match: NodeMatcher.whenRoot,
47
+ actions: () =>
48
+ Effect.succeed([
49
+ {
50
+ id: SearchOperation.OpenSearch.meta.key,
51
+ data: Effect.fnUntraced(function* () {
52
+ yield* Operation.invoke(SearchOperation.OpenSearch);
53
+ return false;
54
+ }),
55
+ properties: {
56
+ label: ['search action label', { ns: meta.id }],
57
+ icon: 'ph--magnifying-glass--regular',
58
+ keyBinding: {
59
+ macos: 'shift+meta+f',
60
+ windows: 'shift+alt+f',
61
+ },
62
+ },
63
+ },
64
+ ]),
65
+ }),
66
+ ]);
67
+
68
+ return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);
69
+ }),
70
+ );
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Capability } from '@dxos/app-framework';
6
+
7
+ export const AppGraphBuilder = Capability.lazy('AppGraphBuilder', () => import('./app-graph-builder'));
@@ -2,8 +2,6 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { lazy } from '@dxos/app-framework';
6
-
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'));
5
+ export * from './app-graph-builder';
6
+ export * from './operation-handler';
7
+ export * from './react-surface';
@@ -0,0 +1,11 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Capability } from '@dxos/app-framework';
6
+ import { OperationHandlerSet } from '@dxos/operation';
7
+
8
+ export const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(
9
+ 'OperationHandler',
10
+ () => import('./operation-handler'),
11
+ );
@@ -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/operation';
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
+ );
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Capability } from '@dxos/app-framework';
6
+
7
+ export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
@@ -0,0 +1,62 @@
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, isSpace } from '@dxos/react-client/echo';
12
+
13
+ import { SEARCH_DIALOG } from '../../constants';
14
+ import { SearchDialog, type SearchDialogProps, SearchMain } from '../../containers';
15
+ import { SearchContextProvider } from '../../hooks';
16
+
17
+ export default Capability.makeModule(() =>
18
+ Effect.succeed(
19
+ Capability.contributes(Capabilities.ReactSurface, [
20
+ Surface.create({
21
+ id: SEARCH_DIALOG,
22
+ role: 'dialog',
23
+ filter: (data): data is { props: SearchDialogProps } => data.component === SEARCH_DIALOG,
24
+ component: ({ data }) => (
25
+ <SearchContextProvider>
26
+ <SearchDialog {...data.props} />
27
+ </SearchContextProvider>
28
+ ),
29
+ }),
30
+ Surface.create({
31
+ id: `${SEARCH_DIALOG}.search-input`,
32
+ role: 'search-input',
33
+ component: () => {
34
+ const space = useActiveSpace();
35
+
36
+ return (
37
+ <SearchContextProvider>
38
+ <SearchMain space={space} />
39
+ </SearchContextProvider>
40
+ );
41
+ },
42
+ }),
43
+ Surface.create({
44
+ id: `${SEARCH_DIALOG}.search`,
45
+ role: 'deck-companion--search',
46
+ filter: (data): data is { subject: Space } => isSpace(data.subject),
47
+ component: ({ data }) => {
48
+ const space = data.subject;
49
+ if (!space) {
50
+ return null;
51
+ }
52
+
53
+ return (
54
+ <SearchContextProvider>
55
+ <SearchMain space={space} />
56
+ </SearchContextProvider>
57
+ );
58
+ },
59
+ }),
60
+ ]),
61
+ ),
62
+ );
@@ -1,7 +1,3 @@
1
1
  //
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
-
5
- export * from './Searchbar';
6
- export * from './SearchMain';
7
- export * from './SearchDialog';
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { meta } from './meta';
6
+
7
+ export const SEARCH_DIALOG = `${meta.id}.SearchDialog`;
@@ -0,0 +1,53 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
+ import React from 'react';
7
+
8
+ import { OperationPlugin, RuntimePlugin } from '@dxos/app-framework';
9
+ import { withPluginManager } from '@dxos/app-framework/testing';
10
+ import { ClientPlugin } from '@dxos/plugin-client';
11
+ import { withClientProvider } from '@dxos/react-client/testing';
12
+ import { Dialog } from '@dxos/react-ui';
13
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
14
+
15
+ import { translations } from '../../translations';
16
+
17
+ import { SearchDialog } from './SearchDialog';
18
+
19
+ const DefaultStory = () => (
20
+ <Dialog.Root defaultOpen>
21
+ <Dialog.Overlay>
22
+ <SearchDialog pivotId='storybook' />
23
+ </Dialog.Overlay>
24
+ </Dialog.Root>
25
+ );
26
+
27
+ const meta = {
28
+ title: 'plugins/plugin-search/containers/SearchDialog',
29
+ component: SearchDialog,
30
+ render: DefaultStory,
31
+ decorators: [
32
+ withTheme(),
33
+ withLayout({ layout: 'fullscreen' }),
34
+ withClientProvider({ createIdentity: true }),
35
+ withPluginManager({
36
+ plugins: [RuntimePlugin(), OperationPlugin(), ClientPlugin({})],
37
+ }),
38
+ ],
39
+ parameters: {
40
+ layout: 'fullscreen',
41
+ translations,
42
+ },
43
+ } satisfies Meta<typeof SearchDialog>;
44
+
45
+ export default meta;
46
+
47
+ type Story = StoryObj<typeof meta>;
48
+
49
+ export const Default: Story = {
50
+ args: {
51
+ pivotId: 'storybook',
52
+ },
53
+ };
@@ -0,0 +1,104 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import React, { useCallback, useMemo, useState } from 'react';
6
+
7
+ import { useOperationInvoker } from '@dxos/app-framework/ui';
8
+ import { getObjectPathFromObject, LayoutOperation } from '@dxos/app-toolkit';
9
+ import { useLayout } from '@dxos/app-toolkit/ui';
10
+ import { Entity, Obj, Query } from '@dxos/echo';
11
+ import { useActiveSpace } from '@dxos/plugin-space';
12
+ import { Filter, useQuery } from '@dxos/react-client/echo';
13
+ import { Dialog, useTranslation } from '@dxos/react-ui';
14
+ import { SearchList } from '@dxos/react-ui-search';
15
+ import { Text } from '@dxos/schema';
16
+
17
+ import { useGlobalSearch, useGlobalSearchResults } from '../../hooks';
18
+ import { meta } from '../../meta';
19
+ import { type SearchResult } from '../../types';
20
+
21
+ export type SearchDialogProps = {
22
+ pivotId?: string;
23
+ };
24
+
25
+ export const SearchDialog = ({ pivotId: pivotIdProp }: SearchDialogProps) => {
26
+ const { t } = useTranslation(meta.id);
27
+ const layout = useLayout();
28
+ const pivotId = pivotIdProp ?? layout.active[layout.active.length - 1];
29
+ const { invokePromise } = useOperationInvoker();
30
+ const { setMatch } = useGlobalSearch();
31
+ const [query, setQuery] = useState<string>();
32
+
33
+ const space = useActiveSpace();
34
+ const objects = useQuery(
35
+ space?.db,
36
+ query === undefined
37
+ ? Query.select(Filter.nothing())
38
+ : Query.all(
39
+ Query.select(Filter.text(query, { type: 'full-text' })).select(Filter.not(Filter.type(Text.Text))),
40
+ Query.select(Filter.text(query, { type: 'full-text' }))
41
+ .select(Filter.type(Text.Text))
42
+ .referencedBy('org.dxos.type.document', 'content'),
43
+ ),
44
+ );
45
+
46
+ const results = useGlobalSearchResults(objects);
47
+ const allResults = useMemo(() => results.filter(({ object }) => object && Entity.getLabel(object)), [results]);
48
+
49
+ const handleSearch = useCallback(
50
+ (text: string) => {
51
+ setQuery(text);
52
+ setMatch?.(text);
53
+ },
54
+ [setMatch],
55
+ );
56
+
57
+ const handleSelect = useCallback(
58
+ async (result: SearchResult) => {
59
+ if (!result.object || !Obj.isObject(result.object)) {
60
+ return;
61
+ }
62
+
63
+ const qualifiedPath = getObjectPathFromObject(result.object);
64
+ await invokePromise(LayoutOperation.UpdateDialog, { state: false });
65
+ await invokePromise(LayoutOperation.Open, {
66
+ subject: [qualifiedPath],
67
+ pivotId,
68
+ positioning: 'end',
69
+ });
70
+ },
71
+ [pivotId, invokePromise],
72
+ );
73
+
74
+ return (
75
+ <Dialog.Content>
76
+ <Dialog.Header>
77
+ <Dialog.Title>{t('search dialog title')}</Dialog.Title>
78
+ <Dialog.Close asChild>
79
+ <Dialog.CloseIconButton />
80
+ </Dialog.Close>
81
+ </Dialog.Header>
82
+ <Dialog.Body>
83
+ <SearchList.Root onSearch={handleSearch}>
84
+ <SearchList.Content classNames='max-h-[24rem]'>
85
+ <SearchList.Input placeholder={t('search placeholder')} autoFocus />
86
+ <SearchList.Viewport>
87
+ {allResults.map((result) => (
88
+ <SearchList.Item
89
+ key={result.id}
90
+ value={result.id}
91
+ label={result.label ?? (result.object ? Entity.getLabel(result.object) : undefined) ?? result.id}
92
+ icon={result.icon}
93
+ onSelect={() => void handleSelect(result)}
94
+ classNames='flex gap-2 items-center'
95
+ />
96
+ ))}
97
+ {query && allResults.length === 0 && <SearchList.Empty>{t('empty results message')}</SearchList.Empty>}
98
+ </SearchList.Viewport>
99
+ </SearchList.Content>
100
+ </SearchList.Root>
101
+ </Dialog.Body>
102
+ </Dialog.Content>
103
+ );
104
+ };
@@ -0,0 +1,6 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ export { SearchDialog, type SearchDialogProps } from './SearchDialog';
6
+ export { SearchDialog as default } from './SearchDialog';