@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.
- package/LICENSE +1 -1
- package/README.md +43 -3
- package/dist/waveform-sounds-no-autoinit.esm.js +607 -178
- package/dist/waveform-sounds-render.esm.js +79 -15
- package/dist/waveform-sounds.css +136 -79
- package/dist/waveform-sounds.esm.js +611 -181
- package/dist/waveform-sounds.js +608 -181
- package/dist/waveform-sounds.min.css +1 -1
- package/dist/waveform-sounds.min.js +3 -3
- package/package.json +36 -33
- package/src/css/waveform-sounds.css +136 -79
- package/src/js/core/WaveformSounds.ts +1366 -0
- package/src/js/core/element.ts +208 -0
- package/src/js/core/engine.ts +107 -0
- package/src/js/core/{options.js → options.ts} +28 -28
- package/src/js/data/{bpm.js → bpm.ts} +27 -17
- package/src/js/data/{navigation.js → navigation.ts} +31 -18
- package/src/js/data/{sounds.js → sounds.ts} +97 -66
- package/src/js/data/url-state.ts +130 -0
- package/src/js/dom/colors.ts +86 -0
- package/src/js/dom/{draw.js → draw.ts} +16 -17
- package/src/js/dom/{menus.js → menus.ts} +70 -55
- package/src/js/dom/{rows.js → rows.ts} +15 -17
- package/src/js/entry.ts +60 -0
- package/src/js/{index.js → index.ts} +7 -3
- package/src/js/render/{html.js → html.ts} +16 -12
- package/src/js/render/{icons.js → icons.ts} +3 -4
- package/src/js/render/{markup.js → markup.ts} +114 -64
- package/src/js/render/options.ts +118 -0
- package/src/js/render/{strings.js → strings.ts} +18 -16
- package/src/js/{render-entry.js → render-entry.ts} +2 -1
- package/src/js/shared/{utils.js → utils.ts} +24 -24
- package/{index.d.ts → src/js/types.ts} +40 -88
- package/types/core/WaveformSounds.d.ts +175 -0
- package/types/core/WaveformSounds.d.ts.map +1 -0
- package/types/core/element.d.ts +84 -0
- package/types/core/element.d.ts.map +1 -0
- package/types/core/engine.d.ts +72 -0
- package/types/core/engine.d.ts.map +1 -0
- package/types/core/options.d.ts +71 -0
- package/types/core/options.d.ts.map +1 -0
- package/types/data/bpm.d.ts +80 -0
- package/types/data/bpm.d.ts.map +1 -0
- package/types/data/navigation.d.ts +62 -0
- package/types/data/navigation.d.ts.map +1 -0
- package/types/data/sounds.d.ts +168 -0
- package/types/data/sounds.d.ts.map +1 -0
- package/types/data/url-state.d.ts +109 -0
- package/types/data/url-state.d.ts.map +1 -0
- package/types/dom/colors.d.ts +48 -0
- package/types/dom/colors.d.ts.map +1 -0
- package/types/dom/draw.d.ts +72 -0
- package/types/dom/draw.d.ts.map +1 -0
- package/types/dom/menus.d.ts +75 -0
- package/types/dom/menus.d.ts.map +1 -0
- package/types/dom/rows.d.ts +39 -0
- package/types/dom/rows.d.ts.map +1 -0
- package/types/entry.d.ts +28 -0
- package/types/entry.d.ts.map +1 -0
- package/types/index.d.ts +16 -0
- package/types/index.d.ts.map +1 -0
- package/types/render/html.d.ts +37 -0
- package/types/render/html.d.ts.map +1 -0
- package/types/render/icons.d.ts +17 -0
- package/types/render/icons.d.ts.map +1 -0
- package/types/render/markup.d.ts +141 -0
- package/types/render/markup.d.ts.map +1 -0
- package/types/render/options.d.ts +69 -0
- package/types/render/options.d.ts.map +1 -0
- package/types/render/strings.d.ts +43 -0
- package/types/render/strings.d.ts.map +1 -0
- package/types/render-entry.d.ts +8 -0
- package/types/render-entry.d.ts.map +1 -0
- package/types/shared/utils.d.ts +57 -0
- package/types/shared/utils.d.ts.map +1 -0
- package/types/types.d.ts +280 -0
- package/types/types.d.ts.map +1 -0
- package/types/vendor/arraypress-text.d.ts +250 -0
- package/dist/waveform-sounds-no-autoinit.cjs +0 -2159
- package/dist/waveform-sounds-render.cjs +0 -614
- package/dist/waveform-sounds.cjs +0 -2181
- package/no-autoinit.d.ts +0 -2
- package/render.d.ts +0 -5
- package/src/js/core/WaveformSounds.js +0 -993
- package/src/js/core/engine.js +0 -57
- package/src/js/data/url-state.js +0 -106
- package/src/js/dom/colors.js +0 -59
- package/src/js/entry.js +0 -25
- package/src/js/render/options.js +0 -90
package/LICENSE
CHANGED
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.
|
|
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
|
|