@dxos/plugin-search 0.8.4-main.f9ba587 → 0.8.4-main.fcfe5033a5

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 (156) hide show
  1. package/README.md +0 -1
  2. package/dist/lib/browser/index.mjs +328 -82
  3. package/dist/lib/browser/index.mjs.map +4 -4
  4. package/dist/lib/browser/meta.json +1 -1
  5. package/dist/types/src/SearchPlugin.d.ts +2 -1
  6. package/dist/types/src/SearchPlugin.d.ts.map +1 -1
  7. package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
  8. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  9. package/dist/types/src/capabilities/index.d.ts +5 -3
  10. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  11. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  12. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  13. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  14. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  15. package/dist/types/src/components/SearchResultStack/SearchResultStack.d.ts +9 -0
  16. package/dist/types/src/components/SearchResultStack/SearchResultStack.d.ts.map +1 -0
  17. package/dist/types/src/components/SearchResultStack/index.d.ts +2 -0
  18. package/dist/types/src/components/SearchResultStack/index.d.ts.map +1 -0
  19. package/dist/types/src/components/index.d.ts +1 -3
  20. package/dist/types/src/components/index.d.ts.map +1 -1
  21. package/dist/types/src/constants.d.ts +2 -0
  22. package/dist/types/src/constants.d.ts.map +1 -0
  23. package/dist/types/src/containers/SearchArticle/SearchArticle.d.ts +7 -0
  24. package/dist/types/src/containers/SearchArticle/SearchArticle.d.ts.map +1 -0
  25. package/dist/types/src/containers/SearchArticle/SearchArticle.stories.d.ts +15 -0
  26. package/dist/types/src/containers/SearchArticle/SearchArticle.stories.d.ts.map +1 -0
  27. package/dist/types/src/containers/SearchArticle/index.d.ts +2 -0
  28. package/dist/types/src/containers/SearchArticle/index.d.ts.map +1 -0
  29. package/dist/types/src/containers/SearchDialog/SearchDialog.d.ts +8 -0
  30. package/dist/types/src/containers/SearchDialog/SearchDialog.d.ts.map +1 -0
  31. package/dist/types/src/containers/SearchDialog/SearchDialog.stories.d.ts +17 -0
  32. package/dist/types/src/containers/SearchDialog/SearchDialog.stories.d.ts.map +1 -0
  33. package/dist/types/src/containers/SearchDialog/index.d.ts +3 -0
  34. package/dist/types/src/containers/SearchDialog/index.d.ts.map +1 -0
  35. package/dist/types/src/containers/index.d.ts +5 -0
  36. package/dist/types/src/containers/index.d.ts.map +1 -0
  37. package/dist/types/src/hooks/index.d.ts +1 -0
  38. package/dist/types/src/hooks/index.d.ts.map +1 -1
  39. package/dist/types/src/hooks/sync.d.ts +4 -3
  40. package/dist/types/src/hooks/sync.d.ts.map +1 -1
  41. package/dist/types/src/hooks/useGlobalSearch.d.ts +8 -4
  42. package/dist/types/src/hooks/useGlobalSearch.d.ts.map +1 -1
  43. package/dist/types/src/hooks/useSearchResults.d.ts +3 -2
  44. package/dist/types/src/hooks/useSearchResults.d.ts.map +1 -1
  45. package/dist/types/src/hooks/useWebSearch.d.ts +7 -4
  46. package/dist/types/src/hooks/useWebSearch.d.ts.map +1 -1
  47. package/dist/types/src/meta.d.ts +3 -4
  48. package/dist/types/src/meta.d.ts.map +1 -1
  49. package/dist/types/src/operations/definitions.d.ts +3 -0
  50. package/dist/types/src/operations/definitions.d.ts.map +1 -0
  51. package/dist/types/src/operations/index.d.ts +4 -0
  52. package/dist/types/src/operations/index.d.ts.map +1 -0
  53. package/dist/types/src/operations/open-search.d.ts +5 -0
  54. package/dist/types/src/operations/open-search.d.ts.map +1 -0
  55. package/dist/types/src/search/exa.d.ts +4 -4
  56. package/dist/types/src/search/exa.d.ts.map +1 -1
  57. package/dist/types/src/translations.d.ts +15 -9
  58. package/dist/types/src/translations.d.ts.map +1 -1
  59. package/dist/types/src/types/index.d.ts +1 -2
  60. package/dist/types/src/types/index.d.ts.map +1 -1
  61. package/dist/types/src/types/search.d.ts +1 -20
  62. package/dist/types/src/types/search.d.ts.map +1 -1
  63. package/dist/types/tsconfig.tsbuildinfo +1 -1
  64. package/package.json +67 -49
  65. package/src/SearchPlugin.tsx +30 -47
  66. package/src/capabilities/app-graph-builder.ts +56 -69
  67. package/src/capabilities/index.ts +8 -4
  68. package/src/capabilities/operation-handler.ts +16 -0
  69. package/src/capabilities/react-surface.tsx +51 -48
  70. package/src/components/SearchResultStack/SearchResultStack.tsx +118 -0
  71. package/src/components/SearchResultStack/index.ts +5 -0
  72. package/src/components/index.ts +1 -3
  73. package/src/constants.ts +7 -0
  74. package/src/containers/SearchArticle/SearchArticle.stories.tsx +80 -0
  75. package/src/containers/SearchArticle/SearchArticle.tsx +63 -0
  76. package/src/containers/SearchArticle/index.ts +5 -0
  77. package/src/containers/SearchDialog/SearchDialog.stories.tsx +109 -0
  78. package/src/containers/SearchDialog/SearchDialog.tsx +96 -0
  79. package/src/containers/SearchDialog/index.ts +6 -0
  80. package/src/containers/index.ts +10 -0
  81. package/src/hooks/index.ts +2 -0
  82. package/src/hooks/sync.test.ts +9 -7
  83. package/src/hooks/sync.ts +28 -32
  84. package/src/hooks/useGlobalSearch.tsx +33 -13
  85. package/src/hooks/useSearchResults.ts +9 -6
  86. package/src/hooks/useWebSearch.ts +23 -17
  87. package/src/meta.ts +10 -7
  88. package/src/operations/definitions.ts +17 -0
  89. package/src/operations/index.ts +9 -0
  90. package/src/operations/open-search.ts +24 -0
  91. package/src/search/exa.test.ts +9 -32
  92. package/src/search/exa.ts +140 -168
  93. package/src/translations.ts +10 -9
  94. package/src/types/command-score.d.ts +16 -0
  95. package/src/types/index.ts +1 -2
  96. package/src/types/search.ts +1 -25
  97. package/dist/lib/browser/app-graph-builder-V667YGDS.mjs +0 -77
  98. package/dist/lib/browser/app-graph-builder-V667YGDS.mjs.map +0 -7
  99. package/dist/lib/browser/chunk-2QKDUXCH.mjs +0 -21
  100. package/dist/lib/browser/chunk-2QKDUXCH.mjs.map +0 -7
  101. package/dist/lib/browser/chunk-KNS62YL2.mjs +0 -20
  102. package/dist/lib/browser/chunk-KNS62YL2.mjs.map +0 -7
  103. package/dist/lib/browser/chunk-LPB2XRYL.mjs +0 -190
  104. package/dist/lib/browser/chunk-LPB2XRYL.mjs.map +0 -7
  105. package/dist/lib/browser/intent-resolver-SPX5JVY7.mjs +0 -22
  106. package/dist/lib/browser/intent-resolver-SPX5JVY7.mjs.map +0 -7
  107. package/dist/lib/browser/react-surface-HMXHJSLE.mjs +0 -642
  108. package/dist/lib/browser/react-surface-HMXHJSLE.mjs.map +0 -7
  109. package/dist/lib/node-esm/app-graph-builder-IZHM72QQ.mjs +0 -78
  110. package/dist/lib/node-esm/app-graph-builder-IZHM72QQ.mjs.map +0 -7
  111. package/dist/lib/node-esm/chunk-L7BUHKLC.mjs +0 -192
  112. package/dist/lib/node-esm/chunk-L7BUHKLC.mjs.map +0 -7
  113. package/dist/lib/node-esm/chunk-N5SNYFMK.mjs +0 -22
  114. package/dist/lib/node-esm/chunk-N5SNYFMK.mjs.map +0 -7
  115. package/dist/lib/node-esm/chunk-Y7BGRQH5.mjs +0 -22
  116. package/dist/lib/node-esm/chunk-Y7BGRQH5.mjs.map +0 -7
  117. package/dist/lib/node-esm/index.mjs +0 -113
  118. package/dist/lib/node-esm/index.mjs.map +0 -7
  119. package/dist/lib/node-esm/intent-resolver-MFPFD3XC.mjs +0 -23
  120. package/dist/lib/node-esm/intent-resolver-MFPFD3XC.mjs.map +0 -7
  121. package/dist/lib/node-esm/meta.json +0 -1
  122. package/dist/lib/node-esm/react-surface-WHU5EEAQ.mjs +0 -643
  123. package/dist/lib/node-esm/react-surface-WHU5EEAQ.mjs.map +0 -7
  124. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  125. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  126. package/dist/types/src/components/Search.stories.d.ts +0 -15
  127. package/dist/types/src/components/Search.stories.d.ts.map +0 -1
  128. package/dist/types/src/components/SearchDialog.d.ts +0 -7
  129. package/dist/types/src/components/SearchDialog.d.ts.map +0 -1
  130. package/dist/types/src/components/SearchMain.d.ts +0 -7
  131. package/dist/types/src/components/SearchMain.d.ts.map +0 -1
  132. package/dist/types/src/components/SearchResults/SearchResults.d.ts +0 -20
  133. package/dist/types/src/components/SearchResults/SearchResults.d.ts.map +0 -1
  134. package/dist/types/src/components/SearchResults/SearchResults.stories.d.ts +0 -12
  135. package/dist/types/src/components/SearchResults/SearchResults.stories.d.ts.map +0 -1
  136. package/dist/types/src/components/SearchResults/index.d.ts +0 -2
  137. package/dist/types/src/components/SearchResults/index.d.ts.map +0 -1
  138. package/dist/types/src/components/Searchbar/Searchbar.d.ts +0 -14
  139. package/dist/types/src/components/Searchbar/Searchbar.d.ts.map +0 -1
  140. package/dist/types/src/components/Searchbar/Searchbar.stories.d.ts +0 -11
  141. package/dist/types/src/components/Searchbar/Searchbar.stories.d.ts.map +0 -1
  142. package/dist/types/src/components/Searchbar/index.d.ts +0 -2
  143. package/dist/types/src/components/Searchbar/index.d.ts.map +0 -1
  144. package/dist/types/src/types/action.d.ts +0 -13
  145. package/dist/types/src/types/action.d.ts.map +0 -1
  146. package/src/capabilities/intent-resolver.ts +0 -18
  147. package/src/components/Search.stories.tsx +0 -66
  148. package/src/components/SearchDialog.tsx +0 -124
  149. package/src/components/SearchMain.tsx +0 -67
  150. package/src/components/SearchResults/SearchResults.stories.tsx +0 -57
  151. package/src/components/SearchResults/SearchResults.tsx +0 -86
  152. package/src/components/SearchResults/index.ts +0 -5
  153. package/src/components/Searchbar/Searchbar.stories.tsx +0 -28
  154. package/src/components/Searchbar/Searchbar.tsx +0 -69
  155. package/src/components/Searchbar/index.ts +0 -5
  156. package/src/types/action.tsx +0 -16
