@hanology/cham-browser 0.3.8 → 0.4.1
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.js +158 -29
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
- package/template/index.html +4 -8
- package/template/src/App.vue +101 -17
- package/template/src/components/AnnotationControlBar.vue +119 -49
- package/template/src/components/AnnotationTooltip.vue +278 -99
- package/template/src/components/BackToTop.vue +4 -0
- package/template/src/components/BookCard.vue +10 -11
- package/template/src/components/HorizontalDisplay.vue +52 -0
- package/template/src/components/PoemCard.vue +1 -0
- package/template/src/components/PronunciationGroup.vue +27 -18
- package/template/src/components/ReadingToolbar.vue +20 -0
- package/template/src/components/SectionBlock.vue +91 -12
- package/template/src/components/SideNav.vue +5 -4
- package/template/src/components/VerticalScroll.vue +30 -0
- package/template/src/composables/useData.ts +6 -1
- package/template/src/composables/useI18n.ts +33 -0
- package/template/src/composables/useReadingMode.ts +9 -4
- package/template/src/composables/useSiteConfig.ts +27 -6
- package/template/src/router.ts +0 -2
- package/template/src/styles/main.css +88 -0
- package/template/src/types.ts +8 -0
- package/template/src/views/BookHome.vue +45 -21
- package/template/src/views/LibraryHome.vue +39 -41
- package/template/src/views/PieceView.vue +434 -71
- package/template/src/views/AboutView.vue +0 -191
|
@@ -5,6 +5,7 @@ const props = defineProps<{
|
|
|
5
5
|
layers: AnnotationLayer[]
|
|
6
6
|
hasAnnotations: boolean
|
|
7
7
|
activeIds: string[]
|
|
8
|
+
annotationsVisible: boolean
|
|
8
9
|
}>()
|
|
9
10
|
|
|
10
11
|
const emit = defineEmits<{
|
|
@@ -12,16 +13,15 @@ const emit = defineEmits<{
|
|
|
12
13
|
'update:annotationsVisible': [visible: boolean]
|
|
13
14
|
}>()
|
|
14
15
|
|
|
15
|
-
const
|
|
16
|
-
const noneIds = () => [] as string[]
|
|
16
|
+
const hasLayers = () => props.layers.length > 1
|
|
17
17
|
|
|
18
18
|
function toggleAnnotations() {
|
|
19
|
-
if (props.
|
|
20
|
-
emit('update:activeIds', noneIds())
|
|
19
|
+
if (props.annotationsVisible) {
|
|
21
20
|
emit('update:annotationsVisible', false)
|
|
21
|
+
if (hasLayers()) emit('update:activeIds', [])
|
|
22
22
|
} else {
|
|
23
|
-
emit('update:activeIds', allIds())
|
|
24
23
|
emit('update:annotationsVisible', true)
|
|
24
|
+
if (hasLayers()) emit('update:activeIds', props.layers.map(l => l.id))
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -40,85 +40,155 @@ function toggleLayer(id: string) {
|
|
|
40
40
|
</script>
|
|
41
41
|
|
|
42
42
|
<template>
|
|
43
|
-
<div v-if="hasAnnotations" class="ann-
|
|
43
|
+
<div v-if="hasAnnotations" class="ann-bar">
|
|
44
44
|
<button
|
|
45
|
-
class="ann-
|
|
46
|
-
:class="{ active:
|
|
45
|
+
class="ann-master"
|
|
46
|
+
:class="{ active: annotationsVisible }"
|
|
47
47
|
@click="toggleAnnotations"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<span class="ann-
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
48
|
+
>
|
|
49
|
+
<span class="ann-master-icon">{{ annotationsVisible ? '✓' : '注' }}</span>
|
|
50
|
+
<span class="ann-master-text">{{ annotationsVisible ? '注釋' : '顯示注釋' }}</span>
|
|
51
|
+
<span v-if="hasLayers() && annotationsVisible" class="ann-count">{{ activeIds.length }}/{{ layers.length }}</span>
|
|
52
|
+
</button>
|
|
53
|
+
<template v-if="hasLayers() && annotationsVisible">
|
|
54
|
+
<div class="ann-chips">
|
|
55
|
+
<button
|
|
56
|
+
v-for="layer in layers"
|
|
57
|
+
:key="layer.id"
|
|
58
|
+
:class="['ann-chip', { active: activeIds.includes(layer.id) }]"
|
|
59
|
+
:title="layer.label"
|
|
60
|
+
@click="toggleLayer(layer.id)"
|
|
61
|
+
>
|
|
62
|
+
<span class="ann-chip-check">{{ activeIds.includes(layer.id) ? '✓' : '' }}</span>
|
|
63
|
+
{{ layer.shortLabel }}
|
|
64
|
+
</button>
|
|
65
|
+
</div>
|
|
60
66
|
</template>
|
|
61
67
|
</div>
|
|
62
68
|
</template>
|
|
63
69
|
|
|
64
70
|
<style scoped>
|
|
65
|
-
.ann-
|
|
71
|
+
.ann-bar {
|
|
66
72
|
display: flex;
|
|
67
|
-
|
|
68
|
-
gap:
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
gap: 10px;
|
|
69
75
|
}
|
|
70
76
|
|
|
71
|
-
.ann-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
.ann-master {
|
|
78
|
+
display: inline-flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
gap: 8px;
|
|
81
|
+
padding: 8px 20px;
|
|
82
|
+
border: 1.5px solid var(--vermillion);
|
|
83
|
+
border-radius: 20px;
|
|
76
84
|
background: none;
|
|
77
85
|
color: var(--vermillion);
|
|
78
|
-
font-family: var(--
|
|
79
|
-
font-size:
|
|
80
|
-
font-weight:
|
|
86
|
+
font-family: var(--sans);
|
|
87
|
+
font-size: 13px;
|
|
88
|
+
font-weight: 600;
|
|
81
89
|
cursor: pointer;
|
|
82
|
-
transition: all 0.
|
|
83
|
-
letter-spacing:
|
|
90
|
+
transition: all 0.2s;
|
|
91
|
+
letter-spacing: 1px;
|
|
92
|
+
min-height: 44px;
|
|
93
|
+
align-self: flex-start;
|
|
84
94
|
}
|
|
85
95
|
|
|
86
|
-
.ann-
|
|
96
|
+
.ann-master.active {
|
|
87
97
|
background: var(--vermillion);
|
|
88
98
|
color: #fff;
|
|
89
99
|
}
|
|
90
100
|
|
|
91
|
-
.ann-
|
|
92
|
-
|
|
101
|
+
.ann-master:active {
|
|
102
|
+
transform: scale(0.97);
|
|
93
103
|
}
|
|
94
104
|
|
|
95
|
-
.ann-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
105
|
+
.ann-master:hover {
|
|
106
|
+
box-shadow: 0 2px 12px rgba(194, 58, 43, 0.15);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.ann-master-icon {
|
|
110
|
+
width: 20px;
|
|
111
|
+
height: 20px;
|
|
112
|
+
border-radius: 50%;
|
|
113
|
+
border: 1.5px solid currentColor;
|
|
114
|
+
display: flex;
|
|
115
|
+
align-items: center;
|
|
116
|
+
justify-content: center;
|
|
117
|
+
font-size: 11px;
|
|
118
|
+
flex-shrink: 0;
|
|
100
119
|
}
|
|
101
120
|
|
|
102
|
-
.ann-
|
|
121
|
+
.ann-master.active .ann-master-icon {
|
|
122
|
+
border-color: rgba(255, 255, 255, 0.5);
|
|
123
|
+
background: rgba(255, 255, 255, 0.15);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.ann-master-text {
|
|
127
|
+
white-space: nowrap;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.ann-count {
|
|
131
|
+
font-size: 11px;
|
|
132
|
+
opacity: 0.7;
|
|
133
|
+
margin-left: 2px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.ann-chips {
|
|
137
|
+
display: flex;
|
|
138
|
+
flex-wrap: wrap;
|
|
139
|
+
gap: 8px;
|
|
140
|
+
padding-left: 4px;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.ann-chip {
|
|
144
|
+
display: inline-flex;
|
|
145
|
+
align-items: center;
|
|
146
|
+
gap: 4px;
|
|
147
|
+
padding: 6px 14px;
|
|
103
148
|
border: 1px solid var(--border);
|
|
104
|
-
border-radius:
|
|
105
|
-
padding: 3px 10px;
|
|
106
|
-
font-size: 12px;
|
|
149
|
+
border-radius: 16px;
|
|
107
150
|
background: var(--surface);
|
|
108
151
|
color: var(--ink-mid);
|
|
109
|
-
cursor: pointer;
|
|
110
|
-
transition: all 0.15s;
|
|
111
152
|
font-family: var(--sans);
|
|
153
|
+
font-size: 12px;
|
|
112
154
|
letter-spacing: 1px;
|
|
155
|
+
cursor: pointer;
|
|
156
|
+
transition: all 0.2s;
|
|
157
|
+
min-height: 36px;
|
|
113
158
|
}
|
|
114
159
|
|
|
115
|
-
.ann-
|
|
160
|
+
.ann-chip:hover {
|
|
116
161
|
border-color: var(--gold);
|
|
162
|
+
color: var(--ink);
|
|
117
163
|
}
|
|
118
164
|
|
|
119
|
-
.ann-
|
|
165
|
+
.ann-chip.active {
|
|
120
166
|
background: var(--ink);
|
|
121
167
|
color: var(--paper);
|
|
122
168
|
border-color: var(--ink);
|
|
123
169
|
}
|
|
170
|
+
|
|
171
|
+
.ann-chip:active {
|
|
172
|
+
transform: scale(0.96);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.ann-chip-check {
|
|
176
|
+
font-size: 11px;
|
|
177
|
+
width: 12px;
|
|
178
|
+
text-align: center;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
@media (max-width: 768px) {
|
|
182
|
+
.ann-master {
|
|
183
|
+
padding: 10px 24px;
|
|
184
|
+
font-size: 14px;
|
|
185
|
+
}
|
|
186
|
+
.ann-chips {
|
|
187
|
+
gap: 6px;
|
|
188
|
+
}
|
|
189
|
+
.ann-chip {
|
|
190
|
+
padding: 8px 16px;
|
|
191
|
+
font-size: 13px;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
124
194
|
</style>
|