wavesurfer.js 6.0.1 → 6.0.2

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 (32) hide show
  1. package/CHANGES.md +15 -5
  2. package/dist/plugin/wavesurfer.cursor.js +1 -1
  3. package/dist/plugin/wavesurfer.cursor.min.js +1 -1
  4. package/dist/plugin/wavesurfer.elan.js +1 -1
  5. package/dist/plugin/wavesurfer.elan.min.js +1 -1
  6. package/dist/plugin/wavesurfer.markers.js +1 -1
  7. package/dist/plugin/wavesurfer.markers.min.js +1 -1
  8. package/dist/plugin/wavesurfer.mediasession.js +1 -1
  9. package/dist/plugin/wavesurfer.mediasession.min.js +1 -1
  10. package/dist/plugin/wavesurfer.microphone.js +1 -1
  11. package/dist/plugin/wavesurfer.microphone.min.js +1 -1
  12. package/dist/plugin/wavesurfer.minimap.js +1 -1
  13. package/dist/plugin/wavesurfer.minimap.min.js +1 -1
  14. package/dist/plugin/wavesurfer.playhead.js +1 -1
  15. package/dist/plugin/wavesurfer.playhead.min.js +1 -1
  16. package/dist/plugin/wavesurfer.regions.js +1 -1
  17. package/dist/plugin/wavesurfer.regions.js.map +1 -1
  18. package/dist/plugin/wavesurfer.regions.min.js +1 -1
  19. package/dist/plugin/wavesurfer.regions.min.js.map +1 -1
  20. package/dist/plugin/wavesurfer.spectrogram.js +1 -1
  21. package/dist/plugin/wavesurfer.spectrogram.min.js +1 -1
  22. package/dist/plugin/wavesurfer.timeline.js +1 -1
  23. package/dist/plugin/wavesurfer.timeline.min.js +1 -1
  24. package/dist/wavesurfer-html-init.js +1 -1
  25. package/dist/wavesurfer-html-init.min.js +1 -1
  26. package/dist/wavesurfer.js +11 -8
  27. package/dist/wavesurfer.js.map +1 -1
  28. package/dist/wavesurfer.min.js +2 -2
  29. package/dist/wavesurfer.min.js.map +1 -1
  30. package/package.json +4 -4
  31. package/src/drawer.canvasentry.js +9 -6
  32. package/src/plugin/regions/index.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wavesurfer.js",
3
- "version": "6.0.1",
3
+ "version": "6.0.2",
4
4
  "description": "Interactive navigable audio visualization using Web Audio and Canvas",
5
5
  "main": "dist/wavesurfer.js",
6
6
  "directories": {
@@ -55,7 +55,7 @@
55
55
  "visualization"
56
56
  ],
57
57
  "devDependencies": {
58
- "@babel/core": "^7.17.2",
58
+ "@babel/core": "^7.17.5",
59
59
  "@babel/eslint-parser": "^7.17.0",
60
60
  "@babel/plugin-proposal-class-properties": "^7.16.7",
61
61
  "@babel/preset-env": "^7.16.11",
@@ -86,10 +86,10 @@
86
86
  "karma-jasmine-matchers": "5.0.0",
87
87
  "karma-verbose-reporter": "0.0.8",
88
88
  "karma-webpack": "^5.0.0",
89
- "lint-staged": "^12.3.3",
89
+ "lint-staged": "^12.3.4",
90
90
  "load-script": "^2.0.0",
91
91
  "pre-commit": "^1.2.2",
92
- "webpack": "^5.68.0",
92
+ "webpack": "^5.69.1",
93
93
  "webpack-cli": "^4.9.2",
94
94
  "webpack-dev-server": "^4.7.4",
95
95
  "webpack-merge": "^5.8.0"
@@ -161,17 +161,20 @@ export default class CanvasEntry {
161
161
  /**
162
162
  * Utility function to handle wave color arguments
163
163
  *
164
- * When the color argument type is a string, it will be returned as is.
165
- * Otherwise, it will be treated as an array, and a canvas gradient will
166
- * be returned
164
+ * When the color argument type is a string or CanvasGradient instance,
165
+ * it will be returned as is. Otherwise, it will be treated as an array,
166
+ * and a new CanvasGradient will be returned
167
167
  *
168
168
  * @since 6.0.0
169
169
  * @param {CanvasRenderingContext2D} ctx Rendering context of target canvas
170
- * @param {string|string[]} color Fill color for the wave canvas, or an array of colors to apply as a gradient
171
- * @returns {string|CanvasGradient} Returns a string fillstyle value, or a canvas gradient
170
+ * @param {string|string[]|CanvasGradient} color Either a single fill color
171
+ * for the wave canvas, an existing CanvasGradient instance, or an array
172
+ * of colors to apply as a gradient
173
+ * @returns {string|CanvasGradient} Returns a string fillstyle value, or a
174
+ * canvas gradient
172
175
  */
173
176
  getFillStyle(ctx, color) {
174
- if (typeof color == 'string') {
177
+ if (typeof color == 'string' || color instanceof CanvasGradient) {
175
178
  return color;
176
179
  }
177
180
 
@@ -10,7 +10,7 @@
10
10
  * @property {?number} snapToGridInterval Snap the regions to a grid of the specified multiples in seconds
11
11
  * @property {?number} snapToGridOffset Shift the snap-to-grid by the specified seconds. May also be negative.
12
12
  * @property {?boolean} deferInit Set to true to manually call
13
- * @property {number[]} maxRegions Maximum number of regions that may be created by the user at one time.
13
+ * @property {number} maxRegions Maximum number of regions that may be created by the user at one time.
14
14
  * `initPlugin('regions')`
15
15
  * @property {function} formatTimeCallback Allows custom formating for region tooltip.
16
16
  * @property {?number} edgeScrollWidth='5% from container edges' Optional width for edgeScroll to start