@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.
Files changed (79) hide show
  1. package/README.md +44 -2
  2. package/dist/waveform-sounds-no-autoinit.esm.js +914 -208
  3. package/dist/waveform-sounds-render.esm.js +274 -82
  4. package/dist/waveform-sounds.css +92 -17
  5. package/dist/waveform-sounds.esm.js +917 -210
  6. package/dist/waveform-sounds.js +913 -210
  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 +92 -17
  11. package/src/js/core/WaveformSounds.ts +540 -120
  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 +1 -5
  15. package/src/js/data/bpm.ts +14 -4
  16. package/src/js/data/keys.ts +156 -0
  17. package/src/js/data/navigation.ts +51 -11
  18. package/src/js/data/sounds.ts +73 -36
  19. package/src/js/data/url-state.ts +39 -12
  20. package/src/js/dom/colors.ts +28 -1
  21. package/src/js/dom/draw.ts +16 -3
  22. package/src/js/dom/menus.ts +2 -3
  23. package/src/js/dom/rows.ts +38 -15
  24. package/src/js/entry.ts +13 -3
  25. package/src/js/index.ts +7 -3
  26. package/src/js/render/html.ts +0 -2
  27. package/src/js/render/icons.ts +59 -17
  28. package/src/js/render/markup.ts +156 -62
  29. package/src/js/render/options.ts +29 -5
  30. package/src/js/render/strings.ts +57 -4
  31. package/src/js/render-entry.ts +1 -1
  32. package/src/js/shared/utils.ts +4 -4
  33. package/src/js/types.ts +54 -3
  34. package/types/core/WaveformSounds.d.ts +41 -11
  35. package/types/core/WaveformSounds.d.ts.map +1 -1
  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 +8 -3
  39. package/types/core/engine.d.ts.map +1 -1
  40. package/types/core/options.d.ts +0 -5
  41. package/types/core/options.d.ts.map +1 -1
  42. package/types/data/bpm.d.ts +17 -4
  43. package/types/data/bpm.d.ts.map +1 -1
  44. package/types/data/keys.d.ts +88 -0
  45. package/types/data/keys.d.ts.map +1 -0
  46. package/types/data/navigation.d.ts +38 -11
  47. package/types/data/navigation.d.ts.map +1 -1
  48. package/types/data/sounds.d.ts +33 -17
  49. package/types/data/sounds.d.ts.map +1 -1
  50. package/types/data/url-state.d.ts +38 -7
  51. package/types/data/url-state.d.ts.map +1 -1
  52. package/types/dom/colors.d.ts +13 -0
  53. package/types/dom/colors.d.ts.map +1 -1
  54. package/types/dom/draw.d.ts +5 -3
  55. package/types/dom/draw.d.ts.map +1 -1
  56. package/types/dom/menus.d.ts +0 -2
  57. package/types/dom/menus.d.ts.map +1 -1
  58. package/types/dom/rows.d.ts +19 -11
  59. package/types/dom/rows.d.ts.map +1 -1
  60. package/types/entry.d.ts +10 -4
  61. package/types/entry.d.ts.map +1 -1
  62. package/types/index.d.ts +2 -2
  63. package/types/index.d.ts.map +1 -1
  64. package/types/render/html.d.ts +0 -2
  65. package/types/render/html.d.ts.map +1 -1
  66. package/types/render/icons.d.ts +41 -3
  67. package/types/render/icons.d.ts.map +1 -1
  68. package/types/render/markup.d.ts +44 -12
  69. package/types/render/markup.d.ts.map +1 -1
  70. package/types/render/options.d.ts +18 -5
  71. package/types/render/options.d.ts.map +1 -1
  72. package/types/render/strings.d.ts +22 -4
  73. package/types/render/strings.d.ts.map +1 -1
  74. package/types/render-entry.d.ts +1 -1
  75. package/types/render-entry.d.ts.map +1 -1
  76. package/types/shared/utils.d.ts +3 -3
  77. package/types/shared/utils.d.ts.map +1 -1
  78. package/types/types.d.ts +53 -3
  79. package/types/types.d.ts.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/js/data/navigation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,oDAAoD;AACpD,eAAO,MAAM,SAAS,MAAM,CAAC;AAE7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gB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAErF;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAElE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhE"}
