@arraypress/waveform-sounds 0.3.1 → 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 (89) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +43 -3
  3. package/dist/waveform-sounds-no-autoinit.esm.js +607 -178
  4. package/dist/waveform-sounds-render.esm.js +79 -15
  5. package/dist/waveform-sounds.css +136 -79
  6. package/dist/waveform-sounds.esm.js +611 -181
  7. package/dist/waveform-sounds.js +608 -181
  8. package/dist/waveform-sounds.min.css +1 -1
  9. package/dist/waveform-sounds.min.js +3 -3
  10. package/package.json +36 -33
  11. package/src/css/waveform-sounds.css +136 -79
  12. package/src/js/core/WaveformSounds.ts +1366 -0
  13. package/src/js/core/element.ts +208 -0
  14. package/src/js/core/engine.ts +107 -0
  15. package/src/js/core/{options.js → options.ts} +28 -28
  16. package/src/js/data/{bpm.js → bpm.ts} +27 -17
  17. package/src/js/data/{navigation.js → navigation.ts} +31 -18
  18. package/src/js/data/{sounds.js → sounds.ts} +97 -66
  19. package/src/js/data/url-state.ts +130 -0
  20. package/src/js/dom/colors.ts +86 -0
  21. package/src/js/dom/{draw.js → draw.ts} +16 -17
  22. package/src/js/dom/{menus.js → menus.ts} +70 -55
  23. package/src/js/dom/{rows.js → rows.ts} +15 -17
  24. package/src/js/entry.ts +60 -0
  25. package/src/js/{index.js → index.ts} +7 -3
  26. package/src/js/render/{html.js → html.ts} +16 -12
  27. package/src/js/render/{icons.js → icons.ts} +3 -4
  28. package/src/js/render/{markup.js → markup.ts} +114 -64
  29. package/src/js/render/options.ts +118 -0
  30. package/src/js/render/{strings.js → strings.ts} +18 -16
  31. package/src/js/{render-entry.js → render-entry.ts} +2 -1
  32. package/src/js/shared/{utils.js → utils.ts} +24 -24
  33. package/{index.d.ts → src/js/types.ts} +40 -88
  34. package/types/core/WaveformSounds.d.ts +175 -0
  35. package/types/core/WaveformSounds.d.ts.map +1 -0
  36. package/types/core/element.d.ts +84 -0
  37. package/types/core/element.d.ts.map +1 -0
  38. package/types/core/engine.d.ts +72 -0
  39. package/types/core/engine.d.ts.map +1 -0
  40. package/types/core/options.d.ts +71 -0
  41. package/types/core/options.d.ts.map +1 -0
  42. package/types/data/bpm.d.ts +80 -0
  43. package/types/data/bpm.d.ts.map +1 -0
  44. package/types/data/navigation.d.ts +62 -0
  45. package/types/data/navigation.d.ts.map +1 -0
  46. package/types/data/sounds.d.ts +168 -0
  47. package/types/data/sounds.d.ts.map +1 -0
  48. package/types/data/url-state.d.ts +109 -0
  49. package/types/data/url-state.d.ts.map +1 -0
  50. package/types/dom/colors.d.ts +48 -0
  51. package/types/dom/colors.d.ts.map +1 -0
  52. package/types/dom/draw.d.ts +72 -0
  53. package/types/dom/draw.d.ts.map +1 -0
  54. package/types/dom/menus.d.ts +75 -0
  55. package/types/dom/menus.d.ts.map +1 -0
  56. package/types/dom/rows.d.ts +39 -0
  57. package/types/dom/rows.d.ts.map +1 -0
  58. package/types/entry.d.ts +28 -0
  59. package/types/entry.d.ts.map +1 -0
  60. package/types/index.d.ts +16 -0
  61. package/types/index.d.ts.map +1 -0
  62. package/types/render/html.d.ts +37 -0
  63. package/types/render/html.d.ts.map +1 -0
  64. package/types/render/icons.d.ts +17 -0
  65. package/types/render/icons.d.ts.map +1 -0
  66. package/types/render/markup.d.ts +141 -0
  67. package/types/render/markup.d.ts.map +1 -0
  68. package/types/render/options.d.ts +69 -0
  69. package/types/render/options.d.ts.map +1 -0
  70. package/types/render/strings.d.ts +43 -0
  71. package/types/render/strings.d.ts.map +1 -0
  72. package/types/render-entry.d.ts +8 -0
  73. package/types/render-entry.d.ts.map +1 -0
  74. package/types/shared/utils.d.ts +57 -0
  75. package/types/shared/utils.d.ts.map +1 -0
  76. package/types/types.d.ts +280 -0
  77. package/types/types.d.ts.map +1 -0
  78. package/types/vendor/arraypress-text.d.ts +250 -0
  79. package/dist/waveform-sounds-no-autoinit.cjs +0 -2159
  80. package/dist/waveform-sounds-render.cjs +0 -614
  81. package/dist/waveform-sounds.cjs +0 -2181
  82. package/no-autoinit.d.ts +0 -2
  83. package/render.d.ts +0 -5
  84. package/src/js/core/WaveformSounds.js +0 -993
  85. package/src/js/core/engine.js +0 -57
  86. package/src/js/data/url-state.js +0 -106
  87. package/src/js/dom/colors.js +0 -59
  88. package/src/js/entry.js +0 -25
  89. package/src/js/render/options.js +0 -90
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 ArrayPress
3
+ Copyright (c) 2026 ArrayPress Limited
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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:
@@ -48,7 +60,25 @@ npx @arraypress/waveform-gen ./public/previews/ --recursive \
48
60
  `loop`, `autoAdvance`, `arrowAudition`, `playerOptions`, `strings`, and the
