@xyd-js/plugin-orama 0.1.0-xyd.2 → 0.1.0-xyd.41
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/CHANGELOG.md +443 -0
- package/dist/Search.tsx +9 -10
- package/dist/index.js +93 -7
- package/dist/index.js.map +1 -1
- package/package.json +10 -6
- package/src/Search.tsx +9 -10
- package/src/index.ts +14 -14
- package/tsup.config.ts +3 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,448 @@
|
|
|
1
1
|
# @xyd-js/plugin-orama
|
|
2
2
|
|
|
3
|
+
## 0.1.0-xyd.41
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- update all packages
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @xyd-js/components@0.1.0-xyd.52
|
|
10
|
+
- @xyd-js/content@0.1.0-xyd.55
|
|
11
|
+
- @xyd-js/core@0.1.0-xyd.54
|
|
12
|
+
- @xyd-js/plugins@0.1.0-xyd.41
|
|
13
|
+
|
|
14
|
+
## 0.1.0-xyd.40
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- update all packages
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
- @xyd-js/components@0.1.0-xyd.51
|
|
21
|
+
- @xyd-js/content@0.1.0-xyd.54
|
|
22
|
+
- @xyd-js/core@0.1.0-xyd.53
|
|
23
|
+
- @xyd-js/plugins@0.1.0-xyd.40
|
|
24
|
+
|
|
25
|
+
## 0.1.0-xyd.39
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- update all packages
|
|
30
|
+
- Updated dependencies
|
|
31
|
+
- @xyd-js/components@0.1.0-xyd.50
|
|
32
|
+
- @xyd-js/content@0.1.0-xyd.53
|
|
33
|
+
- @xyd-js/core@0.1.0-xyd.52
|
|
34
|
+
- @xyd-js/plugins@0.1.0-xyd.39
|
|
35
|
+
|
|
36
|
+
## 0.1.0-xyd.38
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- update all packages
|
|
41
|
+
- Updated dependencies
|
|
42
|
+
- @xyd-js/components@0.1.0-xyd.49
|
|
43
|
+
- @xyd-js/content@0.1.0-xyd.52
|
|
44
|
+
- @xyd-js/core@0.1.0-xyd.51
|
|
45
|
+
- @xyd-js/plugins@0.1.0-xyd.38
|
|
46
|
+
|
|
47
|
+
## 0.1.0-xyd.37
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- update all packages
|
|
52
|
+
- Updated dependencies
|
|
53
|
+
- @xyd-js/components@0.1.0-xyd.48
|
|
54
|
+
- @xyd-js/content@0.1.0-xyd.51
|
|
55
|
+
- @xyd-js/core@0.1.0-xyd.50
|
|
56
|
+
- @xyd-js/plugins@0.1.0-xyd.37
|
|
57
|
+
|
|
58
|
+
## 0.1.0-xyd.36
|
|
59
|
+
|
|
60
|
+
### Patch Changes
|
|
61
|
+
|
|
62
|
+
- update all packages
|
|
63
|
+
- Updated dependencies
|
|
64
|
+
- @xyd-js/components@0.1.0-xyd.47
|
|
65
|
+
- @xyd-js/content@0.1.0-xyd.50
|
|
66
|
+
- @xyd-js/core@0.1.0-xyd.49
|
|
67
|
+
- @xyd-js/plugins@0.1.0-xyd.36
|
|
68
|
+
|
|
69
|
+
## 0.1.0-xyd.35
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- update all packages
|
|
74
|
+
- Updated dependencies
|
|
75
|
+
- @xyd-js/components@0.1.0-xyd.46
|
|
76
|
+
- @xyd-js/content@0.1.0-xyd.49
|
|
77
|
+
- @xyd-js/core@0.1.0-xyd.48
|
|
78
|
+
- @xyd-js/plugins@0.1.0-xyd.35
|
|
79
|
+
|
|
80
|
+
## 0.1.0-xyd.34
|
|
81
|
+
|
|
82
|
+
### Patch Changes
|
|
83
|
+
|
|
84
|
+
- update all packages
|
|
85
|
+
- Updated dependencies
|
|
86
|
+
- @xyd-js/components@0.1.0-xyd.45
|
|
87
|
+
- @xyd-js/content@0.1.0-xyd.48
|
|
88
|
+
- @xyd-js/core@0.1.0-xyd.47
|
|
89
|
+
- @xyd-js/plugins@0.1.0-xyd.34
|
|
90
|
+
|
|
91
|
+
## 0.1.0-xyd.33
|
|
92
|
+
|
|
93
|
+
### Patch Changes
|
|
94
|
+
|
|
95
|
+
- update all packages
|
|
96
|
+
- Updated dependencies
|
|
97
|
+
- @xyd-js/components@0.1.0-xyd.44
|
|
98
|
+
- @xyd-js/content@0.1.0-xyd.47
|
|
99
|
+
- @xyd-js/core@0.1.0-xyd.46
|
|
100
|
+
- @xyd-js/plugins@0.1.0-xyd.33
|
|
101
|
+
|
|
102
|
+
## 0.1.0-xyd.32
|
|
103
|
+
|
|
104
|
+
### Patch Changes
|
|
105
|
+
|
|
106
|
+
- update all packages
|
|
107
|
+
- Updated dependencies
|
|
108
|
+
- @xyd-js/components@0.1.0-xyd.43
|
|
109
|
+
- @xyd-js/content@0.1.0-xyd.46
|
|
110
|
+
- @xyd-js/core@0.1.0-xyd.45
|
|
111
|
+
- @xyd-js/plugins@0.1.0-xyd.32
|
|
112
|
+
|
|
113
|
+
## 0.1.0-xyd.31
|
|
114
|
+
|
|
115
|
+
### Patch Changes
|
|
116
|
+
|
|
117
|
+
- update all packages
|
|
118
|
+
- Updated dependencies
|
|
119
|
+
- @xyd-js/components@0.1.0-xyd.42
|
|
120
|
+
- @xyd-js/content@0.1.0-xyd.45
|
|
121
|
+
- @xyd-js/core@0.1.0-xyd.44
|
|
122
|
+
- @xyd-js/plugins@0.1.0-xyd.31
|
|
123
|
+
|
|
124
|
+
## 0.1.0-xyd.30
|
|
125
|
+
|
|
126
|
+
### Patch Changes
|
|
127
|
+
|
|
128
|
+
- update all packages
|
|
129
|
+
- Updated dependencies
|
|
130
|
+
- @xyd-js/components@0.1.0-xyd.41
|
|
131
|
+
- @xyd-js/content@0.1.0-xyd.44
|
|
132
|
+
- @xyd-js/core@0.1.0-xyd.43
|
|
133
|
+
- @xyd-js/plugins@0.1.0-xyd.30
|
|
134
|
+
|
|
135
|
+
## 0.1.0-xyd.29
|
|
136
|
+
|
|
137
|
+
### Patch Changes
|
|
138
|
+
|
|
139
|
+
- update all packages
|
|
140
|
+
- Updated dependencies
|
|
141
|
+
- @xyd-js/components@0.1.0-xyd.40
|
|
142
|
+
- @xyd-js/content@0.1.0-xyd.43
|
|
143
|
+
- @xyd-js/core@0.1.0-xyd.42
|
|
144
|
+
- @xyd-js/plugins@0.1.0-xyd.29
|
|
145
|
+
|
|
146
|
+
## 0.1.0-xyd.28
|
|
147
|
+
|
|
148
|
+
### Patch Changes
|
|
149
|
+
|
|
150
|
+
- update all packages
|
|
151
|
+
- Updated dependencies
|
|
152
|
+
- @xyd-js/components@0.1.0-xyd.39
|
|
153
|
+
- @xyd-js/content@0.1.0-xyd.42
|
|
154
|
+
- @xyd-js/core@0.1.0-xyd.41
|
|
155
|
+
- @xyd-js/plugins@0.1.0-xyd.28
|
|
156
|
+
|
|
157
|
+
## 0.1.0-xyd.27
|
|
158
|
+
|
|
159
|
+
### Patch Changes
|
|
160
|
+
|
|
161
|
+
- update all packages
|
|
162
|
+
- Updated dependencies
|
|
163
|
+
- @xyd-js/components@0.1.0-xyd.38
|
|
164
|
+
- @xyd-js/content@0.1.0-xyd.41
|
|
165
|
+
- @xyd-js/core@0.1.0-xyd.40
|
|
166
|
+
- @xyd-js/plugins@0.1.0-xyd.27
|
|
167
|
+
|
|
168
|
+
## 0.1.0-xyd.26
|
|
169
|
+
|
|
170
|
+
### Patch Changes
|
|
171
|
+
|
|
172
|
+
- update all packages
|
|
173
|
+
- Updated dependencies
|
|
174
|
+
- @xyd-js/components@0.1.0-xyd.37
|
|
175
|
+
- @xyd-js/content@0.1.0-xyd.40
|
|
176
|
+
- @xyd-js/core@0.1.0-xyd.39
|
|
177
|
+
- @xyd-js/plugins@0.1.0-xyd.26
|
|
178
|
+
|
|
179
|
+
## 0.1.0-xyd.25
|
|
180
|
+
|
|
181
|
+
### Patch Changes
|
|
182
|
+
|
|
183
|
+
- update all packages
|
|
184
|
+
- Updated dependencies
|
|
185
|
+
- @xyd-js/components@0.1.0-xyd.36
|
|
186
|
+
- @xyd-js/content@0.1.0-xyd.39
|
|
187
|
+
- @xyd-js/core@0.1.0-xyd.38
|
|
188
|
+
- @xyd-js/plugins@0.1.0-xyd.25
|
|
189
|
+
|
|
190
|
+
## 0.1.0-xyd.24
|
|
191
|
+
|
|
192
|
+
### Patch Changes
|
|
193
|
+
|
|
194
|
+
- update all packages
|
|
195
|
+
- Updated dependencies
|
|
196
|
+
- @xyd-js/components@0.1.0-xyd.35
|
|
197
|
+
- @xyd-js/content@0.1.0-xyd.38
|
|
198
|
+
- @xyd-js/core@0.1.0-xyd.37
|
|
199
|
+
- @xyd-js/plugins@0.1.0-xyd.24
|
|
200
|
+
|
|
201
|
+
## 0.1.0-xyd.23
|
|
202
|
+
|
|
203
|
+
### Patch Changes
|
|
204
|
+
|
|
205
|
+
- update all packages
|
|
206
|
+
- Updated dependencies
|
|
207
|
+
- @xyd-js/components@0.1.0-xyd.34
|
|
208
|
+
- @xyd-js/content@0.1.0-xyd.37
|
|
209
|
+
- @xyd-js/core@0.1.0-xyd.36
|
|
210
|
+
- @xyd-js/plugins@0.1.0-xyd.23
|
|
211
|
+
|
|
212
|
+
## 0.1.0-xyd.22
|
|
213
|
+
|
|
214
|
+
### Patch Changes
|
|
215
|
+
|
|
216
|
+
- update all packages
|
|
217
|
+
- Updated dependencies
|
|
218
|
+
- @xyd-js/components@0.1.0-xyd.33
|
|
219
|
+
- @xyd-js/content@0.1.0-xyd.36
|
|
220
|
+
- @xyd-js/core@0.1.0-xyd.35
|
|
221
|
+
- @xyd-js/plugins@0.1.0-xyd.22
|
|
222
|
+
|
|
223
|
+
## 0.1.0-xyd.21
|
|
224
|
+
|
|
225
|
+
### Patch Changes
|
|
226
|
+
|
|
227
|
+
- update all packages
|
|
228
|
+
- Updated dependencies
|
|
229
|
+
- @xyd-js/components@0.1.0-xyd.32
|
|
230
|
+
- @xyd-js/content@0.1.0-xyd.35
|
|
231
|
+
- @xyd-js/core@0.1.0-xyd.34
|
|
232
|
+
- @xyd-js/plugins@0.1.0-xyd.21
|
|
233
|
+
|
|
234
|
+
## 0.1.0-xyd.20
|
|
235
|
+
|
|
236
|
+
### Patch Changes
|
|
237
|
+
|
|
238
|
+
- update all packages
|
|
239
|
+
- Updated dependencies
|
|
240
|
+
- @xyd-js/components@0.1.0-xyd.31
|
|
241
|
+
- @xyd-js/content@0.1.0-xyd.34
|
|
242
|
+
- @xyd-js/core@0.1.0-xyd.33
|
|
243
|
+
- @xyd-js/plugins@0.1.0-xyd.20
|
|
244
|
+
|
|
245
|
+
## 0.1.0-xyd.19
|
|
246
|
+
|
|
247
|
+
### Patch Changes
|
|
248
|
+
|
|
249
|
+
- update all packages
|
|
250
|
+
- Updated dependencies
|
|
251
|
+
- @xyd-js/components@0.1.0-xyd.30
|
|
252
|
+
- @xyd-js/content@0.1.0-xyd.33
|
|
253
|
+
- @xyd-js/core@0.1.0-xyd.32
|
|
254
|
+
- @xyd-js/plugins@0.1.0-xyd.19
|
|
255
|
+
|
|
256
|
+
## 0.1.0-xyd.18
|
|
257
|
+
|
|
258
|
+
### Patch Changes
|
|
259
|
+
|
|
260
|
+
- update all packages
|
|
261
|
+
- update all packages
|
|
262
|
+
- Updated dependencies
|
|
263
|
+
- Updated dependencies
|
|
264
|
+
- @xyd-js/components@0.1.0-xyd.29
|
|
265
|
+
- @xyd-js/content@0.1.0-xyd.32
|
|
266
|
+
- @xyd-js/core@0.1.0-xyd.31
|
|
267
|
+
- @xyd-js/plugins@0.1.0-xyd.18
|
|
268
|
+
|
|
269
|
+
## 0.1.0-xyd.17
|
|
270
|
+
|
|
271
|
+
### Patch Changes
|
|
272
|
+
|
|
273
|
+
- update all packages
|
|
274
|
+
- Updated dependencies
|
|
275
|
+
- @xyd-js/components@0.1.0-xyd.28
|
|
276
|
+
- @xyd-js/content@0.1.0-xyd.31
|
|
277
|
+
- @xyd-js/core@0.1.0-xyd.30
|
|
278
|
+
- @xyd-js/plugins@0.1.0-xyd.17
|
|
279
|
+
|
|
280
|
+
## 0.1.0-xyd.16
|
|
281
|
+
|
|
282
|
+
### Patch Changes
|
|
283
|
+
|
|
284
|
+
- update all packages
|
|
285
|
+
- update all packages
|
|
286
|
+
- Updated dependencies
|
|
287
|
+
- Updated dependencies
|
|
288
|
+
- @xyd-js/components@0.1.0-xyd.27
|
|
289
|
+
- @xyd-js/content@0.1.0-xyd.30
|
|
290
|
+
- @xyd-js/core@0.1.0-xyd.29
|
|
291
|
+
- @xyd-js/plugins@0.1.0-xyd.16
|
|
292
|
+
|
|
293
|
+
## 0.1.0-xyd.15
|
|
294
|
+
|
|
295
|
+
### Patch Changes
|
|
296
|
+
|
|
297
|
+
- update all packages
|
|
298
|
+
- update all packages
|
|
299
|
+
- Updated dependencies
|
|
300
|
+
- Updated dependencies
|
|
301
|
+
- @xyd-js/components@0.1.0-xyd.26
|
|
302
|
+
- @xyd-js/content@0.1.0-xyd.29
|
|
303
|
+
- @xyd-js/core@0.1.0-xyd.28
|
|
304
|
+
- @xyd-js/plugins@0.1.0-xyd.15
|
|
305
|
+
|
|
306
|
+
## 0.1.0-xyd.14
|
|
307
|
+
|
|
308
|
+
### Patch Changes
|
|
309
|
+
|
|
310
|
+
- update all packages
|
|
311
|
+
- update all packages
|
|
312
|
+
- Updated dependencies
|
|
313
|
+
- Updated dependencies
|
|
314
|
+
- @xyd-js/components@0.1.0-xyd.25
|
|
315
|
+
- @xyd-js/content@0.1.0-xyd.28
|
|
316
|
+
- @xyd-js/core@0.1.0-xyd.27
|
|
317
|
+
- @xyd-js/plugins@0.1.0-xyd.14
|
|
318
|
+
|
|
319
|
+
## 0.1.0-xyd.13
|
|
320
|
+
|
|
321
|
+
### Patch Changes
|
|
322
|
+
|
|
323
|
+
- update all packages
|
|
324
|
+
- update all packages
|
|
325
|
+
- Updated dependencies
|
|
326
|
+
- Updated dependencies
|
|
327
|
+
- @xyd-js/components@0.1.0-xyd.24
|
|
328
|
+
- @xyd-js/content@0.1.0-xyd.27
|
|
329
|
+
- @xyd-js/core@0.1.0-xyd.26
|
|
330
|
+
- @xyd-js/plugins@0.1.0-xyd.13
|
|
331
|
+
|
|
332
|
+
## 0.1.0-xyd.12
|
|
333
|
+
|
|
334
|
+
### Patch Changes
|
|
335
|
+
|
|
336
|
+
- update all packages
|
|
337
|
+
- update all packages
|
|
338
|
+
- Updated dependencies
|
|
339
|
+
- Updated dependencies
|
|
340
|
+
- @xyd-js/components@0.1.0-xyd.23
|
|
341
|
+
- @xyd-js/content@0.1.0-xyd.26
|
|
342
|
+
- @xyd-js/core@0.1.0-xyd.25
|
|
343
|
+
- @xyd-js/plugins@0.1.0-xyd.12
|
|
344
|
+
|
|
345
|
+
## 0.1.0-xyd.11
|
|
346
|
+
|
|
347
|
+
### Patch Changes
|
|
348
|
+
|
|
349
|
+
- update all packages
|
|
350
|
+
- update all packages
|
|
351
|
+
- Updated dependencies
|
|
352
|
+
- Updated dependencies
|
|
353
|
+
- @xyd-js/components@0.1.0-xyd.22
|
|
354
|
+
- @xyd-js/content@0.1.0-xyd.25
|
|
355
|
+
- @xyd-js/core@0.1.0-xyd.24
|
|
356
|
+
- @xyd-js/plugins@0.1.0-xyd.11
|
|
357
|
+
|
|
358
|
+
## 0.1.0-xyd.10
|
|
359
|
+
|
|
360
|
+
### Patch Changes
|
|
361
|
+
|
|
362
|
+
- update all packages
|
|
363
|
+
- Updated dependencies
|
|
364
|
+
- @xyd-js/components@0.1.0-xyd.21
|
|
365
|
+
- @xyd-js/content@0.1.0-xyd.24
|
|
366
|
+
- @xyd-js/core@0.1.0-xyd.23
|
|
367
|
+
- @xyd-js/plugins@0.1.0-xyd.10
|
|
368
|
+
|
|
369
|
+
## 0.1.0-xyd.9
|
|
370
|
+
|
|
371
|
+
### Patch Changes
|
|
372
|
+
|
|
373
|
+
- update all packages
|
|
374
|
+
- Updated dependencies
|
|
375
|
+
- @xyd-js/components@0.1.0-xyd.20
|
|
376
|
+
- @xyd-js/content@0.1.0-xyd.23
|
|
377
|
+
- @xyd-js/core@0.1.0-xyd.22
|
|
378
|
+
- @xyd-js/plugins@0.1.0-xyd.9
|
|
379
|
+
|
|
380
|
+
## 0.1.0-xyd.8
|
|
381
|
+
|
|
382
|
+
### Patch Changes
|
|
383
|
+
|
|
384
|
+
- update all packages
|
|
385
|
+
- Updated dependencies
|
|
386
|
+
- @xyd-js/components@0.1.0-xyd.19
|
|
387
|
+
- @xyd-js/content@0.1.0-xyd.22
|
|
388
|
+
- @xyd-js/core@0.1.0-xyd.21
|
|
389
|
+
- @xyd-js/plugins@0.1.0-xyd.8
|
|
390
|
+
|
|
391
|
+
## 0.1.0-xyd.7
|
|
392
|
+
|
|
393
|
+
### Patch Changes
|
|
394
|
+
|
|
395
|
+
- update
|
|
396
|
+
- Updated dependencies
|
|
397
|
+
- @xyd-js/components@0.1.0-xyd.18
|
|
398
|
+
- @xyd-js/content@0.1.0-xyd.21
|
|
399
|
+
- @xyd-js/core@0.1.0-xyd.20
|
|
400
|
+
- @xyd-js/plugins@0.1.0-xyd.7
|
|
401
|
+
|
|
402
|
+
## 0.1.0-xyd.6
|
|
403
|
+
|
|
404
|
+
### Patch Changes
|
|
405
|
+
|
|
406
|
+
- update
|
|
407
|
+
- Updated dependencies
|
|
408
|
+
- @xyd-js/components@0.1.0-xyd.17
|
|
409
|
+
- @xyd-js/content@0.1.0-xyd.20
|
|
410
|
+
- @xyd-js/core@0.1.0-xyd.19
|
|
411
|
+
- @xyd-js/plugins@0.1.0-xyd.6
|
|
412
|
+
|
|
413
|
+
## 0.1.0-xyd.5
|
|
414
|
+
|
|
415
|
+
### Patch Changes
|
|
416
|
+
|
|
417
|
+
- update
|
|
418
|
+
- Updated dependencies
|
|
419
|
+
- @xyd-js/components@0.1.0-xyd.16
|
|
420
|
+
- @xyd-js/content@0.1.0-xyd.19
|
|
421
|
+
- @xyd-js/core@0.1.0-xyd.18
|
|
422
|
+
- @xyd-js/plugins@0.1.0-xyd.5
|
|
423
|
+
|
|
424
|
+
## 0.1.0-xyd.4
|
|
425
|
+
|
|
426
|
+
### Patch Changes
|
|
427
|
+
|
|
428
|
+
- update
|
|
429
|
+
- Updated dependencies
|
|
430
|
+
- @xyd-js/components@0.1.0-xyd.15
|
|
431
|
+
- @xyd-js/content@0.1.0-xyd.18
|
|
432
|
+
- @xyd-js/core@0.1.0-xyd.17
|
|
433
|
+
- @xyd-js/plugins@0.1.0-xyd.4
|
|
434
|
+
|
|
435
|
+
## 0.1.0-xyd.3
|
|
436
|
+
|
|
437
|
+
### Patch Changes
|
|
438
|
+
|
|
439
|
+
- update
|
|
440
|
+
- Updated dependencies
|
|
441
|
+
- @xyd-js/components@0.1.0-xyd.14
|
|
442
|
+
- @xyd-js/content@0.1.0-xyd.17
|
|
443
|
+
- @xyd-js/core@0.1.0-xyd.16
|
|
444
|
+
- @xyd-js/plugins@0.1.0-xyd.3
|
|
445
|
+
|
|
3
446
|
## 0.1.0-xyd.2
|
|
4
447
|
|
|
5
448
|
### Patch Changes
|
package/dist/Search.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import React, {useState, lazy, Suspense, useEffect, useCallback} from "react"
|
|
2
|
+
import {createPortal} from 'react-dom'
|
|
3
|
+
import {create, insertMultiple} from '@orama/orama'
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import {SearchButton} from "@xyd-js/components/system"
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
const OramaSearchBox = lazy(() => import('@orama/react-components').then(mod => ({default: mod.OramaSearchBox})));
|
|
8
8
|
|
|
9
|
-
export function
|
|
9
|
+
export default function OramaSearch() {
|
|
10
10
|
const [isSearchOpen, setIsSearchOpen] = useState(false);
|
|
11
11
|
|
|
12
12
|
const handleClick = useCallback(() => {
|
|
@@ -22,16 +22,15 @@ export function SearchButton() {
|
|
|
22
22
|
}, [])
|
|
23
23
|
|
|
24
24
|
return <>
|
|
25
|
-
<
|
|
25
|
+
<SearchButton onClick={handleClick}/>
|
|
26
26
|
|
|
27
27
|
<Suspense>
|
|
28
|
-
<$OramaSearchBoxWrapper isSearchOpen={isSearchOpen} onModalClosed={onModalClosed}
|
|
28
|
+
<$OramaSearchBoxWrapper isSearchOpen={isSearchOpen} onModalClosed={onModalClosed}/>
|
|
29
29
|
</Suspense>
|
|
30
30
|
</>
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
function $OramaSearchBoxWrapper({ isSearchOpen, onModalClosed }: { isSearchOpen: boolean, onModalClosed: () => void }) {
|
|
33
|
+
function $OramaSearchBoxWrapper({isSearchOpen, onModalClosed}: { isSearchOpen: boolean, onModalClosed: () => void }) {
|
|
35
34
|
const [oramaLocalClientInstance, setOramaLocalClientInstance] = useState<any>(null);
|
|
36
35
|
const [pluginOptions, setPluginOptions] = useState<any>(null);
|
|
37
36
|
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,91 @@ var DEFAULT_SUGGESTIONS = [
|
|
|
8
8
|
"How to built-in components?"
|
|
9
9
|
];
|
|
10
10
|
|
|
11
|
+
// src/Search.tsx
|
|
12
|
+
import React, { useState, lazy, Suspense, useEffect, useCallback } from "react";
|
|
13
|
+
import { createPortal } from "react-dom";
|
|
14
|
+
import { create, insertMultiple } from "@orama/orama";
|
|
15
|
+
import { SearchButton } from "@xyd-js/components/system";
|
|
16
|
+
var OramaSearchBox = lazy(() => import("@orama/react-components").then((mod) => ({ default: mod.OramaSearchBox })));
|
|
17
|
+
function OramaSearch() {
|
|
18
|
+
const [isSearchOpen, setIsSearchOpen] = useState(false);
|
|
19
|
+
const handleClick = useCallback(() => {
|
|
20
|
+
if (isSearchOpen) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
setIsSearchOpen(true);
|
|
24
|
+
}, []);
|
|
25
|
+
const onModalClosed = useCallback(() => {
|
|
26
|
+
setIsSearchOpen(false);
|
|
27
|
+
}, []);
|
|
28
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SearchButton, { onClick: handleClick }), /* @__PURE__ */ React.createElement(Suspense, null, /* @__PURE__ */ React.createElement($OramaSearchBoxWrapper, { isSearchOpen, onModalClosed })));
|
|
29
|
+
}
|
|
30
|
+
function $OramaSearchBoxWrapper({ isSearchOpen, onModalClosed }) {
|
|
31
|
+
const [oramaLocalClientInstance, setOramaLocalClientInstance] = useState(null);
|
|
32
|
+
const [pluginOptions, setPluginOptions] = useState(null);
|
|
33
|
+
async function loadData() {
|
|
34
|
+
const oramaDataModule = await import("virtual:xyd-plugin-orama-data");
|
|
35
|
+
const oramaDocs = oramaDataModule.default.docs;
|
|
36
|
+
const oramaCloudConfig = oramaDataModule.default.cloudConfig || null;
|
|
37
|
+
const oramaSuggestions = oramaDataModule.default.suggestions || [];
|
|
38
|
+
if (oramaCloudConfig) {
|
|
39
|
+
setPluginOptions({
|
|
40
|
+
cloudConfig: oramaCloudConfig,
|
|
41
|
+
suggestions: oramaSuggestions
|
|
42
|
+
});
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const db = await createOramaInstance(oramaDocs);
|
|
46
|
+
setOramaLocalClientInstance(db);
|
|
47
|
+
setPluginOptions({
|
|
48
|
+
suggestions: oramaSuggestions
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
loadData();
|
|
53
|
+
}, []);
|
|
54
|
+
if (!isSearchOpen) return null;
|
|
55
|
+
const searchBox = oramaLocalClientInstance || pluginOptions?.cloudConfig ? /* @__PURE__ */ React.createElement(
|
|
56
|
+
OramaSearchBox,
|
|
57
|
+
{
|
|
58
|
+
open: isSearchOpen,
|
|
59
|
+
clientInstance: oramaLocalClientInstance,
|
|
60
|
+
onModalClosed,
|
|
61
|
+
suggestions: pluginOptions.suggestions,
|
|
62
|
+
highlightTitle: {
|
|
63
|
+
caseSensitive: false,
|
|
64
|
+
HTMLTag: "b"
|
|
65
|
+
},
|
|
66
|
+
highlightDescription: {
|
|
67
|
+
caseSensitive: false,
|
|
68
|
+
HTMLTag: "b"
|
|
69
|
+
},
|
|
70
|
+
index: pluginOptions?.cloudConfig && {
|
|
71
|
+
endpoint: pluginOptions.cloudConfig.endpoint,
|
|
72
|
+
api_key: pluginOptions.cloudConfig.apiKey
|
|
73
|
+
},
|
|
74
|
+
disableChat: !pluginOptions?.cloudConfig
|
|
75
|
+
}
|
|
76
|
+
) : null;
|
|
77
|
+
return createPortal(searchBox, document.body);
|
|
78
|
+
}
|
|
79
|
+
async function createOramaInstance(oramaDocs) {
|
|
80
|
+
const db = create({
|
|
81
|
+
schema: {
|
|
82
|
+
category: "string",
|
|
83
|
+
path: "string",
|
|
84
|
+
title: "string",
|
|
85
|
+
description: "string",
|
|
86
|
+
content: "string"
|
|
87
|
+
},
|
|
88
|
+
plugins: [
|
|
89
|
+
// TODO: finish pluganalytics
|
|
90
|
+
]
|
|
91
|
+
});
|
|
92
|
+
await insertMultiple(db, oramaDocs);
|
|
93
|
+
return db;
|
|
94
|
+
}
|
|
95
|
+
|
|
11
96
|
// src/index.ts
|
|
12
97
|
function OramaPlugin(pluginOptions = {}) {
|
|
13
98
|
return function(settings) {
|
|
@@ -18,6 +103,14 @@ function OramaPlugin(pluginOptions = {}) {
|
|
|
18
103
|
settings,
|
|
19
104
|
pluginOptions
|
|
20
105
|
)
|
|
106
|
+
],
|
|
107
|
+
components: [
|
|
108
|
+
{
|
|
109
|
+
component: OramaSearch,
|
|
110
|
+
name: "Search",
|
|
111
|
+
dist: "@xyd-js/plugin-orama/Search"
|
|
112
|
+
// TODO: better in the future
|
|
113
|
+
}
|
|
21
114
|
]
|
|
22
115
|
};
|
|
23
116
|
};
|
|
@@ -29,13 +122,6 @@ function vitePlugin(settings, pluginOptions = {}) {
|
|
|
29
122
|
return {
|
|
30
123
|
name: "xyd-plugin-orama",
|
|
31
124
|
enforce: "pre",
|
|
32
|
-
config: () => ({
|
|
33
|
-
resolve: {
|
|
34
|
-
alias: {
|
|
35
|
-
"virtual-component:Search": new URL("./Search.tsx", import.meta.url).pathname
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}),
|
|
39
125
|
async configResolved(config) {
|
|
40
126
|
if (resolveConfig) {
|
|
41
127
|
return;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/const.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/const.ts","../src/Search.tsx"],"sourcesContent":["import type {Plugin as VitePlugin, ResolvedConfig} from 'vite'\n\nimport type {Settings} from '@xyd-js/core'\nimport type {Plugin} from '@xyd-js/plugins'\nimport {mapSettingsToDocSections, type DocSectionSchema} from '@xyd-js/content/md'\n\nimport {DEFAULT_SUGGESTIONS} from './const'\nimport type {OramaPluginOptions, OramaCloudConfig, OramaSectionSchema} from './types'\nimport Search from './Search'\n\nexport default function OramaPlugin(\n pluginOptions: OramaPluginOptions = {}\n): Plugin {\n return function (settings: Settings) {\n return {\n name: \"plugin-orama\",\n vite: [\n vitePlugin(\n settings,\n pluginOptions,\n )\n ],\n components: [\n {\n component: Search,\n name: \"Search\",\n dist: \"@xyd-js/plugin-orama/Search\" // TODO: better in the future\n }\n ]\n }\n }\n}\n\nfunction vitePlugin(\n settings: Settings,\n pluginOptions: OramaPluginOptions = {}\n): VitePlugin {\n const virtualModuleId = 'virtual:xyd-plugin-orama-data'\n const resolvedVirtualModuleId = `\\0${virtualModuleId}`\n\n let resolveConfig: ResolvedConfig | null = null\n\n return {\n name: 'xyd-plugin-orama',\n enforce: 'pre',\n\n async configResolved(config: ResolvedConfig) {\n if (resolveConfig) {\n return\n }\n\n resolveConfig = config\n },\n\n async resolveId(id) {\n if (id === virtualModuleId) {\n return resolvedVirtualModuleId\n }\n },\n\n async load(this, id: string) {\n if (id !== resolvedVirtualModuleId) {\n return\n }\n\n let cloudConfig: OramaCloudConfig | null = null\n if (pluginOptions.endpoint && pluginOptions.apiKey) {\n cloudConfig = {\n endpoint: pluginOptions.endpoint,\n apiKey: pluginOptions.apiKey\n }\n }\n\n const sections = (await mapSettingsToDocSections(settings)).map(mapDocSectionsToOrama)\n\n return `\n const docs = ${JSON.stringify(sections)};\n const cloudConfig = ${JSON.stringify(cloudConfig)};\n const suggestions = ${JSON.stringify(pluginOptions.suggestions || DEFAULT_SUGGESTIONS)};\n\n export default { docs, cloudConfig, suggestions };\n `\n }\n }\n}\n\nfunction mapDocSectionsToOrama(doc: DocSectionSchema): OramaSectionSchema {\n return {\n category: '', // TODO: finish\n\n path: doc.pageUrl,\n\n title: doc.headingTitle,\n\n description: doc.content,\n\n content: doc.content,\n\n // section: doc.content,\n // version: string\n }\n}\n\n","export const DEFAULT_SUGGESTIONS = [\n \"How to install xyd?\",\n \"How to generate API Docs?\",\n \"How to built-in components?\",\n]","import React, {useState, lazy, Suspense, useEffect, useCallback} from \"react\"\nimport {createPortal} from 'react-dom'\nimport {create, insertMultiple} from '@orama/orama'\n\nimport {SearchButton} from \"@xyd-js/components/system\"\n\nconst OramaSearchBox = lazy(() => import('@orama/react-components').then(mod => ({default: mod.OramaSearchBox})));\n\nexport default function OramaSearch() {\n const [isSearchOpen, setIsSearchOpen] = useState(false);\n\n const handleClick = useCallback(() => {\n if (isSearchOpen) {\n return\n }\n\n setIsSearchOpen(true)\n }, [])\n\n const onModalClosed = useCallback(() => {\n setIsSearchOpen(false)\n }, [])\n\n return <>\n <SearchButton onClick={handleClick}/>\n\n <Suspense>\n <$OramaSearchBoxWrapper isSearchOpen={isSearchOpen} onModalClosed={onModalClosed}/>\n </Suspense>\n </>\n}\n\nfunction $OramaSearchBoxWrapper({isSearchOpen, onModalClosed}: { isSearchOpen: boolean, onModalClosed: () => void }) {\n const [oramaLocalClientInstance, setOramaLocalClientInstance] = useState<any>(null);\n const [pluginOptions, setPluginOptions] = useState<any>(null);\n\n async function loadData() {\n // @ts-ignore\n const oramaDataModule = await import('virtual:xyd-plugin-orama-data')\n\n const oramaDocs = oramaDataModule.default.docs\n const oramaCloudConfig = oramaDataModule.default.cloudConfig || null\n const oramaSuggestions = oramaDataModule.default.suggestions || []\n\n if (oramaCloudConfig) {\n setPluginOptions({\n cloudConfig: oramaCloudConfig,\n suggestions: oramaSuggestions\n })\n return\n }\n\n const db = await createOramaInstance(oramaDocs)\n\n setOramaLocalClientInstance(db)\n setPluginOptions({\n suggestions: oramaSuggestions\n })\n }\n\n useEffect(() => {\n loadData()\n }, [])\n\n if (!isSearchOpen) return null;\n\n const searchBox = (oramaLocalClientInstance || pluginOptions?.cloudConfig) ? (\n <OramaSearchBox\n open={isSearchOpen}\n clientInstance={oramaLocalClientInstance}\n onModalClosed={onModalClosed}\n suggestions={pluginOptions.suggestions}\n highlightTitle={{\n caseSensitive: false,\n HTMLTag: 'b',\n }}\n highlightDescription={{\n caseSensitive: false,\n HTMLTag: 'b',\n }}\n index={pluginOptions?.cloudConfig && {\n endpoint: pluginOptions.cloudConfig.endpoint,\n api_key: pluginOptions.cloudConfig.apiKey\n }}\n disableChat={!pluginOptions?.cloudConfig}\n />\n ) : null;\n\n\n return createPortal(searchBox, document.body);\n}\n\nasync function createOramaInstance(oramaDocs: any[]): Promise<any> {\n const db = create({\n schema: {\n category: \"string\",\n path: \"string\",\n title: \"string\",\n description: \"string\",\n content: \"string\"\n },\n plugins: [\n // TODO: finish pluganalytics\n ]\n })\n\n await insertMultiple(db, oramaDocs as any)\n\n return db\n}"],"mappings":"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","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyd-js/plugin-orama",
|
|
3
|
-
"version": "0.1.0-xyd.
|
|
3
|
+
"version": "0.1.0-xyd.41",
|
|
4
4
|
"author": "",
|
|
5
5
|
"description": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,13 +25,17 @@
|
|
|
25
25
|
"remark-parse": "^11.0.0",
|
|
26
26
|
"remark-rehype": "^11.0.0",
|
|
27
27
|
"rehype-stringify": "^10.0.0",
|
|
28
|
-
"@xyd-js/core": "0.1.0-xyd.
|
|
29
|
-
"@xyd-js/
|
|
30
|
-
"@xyd-js/
|
|
31
|
-
"@xyd-js/plugins": "0.1.0-xyd.
|
|
28
|
+
"@xyd-js/core": "0.1.0-xyd.54",
|
|
29
|
+
"@xyd-js/content": "0.1.0-xyd.55",
|
|
30
|
+
"@xyd-js/components": "0.1.0-xyd.52",
|
|
31
|
+
"@xyd-js/plugins": "0.1.0-xyd.41"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"react": "^19.1.0",
|
|
35
|
+
"react-dom": "^19.1.0"
|
|
32
36
|
},
|
|
33
37
|
"devDependencies": {
|
|
34
|
-
"vite": "^
|
|
38
|
+
"vite": "^7.0.0",
|
|
35
39
|
"@vitest/coverage-v8": "^1.6.1",
|
|
36
40
|
"rimraf": "^3.0.2",
|
|
37
41
|
"tsup": "^8.4.0",
|
package/src/Search.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import React, {useState, lazy, Suspense, useEffect, useCallback} from "react"
|
|
2
|
+
import {createPortal} from 'react-dom'
|
|
3
|
+
import {create, insertMultiple} from '@orama/orama'
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import {SearchButton} from "@xyd-js/components/system"
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
const OramaSearchBox = lazy(() => import('@orama/react-components').then(mod => ({default: mod.OramaSearchBox})));
|
|
8
8
|
|
|
9
|
-
export function
|
|
9
|
+
export default function OramaSearch() {
|
|
10
10
|
const [isSearchOpen, setIsSearchOpen] = useState(false);
|
|
11
11
|
|
|
12
12
|
const handleClick = useCallback(() => {
|
|
@@ -22,16 +22,15 @@ export function SearchButton() {
|
|
|
22
22
|
}, [])
|
|
23
23
|
|
|
24
24
|
return <>
|
|
25
|
-
<
|
|
25
|
+
<SearchButton onClick={handleClick}/>
|
|
26
26
|
|
|
27
27
|
<Suspense>
|
|
28
|
-
<$OramaSearchBoxWrapper isSearchOpen={isSearchOpen} onModalClosed={onModalClosed}
|
|
28
|
+
<$OramaSearchBoxWrapper isSearchOpen={isSearchOpen} onModalClosed={onModalClosed}/>
|
|
29
29
|
</Suspense>
|
|
30
30
|
</>
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
function $OramaSearchBoxWrapper({ isSearchOpen, onModalClosed }: { isSearchOpen: boolean, onModalClosed: () => void }) {
|
|
33
|
+
function $OramaSearchBoxWrapper({isSearchOpen, onModalClosed}: { isSearchOpen: boolean, onModalClosed: () => void }) {
|
|
35
34
|
const [oramaLocalClientInstance, setOramaLocalClientInstance] = useState<any>(null);
|
|
36
35
|
const [pluginOptions, setPluginOptions] = useState<any>(null);
|
|
37
36
|
|
package/src/index.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {Plugin as VitePlugin, ResolvedConfig} from 'vite'
|
|
2
2
|
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import {
|
|
3
|
+
import type {Settings} from '@xyd-js/core'
|
|
4
|
+
import type {Plugin} from '@xyd-js/plugins'
|
|
5
|
+
import {mapSettingsToDocSections, type DocSectionSchema} from '@xyd-js/content/md'
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import type {
|
|
7
|
+
import {DEFAULT_SUGGESTIONS} from './const'
|
|
8
|
+
import type {OramaPluginOptions, OramaCloudConfig, OramaSectionSchema} from './types'
|
|
9
|
+
import Search from './Search'
|
|
9
10
|
|
|
10
11
|
export default function OramaPlugin(
|
|
11
12
|
pluginOptions: OramaPluginOptions = {}
|
|
@@ -18,6 +19,13 @@ export default function OramaPlugin(
|
|
|
18
19
|
settings,
|
|
19
20
|
pluginOptions,
|
|
20
21
|
)
|
|
22
|
+
],
|
|
23
|
+
components: [
|
|
24
|
+
{
|
|
25
|
+
component: Search,
|
|
26
|
+
name: "Search",
|
|
27
|
+
dist: "@xyd-js/plugin-orama/Search" // TODO: better in the future
|
|
28
|
+
}
|
|
21
29
|
]
|
|
22
30
|
}
|
|
23
31
|
}
|
|
@@ -36,14 +44,6 @@ function vitePlugin(
|
|
|
36
44
|
name: 'xyd-plugin-orama',
|
|
37
45
|
enforce: 'pre',
|
|
38
46
|
|
|
39
|
-
config: () => ({
|
|
40
|
-
resolve: {
|
|
41
|
-
alias: {
|
|
42
|
-
'virtual-component:Search': new URL('./Search.tsx', import.meta.url).pathname
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}),
|
|
46
|
-
|
|
47
47
|
async configResolved(config: ResolvedConfig) {
|
|
48
48
|
if (resolveConfig) {
|
|
49
49
|
return
|
package/tsup.config.ts
CHANGED
|
@@ -3,19 +3,13 @@ import {join} from 'node:path';
|
|
|
3
3
|
|
|
4
4
|
import {defineConfig, Options} from 'tsup';
|
|
5
5
|
|
|
6
|
-
import pkg from './package.json';
|
|
7
|
-
|
|
8
|
-
const deps = [
|
|
9
|
-
// ...Object.keys(pkg.dependencies || {}),
|
|
10
|
-
...Object.keys(pkg.devDependencies || {}),
|
|
11
|
-
]
|
|
12
6
|
const config: Options = {
|
|
13
7
|
entry: {
|
|
14
|
-
index: 'src/index.ts'
|
|
8
|
+
index: 'src/index.ts'
|
|
15
9
|
},
|
|
16
10
|
dts: {
|
|
17
11
|
entry: {
|
|
18
|
-
index: 'src/index.ts'
|
|
12
|
+
index: 'src/index.ts'
|
|
19
13
|
},
|
|
20
14
|
resolve: true, // Resolve external types
|
|
21
15
|
},
|
|
@@ -26,7 +20,7 @@ const config: Options = {
|
|
|
26
20
|
sourcemap: true,
|
|
27
21
|
clean: true,
|
|
28
22
|
external: [
|
|
29
|
-
|
|
23
|
+
'virtual:xyd-plugin-orama-data'
|
|
30
24
|
],
|
|
31
25
|
onSuccess: async () => {
|
|
32
26
|
await copyFile(
|