Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vue-youtube/core

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vue-youtube/core - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

dist/index.d.ts

187

dist/index.js

@@ -1,49 +0,61 @@

import { inject as N, shallowRef as Q, ref as p, watch as j, onMounted as x, unref as B, onUnmounted as H } from "vue";
import { PROVIDE_KEY as P, unrefElement as q, HOST_COOKIE as D, HOST_NO_COOKIE as G, PlayerState as U } from "@vue-youtube/shared";
import { inject as N, shallowRef as Q, ref as y, watch as j, onMounted as x, unref as B, onUnmounted as D } from "vue";
import { PROVIDE_KEY as S, unrefElement as H, HOST_COOKIE as q, HOST_NO_COOKIE as G, PlayerState as U } from "@vue-youtube/shared";
export * from "@vue-youtube/shared";
const $ = () => {
const i = N(P);
if (!i)
const $ = (n) => ({
playerVars: n.playerVars ?? {},
cookie: n.cookie ?? !0,
height: n.height ?? 720,
width: n.width ?? 1280
}), z = () => {
const n = N(S);
if (!n)
throw new Error("You may forget to apply app.use(manager). See https://vue-youtube.github.io/docs/usage/manager.html for more information");
return i;
}, J = () => {
const f = {
install(r) {
r.provide(P, f), this._insert();
return n;
}, W = (n) => {
const h = {
install(l) {
var s;
l.provide(S, h), (s = this._state.options.deferLoading) != null && s.enabled || this._insert();
},
register(r, l) {
const n = r.id || `vue-youtube-${this.state.counter++}`, s = this.state.players.get(n);
if (s !== void 0) {
s({
factory: this.state.factory,
id: n
register(l, s) {
var c;
const r = l.id || `vue-youtube-${this._state.counter++}`, i = this._state.players.get(r);
if (i !== void 0) {
i({
factory: this._state.factory,
id: r
});
return;
}
if (this.state.factory !== void 0) {
l({
factory: this.state.factory,
id: n
});
return;
}
this.state.backlog.set(n, l);
this._state.factory === void 0 ? (this._state.backlog.set(r, s), (c = this._state.options.deferLoading) != null && c.enabled && this._state.options.deferLoading.autoLoad && this._insert()) : s({
factory: this._state.factory,
id: r
});
},
load() {
this._state.factory === void 0 && this._insert();
},
_insert() {
var n;
const r = document.createElement("script");
r.src = "https://www.youtube.com/player_api";
const l = document.querySelectorAll("script")[0];
(n = l.parentNode) == null || n.insertBefore(r, l), window.onYouTubeIframeAPIReady = () => {
this.state.factory = window.YT;
for (const [s, y] of this.state.backlog.entries())
this.state.backlog.delete(s), this.state.players.set(s, y), y({
factory: this.state.factory,
id: s
var r;
const l = document.createElement("script");
l.src = "https://www.youtube.com/player_api";
const s = document.querySelectorAll("script")[0];
(r = s.parentNode) == null || r.insertBefore(l, s), window.onYouTubeIframeAPIReady = () => {
this._state.factory = window.YT;
for (const [i, c] of this._state.backlog.entries())
this._state.backlog.delete(i), this._state.players.set(i, c), c({
factory: this._state.factory,
id: i
});
};
},
state: {
_state: {
backlog: /* @__PURE__ */ new Map(),
players: /* @__PURE__ */ new Map(),
options: n || {
deferLoading: {
enabled: !1,
autoLoad: !1
}
},
factory: void 0,

@@ -53,29 +65,29 @@ counter: 1

};
return f;
}, W = (i, f, r = {}) => {
return h;
}, X = (n, p, v = {}) => {
const {
playerVars: l = {},
cookie: n = !0,
width: s = 1280,
height: y = 720
} = r, S = n ? D : G, A = $(), d = new Array(), v = new Array(), b = new Array(), m = new Array(), w = new Array(), C = new Array(), a = Q(), k = p(i), g = p(!1), h = p(!1), u = (e, t) => {
for (const c of t)
c(e);
playerVars: h,
cookie: l,
height: s,
width: r
} = $(v), i = l ? q : G, c = z(), b = new Array(), _ = new Array(), m = new Array(), w = new Array(), C = new Array(), k = new Array(), a = Q(), P = y(n), g = y(!1), d = y(!1), f = (e, t) => {
for (const u of t)
u(e);
}, A = (...e) => {
b.push(...e);
}, I = (...e) => {
d.push(...e);
}, E = (...e) => {
v.push(...e);
}, M = (...e) => {
b.push(...e);
_.push(...e);
}, L = (...e) => {
m.push(...e);
}, O = (...e) => {
m.push(...e);
}, R = (...e) => {
w.push(...e);
}, _ = (...e) => {
}, E = (...e) => {
C.push(...e);
}, T = () => {
var t, c, o;
}, M = (...e) => {
k.push(...e);
}, R = () => {
var t, u, o;
const e = (t = a.value) == null ? void 0 : t.getPlayerState();
if (e && e === U.PLAYING) {
(c = a.value) == null || c.pauseVideo();
(u = a.value) == null || u.pauseVideo();
return;

@@ -91,3 +103,3 @@ }

(t = a.value) == null || t.mute();
}, Y = () => {
}, T = () => {
var e, t;

@@ -99,10 +111,10 @@ if (g.value) {

(t = a.value) == null || t.setShuffle(!0), g.value = !0;
}, L = () => {
}, Y = () => {
var e, t;
if (h.value) {
(e = a.value) == null || e.setLoop(!1), h.value = !1;
if (d.value) {
(e = a.value) == null || e.setLoop(!1), d.value = !1;
return;
}
(t = a.value) == null || t.setLoop(!0), h.value = !0;
}, K = j(k, (e) => {
(t = a.value) == null || t.setLoop(!0), d.value = !0;
}, K = j(P, (e) => {
var t;

@@ -112,28 +124,28 @@ (t = a.value) == null || t.loadVideoById(e);

return x(() => {
const e = q(f);
e && A.register(e, ({ factory: t, id: c }) => {
e.id = c, a.value = new t.Player(c, {
videoId: B(k),
playerVars: l,
height: y,
width: s,
host: S,
const e = H(p);
e && c.register(e, ({ factory: t, id: u }) => {
e.id = u, a.value = new t.Player(u, {
videoId: B(P),
playerVars: h,
height: s,
width: r,
host: i,
events: {
onPlaybackQualityChange: (o) => {
u(o, d);
f(o, b);
},
onPlaybackRateChange: (o) => {
u(o, v);
f(o, _);
},
onStateChange: (o) => {
u(o, b);
f(o, m);
},
onApiChange: (o) => {
u(o, m);
f(o, w);
},
onError: (o) => {
u(o, w);
f(o, C);
},
onReady: (o) => {
u(o, C);
f(o, k);
}

@@ -143,3 +155,3 @@ }

});
}), H(() => {
}), D(() => {
var e;

@@ -149,18 +161,19 @@ (e = a.value) == null || e.destroy(), K();

instance: a,
togglePlay: T,
togglePlay: R,
toggleMute: V,
toggleLoop: L,
toggleShuffle: Y,
onPlaybackQualityChange: I,
onPlaybackRateChange: E,
onStateChange: M,
toggleLoop: Y,
toggleShuffle: T,
onPlaybackQualityChange: A,
onPlaybackRateChange: I,
onStateChange: L,
onApiChange: O,
onError: R,
onReady: _
onError: E,
onReady: M
};
};
export {
J as createManager,
$ as injectManager,
W as usePlayer
W as createManager,
z as injectManager,
X as usePlayer,
$ as withConfigDefaults
};
{
"name": "@vue-youtube/core",
"version": "0.0.5",
"version": "0.0.6",
"description": "Integrate YouTube Iframe Player into Vue 2/3 applications",

@@ -54,3 +54,3 @@ "author": "Techassi <git@techassi.dev>",

"vue-demi": "latest",
"@vue-youtube/shared": "0.0.5"
"@vue-youtube/shared": "0.0.6"
},

@@ -57,0 +57,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc