@pie-players/pie-tool-tts-inline 0.3.53 → 0.3.55
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 +18 -8
- package/dist/tool-tts-inline.js +805 -769
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -100,6 +100,7 @@ toolCoordinator.showTool('tts-passage-1');
|
|
|
100
100
|
- `ttsService` - ITTSService instance (required)
|
|
101
101
|
- `coordinator` - IToolCoordinator instance (optional, for visibility management)
|
|
102
102
|
- `speedOptions` - Optional speed options controlling inline speed button rendering
|
|
103
|
+
- `showSingleSpeedOption` - Optional boolean to show a one-option speed group (hidden by default)
|
|
103
104
|
|
|
104
105
|
### `speedOptions` Configuration
|
|
105
106
|
|
|
@@ -109,7 +110,7 @@ provider settings.
|
|
|
109
110
|
|
|
110
111
|
```javascript
|
|
111
112
|
const ttsButton = document.createElement("pie-tool-tts-inline");
|
|
112
|
-
ttsButton.speedOptions = [2, 1.25, 1.5]; //
|
|
113
|
+
ttsButton.speedOptions = [2, 1.25, 1.5]; // host options keep this order; Normal is added if omitted
|
|
113
114
|
```
|
|
114
115
|
|
|
115
116
|
For hosts that need semantic button copy, pass object-form options. `rate`
|
|
@@ -119,22 +120,28 @@ accessible text.
|
|
|
119
120
|
```javascript
|
|
120
121
|
ttsButton.speedOptions = [
|
|
121
122
|
{ rate: 0.8, label: "Slow", ariaLabel: "Slow speed" },
|
|
123
|
+
{ rate: 1, label: "Normal", ariaLabel: "Normal speed", default: true },
|
|
122
124
|
{ rate: 1.5, label: "Fast", ariaLabel: "Fast speed" }
|
|
123
125
|
];
|
|
124
126
|
```
|
|
125
127
|
|
|
126
128
|
Semantics:
|
|
127
129
|
|
|
128
|
-
- Omitted or non-array: defaults to `
|
|
129
|
-
- Explicit `[]`: no speed
|
|
130
|
-
- Invalid-only values: fall back to `
|
|
130
|
+
- Omitted or non-array: defaults to visible `Slow`, `Normal`, and `Fast` choices, with `Normal` selected.
|
|
131
|
+
- Explicit `[]`: no speed choices rendered; playback speed is reset to `1.0`.
|
|
132
|
+
- Invalid-only values: fall back to the visible `Slow`, `Normal`, and `Fast` choices.
|
|
131
133
|
- Numeric values and object `rate` values are deduplicated while preserving
|
|
132
134
|
first-seen order.
|
|
133
135
|
- Numeric options render as `{rate}x` with accessible names like
|
|
134
136
|
`Speed {rate}x`.
|
|
135
137
|
- Object options can customize labels; missing labels fall back to `{rate}x`,
|
|
136
138
|
and missing `ariaLabel` values fall back to matching names like `Fast speed`.
|
|
137
|
-
- `1`
|
|
139
|
+
- `1` renders as the visible `Normal` choice. If a non-empty config omits `1`,
|
|
140
|
+
the component adds `Normal` at the natural point in the speed scale while
|
|
141
|
+
preserving host-provided option order.
|
|
142
|
+
- One speed is always selected. Clicking the selected speed is a no-op.
|
|
143
|
+
- One-option speed groups are hidden by default; set `showSingleSpeedOption` to
|
|
144
|
+
`true` to surface a single current speed.
|
|
138
145
|
|
|
139
146
|
## Behavior
|
|
140
147
|
|
|
@@ -153,9 +160,12 @@ Semantics:
|
|
|
153
160
|
- Fast-forward/Rewind invoke sentence-jump seek on `ITTSService`
|
|
154
161
|
- Speed buttons call `ttsService.setPlaybackRate(rate)` when available,
|
|
155
162
|
otherwise `ttsService.updateSettings({ rate })`
|
|
156
|
-
-
|
|
157
|
-
|
|
158
|
-
-
|
|
163
|
+
- Speed choices render as a named `Playback speed` radio group with
|
|
164
|
+
`aria-checked` state
|
|
165
|
+
- Selecting another speed switches the active radio to that option
|
|
166
|
+
- Clicking the currently active speed leaves the selection unchanged
|
|
167
|
+
- If `speedOptions` is `[]`, speed controls are omitted and playback rate is
|
|
168
|
+
reset to `1x` while rewind/forward/stop still render
|
|
159
169
|
6. **Keyboard Interaction**: Arrow keys move between controls; Tab enters/leaves the toolbar
|
|
160
170
|
7. **Cleanup**: Unregisters from coordinator on unmount
|
|
161
171
|
|