@pie-players/pie-tool-annotation-toolbar 0.1.8 → 0.1.9

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/README.md CHANGED
@@ -8,9 +8,6 @@ A text selection toolbar for highlighting and annotating text in the PIEoneer as
8
8
  - **Underline Annotation**: Underline selected text
9
9
  - **Persistent Annotations**: Saved to sessionStorage and restored on page load
10
10
  - **Clear Annotations**: Remove annotations from selected text or clear all
11
- - **Dictionary Lookup**: Look up selected words in dictionary
12
- - **Translation**: Translate selected text
13
- - **Picture Dictionary**: Visual dictionary for selected words
14
11
  - **Text-to-Speech (Read Aloud)**: Read selected text aloud with word-level highlighting
15
12
  - **Modern CSS Custom Highlight API**:
16
13
  - Zero DOM mutation (no `<span>` wrappers)
@@ -43,14 +40,7 @@ This component doesn't take props - it automatically shows when text is selected
43
40
 
44
41
  ## Events
45
42
 
46
- - `dictionarylookup`: Dispatched when dictionary button is clicked
47
- - `detail: { text: string }` - The selected text
48
- - `translationrequest`: Dispatched when translation button is clicked
49
- - `detail: { text: string }` - The selected text
50
- - `picturedictionarylookup`: Dispatched when picture dictionary button is clicked
51
- - `detail: { text: string }` - The selected text
52
-
53
- **Note**: Text-to-Speech (Read Aloud) button does not emit an event - it directly uses the TTS service to read the selected text.
43
+ Text-to-Speech (Read Aloud) button does not emit an event - it directly uses the TTS service to read the selected text.
54
44
 
55
45
  ## Architecture
56
46
 
@@ -63,6 +53,7 @@ The annotation toolbar integrates with PIE's shared highlight infrastructure:
63
53
  ### Browser Support
64
54
 
65
55
  Requires CSS Custom Highlight API support:
56
+
66
57
  - Chrome/Edge 105+
67
58
  - Safari 17.2+
68
59
  - Firefox 128+
@@ -74,6 +65,7 @@ For unsupported browsers, the component gracefully degrades (no highlights shown
74
65
  Annotations are automatically saved to `sessionStorage` and restored on page load. The storage key includes the current URL path to scope annotations to specific content.
75
66
 
76
67
  Storage format:
68
+
77
69
  ```typescript
78
70
  {
79
71
  "annotation-highlight-yellow-1234567890": {
@@ -87,6 +79,7 @@ Storage format:
87
79
  ```
88
80
 
89
81
  Annotations are automatically cleared when:
82
+
90
83
  - User explicitly clicks "Clear" button
91
84
  - User navigates to different content
92
85
  - sessionStorage is cleared
@@ -98,7 +91,7 @@ The annotation toolbar includes a "Read" button that uses the TTS service to rea
98
91
  ### How It Works
99
92
 
100
93
  1. **User selects text** in the assessment content
101
- 2. **Annotation toolbar appears** with highlight, dictionary, translate, and read buttons
94
+ 2. **Annotation toolbar appears** with highlight and read buttons
102
95
  3. **User clicks "Read"** button (speaker icon)
103
96
  4. **TTS service speaks the selected text** using Web Speech API
104
97
  5. **Words are highlighted** in sync with speech using CSS Custom Highlight API
@@ -119,6 +112,7 @@ await ttsService.speakRange(selectedRange, {
119
112
  ```
120
113
 
121
114
  **Why this matters:**
115
+
122
116
  - User selects text in the middle of a paragraph
123
117
  - `speak(text)` would highlight from the beginning of the container (wrong)
124
118
  - `speakRange(range)` highlights the exact selected text (correct)
@@ -130,7 +124,7 @@ await ttsService.speakRange(selectedRange, {
130
124
  - **TTS stops automatically** when toolbar is hidden (user clicks away)
131
125
  - **No conflicts** with annotation highlights (different highlight layers)
132
126
 
133
- ### Browser Support
127
+ ### TTS Browser Support
134
128
 
135
129
  - **TTS (Web Speech API)**: 97%+ browser support
136
130
  - **Word Highlighting**: 85-90% browser support (CSS Custom Highlight API)