@hanology/cham-browser 0.4.72 → 0.4.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import { computed } from 'vue'
|
|
3
3
|
import type { Annotation, VerseLine, PieceSource } from '../types'
|
|
4
4
|
import { buildVerseAnnotations, renderAnnotatedText, resolveHoveredAnnotations } from '../composables/useAnnotationRenderer'
|
|
5
|
+
import { parseAnnotationBlock } from '../utils/annotationParser'
|
|
6
|
+
import PronunciationGroup from './PronunciationGroup.vue'
|
|
5
7
|
|
|
6
8
|
const props = defineProps<{
|
|
7
9
|
num: number
|
|
@@ -54,6 +56,10 @@ const sourceLabel = (() => {
|
|
|
54
56
|
const r = props.source?.range as Record<string, string> | undefined
|
|
55
57
|
return r?.chapter || ''
|
|
56
58
|
})()
|
|
59
|
+
|
|
60
|
+
const annotationEntries = computed(() =>
|
|
61
|
+
props.annotationText ? parseAnnotationBlock(props.annotationText) : []
|
|
62
|
+
)
|
|
57
63
|
</script>
|
|
58
64
|
|
|
59
65
|
<template>
|
|
@@ -69,7 +75,22 @@ const sourceLabel = (() => {
|
|
|
69
75
|
v-html="verseHtml(i)"
|
|
70
76
|
/>
|
|
71
77
|
</div>
|
|
72
|
-
<div v-if="annotationText" class="part-annotations">
|
|
78
|
+
<div v-if="annotationText && annotationEntries.length > 0" class="part-annotations">
|
|
79
|
+
<div v-for="entry in annotationEntries" :key="entry.num" class="part-ann-entry">
|
|
80
|
+
<div class="part-ann-head">
|
|
81
|
+
<span class="part-ann-num">{{ entry.numDisplay }}</span>
|
|
82
|
+
<span class="part-ann-term">{{ entry.term }}</span>
|
|
83
|
+
<PronunciationGroup
|
|
84
|
+
v-for="seg in entry.pronSegments"
|
|
85
|
+
:key="seg.lang"
|
|
86
|
+
:segment="seg"
|
|
87
|
+
class="part-ann-pron"
|
|
88
|
+
/>
|
|
89
|
+
</div>
|
|
90
|
+
<div v-if="entry.definition" class="part-ann-def">{{ entry.definition }}</div>
|
|
91
|
+
</div>
|
|
92
|
+
</div>
|
|
93
|
+
<div v-else-if="annotationText" class="part-annotations">
|
|
73
94
|
<div v-for="line in annotationText.split('\n')" :key="line" class="part-ann-line">{{ line }}</div>
|
|
74
95
|
</div>
|
|
75
96
|
</div>
|
|
@@ -114,6 +135,59 @@ const sourceLabel = (() => {
|
|
|
114
135
|
margin-top: 16px;
|
|
115
136
|
padding-top: 12px;
|
|
116
137
|
border-top: 1px dashed var(--border-light);
|
|
138
|
+
text-align: start;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.part-ann-entry {
|
|
142
|
+
padding: 12px 0;
|
|
143
|
+
border-bottom: 1px solid var(--border-light);
|
|
144
|
+
}
|
|
145
|
+
.part-ann-entry:last-child {
|
|
146
|
+
border-bottom: none;
|
|
147
|
+
padding-bottom: 0;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.part-ann-head {
|
|
151
|
+
display: flex;
|
|
152
|
+
flex-wrap: wrap;
|
|
153
|
+
align-items: baseline;
|
|
154
|
+
gap: 6px 10px;
|
|
155
|
+
margin-bottom: 4px;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.part-ann-num {
|
|
159
|
+
display: inline-flex;
|
|
160
|
+
align-items: center;
|
|
161
|
+
justify-content: center;
|
|
162
|
+
width: 22px;
|
|
163
|
+
height: 22px;
|
|
164
|
+
border-radius: 4px;
|
|
165
|
+
background: var(--vermillion);
|
|
166
|
+
color: var(--paper);
|
|
167
|
+
font-family: var(--sans);
|
|
168
|
+
font-size: 12px;
|
|
169
|
+
font-weight: 700;
|
|
170
|
+
flex-shrink: 0;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.part-ann-term {
|
|
174
|
+
font-weight: 700;
|
|
175
|
+
font-size: 1.05em;
|
|
176
|
+
color: var(--ink);
|
|
177
|
+
padding: 2px 8px;
|
|
178
|
+
background: var(--surface-warm);
|
|
179
|
+
border-radius: 3px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.part-ann-pron {
|
|
183
|
+
margin-left: 2px;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.part-ann-def {
|
|
187
|
+
color: var(--ink-mid);
|
|
188
|
+
line-height: 2;
|
|
189
|
+
white-space: pre-line;
|
|
190
|
+
padding-left: 32px;
|
|
117
191
|
}
|
|
118
192
|
|
|
119
193
|
.part-ann-line {
|
|
@@ -188,4 +262,36 @@ const sourceLabel = (() => {
|
|
|
188
262
|
border-top: none;
|
|
189
263
|
border-left: 1px dashed var(--border-light);
|
|
190
264
|
}
|
|
265
|
+
|
|
266
|
+
.part-block--vertical .part-ann-entry {
|
|
267
|
+
margin-bottom: 0;
|
|
268
|
+
margin-left: 16px;
|
|
269
|
+
padding: 0;
|
|
270
|
+
border-bottom: none;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.part-block--vertical .part-ann-head {
|
|
274
|
+
align-items: flex-start;
|
|
275
|
+
gap: 4px;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.part-block--vertical .part-ann-num {
|
|
279
|
+
width: auto;
|
|
280
|
+
height: auto;
|
|
281
|
+
border-radius: 0;
|
|
282
|
+
background: none;
|
|
283
|
+
color: var(--vermillion);
|
|
284
|
+
font-size: inherit;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.part-block--vertical .part-ann-term {
|
|
288
|
+
background: none;
|
|
289
|
+
padding: 0;
|
|
290
|
+
font-size: inherit;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.part-block--vertical .part-ann-def {
|
|
294
|
+
padding-left: 0;
|
|
295
|
+
margin-left: 12px;
|
|
296
|
+
}
|
|
191
297
|
</style>
|