@dxos/plugin-search 0.8.4-main.9be5663bfe → 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.
- package/dist/lib/browser/SearchPlugin-PB5MWMS6.mjs +41 -0
- package/dist/lib/browser/SearchPlugin-PB5MWMS6.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +29 -85
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/translations.mjs +23 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/types/src/SearchPlugin.d.ts +1 -0
- package/dist/types/src/SearchPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +1 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/SearchResultStack/SearchResultStack.d.ts +1 -1
- package/dist/types/src/containers/SearchArticle/SearchArticle.d.ts +2 -5
- package/dist/types/src/containers/SearchArticle/SearchArticle.d.ts.map +1 -1
- package/dist/types/src/containers/SearchArticle/SearchArticle.stories.d.ts +0 -1
- package/dist/types/src/containers/SearchArticle/SearchArticle.stories.d.ts.map +1 -1
- package/dist/types/src/containers/SearchDialog/SearchDialog.d.ts +4 -5
- package/dist/types/src/containers/SearchDialog/SearchDialog.d.ts.map +1 -1
- package/dist/types/src/containers/SearchDialog/SearchDialog.stories.d.ts +0 -1
- package/dist/types/src/containers/SearchDialog/SearchDialog.stories.d.ts.map +1 -1
- package/dist/types/src/containers/SearchDialog/index.d.ts +0 -1
- package/dist/types/src/containers/SearchDialog/index.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +0 -1
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/hooks/sync.d.ts +1 -1
- package/dist/types/src/hooks/sync.d.ts.map +1 -1
- package/dist/types/src/hooks/useGlobalSearch.d.ts.map +1 -1
- package/dist/types/src/hooks/useSearchResults.d.ts.map +1 -1
- package/dist/types/src/hooks/useWebSearch.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/operations/definitions.d.ts +1 -1
- package/dist/types/src/operations/definitions.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts +1 -1
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/operations/open-search.d.ts +1 -1
- package/dist/types/src/operations/open-search.d.ts.map +1 -1
- package/dist/types/src/search/exa.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +10 -11
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +45 -38
- package/src/SearchPlugin.tsx +3 -2
- package/src/capabilities/app-graph-builder.ts +1 -1
- package/src/capabilities/index.ts +1 -1
- package/src/capabilities/operation-handler.ts +1 -1
- package/src/capabilities/react-surface.tsx +17 -8
- package/src/components/SearchResultStack/SearchResultStack.tsx +2 -2
- package/src/containers/SearchArticle/SearchArticle.stories.tsx +3 -4
- package/src/containers/SearchArticle/SearchArticle.tsx +4 -7
- package/src/containers/SearchDialog/SearchDialog.stories.tsx +3 -4
- package/src/containers/SearchDialog/SearchDialog.tsx +23 -30
- package/src/containers/SearchDialog/index.ts +0 -1
- package/src/containers/index.ts +0 -2
- package/src/hooks/sync.ts +2 -2
- package/src/hooks/useWebSearch.ts +2 -2
- package/src/index.ts +10 -3
- package/src/operations/definitions.ts +1 -1
- package/src/operations/index.ts +1 -1
- package/src/operations/open-search.ts +1 -1
- package/src/translations.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-search",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.abd8ff62ef",
|
|
4
4
|
"description": "Search plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"#hooks": "./src/hooks/index.ts",
|
|
20
20
|
"#meta": "./src/meta.ts",
|
|
21
21
|
"#operations": "./src/operations/index.ts",
|
|
22
|
+
"#translations": "./src/translations.ts",
|
|
22
23
|
"#types": "./src/types/index.ts"
|
|
23
24
|
},
|
|
24
25
|
"exports": {
|
|
@@ -27,6 +28,12 @@
|
|
|
27
28
|
"types": "./dist/types/src/index.d.ts",
|
|
28
29
|
"browser": "./dist/lib/browser/index.mjs",
|
|
29
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"
|
|
30
37
|
}
|
|
31
38
|
},
|
|
32
39
|
"types": "dist/types/src/index.d.ts",
|
|
@@ -37,34 +44,34 @@
|
|
|
37
44
|
"dependencies": {
|
|
38
45
|
"exa-js": "^1.5.12",
|
|
39
46
|
"main-thread-scheduling": "^14.1.1",
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/app-
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/echo
|
|
48
|
-
"@dxos/echo-
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/log": "0.8.4-main.
|
|
53
|
-
"@dxos/plugin-client": "0.8.4-main.
|
|
54
|
-
"@dxos/plugin-graph": "0.8.4-main.
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/react-ui-attention": "0.8.4-main.
|
|
59
|
-
"@dxos/react-ui-
|
|
60
|
-
"@dxos/react-ui-
|
|
61
|
-
"@dxos/react-ui-
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/react-ui-
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/
|
|
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"
|
|
68
75
|
},
|
|
69
76
|
"devDependencies": {
|
|
70
77
|
"@effect-atom/atom-react": "^0.5.0",
|
|
@@ -74,13 +81,13 @@
|
|
|
74
81
|
"effect": "3.20.0",
|
|
75
82
|
"react": "~19.2.3",
|
|
76
83
|
"react-dom": "~19.2.3",
|
|
77
|
-
"vite": "^
|
|
78
|
-
"@dxos/plugin-
|
|
79
|
-
"@dxos/plugin-
|
|
80
|
-
"@dxos/
|
|
81
|
-
"@dxos/
|
|
82
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
83
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
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"
|
|
84
91
|
},
|
|
85
92
|
"peerDependencies": {
|
|
86
93
|
"@effect-atom/atom-react": "^0.5.0",
|
|
@@ -88,8 +95,8 @@
|
|
|
88
95
|
"effect": "3.20.0",
|
|
89
96
|
"react": "~19.2.3",
|
|
90
97
|
"react-dom": "~19.2.3",
|
|
91
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
92
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
98
|
+
"@dxos/react-ui": "0.8.4-main.abd8ff62ef",
|
|
99
|
+
"@dxos/ui-theme": "0.8.4-main.abd8ff62ef"
|
|
93
100
|
},
|
|
94
101
|
"publishConfig": {
|
|
95
102
|
"access": "public"
|
package/src/SearchPlugin.tsx
CHANGED
|
@@ -7,10 +7,9 @@ import { AppPlugin } from '@dxos/app-toolkit';
|
|
|
7
7
|
|
|
8
8
|
import { AppGraphBuilder, OperationHandler, ReactSurface } from '#capabilities';
|
|
9
9
|
import { SEARCH_RESULT, meta } from '#meta';
|
|
10
|
+
import { translations } from '#translations';
|
|
10
11
|
import { type SearchResult } from '#types';
|
|
11
12
|
|
|
12
|
-
import { translations } from './translations';
|
|
13
|
-
|
|
14
13
|
export const SearchPlugin = Plugin.define(meta).pipe(
|
|
15
14
|
AppPlugin.addAppGraphModule({ activate: AppGraphBuilder }),
|
|
16
15
|
AppPlugin.addMetadataModule({
|
|
@@ -35,3 +34,5 @@ export const SearchPlugin = Plugin.define(meta).pipe(
|
|
|
35
34
|
AppPlugin.addTranslationsModule({ translations }),
|
|
36
35
|
Plugin.make,
|
|
37
36
|
);
|
|
37
|
+
|
|
38
|
+
export default SearchPlugin;
|
|
@@ -6,7 +6,7 @@ import * as Effect from 'effect/Effect';
|
|
|
6
6
|
|
|
7
7
|
import { Capability } from '@dxos/app-framework';
|
|
8
8
|
import { AppCapabilities, AppNode, getSpaceIdFromPath } from '@dxos/app-toolkit';
|
|
9
|
-
import { Operation } from '@dxos/
|
|
9
|
+
import { Operation } from '@dxos/compute';
|
|
10
10
|
import { ClientCapabilities } from '@dxos/plugin-client/types';
|
|
11
11
|
import { GraphBuilder, NodeMatcher } from '@dxos/plugin-graph';
|
|
12
12
|
import { linkedSegment } from '@dxos/react-ui-attention';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Capability } from '@dxos/app-framework';
|
|
6
|
-
import { OperationHandlerSet } from '@dxos/
|
|
6
|
+
import { OperationHandlerSet } from '@dxos/compute';
|
|
7
7
|
|
|
8
8
|
export const AppGraphBuilder = Capability.lazy('AppGraphBuilder', () => import('./app-graph-builder'));
|
|
9
9
|
export const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
7
|
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
-
import type { OperationHandlerSet } from '@dxos/
|
|
8
|
+
import type { OperationHandlerSet } from '@dxos/compute';
|
|
9
9
|
|
|
10
10
|
import { SearchOperationHandlerSet } from '#operations';
|
|
11
11
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
|
-
import React from 'react';
|
|
6
|
+
import React, { type ComponentProps } from 'react';
|
|
7
7
|
|
|
8
8
|
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
9
|
import { Surface } from '@dxos/app-framework/ui';
|
|
@@ -20,19 +20,28 @@ export default Capability.makeModule(() =>
|
|
|
20
20
|
Capability.contributes(Capabilities.ReactSurface, [
|
|
21
21
|
Surface.create({
|
|
22
22
|
id: SEARCH_DIALOG,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
+
},
|
|
30
36
|
}),
|
|
31
37
|
Surface.create({
|
|
32
38
|
id: `${SEARCH_DIALOG}.search-input`,
|
|
33
39
|
role: 'search-input',
|
|
34
40
|
component: () => {
|
|
35
41
|
const space = useActiveSpace();
|
|
42
|
+
if (!space) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
36
45
|
|
|
37
46
|
return (
|
|
38
47
|
<SearchContextProvider>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import React, { type KeyboardEvent, forwardRef, useCallback, useMemo, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Surface } from '@dxos/app-framework/ui';
|
|
8
|
-
import { useObjectMenuItems } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { AppSurface, useObjectMenuItems } from '@dxos/app-toolkit/ui';
|
|
9
9
|
import { Entity } from '@dxos/echo';
|
|
10
10
|
import { Card, Toolbar } from '@dxos/react-ui';
|
|
11
11
|
import { ScrollArea } from '@dxos/react-ui';
|
|
@@ -106,7 +106,7 @@ const SearchResultTile = forwardRef<HTMLDivElement, SearchResultTileProps>(
|
|
|
106
106
|
</Menu.Trigger>
|
|
107
107
|
<Menu.Content items={menuItems} />
|
|
108
108
|
</Card.Toolbar>
|
|
109
|
-
<Surface.Surface
|
|
109
|
+
<Surface.Surface type={AppSurface.Card} data={{ subject: result.object }} limit={1} />
|
|
110
110
|
</Card.Root>
|
|
111
111
|
</Focus.Item>
|
|
112
112
|
</Mosaic.Tile>
|
|
@@ -19,8 +19,8 @@ import { createObjectFactory } from '@dxos/schema/testing';
|
|
|
19
19
|
import { Organization, Person } from '@dxos/types';
|
|
20
20
|
|
|
21
21
|
import { SearchContextProvider } from '#hooks';
|
|
22
|
+
import { translations } from '#translations';
|
|
22
23
|
|
|
23
|
-
import { translations } from '../../translations';
|
|
24
24
|
import { SearchArticle } from './SearchArticle';
|
|
25
25
|
|
|
26
26
|
random.seed(0);
|
|
@@ -34,14 +34,13 @@ const DefaultStory = () => {
|
|
|
34
34
|
|
|
35
35
|
return (
|
|
36
36
|
<SearchContextProvider>
|
|
37
|
-
<SearchArticle space={space} />
|
|
37
|
+
<SearchArticle role='article' space={space} attendableId={space.id} />
|
|
38
38
|
</SearchContextProvider>
|
|
39
39
|
);
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
const meta = {
|
|
43
43
|
title: 'plugins/plugin-search/containers/SearchArticle',
|
|
44
|
-
component: SearchArticle,
|
|
45
44
|
render: DefaultStory,
|
|
46
45
|
decorators: [
|
|
47
46
|
withLayout({ layout: 'column' }),
|
|
@@ -71,7 +70,7 @@ const meta = {
|
|
|
71
70
|
parameters: {
|
|
72
71
|
layout: 'fullscreen',
|
|
73
72
|
},
|
|
74
|
-
} satisfies Meta<typeof
|
|
73
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
75
74
|
|
|
76
75
|
export default meta;
|
|
77
76
|
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
6
6
|
|
|
7
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
7
8
|
import { Entity, Query } from '@dxos/echo';
|
|
8
|
-
import { Filter,
|
|
9
|
+
import { Filter, useQuery } from '@dxos/react-client/echo';
|
|
9
10
|
import { Panel, Toolbar } from '@dxos/react-ui';
|
|
10
11
|
import { SearchList } from '@dxos/react-ui-search';
|
|
11
12
|
import { Text } from '@dxos/schema';
|
|
@@ -14,16 +15,12 @@ import { isTauri, getHostPlatform } from '@dxos/util';
|
|
|
14
15
|
import { SearchResultStack } from '#components';
|
|
15
16
|
import { useGlobalSearch, useGlobalSearchResults, useWebSearch } from '#hooks';
|
|
16
17
|
|
|
17
|
-
export
|
|
18
|
-
space?: Space;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const SearchArticle = ({ space }: SearchArticleProps) => {
|
|
18
|
+
export const SearchArticle = ({ space }: AppSurface.SpaceArticleProps) => {
|
|
22
19
|
// TODO(burdon): Option to query across spaces.
|
|
23
20
|
const [query, setQuery] = useState<string>();
|
|
24
21
|
// TODO(burdon): Re-enable full-text search when indexer is available in all environments.
|
|
25
22
|
const objects = useQuery(
|
|
26
|
-
space
|
|
23
|
+
space.db,
|
|
27
24
|
query === undefined ? Query.select(Filter.nothing()) : Query.select(Filter.not(Filter.type(Text.Text))),
|
|
28
25
|
);
|
|
29
26
|
|
|
@@ -21,8 +21,8 @@ import { createObjectFactory } from '@dxos/schema/testing';
|
|
|
21
21
|
import { Organization, Person } from '@dxos/types';
|
|
22
22
|
|
|
23
23
|
import { SearchContextProvider } from '#hooks';
|
|
24
|
+
import { translations } from '#translations';
|
|
24
25
|
|
|
25
|
-
import { translations } from '../../translations';
|
|
26
26
|
import { SearchDialog } from './SearchDialog';
|
|
27
27
|
|
|
28
28
|
random.seed(0);
|
|
@@ -38,7 +38,7 @@ const DefaultStory = () => {
|
|
|
38
38
|
<SearchContextProvider>
|
|
39
39
|
<Dialog.Root defaultOpen>
|
|
40
40
|
<Dialog.Overlay>
|
|
41
|
-
<SearchDialog
|
|
41
|
+
<SearchDialog role='article' space={space} attendableId={space.id} pivotId='storybook' />
|
|
42
42
|
</Dialog.Overlay>
|
|
43
43
|
</Dialog.Root>
|
|
44
44
|
</SearchContextProvider>
|
|
@@ -47,7 +47,6 @@ const DefaultStory = () => {
|
|
|
47
47
|
|
|
48
48
|
const meta = {
|
|
49
49
|
title: 'plugins/plugin-search/containers/SearchDialog',
|
|
50
|
-
component: SearchDialog,
|
|
51
50
|
render: DefaultStory,
|
|
52
51
|
decorators: [
|
|
53
52
|
withLayout({ layout: 'fullscreen' }),
|
|
@@ -78,7 +77,7 @@ const meta = {
|
|
|
78
77
|
parameters: {
|
|
79
78
|
layout: 'fullscreen',
|
|
80
79
|
},
|
|
81
|
-
} satisfies Meta<typeof
|
|
80
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
82
81
|
|
|
83
82
|
export default meta;
|
|
84
83
|
|
|
@@ -6,10 +6,10 @@ import React, { useCallback, useMemo, useState } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
8
8
|
import { getObjectPathFromObject, LayoutOperation } from '@dxos/app-toolkit';
|
|
9
|
+
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
9
10
|
import { useLayout } from '@dxos/app-toolkit/ui';
|
|
10
|
-
import { useActiveSpace } from '@dxos/app-toolkit/ui';
|
|
11
11
|
import { Entity, Obj, Query } from '@dxos/echo';
|
|
12
|
-
import { Filter,
|
|
12
|
+
import { Filter, useQuery } from '@dxos/react-client/echo';
|
|
13
13
|
import { Dialog, useTranslation } from '@dxos/react-ui';
|
|
14
14
|
import { SearchList } from '@dxos/react-ui-search';
|
|
15
15
|
import { Text } from '@dxos/schema';
|
|
@@ -18,21 +18,18 @@ import { useGlobalSearch, useGlobalSearchResults } from '#hooks';
|
|
|
18
18
|
import { meta } from '#meta';
|
|
19
19
|
import { type SearchResult } from '#types';
|
|
20
20
|
|
|
21
|
-
export type SearchDialogProps = {
|
|
21
|
+
export type SearchDialogProps = AppSurface.SpaceArticleProps<{
|
|
22
22
|
pivotId?: string;
|
|
23
|
-
|
|
24
|
-
};
|
|
23
|
+
}>;
|
|
25
24
|
|
|
26
|
-
export const SearchDialog = ({ pivotId: pivotIdProp
|
|
25
|
+
export const SearchDialog = ({ space, pivotId: pivotIdProp }: SearchDialogProps) => {
|
|
27
26
|
const { t } = useTranslation(meta.id);
|
|
28
|
-
const layout = useLayout();
|
|
29
|
-
const pivotId = pivotIdProp ?? layout.active[layout.active.length - 1];
|
|
30
27
|
const { invokePromise } = useOperationInvoker();
|
|
31
28
|
const { setMatch } = useGlobalSearch();
|
|
29
|
+
const layout = useLayout();
|
|
30
|
+
const pivotId = pivotIdProp ?? layout.active[layout.active.length - 1];
|
|
32
31
|
const [query, setQuery] = useState<string>();
|
|
33
32
|
|
|
34
|
-
const activeSpace = useActiveSpace();
|
|
35
|
-
const space = spaceProp ?? activeSpace;
|
|
36
33
|
// TODO(burdon): Re-enable full-text search when indexer is available in all environments.
|
|
37
34
|
const objects = useQuery(
|
|
38
35
|
space?.db,
|
|
@@ -75,26 +72,22 @@ export const SearchDialog = ({ pivotId: pivotIdProp, space: spaceProp }: SearchD
|
|
|
75
72
|
<Dialog.CloseIconButton />
|
|
76
73
|
</Dialog.Close>
|
|
77
74
|
</Dialog.Header>
|
|
78
|
-
<
|
|
79
|
-
<SearchList.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
<SearchList.
|
|
83
|
-
{
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
</SearchList.Viewport>
|
|
95
|
-
</SearchList.Content>
|
|
96
|
-
</SearchList.Root>
|
|
97
|
-
</Dialog.Body>
|
|
75
|
+
<SearchList.Root onSearch={handleSearch}>
|
|
76
|
+
<SearchList.Input classNames='px-0' autoFocus placeholder={t('search.placeholder')} />
|
|
77
|
+
<SearchList.Viewport classNames='max-h-[24rem]'>
|
|
78
|
+
{allResults.map((result) => (
|
|
79
|
+
<SearchList.Item
|
|
80
|
+
key={result.id}
|
|
81
|
+
classNames='flex gap-2 items-center'
|
|
82
|
+
value={result.id}
|
|
83
|
+
label={result.label ?? (result.object ? Entity.getLabel(result.object) : undefined) ?? result.id}
|
|
84
|
+
icon={result.icon}
|
|
85
|
+
onSelect={() => void handleSelect(result)}
|
|
86
|
+
/>
|
|
87
|
+
))}
|
|
88
|
+
{query && allResults.length === 0 && <SearchList.Empty />}
|
|
89
|
+
</SearchList.Viewport>
|
|
90
|
+
</SearchList.Root>
|
|
98
91
|
</Dialog.Content>
|
|
99
92
|
);
|
|
100
93
|
};
|
package/src/containers/index.ts
CHANGED
|
@@ -4,7 +4,5 @@
|
|
|
4
4
|
|
|
5
5
|
import { type ComponentType, lazy } from 'react';
|
|
6
6
|
|
|
7
|
-
export type { SearchDialogProps } from './SearchDialog';
|
|
8
|
-
|
|
9
7
|
export const SearchDialog: ComponentType<any> = lazy(() => import('./SearchDialog'));
|
|
10
8
|
export const SearchArticle: ComponentType<any> = lazy(() => import('./SearchArticle'));
|
package/src/hooks/sync.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import type * as Schema from 'effect/Schema';
|
|
6
6
|
import * as SchemaAST from 'effect/SchemaAST';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Entity, Obj } from '@dxos/echo';
|
|
9
9
|
import { Text } from '@dxos/schema';
|
|
10
10
|
|
|
11
11
|
import { type SearchResult } from '#types';
|
|
@@ -57,7 +57,7 @@ export const filterObjectsSync = <T extends Entity.Unknown>(objects: T[], match?
|
|
|
57
57
|
|
|
58
58
|
results.push({
|
|
59
59
|
id: object.id,
|
|
60
|
-
type: getIcon(
|
|
60
|
+
type: getIcon(Entity.getSchema(object)),
|
|
61
61
|
label,
|
|
62
62
|
match,
|
|
63
63
|
// TODO(burdon): Truncate.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { useCallback, useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { EXA_API_KEY } from '@dxos/ai/testing';
|
|
8
|
-
import {
|
|
8
|
+
import { Entity } from '@dxos/echo';
|
|
9
9
|
import { log } from '@dxos/log';
|
|
10
10
|
import { getIconAnnotation } from '@dxos/schema';
|
|
11
11
|
import { TestSchema } from '@dxos/schema/testing';
|
|
@@ -44,7 +44,7 @@ export const useWebSearch = ({ query, context }: UseWebSearchProps): UseWebSearc
|
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
const mappedResults = results.data.map((result): SearchResult => {
|
|
47
|
-
const schema =
|
|
47
|
+
const schema = Entity.getSchema(result);
|
|
48
48
|
return {
|
|
49
49
|
id: result.id,
|
|
50
50
|
label: getStringProperty(result, ['name', 'title', 'label']),
|
package/src/index.ts
CHANGED
|
@@ -2,8 +2,15 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
9
|
+
export const SearchPlugin = Plugin.lazy(meta, () => import('./SearchPlugin'));
|
|
10
|
+
|
|
6
11
|
export * from './meta';
|
|
7
|
-
export * from './types';
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
// TODO(wittjosiah): Hooks should not be exported from the plugin package at all.
|
|
14
|
+
// Either refactor callers to not need them or factor them out to a shared package.
|
|
15
|
+
export * from './hooks';
|
|
16
|
+
export * from './types';
|
package/src/operations/index.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
7
|
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
8
|
-
import { Operation } from '@dxos/
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
9
|
|
|
10
10
|
import { SEARCH_DIALOG } from '../constants';
|
|
11
11
|
import { OpenSearch } from './definitions';
|
package/src/translations.ts
CHANGED