@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.
- package/README.md +24 -2
- package/dist/waveform-sounds-no-autoinit.esm.js +495 -90
- package/dist/waveform-sounds-render.esm.js +55 -5
- package/dist/waveform-sounds.css +88 -17
- package/dist/waveform-sounds.esm.js +498 -92
- package/dist/waveform-sounds.js +494 -92
- package/dist/waveform-sounds.min.css +1 -1
- package/dist/waveform-sounds.min.js +3 -3
- package/package.json +1 -1
- package/src/css/waveform-sounds.css +88 -17
- package/src/js/core/WaveformSounds.ts +350 -87
- package/src/js/core/element.ts +208 -0
- package/src/js/core/engine.ts +9 -3
- package/src/js/core/options.ts +0 -5
- package/src/js/data/bpm.ts +14 -4
- package/src/js/data/navigation.ts +16 -3
- package/src/js/data/sounds.ts +44 -14
- package/src/js/data/url-state.ts +33 -10
- package/src/js/dom/colors.ts +28 -1
- package/src/js/dom/draw.ts +0 -1
- package/src/js/dom/menus.ts +0 -2
- package/src/js/dom/rows.ts +0 -3
- package/src/js/entry.ts +13 -3
- package/src/js/index.ts +7 -3
- package/src/js/render/html.ts +0 -2
- package/src/js/render/icons.ts +0 -1
- package/src/js/render/markup.ts +41 -13
- package/src/js/render/options.ts +26 -4
- package/src/js/render/strings.ts +4 -3
- package/src/js/render-entry.ts +1 -1
- package/src/js/shared/utils.ts +4 -4
- package/src/js/types.ts +30 -3
- package/types/core/WaveformSounds.d.ts +40 -10
- package/types/core/WaveformSounds.d.ts.map +1 -1
- package/types/core/element.d.ts +84 -0
- package/types/core/element.d.ts.map +1 -0
- package/types/core/engine.d.ts +8 -3
- package/types/core/engine.d.ts.map +1 -1
- package/types/core/options.d.ts +0 -5
- package/types/core/options.d.ts.map +1 -1
- package/types/data/bpm.d.ts +17 -4
- package/types/data/bpm.d.ts.map +1 -1
- package/types/data/navigation.d.ts +11 -2
- package/types/data/navigation.d.ts.map +1 -1
- package/types/data/sounds.d.ts +13 -12
- package/types/data/sounds.d.ts.map +1 -1
- package/types/data/url-state.d.ts +32 -6
- package/types/data/url-state.d.ts.map +1 -1
- package/types/dom/colors.d.ts +13 -0
- package/types/dom/colors.d.ts.map +1 -1
- package/types/dom/draw.d.ts +0 -1
- package/types/dom/draw.d.ts.map +1 -1
- package/types/dom/menus.d.ts +0 -2
- package/types/dom/menus.d.ts.map +1 -1
- package/types/dom/rows.d.ts +0 -3
- package/types/dom/rows.d.ts.map +1 -1
- package/types/entry.d.ts +10 -4
- package/types/entry.d.ts.map +1 -1
- package/types/index.d.ts +2 -2
- package/types/index.d.ts.map +1 -1
- package/types/render/html.d.ts +0 -2
- package/types/render/html.d.ts.map +1 -1
- package/types/render/icons.d.ts.map +1 -1
- package/types/render/markup.d.ts +17 -8
- package/types/render/markup.d.ts.map +1 -1
- package/types/render/options.d.ts +17 -4
- package/types/render/options.d.ts.map +1 -1
- package/types/render/strings.d.ts +0 -3
- package/types/render/strings.d.ts.map +1 -1
- package/types/render-entry.d.ts +1 -1
- package/types/render-entry.d.ts.map +1 -1
- package/types/shared/utils.d.ts +3 -3
- package/types/shared/utils.d.ts.map +1 -1
- package/types/types.d.ts +29 -3
- 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
|
|