verce-vue-test 0.0.69 → 0.0.71

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.
@@ -0,0 +1,768 @@
1
+ <script setup lang="ts">
2
+ import { computed, ref } from 'vue'
3
+ import { ElMessage } from 'element-plus'
4
+ import {
5
+ CircleCheck,
6
+ CopyDocument,
7
+ Files,
8
+ FolderOpened,
9
+ Search,
10
+ } from '@element-plus/icons-vue'
11
+ import { globalComponentCatalog } from '@/components'
12
+
13
+ const keyword = ref('')
14
+ const activeCategory = ref('全部')
15
+
16
+ const categories = computed(() => [
17
+ '全部',
18
+ ...new Set(globalComponentCatalog.map((item) => item.category)),
19
+ ])
20
+
21
+ const iconCount = computed(
22
+ () => globalComponentCatalog.filter((item) => item.category === '图标组件').length,
23
+ )
24
+
25
+ const filteredComponents = computed(() => {
26
+ const normalizedKeyword = keyword.value.trim().toLowerCase()
27
+
28
+ return globalComponentCatalog.filter((item) => {
29
+ const matchesCategory = activeCategory.value === '全部'
30
+ || item.category === activeCategory.value
31
+ const matchesKeyword = !normalizedKeyword
32
+ || [item.name, item.category, item.description, item.filePath]
33
+ .some((value) => value.toLowerCase().includes(normalizedKeyword))
34
+
35
+ return matchesCategory && matchesKeyword
36
+ })
37
+ })
38
+
39
+ async function copyFilePath(filePath: string) {
40
+ try {
41
+ await navigator.clipboard.writeText(filePath)
42
+ ElMessage.success('组件文件位置已复制')
43
+ } catch {
44
+ ElMessage.error('复制失败,请手动复制文件位置')
45
+ }
46
+ }
47
+ </script>
48
+
49
+ <template>
50
+ <div class="component-catalog-page">
51
+ <section class="catalog-hero">
52
+ <div class="catalog-hero__content">
53
+ <div class="catalog-eyebrow">
54
+ <el-icon><Files /></el-icon>
55
+ COMPONENT REGISTRY
56
+ </div>
57
+ <h1>公共组件清单</h1>
58
+ <p>
59
+ 项目内已全局注册的公共组件都收录在这里,可按名称或类型快速查找,
60
+ 并直接复制对应的源码位置。
61
+ </p>
62
+ </div>
63
+
64
+ <div class="catalog-summary" aria-label="组件统计">
65
+ <div class="summary-item summary-item--primary">
66
+ <strong>{{ globalComponentCatalog.length }}</strong>
67
+ <span>公共组件</span>
68
+ </div>
69
+ <div class="summary-divider"></div>
70
+ <div class="summary-item">
71
+ <strong>{{ categories.length - 1 }}</strong>
72
+ <span>组件分类</span>
73
+ </div>
74
+ <div class="summary-divider"></div>
75
+ <div class="summary-item">
76
+ <strong>{{ iconCount }}</strong>
77
+ <span>图标组件</span>
78
+ </div>
79
+ </div>
80
+ </section>
81
+
82
+ <section class="catalog-toolbar" aria-label="组件筛选">
83
+ <label class="catalog-search">
84
+ <el-icon><Search /></el-icon>
85
+ <input
86
+ v-model="keyword"
87
+ type="search"
88
+ placeholder="搜索组件名称、说明或文件位置"
89
+ />
90
+ <span class="search-shortcut">{{ filteredComponents.length }} / {{ globalComponentCatalog.length }}</span>
91
+ </label>
92
+
93
+ <div class="category-tabs" role="tablist" aria-label="组件分类">
94
+ <button
95
+ v-for="category in categories"
96
+ :key="category"
97
+ type="button"
98
+ class="category-tab"
99
+ :class="{ 'is-active': activeCategory === category }"
100
+ @click="activeCategory = category"
101
+ >
102
+ {{ category }}
103
+ </button>
104
+ </div>
105
+ </section>
106
+
107
+ <section class="catalog-list" aria-live="polite">
108
+ <div class="catalog-list__heading">
109
+ <div>
110
+ <span class="heading-kicker">AVAILABLE COMPONENTS</span>
111
+ <h2>{{ activeCategory === '全部' ? '全部组件' : activeCategory }}</h2>
112
+ </div>
113
+ <span class="global-status">
114
+ <el-icon><CircleCheck /></el-icon>
115
+ 全部已全局注册
116
+ </span>
117
+ </div>
118
+
119
+ <div v-if="filteredComponents.length" class="component-grid">
120
+ <article
121
+ v-for="(item, index) in filteredComponents"
122
+ :key="item.name"
123
+ class="component-card"
124
+ :style="{ '--enter-delay': `${Math.min(index, 8) * 35}ms` }"
125
+ >
126
+ <div class="component-card__index">
127
+ {{ String(globalComponentCatalog.indexOf(item) + 1).padStart(2, '0') }}
128
+ </div>
129
+
130
+ <div class="component-card__preview" :class="{ 'is-icon': item.category === '图标组件' }">
131
+ <component
132
+ :is="item.name"
133
+ v-if="item.category === '图标组件'"
134
+ />
135
+ <span v-else>{{ item.name.slice(0, 2) }}</span>
136
+ </div>
137
+
138
+ <div class="component-card__body">
139
+ <div class="component-card__title-row">
140
+ <h3>{{ item.name }}</h3>
141
+ <span class="category-badge">{{ item.category }}</span>
142
+ </div>
143
+ <p>{{ item.description }}</p>
144
+
145
+ <div class="component-location">
146
+ <div class="component-location__icon">
147
+ <el-icon><FolderOpened /></el-icon>
148
+ </div>
149
+ <div class="component-location__content">
150
+ <span>组件文件位置</span>
151
+ <code>{{ item.filePath }}</code>
152
+ </div>
153
+ <button
154
+ type="button"
155
+ class="copy-button"
156
+ :aria-label="`复制 ${item.name} 文件位置`"
157
+ @click="copyFilePath(item.filePath)"
158
+ >
159
+ <el-icon><CopyDocument /></el-icon>
160
+ </button>
161
+ </div>
162
+
163
+ <div class="component-usage">
164
+ <span>模板中直接使用</span>
165
+ <code>&lt;{{ item.name }} /&gt;</code>
166
+ </div>
167
+ </div>
168
+ </article>
169
+ </div>
170
+
171
+ <div v-else class="catalog-empty">
172
+ <div class="catalog-empty__icon">
173
+ <el-icon><Search /></el-icon>
174
+ </div>
175
+ <h3>没有找到匹配的组件</h3>
176
+ <p>换一个关键词,或切换到“全部”分类再看看。</p>
177
+ <button type="button" @click="keyword = ''; activeCategory = '全部'">
178
+ 清除筛选
179
+ </button>
180
+ </div>
181
+ </section>
182
+ </div>
183
+ </template>
184
+
185
+ <style scoped>
186
+ .component-catalog-page {
187
+ --catalog-ink: #152235;
188
+ --catalog-muted: #647188;
189
+ --catalog-blue: #1769e0;
190
+ --catalog-cyan: #28c6d8;
191
+ --catalog-border: #dfe6ef;
192
+ min-height: 100%;
193
+ padding: 28px;
194
+ color: var(--catalog-ink);
195
+ font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
196
+ background:
197
+ linear-gradient(rgba(21, 34, 53, .035) 1px, transparent 1px),
198
+ linear-gradient(90deg, rgba(21, 34, 53, .035) 1px, transparent 1px),
199
+ #f5f8fc;
200
+ background-size: 32px 32px;
201
+ }
202
+
203
+ .catalog-hero {
204
+ position: relative;
205
+ display: flex;
206
+ align-items: flex-end;
207
+ justify-content: space-between;
208
+ gap: 48px;
209
+ min-height: 248px;
210
+ padding: 42px 44px;
211
+ overflow: hidden;
212
+ color: #fff;
213
+ border-radius: 20px;
214
+ background:
215
+ radial-gradient(circle at 80% -20%, rgba(40, 198, 216, .42), transparent 38%),
216
+ linear-gradient(118deg, #102139 0%, #17365e 58%, #125c79 100%);
217
+ box-shadow: 0 24px 56px rgba(27, 52, 82, .19);
218
+ }
219
+
220
+ .catalog-hero::before,
221
+ .catalog-hero::after {
222
+ content: "";
223
+ position: absolute;
224
+ border: 1px solid rgba(255, 255, 255, .12);
225
+ border-radius: 50%;
226
+ }
227
+
228
+ .catalog-hero::before {
229
+ width: 280px;
230
+ height: 280px;
231
+ top: -170px;
232
+ right: 15%;
233
+ }
234
+
235
+ .catalog-hero::after {
236
+ width: 420px;
237
+ height: 420px;
238
+ right: -250px;
239
+ bottom: -330px;
240
+ }
241
+
242
+ .catalog-hero__content,
243
+ .catalog-summary {
244
+ position: relative;
245
+ z-index: 1;
246
+ }
247
+
248
+ .catalog-hero__content {
249
+ max-width: 690px;
250
+ }
251
+
252
+ .catalog-eyebrow {
253
+ display: inline-flex;
254
+ align-items: center;
255
+ gap: 9px;
256
+ margin-bottom: 19px;
257
+ color: #79e7ef;
258
+ font-size: 12px;
259
+ font-weight: 700;
260
+ letter-spacing: .17em;
261
+ }
262
+
263
+ .catalog-hero h1 {
264
+ margin: 0;
265
+ font-size: clamp(34px, 4vw, 52px);
266
+ line-height: 1.08;
267
+ letter-spacing: -.04em;
268
+ }
269
+
270
+ .catalog-hero p {
271
+ max-width: 640px;
272
+ margin: 19px 0 0;
273
+ color: rgba(234, 242, 252, .78);
274
+ font-size: 15px;
275
+ line-height: 1.85;
276
+ }
277
+
278
+ .catalog-summary {
279
+ display: flex;
280
+ align-items: center;
281
+ flex: 0 0 auto;
282
+ padding: 19px 22px;
283
+ border: 1px solid rgba(255, 255, 255, .14);
284
+ border-radius: 16px;
285
+ background: rgba(7, 23, 42, .34);
286
+ backdrop-filter: blur(14px);
287
+ }
288
+
289
+ .summary-item {
290
+ display: flex;
291
+ min-width: 82px;
292
+ flex-direction: column;
293
+ align-items: center;
294
+ gap: 3px;
295
+ }
296
+
297
+ .summary-item strong {
298
+ font-family: "SFMono-Regular", Consolas, monospace;
299
+ font-size: 28px;
300
+ line-height: 1;
301
+ }
302
+
303
+ .summary-item--primary strong {
304
+ color: #72e4ed;
305
+ }
306
+
307
+ .summary-item span {
308
+ color: rgba(226, 236, 247, .65);
309
+ font-size: 11px;
310
+ }
311
+
312
+ .summary-divider {
313
+ width: 1px;
314
+ height: 35px;
315
+ margin: 0 14px;
316
+ background: rgba(255, 255, 255, .13);
317
+ }
318
+
319
+ .catalog-toolbar {
320
+ position: relative;
321
+ z-index: 2;
322
+ display: flex;
323
+ align-items: center;
324
+ justify-content: space-between;
325
+ gap: 24px;
326
+ margin: -1px 20px 0;
327
+ padding: 22px 24px;
328
+ border: 1px solid var(--catalog-border);
329
+ border-top: 0;
330
+ border-radius: 0 0 17px 17px;
331
+ background: rgba(255, 255, 255, .94);
332
+ box-shadow: 0 16px 34px rgba(36, 62, 94, .08);
333
+ }
334
+
335
+ .catalog-search {
336
+ display: flex;
337
+ align-items: center;
338
+ width: min(430px, 100%);
339
+ height: 44px;
340
+ gap: 11px;
341
+ padding: 0 14px;
342
+ color: #718097;
343
+ border: 1px solid #d9e1eb;
344
+ border-radius: 10px;
345
+ background: #f8fafc;
346
+ transition: border-color .2s, box-shadow .2s, background .2s;
347
+ }
348
+
349
+ .catalog-search:focus-within {
350
+ border-color: #74a9ef;
351
+ background: #fff;
352
+ box-shadow: 0 0 0 3px rgba(23, 105, 224, .09);
353
+ }
354
+
355
+ .catalog-search input {
356
+ min-width: 0;
357
+ flex: 1;
358
+ color: var(--catalog-ink);
359
+ border: 0;
360
+ outline: 0;
361
+ background: transparent;
362
+ font: inherit;
363
+ font-size: 14px;
364
+ }
365
+
366
+ .catalog-search input::-webkit-search-cancel-button {
367
+ display: none;
368
+ }
369
+
370
+ .search-shortcut {
371
+ padding: 4px 7px;
372
+ color: #79869a;
373
+ border: 1px solid #e0e6ed;
374
+ border-radius: 6px;
375
+ background: #fff;
376
+ font-family: "SFMono-Regular", Consolas, monospace;
377
+ font-size: 10px;
378
+ white-space: nowrap;
379
+ }
380
+
381
+ .category-tabs {
382
+ display: flex;
383
+ align-items: center;
384
+ justify-content: flex-end;
385
+ gap: 7px;
386
+ overflow-x: auto;
387
+ }
388
+
389
+ .category-tab {
390
+ flex: 0 0 auto;
391
+ padding: 8px 12px;
392
+ color: #637087;
393
+ border: 1px solid transparent;
394
+ border-radius: 8px;
395
+ background: transparent;
396
+ font: inherit;
397
+ font-size: 13px;
398
+ cursor: pointer;
399
+ transition: color .2s, border-color .2s, background .2s;
400
+ }
401
+
402
+ .category-tab:hover {
403
+ color: var(--catalog-blue);
404
+ background: #f2f6fc;
405
+ }
406
+
407
+ .category-tab.is-active {
408
+ color: #fff;
409
+ border-color: var(--catalog-blue);
410
+ background: var(--catalog-blue);
411
+ box-shadow: 0 7px 16px rgba(23, 105, 224, .2);
412
+ }
413
+
414
+ .catalog-list {
415
+ margin-top: 34px;
416
+ }
417
+
418
+ .catalog-list__heading {
419
+ display: flex;
420
+ align-items: flex-end;
421
+ justify-content: space-between;
422
+ margin-bottom: 17px;
423
+ padding: 0 4px;
424
+ }
425
+
426
+ .heading-kicker {
427
+ display: block;
428
+ margin-bottom: 5px;
429
+ color: #8590a2;
430
+ font-size: 10px;
431
+ font-weight: 700;
432
+ letter-spacing: .16em;
433
+ }
434
+
435
+ .catalog-list__heading h2 {
436
+ margin: 0;
437
+ font-size: 24px;
438
+ letter-spacing: -.02em;
439
+ }
440
+
441
+ .global-status {
442
+ display: inline-flex;
443
+ align-items: center;
444
+ gap: 7px;
445
+ color: #13805b;
446
+ font-size: 13px;
447
+ font-weight: 600;
448
+ }
449
+
450
+ .component-grid {
451
+ display: grid;
452
+ grid-template-columns: repeat(2, minmax(0, 1fr));
453
+ gap: 16px;
454
+ }
455
+
456
+ .component-card {
457
+ position: relative;
458
+ display: grid;
459
+ grid-template-columns: 62px minmax(0, 1fr);
460
+ min-height: 254px;
461
+ overflow: hidden;
462
+ border: 1px solid var(--catalog-border);
463
+ border-radius: 15px;
464
+ background: #fff;
465
+ box-shadow: 0 10px 26px rgba(32, 58, 89, .055);
466
+ animation: catalog-card-in .42s both;
467
+ animation-delay: var(--enter-delay);
468
+ transition: transform .22s, border-color .22s, box-shadow .22s;
469
+ }
470
+
471
+ .component-card:hover {
472
+ z-index: 1;
473
+ border-color: #b9cef0;
474
+ box-shadow: 0 18px 38px rgba(32, 73, 122, .12);
475
+ transform: translateY(-3px);
476
+ }
477
+
478
+ .component-card__index {
479
+ position: absolute;
480
+ top: 15px;
481
+ right: 17px;
482
+ color: #c8d1dd;
483
+ font-family: "SFMono-Regular", Consolas, monospace;
484
+ font-size: 11px;
485
+ letter-spacing: .08em;
486
+ }
487
+
488
+ .component-card__preview {
489
+ display: flex;
490
+ align-items: flex-start;
491
+ justify-content: center;
492
+ padding-top: 28px;
493
+ color: #266dc8;
494
+ border-right: 1px solid #edf1f6;
495
+ background: linear-gradient(180deg, #f1f7ff, #f8fbff);
496
+ font-family: "SFMono-Regular", Consolas, monospace;
497
+ font-size: 16px;
498
+ font-weight: 700;
499
+ }
500
+
501
+ .component-card__preview.is-icon :deep(svg) {
502
+ width: 24px;
503
+ height: 24px;
504
+ }
505
+
506
+ .component-card__body {
507
+ min-width: 0;
508
+ padding: 25px 24px 21px;
509
+ }
510
+
511
+ .component-card__title-row {
512
+ display: flex;
513
+ align-items: center;
514
+ gap: 10px;
515
+ padding-right: 28px;
516
+ }
517
+
518
+ .component-card h3 {
519
+ min-width: 0;
520
+ margin: 0;
521
+ overflow: hidden;
522
+ color: #17263b;
523
+ font-family: "SFMono-Regular", Consolas, monospace;
524
+ font-size: 17px;
525
+ letter-spacing: -.025em;
526
+ text-overflow: ellipsis;
527
+ white-space: nowrap;
528
+ }
529
+
530
+ .category-badge {
531
+ flex: 0 0 auto;
532
+ padding: 4px 7px;
533
+ color: #41658e;
534
+ border: 1px solid #d7e4f2;
535
+ border-radius: 999px;
536
+ background: #f2f7fc;
537
+ font-size: 10px;
538
+ font-weight: 600;
539
+ }
540
+
541
+ .component-card__body > p {
542
+ min-height: 42px;
543
+ margin: 13px 0 17px;
544
+ color: var(--catalog-muted);
545
+ font-size: 13px;
546
+ line-height: 1.65;
547
+ }
548
+
549
+ .component-location {
550
+ display: flex;
551
+ align-items: center;
552
+ gap: 10px;
553
+ min-width: 0;
554
+ padding: 10px;
555
+ border: 1px solid #e3e9f0;
556
+ border-radius: 9px;
557
+ background: #f8fafc;
558
+ }
559
+
560
+ .component-location__icon {
561
+ display: grid;
562
+ width: 30px;
563
+ height: 30px;
564
+ flex: 0 0 auto;
565
+ place-items: center;
566
+ color: #3178cd;
567
+ border-radius: 7px;
568
+ background: #e8f2ff;
569
+ }
570
+
571
+ .component-location__content {
572
+ display: flex;
573
+ min-width: 0;
574
+ flex: 1;
575
+ flex-direction: column;
576
+ gap: 2px;
577
+ }
578
+
579
+ .component-location__content span {
580
+ color: #8a96a8;
581
+ font-size: 9px;
582
+ font-weight: 600;
583
+ letter-spacing: .08em;
584
+ }
585
+
586
+ .component-location code,
587
+ .component-usage code {
588
+ overflow: hidden;
589
+ color: #31425a;
590
+ font-family: "SFMono-Regular", Consolas, monospace;
591
+ font-size: 11px;
592
+ text-overflow: ellipsis;
593
+ white-space: nowrap;
594
+ }
595
+
596
+ .copy-button {
597
+ display: grid;
598
+ width: 30px;
599
+ height: 30px;
600
+ flex: 0 0 auto;
601
+ place-items: center;
602
+ color: #78869a;
603
+ border: 0;
604
+ border-radius: 7px;
605
+ background: transparent;
606
+ cursor: pointer;
607
+ transition: color .2s, background .2s;
608
+ }
609
+
610
+ .copy-button:hover {
611
+ color: var(--catalog-blue);
612
+ background: #e9f2ff;
613
+ }
614
+
615
+ .component-usage {
616
+ display: flex;
617
+ align-items: center;
618
+ justify-content: space-between;
619
+ gap: 12px;
620
+ margin-top: 12px;
621
+ color: #919cad;
622
+ font-size: 10px;
623
+ }
624
+
625
+ .component-usage code {
626
+ color: #0d7c86;
627
+ }
628
+
629
+ .catalog-empty {
630
+ display: flex;
631
+ min-height: 330px;
632
+ flex-direction: column;
633
+ align-items: center;
634
+ justify-content: center;
635
+ border: 1px dashed #cbd6e3;
636
+ border-radius: 16px;
637
+ background: rgba(255, 255, 255, .72);
638
+ text-align: center;
639
+ }
640
+
641
+ .catalog-empty__icon {
642
+ display: grid;
643
+ width: 52px;
644
+ height: 52px;
645
+ margin-bottom: 15px;
646
+ place-items: center;
647
+ color: #6783a6;
648
+ border-radius: 50%;
649
+ background: #edf3fa;
650
+ font-size: 22px;
651
+ }
652
+
653
+ .catalog-empty h3 {
654
+ margin: 0;
655
+ font-size: 18px;
656
+ }
657
+
658
+ .catalog-empty p {
659
+ margin: 8px 0 17px;
660
+ color: var(--catalog-muted);
661
+ font-size: 13px;
662
+ }
663
+
664
+ .catalog-empty button {
665
+ padding: 8px 16px;
666
+ color: #fff;
667
+ border: 0;
668
+ border-radius: 8px;
669
+ background: var(--catalog-blue);
670
+ cursor: pointer;
671
+ }
672
+
673
+ @keyframes catalog-card-in {
674
+ from {
675
+ opacity: 0;
676
+ transform: translateY(12px);
677
+ }
678
+ to {
679
+ opacity: 1;
680
+ transform: translateY(0);
681
+ }
682
+ }
683
+
684
+ @media (max-width: 1180px) {
685
+ .catalog-hero {
686
+ align-items: flex-start;
687
+ flex-direction: column;
688
+ }
689
+
690
+ .catalog-summary {
691
+ align-self: stretch;
692
+ justify-content: space-around;
693
+ }
694
+
695
+ .catalog-toolbar {
696
+ align-items: stretch;
697
+ flex-direction: column;
698
+ }
699
+
700
+ .catalog-search {
701
+ width: 100%;
702
+ }
703
+
704
+ .category-tabs {
705
+ justify-content: flex-start;
706
+ }
707
+ }
708
+
709
+ @media (max-width: 820px) {
710
+ .component-catalog-page {
711
+ padding: 16px;
712
+ }
713
+
714
+ .catalog-hero {
715
+ min-height: auto;
716
+ padding: 30px 24px;
717
+ }
718
+
719
+ .catalog-toolbar {
720
+ margin: 0 8px;
721
+ }
722
+
723
+ .component-grid {
724
+ grid-template-columns: 1fr;
725
+ }
726
+ }
727
+
728
+ @media (max-width: 520px) {
729
+ .catalog-summary {
730
+ padding: 16px 8px;
731
+ }
732
+
733
+ .summary-item {
734
+ min-width: 65px;
735
+ }
736
+
737
+ .summary-divider {
738
+ margin: 0 5px;
739
+ }
740
+
741
+ .component-card {
742
+ grid-template-columns: 48px minmax(0, 1fr);
743
+ }
744
+
745
+ .component-card__body {
746
+ padding: 23px 16px 18px;
747
+ }
748
+
749
+ .component-card__title-row {
750
+ align-items: flex-start;
751
+ flex-direction: column;
752
+ gap: 7px;
753
+ }
754
+
755
+ .catalog-list__heading {
756
+ align-items: flex-start;
757
+ flex-direction: column;
758
+ gap: 9px;
759
+ }
760
+ }
761
+
762
+ @media (prefers-reduced-motion: reduce) {
763
+ .component-card {
764
+ animation: none;
765
+ transition: none;
766
+ }
767
+ }
768
+ </style>