@tnotesjs/core 0.1.20 → 0.1.22

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.
Files changed (49) hide show
  1. package/dist/{chunk-4MO7F7Q4.js → chunk-BSTQOJVE.js} +1 -1
  2. package/dist/{chunk-SQVHJR2Z.js → chunk-O4DCXHOV.js} +0 -3
  3. package/dist/cli/index.js +2 -2
  4. package/dist/index.js +1 -1
  5. package/dist/vitepress/config/index.js +2 -2
  6. package/package.json +3 -4
  7. package/types/config.ts +0 -1
  8. package/vitepress/components/CodeBlockFullscreen/CodeBlockFullscreen.vue +2 -2
  9. package/vitepress/components/CodeBlockFullscreen/index.ts +1 -5
  10. package/vitepress/components/CodeBlockFullscreen/styles.css +4 -4
  11. package/vitepress/components/Discussions/Discussions.vue +37 -4
  12. package/vitepress/components/EnWordList/EnWordList.vue +135 -15
  13. package/vitepress/components/EnWordList/RightClickMenu.vue +33 -10
  14. package/vitepress/components/Footprints/Footprints.vue +105 -10
  15. package/vitepress/components/Layout/AboutModal.vue +242 -16
  16. package/vitepress/components/Layout/AboutPanel.vue +258 -44
  17. package/vitepress/components/Layout/ContentCollapse.vue +1 -14
  18. package/vitepress/components/Layout/DocBeforeControls.vue +221 -19
  19. package/vitepress/components/Layout/ImagePreview.vue +212 -9
  20. package/vitepress/components/Layout/Layout.vue +133 -10
  21. package/vitepress/components/Layout/NavBarSettingsTrigger.vue +0 -2
  22. package/vitepress/components/Layout/SidebarNavBefore.vue +0 -1
  23. package/vitepress/components/Layout/SidebarResizeHandle.vue +2 -10
  24. package/vitepress/components/Layout/ToggleFullContent.vue +14 -2
  25. package/vitepress/components/Layout/ToggleSidebar.vue +14 -3
  26. package/vitepress/components/LoadingPage/LoadingPage.vue +1 -6
  27. package/vitepress/components/MarkMap/MarkMap.vue +162 -3
  28. package/vitepress/components/Mermaid/Mermaid.vue +300 -22
  29. package/vitepress/components/NotesTable/NotesTable.vue +86 -10
  30. package/vitepress/components/Settings/Settings.vue +434 -57
  31. package/vitepress/components/Settings/SettingsDialog.vue +1 -11
  32. package/vitepress/components/SidebarCard/MindMapView.vue +28 -28
  33. package/vitepress/components/SidebarCard/SidebarCard.vue +3 -4
  34. package/vitepress/components/Tooltip/Tooltip.vue +28 -28
  35. package/vitepress/configs/markdown.config.ts +3 -2
  36. package/vitepress/theme/styles/base.scss +2 -2
  37. package/vitepress/components/Discussions/Discussions.module.scss +0 -32
  38. package/vitepress/components/EnWordList/EnWordList.module.scss +0 -124
  39. package/vitepress/components/EnWordList/RightClickMenu.module.scss +0 -22
  40. package/vitepress/components/Footprints/Footprints.module.scss +0 -93
  41. package/vitepress/components/Layout/AboutModal.module.scss +0 -233
  42. package/vitepress/components/Layout/ImagePreview.module.scss +0 -201
  43. package/vitepress/components/Layout/Layout.module.scss +0 -661
  44. package/vitepress/components/Layout/ToggleFullContent.module.scss +0 -11
  45. package/vitepress/components/Layout/ToggleSidebar.module.scss +0 -11
  46. package/vitepress/components/MarkMap/MarkMap.module.scss +0 -159
  47. package/vitepress/components/Mermaid/Mermaid.module.scss +0 -275
  48. package/vitepress/components/NotesTable/NotesTable.module.scss +0 -77
  49. package/vitepress/components/Settings/Settings.module.scss +0 -375
@@ -1,81 +1,83 @@
1
1
  <template>
2
2
  <div
3
3
  ref="mermaidRef"
4
- :class="[$style.mermaidWrapper, { [$style.showToolbar]: showToolbar }]"
4
+ class="mermaidWrapper"
5
5
  @mouseenter="showToolbar = true"
6
6
  @mouseleave="showToolbar = false"