package/package.json CHANGED
@@ -1,77 +1,95 @@
1
1
  {
2
2
  "name": "@dxos/plugin-search",
3
- "version": "0.8.4-main.f9ba587",
4
- "description": "Braneframe sketch plugin",
3
+ "version": "0.8.4-main.fcfe5033a5",
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
+ "#types": "./src/types/index.ts"
23
+ },
11
24
  "exports": {
12
25
  ".": {
26
+ "source": "./src/index.ts",
13
27
  "types": "./dist/types/src/index.d.ts",
14
- "browser": "./dist/lib/browser/index.mjs"
28
+ "browser": "./dist/lib/browser/index.mjs",
29
+ "node": "./dist/lib/node-esm/index.mjs"
15
30
  }
16
31
  },
17
32
  "types": "dist/types/src/index.d.ts",
18
- "typesVersions": {
19
- "*": {}
20
- },
21
33
  "files": [
22
34
  "dist",
23
35
  "src"
24
36
  ],
25
37
  "dependencies": {
26
- "@preact-signals/safe-react": "^0.9.0",
27
38
  "exa-js": "^1.5.12",
28
39
  "main-thread-scheduling": "^14.1.1",
29
- "@dxos/ai": "0.8.4-main.f9ba587",
30
- "@dxos/app-framework": "0.8.4-main.f9ba587",
31
- "@dxos/artifact": "0.8.4-main.f9ba587",
32
- "@dxos/assistant": "0.8.4-main.f9ba587",
33
- "@dxos/debug": "0.8.4-main.f9ba587",
34
- "@dxos/echo": "0.8.4-main.f9ba587",
35
- "@dxos/echo-protocol": "0.8.4-main.f9ba587",
36
- "@dxos/echo-schema": "0.8.4-main.f9ba587",
37
- "@dxos/effect": "0.8.4-main.f9ba587",
38
- "@dxos/invariant": "0.8.4-main.f9ba587",
39
- "@dxos/live-object": "0.8.4-main.f9ba587",
40
- "@dxos/log": "0.8.4-main.f9ba587",
41
- "@dxos/plugin-deck": "0.8.4-main.f9ba587",
42
- "@dxos/plugin-client": "0.8.4-main.f9ba587",
43
- "@dxos/plugin-graph": "0.8.4-main.f9ba587",
44
- "@dxos/plugin-space": "0.8.4-main.f9ba587",
45
- "@dxos/react-client": "0.8.4-main.f9ba587",
46
- "@dxos/react-ui-searchlist": "0.8.4-main.f9ba587",
47
- "@dxos/schema": "0.8.4-main.f9ba587",
48
- "@dxos/react-ui-stack": "0.8.4-main.f9ba587",
49
- "@dxos/util": "0.8.4-main.f9ba587"
40
+ "@dxos/app-framework": "0.8.4-main.fcfe5033a5",
41
+ "@dxos/ai": "0.8.4-main.fcfe5033a5",
42
+ "@dxos/assistant": "0.8.4-main.fcfe5033a5",
43
+ "@dxos/app-toolkit": "0.8.4-main.fcfe5033a5",
44
+ "@dxos/blueprints": "0.8.4-main.fcfe5033a5",
45
+ "@dxos/async": "0.8.4-main.fcfe5033a5",
46
+ "@dxos/debug": "0.8.4-main.fcfe5033a5",
47
+ "@dxos/echo": "0.8.4-main.fcfe5033a5",
48
+ "@dxos/echo-query": "0.8.4-main.fcfe5033a5",
49
+ "@dxos/operation": "0.8.4-main.fcfe5033a5",
50
+ "@dxos/echo-protocol": "0.8.4-main.fcfe5033a5",
51
+ "@dxos/log": "0.8.4-main.fcfe5033a5",
52
+ "@dxos/effect": "0.8.4-main.fcfe5033a5",
53
+ "@dxos/plugin-deck": "0.8.4-main.fcfe5033a5",
54
+ "@dxos/plugin-client": "0.8.4-main.fcfe5033a5",
55
+ "@dxos/react-client": "0.8.4-main.fcfe5033a5",
56
+ "@dxos/react-ui-components": "0.8.4-main.fcfe5033a5",
57
+ "@dxos/react-ui-attention": "0.8.4-main.fcfe5033a5",
58
+ "@dxos/plugin-graph": "0.8.4-main.fcfe5033a5",
59
+ "@dxos/react-ui-mosaic": "0.8.4-main.fcfe5033a5",
60
+ "@dxos/react-ui-menu": "0.8.4-main.fcfe5033a5",
61
+ "@dxos/plugin-space": "0.8.4-main.fcfe5033a5",
62
+ "@dxos/invariant": "0.8.4-main.fcfe5033a5",
63
+ "@dxos/react-ui-search": "0.8.4-main.fcfe5033a5",
64
+ "@dxos/schema": "0.8.4-main.fcfe5033a5",
65
+ "@dxos/util": "0.8.4-main.fcfe5033a5",
66
+ "@dxos/types": "0.8.4-main.fcfe5033a5",
67
+ "@dxos/react-ui-stack": "0.8.4-main.fcfe5033a5"
50
68
  },
