@hanology/cham-browser 0.4.81 → 0.4.83

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.81",
3
+ "version": "0.4.83",
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",
@@ -110,22 +110,24 @@ onBeforeUnmount(() => {
110
110
  @mouseenter="emit('tooltipEnter')"
111
111
  @mouseleave="emit('tooltipLeave')"
112
112
  >
113
- <div v-if="headword" class="ann-card-head" :class="dominantKind()">
114
- <div class="ann-headword">{{ headword }}</div>
115
- <div class="ann-badge-count" v-if="annotations.length > 1">{{ t('annotation.noteCount', { count: toChineseNumber(annotations.length) }) }}</div>
116
- </div>
117
- <button class="ann-card-close" @click="dismiss" :aria-label="t('action.close')">
118
- <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3"><path d="M18 6L6 18M6 6l12 12"/></svg>
119
- </button>
120
- <div class="ann-card-scroll">
121
- <div v-for="ann in annotations" :key="ann.id" class="ann-entry">
122
- <div class="ann-entry-header">
123
- <span class="ann-kind" :class="ann.kind">{{ kindLabel(ann) }}</span>
124
- </div>
125
- <div class="ann-entry-body">
126
- <span v-if="layerLabel(ann)" class="ann-layer">{{ layerLabel(ann) }}</span>
127
- <div v-if="getSegment(ann)" class="ann-pron-h"><PronunciationGroup :segment="getSegment(ann)!" /></div>
128
- <span v-if="ann.text && ann.kind !== 'pronunciation'" class="ann-text">{{ ann.text }}</span>
113
+ <div class="ann-card-inner">
114
+ <div v-if="headword" class="ann-card-head" :class="dominantKind()">
115
+ <div class="ann-headword">{{ headword }}</div>
116
+ <div class="ann-badge-count" v-if="annotations.length > 1">{{ t('annotation.noteCount', { count: toChineseNumber(annotations.length) }) }}</div>
117
+ </div>
118
+ <button class="ann-card-close" @click="dismiss" :aria-label="t('action.close')">
119
+ <svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3"><path d="M18 6L6 18M6 6l12 12"/></svg>
120
+ </button>
121
+ <div class="ann-card-scroll">
122
+ <div v-for="ann in annotations" :key="ann.id" class="ann-entry">
123
+ <div class="ann-entry-header">
124
+ <span class="ann-kind" :class="ann.kind">{{ kindLabel(ann) }}</span>
125
+ </div>
126
+ <div class="ann-entry-body">
127
+ <span v-if="layerLabel(ann)" class="ann-layer">{{ layerLabel(ann) }}</span>
128
+ <div v-if="getSegment(ann)" class="ann-pron-h"><PronunciationGroup :segment="getSegment(ann)!" /></div>
129
+ <span v-if="ann.text && ann.kind !== 'pronunciation'" class="ann-text">{{ ann.text }}</span>
130
+ </div>
129
131
  </div>
130
132
  </div>
131
133
  </div>
@@ -485,21 +487,24 @@ onBeforeUnmount(() => {
485
487
  overflow-x: auto;
486
488
  flex: 1;
487
489
  min-width: 0;
490
+ align-items: stretch;
488
491
  }
489
492
 
490
493
  .ann-card.vertical .ann-entry {
491
- flex-shrink: 0;
492
- border-bottom: none;
493
- margin: 0 3px;
494
- border-right: 1px solid var(--border-light);
495
494
  writing-mode: vertical-rl;
496
495
  text-orientation: mixed;
497
496
  display: flex;
498
497
  flex-direction: row;
499
498
  align-items: flex-start;
499
+ flex-shrink: 0;
500
+ padding: 0 6px;
501
+ margin: 0;
502
+ border-bottom: none;
503
+ border-right: 1px solid var(--border-light);
500
504
  }
501
505
 
502
506
  .ann-card.vertical .ann-entry:first-child {
507
+ padding: 0 6px;
503
508
  border-right: none;
504
509
  }
505
510
 
@@ -514,12 +519,17 @@ onBeforeUnmount(() => {
514
519
  flex-shrink: 0;
515
520
  }
516
521
 
517
- .ann-card.vertical .ann-pron-h {
518
- writing-mode: vertical-lr;
522
+ .ann-card.vertical .ann-entry-header {
523
+ gap: 4px;
524
+ margin-bottom: 4px;
519
525
  }
520
526
 
521
527
  .ann-card.vertical .ann-entry-body {
522
- padding-left: 0;
528
+ padding: 0;
529
+ }
530
+
531
+ .ann-card.vertical .ann-pron-h {
532
+ writing-mode: vertical-lr;
523
533
  }
524
534
 
525
535
  .ann-card.vertical .ann-text {
@@ -527,10 +537,6 @@ onBeforeUnmount(() => {
527
537
  line-height: 2;
528
538
  }
529
539
 
530
- .ann-card.vertical .ann-entry-header {
531
- gap: 4px;
532
- }
533
-
534
540
  .ann-card.vertical .ann-entry:last-child {
535
541
  border-right: none;
536
542
  }
@@ -139,12 +139,17 @@ export function useAnnotationTooltip() {
139
139
  const el = (event.target as HTMLElement).closest('.ann-target') as HTMLElement | null
140
140
  const rect = (el ?? event.target as HTMLElement).getBoundingClientRect()
141
141
 
142
- // Extract headword text (strip the annotation number)
142
+ // Extract headword text from all .ann-target elements sharing the same data-ann-ids
143
143
  if (el) {
144
- const clone = el.cloneNode(true) as HTMLElement
145
- const nums = clone.querySelectorAll('.ann-num, sup')
146
- nums.forEach(n => n.remove())
147
- headword.value = clone.textContent?.trim() || ''
144
+ const ids = el.getAttribute('data-ann-ids') || ''
145
+ const container = el.closest('.v-scroll-line, .v-scroll-body, .sb-text, .part-block, [class*="section"]') || el.parentElement
146
+ const allTargets = container ? container.querySelectorAll(`.ann-target[data-ann-ids="${ids}"]`) : [el]
147
+ const text = [...allTargets].map(t => {
148
+ const clone = t.cloneNode(true) as HTMLElement
149
+ clone.querySelectorAll('.ann-num, sup, rt, rp').forEach(n => n.remove())
150
+ return clone.textContent?.trim() || ''
151
+ }).join('')
152
+ headword.value = text || el.textContent?.trim() || ''
148
153
  } else {
149
154
  headword.value = ''
150
155
  }