nuxt-musicfyplayer 2.1.3 → 2.1.4

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 CHANGED
@@ -7,7 +7,7 @@
7
7
  [![License][license-src]][license-href]
8
8
  [![Nuxt][nuxt-src]][nuxt-href]
9
9
 
10
- Embed a simple HTML music player from local or hosted audio on your Nuxt app using MediaElement.js and ColorThief.js
10
+ Embed a simple HTML music player from local or hosted audio on your Nuxt app using MediaElement.js and fast-average-color
11
11
 
12
12
  - [✨ Release Notes](https://github.com/Yizack/nuxt-musicfyplayer/blob/main/CHANGELOG.md)
13
13
  - [🏀 Online playground](https://stackblitz.com/github/yizack/nuxt-musicfyplayer?file=playground%2Fapp.vue)
@@ -146,7 +146,7 @@ Check out the [🏀 Online playground](https://stackblitz.com/github/yizack/nuxt
146
146
 
147
147
  ## Credits
148
148
 
149
- - Detect dominant color with [ColorThief](https://lokeshdhakar.com/projects/color-thief/)
149
+ - Detect average color with [fast-average-color](https://github.com/fast-average-color/fast-average-color)
150
150
  - Music player controls by [MediaElement.js](https://www.mediaelementjs.com/)
151
151
  - [Nuxt](https://github.com/nuxt/nuxt), the JavaScript framework for creating SSR Vue applications and its [Module Author Guide](https://nuxt.com/docs/guide/going-further/modules)
152
152
 
package/dist/module.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "nuxt-musicfyplayer",
3
- "configKey": "nuxtMusicfyPlayer",
3
+ "configKey": "musicfyplayer",
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.0.0"
6
6
  },
7
- "version": "2.1.3",
7
+ "version": "2.1.4",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.0",
10
10
  "unbuild": "3.5.0"
package/dist/module.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { defineNuxtModule, createResolver, addComponent, addImportsDir, addTypeTemplate } from '@nuxt/kit';
1
+ import { defineNuxtModule, createResolver, addComponent, addImportsDir } from '@nuxt/kit';
2
2
 
3
3
  const module = defineNuxtModule({
4
4
  meta: {
5
5
  name: "nuxt-musicfyplayer",
6
- configKey: "nuxtMusicfyPlayer",
6
+ configKey: "musicfyplayer",
7
7
  compatibility: {
8
8
  nuxt: ">=3.0.0"
9
9
  }
@@ -16,10 +16,6 @@ const module = defineNuxtModule({
16
16
  filePath: resolve("./runtime/components/MusicfyPlayer.vue")
17
17
  });
18
18
  addImportsDir(resolve("./runtime/composables"));
19
- addTypeTemplate({
20
- filename: "types/colorthief.d.ts",
21
- src: resolve("./runtime/types/colorthief.d.ts")
22
- });
23
19
  }
24
20
  });
25
21
 
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import ColorThief from "colorthief";
2
+ import { FastAverageColor } from "fast-average-color";
3
3
  import { onMounted, ref, useTemplateRef } from "#imports";
4
4
  const props = defineProps({
5
5
  config: {
@@ -25,9 +25,9 @@ if (import.meta.client && props.config.colorDetect) {
25
25
  img.crossOrigin = "Anonymous";
26
26
  img.src = props.config.imageSrc;
27
27
  img.onload = () => {
28
- const colorThief = new ColorThief();
29
- const color = colorThief.getColor(img);
30
- backgroundColor.value = color ? `rgb(${color[0]}, ${color[1]}, ${color[2]})` : void 0;
28
+ const fac = new FastAverageColor();
29
+ const color = fac.getColor(img);
30
+ backgroundColor.value = color ? color.rgba : void 0;
31
31
  };
32
32
  }
33
33
  onMounted(async () => {
@@ -12,3 +12,9 @@ export interface MediaElementPlayerOptions {
12
12
  iPhoneUseNativeControls: boolean
13
13
  AndroidUseNativeControls: boolean
14
14
  }
15
+
16
+ declare global {
17
+ interface Window {
18
+ MediaElementPlayer?: MediaElementPlayer
19
+ }
20
+ }
@@ -1,8 +1,3 @@
1
1
  import 'mediaelement/build/mediaelement-and-player.js';
2
- import type { MediaElementPlayer, MediaElementPlayerOptions } from '../types/mediaelement.js';
3
- declare global {
4
- interface Window {
5
- MediaElementPlayer: MediaElementPlayer | undefined;
6
- }
7
- }
2
+ import type { MediaElementPlayerOptions } from '../types/mediaelement.js';
8
3
  export declare const mediaElementPlayer: (element: HTMLAudioElement, options: MediaElementPlayerOptions) => void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-musicfyplayer",
3
- "version": "2.1.3",
4
- "description": "Embed a simple and beautiful HTML music player from local or hosted audio on your website using MediaElement.js and ColorThief.js",
3
+ "version": "2.1.4",
4
+ "description": "Embed a simple and beautiful HTML music player from local or hosted audio on your website using MediaElement.js and fast-average-color",
5
5
  "keywords": [
6
6
  "nuxt",
7
7
  "nuxt3",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@nuxt/kit": "^3.16.2",
47
- "colorthief": "2.4.0",
47
+ "fast-average-color": "^9.5.0",
48
48
  "mediaelement": "^7.0.7"
49
49
  },
50
50
  "devDependencies": {
@@ -1,9 +0,0 @@
1
- declare module 'colorthief' {
2
- type Palette = [red: number, green: number, blue: number]
3
- export default class ColorThief {
4
- getColor(sourceImage: HTMLImageElement, quality?: number): Palette
5
- static getColor(sourceImage: string, quality?: number): Promise<Palette>
6
- getPaletteFromURL(URL: string, colorCount?: number, quality?: number): Promise<Palette[]>
7
- getColorFromURL(imageURL: string, quality?: number): Promise<Palette>
8
- }
9
- }