-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.html
More file actions
1307 lines (1217 loc) · 62.5 KB
/
Copy pathtemplate.html
File metadata and controls
1307 lines (1217 loc) · 62.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html lang="zh-CN">
<head>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&family=Work+Sans:wght@300;400;500;600&family=IBM+Plex+Mono:wght@400;500&family=Noto+Sans+SC:wght@300;400;500;600&family=Noto+Serif+SC:wght@400;500;600&display=swap" rel="stylesheet">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="generator" content="deepwiki-html">
<title>{{MODULE_NAME}} 技术设计文档</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github.min.css" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github-dark.min.css" media="(prefers-color-scheme: dark)">
<style>
/* ===== CSS Variables ===== */
:root {
--font-sans: "Work Sans", "Noto Sans SC", system-ui, sans-serif;
--font-display: "Cormorant Garamond", "Noto Serif SC", serif;
--font-mono: "IBM Plex Mono", Consolas, "Courier New", monospace;
--line-height: 1.65;
--max-width: 880px;
--toc-width: 220px;
--header-height: 48px;
/* Light theme */
--bg: #F2EEDF;
--bg-secondary: #ECE6D2;
--bg-tertiary: #E4DDD0;
--text: #2A241B;
--text-secondary: #5C5345;
--text-muted: #7A7060;
--text-faint: #9A9080;
--border: #D8D0C0;
--border-light: #E4DDD0;
--accent: #B07070;
--accent-hover: #9A5A5A;
--accent-soft: #F5EDED;
--accent-light: #F5EDED;
--code-bg: #ECE6D2;
--code-border: #D8D0C0;
--link: #8B5E5E;
--link-hover: #6B4040;
--shadow-sm: 0 1px 3px rgba(0,0,0,.06);
--shadow-md: 0 4px 12px rgba(0,0,0,.08);
/* Semantic callout colors */
--info: #7B8FA0; --info-bg: #EDF0F2; --info-border: #C8D0D8;
--success: #7B9A6B; --success-bg: #EDF2EE; --success-border: #C8D8CC;
--warning: #B08B40; --warning-bg: #F5F0E0; --warning-border: #D8CCA0;
--danger: #B05050; --danger-bg: #F5EDED; --danger-border: #D8B0B0;
--note: #8B7B9A; --note-bg: #F0EDF5; --note-border: #C8C0D8;
/* Card accent colors (solid, used for border-left) */
--card-green: #B7C7A8;
--card-amber: #D6DD63;
--card-red: #E1A4C2;
--card-violet: #C9BEDC;
--card-cyan: #A8C0B8;
--card-blue: #9AB0C8;
}
[data-theme="dark"] {
--bg: #1E1B16;
--bg-secondary: #282420;
--bg-tertiary: #302B25;
--text: #E8DDD0;
--text-muted: #8A7E70;
--text-faint: #6A6055;
--border: #4A4440;
--border-light: #352F2A;
--accent: #D4A0A0;
--accent-hover: #E0B5B5;
--accent-soft: #2A1E1E;
--accent-light: #2A1E1E;
--code-bg: #282420;
--code-border: #4A4440;
--link: #D4A0A0;
--link-hover: #E0B5B5;
--shadow-sm: 0 1px 3px rgba(0,0,0,.3);
--shadow-md: 0 4px 12px rgba(0,0,0,.4);
--info: #58a6ff; --info-bg: #0d1d31; --info-border: #1f4170;
--success: #3fb950; --success-bg: #0d2818; --success-border: #1a4731;
--warning: #d29922; --warning-bg: #2a1f05; --warning-border: #4b3a12;
--danger: #f85149; --danger-bg: #2d0d0d; --danger-border: #5a1a1a;
--note: #a371f7; --note-bg: #1a0d2e; --note-border: #3b2066;
--card-green: #3fb950;
--card-amber: #d29922;
--card-red: #f85149;
--card-violet: #a371f7;
--card-cyan: #39d2c0;
--card-blue: #58a6ff;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--bg: #1E1B16;
--bg-secondary: #282420;
--bg-tertiary: #302B25;
--text: #E8DDD0;
--text-muted: #8A7E70;
--text-faint: #6A6055;
--border: #4A4440;
--border-light: #352F2A;
--text-secondary: #B0A595;
--accent: #D4A0A0;
--accent-hover: #E0B5B5;
--accent-soft: #2A1E1E;
--accent-light: #2A1E1E;
--code-bg: #282420;
--code-border: #4A4440;
--link: #D4A0A0;
--link-hover: #E0B5B5;
--shadow-sm: 0 1px 3px rgba(0,0,0,.3);
--shadow-md: 0 4px 12px rgba(0,0,0,.4);
--info: #58a6ff; --info-bg: #0d1d31; --info-border: #1f4170;
--success: #3fb950; --success-bg: #0d2818; --success-border: #1a4731;
--warning: #d29922; --warning-bg: #2a1f05; --warning-border: #4b3a12;
--danger: #f85149; --danger-bg: #2d0d0d; --danger-border: #5a1a1a;
--note: #a371f7; --note-bg: #1a0d2e; --note-border: #3b2066;
--card-green: #3fb950;
--card-amber: #d29922;
--card-red: #f85149;
--card-violet: #a371f7;
--card-cyan: #39d2c0;
--card-blue: #58a6ff;
}
}
/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
margin: 0;
font-family: var(--font-sans);
font-size: 15px;
line-height: var(--line-height);
color: var(--text);
background: var(--bg);
-webkit-font-smoothing: antialiased;
}
/* ===== Top bar ===== */
.topbar {
position: sticky;
top: 0;
z-index: 100;
display: flex;
align-items: center;
gap: 12px;
height: var(--header-height);
padding: 0 24px;
background: var(--bg);
border-bottom: 1px solid var(--border);
font-size: 13px;
}
.topbar-brand {
font-weight: 800;
color: var(--accent);
letter-spacing: .02em;
white-space: nowrap;
}
.topbar-sep { color: var(--text-faint); }
.topbar-title {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: var(--text-muted);
}
.topbar-actions { display: flex; gap: 6px; }
.topbar-btn {
display: inline-flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
border: 1px solid var(--border);
border-radius: 6px;
background: var(--bg);
color: var(--text-muted);
cursor: pointer;
font-size: 16px;
transition: border-color .15s, color .15s;
}
.topbar-btn:hover { border-color: var(--accent); color: var(--accent); }
/* ===== Layout ===== */
.layout {
display: grid;
grid-template-columns: var(--toc-width) 1fr;
min-height: calc(100vh - var(--header-height));
}
/* ===== Sidebar TOC ===== */
.sidebar {
position: sticky;
top: var(--header-height);
height: calc(100vh - var(--header-height));
overflow-y: auto;
padding: 20px 0 20px 20px;
border-right: 1px solid var(--border);
font-size: 13px;
scrollbar-width: thin;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-list li { margin: 0; }
.toc-list a {
display: block;
padding: 4px 12px 4px 10px;
color: var(--text-muted);
text-decoration: none;
border-left: 2px solid transparent;
border-radius: 0 4px 4px 0;
transition: color .15s, border-color .15s, background .15s;
line-height: 1.4;
}
.toc-list a:hover { color: var(--text); background: var(--bg-secondary); }
.toc-list a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.toc-list .toc-h3 { padding-left: 24px; font-size: 12px; }
/* ===== Main content ===== */
.main {
max-width: var(--max-width);
margin: 0 auto;
padding: 32px 40px 80px;
}
/* ===== Document metadata header ===== */
.doc-meta { margin-bottom: 36px; }
.doc-version {
display: inline-block;
padding: 2px 10px;
border-radius: 4px;
background: var(--accent-soft);
color: var(--accent);
font-size: 12px;
font-weight: 700;
letter-spacing: .03em;
}
.doc-meta h1 {
margin: 12px 0 16px;
font-size: 32px;
line-height: 1.2;
letter-spacing: -.01em;
}
.meta-grid {
display: grid;
grid-template-columns: auto 1fr;
gap: 4px 16px;
margin: 0;
padding: 14px 18px;
border: 1px solid var(--border);
border-radius: 8px;
background: var(--bg-secondary);
font-size: 14px;
}
.meta-grid dt { color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.meta-grid dd { margin: 0; }
/* ===== Headings ===== */
h1, h2, h3, h4 { margin: 0; color: var(--text); line-height: 1.3; font-family: var(--font-display); }
h2 {
margin: 40px 0 16px;
padding-bottom: 8px;
font-size: 22px;
border-bottom: 2px solid var(--border-light);
}
h3 { margin: 28px 0 10px; font-size: 17px; }
h4 { margin: 20px 0 8px; font-size: 15px; font-weight: 700; }
/* Headings inside <details> <summary> lose their own margins */
summary > h2, summary > h3 { display: inline; margin: 0; border: 0; padding: 0; }
/* ===== Paragraphs & links ===== */
p { margin: 0 0 12px; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
/* ===== Details / collapsible sections ===== */
details {
margin: 24px 0;
border: 1px solid var(--border);
border-radius: 8px;
overflow: hidden;
}
details > summary {
padding: 12px 18px;
background: var(--bg-secondary);
cursor: pointer;
font-weight: 700;
font-size: 18px;
list-style: none;
user-select: none;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
content: "▸";
display: inline-block;
width: 20px;
color: var(--text-faint);
transition: transform .15s;
}
details[open] > summary::before { transform: rotate(90deg); }
details > summary:hover { background: var(--bg-tertiary); }
details > .section-body { padding: 18px 20px; }
/* ===== Callouts ===== */
.callout {
margin: 16px 0;
padding: 14px 18px;
border-radius: 8px;
border-left: 4px solid;
font-size: 14px;
line-height: 1.6;
}
.callout strong { display: block; margin-bottom: 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.callout.info { background: var(--info-bg); border-color: var(--info); color: var(--text); }
.callout.success { background: var(--success-bg); border-color: var(--success); color: var(--text); }
.callout.warning { background: var(--warning-bg); border-color: var(--warning); color: var(--text); }
.callout.danger { background: var(--danger-bg); border-color: var(--danger); color: var(--text); }
.callout.note { background: var(--note-bg); border-color: var(--note); color: var(--text); }
/* ===== Card grid ===== */
.card-grid { display: grid; gap: 16px; margin: 16px 0; }
.card-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.card-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.card {
padding: 18px;
border: 1px solid var(--border);
border-radius: 8px;
background: var(--bg);
}
.card h3 { margin: 0 0 10px; font-size: 15px; }
.card ul { margin: 0; padding-left: 18px; font-size: 14px; color: var(--text-muted); }
.card li + li { margin-top: 4px; }
.card.accent-green { background: var(--card-green); border-color: color-mix(in srgb, var(--success) 30%, var(--border)); }
.card.accent-amber { background: var(--card-amber); border-color: color-mix(in srgb, var(--warning) 30%, var(--border)); }
.card.accent-red { background: var(--card-red); border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); }
.card.accent-violet { background: var(--card-violet); border-color: color-mix(in srgb, var(--note) 30%, var(--border)); }
.card.accent-cyan { background: var(--card-cyan); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.card.accent-blue { background: var(--card-blue); border-color: color-mix(in srgb, var(--info) 30%, var(--border)); }
/* ===== Code blocks ===== */
code {
padding: 2px 6px;
border-radius: 4px;
background: var(--code-bg);
font-family: var(--font-mono);
font-size: .9em;
}
.code-block {
position: relative;
margin: 16px 0;
}
.code-block pre {
margin: 0;
padding: 16px 20px;
border: 1px solid var(--code-border);
border-radius: 8px;
background: var(--code-bg);
overflow-x: auto;
font-family: var(--font-mono);
font-size: 13.5px;
line-height: 1.55;
tab-size: 4;
}
.code-block pre code,
.code-block pre code.hljs {
padding: 0;
background: none;
font-size: inherit;
}
/* highlight.js theme override for dark mode toggle */
[data-theme="dark"] .hljs { color: #e6edf3; background: var(--code-bg); }
[data-theme="dark"] .hljs-keyword { color: #ff7b72; }
[data-theme="dark"] .hljs-string, [data-theme="dark"] .hljs-attr { color: #a5d6ff; }
[data-theme="dark"] .hljs-comment { color: #8b949e; }
[data-theme="dark"] .hljs-type, [data-theme="dark"] .hljs-built_in { color: #79c0ff; }
[data-theme="dark"] .hljs-number { color: #79c0ff; }
[data-theme="dark"] .hljs-function { color: #d2a8ff; }
[data-theme="dark"] .hljs-class .hljs-title { color: #ffa657; }
[data-theme="dark"] .hljs-meta { color: #79c0ff; }
.code-block .lang-tag {
position: absolute;
top: 8px;
right: 48px;
padding: 1px 8px;
border-radius: 4px;
background: var(--bg-tertiary);
color: var(--text-faint);
font-size: 11px;
font-family: var(--font-mono);
pointer-events: none;
}
.code-block .copy-btn {
position: absolute;
top: 6px;
right: 8px;
padding: 4px 8px;
border: 1px solid var(--border);
border-radius: 4px;
background: var(--bg);
color: var(--text-muted);
font-size: 12px;
cursor: pointer;
opacity: 0;
transition: opacity .15s;
}
.code-block:hover .copy-btn { opacity: 1; }
.code-block .copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.code-block .copy-btn.copied { color: var(--success); border-color: var(--success); }
/* ===== Tabs (pure CSS) ===== */
.tabs { margin: 16px 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.tabs input[type="radio"] { display: none; }
.tab-bar {
display: flex;
border-bottom: 1px solid var(--border);
background: var(--bg-secondary);
}
.tab-bar label {
padding: 10px 20px;
font-size: 13px;
font-weight: 600;
color: var(--text-muted);
cursor: pointer;
border-bottom: 2px solid transparent;
margin-bottom: -1px;
transition: color .15s, border-color .15s;
}
.tab-bar label:hover { color: var(--text); }
.tab-panel { display: none; padding: 16px 20px; }
/* Show the panel whose radio is checked: up to 5 tabs */
.tabs input:nth-of-type(1):checked ~ .tab-bar label:nth-of-type(1),
.tabs input:nth-of-type(2):checked ~ .tab-bar label:nth-of-type(2),
.tabs input:nth-of-type(3):checked ~ .tab-bar label:nth-of-type(3),
.tabs input:nth-of-type(4):checked ~ .tab-bar label:nth-of-type(4),
.tabs input:nth-of-type(5):checked ~ .tab-bar label:nth-of-type(5) {
color: var(--accent);
border-bottom-color: var(--accent);
}
.tabs input:nth-of-type(1):checked ~ .tab-panel:nth-of-type(1),
.tabs input:nth-of-type(2):checked ~ .tab-panel:nth-of-type(2),
.tabs input:nth-of-type(3):checked ~ .tab-panel:nth-of-type(3),
.tabs input:nth-of-type(4):checked ~ .tab-panel:nth-of-type(4),
.tabs input:nth-of-type(5):checked ~ .tab-panel:nth-of-type(5) {
display: block;
}
/* ===== Tables ===== */
.table-wrapper { margin: 16px 0; overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border-light); }
th { background: var(--bg-secondary); font-weight: 700; color: var(--text); white-space: nowrap; }
td { color: var(--text-muted); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-secondary); }
td code { font-size: .85em; }
/* ===== Diagrams ===== */
.diagram {
margin: 20px 0; text-align: center;
cursor: zoom-in; position: relative;
border: 1px solid transparent; border-radius: 8px;
padding: 12px;
}
.diagram:hover {
border-color: var(--border);
background: var(--bg-secondary);
}
.diagram::after {
content: '点击放大'; position: absolute;
bottom: 4px; right: 10px; font-size: 12px;
color: var(--text-faint); opacity: 0;
transition: opacity 0.2s; pointer-events: none;
}
.diagram:hover::after { opacity: 1; }
.diagram svg { max-width: 100%; height: auto; }
.diagram figcaption {
margin-top: 8px;
font-size: 13px;
color: var(--text-faint);
font-style: italic;
}
/* ===== Diagram Zoom Overlay ===== */
.diagram-overlay {
display: none; position: fixed;
top: 0; left: 0; right: 0; bottom: 0;
background: rgba(0,0,0,0.85); z-index: 9999;
cursor: grab; overflow: hidden;
}
.diagram-overlay.active { display: flex; align-items: center; justify-content: center; }
.diagram-overlay.grabbing { cursor: grabbing; }
.diagram-overlay-inner { transform-origin: center center; }
.diagram-overlay .zoom-controls {
position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
display: flex; gap: 8px; background: rgba(30,30,50,0.9);
padding: 8px 16px; border-radius: 40px;
box-shadow: 0 4px 20px rgba(0,0,0,0.4); z-index: 10000; user-select: none;
}
.diagram-overlay .zoom-controls button {
background: rgba(255,255,255,0.1); border: none; color: #fff;
width: 36px; height: 36px; border-radius: 50%; font-size: 18px;
cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.diagram-overlay .zoom-controls button:hover { background: rgba(255,255,255,0.25); }
.diagram-overlay .zoom-controls .zoom-level {
color: #aaa; font-size: 13px; min-width: 50px; text-align: center; line-height: 36px;
}
.diagram-overlay .zoom-close {
position: fixed; top: 16px; right: 20px;
background: rgba(255,255,255,0.1); border: none; color: #fff;
width: 40px; height: 40px; border-radius: 50%; font-size: 22px;
cursor: pointer; z-index: 10000;
display: flex; align-items: center; justify-content: center;
}
.diagram-overlay .zoom-close:hover { background: rgba(255,255,255,0.25); }
.diagram-overlay .zoom-hint {
position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
color: rgba(255,255,255,0.5); font-size: 13px; z-index: 10000; pointer-events: none;
}
/* ===== Flow (horizontal steps) ===== */
.flow { display: flex; gap: 8px; margin: 16px 0; flex-wrap: wrap; }
.flow-step {
flex: 1;
min-width: 120px;
position: relative;
padding: 12px 14px;
border: 1px solid var(--border);
border-radius: 8px;
background: var(--bg);
text-align: center;
}
.flow-step b { display: block; font-size: 14px; color: var(--text); }
.flow-step span { font-size: 12px; color: var(--text-muted); }
.flow-step:not(:last-child)::after {
content: "→";
position: absolute;
right: -14px;
top: 50%;
transform: translateY(-50%);
color: var(--text-faint);
font-size: 18px;
z-index: 1;
}
/* ===== Changelog ===== */
.changelog { margin: 16px 0; padding: 0; list-style: none; }
.changelog li {
position: relative;
padding: 8px 0 8px 24px;
border-left: 2px solid var(--border);
font-size: 14px;
color: var(--text-muted);
}
.changelog li::before {
content: "";
position: absolute;
left: -5px;
top: 14px;
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--accent);
border: 2px solid var(--bg);
}
.changelog li:first-child::before { background: var(--success); }
.changelog time {
font-weight: 600;
color: var(--text);
margin-right: 8px;
}
.changelog .tag {
display: inline-block;
padding: 1px 8px;
margin-right: 6px;
border-radius: 4px;
background: var(--accent-soft);
color: var(--accent);
font-size: 12px;
font-weight: 700;
}
/* ===== Dependency tree ===== */
.dep-tree {
margin: 12px 0;
padding: 14px 18px;
border: 1px solid var(--border);
border-radius: 8px;
background: var(--code-bg);
font-family: var(--font-mono);
font-size: 13px;
line-height: 1.6;
white-space: pre;
}
/* ===== Lists ===== */
ul, ol { margin: 0 0 12px; padding-left: 22px; }
li + li { margin-top: 3px; }
/* ===== Responsive ===== */
@media (max-width: 900px) {
.layout { grid-template-columns: 1fr; }
.sidebar { display: none; }
.sidebar.open {
display: block;
position: fixed;
top: var(--header-height);
left: 0;
width: 280px;
height: calc(100vh - var(--header-height));
background: var(--bg);
z-index: 99;
box-shadow: var(--shadow-md);
}
.main { padding: 24px 20px 60px; }
.card-grid.cols-3 { grid-template-columns: 1fr; }
.card-grid.cols-2 { grid-template-columns: 1fr; }
}
/* ===== Scope Block ===== */
.scope-block {
background: var(--info-bg); border-left: 3px solid var(--info);
padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px;
font-size: 0.9rem;
}
/* ===== Print ===== */
@media print {
.topbar, .sidebar, .topbar-actions { display: none !important; }
.layout { display: block; }
.main { max-width: 100%; padding: 0; }
details { border: none; }
details > summary { display: none; }
details > .section-body { padding: 0; display: block !important; }
details[open] > .section-body { display: block; }
.code-block .copy-btn { display: none; }
.callout { break-inside: avoid; }
.card-grid { break-inside: avoid; }
a[href]::after { content: " (" attr(href) ")"; font-size: .85em; color: #666; }
a[href^="#"]::after { content: none; }
}
/* ===== Menu toggle (mobile) ===== */
.menu-toggle { display: none; }
@media (max-width: 900px) {
.menu-toggle { display: inline-flex; }
}
</style>
</head>
<body data-doctype="tech-design">
<!-- Top bar -->
<nav class="topbar">
<span class="topbar-brand">HDSA-MACO</span>
<span class="topbar-sep">/</span>
<span class="topbar-title">{{MODULE_NAME}} 技术设计文档</span>
<div class="topbar-actions">
<button class="topbar-btn menu-toggle" onclick="toggleSidebar()" title="目录">☰</button>
<button class="topbar-btn" onclick="toggleTheme()" title="切换主题">◐</button>
<button class="topbar-btn" onclick="window.print()" title="打印">⎙</button>
</div>
</nav>
<div class="layout">
<!-- Sidebar TOC (auto-generated by JS) -->
<aside class="sidebar" id="sidebar">
<nav>
<ul class="toc-list" id="toc"></ul>
</nav>
</aside>
<!-- Main content -->
<article class="main" id="content">
<!-- Document metadata -->
<header class="doc-meta">
<span class="doc-version">{{VERSION}}</span>
<h1>{{MODULE_NAME}} 技术设计文档</h1>
<dl class="meta-grid">
<dt>实现文件</dt><dd><code>{{FILE_PATH}}</code></dd>
<dt>测试文件</dt><dd><code>{{TEST_FILE}}</code></dd>
<dt>关联文档</dt><dd>{{RELATED_DOCS}}</dd>
<dt>更新日期</dt><dd>{{DATE}}</dd>
</dl>
</header>
<!-- Section 1: Overview (default open) -->
<details open id="sec-overview">
<summary><h2>1. 概述</h2></summary>
<div class="section-body">
<h3>1.1 背景</h3>
<p>[模块存在的背景]</p>
<h3>1.2 问题</h3>
<div class="table-wrapper">
<table>
<thead><tr><th>问题</th><th>影响</th></tr></thead>
<tbody>
<tr><td>[问题1]</td><td>[影响1]</td></tr>
</tbody>
</table>
</div>
<h3>1.3 解决方案</h3>
<div class="diagram">
<svg viewBox="0 0 600 200" role="img" aria-label="模块架构图">
<!-- inline SVG diagram here -->
</svg>
<figcaption>图 1.1 — {{MODULE_NAME}} 架构概览</figcaption>
</div>
</div>
</details>
<!-- Section 2: Design Goals -->
<details open id="sec-goals">
<summary><h2>2. 设计目标</h2></summary>
<div class="section-body">
<div class="card-grid cols-2">
<article class="card">
<h3>功能目标</h3>
<div class="table-wrapper">
<table>
<thead><tr><th>目标</th><th>说明</th></tr></thead>
<tbody>
<tr><td>[目标1]</td><td>[说明1]</td></tr>
</tbody>
</table>
</div>
</article>
<article class="card accent-cyan">
<h3>非功能目标</h3>
<div class="table-wrapper">
<table>
<thead><tr><th>目标</th><th>指标</th></tr></thead>
<tbody>
<tr><td>性能</td><td>[性能要求]</td></tr>
</tbody>
</table>
</div>
</article>
</div>
</div>
</details>
<!-- Section 3: Architecture -->
<details open id="sec-arch">
<summary><h2>3. 架构设计</h2></summary>
<div class="section-body">
<h3>3.1 模块关系</h3>
<div class="diagram">
<svg viewBox="0 0 600 300" role="img" aria-label="模块关系图">
<!-- inline SVG diagram here -->
</svg>
<figcaption>图 3.1 — 模块依赖关系</figcaption>
</div>
<h3>3.2 职责划分</h3>
<div class="table-wrapper">
<table>
<thead><tr><th>组件</th><th>职责</th></tr></thead>
<tbody>
<tr><td>[组件A]</td><td>[职责A]</td></tr>
</tbody>
</table>
</div>
</div>
</details>
<!-- Section 4: Core Concepts -->
<details open id="sec-concepts">
<summary><h2>4. 核心概念</h2></summary>
<div class="section-body">
<h3>4.1 数据结构</h3>
<figure class="code-block" data-lang="cpp">
<pre><code>struct ExampleStruct {
int field1;
std::string field2;
};</code></pre>
</figure>
<h3>4.2 枚举定义</h3>
<div class="table-wrapper">
<table>
<thead><tr><th>值</th><th>名称</th><th>含义</th></tr></thead>
<tbody>
<tr><td>0</td><td>[Name0]</td><td>[含义0]</td></tr>
</tbody>
</table>
</div>
</div>
</details>
<!-- Section 5: State Machine (optional) -->
<details id="sec-state">
<summary><h2>5. 状态机</h2></summary>
<div class="section-body">
<h3>5.1 状态定义</h3>
<div class="table-wrapper">
<table>
<thead><tr><th>状态</th><th>名称</th><th>含义</th></tr></thead>
<tbody>
<tr><td><code>STATE_A</code></td><td>[名称A]</td><td>[含义说明]</td></tr>
</tbody>
</table>
</div>
<h3>5.2 状态转换图</h3>
<div class="diagram">
<svg viewBox="0 0 500 300" role="img" aria-label="状态转换图">
<!-- inline SVG state diagram -->
</svg>
<figcaption>图 5.1 — 状态转换图</figcaption>
</div>
<h3>5.3 转换条件</h3>
<div class="table-wrapper">
<table>
<thead><tr><th>当前状态</th><th>事件/条件</th><th>目标状态</th><th>副作用</th></tr></thead>
<tbody>
<tr><td>Initial</td><td>start()</td><td>Running</td><td>开始计时</td></tr>
</tbody>
</table>
</div>
</div>
</details>
<!-- Section 6: Flow Charts (optional) -->
<details id="sec-flow">
<summary><h2>6. 流程图</h2></summary>
<div class="section-body">
<h3>6.1 核心流程</h3>
<div class="flow">
<div class="flow-step"><b>Step 1</b><span>描述</span></div>
<div class="flow-step"><b>Step 2</b><span>描述</span></div>
<div class="flow-step"><b>Step 3</b><span>描述</span></div>
</div>
<div class="diagram">
<svg viewBox="0 0 600 400" role="img" aria-label="核心流程图">
<!-- inline SVG flow chart -->
</svg>
<figcaption>图 6.1 — 核心流程</figcaption>
</div>
</div>
</details>
<!-- Section 7: Implementation Details -->
<details open id="sec-impl">
<summary><h2>7. 实现细节</h2></summary>
<div class="section-body">
<h3>7.1 核心方法</h3>
<figure class="code-block" data-lang="cpp">
<pre><code>void CoreMethod::execute() {
// implementation
}</code></pre>
</figure>
<aside class="callout info">
<strong>Why</strong>
解释这个实现选择背后的原因。
</aside>
</div>
</details>
<!-- Section 8: API Reference -->
<details open id="sec-api">
<summary><h2>8. API 参考</h2></summary>
<div class="section-body">
<div class="table-wrapper">
<table>
<thead><tr><th>函数</th><th>签名</th><th>说明</th></tr></thead>
<tbody>
<tr>
<td><code>method1</code></td>
<td><code>ReturnType method1(ParamType param)</code></td>
<td>[说明]</td>
</tr>
</tbody>
</table>
</div>
</div>
</details>
<!-- Section 9: Usage Guide -->
<details open id="sec-usage">
<summary><h2>9. 使用指南</h2></summary>
<div class="section-body">
<!-- Tabs: basic / advanced / best practices -->
<div class="tabs">
<input type="radio" name="usage-tabs" id="usage-basic" checked>
<input type="radio" name="usage-tabs" id="usage-adv">
<input type="radio" name="usage-tabs" id="usage-best">
<div class="tab-bar">
<label for="usage-basic">基本使用</label>
<label for="usage-adv">进阶用法</label>
<label for="usage-best">最佳实践</label>
</div>
<div class="tab-panel">
<figure class="code-block" data-lang="cpp">
<pre><code>// Basic usage example
auto obj = createObject();
obj->doWork();</code></pre>
</figure>
</div>
<div class="tab-panel">
<figure class="code-block" data-lang="cpp">
<pre><code>// Advanced usage with callbacks
auto obj = createObject();
obj->setCallback([](auto& ctx) { /* ... */ });
obj->doWork();</code></pre>
</figure>
</div>
<div class="tab-panel">
<ul>
<li>[最佳实践1]</li>
<li>[最佳实践2]</li>
</ul>
</div>
</div>
</div>
</details>
<!-- Section 10: FAQ (optional, default collapsed) -->
<details id="sec-faq">
<summary><h2>10. 常见问题</h2></summary>
<div class="section-body">
<div class="table-wrapper">
<table>
<thead><tr><th>问题</th><th>解答</th></tr></thead>
<tbody>
<tr><td>[Q1]</td><td>[A1]</td></tr>
</tbody>
</table>
</div>
<aside class="callout warning">
<strong>常见陷阱</strong>
[陷阱描述和解决方案]
</aside>
</div>
</details>
<!-- Section 11: Test Coverage -->
<details open id="sec-tests">
<summary><h2>11. 测试覆盖</h2></summary>
<div class="section-body">
<div class="table-wrapper">
<table>
<thead><tr><th>测试</th><th>说明</th></tr></thead>
<tbody>
<tr><td>[测试1]</td><td>[说明]</td></tr>
</tbody>
</table>
</div>
<div class="card-grid cols-3">
<article class="card accent-green"><h3>总测试数</h3><p style="font-size:28px;font-weight:800;margin:0">[N]</p></article>
<article class="card accent-cyan"><h3>通过</h3><p style="font-size:28px;font-weight:800;margin:0">[N]</p></article>
<article class="card"><h3>覆盖范围</h3><p style="font-size:14px;margin:0">[范围描述]</p></article>
</div>
</div>
</details>
<!-- Appendix -->
<details id="sec-appendix">
<summary><h2>附录</h2></summary>
<div class="section-body">
<h3>文件清单</h3>
<div class="table-wrapper">
<table>
<thead><tr><th>文件</th><th>说明</th></tr></thead>
<tbody>
<tr><td><code>{{FILE_PATH}}</code></td><td>模块实现</td></tr>
<tr><td><code>{{TEST_FILE}}</code></td><td>单元测试</td></tr>
</tbody>
</table>
</div>
<h3>依赖关系</h3>
<div class="dep-tree">{{MODULE_NAME}}
├── [依赖模块1]
├── [依赖模块2]
└── [依赖模块3]</div>
<h3>变更历史</h3>
<ol class="changelog">
<li><time>{{DATE}}</time><span class="tag">{{VERSION}}</span> 初始版本</li>