@xyd-js/plugin-orama 0.1.0-xyd.2 → 0.1.0-xyd.53

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 CHANGED
@@ -1,5 +1,592 @@
1
1
  # @xyd-js/plugin-orama
2
2
 
3
+ ## 0.1.0-xyd.53
4
+
5
+ ### Patch Changes
6
+
7
+ - update all packages
8
+ - update all packages
9
+ - Updated dependencies
10
+ - Updated dependencies
11
+ - @xyd-js/components@0.1.0-xyd.64
12
+ - @xyd-js/content@0.1.0-xyd.67
13
+ - @xyd-js/core@0.1.0-xyd.66
14
+ - @xyd-js/plugins@0.1.0-xyd.53
15
+
16
+ ## 0.1.0-xyd.52
17
+
18
+ ### Patch Changes
19
+
20
+ - update all packages
21
+ - Updated dependencies
22
+ - @xyd-js/components@0.1.0-xyd.63
23
+ - @xyd-js/content@0.1.0-xyd.66
24
+ - @xyd-js/core@0.1.0-xyd.65
25
+ - @xyd-js/plugins@0.1.0-xyd.52
26
+
27
+ ## 0.1.0-xyd.51
28
+
29
+ ### Patch Changes
30
+
31
+ - update all packages
32
+ - Updated dependencies
33
+ - @xyd-js/components@0.1.0-xyd.62
34
+ - @xyd-js/content@0.1.0-xyd.65
35
+ - @xyd-js/core@0.1.0-xyd.64
36
+ - @xyd-js/plugins@0.1.0-xyd.51
37
+
38
+ ## 0.1.0-xyd.50
39
+
40
+ ### Patch Changes
41
+
42
+ - update all packages
43
+ - Updated dependencies
44
+ - @xyd-js/components@0.1.0-xyd.61
45
+ - @xyd-js/content@0.1.0-xyd.64
46
+ - @xyd-js/core@0.1.0-xyd.63
47
+ - @xyd-js/plugins@0.1.0-xyd.50
48
+
49
+ ## 0.1.0-xyd.49
50
+
51
+ ### Patch Changes
52
+
53
+ - update all packages
54
+ - Updated dependencies
55
+ - @xyd-js/components@0.1.0-xyd.60
56
+ - @xyd-js/content@0.1.0-xyd.63
57
+ - @xyd-js/core@0.1.0-xyd.62
58
+ - @xyd-js/plugins@0.1.0-xyd.49
59
+
60
+ ## 0.1.0-xyd.48
61
+
62
+ ### Patch Changes
63
+
64
+ - update all packages
65
+ - Updated dependencies
66
+ - @xyd-js/components@0.1.0-xyd.59
67
+ - @xyd-js/content@0.1.0-xyd.62
68
+ - @xyd-js/core@0.1.0-xyd.61
69
+ - @xyd-js/plugins@0.1.0-xyd.48
70
+
71
+ ## 0.1.0-xyd.47
72
+
73
+ ### Patch Changes
74
+
75
+ - update all packages
76
+ - Updated dependencies
77
+ - @xyd-js/components@0.1.0-xyd.58
78
+ - @xyd-js/content@0.1.0-xyd.61
79
+ - @xyd-js/core@0.1.0-xyd.60
80
+ - @xyd-js/plugins@0.1.0-xyd.47
81
+
82
+ ## 0.1.0-xyd.46
83
+
84
+ ### Patch Changes
85
+
86
+ - update all packages
87
+ - Updated dependencies
88
+ - @xyd-js/components@0.1.0-xyd.57
89
+ - @xyd-js/content@0.1.0-xyd.60
90
+ - @xyd-js/core@0.1.0-xyd.59
91
+ - @xyd-js/plugins@0.1.0-xyd.46
92
+
93
+ ## 0.1.0-xyd.45
94
+
95
+ ### Patch Changes
96
+
97
+ - update all packages
98
+ - Updated dependencies
99
+ - @xyd-js/components@0.1.0-xyd.56
100
+ - @xyd-js/content@0.1.0-xyd.59
101
+ - @xyd-js/core@0.1.0-xyd.58
102
+ - @xyd-js/plugins@0.1.0-xyd.45
103
+
104
+ ## 0.1.0-xyd.44
105
+
106
+ ### Patch Changes
107
+
108
+ - update all packages
109
+ - Updated dependencies
110
+ - @xyd-js/components@0.1.0-xyd.55
111
+ - @xyd-js/content@0.1.0-xyd.58
112
+ - @xyd-js/core@0.1.0-xyd.57
113
+ - @xyd-js/plugins@0.1.0-xyd.44
114
+
115
+ ## 0.1.0-xyd.43
116
+
117
+ ### Patch Changes
118
+
119
+ - update all packages
120
+ - Updated dependencies
121
+ - @xyd-js/components@0.1.0-xyd.54
122
+ - @xyd-js/content@0.1.0-xyd.57
123
+ - @xyd-js/core@0.1.0-xyd.56
124
+ - @xyd-js/plugins@0.1.0-xyd.43
125
+
126
+ ## 0.1.0-xyd.42
127
+
128
+ ### Patch Changes
129
+
130
+ - update all packages
131
+ - update all packages
132
+ - update all packages
133
+ - update all packages
134
+ - update all packages
135
+ - update all packages
136
+ - Updated dependencies
137
+ - Updated dependencies
138
+ - Updated dependencies
139
+ - Updated dependencies
140
+ - Updated dependencies
141
+ - Updated dependencies
142
+ - @xyd-js/components@0.1.0-xyd.53
143
+ - @xyd-js/content@0.1.0-xyd.56
144
+ - @xyd-js/core@0.1.0-xyd.55
145
+ - @xyd-js/plugins@0.1.0-xyd.42
146
+
147
+ ## 0.1.0-xyd.41
148
+
149
+ ### Patch Changes
150
+
151
+ - update all packages
152
+ - Updated dependencies
153
+ - @xyd-js/components@0.1.0-xyd.52
154
+ - @xyd-js/content@0.1.0-xyd.55
155
+ - @xyd-js/core@0.1.0-xyd.54
156
+ - @xyd-js/plugins@0.1.0-xyd.41
157
+
158
+ ## 0.1.0-xyd.40
159
+
160
+ ### Patch Changes
161
+
162
+ - update all packages
163
+ - Updated dependencies
164
+ - @xyd-js/components@0.1.0-xyd.51
165
+ - @xyd-js/content@0.1.0-xyd.54
166
+ - @xyd-js/core@0.1.0-xyd.53
167
+ - @xyd-js/plugins@0.1.0-xyd.40
168
+
169
+ ## 0.1.0-xyd.39
170
+
171
+ ### Patch Changes
172
+
173
+ - update all packages
174
+ - Updated dependencies
175
+ - @xyd-js/components@0.1.0-xyd.50
176
+ - @xyd-js/content@0.1.0-xyd.53
177
+ - @xyd-js/core@0.1.0-xyd.52
178
+ - @xyd-js/plugins@0.1.0-xyd.39
179
+
180
+ ## 0.1.0-xyd.38
181
+
182
+ ### Patch Changes
183
+
184
+ - update all packages
185
+ - Updated dependencies
186
+ - @xyd-js/components@0.1.0-xyd.49
187
+ - @xyd-js/content@0.1.0-xyd.52
188
+ - @xyd-js/core@0.1.0-xyd.51
189
+ - @xyd-js/plugins@0.1.0-xyd.38
190
+
191
+ ## 0.1.0-xyd.37
192
+
193
+ ### Patch Changes
194
+
195
+ - update all packages
196
+ - Updated dependencies
197
+ - @xyd-js/components@0.1.0-xyd.48
198
+ - @xyd-js/content@0.1.0-xyd.51
199
+ - @xyd-js/core@0.1.0-xyd.50
200
+ - @xyd-js/plugins@0.1.0-xyd.37
201
+
202
+ ## 0.1.0-xyd.36
203
+
204
+ ### Patch Changes
205
+
206
+ - update all packages
207
+ - Updated dependencies
208
+ - @xyd-js/components@0.1.0-xyd.47
209
+ - @xyd-js/content@0.1.0-xyd.50
210
+ - @xyd-js/core@0.1.0-xyd.49
211
+ - @xyd-js/plugins@0.1.0-xyd.36
212
+
213
+ ## 0.1.0-xyd.35
214
+
215
+ ### Patch Changes
216
+
217
+ - update all packages
218
+ - Updated dependencies
219
+ - @xyd-js/components@0.1.0-xyd.46
220
+ - @xyd-js/content@0.1.0-xyd.49
221
+ - @xyd-js/core@0.1.0-xyd.48
222
+ - @xyd-js/plugins@0.1.0-xyd.35
223
+
224
+ ## 0.1.0-xyd.34
225
+
226
+ ### Patch Changes
227
+
228
+ - update all packages
229
+ - Updated dependencies
230
+ - @xyd-js/components@0.1.0-xyd.45
231
+ - @xyd-js/content@0.1.0-xyd.48
232
+ - @xyd-js/core@0.1.0-xyd.47
233
+ - @xyd-js/plugins@0.1.0-xyd.34
234
+
235
+ ## 0.1.0-xyd.33
236
+
237
+ ### Patch Changes
238
+
239
+ - update all packages
240
+ - Updated dependencies
241
+ - @xyd-js/components@0.1.0-xyd.44
242
+ - @xyd-js/content@0.1.0-xyd.47
243
+ - @xyd-js/core@0.1.0-xyd.46
244
+ - @xyd-js/plugins@0.1.0-xyd.33
245
+
246
+ ## 0.1.0-xyd.32
247
+
248
+ ### Patch Changes
249
+
250
+ - update all packages
251
+ - Updated dependencies
252
+ - @xyd-js/components@0.1.0-xyd.43
253
+ - @xyd-js/content@0.1.0-xyd.46
254
+ - @xyd-js/core@0.1.0-xyd.45
255
+ - @xyd-js/plugins@0.1.0-xyd.32
256
+
257
+ ## 0.1.0-xyd.31
258
+
259
+ ### Patch Changes
260
+
261
+ - update all packages
262
+ - Updated dependencies
263
+ - @xyd-js/components@0.1.0-xyd.42
264
+ - @xyd-js/content@0.1.0-xyd.45
265
+ - @xyd-js/core@0.1.0-xyd.44
266
+ - @xyd-js/plugins@0.1.0-xyd.31
267
+
268
+ ## 0.1.0-xyd.30
269
+
270
+ ### Patch Changes
271
+
272
+ - update all packages
273
+ - Updated dependencies
274
+ - @xyd-js/components@0.1.0-xyd.41
275
+ - @xyd-js/content@0.1.0-xyd.44
276
+ - @xyd-js/core@0.1.0-xyd.43
277
+ - @xyd-js/plugins@0.1.0-xyd.30
278
+
279
+ ## 0.1.0-xyd.29
280
+
281
+ ### Patch Changes
282
+
283
+ - update all packages
284
+ - Updated dependencies
285
+ - @xyd-js/components@0.1.0-xyd.40
286
+ - @xyd-js/content@0.1.0-xyd.43
287
+ - @xyd-js/core@0.1.0-xyd.42
288
+ - @xyd-js/plugins@0.1.0-xyd.29
289
+
290
+ ## 0.1.0-xyd.28
291
+
292
+ ### Patch Changes
293
+
294
+ - update all packages
295
+ - Updated dependencies
296
+ - @xyd-js/components@0.1.0-xyd.39
297
+ - @xyd-js/content@0.1.0-xyd.42
298
+ - @xyd-js/core@0.1.0-xyd.41
299
+ - @xyd-js/plugins@0.1.0-xyd.28
300
+
301
+ ## 0.1.0-xyd.27
302
+
303
+ ### Patch Changes
304
+
305
+ - update all packages
306
+ - Updated dependencies
307
+ - @xyd-js/components@0.1.0-xyd.38
308
+ - @xyd-js/content@0.1.0-xyd.41
309
+ - @xyd-js/core@0.1.0-xyd.40
310
+ - @xyd-js/plugins@0.1.0-xyd.27
311
+
312
+ ## 0.1.0-xyd.26
313
+
314
+ ### Patch Changes
315
+
316
+ - update all packages
317
+ - Updated dependencies
318
+ - @xyd-js/components@0.1.0-xyd.37
319
+ - @xyd-js/content@0.1.0-xyd.40
320
+ - @xyd-js/core@0.1.0-xyd.39
321
+ - @xyd-js/plugins@0.1.0-xyd.26
322
+
323
+ ## 0.1.0-xyd.25
324
+
325
+ ### Patch Changes
326
+
327
+ - update all packages
328
+ - Updated dependencies
329
+ - @xyd-js/components@0.1.0-xyd.36
330
+ - @xyd-js/content@0.1.0-xyd.39
331
+ - @xyd-js/core@0.1.0-xyd.38
332
+ - @xyd-js/plugins@0.1.0-xyd.25
333
+
334
+ ## 0.1.0-xyd.24
335
+
336
+ ### Patch Changes
337
+
338
+ - update all packages
339
+ - Updated dependencies
340
+ - @xyd-js/components@0.1.0-xyd.35
341
+ - @xyd-js/content@0.1.0-xyd.38
342
+ - @xyd-js/core@0.1.0-xyd.37
343
+ - @xyd-js/plugins@0.1.0-xyd.24
344
+
345
+ ## 0.1.0-xyd.23
346
+
347
+ ### Patch Changes
348
+
349
+ - update all packages
350
+ - Updated dependencies
351
+ - @xyd-js/components@0.1.0-xyd.34
352
+ - @xyd-js/content@0.1.0-xyd.37
353
+ - @xyd-js/core@0.1.0-xyd.36
354
+ - @xyd-js/plugins@0.1.0-xyd.23
355
+
356
+ ## 0.1.0-xyd.22
357
+
358
+ ### Patch Changes
359
+
360
+ - update all packages
361
+ - Updated dependencies
362
+ - @xyd-js/components@0.1.0-xyd.33
363
+ - @xyd-js/content@0.1.0-xyd.36
364
+ - @xyd-js/core@0.1.0-xyd.35
365
+ - @xyd-js/plugins@0.1.0-xyd.22
366
+
367
+ ## 0.1.0-xyd.21
368
+
369
+ ### Patch Changes
370
+
371
+ - update all packages
372
+ - Updated dependencies
373
+ - @xyd-js/components@0.1.0-xyd.32
374
+ - @xyd-js/content@0.1.0-xyd.35
375
+ - @xyd-js/core@0.1.0-xyd.34
376
+ - @xyd-js/plugins@0.1.0-xyd.21
377
+
378
+ ## 0.1.0-xyd.20
379
+
380
+ ### Patch Changes
381
+
382
+ - update all packages
383
+ - Updated dependencies
384
+ - @xyd-js/components@0.1.0-xyd.31
385
+ - @xyd-js/content@0.1.0-xyd.34
386
+ - @xyd-js/core@0.1.0-xyd.33
387
+ - @xyd-js/plugins@0.1.0-xyd.20
388
+
389
+ ## 0.1.0-xyd.19
390
+
391
+ ### Patch Changes
392
+
393
+ - update all packages
394
+ - Updated dependencies
395
+ - @xyd-js/components@0.1.0-xyd.30
396
+ - @xyd-js/content@0.1.0-xyd.33
397
+ - @xyd-js/core@0.1.0-xyd.32
398
+ - @xyd-js/plugins@0.1.0-xyd.19
399
+
400
+ ## 0.1.0-xyd.18
401
+
402
+ ### Patch Changes
403
+
404
+ - update all packages
405
+ - update all packages
406
+ - Updated dependencies
407
+ - Updated dependencies
408
+ - @xyd-js/components@0.1.0-xyd.29
409
+ - @xyd-js/content@0.1.0-xyd.32
410
+ - @xyd-js/core@0.1.0-xyd.31
411
+ - @xyd-js/plugins@0.1.0-xyd.18
412
+
413
+ ## 0.1.0-xyd.17
414
+
415
+ ### Patch Changes
416
+
417
+ - update all packages
418
+ - Updated dependencies
419
+ - @xyd-js/components@0.1.0-xyd.28
420
+ - @xyd-js/content@0.1.0-xyd.31
421
+ - @xyd-js/core@0.1.0-xyd.30
422
+ - @xyd-js/plugins@0.1.0-xyd.17
423
+
424
+ ## 0.1.0-xyd.16
425
+
426
+ ### Patch Changes
427
+
428
+ - update all packages
429
+ - update all packages
430
+ - Updated dependencies
431
+ - Updated dependencies
432
+ - @xyd-js/components@0.1.0-xyd.27
433
+ - @xyd-js/content@0.1.0-xyd.30
434
+ - @xyd-js/core@0.1.0-xyd.29
435
+ - @xyd-js/plugins@0.1.0-xyd.16
436
+
437
+ ## 0.1.0-xyd.15
438
+
439
+ ### Patch Changes
440
+
441
+ - update all packages
442
+ - update all packages
443
+ - Updated dependencies
444
+ - Updated dependencies
445
+ - @xyd-js/components@0.1.0-xyd.26
446
+ - @xyd-js/content@0.1.0-xyd.29
447
+ - @xyd-js/core@0.1.0-xyd.28
448
+ - @xyd-js/plugins@0.1.0-xyd.15
449
+
450
+ ## 0.1.0-xyd.14
451
+
452
+ ### Patch Changes
453
+
454
+ - update all packages
455
+ - update all packages
456
+ - Updated dependencies
457
+ - Updated dependencies
458
+ - @xyd-js/components@0.1.0-xyd.25
459
+ - @xyd-js/content@0.1.0-xyd.28
460
+ - @xyd-js/core@0.1.0-xyd.27
461
+ - @xyd-js/plugins@0.1.0-xyd.14
462
+
463
+ ## 0.1.0-xyd.13
464
+
465
+ ### Patch Changes
466
+
467
+ - update all packages
468
+ - update all packages
469
+ - Updated dependencies
470
+ - Updated dependencies
471
+ - @xyd-js/components@0.1.0-xyd.24
472
+ - @xyd-js/content@0.1.0-xyd.27
473
+ - @xyd-js/core@0.1.0-xyd.26
474
+ - @xyd-js/plugins@0.1.0-xyd.13
475
+
476
+ ## 0.1.0-xyd.12
477
+
478
+ ### Patch Changes
479
+
480
+ - update all packages
481
+ - update all packages
482
+ - Updated dependencies
483
+ - Updated dependencies
484
+ - @xyd-js/components@0.1.0-xyd.23
485
+ - @xyd-js/content@0.1.0-xyd.26
486
+ - @xyd-js/core@0.1.0-xyd.25
487
+ - @xyd-js/plugins@0.1.0-xyd.12
488
+
489
+ ## 0.1.0-xyd.11
490
+
491
+ ### Patch Changes
492
+
493
+ - update all packages
494
+ - update all packages
495
+ - Updated dependencies
496
+ - Updated dependencies
497
+ - @xyd-js/components@0.1.0-xyd.22
498
+ - @xyd-js/content@0.1.0-xyd.25
499
+ - @xyd-js/core@0.1.0-xyd.24
500
+ - @xyd-js/plugins@0.1.0-xyd.11
501
+
502
+ ## 0.1.0-xyd.10
503
+
504
+ ### Patch Changes
505
+
506
+ - update all packages
507
+ - Updated dependencies
508
+ - @xyd-js/components@0.1.0-xyd.21
509
+ - @xyd-js/content@0.1.0-xyd.24
510
+ - @xyd-js/core@0.1.0-xyd.23
511
+ - @xyd-js/plugins@0.1.0-xyd.10
512
+
513
+ ## 0.1.0-xyd.9
514
+
515
+ ### Patch Changes
516
+
517
+ - update all packages
518
+ - Updated dependencies
519
+ - @xyd-js/components@0.1.0-xyd.20
520
+ - @xyd-js/content@0.1.0-xyd.23
521
+ - @xyd-js/core@0.1.0-xyd.22
522
+ - @xyd-js/plugins@0.1.0-xyd.9
523
+
524
+ ## 0.1.0-xyd.8
525
+
526
+ ### Patch Changes
527
+
528
+ - update all packages
529
+ - Updated dependencies
530
+ - @xyd-js/components@0.1.0-xyd.19
531
+ - @xyd-js/content@0.1.0-xyd.22
532
+ - @xyd-js/core@0.1.0-xyd.21
533
+ - @xyd-js/plugins@0.1.0-xyd.8
534
+
535
+ ## 0.1.0-xyd.7
536
+
537
+ ### Patch Changes
538
+
539
+ - update
540
+ - Updated dependencies
541
+ - @xyd-js/components@0.1.0-xyd.18
542
+ - @xyd-js/content@0.1.0-xyd.21
543
+ - @xyd-js/core@0.1.0-xyd.20
544
+ - @xyd-js/plugins@0.1.0-xyd.7
545
+
546
+ ## 0.1.0-xyd.6
547
+
548
+ ### Patch Changes
549
+
550
+ - update
551
+ - Updated dependencies
552
+ - @xyd-js/components@0.1.0-xyd.17
553
+ - @xyd-js/content@0.1.0-xyd.20
554
+ - @xyd-js/core@0.1.0-xyd.19
555
+ - @xyd-js/plugins@0.1.0-xyd.6
556
+
557
+ ## 0.1.0-xyd.5
558
+
559
+ ### Patch Changes
560
+
561
+ - update
562
+ - Updated dependencies
563
+ - @xyd-js/components@0.1.0-xyd.16
564
+ - @xyd-js/content@0.1.0-xyd.19
565
+ - @xyd-js/core@0.1.0-xyd.18
566
+ - @xyd-js/plugins@0.1.0-xyd.5
567
+
568
+ ## 0.1.0-xyd.4
569
+
570
+ ### Patch Changes
571
+
572
+ - update
573
+ - Updated dependencies
574
+ - @xyd-js/components@0.1.0-xyd.15
575
+ - @xyd-js/content@0.1.0-xyd.18
576
+ - @xyd-js/core@0.1.0-xyd.17
577
+ - @xyd-js/plugins@0.1.0-xyd.4
578
+
579
+ ## 0.1.0-xyd.3
580
+
581
+ ### Patch Changes
582
+
583
+ - update
584
+ - Updated dependencies
585
+ - @xyd-js/components@0.1.0-xyd.14
586
+ - @xyd-js/content@0.1.0-xyd.17
587
+ - @xyd-js/core@0.1.0-xyd.16
588
+ - @xyd-js/plugins@0.1.0-xyd.3
589
+
3
590
  ## 0.1.0-xyd.2