@@ -20,9 +20,11 @@ export declare function encodePeaks(peaks: number[]): string;
20
20
  /**
21
21
  * Decode peaks from any accepted form into numbers 0..1.
22
22
  *
23
- * Accepts the hex string from {@link encodePeaks}, an array of 0..1
24
- * numbers, or an array of integers on a larger scale (e.g. 0..100 or
25
- * 0..255) together with that `scale`.
23
+ * Accepts the hex string from {@link encodePeaks}, the player's compact
24
+ * `wp1:` string (`"wp1:"` + base64url of one byte per peak, what the 2.0
25
+ * core and waveform-gen write), an array of 0..1 numbers, or an array of
26
+ * integers on a larger scale (e.g. 0..100 or 0..255) together with that
27
+ * `scale`. Server markup still writes hex.
26
28
  *
27
29
  * @param value
28
30
  * @param scale - The maximum of an integer array.
@@ -50,10 +52,17 @@ export declare function normalizeKey(key: string | null | undefined): string;
50
52
  * @returns e.g. "0:08", "0.4s", or '' when unknown.
51
53
  */
52
54
  export declare function formatDuration(seconds: number | null | undefined): string;
55
+ /**
56
+ * A playback position as a clock: whole seconds, rounded down like a
57
+ * player's ("0:12", "1:05:09" past an hour).
58
+ *
59
+ * @param seconds
60
+ * @returns e.g. "0:12"; "0:00" for anything unusable.
61
+ */
62
+ export declare function formatClock(seconds: number): string;
53
63
  /**
54
64
  * Parse a duration given as seconds (8.02) or as "m:ss" / "h:mm:ss".
55
65
  * @param value
56
- * @returns
57
66
  */
58
67
  export declare function parseDuration(value: number | string | null | undefined): number | null;
59
68
  /**
@@ -61,7 +70,6 @@ export declare function parseDuration(value: number | string | null | undefined)
61
70
  * leading pack prefixes kept (they are often the label's code).
62
71
  * "NW_Bass_Loop_04_128_Fmin.wav" → "NW Bass Loop 04 128 Fmin".
63
72
  * @param url
64
- * @returns
65
73
  */
66
74
  export declare function titleFromUrl(url: string): string;
67
75
  /**
@@ -85,7 +93,6 @@ export declare const LOOP_FILTERS: string[];
85
93
  * as an attribute or a CSV-ish manifest writes it. Unset is a one-shot.
86
94
  *
87
95
  * @param value
88
- * @returns
89
96
  */
90
97
  export declare function isLoop(value: unknown): boolean;
91
98
  /**
@@ -94,7 +101,6 @@ export declare function isLoop(value: unknown): boolean;
94
101
  * Sounds without a url are dropped.
95
102
  *
96
103
  * @param manifest
97
- * @returns
98
104
  */
99
105
  export declare function parseManifest(manifest: SoundsManifest | SoundInput[]): Sound[];
100
106
  /**
@@ -102,24 +108,32 @@ export declare function parseManifest(manifest: SoundsManifest | SoundInput[]):
102
108
  * (a repeated id would make two rows answer to one play() call).
103
109
  * @param list
104
110
  * @param peakScale
105
- * @returns
106
111
  */
107
112
  export declare function normalizeSounds(list: SoundInput[], peakScale?: number): Sound[];
113
+ /** Options of the pure filter helpers ({@link facets}, {@link matches}). */
114
+ export interface KeyOptions {
115
+ /** Enharmonic keys (A#m and Bbm) are one key. Default true. Since 2.2.0. */
116
+ mergeEnharmonicKeys?: boolean;
117
+ }
108
118
  /**
109
119
  * What the filter controls offer, derived from the sounds: each type with
110
- * its count (in first-seen order), each key (in musical order), the BPM
111
- * range, and how many are loops and one-shots. A control with nothing to
112
- * offer is not rendered.
120
+ * its count (in first-seen order), each key (in musical order; enharmonic
121
+ * spellings merged into one entry unless `mergeEnharmonicKeys` is false —
122
+ * see `keyEntries` for the spelling it shows), the BPM range, and how many
123
+ * are loops and one-shots. A control with nothing to offer is not rendered.
113
124
  *
114
125
  * @param sounds
115
- * @returns
126
+ * @param options
127
+ * @returns `keyAliases`: each merged key entry's other spellings in the
128
+ * list (since 2.2.0).
116
129
  */