49
61
  callbacks `onReady` / `onPlay` / `onPause` / `onEnd` / `onFilter` / `onError`.
50
62
  Every option has a `data-*` form (`data-page-size="100"`); `strings` and
51
- `playerOptions` take JSON. See `index.d.ts` for each one.
63
+ `playerOptions` take JSON. Each one is documented in the type declarations
64
+ (`WaveformSoundsOptions`).
65
+
66
+ ### The engine player (`playerOptions`)
67
+
68
+ Every sound plays through one `WaveformPlayer`, and `playerOptions` is
69
+ passed to it — its look, `preload`, `volume`, its callbacks (called after
70
+ the list's own). In the `strip` layout it is the docked player, so
71
+ `showVolume` and `showDownload` show there (the download link is the
72
+ sound's `download`, else its audio). A few options are the list's to set:
73
+
74
+ - `audioMode` is always `'self'`.
75
+ - `loop` and `showLoop` are always off: the Loop toggle (the `loop` option)
76
+ owns looping, and repeats only the sounds marked as loops.
77
+ - `duration`, `downloadUrl` and `downloadName` are ignored: they describe
78
+ one track. A sound's own `duration` reaches the player instead, so its
79
+ length shows before the audio's metadata loads.
80
+ - `lazy` has no effect: the engine is built empty and the list loads each
81
+ sound into it when it plays (the strip also cues the first one).
52
82
 
53
83
  Every control can go. No BPM anywhere:
54
84
 
@@ -111,8 +141,10 @@ before the first play.)
111
141
 
112
142
  | Key | Does |
113
143
  |---|---|
144
+ | Tab | The list is one stop: the focused (else first) row |
114
145
  | ↑ / ↓ | Move between sounds; while one plays, play the next |
115
146
  | ← / → | Seek the playing sound |
147
+ | Home / End | First / last sound; on the playing row's seek slider, its start / end |
116
148
  | Space / Enter | Play / pause |
117
149
  | `/` | Search |
118
150
 
@@ -120,10 +152,18 @@ before the first play.)
120
152
 
121
153
  ```js
122
154
  import {renderSounds} from '@arraypress/waveform-sounds/render';
123
- 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>`;
124
156
  ```
125
157
 
126
- 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.
127
167
 
128
168
  ## Theming
129
169