@arraypress/waveform-sounds 2.0.0 → 2.1.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 (75) hide show
  1. package/README.md +24 -2
  2. package/dist/waveform-sounds-no-autoinit.esm.js +495 -90
  3. package/dist/waveform-sounds-render.esm.js +55 -5
  4. package/dist/waveform-sounds.css +88 -17
  5. package/dist/waveform-sounds.esm.js +498 -92
  6. package/dist/waveform-sounds.js +494 -92
  7. package/dist/waveform-sounds.min.css +1 -1
  8. package/dist/waveform-sounds.min.js +3 -3
  9. package/package.json +1 -1
  10. package/src/css/waveform-sounds.css +88 -17
  11. package/src/js/core/WaveformSounds.ts +350 -87
  12. package/src/js/core/element.ts +208 -0
  13. package/src/js/core/engine.ts +9 -3
  14. package/src/js/core/options.ts +0 -5
  15. package/src/js/data/bpm.ts +14 -4
  16. package/src/js/data/navigation.ts +16 -3
  17. package/src/js/data/sounds.ts +44 -14
  18. package/src/js/data/url-state.ts +33 -10
  19. package/src/js/dom/colors.ts +28 -1
  20. package/src/js/dom/draw.ts +0 -1
  21. package/src/js/dom/menus.ts +0 -2
  22. package/src/js/dom/rows.ts +0 -3
  23. package/src/js/entry.ts +13 -3
  24. package/src/js/index.ts +7 -3
  25. package/src/js/render/html.ts +0 -2
  26. package/src/js/render/icons.ts +0 -1
  27. package/src/js/render/markup.ts +41 -13
  28. package/src/js/render/options.ts +26 -4
  29. package/src/js/render/strings.ts +4 -3
  30. package/src/js/render-entry.ts +1 -1
  31. package/src/js/shared/utils.ts +4 -4
  32. package/src/js/types.ts +30 -3
  33. package/types/core/WaveformSounds.d.ts +40 -10
  34. package/types/core/WaveformSounds.d.ts.map +1 -1
  35. package/types/core/element.d.ts +84 -0
  36. package/types/core/element.d.ts.map +1 -0
  37. package/types/core/engine.d.ts +8 -3
  38. package/types/core/engine.d.ts.map +1 -1
  39. package/types/core/options.d.ts +0 -5
  40. package/types/core/options.d.ts.map +1 -1
  41. package/types/data/bpm.d.ts +17 -4
  42. package/types/data/bpm.d.ts.map +1 -1
  43. package/types/data/navigation.d.ts +11 -2
  44. package/types/data/navigation.d.ts.map +1 -1
  45. package/types/data/sounds.d.ts +13 -12
  46. package/types/data/sounds.d.ts.map +1 -1
  47. package/types/data/url-state.d.ts +32 -6
  48. package/types/data/url-state.d.ts.map +1 -1
  49. package/types/dom/colors.d.ts +13 -0
  50. package/types/dom/colors.d.ts.map +1 -1
  51. package/types/dom/draw.d.ts +0 -1
  52. package/types/dom/draw.d.ts.map +1 -1
  53. package/types/dom/menus.d.ts +0 -2
  54. package/types/dom/menus.d.ts.map +1 -1
  55. package/types/dom/rows.d.ts +0 -3
  56. package/types/dom/rows.d.ts.map +1 -1
  57. package/types/entry.d.ts +10 -4
  58. package/types/entry.d.ts.map +1 -1
  59. package/types/index.d.ts +2 -2
  60. package/types/index.d.ts.map +1 -1
  61. package/types/render/html.d.ts +0 -2
  62. package/types/render/html.d.ts.map +1 -1
  63. package/types/render/icons.d.ts.map +1 -1
  64. package/types/render/markup.d.ts +17 -8
  65. package/types/render/markup.d.ts.map +1 -1
  66. package/types/render/options.d.ts +17 -4
  67. package/types/render/options.d.ts.map +1 -1
  68. package/types/render/strings.d.ts +0 -3
  69. package/types/render/strings.d.ts.map +1 -1
  70. package/types/render-entry.d.ts +1 -1
  71. package/types/render-entry.d.ts.map +1 -1
  72. package/types/shared/utils.d.ts +3 -3
  73. package/types/shared/utils.d.ts.map +1 -1
  74. package/types/types.d.ts +29 -3
  75. package/types/types.d.ts.map +1 -1
package/README.md CHANGED
@@ -29,6 +29,18 @@ import '@arraypress/waveform-sounds/styles.css';
29
29
  <div data-waveform-sounds data-manifest="/sounds.json"></div>
30
30
  ```
31
31
 
32
+ Or as a custom element — every `data-*` option works as an attribute,
33
+ with or without the prefix, and server-rendered markup inside it is
34
+ adopted:
35
+
36
+ ```html
37
+ <waveform-sounds manifest="/sounds.json" page-size="20"></waveform-sounds>
38
+ ```
39
+
40
+ The default import registers it; with `/no-autoinit` (or
41
+ `data-waveform-autoinit="false"`), call `defineWaveformSoundsElement()` —
42
+ `WaveformSounds.defineElement()` from a `<script>` page.
43
+
32
44
  Generate the manifest from a folder of previews (BPM and key are read from
33
45
  file names like `Bass_Loop_04_128_Fmin.wav`; the type is the sub-folder).
34
46
  `--base-url` is the public URL the folder is served at:
@@ -129,8 +141,10 @@ before the first play.)
129
141
 
130
142
  | Key | Does |
131
143
  |---|---|
144
+ | Tab | The list is one stop: the focused (else first) row |
132
145
  | ↑ / ↓ | Move between sounds; while one plays, play the next |
133
146
  | ← / → | Seek the playing sound |
147
+ | Home / End | First / last sound; on the playing row's seek slider, its start / end |
134
148
  | Space / Enter | Play / pause |
135
149
  | `/` | Search |
136
150
 
@@ -138,10 +152,18 @@ before the first play.)
138
152
 
139
153
  ```js
140
154
  import {renderSounds} from '@arraypress/waveform-sounds/render';
141
- const html = `<div data-waveform-sounds>${renderSounds(sounds, options)}</div>`;
155
+ const html = `<div class="waveform-sounds waveform-sounds--inline" data-waveform-sounds>${renderSounds(sounds, options)}</div>`;
142
156
  ```
143
157
 
144
- The runtime adopts that markup instead of rebuilding it.
158
+ The runtime adopts that markup instead of rebuilding it. Keep the
159
+ `waveform-sounds` classes on the wrapper (`waveform-sounds--strip` for the
160
+ strip): the stylesheet hangs off them, so without them the list paints
161
+ unstyled until the script runs and then shifts. `renderSoundsElement(sounds,
162
+ options, className)` writes the whole wrapper — the classes, and a `data-*`
163
+ attribute for every render option you set, so the runtime keeps them (pass
164
+ the same options to both, or a `pageSize` the runtime doesn't know is
165
+ re-paged to 50). `pickRenderOptions(props)` picks the options that shape
166
+ the markup out of a component's props.
145
167
 
146
168
  ## Theming
147
169