117
- export declare function facets(sounds: Sound[]): {
130
+ export declare function facets(sounds: Sound[], options?: KeyOptions): {
118
131
  types: {
119
132
  name: string;
120
133
  count: number;
121
134
  }[];
122
135
  keys: string[];
136
+ keyAliases: Record<string, string[]>;
123
137
  bpm: {
124
138
  min: number;
125
139
  max: number;
@@ -138,11 +152,15 @@ export declare function facets(sounds: Sound[]): {
138
152
  * number in the query also matches the BPM exactly, so "bass 128" finds
139
153
  * 128 BPM bass loops.
140
154
  *
155
+ * Keys: unless `mergeEnharmonicKeys` is false, a key filter matches every
156
+ * spelling of that key (A#m finds Bbm too), and a key typed in the search
157
+ * finds its other spellings.
158
+ *
141
159
  * @param sound
142
160
  * @param filter
143
- * @returns
161
+ * @param options
144
162
  */
145
- export declare function matches(sound: Sound, filter?: Partial<SoundsFilter>): boolean;
163
+ export declare function matches(sound: Sound, filter?: Partial<SoundsFilter>, options?: KeyOptions): boolean;
146
164
  /** The sort orders the toolbar offers. */
147
165
  export declare const SORTS: SoundsSort[];
148
166
  /**
@@ -152,7 +170,6 @@ export declare const SORTS: SoundsSort[];
152
170
  *
153
171
  * @param sorts - The configured orders.
154
172
  * @param f - The sounds' facets.
155
- * @returns
156
173
  */
157
174
  export declare function availableSorts(sorts: string[], f: ReturnType<typeof facets>): string[];
158
175
  /**
@@ -161,7 +178,6 @@ export declare function availableSorts(sorts: string[], f: ReturnType<typeof fac
161
178
  *
162
179
  * @param sounds
163
180
  * @param by
164
- * @returns
165
181
  */
166
182
  export declare function sortSounds(sounds: Sound[], by?: SoundsSort): Sound[];
167
183
  //# sourceMappingURL=sounds.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sounds.d.ts","sourceRoot":"","sources":["../../src/js/data/sounds.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAC,MAAM,aAAa,CAAC;AAE7F;;;;;;;GA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AAM,EAAE,KAAK,EAAE,EAAE,OAAO,GAAE,UAAe,GAAG;IAAC,KAAK,EAAE;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAAC,GAAG,EAAE;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAC,GAAC,IAAI,CAAC;IAAC,WAAW,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,CAqB7P;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,GAAE,OAAO,CAAC,YAAY,CAAM,EAAE,OAAO,GAAE,UAAe,GAAG,OAAO,CAuB3G;AAED,0CAA0C;AAC1C,eAAO,MAAM,KAAK,EAAE,UAAU,EAAmD,CAAC;AAWlF;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,GAAG,MAAM,EAAE,CAEtF;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,GAAE,UAAsB,GAAG,KAAK,EAAE,CAW/E"}
@@ -15,7 +15,6 @@ import type { SoundsFilter } from '../types.js';
15
15
  * page don't share a filter.
16
16
  *
17
17
  * @param urlState
18
- * @returns
19
18
  */
20
19
  export declare function urlKeys(urlState: boolean | string | null | undefined): {
21
20
  q: string;
@@ -26,7 +25,9 @@ export declare function urlKeys(urlState: boolean | string | null | undefined):
26
25
  sort: string;
27
26
  } | null;
28
27
  /**
29
- * A BPM range parameter: "120-130", "120-" or "-130".
28
+ * A BPM range parameter: "120-130", "120-", "-130", or with decimals
29
+ * ("128.5-130", what `setFilter({bpmMin: 128.5})` writes). Reversed ends
30
+ * are put in order.
30
31
  *
31
32
  * @param value
32
33
  * @returns null if malformed.
@@ -35,25 +36,49 @@ export declare function parseBpmRange(value: string | null | undefined): {
35
36
  bpmMin: string;
36
37
  bpmMax: string;
37
38
  } | null;
39
+ /**
40
+ * Keep only the limits that fall inside the pack's BPM range: a link made
41
+ * for another pack (`?bpm=200-` on one topping out at 174) must not empty
42
+ * the list, and a limit beyond an end is no limit at all.
43
+ *
44
+ * @param range - From {@link parseBpmRange}.
45
+ * @param extent - The slider's range; null when the pack has no BPMs
46
+ * (then any BPM filter would hide everything, so none is kept).
47
+ * @returns The usable limits, or null when none is left.
48
+ */
49
+ export declare function bpmRangeWithin(range: {
50
+ bpmMin: string;
51
+ bpmMax: string;
52
+ }, extent: {
53
+ min: number;
54
+ max: number;
55
+ } | null): {
56
+ bpmMin: string;
57
+ bpmMax: string;
58
+ } | null;
38
59
  /**
39
60
  * The inverse of {@link parseBpmRange}; '' when neither end is set.
40
61
  *
41
62
  * @param min
42
63
  * @param max
43
- * @returns
44
64
  */
45
65
  export declare function formatBpmRange(min: string | number | null | undefined, max: string | number | null | undefined): string;
46
66
  /**
47
67
  * Read the filter and sort from a query string. Values the list can't use
48
- * (a type it doesn't have, a key no sound is in, a loops filter on a list
49
- * that isn't a mix of loops and one-shots, a sort it doesn't offer)
68
+ * (a type it doesn't have, a key no sound is in, a BPM limit outside its
69
+ * range, a loops filter on a list that isn't a mix of loops and one-shots,
70
+ * a sort it doesn't offer)
50
71
  * are ignored, never applied: a stale link shows the whole list, not an
51
72
  * empty one.
52
73
  *
53
74
  * @param search - `location.search`.
54
75
  * @param keys
55
- * @param available - From `facets()`.
76
+ * @param available - From `facets()`, with `bpm` as the slider's range
77
+ * (`bpmExtent()`).
56
78
  * @param sorts - The sort orders offered.
79
+ * @param options
80
+ * @param options.mergeEnharmonicKeys - A key in either spelling selects
81
+ * the list's entry for it (`?key=A#m` → `Bbm`). Default true. Since 2.2.0.
57
82
  * @returns A filter patch, and the sort (or null).
58
83
  */
59
84
  export declare function readUrlState(search: string, keys: ReturnType<typeof urlKeys>, available: {
@@ -63,7 +88,13 @@ export declare function readUrlState(search: string, keys: ReturnType<typeof url
63
88
  keys: string[];
64
89
  loops?: number;
65
90
  oneShots?: number;
66
- }, sorts: string[]): {
91
+ bpm?: {
92
+ min: number;
93
+ max: number;
94
+ } | null;
95
+ }, sorts: string[], options?: {
96
+ mergeEnharmonicKeys?: boolean;
97
+ }): {
67
98
  filter: Partial<SoundsFilter>;
68
99
  sort: string | null;
69
100
  };
@@ -1 +1 @@
1
- {"version":3,"file":"url-state.d.ts","sourceRoot":"","sources":["../../src/js/data/url-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAC,YAAY,EAAmB,MAAM,aAAa,CAAC;AAEhE;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,GAAG,IAAI,CAI7J;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAC,GAAG,IAAI,CAGvG;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAG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AAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,OAAO,OAAO,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAW7I"}
@@ -23,6 +23,19 @@ export declare function parseAlpha(color: string | null | undefined): number;
23
23
  * @returns A computed colour, or `#fff` when nothing is painted.
24
24
  */
25
25
  export declare function pageSurface(el: Element, minAlpha?: number): string;
26
+ /**
27
+ * Is the page in forced colours (Windows High Contrast)? Then the canvas
28
+ * must draw in system colours too.
29
+ */
30
+ export declare function forcedColors(): boolean;
31
+ /**
32
+ * Every element above `el`, nearest first, crossing shadow-root boundaries
33
+ * (the elements whose class, style or theme attribute can change what the
34
+ * list inherits).
35
+ *
36
+ * @param el
37
+ */
38
+ export declare function ancestorsOf(el: Element): Element[];
26
39
  /**
27
40
  * Resolve any CSS colour (a `var()`, `color-mix()`, `currentColor`) to a
28
41
  * concrete value, as it would compute inside `container`.
@@ -1 +1 @@
1
- {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/js/dom/colors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAQnE;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE,QAAQ,GAAE,MAAa,GAAG,MAAM,CAMxE;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAQzE"}
1
+ {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/js/dom/colors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAQnE;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE,QAAQ,GAAE,MAAa,GAAG,MAAM,CAMxE;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAMtC;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,OAAO,GAAG,OAAO,EAAE,CAIlD;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAUzE"}
@@ -20,8 +20,11 @@ export declare function fitCanvas(canvas: HTMLCanvasElement): {
20
20
  dpr: number;
21
21
  } | null;
22
22
  /**
23
- * Resample peaks to `count` bars (max of each bucket, so transients
24
- * survive the downsample).
23
+ * Resample peaks to `count` bars, whatever their number (64 or 128 from
24
+ * waveform-gen, any length of `wp1:`). Fewer bars than peaks: the max of
25
+ * each bucket, so transients survive. More bars than peaks: linear
26
+ * interpolation between neighbouring peaks — repeating each peak drew
27
+ * flat steps (64 peaks across a 400px row were plateaus three bars wide).
25
28
  * @param peaks
26
29
  * @param count
27
30
  */
@@ -38,7 +41,6 @@ export declare function resample(peaks: number[], count: number): any[];
38
41
  * @param width - Canvas width (CSS px).
39
42
  * @param height - Canvas height (CSS px).
40
43
  * @param o
41
- * @returns
42
44
  */
43
45
  export declare function barRects(peaks: number[], width: number, height: number, o: {
44
46
  style: 'mirror' | 'bars';
@@ -1 +1 @@
1
- {"version":3,"file":"draw.d.ts","sourceRoot":"","sources":["../../src/js/dom/draw.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,iBAAiB;;;;SAQlD;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,SAatD;AAED;;;;;;;;;;;;;GAaG;AACH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;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAC,EAAE,CActL;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,EAAE;IAAC,KAAK,EAAE,QAAQ,GAAC,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAC,QA6BvM"}
@@ -20,7 +20,6 @@
20
20
  *
21
21
  * @param label
22
22
  * @param query
23
- * @returns
24
23
  */
25
24
  export declare function optionMatches(label: string, query: string): boolean;
26
25
  /**
@@ -29,7 +28,6 @@ export declare function optionMatches(label: string, query: string): boolean;
29
28
  * @param current - -1 when nothing is active.
30
29
  * @param delta
31
30
  * @param length
32
- * @returns
33
31
  */
34
32
  export declare function stepIndex(current: number, delta: number, length: number): number;
35
33
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"menus.d.ts","sourceRoot":"","sources":["../../src/js/dom/menus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAGnE;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEhF;AA8BD;;GAEG;AACH,qBAAa,KAAK;IAGd,4DAA4D;IACpD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC3C,4CAA4C;IACpC,Q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AAW,QAWrB;IAED;;;;;OAKG;IACH,KAAK,CAAC,WAAW,EAAE,OAAO,QAQzB;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAYnC;CAsEJ"}
@@ -1,18 +1,27 @@
1
1
  /**
2
- * The rows in the DOM: reading server-rendered rows back into sounds, and
3
- * finding a row by the sound it shows.
2
+ * The rows in the DOM: reading server-rendered sounds back, finding a row
3
+ * by the sound it shows, and putting exactly the rows shown in the list.
4
4
  *
5
5
  * @module rows
6
6
  */
7
7
  import type { Sound } from '../types.js';
8
8
  /**
9
- * Read server-rendered rows back into sounds. Rows are taken in their
9
+ * Read the sounds of server-rendered markup from its JSON
10
+ * (`<script type="application/json" data-ws-sounds>`, since 2.2.0).
11
+ *
12
+ * @param root - The list's container.
13
+ * @returns The sounds, or null when there is no (usable) JSON — then the
14
+ * rows themselves are read ({@link readRows}, markup from before 2.2).
15
+ */
16
+ export declare function readSoundsData(root: HTMLElement): Sound[] | null;
17
+ /**
18
+ * Read server-rendered rows back into sounds (markup from before 2.2.0,
19
+ * whose rows carry every field as a `data-*` attribute). Rows are taken in their
10
20
  * original order (`data-ws-index`) and renumbered 0..n-1, and a row whose
11
21
  * data is unusable (no url) is removed — so a row missing from the markup
12
22
  * can't leave a hole that would misalign rows and sounds.
13
23
  *
14
24
  * @param list - The `[data-ws-list]` element.
15
- * @returns
16
25
  */
17
26
  export declare function readRows(list: HTMLElement): Sound[];
18
27
  /**
@@ -20,23 +29,22 @@ export declare function readRows(list: HTMLElement): Sound[];
20
29
  * they're displayed in).
21
30
  *
22
31
  * @param list
23
- * @returns
24
32
  */
25
33
  export declare function indexRows(list: HTMLElement): HTMLElement[];
26
34
  /**
27
- * The rows currently visible (not hidden by the filter or the page), in
28
- * display order.
35
+ * The rows in the list (not hidden), in display order.
29
36
  *
30
37
  * @param list
31
- * @returns
32
38
  */
33
39
  export declare function visibleRows(list: HTMLElement): HTMLElement[];
34
40
  /**
35
- * Put the rows in the given order. Every row moves (hidden ones too), so
36
- * clearing a filter keeps the order.
41
+ * Make the list hold exactly `rows`, in that order: rows not among them
42
+ * leave the DOM, new ones go in, and rows already in order are not moved
43
+ * (moving an element drops its focus, so a filter change keeps focus
44
+ * where it was; only a re-sort moves rows).
37
45
  *
38
46
  * @param list
39
47
  * @param rows - In the order to show them.
40
48
  */
41
- export declare function orderRows(list: HTMLElement, rows: HTMLElement[]): void;
49
+ export declare function layoutRows(list: HTMLElement, rows: HTMLElement[]): void;
42
50
  //# sourceMappingURL=rows.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rows.d.ts","sourceRoot":"","sources":["../../src/js/dom/rows.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAKvC;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,KAAK,EAAE,CAenD;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,EAAE,CAI1D;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,EAAE,CAE5D;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,QAI/D"}
1
+ {"version":3,"file":"rows.d.ts","sourceRoot":"","sources":["../../src/js/dom/rows.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAKvC;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,KAAK,EAAE,GAAG,IAAI,CAShE;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,KAAK,EAAE,CAenD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,EAAE,CAI1D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,WAAW,EAAE,CAE5D;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,IAAI,CAQvE"}
package/types/entry.d.ts CHANGED
@@ -1,12 +1,14 @@
1
1
  /**
2
2
  * @arraypress/waveform-sounds — public surface, without the import-time
3
- * auto-init scan (`index.js` adds that). Anything new belongs here.
3
+ * side effects: the auto-init scan and registering `<waveform-sounds>`
4
+ * (`index.js` adds those). Anything new belongs here.
4
5
  *
5
6
  * @module entry
6
7
  */
7
8
  import { WaveformSounds, DEFAULT_OPTIONS } from './core/WaveformSounds.js';
9
+ import { WaveformSoundsElement, defineWaveformSoundsElement } from './core/element.js';
8
10
  import { encodePeaks, decodePeaks, normalizeKey, normalizeSounds, parseManifest, facets, matches, sortSounds, formatDuration } from './data/sounds.js';
9
- import { renderSounds, renderSoundsElement, DEFAULT_STRINGS } from './render/markup.js';
11
+ import { renderSounds, renderSoundsElement, DEFAULT_STRINGS, RENDER_OPTION_KEYS, pickRenderOptions } from './render/markup.js';
10
12
  import type { WaveformSoundsEventMap } from './types.js';
11
13
  declare global {
12
14
  interface Window {
@@ -15,8 +17,12 @@ declare global {
15
17
  }
16
18
  interface HTMLElementEventMap extends WaveformSoundsEventMap {
17
19
  }
20
+ interface DocumentEventMap extends WaveformSoundsEventMap {
21
+ }
22
+ interface WindowEventMap extends WaveformSoundsEventMap {
23
+ }
18
24
  }
19
25
  export default WaveformSounds;
20
- export { WaveformSounds, DEFAULT_OPTIONS, DEFAULT_STRINGS, encodePeaks, decodePeaks, normalizeKey, normalizeSounds, parseManifest, facets, matches, sortSounds, formatDuration, renderSounds, renderSoundsElement, };
21
- export type { SoundInput, Sound, SoundsManifest, SoundsFilter, SoundsLoopFilter, SoundsSort, SoundsLayout, SoundsFilterControl, SoundsColumn, WaveformSoundsStrings, WaveformSoundsOptions, WaveformSoundsEventMap, } from './types.js';
26
+ export { WaveformSounds, DEFAULT_OPTIONS, DEFAULT_STRINGS, encodePeaks, decodePeaks, normalizeKey, normalizeSounds, parseManifest, facets, matches, sortSounds, formatDuration, renderSounds, renderSoundsElement, RENDER_OPTION_KEYS, pickRenderOptions, WaveformSoundsElement, defineWaveformSoundsElement, };
27
+ export type { SoundInput, Sound, SoundsManifest, SoundsFilter, SoundsLoopFilter, SoundsSort, SoundsLayout, SoundsFilterControl, SoundsColumn, WaveformSoundsStrings, WaveformSoundsOptions, WaveformSoundsEventMap, WaveformSoundsInstanceEventMap, } from './types.js';
22
28
  //# sourceMappingURL=entry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../src/js/entry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAC,cAAc,EAAE,eAAe,EAAC,MAAM,0BAA0B,CAAC;AACzE,OAAO,EACH,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,cAAc,EACtH,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAC,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAC,MAAM,oBAAoB,CAAC;AACtF,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,YAAY,CAAC;AAEvD,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,qEAAqE;QACrE,cAAc,EAAE,OAAO,cAAc,CAAC;KACzC;IACD,UAAU,mBAAoB,SAAQ,sBAAsB;KAAG;CAClE;eASc,cAAc;AAC7B,OAAO,EACH,cAAc,EAAE,eAAe,EAAE,eAAe,EAChD,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE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,EACxE,qBAAqB,EAAE,2BAA2B,GACrD,CAAC;AAGF,YAAY,EACR,UAAU,EACV,KAAK,EACL,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,YAAY,EACZ,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,8BAA8B,GACjC,MAAM,YAAY,CAAC"}
package/types/index.d.ts CHANGED
@@ -2,8 +2,8 @@
2
2
  * @arraypress/waveform-sounds
3
3
  * A searchable, filterable list of sounds for WaveformPlayer.
4
4
  *
5
- * Importing this entry initialises every `[data-waveform-sounds]` element
6
- * once the DOM is ready. Opt out page-wide with
5
+ * Importing this entry registers `<waveform-sounds>` and initialises every
6
+ * `[data-waveform-sounds]` element once the DOM is ready. Opt out page-wide with
7
7
  * `<html data-waveform-autoinit="false">` (the family's switch), or import
8
8
  * `@arraypress/waveform-sounds/no-autoinit`.
9
9
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/js/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,cAAc,MAAM,YAAY,CAAC;AAExC,cAAc,YAAY,CAAC;eACZ,cAAc"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/js/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,cAA6C,MAAM,YAAY,CAAC;AAEvE,cAAc,YAAY,CAAC;eACZ,cAAc"}
@@ -17,7 +17,6 @@ export type HtmlChild = string | false | null | undefined | HtmlChild[];
17
17
  * Escape text for use as a child.
18
18
  *
19
19
  * @param value
20
- * @returns
21
20
  */
22
21
  export declare function text(value: unknown): string;
23
22
  /**
@@ -33,7 +32,6 @@ export declare function attrs(map?: HtmlAttrs): string;
33
32
  * @param tag
34
33
  * @param attributes
35
34
  * @param children - HTML strings; falsy ones and nested arrays are flattened away.
36
- * @returns
37
35
  */
38
36
  export declare function h(tag: string, attributes?: HtmlAttrs, ...children: HtmlChild[]): string;
39
37
  //# sourceMappingURL=html.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/js/render/html.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,8FAA8F;AAC9F,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;AAErF,wEAAwE;AACxE,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,EAAE,CAAC;AAKxE;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAE3C;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,GAAG,GAAE,SAAc,GAAG,MAAM,CAOjD;AAED;;;;;;;GAOG;AACH,wBAAgB,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,GAAE,SAAc,EAAE,GAAG,QAAQ,EAAE,SAAS,EAAE,GAAG,MAAM,CAI3F"}
1
+ {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/js/render/html.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,8FAA8F;AAC9F,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;AAErF,wEAAwE;AACxE,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,EAAE,CAAC;AAKxE;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAE3C;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,GAAG,GAAE,SAAc,GAAG,MAAM,CAOjD;AAED;;;;;;GAMG;AACH,wBAAgB,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,GAAE,SAAc,EAAE,GAAG,QAAQ,EAAE,SAAS,EAAE,GAAG,MAAM,CAI3F"}
@@ -1,11 +1,19 @@
1
1
  /**
2
2
  * The list's icons: 24×24 single-path SVGs that take `currentColor`, so
3
- * they follow whatever colour their control has. Decorative (aria-hidden);
4
- * every control carries its own label.
3
+ * they follow whatever colour their control has (and the system colours
4
+ * under forced colours). Decorative (aria-hidden); every control carries
5
+ * its own label.
6
+ *
7
+ * Each icon is defined ONCE per list, as a `<symbol>` in a hidden sprite
8
+ * ({@link iconSprite}), and every use is a `<use>` of it ({@link icon}):
9
+ * a row's play and pause icons were ~240 bytes of inline paths, on every
10
+ * row. The symbol ids carry the list's id prefix, so two lists on a page
11
+ * never share (or break) each other's icons. Since 2.2.0.
5
12
  *
6
13
  * @module icons
7
14
  */
8
- export declare const ICONS: {
15
+ /** Every icon's path data. */
16
+ export declare const ICON_PATHS: {
9
17
  play: string;
10
18
  pause: string;
11
19
  search: string;
@@ -14,4 +22,34 @@ export declare const ICONS: {
14
22
  download: string;
15
23
  loop: string;
16
24
  };
25
+ /** An icon's name. */
26
+ export type IconName = keyof typeof ICON_PATHS;
27
+ /** Every icon, in sprite order. */
28
+ export declare const ICON_NAMES: IconName[];
29
+ /**
30
+ * A symbol's id: the list's id prefix + the icon (`ws1x9k2f-i-play`).
31
+ *
32
+ * @param id - The list's id prefix.
33
+ * @param name
34
+ */
35
+ export declare function iconId(id: string, name: IconName): string;
36
+ /**
37
+ * The sprite: one hidden `<svg>` holding a `<symbol>` for each icon the
38
+ * list uses. Zero-sized by its attributes (no CSS needed, no style
39
+ * attribute for a CSP to block), not `display: none` (some engines drop
40
+ * what a hidden SVG defines). `data-ws-sprite` names the id prefix, so the
41
+ * runtime renders new rows against the same symbols.
42
+ *
43
+ * @param id - The list's id prefix.
44
+ * @param names - The icons to define.
45
+ */
46
+ export declare function iconSprite(id: string, names: IconName[]): string;
47
+ /**
48
+ * One icon: a `<use>` of its symbol in the list's sprite.
49
+ *
50
+ * @param id - The list's id prefix.
51
+ * @param name
52
+ * @param extraClass - Classes beyond `ws-icon`.
53
+ */
54
+ export declare function icon(id: string, name: IconName, extraClass?: string): string;
17
55
  //# sourceMappingURL=icons.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/js/render/icons.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAcH,eAAO,MAAM,KAAK;IACd,IAAI;IACJ,KAAK;IACL,MAAM;IACN,OAAO;IACP,KAAK;IACL,QAAQ;IACR,IAAI;CACP,CAAC"}
1
+ {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/js/render/icons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,8BAA8B;AAC9B,eAAO,MAAM,UAAU;IACnB,IAAI;IACJ,KAAK;IACL,MAAM;IACN,OAAO;IACP,KAAK;IACL,QAAQ;IACR,IAAI;CACP,CAAC;AAEF,sBAAsB;AACtB,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,UAAU,CAAC;AAE/C,mCAAmC;AACnC,eAAO,MAAM,UAAU,EAA8B,QAAQ,EAAE,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,CAEzD;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,CAIhE;AAED;;;;;;GAMG;AACH,wBAAgB,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,GAAE,MAAW,GAAG,MAAM,CAGhF"}