@hanology/cham-browser 0.4.11 → 0.4.13

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanology/cham-browser",
3
- "version": "0.4.11",
3
+ "version": "0.4.13",
4
4
  "description": "CHAM — browser-compatible parser, serializer, and site generator for Classical Han Annotated Markdown",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import { computed } from 'vue'
2
3
  import type { AnnotationLayer } from '../types'
3
4
 
4
5
  const props = defineProps<{
@@ -13,7 +14,12 @@ const emit = defineEmits<{
13
14
  'update:annotationsVisible': [visible: boolean]
14
15
  }>()
15
16
 
16
- const hasLayers = () => props.layers.length > 1
17
+ // Only named layers (skip 'default' base annotations are always shown)
18
+ const toggleableLayers = computed(() =>
19
+ props.layers.filter(l => l.id !== 'default')
20
+ )
21
+
22
+ const hasLayers = () => toggleableLayers.value.length > 0
17
23
 
18
24
  function toggleAnnotations() {
19
25
  if (props.annotationsVisible) {
@@ -21,7 +27,7 @@ function toggleAnnotations() {
21
27
  if (hasLayers()) emit('update:activeIds', [])
22
28
  } else {
23
29
  emit('update:annotationsVisible', true)
24
- if (hasLayers()) emit('update:activeIds', props.layers.map(l => l.id))
30
+ if (hasLayers()) emit('update:activeIds', toggleableLayers.value.map(l => l.id))
25
31
  }
26
32
  }
27
33
 
@@ -47,26 +53,25 @@ function toggleLayer(id: string) {
47
53
  @click="toggleAnnotations"
48
54
  :title="annotationsVisible ? '隱藏注釋' : '顯示注釋'"
49
55
  >注</button>
50
- <div v-if="hasLayers() && annotationsVisible" class="ann-layers">
51
- <button
52
- v-for="layer in layers"
53
- :key="layer.id"
54
- class="ann-layer-btn"
55
- :class="{ active: activeIds.includes(layer.id) }"
56
- @click="toggleLayer(layer.id)"
57
- :title="layer.label"
58
- >{{ layer.shortLabel }}</button>
59
- </div>
56
+ <button
57
+ v-for="layer in toggleableLayers"
58
+ :key="layer.id"
59
+ v-show="annotationsVisible"
60
+ class="ann-layer-btn"
61
+ :class="{ active: activeIds.includes(layer.id) }"
62
+ @click="toggleLayer(layer.id)"
63
+ :title="layer.label"
64
+ >{{ layer.shortLabel }}</button>
60
65
  </div>
61
66
  </template>
62
67
 
63
68
  <style scoped>
64
69
  .ann-bar {
70
+ writing-mode: horizontal-tb;
65
71
  display: flex;
66
72
  flex-direction: column;
67
73
  gap: 6px;
68
- align-items: flex-start;
69
- width: fit-content;
74
+ align-items: center;
70
75
  }
71
76
 
72
77
  .ann-toggle {
@@ -82,9 +87,6 @@ function toggleLayer(id: string) {
82
87
  letter-spacing: 0;
83
88
  cursor: pointer;
84
89
  transition: all 0.2s;
85
- display: flex;
86
- align-items: center;
87
- justify-content: center;
88
90
  }
89
91
 
90
92
  .ann-toggle:hover {
@@ -100,15 +102,9 @@ function toggleLayer(id: string) {
100
102
  color: #fff;
101
103
  }
102
104
 
103
- .ann-layers {
104
- display: flex;
105
- flex-direction: column;
106
- gap: 4px;
107
- align-items: flex-start;
108
- }
109
-
110
105
  .ann-layer-btn {
111
- padding: 5px 10px;
106
+ width: 36px;
107
+ padding: 5px 0;
112
108
  border: 1px solid var(--border);
113
109
  border-radius: 4px;
114
110
  background: none;
@@ -119,6 +115,7 @@ function toggleLayer(id: string) {
119
115
  cursor: pointer;
120
116
  transition: all 0.15s;
121
117
  white-space: nowrap;
118
+ text-align: center;
122
119
  }
123
120
 
124
121
  .ann-layer-btn:hover {
@@ -143,7 +140,7 @@ function toggleLayer(id: string) {
143
140
  font-size: 17px;
144
141
  }
145
142
  .ann-layer-btn {
146
- padding: 6px 12px;
143
+ width: 40px;
147
144
  font-size: 12px;
148
145
  }
149
146
  }
@@ -778,16 +778,13 @@ function tcy(n: number): string {
778
778
  .v-nav-btn {
779
779
  writing-mode: vertical-rl;
780
780
  text-orientation: mixed;
781
- display: flex;
782
- flex-direction: row;
783
- align-items: center;
784
- gap: 8px;
785
- padding: 16px 8px;
781
+ padding: 20px 12px;
786
782
  background: var(--surface);
787
783
  border: 1px solid var(--border-light);
788
784
  border-radius: 6px;
789
785
  cursor: pointer;
790
786
  transition: all 0.2s;
787
+ line-height: 1.6;
791
788
  }
792
789
  .v-nav-btn:hover {
793
790
  border-color: var(--gold);
@@ -795,10 +792,12 @@ function tcy(n: number): string {
795
792
  }
796
793
  .v-nav-dir {
797
794
  font-size: 16px; color: var(--vermillion);
795
+ margin-bottom: 0.5em;
798
796
  }
799
797
  .v-nav-label {
800
798
  font-size: 11px; color: var(--ink-faint);
801
799
  font-family: var(--sans); letter-spacing: 2px;
800
+ margin-bottom: 0.5em;
802
801
  }
803
802
  .v-nav-title {
804
803
  font-size: 18px; font-weight: 700;