vidply 1.0.35 → 1.0.36
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/dist/dev/vidply.esm.js +51 -0
- package/dist/dev/vidply.esm.js.map +2 -2
- package/dist/legacy/vidply.js +51 -0
- package/dist/legacy/vidply.js.map +2 -2
- package/dist/legacy/vidply.min.js +1 -1
- package/dist/legacy/vidply.min.meta.json +3 -3
- package/dist/prod/vidply.esm.min.js +3 -3
- package/dist/vidply.css +75 -0
- package/dist/vidply.esm.min.meta.json +3 -3
- package/dist/vidply.min.css +1 -1
- package/package.json +1 -1
- package/src/core/Player.js +74 -0
- package/src/styles/vidply.css +75 -0
package/dist/dev/vidply.esm.js
CHANGED
|
@@ -6055,6 +6055,7 @@ var Player = class _Player extends EventEmitter {
|
|
|
6055
6055
|
_enablePseudoFullscreen() {
|
|
6056
6056
|
this.state.fullscreen = true;
|
|
6057
6057
|
this.container.classList.add(`${this.options.classPrefix}-fullscreen`);
|
|
6058
|
+
document.body.classList.add("vidply-fullscreen-active");
|
|
6058
6059
|
this._originalScrollX = window.scrollX || window.pageXOffset;
|
|
6059
6060
|
this._originalScrollY = window.scrollY || window.pageYOffset;
|
|
6060
6061
|
this._originalBodyOverflow = document.body.style.overflow;
|
|
@@ -6062,20 +6063,58 @@ var Player = class _Player extends EventEmitter {
|
|
|
6062
6063
|
this._originalBodyWidth = document.body.style.width;
|
|
6063
6064
|
this._originalBodyHeight = document.body.style.height;
|
|
6064
6065
|
this._originalHtmlOverflow = document.documentElement.style.overflow;
|
|
6066
|
+
this._originalBodyBackground = document.body.style.background;
|
|
6067
|
+
this._originalHtmlBackground = document.documentElement.style.background;
|
|
6065
6068
|
document.body.style.overflow = "hidden";
|
|
6066
6069
|
document.body.style.width = "100%";
|
|
6067
6070
|
document.body.style.height = "100%";
|
|
6071
|
+
document.body.style.background = "#000";
|
|
6068
6072
|
document.documentElement.style.overflow = "hidden";
|
|
6073
|
+
document.documentElement.style.background = "#000";
|
|
6069
6074
|
this._originalViewport = document.querySelector('meta[name="viewport"]')?.getAttribute("content");
|
|
6070
6075
|
const viewport = document.querySelector('meta[name="viewport"]');
|
|
6071
6076
|
if (viewport) {
|
|
6072
6077
|
viewport.setAttribute("content", "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no");
|
|
6073
6078
|
}
|
|
6074
6079
|
window.scrollTo(0, 0);
|
|
6080
|
+
this._makeBackgroundInert();
|
|
6075
6081
|
this.emit("fullscreenchange", true);
|
|
6076
6082
|
this.emit("enterfullscreen");
|
|
6077
6083
|
}
|
|
6084
|
+
/**
|
|
6085
|
+
* Makes all page content except the fullscreen player inert (non-focusable)
|
|
6086
|
+
* This prevents keyboard navigation from focusing on hidden background elements
|
|
6087
|
+
*/
|
|
6088
|
+
_makeBackgroundInert() {
|
|
6089
|
+
this._inertElements = [];
|
|
6090
|
+
let current = this.container;
|
|
6091
|
+
while (current && current !== document.body && current !== document.documentElement) {
|
|
6092
|
+
const parent = current.parentElement;
|
|
6093
|
+
if (parent) {
|
|
6094
|
+
Array.from(parent.children).forEach((sibling) => {
|
|
6095
|
+
if (sibling !== current && sibling.nodeType === Node.ELEMENT_NODE && !sibling.hasAttribute("inert") && sibling.tagName !== "SCRIPT" && sibling.tagName !== "STYLE" && sibling.tagName !== "LINK" && sibling.tagName !== "META") {
|
|
6096
|
+
sibling.setAttribute("inert", "");
|
|
6097
|
+
this._inertElements.push(sibling);
|
|
6098
|
+
}
|
|
6099
|
+
});
|
|
6100
|
+
}
|
|
6101
|
+
current = parent;
|
|
6102
|
+
}
|
|
6103
|
+
}
|
|
6104
|
+
/**
|
|
6105
|
+
* Restores interactivity to elements that were made inert during fullscreen
|
|
6106
|
+
*/
|
|
6107
|
+
_restoreBackgroundInteractivity() {
|
|
6108
|
+
if (this._inertElements) {
|
|
6109
|
+
this._inertElements.forEach((el) => {
|
|
6110
|
+
el.removeAttribute("inert");
|
|
6111
|
+
});
|
|
6112
|
+
this._inertElements = [];
|
|
6113
|
+
}
|
|
6114
|
+
}
|
|
6078
6115
|
_disablePseudoFullscreen() {
|
|
6116
|
+
document.body.classList.remove("vidply-fullscreen-active");
|
|
6117
|
+
this._restoreBackgroundInteractivity();
|
|
6079
6118
|
if (this._originalBodyOverflow !== void 0) {
|
|
6080
6119
|
document.body.style.overflow = this._originalBodyOverflow;
|
|
6081
6120
|
delete this._originalBodyOverflow;
|
|
@@ -6096,6 +6135,14 @@ var Player = class _Player extends EventEmitter {
|
|
|
6096
6135
|
document.documentElement.style.overflow = this._originalHtmlOverflow;
|
|
6097
6136
|
delete this._originalHtmlOverflow;
|
|
6098
6137
|
}
|
|
6138
|
+
if (this._originalBodyBackground !== void 0) {
|
|
6139
|
+
document.body.style.background = this._originalBodyBackground;
|
|
6140
|
+
delete this._originalBodyBackground;
|
|
6141
|
+
}
|
|
6142
|
+
if (this._originalHtmlBackground !== void 0) {
|
|
6143
|
+
document.documentElement.style.background = this._originalHtmlBackground;
|
|
6144
|
+
delete this._originalHtmlBackground;
|
|
6145
|
+
}
|
|
6099
6146
|
if (this._originalViewport !== void 0) {
|
|
6100
6147
|
const viewport = document.querySelector('meta[name="viewport"]');
|
|
6101
6148
|
if (viewport) {
|
|
@@ -8111,8 +8158,12 @@ var Player = class _Player extends EventEmitter {
|
|
|
8111
8158
|
this.state.fullscreen = isFullscreen;
|
|
8112
8159
|
if (isFullscreen) {
|
|
8113
8160
|
this.container.classList.add(`${this.options.classPrefix}-fullscreen`);
|
|
8161
|
+
document.body.classList.add("vidply-fullscreen-active");
|
|
8162
|
+
this._makeBackgroundInert();
|
|
8114
8163
|
} else {
|
|
8115
8164
|
this.container.classList.remove(`${this.options.classPrefix}-fullscreen`);
|
|
8165
|
+
document.body.classList.remove("vidply-fullscreen-active");
|
|
8166
|
+
this._restoreBackgroundInteractivity();
|
|
8116
8167
|
this._disablePseudoFullscreen();
|
|
8117
8168
|
}
|
|
8118
8169
|
this.emit("fullscreenchange", isFullscreen);
|