7
7
  >
8
8
  <!-- 工具栏 -->
9
9
  <div
10
10
  v-if="!loading && !error"
11
- :class="[$style.toolbar, { [$style.visible]: showToolbar }]"
11
+ class="toolbar"
12
+ :class="{ visible: showToolbar }"
12
13
  >
13
14
  <button
14
15
  @click="zoomIn"
15
- :class="[$style.toolbarBtn, $style.iconBtn]"
16
+ class="toolbarBtn iconBtn"
16
17
  title="放大 (Ctrl + +)"
17
18
  >
18
- <img :src="icon__zoom_in" alt="放大" :class="$style.btnIcon" />
19
+ <img :src="icon__zoom_in" alt="放大" class="btnIcon" />
19
20
  </button>
20
21
  <button
21
22
  @click="zoomOut"
22
- :class="[$style.toolbarBtn, $style.iconBtn]"
23
+ class="toolbarBtn iconBtn"
23
24
  title="缩小 (Ctrl + -)"
24
25
  >
25
- <img :src="icon__zoom_out" alt="缩小" :class="$style.btnIcon" />
26
+ <img :src="icon__zoom_out" alt="缩小" class="btnIcon" />
26
27
  </button>
27
28
  <button
28
29
  @click="resetZoom"
29
- :class="[$style.toolbarBtn, $style.iconBtn]"
30
+ class="toolbarBtn iconBtn"
30
31
  title="重置缩放 (Ctrl + 0)"
31
32
  >
32
- <img :src="icon__zoom_reset" alt="重置" :class="$style.btnIcon" />
33
+ <img :src="icon__zoom_reset" alt="重置" class="btnIcon" />
33
34
  </button>
34
35
  <button
35
36
  @click="fitToScreen"
36
- :class="[$style.toolbarBtn, $style.iconBtn]"
37
+ class="toolbarBtn iconBtn"
37
38
  title="适应屏幕"
38
39
  >
39
- <img :src="icon__zoom_fit" alt="适应屏幕" :class="$style.btnIcon" />
40
+ <img :src="icon__zoom_fit" alt="适应屏幕" class="btnIcon" />
40
41
  </button>
41
42
  <button
42
43
  @click="toggleFullscreen"
43
- :class="[$style.toolbarBtn, $style.iconBtn]"
44
+ class="toolbarBtn iconBtn"
44
45
  title="全屏 (F11)"
45
46
  >
46
47
  <img
47
48
  v-if="isFullscreen"
48
49
  :src="icon__fullscreen_exit"
49
50
  alt="退出全屏"
50
- :class="$style.btnIcon"
51
+ class="btnIcon"
51
52
  />
52
53
  <img
53
54
  v-else
54
55
  :src="icon__fullscreen"
55
56
  alt="全屏"
56
- :class="$style.btnIcon"
57
+ class="btnIcon"
57
58
  />
58
59
  </button>
59
- <span :class="$style.zoomLevel">{{ Math.round(scale * 100) }}%</span>
60
+ <span class="zoomLevel">{{ Math.round(scale * 100) }}%</span>
60
61
  </div>
61
62
 
62
63
  <!-- 图表容器 -->
63
64
  <div
64
- :class="[$style.mermaidContainer, { [$style.fullscreen]: isFullscreen }]"
65
+ class="mermaidContainer"
66
+ :class="{ fullscreen: isFullscreen }"
65
67
  @click="handleContainerClick"
66
68
  >
67
- <div v-if="loading" :class="$style.mermaidLoading">
68
- <div :class="$style.spinner"></div>
69
+ <div v-if="loading" class="mermaidLoading">
70
+ <div class="spinner"></div>
69
71
  <p>加载图表中...</p>
70
72
  </div>
71
- <div v-else-if="error" :class="$style.mermaidError">
72
- <span :class="$style.errorIcon">⚠️</span>
73
+ <div v-else-if="error" class="mermaidError">
74
+ <span class="errorIcon">⚠️</span>
73
75
  <p>{{ error }}</p>
74
76
  </div>
75
77
  <div
76
78
  v-show="!loading && !error"
77
79
  ref="diagramRef"
78
- :class="[$style.mermaidDiagram, props.class]"
80
+ :class="['mermaidDiagram', props.class]"
79
81
  :style="{
80
82
  transform: `scale(${scale})`,
81
83
  transformOrigin: 'center center',
