@eightyfourthousand/lib-search 2026.4.0 → 2026.4.2
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/index.js +4 -0
- package/index.js.map +1 -0
- package/lib/data/index.js +2 -0
- package/lib/data/index.js.map +1 -0
- package/lib/data/search.d.ts +5 -0
- package/lib/data/search.js +17 -0
- package/lib/data/search.js.map +1 -0
- package/lib/types/index.js +2 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/search.d.ts +71 -0
- package/lib/types/search.js +58 -0
- package/lib/types/search.js.map +1 -0
- package/lib/ui/SearchButton.d.ts +35 -0
- package/lib/ui/SearchButton.js +221 -0
- package/lib/ui/SearchButton.js.map +1 -0
- package/lib/ui/SearchResultCard.d.ts +26 -0
- package/lib/ui/SearchResultCard.js +67 -0
- package/lib/ui/SearchResultCard.js.map +1 -0
- package/lib/ui/SearchResultTab.d.ts +4 -0
- package/lib/ui/SearchResultTab.js +7 -0
- package/lib/ui/SearchResultTab.js.map +1 -0
- package/lib/ui/SearchResultsList.d.ts +8 -0
- package/lib/ui/SearchResultsList.js +10 -0
- package/lib/ui/SearchResultsList.js.map +1 -0
- package/lib/ui/index.js +2 -0
- package/lib/ui/index.js.map +1 -0
- package/package.json +19 -6
- package/.babelrc +0 -12
- package/.eslintrc.json +0 -18
- package/README.md +0 -9
- package/project.json +0 -20
- package/src/lib/data/search.ts +0 -28
- package/src/lib/types/search.ts +0 -153
- package/src/lib/ui/SearchButton.tsx +0 -453
- package/src/lib/ui/SearchResultCard.tsx +0 -209
- package/src/lib/ui/SearchResultTab.tsx +0 -28
- package/src/lib/ui/SearchResultsList.tsx +0 -35
- package/tsconfig.json +0 -17
- package/tsconfig.lib.json +0 -26
- /package/{src/index.ts → index.d.ts} +0 -0
- /package/{src/lib/data/index.ts → lib/data/index.d.ts} +0 -0
- /package/{src/lib/types/index.ts → lib/types/index.d.ts} +0 -0
- /package/{src/lib/ui/index.ts → lib/ui/index.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eightyfourthousand/lib-search",
|
|
3
|
-
"version": "2026.4.
|
|
3
|
+
"version": "2026.4.2",
|
|
4
4
|
"description": "Shared translation search UI and server helpers for 84000 applications.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"repository": {
|
|
@@ -17,17 +17,30 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@eightyfourthousand/client-graphql": "^2026.
|
|
21
|
-
"@eightyfourthousand/data-access": "^2026.
|
|
22
|
-
"@eightyfourthousand/design-system": "^2026.
|
|
23
|
-
"@eightyfourthousand/lib-utils": "^2026.
|
|
20
|
+
"@eightyfourthousand/client-graphql": "^2026.4.2",
|
|
21
|
+
"@eightyfourthousand/data-access": "^2026.4.2",
|
|
22
|
+
"@eightyfourthousand/design-system": "^2026.4.2",
|
|
23
|
+
"@eightyfourthousand/lib-utils": "^2026.4.2",
|
|
24
|
+
"lucide-react": "^0.477.0"
|
|
24
25
|
},
|
|
25
26
|
"peerDependencies": {
|
|
26
27
|
"next": "^16.0.0",
|
|
27
28
|
"react": "^19.0.0",
|
|
28
29
|
"react-dom": "^19.0.0"
|
|
29
30
|
},
|
|
31
|
+
"type": "module",
|
|
32
|
+
"main": "./index.js",
|
|
33
|
+
"module": "./index.js",
|
|
34
|
+
"types": "./index.d.ts",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"types": "./index.d.ts",
|
|
38
|
+
"import": "./index.js",
|
|
39
|
+
"default": "./index.js"
|
|
40
|
+
},
|
|
41
|
+
"./package.json": "./package.json"
|
|
42
|
+
},
|
|
30
43
|
"sideEffects": false,
|
|
31
44
|
"keywords": [],
|
|
32
45
|
"author": ""
|
|
33
|
-
}
|
|
46
|
+
}
|
package/.babelrc
DELETED
package/.eslintrc.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": ["plugin:@nx/react", "../../.eslintrc.json"],
|
|
3
|
-
"ignorePatterns": ["!**/*"],
|
|
4
|
-
"overrides": [
|
|
5
|
-
{
|
|
6
|
-
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
|
7
|
-
"rules": {}
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
"files": ["*.ts", "*.tsx"],
|
|
11
|
-
"rules": {}
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"files": ["*.js", "*.jsx"],
|
|
15
|
-
"rules": {}
|
|
16
|
-
}
|
|
17
|
-
]
|
|
18
|
-
}
|
package/README.md
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
# @eightyfourthousand/lib-search
|
|
2
|
-
|
|
3
|
-
Shared translation search UI and server helpers for 84000 applications.
|
|
4
|
-
|
|
5
|
-
Use this package for the cross-application translation search dialog, result rendering, and supporting search helpers.
|
|
6
|
-
|
|
7
|
-
## Running unit tests
|
|
8
|
-
|
|
9
|
-
Run `nx test lib-search` to execute the unit tests via [Jest](https://jestjs.io).
|
package/project.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "lib-search",
|
|
3
|
-
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
-
"sourceRoot": "libs/lib-search/src",
|
|
5
|
-
"projectType": "library",
|
|
6
|
-
"tags": [],
|
|
7
|
-
"targets": {
|
|
8
|
-
"build": {
|
|
9
|
-
"executor": "@nx/js:tsc",
|
|
10
|
-
"outputs": ["{options.outputPath}"],
|
|
11
|
-
"options": {
|
|
12
|
-
"outputPath": "dist/libs/lib-search",
|
|
13
|
-
"main": "libs/lib-search/src/index.ts",
|
|
14
|
-
"tsConfig": "libs/lib-search/tsconfig.lib.json",
|
|
15
|
-
"rootDir": "libs/lib-search/src",
|
|
16
|
-
"generateExportsField": true
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
package/src/lib/data/search.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
'use server';
|
|
2
|
-
|
|
3
|
-
import { createServerClient } from '@eightyfourthousand/data-access/ssr';
|
|
4
|
-
import { searchResultsFromDTO } from '../types';
|
|
5
|
-
|
|
6
|
-
export const search = async ({
|
|
7
|
-
text,
|
|
8
|
-
uuid,
|
|
9
|
-
toh,
|
|
10
|
-
}: {
|
|
11
|
-
text: string;
|
|
12
|
-
uuid: string;
|
|
13
|
-
toh: string;
|
|
14
|
-
}) => {
|
|
15
|
-
const client = await createServerClient();
|
|
16
|
-
const { data, error } = await client.rpc('translation_search', {
|
|
17
|
-
search_term: text,
|
|
18
|
-
work_uuid: uuid,
|
|
19
|
-
toh: toh,
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
if (error) {
|
|
23
|
-
console.error('Search error:', error);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return searchResultsFromDTO(data);
|
|
28
|
-
};
|
package/src/lib/types/search.ts
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { GlossaryTermInstance, GlossaryTermInstanceDTO, glossaryTermInstanceFromDTO } from "@eightyfourthousand/data-access";
|
|
2
|
-
|
|
3
|
-
export const RESULTS_ENTITIES = [
|
|
4
|
-
'alignments',
|
|
5
|
-
'passages',
|
|
6
|
-
'bibliographies',
|
|
7
|
-
'glossaries',
|
|
8
|
-
] as const;
|
|
9
|
-
|
|
10
|
-
export type ResultsEntity = (typeof RESULTS_ENTITIES)[number];
|
|
11
|
-
|
|
12
|
-
export const RESULTS_ENTITY_LABELS: Record<ResultsEntity, string> = {
|
|
13
|
-
alignments: 'Translation Passages',
|
|
14
|
-
passages: 'Other Passages',
|
|
15
|
-
bibliographies: 'Bibliographies',
|
|
16
|
-
glossaries: 'Glossaries',
|
|
17
|
-
} as const;
|
|
18
|
-
|
|
19
|
-
export type BibliographySearchMatchDTO = {
|
|
20
|
-
bibliography_uuid: string;
|
|
21
|
-
content: string;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export type GlossarySearchMatchDTO = {
|
|
25
|
-
authority_uuid: string;
|
|
26
|
-
glossary_uuid: string;
|
|
27
|
-
content: string;
|
|
28
|
-
entry: GlossaryTermInstanceDTO;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export type PassageSearchMatchDTO = {
|
|
32
|
-
passage_uuid: string;
|
|
33
|
-
type: ResultsEntity;
|
|
34
|
-
label: string;
|
|
35
|
-
content: string;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export type AlignmentSearchMatchDTO = {
|
|
39
|
-
passage_uuid: string;
|
|
40
|
-
english_label: string;
|
|
41
|
-
english: string;
|
|
42
|
-
tibetan: string;
|
|
43
|
-
tibetan_volume_number: string;
|
|
44
|
-
tibetan_folio_number: string;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export type SearchMatch = {
|
|
48
|
-
type: string;
|
|
49
|
-
uuid: string;
|
|
50
|
-
content: string;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export type PassageMatch = SearchMatch & {
|
|
54
|
-
type: 'passage';
|
|
55
|
-
section: string;
|
|
56
|
-
label: string;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export type AlignmentMatch = SearchMatch & {
|
|
60
|
-
type: 'alignment';
|
|
61
|
-
section: 'translation';
|
|
62
|
-
label: string;
|
|
63
|
-
source: string;
|
|
64
|
-
volume: string;
|
|
65
|
-
folio: string;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export type BibliographyMatch = SearchMatch & {
|
|
69
|
-
type: 'bibliography';
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export type GlossaryMatch = SearchMatch & {
|
|
73
|
-
type: 'glossary';
|
|
74
|
-
entry: GlossaryTermInstance;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export type SearchResultsDTO = {
|
|
78
|
-
passage_matches: PassageSearchMatchDTO[];
|
|
79
|
-
alignment_matches: AlignmentSearchMatchDTO[];
|
|
80
|
-
bibliography_matches: BibliographySearchMatchDTO[];
|
|
81
|
-
glossary_matches: GlossarySearchMatchDTO[];
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export type SearchResult =
|
|
85
|
-
| SearchMatch
|
|
86
|
-
| PassageMatch
|
|
87
|
-
| AlignmentMatch
|
|
88
|
-
| BibliographyMatch
|
|
89
|
-
| GlossaryMatch;
|
|
90
|
-
|
|
91
|
-
export type SearchResults = {
|
|
92
|
-
passages: PassageMatch[];
|
|
93
|
-
alignments: AlignmentMatch[];
|
|
94
|
-
bibliographies: SearchMatch[];
|
|
95
|
-
glossaries: SearchMatch[];
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export const bibliographyMatchFromDTO = (
|
|
99
|
-
dto: BibliographySearchMatchDTO,
|
|
100
|
-
): BibliographyMatch => {
|
|
101
|
-
return {
|
|
102
|
-
type: 'bibliography',
|
|
103
|
-
uuid: dto.bibliography_uuid,
|
|
104
|
-
content: dto.content,
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
export const glossaryMatchFromDTO = (
|
|
109
|
-
dto: GlossarySearchMatchDTO,
|
|
110
|
-
): GlossaryMatch => {
|
|
111
|
-
return {
|
|
112
|
-
type: 'glossary',
|
|
113
|
-
uuid: dto.authority_uuid,
|
|
114
|
-
content: dto.content,
|
|
115
|
-
entry: glossaryTermInstanceFromDTO(dto.entry),
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
export const passageMatchFromDTO = (
|
|
120
|
-
dto: PassageSearchMatchDTO,
|
|
121
|
-
): PassageMatch => {
|
|
122
|
-
return {
|
|
123
|
-
type: 'passage',
|
|
124
|
-
uuid: dto.passage_uuid,
|
|
125
|
-
section: dto.type,
|
|
126
|
-
label: dto.label,
|
|
127
|
-
content: dto.content,
|
|
128
|
-
};
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
export const alignmentMatchFromDTO = (
|
|
132
|
-
dto: AlignmentSearchMatchDTO,
|
|
133
|
-
): AlignmentMatch => {
|
|
134
|
-
return {
|
|
135
|
-
type: 'alignment',
|
|
136
|
-
section: 'translation',
|
|
137
|
-
uuid: dto.passage_uuid,
|
|
138
|
-
label: dto.english_label,
|
|
139
|
-
content: dto.english,
|
|
140
|
-
source: dto.tibetan,
|
|
141
|
-
volume: dto.tibetan_volume_number,
|
|
142
|
-
folio: dto.tibetan_folio_number,
|
|
143
|
-
};
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
export const searchResultsFromDTO = (dto: SearchResultsDTO): SearchResults => {
|
|
147
|
-
return {
|
|
148
|
-
passages: dto.passage_matches.map(passageMatchFromDTO),
|
|
149
|
-
alignments: dto.alignment_matches.map(alignmentMatchFromDTO),
|
|
150
|
-
bibliographies: dto.bibliography_matches.map(bibliographyMatchFromDTO),
|
|
151
|
-
glossaries: dto.glossary_matches.map(glossaryMatchFromDTO),
|
|
152
|
-
};
|
|
153
|
-
};
|