@zhin.js/console 2.0.3 → 2.0.5
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 +21 -0
- package/browser.tsconfig.json +0 -1
- package/client/src/pages/marketplace.tsx +24 -17
- package/dist/assets/index-C6cpEkIY.js +124 -0
- package/dist/index.html +1 -1
- package/package.json +6 -6
- package/dist/assets/index-BMkFI-uN.js +0 -124
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @zhin.js/console
|
|
2
2
|
|
|
3
|
+
## 2.0.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ba30934: fix: web 优化
|
|
8
|
+
- Updated dependencies [ba30934]
|
|
9
|
+
- @zhin.js/http@1.0.58
|
|
10
|
+
- @zhin.js/agent@0.1.5
|
|
11
|
+
- zhin.js@1.0.63
|
|
12
|
+
- @zhin.js/core@1.1.5
|
|
13
|
+
|
|
14
|
+
## 2.0.4
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [bf0dc75]
|
|
19
|
+
- @zhin.js/agent@0.1.4
|
|
20
|
+
- zhin.js@1.0.62
|
|
21
|
+
- @zhin.js/http@1.0.57
|
|
22
|
+
- @zhin.js/core@1.1.4
|
|
23
|
+
|
|
3
24
|
## 2.0.3
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/browser.tsconfig.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useState, useMemo, useCallback } from 'react'
|
|
1
|
+
import { useEffect, useState, useMemo, useCallback, useRef } from 'react'
|
|
2
2
|
import {
|
|
3
3
|
Search, Package, Download, ExternalLink, AlertCircle,
|
|
4
4
|
ArrowUpDown, RefreshCw, ShieldCheck, Globe,
|
|
@@ -78,6 +78,8 @@ export default function MarketplacePage() {
|
|
|
78
78
|
const [loading, setLoading] = useState(true)
|
|
79
79
|
const [error, setError] = useState<string | null>(null)
|
|
80
80
|
const [search, setSearch] = useState('')
|
|
81
|
+
const [debouncedSearch, setDebouncedSearch] = useState('')
|
|
82
|
+
const debounceRef = useRef<ReturnType<typeof setTimeout>>()
|
|
81
83
|
const [category, setCategory] = useState<Category>('')
|
|
82
84
|
const [officialOnly, setOfficialOnly] = useState(false)
|
|
83
85
|
const [sortKey, setSortKey] = useState<SortKey>('name')
|
|
@@ -94,7 +96,7 @@ export default function MarketplacePage() {
|
|
|
94
96
|
setError(null)
|
|
95
97
|
try {
|
|
96
98
|
const params = new URLSearchParams()
|
|
97
|
-
if (
|
|
99
|
+
if (debouncedSearch) params.set('q', debouncedSearch)
|
|
98
100
|
if (category) params.set('category', category)
|
|
99
101
|
if (officialOnly) params.set('official', 'true')
|
|
100
102
|
params.set('limit', '50')
|
|
@@ -112,7 +114,14 @@ export default function MarketplacePage() {
|
|
|
112
114
|
} finally {
|
|
113
115
|
setLoading(false)
|
|
114
116
|
}
|
|
115
|
-
}, [
|
|
117
|
+
}, [debouncedSearch, category, officialOnly])
|
|
118
|
+
|
|
119
|
+
// Debounce search input (350ms)
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
clearTimeout(debounceRef.current)
|
|
122
|
+
debounceRef.current = setTimeout(() => setDebouncedSearch(search), 350)
|
|
123
|
+
return () => clearTimeout(debounceRef.current)
|
|
124
|
+
}, [search])
|
|
116
125
|
|
|
117
126
|
useEffect(() => {
|
|
118
127
|
fetchPlugins()
|
|
@@ -138,7 +147,7 @@ export default function MarketplacePage() {
|
|
|
138
147
|
setDetailLoading(true)
|
|
139
148
|
setDetail(null)
|
|
140
149
|
try {
|
|
141
|
-
const res = await fetch(`/pub/marketplace/detail/${
|
|
150
|
+
const res = await fetch(`/pub/marketplace/detail/${name}`)
|
|
142
151
|
if (res.ok) {
|
|
143
152
|
const data = await res.json()
|
|
144
153
|
if (data.success) setDetail(data.data)
|
|
@@ -322,7 +331,7 @@ export default function MarketplacePage() {
|
|
|
322
331
|
|
|
323
332
|
{/* Detail Dialog */}
|
|
324
333
|
<Dialog open={detailOpen} onOpenChange={setDetailOpen}>
|
|
325
|
-
<DialogContent className="max-w-
|
|
334
|
+
<DialogContent className="max-w-2xl max-h-[80vh] overflow-y-auto">
|
|
326
335
|
{detailLoading ? (
|
|
327
336
|
<div className="space-y-3">
|
|
328
337
|
<Skeleton className="h-6 w-48" />
|
|
@@ -427,7 +436,7 @@ export default function MarketplacePage() {
|
|
|
427
436
|
</div>
|
|
428
437
|
</div>
|
|
429
438
|
|
|
430
|
-
<DialogFooter className="gap-2">
|
|
439
|
+
<DialogFooter className="gap-2 flex-wrap">
|
|
431
440
|
{detail.homepage && (
|
|
432
441
|
<Button variant="outline" size="sm" asChild>
|
|
433
442
|
<a href={detail.homepage} target="_blank" rel="noopener noreferrer">
|
|
@@ -435,17 +444,15 @@ export default function MarketplacePage() {
|
|
|
435
444
|
</a>
|
|
436
445
|
</Button>
|
|
437
446
|
)}
|
|
438
|
-
|
|
439
|
-
<
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
</Button>
|
|
448
|
-
)}
|
|
447
|
+
<Button variant="outline" size="sm" asChild>
|
|
448
|
+
<a
|
|
449
|
+
href={detail.npm || `https://www.npmjs.com/package/${detail.name}`}
|
|
450
|
+
target="_blank"
|
|
451
|
+
rel="noopener noreferrer"
|
|
452
|
+
>
|
|
453
|
+
<Download className="w-3 h-3 mr-1" /> npm
|
|
454
|
+
</a>
|
|
455
|
+
</Button>
|
|
449
456
|
<DialogClose asChild>
|
|
450
457
|
<Button variant="secondary" size="sm">关闭</Button>
|
|
451
458
|
</DialogClose>
|