@arraypress/waveform-sounds 2.0.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.
- package/README.md +44 -2
- package/dist/waveform-sounds-no-autoinit.esm.js +914 -208
- package/dist/waveform-sounds-render.esm.js +274 -82
- package/dist/waveform-sounds.css +92 -17
- package/dist/waveform-sounds.esm.js +917 -210
- package/dist/waveform-sounds.js +913 -210
- 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 +92 -17
- package/src/js/core/WaveformSounds.ts +540 -120
- package/src/js/core/element.ts +208 -0
- package/src/js/core/engine.ts +9 -3
- package/src/js/core/options.ts +1 -5
- package/src/js/data/bpm.ts +14 -4
- package/src/js/data/keys.ts +156 -0
- package/src/js/data/navigation.ts +51 -11
- package/src/js/data/sounds.ts +73 -36
- package/src/js/data/url-state.ts +39 -12
- package/src/js/dom/colors.ts +28 -1
- package/src/js/dom/draw.ts +16 -3
- package/src/js/dom/menus.ts +2 -3
- package/src/js/dom/rows.ts +38 -15
- 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 +59 -17
- package/src/js/render/markup.ts +156 -62
- package/src/js/render/options.ts +29 -5
- package/src/js/render/strings.ts +57 -4
- package/src/js/render-entry.ts +1 -1
- package/src/js/shared/utils.ts +4 -4
- package/src/js/types.ts +54 -3
- package/types/core/WaveformSounds.d.ts +41 -11
- 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/keys.d.ts +88 -0
- package/types/data/keys.d.ts.map +1 -0
- package/types/data/navigation.d.ts +38 -11
- package/types/data/navigation.d.ts.map +1 -1
- package/types/data/sounds.d.ts +33 -17
- package/types/data/sounds.d.ts.map +1 -1
- package/types/data/url-state.d.ts +38 -7
- 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 +5 -3
- 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 +19 -11
- 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 +41 -3
- package/types/render/icons.d.ts.map +1 -1
- package/types/render/markup.d.ts +44 -12
- package/types/render/markup.d.ts.map +1 -1
- package/types/render/options.d.ts +18 -5
- package/types/render/options.d.ts.map +1 -1
- package/types/render/strings.d.ts +22 -4
- 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 +53 -3
- package/types/types.d.ts.map +1 -1
package/src/js/render-entry.ts
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* `@arraypress/waveform-sounds/render` — the DOM-free half, for server
|
|
3
3
|
* rendering. Importing it never touches `window` or `document`.
|
|
4
4
|
*/
|
|
5
|
-
export {renderSounds, renderSoundsElement, DEFAULT_STRINGS, escapeHtml} from './render/markup.js';
|
|
5
|
+
export {renderSounds, renderSoundsElement, DEFAULT_STRINGS, escapeHtml, RENDER_OPTION_KEYS, pickRenderOptions} from './render/markup.js';
|
|
6
6
|
export {normalizeSounds, parseManifest, encodePeaks, decodePeaks, normalizeKey, facets, formatDuration} from './data/sounds.js';
|
|
7
7
|
export type {SoundInput, Sound, SoundsManifest, WaveformSoundsOptions, WaveformSoundsStrings} from './types.js';
|
package/src/js/shared/utils.ts
CHANGED
|
@@ -14,7 +14,6 @@ export const LOG = '[WaveformSounds]';
|
|
|
14
14
|
* @param value
|
|
15
15
|
* @param min
|
|
16
16
|
* @param max
|
|
17
|
-
* @returns
|
|
18
17
|
*/
|
|
19
18
|
export function clamp(value: number, min: number = 0, max: number = 1): number {
|
|
20
19
|
return Math.min(Math.max(value, min), max);
|
|
@@ -37,14 +36,15 @@ export function pointerFraction(clientX: number, rect: {left: number, width: num
|
|
|
37
36
|
* must not fire there.
|
|
38
37
|
*
|
|
39
38
|
* @param el
|
|
40
|
-
* @returns
|
|
41
39
|
*/
|
|
42
40
|
export function isTyping(el: Element | null | undefined): boolean {
|
|
43
41
|
return !!el && ((el as HTMLElement).isContentEditable || /^(INPUT|SELECT|TEXTAREA)$/.test(el.tagName));
|
|
44
42
|
}
|
|
45
43
|
|
|
46
44
|
/**
|
|
47
|
-
* Dispatch a bubbling `waveformsounds:<name>` CustomEvent from an
|
|
45
|
+
* Dispatch a bubbling, composed `waveformsounds:<name>` CustomEvent from an
|
|
46
|
+
* element (composed: it leaves a shadow root, like the core's lifecycle
|
|
47
|
+
* events).
|
|
48
48
|
* Every event the list emits goes through here, so they share one shape:
|
|
49
49
|
* the detail plus the instance that sent it.
|
|
50
50
|
*
|
|
@@ -54,7 +54,7 @@ export function isTyping(el: Element | null | undefined): boolean {
|
|
|
54
54
|
* @returns The event dispatched.
|
|
55
55
|
*/
|
|
56
56
|
export function emit(target: EventTarget, name: string, detail: Record<string, any>): CustomEvent {
|
|
57
|
-
const event = new CustomEvent(`waveformsounds:${name}`, {bubbles: true, detail});
|
|
57
|
+
const event = new CustomEvent(`waveformsounds:${name}`, {bubbles: true, composed: true, detail});
|
|
58
58
|
target.dispatchEvent(event);
|
|
59
59
|
return event;
|
|
60
60
|
}
|
package/src/js/types.ts
CHANGED
|
@@ -43,8 +43,9 @@ export interface SoundInput {
|
|
|
43
43
|
/** A loop (`true`) rather than a one-shot (the default). Loops get a
|
|
44
44
|
* loop icon beside their name, the "Loops / One-shots" filter appears
|
|
45
45
|
* once a list has both, and with any sound marked the Loop toggle
|
|
46
|
-
* repeats only loops.
|
|
47
|
-
|
|
46
|
+
* repeats only loops. As data writes it, `'true'` / `'1'` / `1` also
|
|
47
|
+
* mean a loop; anything else is a one-shot. */
|
|
48
|
+
loop?: boolean | 'true' | 'false' | '1' | '0' | 1 | 0;
|
|
48
49
|
/** Stable id for `play('id')`. Defaults to `sound-<n>`, 1-based
|
|
49
50
|
* (`sound-1` is the first sound). */
|
|
50
51
|
id?: string;
|
|
@@ -129,6 +130,9 @@ export interface WaveformSoundsStrings {
|
|
|
129
130
|
play: string;
|
|
130
131
|
pause: string;
|
|
131
132
|
seek: string;
|
|
133
|
+
/** The playing row's seek slider, read out: `{time}`, `{duration}`
|
|
134
|
+
* ("0:12 of 0:30"). Since 2.1.0. */
|
|
135
|
+
seekValue: string;
|
|
132
136
|
download: string;
|
|
133
137
|
count: string;
|
|
134
138
|
countOne: string;
|
|
@@ -137,6 +141,29 @@ export interface WaveformSoundsStrings {
|
|
|
137
141
|
empty: string;
|
|
138
142
|
clear: string;
|
|
139
143
|
nowPlaying: string;
|
|
144
|
+
/** Announced when a sound fails to load or play. Since 2.1.0. */
|
|
145
|
+
playError: string;
|
|
146
|
+
/** Shown in place of the list when it can't be built (the manifest
|
|
147
|
+
* fails to load or isn't a manifest). Since 2.1.0. */
|
|
148
|
+
loadError: string;
|
|
149
|
+
/** The empty state of a list with no sounds at all. Since 2.1.0. */
|
|
150
|
+
noSounds: string;
|
|
151
|
+
/** A row's BPM, read out: `{bpm}` ("130 BPM"). Since 2.2.0. */
|
|
152
|
+
rowBpm: string;
|
|
153
|
+
/** A row's key, read out: `{key}`, spoken ("key B minor"). Since 2.2.0. */
|
|
154
|
+
rowKey: string;
|
|
155
|
+
/** A row's length, read out: `{duration}` ("0:07"). Since 2.2.0. */
|
|
156
|
+
rowDuration: string;
|
|
157
|
+
/** A major key, spoken: `{note}` ("F sharp major"). Since 2.2.0. */
|
|
158
|
+
keyMajor: string;
|
|
159
|
+
/** A minor key, spoken: `{note}` ("B minor"). Since 2.2.0. */
|
|
160
|
+
keyMinor: string;
|
|
161
|
+
/** A sharp note, spoken: `{note}` is the letter ("F sharp"). Since 2.2.0. */
|
|
162
|
+
noteSharp: string;
|
|
163
|
+
/** A flat note, spoken: `{note}` is the letter ("B flat"). Since 2.2.0. */
|
|
164
|
+
noteFlat: string;
|
|
165
|
+
/** Between the parts of a row's read-out (", "). Since 2.2.0. */
|
|
166
|
+
listSeparator: string;
|
|
140
167
|
}
|
|
141
168
|
|
|
142
169
|
export interface WaveformSoundsOptions {
|
|
@@ -187,6 +214,14 @@ export interface WaveformSoundsOptions {
|
|
|
187
214
|
pageSize?: number;
|
|
188
215
|
/** Columns after the title, in order. Default all four. */
|
|
189
216
|
columns?: SoundsColumn[];
|
|
217
|
+
/** Enharmonic keys are one key: A#m and Bbm (C# and Db, …) are one
|
|
218
|
+
* entry in the key menu, a filter on either finds both, and the address
|
|
219
|
+
* accepts either spelling. The entry shows the spelling the list uses
|
|
220
|
+
* most (a tie: the conventional one — Db, Eb, F#, Ab, Bb major; C#m,
|
|
221
|
+
* Ebm, F#m, G#m, Bbm minor); each row still shows its key as written.
|
|
222
|
+
* `false` keeps every spelling apart. As markup:
|
|
223
|
+
* `data-merge-enharmonic-keys="false"`. Default true. Since 2.2.0. */
|
|
224
|
+
mergeEnharmonicKeys?: boolean;
|
|
190
225
|
/** Row waveform style. Default `'mirror'`. */
|
|
191
226
|
waveformStyle?: 'mirror' | 'bars';
|
|
192
227
|
/** Row waveform colour. Default: CSS `--ws-wave-color`. */
|
|
@@ -226,7 +261,10 @@ export interface WaveformSoundsOptions {
|
|
|
226
261
|
onError?: ((error: unknown, instance: WaveformSounds) => void) | null;
|
|
227
262
|
}
|
|
228
263
|
|
|
229
|
-
/** `detail` of the `waveformsounds:*` DOM events
|
|
264
|
+
/** `detail` of the `waveformsounds:*` DOM events. All bubble and are
|
|
265
|
+
* composed (they leave a shadow root); merged into `HTMLElementEventMap`,
|
|
266
|
+
* `DocumentEventMap` and `WindowEventMap`, so `addEventListener` on an
|
|
267
|
+
* element, `document` or `window` is typed. */
|
|
230
268
|
export interface WaveformSoundsEventMap {
|
|
231
269
|
'waveformsounds:ready': CustomEvent<{sounds: number; instance: WaveformSounds}>;
|
|
232
270
|
'waveformsounds:play': CustomEvent<{sound: Sound; index: number; instance: WaveformSounds}>;
|
|
@@ -235,3 +273,16 @@ export interface WaveformSoundsEventMap {
|
|
|
235
273
|
'waveformsounds:filter': CustomEvent<{visible: number; total: number; filter: SoundsFilter; sort: SoundsSort; instance: WaveformSounds}>;
|
|
236
274
|
'waveformsounds:error': CustomEvent<{error: unknown; sound?: Sound; index?: number; instance: WaveformSounds}>;
|
|
237
275
|
}
|
|
276
|
+
|
|
277
|
+
/** The plain events a {@link WaveformSounds} dispatches on itself — it is an
|
|
278
|
+
* `EventTarget`, so `list.addEventListener('play', …)` works and is typed.
|
|
279
|
+
* Each mirrors a `waveformsounds:*` container event (whose `detail`
|
|
280
|
+
* carries the data); the matching `on*` callback still runs. Since 2.1.0. */
|
|
281
|
+
export interface WaveformSoundsInstanceEventMap {
|
|
282
|
+
ready: Event;
|
|
283
|
+
play: Event;
|
|
284
|
+
pause: Event;
|
|
285
|
+
end: Event;
|
|
286
|
+
filter: Event;
|
|
287
|
+
error: Event;
|
|
288
|
+
}
|
|
@@ -25,13 +25,31 @@
|
|
|
25
25
|
*
|
|
26
26
|
* @module core
|
|
27
27
|
*/
|
|
28
|
-
import { facets, matches, normalizeSounds, parseManifest, sortSounds } from '../data/sounds.js';
|
|
28
|
+
import { facets, formatDuration, matches, normalizeKey, normalizeSounds, parseManifest, sortSounds } from '../data/sounds.js';
|
|
29
29
|
import { DEFAULT_OPTIONS } from './options.js';
|
|
30
|
-
import { renderSounds } from '../render/markup.js';
|
|
31
|
-
import type { decodePeaks, encodePeaks
|
|
32
|
-
import type {
|
|
30
|
+
import type { renderSounds } from '../render/markup.js';
|
|
31
|
+
import type { decodePeaks, encodePeaks } from '../data/sounds.js';
|
|
32
|
+
import type { WaveformPlayer } from '@arraypress/waveform-player';
|
|
33
|
+
import type { Sound, SoundsFilter, SoundsSort, WaveformSoundsInstanceEventMap, WaveformSoundsOptions, WaveformSoundsStrings } from '../types.js';
|
|
33
34
|
export { DEFAULT_OPTIONS };
|
|
34
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Typed listeners for the events a list dispatches on itself (see
|
|
37
|
+
* {@link WaveformSoundsInstanceEventMap}). Types only: merged into the class
|
|
38
|
+
* below, it emits nothing.
|
|
39
|
+
*/
|
|
40
|
+
export interface WaveformSounds {
|
|
41
|
+
addEventListener<K extends keyof WaveformSoundsInstanceEventMap>(type: K, listener: (this: WaveformSounds, ev: WaveformSoundsInstanceEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
42
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
|
|
43
|
+
removeEventListener<K extends keyof WaveformSoundsInstanceEventMap>(type: K, listener: (this: WaveformSounds, ev: WaveformSoundsInstanceEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
44
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions): void;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* An `EventTarget`, like the core's player: each moment is dispatched on the
|
|
48
|
+
* instance as a plain event (`ready`, `play`, `pause`, `end`, `filter`,
|
|
49
|
+
* `error`), and on the container as a bubbling, composed
|
|
50
|
+
* `waveformsounds:<name>` CustomEvent carrying the details.
|
|
51
|
+
*/
|
|
52
|
+
export declare class WaveformSounds extends EventTarget {
|
|
35
53
|
/** Every live instance, by its element. */
|
|
36
54
|
static instances: Map<Element, WaveformSounds>;
|
|
37
55
|
/** The pure helpers, for `<script>` users (attached in `entry.ts`). */
|
|
@@ -47,6 +65,11 @@ export declare class WaveformSounds {
|
|
|
47
65
|
formatDuration: typeof formatDuration;
|
|
48
66
|
renderSounds: typeof renderSounds;
|
|
49
67
|
};
|
|
68
|
+
/** Register the `<waveform-sounds>` element (default tag name
|
|
69
|
+
* `waveform-sounds`). The default entry does this on import; this
|
|
70
|
+
* reaches it from a `<script>` page that opted out of auto-init.
|
|
71
|
+
* Attached in `entry.ts`. Since 2.1.0. */
|
|
72
|
+
static defineElement: (name?: string) => CustomElementConstructor | undefined;
|
|
50
73
|
/** Every option with its default (attached in `entry.ts`). */
|
|
51
74
|
static DEFAULT_OPTIONS: WaveformSoundsOptions;
|
|
52
75
|
/** The English UI strings (attached in `entry.ts`). */
|
|
@@ -65,8 +88,9 @@ export declare class WaveformSounds {
|
|
|
65
88
|
readonly filter: SoundsFilter;
|
|
66
89
|
readonly sortBy: SoundsSort;
|
|
67
90
|
readonly playing: boolean;
|
|
68
|
-
/** The engine `WaveformPlayer
|
|
69
|
-
|
|
91
|
+
/** The engine `WaveformPlayer`: built when the list is ready if the
|
|
92
|
+
* player is on the page (else on first play), null before and after. */
|
|
93
|
+
readonly engine: WaveformPlayer | null;
|
|
70
94
|
/**
|
|
71
95
|
* @param {HTMLElement|string} container - The element (or a selector).
|
|
72
96
|
* @param {WaveformSoundsOptions} [options]
|
|
@@ -121,10 +145,17 @@ export declare class WaveformSounds {
|
|
|
121
145
|
* Tear down: listeners, observers, timers and the engine. Markup this
|
|
122
146
|
* instance rendered is restored to what the container held before.
|
|
123
147
|
* ADOPTED (server-rendered) markup is left as it is now — rows may be
|
|
124
|
-
* re-sorted, hidden or marked current —
|
|
125
|
-
*
|
|
148
|
+
* re-sorted, hidden or marked current — unless `restore` is set: then it
|
|
149
|
+
* is put back exactly as the server sent it, ready for a new instance
|
|
150
|
+
* (what a framework re-mounting the same markup wants).
|
|
151
|
+
*
|
|
152
|
+
* @param options
|
|
153
|
+
* @param options.restore - Put adopted server markup back as it was.
|
|
154
|
+
* Default false. Since 2.1.0.
|
|
126
155
|
*/
|
|
127
|
-
destroy(
|
|
156
|
+
destroy(options?: {
|
|
157
|
+
restore?: boolean;
|
|
158
|
+
}): void;
|
|
128
159
|
/**
|
|
129
160
|
* Initialise every `[data-waveform-sounds]` under `root` that isn't yet.
|
|
130
161
|
*
|
|
@@ -135,7 +166,6 @@ export declare class WaveformSounds {
|
|
|
135
166
|
/**
|
|
136
167
|
* The instance on an element (or selector), if any.
|
|
137
168
|
* @param el
|
|
138
|
-
* @returns
|
|
139
169
|
*/
|
|
140
170
|
static getInstance(el: Element | string): WaveformSounds | null;
|
|
141
171
|
/** Destroy instances whose element has left the document (after a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WaveformSounds.d.ts","sourceRoot":"","sources":["../../src/js/core/WaveformSounds.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAiB,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAQ,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"WaveformSounds.d.ts","sourceRoot":"","sources":["../../src/js/core/WaveformSounds.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAiB,MAAM,EAAe,cAAc,EAAE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAQ,MAAM,mBAAmB,CAAC;AAMhK,OAAO,EAAC,eAAe,EAAgC,MAAM,cAAc,CAAC;AAG5E,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAStD,OAAO,KAAK,EAAC,WAAW,EAAE,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAEhE,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC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IAAI,CAK5B;IAED,uCAAuC;IACvC,QAAQ,IAAI,IAAI,CAIf;IAyND;;;;;;OAMG;IACH,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,EAAE,IAAI,GAAE;QAAC,EAAE,CAAC,EAAE,MAAM,CAAA;KAAM,GAAG,IAAI,CAoBrE;IAoCD,+BAA+B;IAC/B,KAAK,IAAI,IAAI,CAEZ;IAED;;;OAGG;IACH,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,CAK7C;IAED,wDAAwD;IACxD,IAAI,IAAI,IAAI,CAAmB;IAE/B,uCAAuC;IACvC,QAAQ,IAAI,IAAI,CAAoB;IAqBpC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAIzB;IA8OD,kDAAkD;IAClD,IAAI,OAAO,IAAI,KAAK,GAAG,IAAI,CAG1B;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,OAAO,GAAE;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAM,GAAG,IAAI,CAmB/C;IAED;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,GAAE,UAAqB,GAAG,cAAc,EAAE,CAUzD;IAED;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAC,EAAE,EAAE,OAAO,GAAG,MAAM,GAAG,cAAc,GAAG,IAAI,CAG9D;IAED;mCAC+B;IAC/B,MAAM,CAAC,KAAK,IAAI,IAAI,CAEnB;CACJ"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `<waveform-sounds>` custom element, modelled on the core's
|
|
3
|
+
* `<waveform-player>`.
|
|
4
|
+
*
|
|
5
|
+
* A light-DOM wrapper: the element itself is the list's container, so the
|
|
6
|
+
* stylesheet applies as it does to `[data-waveform-sounds]`, server-rendered
|
|
7
|
+
* markup inside it (`renderSounds()` output) is ADOPTED exactly as it is
|
|
8
|
+
* there, and `waveformsounds:*` events bubble from the tag. Configured by
|
|
9
|
+
* attributes — every `data-*` option the list reads, with or without the
|
|
10
|
+
* `data-` prefix (`manifest`, `page-size`, `player`, …), the unprefixed form
|
|
11
|
+
* winning.
|
|
12
|
+
*
|
|
13
|
+
* The default entry registers it (behind the same opt-out as the scan);
|
|
14
|
+
* `/no-autoinit` exports {@link defineWaveformSoundsElement}, and
|
|
15
|
+
* `WaveformSounds.defineElement()` reaches it from a `<script>` page.
|
|
16
|
+
*
|
|
17
|
+
* @module element
|
|
18
|
+
*/
|
|
19
|
+
import { WaveformSounds } from './WaveformSounds.js';
|
|
20
|
+
declare global {
|
|
21
|
+
interface HTMLElementTagNameMap {
|
|
22
|
+
'waveform-sounds': WaveformSoundsElement;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Every `data-*` key `readDataOptions` reads, as its `dataset` name. The
|
|
27
|
+
* element accepts each as `data-<kebab>` and as plain `<kebab>`.
|
|
28
|
+
* `test/runtime/element.test.js` fails if this list and `readDataOptions`
|
|
29
|
+
* drift apart.
|
|
30
|
+
*/
|
|
31
|
+
export declare const ELEMENT_OPTION_KEYS: string[];
|
|
32
|
+
/**
|
|
33
|
+
* Read the element's options: each key from its plain attribute, else its
|
|
34
|
+
* `data-` one, through the same `readDataOptions` the `data-*` contract uses
|
|
35
|
+
* (so a bare boolean attribute — `<waveform-sounds auto-advance>` — is true,
|
|
36
|
+
* as `data-auto-advance` is).
|
|
37
|
+
*
|
|
38
|
+
* @param el
|
|
39
|
+
* @returns Sparse options.
|
|
40
|
+
*/
|
|
41
|
+
export declare function readElementOptions(el: Element): Record<string, any>;
|
|
42
|
+
declare const Base: typeof HTMLElement;
|
|
43
|
+
/**
|
|
44
|
+
* `<waveform-sounds manifest="/previews/sounds.json" page-size="20">`.
|
|
45
|
+
*
|
|
46
|
+
* - `connectedCallback` builds the list in the element (adopting
|
|
47
|
+
* server-rendered markup inside it); `disconnectedCallback` destroys it —
|
|
48
|
+
* putting adopted markup back as the server sent it — unless the element
|
|
49
|
+
* is put back before the current task ends (a move keeps the list, and
|
|
50
|
+
* its playback).
|
|
51
|
+
* - Changing an option attribute (either form) rebuilds the list once per
|
|
52
|
+
* task, from the sounds it holds (or from the new `manifest`).
|
|
53
|
+
* - {@link WaveformSoundsElement.sounds} is the `WaveformSounds` instance.
|
|
54
|
+
*/
|
|
55
|
+
export declare class WaveformSoundsElement extends Base {
|
|
56
|
+
/** The list inside this element, or `null` while disconnected. */
|
|
57
|
+
sounds: WaveformSounds | null;
|
|
58
|
+
/** Every option attribute, plain and `data-` prefixed. */
|
|
59
|
+
static get observedAttributes(): string[];
|
|
60
|
+
/** Build the list (or keep it, after a move). */
|
|
61
|
+
connectedCallback(): void;
|
|
62
|
+
/** Destroy the list, unless the element comes straight back (a move). */
|
|
63
|
+
disconnectedCallback(): void;
|
|
64
|
+
/**
|
|
65
|
+
* An option attribute changed: rebuild once the task's changes are in.
|
|
66
|
+
*
|
|
67
|
+
* @param name
|
|
68
|
+
* @param previous
|
|
69
|
+
* @param value
|
|
70
|
+
*/
|
|
71
|
+
attributeChangedCallback(name: string, previous: string | null, value: string | null): void;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Register the `<waveform-sounds>` element (or the same element under
|
|
75
|
+
* another name). The default entry does this on import; `/no-autoinit`
|
|
76
|
+
* leaves it to you (`WaveformSounds.defineElement()` from a `<script>` page).
|
|
77
|
+
* A name that is already defined is left alone.
|
|
78
|
+
*
|
|
79
|
+
* @param name - Tag name; must contain a hyphen.
|
|
80
|
+
* @returns The registered constructor, or `undefined` outside a browser.
|
|
81
|
+
*/
|
|
82
|
+
export declare function defineWaveformSoundsElement(name?: string): CustomElementConstructor | undefined;
|
|
83
|
+
export {};
|
|
84
|
+
//# sourceMappingURL=element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../src/js/core/element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAKnD,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,iBAAiB,EAAE,qBAAqB,CAAC;KAC5C;CACJ;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,UAI/B,CAAC;AASF;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAQnE;AAKD,QAAA,MAAM,IAAI,EAAoE,OAAO,WAAW,CAAC;AAEjG;;;;;;;;;;;GAWG;AACH,qBAAa,qBAAsB,SAAQ,IAAI;IAC3C,kEAAkE;IAC1D,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAItC,0DAA0D;IAC1D,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,iDAAiD;IACjD,iBAAiB,IAAI,IAAI,CAOxB;IAED,yEAAyE;IACzE,oBAAoB,IAAI,IAAI,CAM3B;IAED;;;;;;OAMG;IACH,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAe1F;CAkDJ;AAED;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,GAAE,MAA0B,GAAG,wBAAwB,GAAG,SAAS,CASlH"}
|
package/types/core/engine.d.ts
CHANGED
|
@@ -33,7 +33,6 @@ export declare function engineOptions(user: Record<string, any> | null | undefin
|
|
|
33
33
|
*
|
|
34
34
|
* @param sound
|
|
35
35
|
* @param layout
|
|
36
|
-
* @returns
|
|
37
36
|
*/
|
|
38
37
|
export declare function enginePeaks(sound: {
|
|
39
38
|
peaks: number[] | null;
|
|
@@ -45,6 +44,7 @@ export interface EngineTrack {
|
|
|
45
44
|
autoplay: boolean;
|
|
46
45
|
duration?: number;
|
|
47
46
|
downloadUrl?: string;
|
|
47
|
+
preload?: string;
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* The `loadTrack()` options for a sound: its peaks (see {@link enginePeaks}),
|
|
@@ -53,15 +53,20 @@ export interface EngineTrack {
|
|
|
53
53
|
* which with `preload: 'none'` is only once it plays — and its download
|
|
54
54
|
* link, so a `showDownload` engine offers what the row offers.
|
|
55
55
|
*
|
|
56
|
+
* `preload` is given every time because the core keeps the last one: the
|
|
57
|
+
* strip CUES its first sound with `'none'` (it shows the title, length and
|
|
58
|
+
* peaks from the data, and fetches nothing until it plays), and the next
|
|
59
|
+
* sound played must get the engine's own preload back.
|
|
60
|
+
*
|
|
56
61
|
* @param sound
|
|
57
62
|
* @param layout
|
|
58
63
|
* @param autoplay - Start once loaded (false: cue only).
|
|
59
|
-
* @
|
|
64
|
+
* @param preload - The media element's `preload` for this sound.
|
|
60
65
|
*/
|
|
61
66
|
export declare function engineTrack(sound: {
|
|
62
67
|
peaks: number[] | null;
|
|
63
68
|
waveform: string | null;
|
|
64
69
|
duration: number | null;
|
|
65
70
|
download: string | null;
|
|
66
|
-
}, layout: 'inline' | 'strip', autoplay: boolean): EngineTrack;
|
|
71
|
+
}, layout: 'inline' | 'strip', autoplay: boolean, preload?: string): EngineTrack;
|
|
67
72
|
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/js/core/engine.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG,SAAS,EAAE,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,E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CAAA;CAAC,EAAE,MAAM,EAAE,QAAQ,GAAG,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,CAM5M"}
|
package/types/core/options.d.ts
CHANGED
|
@@ -28,14 +28,12 @@ export declare function parseBool(value: string | undefined): boolean | undefine
|
|
|
28
28
|
* is an empty list (e.g. `data-sorts=""` = no sort menu).
|
|
29
29
|
*
|
|
30
30
|
* @param value
|
|
31
|
-
* @returns
|
|
32
31
|
*/
|
|
33
32
|
export declare function parseList(value: string | undefined): string[] | undefined;
|
|
34
33
|
/**
|
|
35
34
|
* A number attribute; an empty string is "not set".
|
|
36
35
|
*
|
|
37
36
|
* @param value
|
|
38
|
-
* @returns
|
|
39
37
|
*/
|
|
40
38
|
export declare function parseNumber(value: string | undefined): number | undefined;
|
|
41
39
|
/**
|
|
@@ -43,7 +41,6 @@ export declare function parseNumber(value: string | undefined): number | undefin
|
|
|
43
41
|
* the parameter prefix.
|
|
44
42
|
*
|
|
45
43
|
* @param value
|
|
46
|
-
* @returns
|
|
47
44
|
*/
|
|
48
45
|
export declare function parseUrlState(value: string | undefined): boolean | string | undefined;
|
|
49
46
|
/**
|
|
@@ -53,7 +50,6 @@ export declare function parseUrlState(value: string | undefined): boolean | stri
|
|
|
53
50
|
*
|
|
54
51
|
* @param value
|
|
55
52
|
* @param name - The attribute name, for the warning.
|
|
56
|
-
* @returns
|
|
57
53
|
*/
|
|
58
54
|
export declare function parseJson(value: string | undefined, name: string): Record<string, any> | undefined;
|
|
59
55
|
/**
|
|
@@ -70,7 +66,6 @@ export declare function readDataOptions(el: HTMLElement): Record<string, any>;
|
|
|
70
66
|
* overwrite (an unset prop must not erase a default).
|
|
71
67
|
*
|
|
72
68
|
* @param sources
|
|
73
|
-
* @returns
|
|
74
69
|
*/
|
|
75
70
|
export declare function mergeOptions(...sources: (Record<string, any> | null | undefined)[]): Record<string, any>;
|
|
76
71
|
//# sourceMappingURL=options.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/js/core/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAC,eAAe,EAAC,CAAC;AAEzB,sCAAsC;AACtC,eAAO,MAAM,eAAe,EAAE,qBAyB7B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAIxE;AAED
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/js/core/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,aAAa,CAAC;AAEvD,OAAO,EAAC,eAAe,EAAC,CAAC;AAEzB,sCAAsC;AACtC,eAAO,MAAM,eAAe,EAAE,qBAyB7B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAIxE;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,EAAE,GAAG,SAAS,CAGzE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAEzE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAIrF;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAQlG;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CA8BpE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,OAAO,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAOxG"}
|
package/types/data/bpm.d.ts
CHANGED
|
@@ -9,12 +9,28 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @module bpm
|
|
11
11
|
*/
|
|
12
|
+
/**
|
|
13
|
+
* The range the slider spans: the pack's BPMs widened to whole numbers
|
|
14
|
+
* (the handles step by 1, so a pack whose fastest loop is 128.5 BPM needs
|
|
15
|
+
* an end at 129, or the top handle could never reach it). A pack of whole
|
|
16
|
+
* BPMs is unchanged.
|
|
17
|
+
*
|
|
18
|
+
* @param range - The pack's BPM range (`facets().bpm`).
|
|
19
|
+
* @returns The slider's ends, or null when the pack has no BPMs.
|
|
20
|
+
*/
|
|
21
|
+
export declare function bpmExtent(range: {
|
|
22
|
+
min: number;
|
|
23
|
+
max: number;
|
|
24
|
+
} | null | undefined): {
|
|
25
|
+
min: number;
|
|
26
|
+
max: number;
|
|
27
|
+
} | null;
|
|
12
28
|
/**
|
|
13
29
|
* The filter for a pair of handle positions.
|
|
14
30
|
*
|
|
15
31
|
* @param lo - The lower handle.
|
|
16
32
|
* @param hi - The upper handle.
|
|
17
|
-
* @param extent - The
|
|
33
|
+
* @param extent - The slider's range ({@link bpmExtent}).
|
|
18
34
|
* @returns `''` for an open end.
|
|
19
35
|
*/
|
|
20
36
|
export declare function bpmFilterFromRange(lo: number, hi: number, extent: {
|
|
@@ -31,7 +47,6 @@ export declare function bpmFilterFromRange(lo: number, hi: number, extent: {
|
|
|
31
47
|
*
|
|
32
48
|
* @param filter
|
|
33
49
|
* @param extent
|
|
34
|
-
* @returns
|
|
35
50
|
*/
|
|
36
51
|
export declare function bpmRangeFromFilter(filter: {
|
|
37
52
|
bpmMin?: string | number;
|
|
@@ -48,7 +63,6 @@ export declare function bpmRangeFromFilter(filter: {
|
|
|
48
63
|
*
|
|
49
64
|
* @param value
|
|
50
65
|
* @param extent
|
|
51
|
-
* @returns
|
|
52
66
|
*/
|
|
53
67
|
export declare function bpmFraction(value: number, extent: {
|
|
54
68
|
min: number;
|
|
@@ -58,7 +72,6 @@ export declare function bpmFraction(value: number, extent: {
|
|
|
58
72
|
* Is a BPM limit set on either side?
|
|
59
73
|
*
|
|
60
74
|
* @param filter
|
|
61
|
-
* @returns
|
|
62
75
|
*/
|
|
63
76
|
export declare function hasBpmFilter(filter: {
|
|
64
77
|
bpmMin?: string | number;
|
package/types/data/bpm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bpm.d.ts","sourceRoot":"","sources":["../../src/js/data/bpm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAC,GAAG;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAC,CAM/H;AAED
|
|
1
|
+
{"version":3,"file":"bpm.d.ts","sourceRoot":"","sources":["../../src/js/data/bpm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAC,GAAG,IAAI,GAAG,SAAS,GAAG;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAC,GAAG,IAAI,CAEjH;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAC,GAAG;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAC,CAM/H;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE;IAAC,MAAM,CAAC,EAAE,MAAM,GAAC,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,GAAC,MAAM,CAAA;CAAC,EAAE,MAAM,EAAE;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAC,GAAG;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAC,CAQzJ;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAC,GAAG,MAAM,CAGrF;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE;IAAC,MAAM,CAAC,EAAE,MAAM,GAAC,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,GAAC,MAAM,CAAA;CAAC,GAAG,OAAO,CAE9F"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Musical keys beyond their spelling: which keys sound the same
|
|
3
|
+
* (enharmonics: A#m and Bbm), which spelling a merged filter entry shows,
|
|
4
|
+
* and how keys sort. Pure — shared by the renderer and the runtime.
|
|
5
|
+
*
|
|
6
|
+
* Keys arrive here already in the short form `normalizeKey()` writes
|
|
7
|
+
* (`'Fm'`, `'C#'`, `'Bb'`); anything else is a label to keep as given.
|
|
8
|
+
*
|
|
9
|
+
* @module keys
|
|
10
|
+
*/
|
|
11
|
+
/** Pitch class of each root spelling, C = 0. The theoretical spellings
|
|
12
|
+
* (Cb, B#, E#, Fb) are here so they merge with the keys they sound as. */
|
|
13
|
+
export declare const KEY_PITCH: Record<string, number>;
|
|
14
|
+
/**
|
|
15
|
+
* A key's parts: its root spelling, pitch class and mode.
|
|
16
|
+
*
|
|
17
|
+
* @param key - A normalised key (`'A#m'`).
|
|
18
|
+
* @returns null for a label that isn't a key.
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseKey(key: string | null | undefined): {
|
|
21
|
+
root: string;
|
|
22
|
+
pitch: number;
|
|
23
|
+
minor: boolean;
|
|
24
|
+
} | null;
|
|
25
|
+
/**
|
|
26
|
+
* What a key sounds as: pitch class and mode (`'10m'` for A#m and Bbm).
|
|
27
|
+
* Two keys are enharmonic when their classes match.
|
|
28
|
+
*
|
|
29
|
+
* @param key - A normalised key.
|
|
30
|
+
* @returns The class, or the label itself when it isn't a key (so it only
|
|
31
|
+
* ever matches itself).
|
|
32
|
+
*/
|
|
33
|
+
export declare function keyClass(key: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Is a sound in key `b` (the filter's) when it is written `a`? The same
|
|
36
|
+
* spelling always is; with `merge`, so is any enharmonic one.
|
|
37
|
+
*
|
|
38
|
+
* @param a - The sound's key.
|
|
39
|
+
* @param b - The filter's key.
|
|
40
|
+
* @param merge - Treat enharmonic spellings as one key.
|
|
41
|
+
*/
|
|
42
|
+
export declare function sameKey(a: string, b: string, merge?: boolean): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Sort rank of a key: by pitch from C, majors before minors; unknown
|
|
45
|
+
* labels after every key, no key at all last.
|
|
46
|
+
*
|
|
47
|
+
* @param key
|
|
48
|
+
*/
|
|
49
|
+
export declare function keyRank(key: string): number;
|
|
50
|
+
/**
|
|
51
|
+
* Every common spelling of a key (`'A#m'` → `['A#m', 'Bbm']`), for search:
|
|
52
|
+
* typing either finds both when keys are merged.
|
|
53
|
+
*
|
|
54
|
+
* @param key
|
|
55
|
+
*/
|
|
56
|
+
export declare function enharmonics(key: string): string[];
|
|
57
|
+
/**
|
|
58
|
+
* The spelling a merged key entry shows: the one the pack uses most; a
|
|
59
|
+
* tie goes to the conventional spelling (see {@link CONVENTIONAL_MAJOR})
|
|
60
|
+
* when it is one of the tied, else to the first in alphabetical order.
|
|
61
|
+
*
|
|
62
|
+
* @param counts - Each spelling of ONE key, with how many sounds use it.
|
|
63
|
+
*/
|
|
64
|
+
export declare function canonicalSpelling(counts: Map<string, number>): string;
|
|
65
|
+
/**
|
|
66
|
+
* The keys a list offers, merged or not: each entry once, in musical
|
|
67
|
+
* order, with the other spellings merged into it.
|
|
68
|
+
*
|
|
69
|
+
* @param keys - Every sound's key ('' for none), duplicates included.
|
|
70
|
+
* @param merge - Merge enharmonic spellings into one entry.
|
|
71
|
+
* @returns `keys` (the entries) and `aliases` (entry → the other spellings
|
|
72
|
+
* the list uses for it; only entries that have some).
|
|
73
|
+
*/
|
|
74
|
+
export declare function keyEntries(keys: string[], merge?: boolean): {
|
|
75
|
+
keys: string[];
|
|
76
|
+
aliases: Record<string, string[]>;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* The entry of `entries` a key belongs to: itself, or with `merge` the
|
|
80
|
+
* entry it is enharmonic to (`?key=A#m` on a list whose entry is Bbm).
|
|
81
|
+
*
|
|
82
|
+
* @param key - A normalised key.
|
|
83
|
+
* @param entries - The list's key entries ({@link keyEntries}).
|
|
84
|
+
* @param merge
|
|
85
|
+
* @returns The entry, or '' when the list has no such key.
|
|
86
|
+
*/
|
|
87
|
+
export declare function keyEntry(key: string, entries: string[], merge?: boolean): string;
|
|
88
|
+
//# sourceMappingURL=keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version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,26 +28,53 @@ export declare function rowTarget(key: string, at: number, count: number): numbe
|
|
|
28
28
|
* @returns The new position, or null for any other key.
|
|
29
29
|
*/
|
|
30
30
|
export declare function seekTarget(progress: number, key: string): number | null;
|
|
31
|
+
/** Where End seeks on a slider: just short of the end, so it can't end
|
|
32
|
+
* the sound (and with it auto-advance) by accident. */
|
|
33
|
+
export declare const SEEK_END = 0.999;
|
|
31
34
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
35
|
+
* The position Home / End seek to on a row's seek slider (the ARIA slider
|
|
36
|
+
* pattern: they go to the minimum / maximum, not to the first / last row).
|
|
34
37
|
*
|
|
35
|
-
* @
|
|
36
|
-
* @
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
* @param key - `KeyboardEvent.key`.
|
|
39
|
+
* @returns 0 for Home, {@link SEEK_END} for End, else null.
|
|
40
|
+
*/
|
|
41
|
+
export declare function sliderEdgeTarget(key: string): number | null;
|
|
42
|
+
/**
|
|
43
|
+
* Rows are rendered as they are revealed, never all up front: a page's
|
|
44
|
+
* worth, or with paging off this many at a time, more as the list
|
|
45
|
+
* scrolls toward its end. Since 2.2.0.
|
|
46
|
+
*/
|
|
47
|
+
export declare const RENDER_CHUNK = 50;
|
|
48
|
+
/**
|
|
49
|
+
* How many of the matching sounds have rows: the page, or with paging off
|
|
50
|
+
* the rows rendered so far (`budget`). The server renders the first of
|
|
51
|
+
* these ({@link firstRender}).
|
|
52
|
+
*
|
|
53
|
+
* @param matching - How many sounds match.
|
|
54
|
+
* @param limit - The page limit (Infinity when paging is off).
|
|
55
|
+
* @param budget - Rows rendered so far when paging is off.
|
|
56
|
+
*/
|
|
57
|
+
export declare function renderedCount(matching: number, limit: number, budget: number): number;
|
|
58
|
+
/**
|
|
59
|
+
* How many rows a list starts with: a page, or with paging off
|
|
60
|
+
* {@link RENDER_CHUNK}.
|
|
61
|
+
*
|
|
62
|
+
* @param pageSize - The `pageSize` option (0 = paging off).
|
|
63
|
+
*/
|
|
64
|
+
export declare function firstRender(pageSize: number): number;
|
|
65
|
+
/**
|
|
66
|
+
* The budget that renders position `pos` with paging off: whole chunks.
|
|
67
|
+
*
|
|
68
|
+
* @param budget - Rows rendered so far.
|
|
69
|
+
* @param pos - The position that must have a row.
|
|
39
70
|
*/
|
|
40
|
-
export declare function
|
|
41
|
-
visible: Set<T>;
|
|
42
|
-
remaining: number;
|
|
43
|
-
};
|
|
71
|
+
export declare function budgetToReveal(budget: number, pos: number): number;
|
|
44
72
|
/**
|
|
45
73
|
* The page limit that reveals position `pos` (used when playing past the
|
|
46
74
|
* end of the current page, e.g. by `next()` or auto-advance).
|
|
47
75
|
*
|
|
48
76
|
* @param limit - The current limit.
|
|
49
77
|
* @param pos - The position that must be visible.
|
|
50
|
-
* @returns
|
|
51
78
|
*/
|
|
52
79
|
export declare function limitToReveal(limit: number, pos: number): number;
|
|
53
80
|
//# sourceMappingURL=navigation.d.ts.map
|