create-librex 1.0.5 → 1.0.7
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/package.json
CHANGED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { definePageConfig, iconRegistry } from 'librex'
|
|
2
|
+
import { ref, computed } from 'vue'
|
|
3
|
+
|
|
4
|
+
export default definePageConfig({
|
|
5
|
+
title: '图标浏览器',
|
|
6
|
+
path: '/dev/icon-browser',
|
|
7
|
+
icon: 'image',
|
|
8
|
+
navOrder: 99,
|
|
9
|
+
navGroup: '🛠 开发工具',
|
|
10
|
+
|
|
11
|
+
setup({ setSlot }) {
|
|
12
|
+
const search = ref('')
|
|
13
|
+
const allIcons = iconRegistry.list()
|
|
14
|
+
|
|
15
|
+
const filtered = computed(() => {
|
|
16
|
+
if (!search.value.trim()) return allIcons
|
|
17
|
+
const q = search.value.toLowerCase()
|
|
18
|
+
return allIcons.filter(name => name.includes(q))
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
setSlot('main', () => ({
|
|
22
|
+
template: `
|
|
23
|
+
<div style="padding: 24px; height: 100%; display: flex; flex-direction: column; gap: 16px;">
|
|
24
|
+
<div style="display: flex; align-items: center; gap: 12px;">
|
|
25
|
+
<h2 style="margin: 0; font-size: 20px; font-weight: 600;">图标浏览器</h2>
|
|
26
|
+
<span style="color: var(--color-text-secondary); font-size: 13px;">
|
|
27
|
+
共 {{ allIcons.length }} 个图标 | Lucide 1000+ 内置
|
|
28
|
+
</span>
|
|
29
|
+
</div>
|
|
30
|
+
<input
|
|
31
|
+
v-model="search"
|
|
32
|
+
placeholder="搜索图标名称..."
|
|
33
|
+
style="padding: 8px 12px; border: 1px solid var(--color-border); border-radius: 8px;
|
|
34
|
+
font-size: 14px; max-width: 320px; outline: none; background: var(--color-bg); color: var(--color-text);"
|
|
35
|
+
/>
|
|
36
|
+
<div
|
|
37
|
+
style="flex: 1; overflow-y: auto; display: grid;
|
|
38
|
+
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
|
|
39
|
+
gap: 8px; align-content: start;"
|
|
40
|
+
>
|
|
41
|
+
<div
|
|
42
|
+
v-for="name in filtered"
|
|
43
|
+
:key="name"
|
|
44
|
+
:title="name"
|
|
45
|
+
style="display: flex; flex-direction: column; align-items: center; gap: 6px;
|
|
46
|
+
padding: 12px 6px; border-radius: 8px; cursor: pointer;
|
|
47
|
+
background: var(--color-bg-secondary); transition: background .15s;
|
|
48
|
+
border: 1px solid transparent;"
|
|
49
|
+
@mouseenter="\$el.style.borderColor='var(--color-accent)'"
|
|
50
|
+
@mouseleave="\$el.style.borderColor='transparent'"
|
|
51
|
+
@click="copyIcon"
|
|
52
|
+
>
|
|
53
|
+
<span style="width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;">
|
|
54
|
+
<Icon :name="name" :size="20" />
|
|
55
|
+
</span>
|
|
56
|
+
<span style="font-size: 11px; color: var(--color-text-secondary);
|
|
57
|
+
text-align: center; word-break: break-all; line-height: 1.3;">
|
|
58
|
+
{{ name }}
|
|
59
|
+
</span>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
`,
|
|
64
|
+
data: { search, allIcons, filtered },
|
|
65
|
+
methods: {
|
|
66
|
+
copyIcon(event: MouseEvent) {
|
|
67
|
+
const name = (event.currentTarget as HTMLElement)?.querySelector('span:last-child')?.textContent
|
|
68
|
+
if (name) {
|
|
69
|
+
navigator.clipboard.writeText(name).catch(() => {})
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
}))
|
|
74
|
+
},
|
|
75
|
+
})
|