@hanology/cham-browser 0.1.0 → 0.2.0
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/dist/cli.d.ts +2 -0
- package/dist/cli.js +191 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/pipeline.d.ts +14 -0
- package/dist/pipeline.js +377 -0
- package/dist/pipeline.js.map +1 -0
- package/package.json +22 -3
- package/template/index.html +29 -0
- package/template/src/App.vue +29 -0
- package/template/src/components/AnnotationLayerSelector.vue +66 -0
- package/template/src/components/AnnotationTooltip.vue +189 -0
- package/template/src/components/BookCard.vue +85 -0
- package/template/src/components/HorizontalDisplay.vue +100 -0
- package/template/src/components/PoemCard.vue +131 -0
- package/template/src/components/PronunciationGroup.vue +45 -0
- package/template/src/components/ReadingToolbar.vue +131 -0
- package/template/src/components/SectionBlock.vue +142 -0
- package/template/src/components/SideNav.vue +291 -0
- package/template/src/components/VerticalScroll.vue +120 -0
- package/template/src/composables/useAnnotationRenderer.ts +158 -0
- package/template/src/composables/useBook.ts +93 -0
- package/template/src/composables/useData.ts +41 -0
- package/template/src/composables/useHorizontalScroll.ts +60 -0
- package/template/src/composables/useLibrary.ts +40 -0
- package/template/src/composables/usePageLayout.ts +25 -0
- package/template/src/composables/useReadingMode.ts +70 -0
- package/template/src/composables/useTitle.ts +5 -0
- package/template/src/main.ts +22 -0
- package/template/src/router.ts +29 -0
- package/template/src/shims-vue.d.ts +7 -0
- package/template/src/styles/main.css +136 -0
- package/template/src/types.ts +164 -0
- package/template/src/utils/annotationParser.ts +58 -0
- package/template/src/utils/chineseNumber.ts +41 -0
- package/template/src/views/AuthorView.vue +338 -0
- package/template/src/views/BookHome.vue +375 -0
- package/template/src/views/LibraryHome.vue +419 -0
- package/template/src/views/PieceView.vue +793 -0
- package/src/index.ts +0 -20
- package/tsconfig.json +0 -16
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
|
+
import { useRoute, useRouter } from 'vue-router'
|
|
4
|
+
import { useLibrary } from '../composables/useLibrary'
|
|
5
|
+
import { useBook } from '../composables/useBook'
|
|
6
|
+
import { useData } from '../composables/useData'
|
|
7
|
+
import { useTitle } from '../composables/useTitle'
|
|
8
|
+
import { useReadingMode } from '../composables/useReadingMode'
|
|
9
|
+
import { useHorizontalScroll } from '../composables/useHorizontalScroll'
|
|
10
|
+
import SideNav from '../components/SideNav.vue'
|
|
11
|
+
import type { Piece } from '../types'
|
|
12
|
+
|
|
13
|
+
const route = useRoute()
|
|
14
|
+
const router = useRouter()
|
|
15
|
+
|
|
16
|
+
const { loadLibrary, books, singleBook } = useLibrary()
|
|
17
|
+
await loadLibrary()
|
|
18
|
+
|
|
19
|
+
const { loadShared, getAuthor } = useData()
|
|
20
|
+
await loadShared()
|
|
21
|
+
|
|
22
|
+
const { load, getPiecesByAuthor, meta } = useBook()
|
|
23
|
+
const bookId = singleBook.value?.id || books.value[0]?.id
|
|
24
|
+
if (bookId) await load(bookId)
|
|
25
|
+
|
|
26
|
+
const { layout } = useReadingMode()
|
|
27
|
+
const isVertical = computed(() => layout.value === 'vertical')
|
|
28
|
+
const vPageRef = ref<HTMLElement | null>(null)
|
|
29
|
+
const vScroll = useHorizontalScroll(vPageRef)
|
|
30
|
+
|
|
31
|
+
const authorName = computed(() => decodeURIComponent(String(route.params.name || '')))
|
|
32
|
+
const author = computed(() => getAuthor(authorName.value))
|
|
33
|
+
const authorPieces = computed(() => getPiecesByAuthor(authorName.value))
|
|
34
|
+
|
|
35
|
+
useTitle(`${authorName.value} — ${meta.value?.title || ''}`)
|
|
36
|
+
|
|
37
|
+
function openPiece(piece: Piece) {
|
|
38
|
+
router.push(`/${piece.bookId}/${piece.num}`)
|
|
39
|
+
}
|
|
40
|
+
function goBack() { router.push('/') }
|
|
41
|
+
function goHome() { router.push('/') }
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<div v-if="author">
|
|
46
|
+
<!-- ═══════ 直排模式 ═══════ -->
|
|
47
|
+
<div v-if="isVertical" class="v-root">
|
|
48
|
+
<SideNav :context="authorName" @back="goBack" @home="goHome" />
|
|
49
|
+
<div ref="vPageRef" class="v-page">
|
|
50
|
+
<section class="v-author-info">
|
|
51
|
+
<div class="v-seal">{{ authorName.charAt(0) }}</div>
|
|
52
|
+
<h1 class="v-name">{{ authorName }}</h1>
|
|
53
|
+
<span v-if="author.dynasty" class="v-dynasty">{{ author.dynasty }}</span>
|
|
54
|
+
<span class="v-count">{{ authorPieces.length }} 篇收錄作品</span>
|
|
55
|
+
</section>
|
|
56
|
+
|
|
57
|
+
<section v-if="author.bio" class="v-bio">
|
|
58
|
+
<div class="v-bio-label">作者簡介</div>
|
|
59
|
+
<div class="v-bio-text">{{ author.bio }}</div>
|
|
60
|
+
</section>
|
|
61
|
+
|
|
62
|
+
<div
|
|
63
|
+
v-for="piece in authorPieces"
|
|
64
|
+
:key="`${piece.bookId}-${piece.num}`"
|
|
65
|
+
class="v-work"
|
|
66
|
+
@click="openPiece(piece)"
|
|
67
|
+
>
|
|
68
|
+
<div class="v-work-num">{{ String(piece.num).padStart(3, '0') }}</div>
|
|
69
|
+
<div class="v-work-title">{{ piece.title }}</div>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
<!-- ═══════ 橫排模式 ═══════ -->
|
|
75
|
+
<div v-else class="h-root">
|
|
76
|
+
<div class="h-page">
|
|
77
|
+
<nav class="h-nav">
|
|
78
|
+
<div class="h-nav-inner">
|
|
79
|
+
<button class="h-back" @click="goBack">← 返回</button>
|
|
80
|
+
<div class="h-breadcrumb">
|
|
81
|
+
<span class="h-sep">作者</span>
|
|
82
|
+
<span class="h-sep">·</span>
|
|
83
|
+
<span class="h-author-name">{{ authorName }}</span>
|
|
84
|
+
</div>
|
|
85
|
+
<div class="h-controls">
|
|
86
|
+
<span class="h-tag">{{ author.dynasty || '未知朝代' }}</span>
|
|
87
|
+
<span class="h-tag">{{ authorPieces.length }} 篇</span>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
</nav>
|
|
91
|
+
|
|
92
|
+
<div class="h-content">
|
|
93
|
+
<div class="h-hero">
|
|
94
|
+
<div class="h-seal">{{ authorName.charAt(0) }}</div>
|
|
95
|
+
<div class="h-info">
|
|
96
|
+
<h1 class="h-name">{{ authorName }}</h1>
|
|
97
|
+
<div class="h-meta">
|
|
98
|
+
<span v-if="author.dynasty" class="h-dynasty">{{ author.dynasty }}</span>
|
|
99
|
+
<span class="h-count">{{ authorPieces.length }} 篇收錄作品</span>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
<div v-if="author.bio" class="h-bio">
|
|
105
|
+
<h3>作者簡介</h3>
|
|
106
|
+
<p>{{ author.bio }}</p>
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<div class="h-works">
|
|
110
|
+
<h3>收錄作品</h3>
|
|
111
|
+
<div class="h-grid">
|
|
112
|
+
<div
|
|
113
|
+
v-for="piece in authorPieces"
|
|
114
|
+
:key="`${piece.bookId}-${piece.num}`"
|
|
115
|
+
class="h-work"
|
|
116
|
+
@click="openPiece(piece)"
|
|
117
|
+
>
|
|
118
|
+
<div class="h-work-num">{{ String(piece.num).padStart(3, '0') }}</div>
|
|
119
|
+
<div class="h-work-title">{{ piece.title }}</div>
|
|
120
|
+
<div class="h-work-preview">{{ piece.verses.map(v => v.text).join('').slice(0, 40) }}</div>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
<div v-else style="text-align:center;padding-top:120px">
|
|
130
|
+
<p style="font-size:18px;color:var(--ink-faint)">載入中…</p>
|
|
131
|
+
</div>
|
|
132
|
+
</template>
|
|
133
|
+
|
|
134
|
+
<style scoped>
|
|
135
|
+
/* ═══════ 直排模式 ═══════ */
|
|
136
|
+
|
|
137
|
+
.v-page {
|
|
138
|
+
height: 100vh;
|
|
139
|
+
display: flex;
|
|
140
|
+
flex-direction: row-reverse;
|
|
141
|
+
overflow-x: auto;
|
|
142
|
+
overflow-y: hidden;
|
|
143
|
+
margin-right: var(--nav-width, 56px);
|
|
144
|
+
padding: 0 32px;
|
|
145
|
+
background: var(--paper);
|
|
146
|
+
scrollbar-width: thin;
|
|
147
|
+
scrollbar-color: var(--gold) transparent;
|
|
148
|
+
}
|
|
149
|
+
.v-page::-webkit-scrollbar { height: 4px; }
|
|
150
|
+
.v-page::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 2px; }
|
|
151
|
+
|
|
152
|
+
.v-author-info {
|
|
153
|
+
writing-mode: vertical-rl;
|
|
154
|
+
text-orientation: mixed;
|
|
155
|
+
flex-shrink: 0;
|
|
156
|
+
height: 100vh;
|
|
157
|
+
display: flex;
|
|
158
|
+
flex-direction: column;
|
|
159
|
+
align-items: flex-start;
|
|
160
|
+
justify-content: center;
|
|
161
|
+
padding: 40px 20px;
|
|
162
|
+
}
|
|
163
|
+
.v-seal {
|
|
164
|
+
width: 64px; height: 64px;
|
|
165
|
+
border: 3px solid var(--vermillion); border-radius: 4px;
|
|
166
|
+
display: flex; align-items: center; justify-content: center;
|
|
167
|
+
font-size: 28px; font-weight: 900;
|
|
168
|
+
color: var(--vermillion);
|
|
169
|
+
margin-left: 24px; padding-left: 20px;
|
|
170
|
+
border-left: 3px solid var(--vermillion);
|
|
171
|
+
}
|
|
172
|
+
.v-name {
|
|
173
|
+
font-size: 48px; font-weight: 900;
|
|
174
|
+
letter-spacing: 10px; color: var(--ink);
|
|
175
|
+
margin-left: 20px;
|
|
176
|
+
}
|
|
177
|
+
.v-dynasty {
|
|
178
|
+
font-size: 20px; color: var(--gold);
|
|
179
|
+
font-weight: 600; letter-spacing: 4px;
|
|
180
|
+
margin-left: 12px;
|
|
181
|
+
}
|
|
182
|
+
.v-count {
|
|
183
|
+
font-size: 16px; color: var(--ink-faint);
|
|
184
|
+
letter-spacing: 2px; margin-left: 12px;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.v-bio {
|
|
188
|
+
writing-mode: vertical-rl;
|
|
189
|
+
text-orientation: mixed;
|
|
190
|
+
flex-shrink: 0;
|
|
191
|
+
height: 100vh;
|
|
192
|
+
padding: 40px 16px;
|
|
193
|
+
border-right: 1px solid var(--border);
|
|
194
|
+
}
|
|
195
|
+
.v-bio-label {
|
|
196
|
+
font-size: 18px; font-weight: 700;
|
|
197
|
+
letter-spacing: 4px; color: var(--ink);
|
|
198
|
+
margin-left: 16px; padding-left: 12px;
|
|
199
|
+
border-left: 1px solid var(--border);
|
|
200
|
+
}
|
|
201
|
+
.v-bio-text {
|
|
202
|
+
font-size: 16px; line-height: 2.4;
|
|
203
|
+
color: var(--ink-mid);
|
|
204
|
+
max-height: 80vh;
|
|
205
|
+
overflow-x: auto;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.v-work {
|
|
209
|
+
writing-mode: vertical-rl;
|
|
210
|
+
text-orientation: mixed;
|
|
211
|
+
flex-shrink: 0;
|
|
212
|
+
height: 240px;
|
|
213
|
+
padding: 24px 16px;
|
|
214
|
+
background: var(--surface);
|
|
215
|
+
border: 1px solid var(--border-light);
|
|
216
|
+
border-radius: 6px;
|
|
217
|
+
cursor: pointer;
|
|
218
|
+
transition: all 0.2s ease;
|
|
219
|
+
align-self: center;
|
|
220
|
+
}
|
|
221
|
+
.v-work:hover {
|
|
222
|
+
border-color: var(--gold);
|
|
223
|
+
box-shadow: 0 4px 16px rgba(var(--shadow-rgb), 0.08);
|
|
224
|
+
}
|
|
225
|
+
.v-work-num {
|
|
226
|
+
font-size: 11px; color: var(--ink-faint);
|
|
227
|
+
font-family: var(--sans); letter-spacing: 2px;
|
|
228
|
+
margin-left: 8px;
|
|
229
|
+
}
|
|
230
|
+
.v-work-title {
|
|
231
|
+
font-size: 22px; font-weight: 700;
|
|
232
|
+
letter-spacing: 4px; color: var(--ink);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/* ═══════ 橫排模式 ═══════ */
|
|
236
|
+
|
|
237
|
+
.h-page { min-height: 100vh; }
|
|
238
|
+
.h-nav {
|
|
239
|
+
position: sticky; top: 0; z-index: 100;
|
|
240
|
+
background: var(--paper); opacity: 0.97;
|
|
241
|
+
backdrop-filter: blur(20px);
|
|
242
|
+
border-bottom: 1px solid var(--border-light);
|
|
243
|
+
padding: 0 40px;
|
|
244
|
+
}
|
|
245
|
+
.h-nav-inner {
|
|
246
|
+
max-width: 1200px; margin: 0 auto;
|
|
247
|
+
display: flex; align-items: center;
|
|
248
|
+
height: 56px; gap: 16px;
|
|
249
|
+
}
|
|
250
|
+
.h-back {
|
|
251
|
+
display: inline-flex; align-items: center; gap: 6px;
|
|
252
|
+
padding: 6px 16px; border: 1px solid var(--border);
|
|
253
|
+
border-radius: 2px; background: none;
|
|
254
|
+
font-family: var(--sans); font-size: 13px;
|
|
255
|
+
color: var(--ink-mid); cursor: pointer;
|
|
256
|
+
transition: all 0.2s; white-space: nowrap;
|
|
257
|
+
}
|
|
258
|
+
.h-back:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
|
|
259
|
+
.h-breadcrumb { font-size: 15px; font-weight: 600; letter-spacing: 1px; }
|
|
260
|
+
.h-sep { color: var(--ink-faint); font-weight: 300; margin: 0 8px; }
|
|
261
|
+
.h-author-name { color: var(--ink-light); font-weight: 400; }
|
|
262
|
+
.h-controls { margin-left: auto; display: flex; gap: 6px; }
|
|
263
|
+
.h-tag {
|
|
264
|
+
padding: 4px 12px; border: 1px solid var(--border);
|
|
265
|
+
border-radius: 2px; font-family: var(--sans);
|
|
266
|
+
font-size: 12px; color: var(--ink-light); letter-spacing: 1px;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.h-content {
|
|
270
|
+
max-width: 1200px; margin: 0 auto; padding: 60px 40px;
|
|
271
|
+
}
|
|
272
|
+
.h-hero {
|
|
273
|
+
display: flex; align-items: center; gap: 32px;
|
|
274
|
+
max-width: min(680px, calc(100vw - 80px));
|
|
275
|
+
margin: 0 auto 48px; padding: 40px;
|
|
276
|
+
background: var(--surface); border: 1px solid var(--border);
|
|
277
|
+
border-radius: 8px;
|
|
278
|
+
box-shadow: 0 4px 16px rgba(var(--shadow-rgb), 0.08);
|
|
279
|
+
}
|
|
280
|
+
.h-seal {
|
|
281
|
+
width: 80px; height: 80px;
|
|
282
|
+
border: 3px solid var(--vermillion); border-radius: 4px;
|
|
283
|
+
display: flex; align-items: center; justify-content: center;
|
|
284
|
+
font-size: 28px; font-weight: 900;
|
|
285
|
+
color: var(--vermillion); flex-shrink: 0;
|
|
286
|
+
}
|
|
287
|
+
.h-name { font-size: 36px; font-weight: 900; letter-spacing: 6px; color: var(--ink); }
|
|
288
|
+
.h-meta { display: flex; gap: 16px; margin-top: 8px; font-family: var(--sans); font-size: 14px; }
|
|
289
|
+
.h-dynasty { color: var(--gold); font-weight: 600; letter-spacing: 2px; }
|
|
290
|
+
.h-count { color: var(--ink-faint); letter-spacing: 1px; }
|
|
291
|
+
|
|
292
|
+
.h-bio {
|
|
293
|
+
max-width: min(680px, calc(100vw - 80px));
|
|
294
|
+
margin: 0 auto 48px; padding: 24px 32px;
|
|
295
|
+
background: var(--surface); border: 1px solid var(--border-light);
|
|
296
|
+
border-radius: 8px;
|
|
297
|
+
}
|
|
298
|
+
.h-bio h3 {
|
|
299
|
+
font-size: 16px; font-weight: 700;
|
|
300
|
+
letter-spacing: 3px; color: var(--ink);
|
|
301
|
+
margin-bottom: 16px; padding-bottom: 12px;
|
|
302
|
+
border-bottom: 1px solid var(--border);
|
|
303
|
+
}
|
|
304
|
+
.h-bio p { font-size: 16px; line-height: 2.2; color: var(--ink-mid); text-align: justify; }
|
|
305
|
+
|
|
306
|
+
.h-works { max-width: min(900px, calc(100vw - 80px)); margin: 0 auto; }
|
|
307
|
+
.h-works h3 { font-size: 18px; font-weight: 700; letter-spacing: 3px; color: var(--ink); margin-bottom: 24px; }
|
|
308
|
+
.h-grid {
|
|
309
|
+
display: grid;
|
|
310
|
+
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
|
311
|
+
gap: 12px;
|
|
312
|
+
}
|
|
313
|
+
.h-work {
|
|
314
|
+
padding: 20px;
|
|
315
|
+
background: var(--surface); border: 1px solid var(--border-light);
|
|
316
|
+
border-radius: 6px; cursor: pointer;
|
|
317
|
+
transition: all 0.2s ease;
|
|
318
|
+
}
|
|
319
|
+
.h-work:hover {
|
|
320
|
+
border-color: var(--gold);
|
|
321
|
+
box-shadow: 0 4px 16px rgba(var(--shadow-rgb), 0.08);
|
|
322
|
+
transform: translateY(-2px);
|
|
323
|
+
}
|
|
324
|
+
.h-work-num { font-size: 11px; color: var(--ink-faint); font-family: var(--sans); letter-spacing: 2px; }
|
|
325
|
+
.h-work-title { font-size: 18px; font-weight: 700; letter-spacing: 2px; margin: 6px 0 4px; }
|
|
326
|
+
.h-work-preview {
|
|
327
|
+
font-size: 12px; color: var(--ink-faint); line-height: 1.6;
|
|
328
|
+
display: -webkit-box; -webkit-line-clamp: 1;
|
|
329
|
+
-webkit-box-orient: vertical; overflow: hidden;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
@media (max-width: 768px) {
|
|
333
|
+
.h-hero { flex-direction: column; text-align: center; padding: 24px; }
|
|
334
|
+
.h-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
|
|
335
|
+
.h-content { padding: 30px 20px; }
|
|
336
|
+
.v-page { padding: 0 16px; }
|
|
337
|
+
}
|
|
338
|
+
</style>
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, computed } from 'vue'
|
|
3
|
+
import { useRouter } from 'vue-router'
|
|
4
|
+
import { useBook } from '../composables/useBook'
|
|
5
|
+
import { useTitle } from '../composables/useTitle'
|
|
6
|
+
import { useReadingMode } from '../composables/useReadingMode'
|
|
7
|
+
import { useHorizontalScroll } from '../composables/useHorizontalScroll'
|
|
8
|
+
import PoemCard from '../components/PoemCard.vue'
|
|
9
|
+
import SideNav from '../components/SideNav.vue'
|
|
10
|
+
import ReadingToolbar from '../components/ReadingToolbar.vue'
|
|
11
|
+
|
|
12
|
+
const props = defineProps<{ bookId: string }>()
|
|
13
|
+
const router = useRouter()
|
|
14
|
+
const { pieces, meta, load } = useBook()
|
|
15
|
+
await load(props.bookId)
|
|
16
|
+
|
|
17
|
+
const searchQuery = ref('')
|
|
18
|
+
useTitle(meta.value?.title || '')
|
|
19
|
+
|
|
20
|
+
const { layout } = useReadingMode()
|
|
21
|
+
const isVertical = computed(() => layout.value === 'vertical')
|
|
22
|
+
const vPageRef = ref<HTMLElement | null>(null)
|
|
23
|
+
const vScroll = useHorizontalScroll(vPageRef)
|
|
24
|
+
|
|
25
|
+
const filtered = computed(() => {
|
|
26
|
+
const q = searchQuery.value.toLowerCase()
|
|
27
|
+
if (!q) return pieces.value
|
|
28
|
+
return pieces.value.filter(p =>
|
|
29
|
+
p.title.toLowerCase().includes(q) ||
|
|
30
|
+
p.author.toLowerCase().includes(q) ||
|
|
31
|
+
p.verses.some(v => v.text.toLowerCase().includes(q))
|
|
32
|
+
)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
const authorCount = computed(() => new Set(pieces.value.map(p => p.author)).size)
|
|
36
|
+
|
|
37
|
+
function tcy(n: number): string {
|
|
38
|
+
const s = String(n)
|
|
39
|
+
return `<span class="tcy">${s}</span>`
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function heroHtml(template: string): string {
|
|
43
|
+
return template
|
|
44
|
+
.replace('{count}', tcy(pieces.value.length))
|
|
45
|
+
.replace('{authorCount}', tcy(authorCount.value))
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function openPiece(num: number) {
|
|
49
|
+
router.push(`/${props.bookId}/${num}`)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function scrollToCatalog() {
|
|
53
|
+
document.querySelector('.h-catalog')?.scrollIntoView({ behavior: 'smooth' })
|
|
54
|
+
}
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<template>
|
|
58
|
+
<!-- ═══════ 直排模式 ═══════ -->
|
|
59
|
+
<div v-if="isVertical" class="v-root">
|
|
60
|
+
<SideNav @home="router.push('/')" @back="router.push('/')" />
|
|
61
|
+
<div ref="vPageRef" class="v-page">
|
|
62
|
+
<section class="v-hero">
|
|
63
|
+
<div class="v-ornament">◆ ◇ ◆</div>
|
|
64
|
+
<h1 class="v-title">{{ meta?.title }}</h1>
|
|
65
|
+
<p class="v-subtitle">{{ meta?.subtitle }}</p>
|
|
66
|
+
<span v-if="meta?.publisher" class="v-publisher">{{ meta.publisher }}</span>
|
|
67
|
+
<div class="v-divider"></div>
|
|
68
|
+
<div v-if="meta?.hero?.length" class="v-stats">
|
|
69
|
+
<span v-for="line in meta.hero" :key="line" class="v-stat" v-html="heroHtml(line)" />
|
|
70
|
+
</div>
|
|
71
|
+
</section>
|
|
72
|
+
|
|
73
|
+
<section class="v-catalog-col">
|
|
74
|
+
<span class="v-ch-title">篇 章 目 錄</span>
|
|
75
|
+
<span class="v-ch-line"> </span>
|
|
76
|
+
<span class="v-count">共 {{ filtered.length }} 篇</span>
|
|
77
|
+
<span class="v-search-wrap">
|
|
78
|
+
<input v-model="searchQuery" class="v-search" placeholder="搜索詩題、作者…" />
|
|
79
|
+
</span>
|
|
80
|
+
</section>
|
|
81
|
+
|
|
82
|
+
<div class="v-cards-col">
|
|
83
|
+
<PoemCard
|
|
84
|
+
v-for="piece in filtered"
|
|
85
|
+
:key="piece.num"
|
|
86
|
+
:poem="piece"
|
|
87
|
+
:vertical="true"
|
|
88
|
+
class="v-card"
|
|
89
|
+
@click="openPiece(piece.num)"
|
|
90
|
+
/>
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<!-- ═══════ 橫排模式 ═══════ -->
|
|
96
|
+
<div v-else class="h-root">
|
|
97
|
+
<section class="h-hero">
|
|
98
|
+
<div class="h-hero-inner">
|
|
99
|
+
<div class="h-ornament">◆ ◇ ◆</div>
|
|
100
|
+
<h1 class="h-title">{{ meta?.title }}</h1>
|
|
101
|
+
<p class="h-subtitle">{{ meta?.subtitle }}</p>
|
|
102
|
+
<div class="h-divider"></div>
|
|
103
|
+
<div class="h-stats">
|
|
104
|
+
<div class="h-stat-block">
|
|
105
|
+
<div class="h-stat-num">{{ pieces.length }}</div>
|
|
106
|
+
<div class="h-stat-label">篇詩文</div>
|
|
107
|
+
</div>
|
|
108
|
+
<div class="h-stat-block">
|
|
109
|
+
<div class="h-stat-num">{{ authorCount }}</div>
|
|
110
|
+
<div class="h-stat-label">位作者</div>
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
<p v-if="meta?.publisher" class="h-publisher">{{ meta.publisher }}</p>
|
|
114
|
+
<button class="h-cta" @click="scrollToCatalog">
|
|
115
|
+
進 入 文 庫 ↓
|
|
116
|
+
</button>
|
|
117
|
+
</div>
|
|
118
|
+
</section>
|
|
119
|
+
|
|
120
|
+
<section class="h-catalog">
|
|
121
|
+
<div class="h-catalog-header">
|
|
122
|
+
<h2>篇 章 目 錄</h2>
|
|
123
|
+
<div class="h-line"></div>
|
|
124
|
+
<p v-if="meta?.publisher">{{ meta.publisher }}</p>
|
|
125
|
+
</div>
|
|
126
|
+
<div class="h-filter">
|
|
127
|
+
<input v-model="searchQuery" class="h-search" placeholder="搜索詩題、作者…" />
|
|
128
|
+
</div>
|
|
129
|
+
<div class="h-grid">
|
|
130
|
+
<PoemCard
|
|
131
|
+
v-for="piece in filtered"
|
|
132
|
+
:key="piece.num"
|
|
133
|
+
:poem="piece"
|
|
134
|
+
@click="openPiece(piece.num)"
|
|
135
|
+
/>
|
|
136
|
+
</div>
|
|
137
|
+
</section>
|
|
138
|
+
|
|
139
|
+
<ReadingToolbar />
|
|
140
|
+
</div>
|
|
141
|
+
</template>
|
|
142
|
+
|
|
143
|
+
<style scoped>
|
|
144
|
+
/* ═══════ 直排模式 ═══════ */
|
|
145
|
+
|
|
146
|
+
.v-page {
|
|
147
|
+
height: 100vh;
|
|
148
|
+
display: flex;
|
|
149
|
+
flex-direction: row-reverse;
|
|
150
|
+
overflow-x: auto;
|
|
151
|
+
overflow-y: hidden;
|
|
152
|
+
margin-right: var(--nav-width, 56px);
|
|
153
|
+
padding: 0 32px;
|
|
154
|
+
background: linear-gradient(90deg, var(--paper) 0%, var(--paper-warm) 100%);
|
|
155
|
+
scrollbar-width: thin;
|
|
156
|
+
scrollbar-color: var(--gold) transparent;
|
|
157
|
+
}
|
|
158
|
+
.v-page::-webkit-scrollbar { height: 4px; }
|
|
159
|
+
.v-page::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 2px; }
|
|
160
|
+
|
|
161
|
+
.v-hero {
|
|
162
|
+
writing-mode: vertical-rl;
|
|
163
|
+
text-orientation: mixed;
|
|
164
|
+
flex-shrink: 0;
|
|
165
|
+
height: 100vh;
|
|
166
|
+
display: flex;
|
|
167
|
+
flex-direction: column;
|
|
168
|
+
align-items: flex-start;
|
|
169
|
+
justify-content: center;
|
|
170
|
+
padding: 40px 20px;
|
|
171
|
+
}
|
|
172
|
+
.v-ornament {
|
|
173
|
+
font-size: 36px; color: var(--vermillion);
|
|
174
|
+
opacity: 0.6; letter-spacing: 12px; margin-left: 24px;
|
|
175
|
+
}
|
|
176
|
+
.v-title {
|
|
177
|
+
font-size: 56px; font-weight: 900;
|
|
178
|
+
letter-spacing: 16px; color: var(--ink);
|
|
179
|
+
margin-left: 20px; padding-left: 20px;
|
|
180
|
+
border-left: 4px solid var(--vermillion);
|
|
181
|
+
line-height: 1.6;
|
|
182
|
+
}
|
|
183
|
+
.v-subtitle {
|
|
184
|
+
font-size: 18px; font-weight: 300;
|
|
185
|
+
color: var(--ink-light); letter-spacing: 6px;
|
|
186
|
+
margin-left: 16px; font-family: var(--sans);
|
|
187
|
+
}
|
|
188
|
+
.v-divider {
|
|
189
|
+
width: 2px; height: 80px;
|
|
190
|
+
background: linear-gradient(180deg, transparent, var(--gold), transparent);
|
|
191
|
+
margin-left: 20px;
|
|
192
|
+
}
|
|
193
|
+
.v-stats { display: flex; flex-direction: column; gap: 16px; margin-left: 16px; }
|
|
194
|
+
.v-stat {
|
|
195
|
+
font-size: 22px; font-weight: 200;
|
|
196
|
+
color: var(--ink); letter-spacing: 4px; white-space: nowrap;
|
|
197
|
+
}
|
|
198
|
+
.v-stat :deep(.tcy) {
|
|
199
|
+
text-combine-upright: all;
|
|
200
|
+
}
|
|
201
|
+
.v-publisher {
|
|
202
|
+
font-size: 14px; font-weight: 300;
|
|
203
|
+
color: var(--ink-faint); letter-spacing: 3px;
|
|
204
|
+
margin-left: 16px; font-family: var(--sans);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.v-catalog-col {
|
|
208
|
+
writing-mode: vertical-rl;
|
|
209
|
+
text-orientation: mixed;
|
|
210
|
+
flex-shrink: 0;
|
|
211
|
+
height: 100vh;
|
|
212
|
+
padding: 40px 16px;
|
|
213
|
+
border-right: 1px solid var(--border);
|
|
214
|
+
display: flex;
|
|
215
|
+
align-items: center;
|
|
216
|
+
}
|
|
217
|
+
.v-ch-title {
|
|
218
|
+
font-size: 28px; font-weight: 700;
|
|
219
|
+
letter-spacing: 8px; color: var(--ink);
|
|
220
|
+
margin-left: 16px;
|
|
221
|
+
}
|
|
222
|
+
.v-ch-line {
|
|
223
|
+
display: inline-block;
|
|
224
|
+
width: 2px; height: 40px;
|
|
225
|
+
background: var(--vermillion);
|
|
226
|
+
margin-left: 16px;
|
|
227
|
+
}
|
|
228
|
+
.v-count {
|
|
229
|
+
font-size: 14px; color: var(--ink-light);
|
|
230
|
+
letter-spacing: 2px;
|
|
231
|
+
margin-left: 12px;
|
|
232
|
+
padding-left: 12px;
|
|
233
|
+
border-left: 1px solid var(--border);
|
|
234
|
+
}
|
|
235
|
+
.v-search-wrap {
|
|
236
|
+
margin-left: 12px;
|
|
237
|
+
}
|
|
238
|
+
.v-search {
|
|
239
|
+
writing-mode: vertical-rl;
|
|
240
|
+
text-orientation: mixed;
|
|
241
|
+
padding: 12px 8px;
|
|
242
|
+
border: 1px solid var(--border);
|
|
243
|
+
border-radius: 2px;
|
|
244
|
+
background: var(--surface);
|
|
245
|
+
font-family: var(--sans);
|
|
246
|
+
font-size: 13px;
|
|
247
|
+
color: var(--ink);
|
|
248
|
+
height: 200px;
|
|
249
|
+
width: 36px;
|
|
250
|
+
outline: none;
|
|
251
|
+
text-align: start;
|
|
252
|
+
}
|
|
253
|
+
.v-search:focus { border-color: var(--gold); }
|
|
254
|
+
.v-search::placeholder {
|
|
255
|
+
color: var(--ink-faint);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.v-cards-col {
|
|
259
|
+
flex-shrink: 0;
|
|
260
|
+
display: grid;
|
|
261
|
+
grid-auto-flow: column;
|
|
262
|
+
grid-template-rows: repeat(auto-fill, 240px);
|
|
263
|
+
gap: 12px;
|
|
264
|
+
padding: 24px 16px;
|
|
265
|
+
height: 100vh;
|
|
266
|
+
box-sizing: border-box;
|
|
267
|
+
overflow-x: auto;
|
|
268
|
+
overflow-y: hidden;
|
|
269
|
+
direction: rtl;
|
|
270
|
+
align-items: start;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.v-card {
|
|
274
|
+
flex-shrink: 0;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/* ═══════ 橫排模式 ═══════ */
|
|
278
|
+
|
|
279
|
+
.h-hero {
|
|
280
|
+
position: relative;
|
|
281
|
+
height: 100vh;
|
|
282
|
+
display: flex; flex-direction: column;
|
|
283
|
+
align-items: center; justify-content: center;
|
|
284
|
+
background: linear-gradient(180deg, var(--paper) 0%, var(--paper-warm) 100%);
|
|
285
|
+
overflow: hidden;
|
|
286
|
+
}
|
|
287
|
+
.h-hero::before {
|
|
288
|
+
content: '';
|
|
289
|
+
position: absolute; inset: 0;
|
|
290
|
+
background: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 0v60M0 30h60' stroke='%23d8cdb8' stroke-width='.3' fill='none'/%3E%3C/svg%3E") repeat;
|
|
291
|
+
opacity: 0.3;
|
|
292
|
+
pointer-events: none;
|
|
293
|
+
}
|
|
294
|
+
.h-hero-inner { position: relative; z-index: 1; text-align: center; }
|
|
295
|
+
.h-ornament {
|
|
296
|
+
font-size: 48px; color: var(--vermillion);
|
|
297
|
+
opacity: 0.6; letter-spacing: 20px; margin-bottom: 32px;
|
|
298
|
+
}
|
|
299
|
+
.h-title {
|
|
300
|
+
font-size: clamp(36px, 6vw, 64px);
|
|
301
|
+
font-weight: 900; letter-spacing: 12px;
|
|
302
|
+
color: var(--ink); margin-bottom: 12px;
|
|
303
|
+
}
|
|
304
|
+
.h-subtitle {
|
|
305
|
+
font-size: clamp(14px, 2vw, 18px);
|
|
306
|
+
font-weight: 300; color: var(--ink-light);
|
|
307
|
+
letter-spacing: 6px; margin-bottom: 48px;
|
|
308
|
+
font-family: var(--sans);
|
|
309
|
+
}
|
|
310
|
+
.h-divider {
|
|
311
|
+
width: 120px; height: 2px;
|
|
312
|
+
background: linear-gradient(90deg, transparent, var(--gold), transparent);
|
|
313
|
+
margin: 0 auto 48px;
|
|
314
|
+
}
|
|
315
|
+
.h-stats { display: flex; gap: 48px; justify-content: center; margin-bottom: 48px; }
|
|
316
|
+
.h-stat-num { font-size: 36px; font-weight: 200; color: var(--ink); letter-spacing: 2px; }
|
|
317
|
+
.h-stat-label {
|
|
318
|
+
font-size: 12px; color: var(--ink-faint);
|
|
319
|
+
letter-spacing: 4px; font-family: var(--sans);
|
|
320
|
+
margin-top: 4px; text-align: center;
|
|
321
|
+
}
|
|
322
|
+
.h-publisher {
|
|
323
|
+
font-size: 14px; color: var(--ink-faint);
|
|
324
|
+
font-family: var(--sans); letter-spacing: 3px;
|
|
325
|
+
margin-bottom: 48px;
|
|
326
|
+
}
|
|
327
|
+
.h-cta {
|
|
328
|
+
display: inline-flex; align-items: center; gap: 12px;
|
|
329
|
+
padding: 14px 40px;
|
|
330
|
+
background: var(--ink); color: var(--paper);
|
|
331
|
+
font-family: var(--sans); font-size: 15px;
|
|
332
|
+
font-weight: 500; letter-spacing: 3px;
|
|
333
|
+
border: none; border-radius: 2px; cursor: pointer;
|
|
334
|
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
335
|
+
}
|
|
336
|
+
.h-cta:hover {
|
|
337
|
+
background: var(--vermillion);
|
|
338
|
+
transform: translateY(-2px);
|
|
339
|
+
box-shadow: 0 12px 40px rgba(var(--shadow-rgb), 0.12);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.h-catalog { max-width: 1200px; margin: 0 auto; padding: 80px 40px; }
|
|
343
|
+
.h-catalog-header { text-align: center; margin-bottom: 60px; }
|
|
344
|
+
.h-catalog-header h2 { font-size: 28px; font-weight: 700; letter-spacing: 8px; color: var(--ink); margin-bottom: 8px; }
|
|
345
|
+
.h-catalog-header .h-line { width: 60px; height: 2px; background: var(--vermillion); margin: 16px auto; }
|
|
346
|
+
.h-catalog-header p { font-size: 14px; color: var(--ink-faint); font-family: var(--sans); letter-spacing: 2px; }
|
|
347
|
+
.h-filter { display: flex; justify-content: center; margin-bottom: 40px; }
|
|
348
|
+
.h-search {
|
|
349
|
+
padding: 10px 20px; border: 1px solid var(--border);
|
|
350
|
+
border-radius: 2px; background: var(--surface);
|
|
351
|
+
font-family: var(--sans); font-size: 14px;
|
|
352
|
+
color: var(--ink); width: 320px; outline: none;
|
|
353
|
+
}
|
|
354
|
+
.h-search:focus { border-color: var(--gold); }
|
|
355
|
+
.h-search::placeholder { color: var(--ink-faint); }
|
|
356
|
+
.h-grid {
|
|
357
|
+
display: grid;
|
|
358
|
+
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
|
|
359
|
+
gap: 16px;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
@media (max-width: 768px) {
|
|
363
|
+
.h-stats { gap: 24px; }
|
|
364
|
+
.h-stat-num { font-size: 28px; }
|
|
365
|
+
.h-catalog { padding: 40px 20px; }
|
|
366
|
+
.h-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
|
|
367
|
+
.h-search { width: 100%; }
|
|
368
|
+
.v-page { padding: 0 16px; }
|
|
369
|
+
.v-cards-col {
|
|
370
|
+
padding: 16px 8px;
|
|
371
|
+
gap: 10px;
|
|
372
|
+
}
|
|
373
|
+
.v-search { height: 160px; }
|
|
374
|
+
}
|
|
375
|
+
</style>
|