4
591
 
5
592
  ### Patch Changes
package/dist/Search.tsx CHANGED
@@ -1,12 +1,12 @@
1
- import React, { useState, lazy, Suspense, useEffect, useCallback } from "react"
2
- import { createPortal } from 'react-dom'
3
- import { create, insertMultiple } from '@orama/orama'
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
- const OramaSearchBox = lazy(() => import('@orama/react-components').then(mod => ({ default: mod.OramaSearchBox })));
5
+ import {SearchButton} from "@xyd-js/components/system"
6
6
 
7
- import { SearchButton as XydSearchButton } from "@xyd-js/components/system"
7
+ const OramaSearchBox = lazy(() => import('@orama/react-components').then(mod => ({default: mod.OramaSearchBox})));
8
8
 
9
- export function SearchButton() {
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
- <XydSearchButton onClick={handleClick} />
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 { 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'\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 }\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 config: () => ({\n resolve: {\n alias: {\n 'virtual-component:Search': new URL('./Search.tsx', import.meta.url).pathname\n }\n }\n }),\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]"],"mappings":";AAIA,SAAS,gCAAuD;;;ACJzD,IAAM,sBAAsB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AACJ;;;ADKe,SAAR,YACH,gBAAoC,CAAC,GAC/B;AACN,SAAO,SAAU,UAAoB;AACjC,WAAO;AAAA,MACH,MAAM;AAAA,MACN,MAAM;AAAA,QACF;AAAA,UACI;AAAA,UACA;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACJ;AAEA,SAAS,WACL,UACA,gBAAoC,CAAC,GAC3B;AACV,QAAM,kBAAkB;AACxB,QAAM,0BAA0B,KAAK,eAAe;AAEpD,MAAI,gBAAuC;AAE3C,SAAO;AAAA,IACH,MAAM;AAAA,IACN,SAAS;AAAA,IAET,QAAQ,OAAO;AAAA,MACX,SAAS;AAAA,QACL,OAAO;AAAA,UACH,4BAA4B,IAAI,IAAI,gBAAgB,YAAY,GAAG,EAAE;AAAA,QACzE;AAAA,MACJ;AAAA,IACJ;AAAA,IAEA,MAAM,eAAe,QAAwB;AACzC,UAAI,eAAe;AACf;AAAA,MACJ;AAEA,sBAAgB;AAAA,IACpB;AAAA,IAEA,MAAM,UAAU,IAAI;AAChB,UAAI,OAAO,iBAAiB;AACxB,eAAO;AAAA,MACX;AAAA,IACJ;AAAA,IAEA,MAAM,KAAW,IAAY;AACzB,UAAI,OAAO,yBAAyB;AAChC;AAAA,MACJ;AAEA,UAAI,cAAuC;AAC3C,UAAI,cAAc,YAAY,cAAc,QAAQ;AAChD,sBAAc;AAAA,UACV,UAAU,cAAc;AAAA,UACxB,QAAQ,cAAc;AAAA,QAC1B;AAAA,MACJ;AAEA,YAAM,YAAY,MAAM,yBAAyB,QAAQ,GAAG,IAAI,qBAAqB;AAErF,aAAO;AAAA,+BACY,KAAK,UAAU,QAAQ,CAAC;AAAA,sCACjB,KAAK,UAAU,WAAW,CAAC;AAAA,sCAC3B,KAAK,UAAU,cAAc,eAAe,mBAAmB,CAAC;AAAA;AAAA;AAAA;AAAA,IAI9F;AAAA,EACJ;AACJ;AAEA,SAAS,sBAAsB,KAA2C;AACtE,SAAO;AAAA,IACH,UAAU;AAAA;AAAA,IAEV,MAAM,IAAI;AAAA,IAEV,OAAO,IAAI;AAAA,IAEX,aAAa,IAAI;AAAA,IAEjB,SAAS,IAAI;AAAA;AAAA;AAAA,EAIjB;AACJ;","names":[]}
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.2",
3
+ "version": "0.1.0-xyd.53",
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.15",
29
- "@xyd-js/components": "0.1.0-xyd.13",
30
- "@xyd-js/content": "0.1.0-xyd.16",
31
- "@xyd-js/plugins": "0.1.0-xyd.2"
28
+ "@xyd-js/core": "0.1.0-xyd.66",
29
+ "@xyd-js/plugins": "0.1.0-xyd.53",
30
+ "@xyd-js/components": "0.1.0-xyd.64",
31
+ "@xyd-js/content": "0.1.0-xyd.67"
32
+ },
33
+ "peerDependencies": {
34
+ "react": "^19.1.0",
35
+ "react-dom": "^19.1.0"
32
36
  },
33
37
  "devDependencies": {
34
- "vite": "^6.1.0",
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, { useState, lazy, Suspense, useEffect, useCallback } from "react"
2
- import { createPortal } from 'react-dom'
3
- import { create, insertMultiple } from '@orama/orama'
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
- const OramaSearchBox = lazy(() => import('@orama/react-components').then(mod => ({ default: mod.OramaSearchBox })));
5
+ import {SearchButton} from "@xyd-js/components/system"
6
6
 
7
- import { SearchButton as XydSearchButton } from "@xyd-js/components/system"
7
+ const OramaSearchBox = lazy(() => import('@orama/react-components').then(mod => ({default: mod.OramaSearchBox})));
8
8
 
9
- export function SearchButton() {
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
- <XydSearchButton onClick={handleClick} />
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 { Plugin as VitePlugin, ResolvedConfig } from 'vite'
1
+ import type {Plugin as VitePlugin, ResolvedConfig} from 'vite'
2
2
 
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'
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 { DEFAULT_SUGGESTIONS } from './const'
8
- import type { OramaPluginOptions, OramaCloudConfig, OramaSectionSchema } from './types'
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
- ...deps,
23
+ 'virtual:xyd-plugin-orama-data'
30
24
  ],
31
25
  onSuccess: async () => {
32
26
  await copyFile(