51
69
  "devDependencies": {
52
- "@effect-rx/rx-react": "0.38.0",
53
- "@effect/platform": "0.88.0",
54
- "@phosphor-icons/react": "^2.1.5",
55
- "@types/react": "~18.2.0",
56
- "@types/react-dom": "~18.2.0",
57
- "effect": "3.16.13",
58
- "react": "~18.2.0",
59
- "react-dom": "~18.2.0",
60
- "vite": "5.4.7",
61
- "@dxos/random": "0.8.4-main.f9ba587",
62
- "@dxos/react-ui": "0.8.4-main.f9ba587",
63
- "@dxos/react-ui-theme": "0.8.4-main.f9ba587",
64
- "@dxos/storybook-utils": "0.8.4-main.f9ba587"
70
+ "@effect-atom/atom-react": "^0.5.0",
71
+ "@effect/platform": "0.94.4",
72
+ "@types/react": "~19.2.7",
73
+ "@types/react-dom": "~19.2.3",
74
+ "effect": "3.20.0",
75
+ "react": "~19.2.3",
76
+ "react-dom": "~19.2.3",
77
+ "vite": "^7.1.11",
78
+ "@dxos/plugin-preview": "0.8.4-main.fcfe5033a5",
79
+ "@dxos/plugin-testing": "0.8.4-main.fcfe5033a5",
80
+ "@dxos/random": "0.8.4-main.fcfe5033a5",
81
+ "@dxos/react-ui": "0.8.4-main.fcfe5033a5",
82
+ "@dxos/storybook-utils": "0.8.4-main.fcfe5033a5",
83
+ "@dxos/ui-theme": "0.8.4-main.fcfe5033a5"
65
84
  },
