@arraypress/waveform-sounds 2.1.0 → 2.2.0

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.
Files changed (51) hide show
  1. package/README.md +21 -1
  2. package/dist/waveform-sounds-no-autoinit.esm.js +445 -144
  3. package/dist/waveform-sounds-render.esm.js +220 -78
  4. package/dist/waveform-sounds.css +4 -0
  5. package/dist/waveform-sounds.esm.js +445 -144
  6. package/dist/waveform-sounds.js +445 -144
  7. package/dist/waveform-sounds.min.css +1 -1
  8. package/dist/waveform-sounds.min.js +1 -1
  9. package/package.json +1 -1
  10. package/src/css/waveform-sounds.css +4 -0
  11. package/src/js/core/WaveformSounds.ts +224 -67
  12. package/src/js/core/element.ts +1 -1
  13. package/src/js/core/options.ts +1 -0
  14. package/src/js/data/keys.ts +156 -0
  15. package/src/js/data/navigation.ts +35 -8
  16. package/src/js/data/sounds.ts +29 -22
  17. package/src/js/data/url-state.ts +7 -3
  18. package/src/js/dom/draw.ts +16 -2
  19. package/src/js/dom/menus.ts +2 -1
  20. package/src/js/dom/rows.ts +38 -12
  21. package/src/js/render/icons.ts +59 -16
  22. package/src/js/render/markup.ts +115 -49
  23. package/src/js/render/options.ts +3 -1
  24. package/src/js/render/strings.ts +53 -1
  25. package/src/js/types.ts +24 -0
  26. package/types/core/WaveformSounds.d.ts +3 -3
  27. package/types/core/WaveformSounds.d.ts.map +1 -1
  28. package/types/core/options.d.ts.map +1 -1
  29. package/types/data/keys.d.ts +88 -0
  30. package/types/data/keys.d.ts.map +1 -0
  31. package/types/data/navigation.d.ts +27 -9
  32. package/types/data/navigation.d.ts.map +1 -1
  33. package/types/data/sounds.d.ts +20 -5
  34. package/types/data/sounds.d.ts.map +1 -1
  35. package/types/data/url-state.d.ts +6 -1
  36. package/types/data/url-state.d.ts.map +1 -1
  37. package/types/dom/draw.d.ts +5 -2
  38. package/types/dom/draw.d.ts.map +1 -1
  39. package/types/dom/menus.d.ts.map +1 -1
  40. package/types/dom/rows.d.ts +19 -8
  41. package/types/dom/rows.d.ts.map +1 -1
  42. package/types/render/icons.d.ts +41 -3
  43. package/types/render/icons.d.ts.map +1 -1
  44. package/types/render/markup.d.ts +27 -4
  45. package/types/render/markup.d.ts.map +1 -1
  46. package/types/render/options.d.ts +1 -1
  47. package/types/render/options.d.ts.map +1 -1
  48. package/types/render/strings.d.ts +22 -1
  49. package/types/render/strings.d.ts.map +1 -1
  50. package/types/types.d.ts +24 -0
  51. package/types/types.d.ts.map +1 -1
package/README.md CHANGED
@@ -56,6 +56,7 @@ npx @arraypress/waveform-gen ./public/previews/ --recursive \
56
56
 
57
57
  `player` (`'inline'` | `'strip'`), `search`, `filters`, `sorts`,
58
58
  `loopToggle`, `showCount`, `pageSize` (50), `maxTypeChips` (10), `menuSearch` (8), `columns`,
59
+ `mergeEnharmonicKeys` (true),
59
60
  `waveformStyle`, `waveformColor`, `progressColor`, `barWidth`, `barGap`,
60
61
  `loop`, `autoAdvance`, `arrowAudition`, `playerOptions`, `strings`, and the
61
62
  callbacks `onReady` / `onPlay` / `onPause` / `onEnd` / `onFilter` / `onError`.
@@ -102,6 +103,17 @@ A list that marks nothing works as before.
102
103
  `waveform-gen --manifest` sets `loop: true` for files whose folder or name
103
104
  contains the word "loop".
104
105
 
106
+ ## Keys
107
+
108
+ Enharmonic keys are one key: a pack that writes both A#m and Bbm (or C#
109
+ and Db) gets one key-menu entry, a filter on either spelling finds both,
110
+ and `?key=` accepts either. The entry shows the spelling the pack uses
111
+ most; a tie goes to the conventional one (the key signature with the
112
+ fewest accidentals — Db, Eb, F#, Ab, Bb, B major; C#m, Ebm, F#m, G#m, Bbm
113
+ minor). Each row still shows its own key as written.
114
+ `mergeEnharmonicKeys: false` (`data-merge-enharmonic-keys="false"`) keeps
115
+ every spelling apart.
116
+
105
117
  ## Download links
106
118
 
107
119
  Optional, per sound — a free sample, the `.mid` of a MIDI preview. Rows
@@ -148,6 +160,11 @@ before the first play.)
148
160
  | Space / Enter | Play / pause |
149
161
  | `/` | Search |
150
162
 
163
+ For a screen reader each row reads as a sentence ("Bass loops, 130 BPM,
164
+ key B minor, 0:07") that also describes its play button, and only the
165
+ playing (or paused) sound's waveform is a seek slider. The words are
166
+ `strings` (`rowBpm`, `rowKey`, `keyMinor`, `noteSharp`, …).
167
+
151
168
  ## Server rendering
152
169
 
153
170
  ```js
@@ -155,7 +172,10 @@ import {renderSounds} from '@arraypress/waveform-sounds/render';
155
172
  const html = `<div class="waveform-sounds waveform-sounds--inline" data-waveform-sounds>${renderSounds(sounds, options)}</div>`;
156
173
  ```
157
174
 
158
- The runtime adopts that markup instead of rebuilding it. Keep the
175
+ The runtime adopts that markup instead of rebuilding it. It holds the
176
+ rows the list starts with (the first page; with `pageSize: 0` the first
177
+ 50) and every sound once as JSON; the runtime renders the other rows as
178
+ they are revealed (Show more, a filter, scrolling, ↓). Keep the
159
179
  `waveform-sounds` classes on the wrapper (`waveform-sounds--strip` for the
160
180
  strip): the stylesheet hangs off them, so without them the list paints
161
181
  unstyled until the script runs and then shifts. `renderSoundsElement(sounds,