@@ -88,7 +90,7 @@
88
90
 
89
91
  <script setup lang="ts">
90
92
  import mermaid from 'mermaid'
91
- import { nextTick, onMounted, onBeforeUnmount, ref, watch } from 'vue'
93
+ import { nextTick, onMounted, onBeforeUnmount, ref, watch } from 'vue'
92
94
 
93
95
  import {
94
96
  icon__zoom_in,
@@ -363,4 +365,280 @@ watch(
363
365
  // #endregion
364
366
  </script>
365
367
 
366
- <style module src="./Mermaid.module.scss"></style>
368
+ <style scoped lang="scss">
369
+ /* ===================================== */
370
+ /* #region 容器布局 */
371
+ /* ===================================== */
372
+ .mermaidWrapper {
373
+ position: relative;
374
+ margin: 1rem 0;
375
+ border: 1px solid var(--vp-c-divider);
376
+ border-radius: 8px;
377
+ background: var(--vp-c-bg-soft);
378
+ overflow: hidden;
379
+ }
380
+ /* ===================================== */
381
+ /* #endregion 容器布局 */
382
+ /* ===================================== */
383
+
384
+ /* ===================================== */
385
+ /* #region 工具栏 */
386
+ /* ===================================== */
387
+ .toolbar {
388
+ position: absolute;
389
+ top: 0;
390
+ left: 0;
391
+ right: 0;
392
+ display: flex;
393
+ align-items: center;
394
+ gap: 2px;
395
+ padding: 6px 8px;
396
+ background: var(--vp-c-bg);
397
+ border-bottom: 1px solid var(--vp-c-divider);
398
+ flex-wrap: wrap;
399
+ transform: translateY(-100%);
400
+ transition: transform 0.3s ease, opacity 0.3s ease;
401
+ opacity: 0;
402
+ z-index: 10;
403
+ pointer-events: none;
404
+
405
+ &.visible {
406
+ transform: translateY(0);
407
+ opacity: 1;
408
+ pointer-events: auto;
409
+ }
410
+ }
411
+
412
+ .toolbarBtn {
413
+ display: inline-flex;
414
+ align-items: center;
415
+ justify-content: center;
416
+ width: 28px;
417
+ height: 28px;
418
+ padding: 0;
419
+ font-size: 12px;
420
+ background: transparent;
421
+ border: none;
422
+ border-radius: 4px;
423
+ cursor: pointer;
424
+ transition: all 0.2s ease;
425
+ opacity: 0.6;
426
+
427
+ &:hover {
428
+ background: var(--vp-c-brand-soft);
429
+ opacity: 1;
430
+ }
431
+
432
+ &:active {
433
+ transform: scale(0.95);
434
+ }
435
+ }
436
+
437
+ .iconBtn {
438
+ padding: 4px;
439
+
440
+ .btnIcon {
441
+ width: 16px;
442
+ height: 16px;
443
+ display: block;
444
+ pointer-events: none;
445
+ }
446
+ }
447
+
448
+ .zoomLevel {
449
+ margin-left: auto;
450
+ padding: 0 6px;
451
+ font-size: 11px;
452
+ font-weight: 500;
453
+ color: var(--vp-c-text-3);
454
+ user-select: none;
455
+ }
456
+ /* ===================================== */
457
+ /* #endregion 工具栏 */
458
+ /* ===================================== */
459
+
460
+ /* ===================================== */
461
+ /* #region 图表容器 */
462
+ /* ===================================== */
463
+ .mermaidContainer {
464
+ position: relative;
465
+ min-height: 200px;
466
+ max-height: 600px;
467
+ overflow: auto;
468
+ display: flex;
469
+ align-items: center;
470
+ justify-content: center;
471
+ padding: 20px;
472
+ background: var(--vp-c-bg);
473
+
474
+ &.fullscreen {
475
+ position: fixed;
476
+ top: 0;
477
+ left: 0;
478
+ right: 0;
479
+ bottom: 0;
480
+ max-height: none;
481
+ z-index: 9999;
482
+ background: var(--vp-c-bg);
483
+ padding: 40px;
484
+ }
485
+
486
+ /* 自定义滚动条 */
487
+ &::-webkit-scrollbar {
488
+ width: 8px;
489
+ height: 8px;
490
+ }
491
+
492
+ &::-webkit-scrollbar-track {
493
+ background: var(--vp-c-bg-soft);
494
+ }
495
+
496
+ &::-webkit-scrollbar-thumb {
497
+ background: var(--vp-c-divider);
498
+ border-radius: 4px;
499
+
500
+ &:hover {
501
+ background: var(--vp-c-text-3);
502
+ }
503
+ }
504
+ }
505
+ /* ===================================== */
506
+ /* #endregion 图表容器 */
507
+ /* ===================================== */
508
+
509
+ /* ===================================== */
510
+ /* #region 加载和错误状态 */
511
+ /* ===================================== */
512
+ .mermaidLoading {
513
+ display: flex;
514
+ flex-direction: column;
515
+ align-items: center;
516
+ gap: 12px;
517
+ padding: 2rem;
518
+ color: var(--vp-c-text-2);
519
+
520
+ p {
521
+ margin: 0;
522
+ font-size: 14px;
523
+ }
524
+ }
525
+
526
+ .spinner {
527
+ width: 40px;
528
+ height: 40px;
529
+ border: 3px solid var(--vp-c-divider);
530
+ border-top-color: var(--vp-c-brand-1);
531
+ border-radius: 50%;
532
+ animation: spin 0.8s linear infinite;
533
+ }
534
+
535
+ @keyframes spin {
536
+ to {
537
+ transform: rotate(360deg);
538
+ }
539
+ }
540
+
541
+ .mermaidError {
542
+ display: flex;
543
+ flex-direction: column;
544
+ align-items: center;
545
+ gap: 8px;
546
+ padding: 2rem;
547
+ color: var(--vp-c-danger-1);
548
+
549
+ p {
550
+ margin: 0;
551
+ font-size: 14px;
552
+ text-align: center;
553
+ }
554
+ }
555
+
556
+ .errorIcon {
557
+ font-size: 32px;
558
+ }
559
+ /* ===================================== */
560
+ /* #endregion 加载和错误状态 */
561
+ /* ===================================== */
562
+
563
+ /* ===================================== */
564
+ /* #region 图表样式 */
565
+ /* ===================================== */
566
+ .mermaidDiagram {
567
+ width: 100%;
568
+ display: flex;
569
+ align-items: center;
570
+ justify-content: center;
571
+ transition: transform 0.2s ease;
572
+ cursor: grab;
573
+
574
+ &:active {
575
+ cursor: grabbing;
576
+ }
577
+
578
+ :global(svg) {
579
+ max-width: 100%;
580
+ height: auto;
581
+ }
582
+ }
583
+ /* ===================================== */
584
+ /* #endregion 图表样式 */
585
+ /* ===================================== */
586
+
587
+ /* ===================================== */
588
+ /* #region 暗色主题优化 */
589
+ /* ===================================== */
590
+ :global(html.dark) .mermaidWrapper {
591
+ background: var(--vp-code-block-bg);
592
+ border-color: var(--vp-c-divider);
593
+ }
594
+
595
+ :global(html.dark) .toolbar {
596
+ background: var(--vp-code-block-bg);
597
+ }
598
+
599
+ :global(html.dark) .mermaidContainer {
600
+ background: var(--vp-code-block-bg);
601
+ }
602
+ /* ===================================== */
603
+ /* #endregion 暗色主题优化 */
604
+ /* ===================================== */
605
+
606
+ /* ===================================== */
607
+ /* #region 响应式设计 */
608
+ /* ===================================== */
609
+ @media (max-width: 768px) {
610
+ .toolbar {
611
+ padding: 4px 6px;
612
+ }
613
+
614
+ .toolbarBtn {
615
+ width: 24px;
616
+ height: 24px;
617
+ }
618
+
619
+ .iconBtn {
620
+ padding: 3px;
621
+
622
+ .btnIcon {
623
+ width: 14px;
624
+ height: 14px;
625
+ }
626
+ }
627
+
628
+ .zoomLevel {
629
+ font-size: 10px;
630
+ }
631
+
632
+ .mermaidContainer {
633
+ padding: 12px;
634
+ max-height: 400px;
635
+
636
+ &.fullscreen {
637
+ padding: 20px;
638
+ }
639
+ }
640
+ }
641
+ /* ===================================== */
642
+ /* #endregion 响应式设计 */
643
+ /* ===================================== */
644
+ </style>
@@ -1,13 +1,13 @@
1
1
  <template>
2
- <div v-if="errorMessage" :class="$style.error">
2
+ <div v-if="errorMessage" class="error">
3
3
  {{ errorMessage }}
4
4
  </div>
5
5
 
6
- <div v-else-if="notFoundIds.length > 0" :class="$style.warning">
6
+ <div v-else-if="notFoundIds.length > 0" class="warning">
7
7
  以下笔记 ID 未找到配置: {{ notFoundIds.join(', ') }}
8
8
  </div>
9
9
 
10
- <table v-if="tableData.length > 0" :class="$style.notesTable">
10
+ <table v-if="tableData.length > 0" class="notesTable">
11
11
  <thead>
12
12
  <tr>
13
13
  <th>笔记</th>
@@ -17,15 +17,13 @@
17
17
  <tbody>
18
18
  <tr v-for="note in tableData" :key="note.id">
19
19
  <td>
20
- <a :href="note.url" :class="$style.noteLink">
21
- <span :class="$style.noteId">{{ note.id }}.</span>
20
+ <a :href="note.url" class="noteLink">
21
+ <span class="noteId">{{ note.id }}.</span>
22
22
  <span>{{ note.title }}</span>
23
23
  </a>
24
24
  </td>
25
25
  <td>
26
- <span
27
- :class="[$style.description, { [$style.empty]: !note.description }]"
28
- >
26
+ <span class="description" :class="{ empty: !note.description }">
29
27
  {{ note.description || '暂无简介' }}
30
28
  </span>
31
29
  </td>
@@ -36,7 +34,7 @@
36
34
 
37
35
  <script setup lang="ts">
38
36
  import { useData } from 'vitepress'
39
- import { computed } from 'vue'
37
+ import { computed } from 'vue'
40
38
 
41
39
  // @ts-expect-error - VitePress data loader exports data at runtime
42
40
  import { data as allNotesConfig } from '../notesConfig.data.ts'
@@ -96,4 +94,82 @@ const tableData = computed(() => {
96
94
  })
97
95
  </script>
98
96
 
99
- <style module src="./NotesTable.module.scss"></style>
97
+ <style scoped lang="scss">
98
+ .notesTable {
99
+ width: 100%;
100
+ border-collapse: collapse;
101
+ margin: 1.5rem 0;
102
+ font-size: 0.95rem;
103
+
104
+ th,
105
+ td {
106
+ padding: 0.75rem 1rem;
107
+ text-align: left;
108
+ border: 1px solid var(--vp-c-divider);
109
+ }
110
+
111
+ th {
112
+ background-color: var(--vp-c-bg-soft);
113
+ font-weight: 600;
114
+ color: var(--vp-c-text-1);
115
+ }
116
+
117
+ tbody tr {
118
+ transition: background-color 0.2s;
119
+
120
+ &:hover {
121
+ background-color: var(--vp-c-bg-soft);
122
+ }
123
+ }
124
+
125
+ td {
126
+ color: var(--vp-c-text-2);
127
+ }
128
+
129
+ .noteLink {
130
+ color: var(--vp-c-brand-1);
131
+ text-decoration: none;
132
+ font-weight: 500;
133
+ transition: color 0.2s;
134
+
135
+ &:hover {
136
+ color: var(--vp-c-brand-2);
137
+ text-decoration: underline;
138
+ }
139
+ }
140
+
141
+ .noteId {
142
+ font-family: var(--vp-font-family-mono);
143
+ font-size: 0.9em;
144
+ color: var(--vp-c-text-3);
145
+ margin-right: 0.5rem;
146
+ }
147
+
148
+ .description {
149
+ line-height: 1.6;
150
+
151
+ &.empty {
152
+ color: var(--vp-c-text-3);
153
+ font-style: italic;
154
+ }
155
+ }
156
+ }
157
+
158
+ .error {
159
+ padding: 1rem;
160
+ margin: 1rem 0;
161
+ border-left: 4px solid var(--vp-c-danger-1);
162
+ background-color: var(--vp-c-danger-soft);
163
+ color: var(--vp-c-danger-1);
164
+ border-radius: 4px;
165
+ }
166
+
167
+ .warning {
168
+ padding: 1rem;
169
+ margin: 1rem 0;
170
+ border-left: 4px solid var(--vp-c-warning-1);
171
+ background-color: var(--vp-c-warning-soft);
172
+ color: var(--vp-c-warning-1);
173
+ border-radius: 4px;
174
+ }
175
+ </style>