@dxos/plugin-search 0.7.5-main.9d26e3a → 0.7.5-main.e9bb01b
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/app-graph-builder-4C2ZPCED.mjs +41 -0
- package/dist/lib/browser/app-graph-builder-4C2ZPCED.mjs.map +7 -0
- package/dist/lib/browser/{chunk-4L4PWJYC.mjs → chunk-B532NWHM.mjs} +3 -3
- package/dist/lib/browser/chunk-B532NWHM.mjs.map +7 -0
- package/dist/lib/browser/chunk-GGOOQO2C.mjs +133 -0
- package/dist/lib/browser/chunk-GGOOQO2C.mjs.map +7 -0
- package/dist/lib/browser/chunk-Z745WIBH.mjs +21 -0
- package/dist/lib/browser/chunk-Z745WIBH.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +61 -557
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-MKBD2LPH.mjs +22 -0
- package/dist/lib/browser/intent-resolver-MKBD2LPH.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-H2PAVIXZ.mjs +357 -0
- package/dist/lib/browser/react-surface-H2PAVIXZ.mjs.map +7 -0
- package/dist/types/src/SearchPlugin.d.ts +1 -3
- package/dist/types/src/SearchPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +180 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +4 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/SearchDialog.d.ts +2 -3
- package/dist/types/src/components/SearchDialog.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +0 -2
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +20 -27
- package/src/SearchPlugin.tsx +35 -91
- package/src/capabilities/app-graph-builder.ts +36 -0
- package/src/capabilities/index.ts +9 -0
- package/src/capabilities/intent-resolver.ts +18 -0
- package/src/capabilities/react-surface.tsx +39 -0
- package/src/components/SearchDialog.tsx +20 -35
- package/src/index.ts +1 -4
- package/src/meta.ts +1 -1
- package/src/search-sync.ts +1 -1
- package/src/search.ts +1 -1
- package/src/types.tsx +0 -13
- package/dist/lib/browser/chunk-4L4PWJYC.mjs.map +0 -7
- package/dist/lib/browser/meta.mjs +0 -11
- package/dist/lib/browser/meta.mjs.map +0 -7
|
@@ -4,17 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { forwardRef, useCallback, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
useResolvePlugin,
|
|
9
|
-
parseNavigationPlugin,
|
|
10
|
-
parseGraphPlugin,
|
|
11
|
-
NavigationAction,
|
|
12
|
-
LayoutAction,
|
|
13
|
-
type LayoutCoordinate,
|
|
14
|
-
isLayoutParts,
|
|
15
|
-
useIntentDispatcher,
|
|
16
|
-
createIntent,
|
|
17
|
-
} from '@dxos/app-framework';
|
|
7
|
+
import { LayoutAction, createIntent, useAppGraph, useIntentDispatcher, useLayout } from '@dxos/app-framework';
|
|
18
8
|
import { type Node } from '@dxos/plugin-graph';
|
|
19
9
|
import { useClient } from '@dxos/react-client';
|
|
20
10
|
import { Filter, fullyQualifiedId, useQuery } from '@dxos/react-client/echo';
|
|
@@ -49,19 +39,16 @@ const SearchListResult = forwardRef<HTMLDivElement, SearchListResultProps>(({ no
|
|
|
49
39
|
});
|
|
50
40
|
|
|
51
41
|
export type SearchDialogProps = {
|
|
52
|
-
|
|
42
|
+
pivotId: string;
|
|
53
43
|
};
|
|
54
44
|
|
|
55
|
-
export const SearchDialog = ({
|
|
45
|
+
export const SearchDialog = ({ pivotId }: SearchDialogProps) => {
|
|
56
46
|
const { t } = useTranslation(SEARCH_PLUGIN);
|
|
57
|
-
const
|
|
58
|
-
const graph =
|
|
59
|
-
const
|
|
60
|
-
const providedClosed = navigationPlugin?.provides.location.closed ?? [];
|
|
61
|
-
const closed = (Array.isArray(providedClosed) ? providedClosed : [providedClosed])
|
|
47
|
+
const layout = useLayout();
|
|
48
|
+
const { graph } = useAppGraph();
|
|
49
|
+
const closed = (Array.isArray(layout.inactive) ? layout.inactive : [layout.inactive])
|
|
62
50
|
.map((id) => graph?.findNode(id))
|
|
63
51
|
.filter(Boolean);
|
|
64
|
-
const active = navigationPlugin?.provides.location.active;
|
|
65
52
|
const [queryString, setQueryString] = useState('');
|
|
66
53
|
const client = useClient();
|
|
67
54
|
const dangerouslyLoadAllObjects = useQuery(client.spaces, Filter.all());
|
|
@@ -71,28 +58,26 @@ export const SearchDialog = ({ layoutCoordinate }: SearchDialogProps) => {
|
|
|
71
58
|
|
|
72
59
|
const handleSelect = useCallback(
|
|
73
60
|
async (nodeId: string) => {
|
|
74
|
-
|
|
75
|
-
// If node is already present in the active parts, scroll to it and close the dialog.
|
|
76
|
-
const index = active?.main?.findIndex((entry) => entry.id === nodeId);
|
|
77
|
-
if (index !== -1) {
|
|
78
|
-
await dispatch(createIntent(LayoutAction.SetLayout, { element: 'dialog', state: false }));
|
|
79
|
-
await dispatch(createIntent(LayoutAction.ScrollIntoView, { id: nodeId }));
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
61
|
+
await dispatch(createIntent(LayoutAction.UpdateDialog, { part: 'dialog', options: { state: false } }));
|
|
82
62
|
|
|
63
|
+
// If node is already present in the active parts, scroll to it and close the dialog.
|
|
64
|
+
const index = layout.active.findIndex((id) => id === nodeId);
|
|
65
|
+
if (index !== -1) {
|
|
66
|
+
await dispatch(createIntent(LayoutAction.ScrollIntoView, { part: 'current', subject: nodeId }));
|
|
67
|
+
} else {
|
|
83
68
|
await dispatch(
|
|
84
|
-
createIntent(
|
|
85
|
-
part:
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
69
|
+
createIntent(LayoutAction.Open, {
|
|
70
|
+
part: 'main',
|
|
71
|
+
subject: [nodeId],
|
|
72
|
+
options: {
|
|
73
|
+
pivotId,
|
|
74
|
+
positioning: 'end',
|
|
75
|
+
},
|
|
89
76
|
}),
|
|
90
77
|
);
|
|
91
|
-
await dispatch(createIntent(LayoutAction.SetLayout, { element: 'dialog', state: false }));
|
|
92
|
-
await dispatch(createIntent(LayoutAction.ScrollIntoView, { id: nodeId }));
|
|
93
78
|
}
|
|
94
79
|
},
|
|
95
|
-
[
|
|
80
|
+
[pivotId, dispatch, layout],
|
|
96
81
|
);
|
|
97
82
|
|
|
98
83
|
return (
|
package/src/index.ts
CHANGED
package/src/meta.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { type PluginMeta } from '@dxos/app-framework';
|
|
|
7
7
|
export const SEARCH_PLUGIN = 'dxos.org/plugin/search';
|
|
8
8
|
export const SEARCH_RESULT = `${SEARCH_PLUGIN}/result`;
|
|
9
9
|
|
|
10
|
-
export
|
|
10
|
+
export const meta = {
|
|
11
11
|
id: SEARCH_PLUGIN,
|
|
12
12
|
name: 'Search',
|
|
13
13
|
description: 'Search ECHO spaces for content.',
|
package/src/search-sync.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { AST, type S } from '@dxos/echo-schema';
|
|
6
6
|
import { getSchema } from '@dxos/live-object';
|
|
7
|
-
import { TextType } from '@dxos/
|
|
7
|
+
import { TextType } from '@dxos/schema';
|
|
8
8
|
|
|
9
9
|
export const queryStringToMatch = (queryString?: string): RegExp | undefined => {
|
|
10
10
|
const trimmed = queryString?.trim();
|
package/src/search.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { yieldOrContinue } from 'main-thread-scheduling';
|
|
6
6
|
import { useEffect, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import { TextType } from '@dxos/
|
|
8
|
+
import { TextType } from '@dxos/schema';
|
|
9
9
|
|
|
10
10
|
// TODO(thure): Deprecate search-sync, move still-relevant utilities elsewhere (here, probably).
|
|
11
11
|
import { mapObjectToTextFields, queryStringToMatch } from './search-sync';
|
package/src/types.tsx
CHANGED
|
@@ -2,13 +2,6 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import type {
|
|
6
|
-
GraphBuilderProvides,
|
|
7
|
-
IntentResolverProvides,
|
|
8
|
-
MetadataRecordsProvides,
|
|
9
|
-
SurfaceProvides,
|
|
10
|
-
TranslationsProvides,
|
|
11
|
-
} from '@dxos/app-framework';
|
|
12
5
|
import { S } from '@dxos/echo-schema';
|
|
13
6
|
|
|
14
7
|
import { SEARCH_PLUGIN } from './meta';
|
|
@@ -21,9 +14,3 @@ export namespace SearchAction {
|
|
|
21
14
|
output: S.Void,
|
|
22
15
|
}) {}
|
|
23
16
|
}
|
|
24
|
-
|
|
25
|
-
export type SearchPluginProvides = SurfaceProvides &
|
|
26
|
-
IntentResolverProvides &
|
|
27
|
-
GraphBuilderProvides &
|
|
28
|
-
MetadataRecordsProvides &
|
|
29
|
-
TranslationsProvides;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const SEARCH_PLUGIN = 'dxos.org/plugin/search';\nexport const SEARCH_RESULT = `${SEARCH_PLUGIN}/result`;\n\nexport default {\n id: SEARCH_PLUGIN,\n name: 'Search',\n description: 'Search ECHO spaces for content.',\n icon: 'ph--magnifying-glass--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/experimental/plugin-search',\n tags: ['experimental'],\n} satisfies PluginMeta;\n"],
|
|
5
|
-
"mappings": ";AAMO,IAAMA,gBAAgB;AACtB,IAAMC,gBAAgB,GAAGD,aAAAA;AAEhC,IAAA,eAAe;EACbE,IAAIF;EACJG,MAAM;EACNC,aAAa;EACbC,MAAM;EACNC,QAAQ;EACRC,MAAM;IAAC;;AACT;",
|
|
6
|
-
"names": ["SEARCH_PLUGIN", "SEARCH_RESULT", "id", "name", "description", "icon", "source", "tags"]
|
|
7
|
-
}
|