66
85
  "peerDependencies": {
67
- "@effect-rx/rx-react": "^0.34.1",
68
- "@effect/platform": "^0.80.12",
69
- "@phosphor-icons/react": "^2.1.5",
70
- "effect": "^3.13.3",
71
- "react": "~18.2.0",
72
- "react-dom": "~18.2.0",
73
- "@dxos/react-ui": "0.8.4-main.f9ba587",
74
- "@dxos/react-ui-theme": "0.8.4-main.f9ba587"
86
+ "@effect-atom/atom-react": "^0.5.0",
87
+ "@effect/platform": "0.94.4",
88
+ "effect": "3.20.0",
89
+ "react": "~19.2.3",
90
+ "react-dom": "~19.2.3",
91
+ "@dxos/react-ui": "0.8.4-main.fcfe5033a5",
92
+ "@dxos/ui-theme": "0.8.4-main.fcfe5033a5"
75
93
  },
76
94
  "publishConfig": {
77
95
  "access": "public"
@@ -2,53 +2,36 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { contributes, Events, defineModule, definePlugin, Capabilities } from '@dxos/app-framework';
5
+ import { Plugin } from '@dxos/app-framework';
6
+ import { AppPlugin } from '@dxos/app-toolkit';
7
+
8
+ import { AppGraphBuilder, OperationHandler, ReactSurface } from '#capabilities';
9
+ import { SEARCH_RESULT, meta } from '#meta';
10
+ import { type SearchResult } from '#types';
6
11
 
7
- import { AppGraphBuilder, IntentResolver, ReactSurface } from './capabilities';
8
- import { meta, SEARCH_RESULT } from './meta';
9
12
  import { translations } from './translations';
10
- import { type SearchResult } from './types';
11
13
 
12
- export const SearchPlugin = () =>
13
- definePlugin(meta, [
14
- defineModule({
15
- id: `${meta.id}/module/translations`,
16
- activatesOn: Events.SetupTranslations,
17
- activate: () => contributes(Capabilities.Translations, translations),
18
- }),
19
- defineModule({
20
- id: `${meta.id}/module/metadata`,
21
- activatesOn: Events.SetupMetadata,
22
- activate: () =>
23
- contributes(Capabilities.Metadata, {
24
- id: SEARCH_RESULT,
25
- metadata: {
26
- parse: (item: SearchResult, type: string) => {
27
- switch (type) {
28
- case 'node':
29
- return { id: item.id, label: item.label, data: item.object };
30
- case 'object':
31
- return item.object;
32
- case 'view-object':
33
- return item;
34
- }
35
- },
36
- },
37
- }),
38
- }),
39
- defineModule({
40
- id: `${meta.id}/module/app-graph-builder`,
41
- activatesOn: Events.SetupAppGraph,
42
- activate: AppGraphBuilder,
43
- }),
44
- defineModule({
45
- id: `${meta.id}/module/intent-resolver`,
46
- activatesOn: Events.SetupIntentResolver,
47
- activate: IntentResolver,
48
- }),
49
- defineModule({
50
- id: `${meta.id}/module/react-surface`,
51
- activatesOn: Events.SetupReactSurface,
52
- activate: ReactSurface,
53
- }),
54
- ]);
14
+ export const SearchPlugin = Plugin.define(meta).pipe(
15
+ AppPlugin.addAppGraphModule({ activate: AppGraphBuilder }),
16
+ AppPlugin.addMetadataModule({
17
+ metadata: {
18
+ id: SEARCH_RESULT,
19
+ metadata: {
20
+ parse: (item: SearchResult, type: string) => {
21
+ switch (type) {
22
+ case 'node':
23
+ return { id: item.id, label: item.label, data: item.object };
24
+ case 'object':
25
+ return item.object;
26
+ case 'view-object':
27
+ return item;
28
+ }
29
+ },
30
+ },
31
+ },
32
+ }),
33
+ AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),
34
+ AppPlugin.addSurfaceModule({ activate: ReactSurface }),
35
+ AppPlugin.addTranslationsModule({ translations }),
36
+ Plugin.make,
37
+ );
@@ -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, contributes, createIntent, type PluginContext } 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 { createExtension, ROOT_ID, 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/operation';
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 { SEARCH_PLUGIN } 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: `${SEARCH_PLUGIN}/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: SEARCH_PLUGIN }],
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: SEARCH_PLUGIN,
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: SEARCH_PLUGIN }],
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/operation';
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/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
+ );
@@ -2,58 +2,61 @@
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';
9
- import { isSpace, type Space } from '@dxos/react-client/echo';
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';
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
+ import { SearchArticle, SearchDialog } from '#containers';
14
+ import { SearchContextProvider } from '#hooks';
13
15
 
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
- }
16
+ import { SEARCH_DIALOG } from '../constants';
34
17
 
35
- return (
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 }) => (
36
25
  <SearchContextProvider>
37
- <SearchMain space={space} />
26
+ <SearchDialog {...data.props} />
38
27
  </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
- }
28
+ ),
29
+ }),
30
+ Surface.create({
31
+ id: `${SEARCH_DIALOG}.search-input`,
32
+ role: 'search-input',
33
+ component: () => {
34
+ const space = useActiveSpace();
51
35
 
52
- return (
53
- <SearchContextProvider>
54
- <SearchMain space={space} />
55
- </SearchContextProvider>
56
- );
57
- },
58
- }),
59
- ]);
36
+ return (
37
+ <SearchContextProvider>
38
+ <SearchArticle 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
+ <SearchArticle space={space} />
56
+ </SearchContextProvider>
57
+ );
58
+ },
59
+ }),
60
+ ]),
61
+ ),
62
+ );
@@ -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';
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ export * from './SearchResultStack';
@@ -2,6 +2,4 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- export * from './Searchbar';
6
- export * from './SearchMain';
7
- export * from './SearchDialog';
5
+ export * from './SearchResultStack';
@@ -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`;