This commit is contained in:
2025-01-04 00:34:03 +01:00
parent 41829408dc
commit 0ca14bbc19
18111 changed files with 1871397 additions and 0 deletions

21
resources/app/node_modules/@pixi/accessibility/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License
Copyright (c) 2013-2023 Mathew Groves, Chad Engler
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,193 @@
"use strict";
var core = require("@pixi/core"), display = require("@pixi/display"), events = require("@pixi/events"), accessibleTarget = require("./accessibleTarget.js");
display.DisplayObject.mixin(accessibleTarget.accessibleTarget);
const KEY_CODE_TAB = 9, DIV_TOUCH_SIZE = 100, DIV_TOUCH_POS_X = 0, DIV_TOUCH_POS_Y = 0, DIV_TOUCH_ZINDEX = 2, DIV_HOOK_SIZE = 1, DIV_HOOK_POS_X = -1e3, DIV_HOOK_POS_Y = -1e3, DIV_HOOK_ZINDEX = 2;
class AccessibilityManager {
// 2fps
/**
* @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer
*/
constructor(renderer) {
this.debug = !1, this._isActive = !1, this._isMobileAccessibility = !1, this.pool = [], this.renderId = 0, this.children = [], this.androidUpdateCount = 0, this.androidUpdateFrequency = 500, this._hookDiv = null, (core.utils.isMobile.tablet || core.utils.isMobile.phone) && this.createTouchHook();
const div = document.createElement("div");
div.style.width = `${DIV_TOUCH_SIZE}px`, div.style.height = `${DIV_TOUCH_SIZE}px`, div.style.position = "absolute", div.style.top = `${DIV_TOUCH_POS_X}px`, div.style.left = `${DIV_TOUCH_POS_Y}px`, div.style.zIndex = DIV_TOUCH_ZINDEX.toString(), this.div = div, this.renderer = renderer, this._onKeyDown = this._onKeyDown.bind(this), this._onMouseMove = this._onMouseMove.bind(this), globalThis.addEventListener("keydown", this._onKeyDown, !1);
}
/**
* Value of `true` if accessibility is currently active and accessibility layers are showing.
* @member {boolean}
* @readonly
*/
get isActive() {
return this._isActive;
}
/**
* Value of `true` if accessibility is enabled for touch devices.
* @member {boolean}
* @readonly
*/
get isMobileAccessibility() {
return this._isMobileAccessibility;
}
/**
* Creates the touch hooks.
* @private
*/
createTouchHook() {
const hookDiv = document.createElement("button");
hookDiv.style.width = `${DIV_HOOK_SIZE}px`, hookDiv.style.height = `${DIV_HOOK_SIZE}px`, hookDiv.style.position = "absolute", hookDiv.style.top = `${DIV_HOOK_POS_X}px`, hookDiv.style.left = `${DIV_HOOK_POS_Y}px`, hookDiv.style.zIndex = DIV_HOOK_ZINDEX.toString(), hookDiv.style.backgroundColor = "#FF0000", hookDiv.title = "select to enable accessibility for this content", hookDiv.addEventListener("focus", () => {
this._isMobileAccessibility = !0, this.activate(), this.destroyTouchHook();
}), document.body.appendChild(hookDiv), this._hookDiv = hookDiv;
}
/**
* Destroys the touch hooks.
* @private
*/
destroyTouchHook() {
this._hookDiv && (document.body.removeChild(this._hookDiv), this._hookDiv = null);
}
/**
* Activating will cause the Accessibility layer to be shown.
* This is called when a user presses the tab key.
* @private
*/
activate() {
this._isActive || (this._isActive = !0, globalThis.document.addEventListener("mousemove", this._onMouseMove, !0), globalThis.removeEventListener("keydown", this._onKeyDown, !1), this.renderer.on("postrender", this.update, this), this.renderer.view.parentNode?.appendChild(this.div));
}
/**
* Deactivating will cause the Accessibility layer to be hidden.
* This is called when a user moves the mouse.
* @private
*/
deactivate() {
!this._isActive || this._isMobileAccessibility || (this._isActive = !1, globalThis.document.removeEventListener("mousemove", this._onMouseMove, !0), globalThis.addEventListener("keydown", this._onKeyDown, !1), this.renderer.off("postrender", this.update), this.div.parentNode?.removeChild(this.div));
}
/**
* This recursive function will run through the scene graph and add any new accessible objects to the DOM layer.
* @private
* @param {PIXI.Container} displayObject - The DisplayObject to check.
*/
updateAccessibleObjects(displayObject) {
if (!displayObject.visible || !displayObject.accessibleChildren)
return;
displayObject.accessible && displayObject.isInteractive() && (displayObject._accessibleActive || this.addChild(displayObject), displayObject.renderId = this.renderId);
const children = displayObject.children;
if (children)
for (let i = 0; i < children.length; i++)
this.updateAccessibleObjects(children[i]);
}
/**
* Before each render this function will ensure that all divs are mapped correctly to their DisplayObjects.
* @private
*/
update() {
const now = performance.now();
if (core.utils.isMobile.android.device && now < this.androidUpdateCount || (this.androidUpdateCount = now + this.androidUpdateFrequency, !this.renderer.renderingToScreen))
return;
this.renderer.lastObjectRendered && this.updateAccessibleObjects(this.renderer.lastObjectRendered);
const { x, y, width, height } = this.renderer.view.getBoundingClientRect(), { width: viewWidth, height: viewHeight, resolution } = this.renderer, sx = width / viewWidth * resolution, sy = height / viewHeight * resolution;
let div = this.div;
div.style.left = `${x}px`, div.style.top = `${y}px`, div.style.width = `${viewWidth}px`, div.style.height = `${viewHeight}px`;
for (let i = 0; i < this.children.length; i++) {
const child = this.children[i];
if (child.renderId !== this.renderId)
child._accessibleActive = !1, core.utils.removeItems(this.children, i, 1), this.div.removeChild(child._accessibleDiv), this.pool.push(child._accessibleDiv), child._accessibleDiv = null, i--;
else {
div = child._accessibleDiv;
let hitArea = child.hitArea;
const wt = child.worldTransform;
child.hitArea ? (div.style.left = `${(wt.tx + hitArea.x * wt.a) * sx}px`, div.style.top = `${(wt.ty + hitArea.y * wt.d) * sy}px`, div.style.width = `${hitArea.width * wt.a * sx}px`, div.style.height = `${hitArea.height * wt.d * sy}px`) : (hitArea = child.getBounds(), this.capHitArea(hitArea), div.style.left = `${hitArea.x * sx}px`, div.style.top = `${hitArea.y * sy}px`, div.style.width = `${hitArea.width * sx}px`, div.style.height = `${hitArea.height * sy}px`, div.title !== child.accessibleTitle && child.accessibleTitle !== null && (div.title = child.accessibleTitle), div.getAttribute("aria-label") !== child.accessibleHint && child.accessibleHint !== null && div.setAttribute("aria-label", child.accessibleHint)), (child.accessibleTitle !== div.title || child.tabIndex !== div.tabIndex) && (div.title = child.accessibleTitle, div.tabIndex = child.tabIndex, this.debug && this.updateDebugHTML(div));
}
}
this.renderId++;
}
/**
* private function that will visually add the information to the
* accessability div
* @param {HTMLElement} div -
*/
updateDebugHTML(div) {
div.innerHTML = `type: ${div.type}</br> title : ${div.title}</br> tabIndex: ${div.tabIndex}`;
}
/**
* Adjust the hit area based on the bounds of a display object
* @param {PIXI.Rectangle} hitArea - Bounds of the child
*/
capHitArea(hitArea) {
hitArea.x < 0 && (hitArea.width += hitArea.x, hitArea.x = 0), hitArea.y < 0 && (hitArea.height += hitArea.y, hitArea.y = 0);
const { width: viewWidth, height: viewHeight } = this.renderer;
hitArea.x + hitArea.width > viewWidth && (hitArea.width = viewWidth - hitArea.x), hitArea.y + hitArea.height > viewHeight && (hitArea.height = viewHeight - hitArea.y);
}
/**
* Adds a DisplayObject to the accessibility manager
* @private
* @param {PIXI.DisplayObject} displayObject - The child to make accessible.
*/
addChild(displayObject) {
let div = this.pool.pop();
div || (div = document.createElement("button"), div.style.width = `${DIV_TOUCH_SIZE}px`, div.style.height = `${DIV_TOUCH_SIZE}px`, div.style.backgroundColor = this.debug ? "rgba(255,255,255,0.5)" : "transparent", div.style.position = "absolute", div.style.zIndex = DIV_TOUCH_ZINDEX.toString(), div.style.borderStyle = "none", navigator.userAgent.toLowerCase().includes("chrome") ? div.setAttribute("aria-live", "off") : div.setAttribute("aria-live", "polite"), navigator.userAgent.match(/rv:.*Gecko\//) ? div.setAttribute("aria-relevant", "additions") : div.setAttribute("aria-relevant", "text"), div.addEventListener("click", this._onClick.bind(this)), div.addEventListener("focus", this._onFocus.bind(this)), div.addEventListener("focusout", this._onFocusOut.bind(this))), div.style.pointerEvents = displayObject.accessiblePointerEvents, div.type = displayObject.accessibleType, displayObject.accessibleTitle && displayObject.accessibleTitle !== null ? div.title = displayObject.accessibleTitle : (!displayObject.accessibleHint || displayObject.accessibleHint === null) && (div.title = `displayObject ${displayObject.tabIndex}`), displayObject.accessibleHint && displayObject.accessibleHint !== null && div.setAttribute("aria-label", displayObject.accessibleHint), this.debug && this.updateDebugHTML(div), displayObject._accessibleActive = !0, displayObject._accessibleDiv = div, div.displayObject = displayObject, this.children.push(displayObject), this.div.appendChild(displayObject._accessibleDiv), displayObject._accessibleDiv.tabIndex = displayObject.tabIndex;
}
/**
* Dispatch events with the EventSystem.
* @param e
* @param type
* @private
*/
_dispatchEvent(e, type) {
const { displayObject: target } = e.target, boundry = this.renderer.events.rootBoundary, event = Object.assign(new events.FederatedEvent(boundry), { target });
boundry.rootTarget = this.renderer.lastObjectRendered, type.forEach((type2) => boundry.dispatchEvent(event, type2));
}
/**
* Maps the div button press to pixi's EventSystem (click)
* @private
* @param {MouseEvent} e - The click event.
*/
_onClick(e) {
this._dispatchEvent(e, ["click", "pointertap", "tap"]);
}
/**
* Maps the div focus events to pixi's EventSystem (mouseover)
* @private
* @param {FocusEvent} e - The focus event.
*/
_onFocus(e) {
e.target.getAttribute("aria-live") || e.target.setAttribute("aria-live", "assertive"), this._dispatchEvent(e, ["mouseover"]);
}
/**
* Maps the div focus events to pixi's EventSystem (mouseout)
* @private
* @param {FocusEvent} e - The focusout event.
*/
_onFocusOut(e) {
e.target.getAttribute("aria-live") || e.target.setAttribute("aria-live", "polite"), this._dispatchEvent(e, ["mouseout"]);
}
/**
* Is called when a key is pressed
* @private
* @param {KeyboardEvent} e - The keydown event.
*/
_onKeyDown(e) {
e.keyCode === KEY_CODE_TAB && this.activate();
}
/**
* Is called when the mouse moves across the renderer element
* @private
* @param {MouseEvent} e - The mouse event.
*/
_onMouseMove(e) {
e.movementX === 0 && e.movementY === 0 || this.deactivate();
}
/** Destroys the accessibility manager */
destroy() {
this.destroyTouchHook(), this.div = null, globalThis.document.removeEventListener("mousemove", this._onMouseMove, !0), globalThis.removeEventListener("keydown", this._onKeyDown), this.pool = null, this.children = null, this.renderer = null;
}
}
AccessibilityManager.extension = {
name: "accessibility",
type: [
core.ExtensionType.RendererPlugin,
core.ExtensionType.CanvasRendererPlugin
]
};
core.extensions.add(AccessibilityManager);
exports.AccessibilityManager = AccessibilityManager;
//# sourceMappingURL=AccessibilityManager.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,197 @@
import { utils, ExtensionType, extensions } from "@pixi/core";
import { DisplayObject } from "@pixi/display";
import { FederatedEvent } from "@pixi/events";
import { accessibleTarget } from "./accessibleTarget.mjs";
DisplayObject.mixin(accessibleTarget);
const KEY_CODE_TAB = 9, DIV_TOUCH_SIZE = 100, DIV_TOUCH_POS_X = 0, DIV_TOUCH_POS_Y = 0, DIV_TOUCH_ZINDEX = 2, DIV_HOOK_SIZE = 1, DIV_HOOK_POS_X = -1e3, DIV_HOOK_POS_Y = -1e3, DIV_HOOK_ZINDEX = 2;
class AccessibilityManager {
// 2fps
/**
* @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer
*/
constructor(renderer) {
this.debug = !1, this._isActive = !1, this._isMobileAccessibility = !1, this.pool = [], this.renderId = 0, this.children = [], this.androidUpdateCount = 0, this.androidUpdateFrequency = 500, this._hookDiv = null, (utils.isMobile.tablet || utils.isMobile.phone) && this.createTouchHook();
const div = document.createElement("div");
div.style.width = `${DIV_TOUCH_SIZE}px`, div.style.height = `${DIV_TOUCH_SIZE}px`, div.style.position = "absolute", div.style.top = `${DIV_TOUCH_POS_X}px`, div.style.left = `${DIV_TOUCH_POS_Y}px`, div.style.zIndex = DIV_TOUCH_ZINDEX.toString(), this.div = div, this.renderer = renderer, this._onKeyDown = this._onKeyDown.bind(this), this._onMouseMove = this._onMouseMove.bind(this), globalThis.addEventListener("keydown", this._onKeyDown, !1);
}
/**
* Value of `true` if accessibility is currently active and accessibility layers are showing.
* @member {boolean}
* @readonly
*/
get isActive() {
return this._isActive;
}
/**
* Value of `true` if accessibility is enabled for touch devices.
* @member {boolean}
* @readonly
*/
get isMobileAccessibility() {
return this._isMobileAccessibility;
}
/**
* Creates the touch hooks.
* @private
*/
createTouchHook() {
const hookDiv = document.createElement("button");
hookDiv.style.width = `${DIV_HOOK_SIZE}px`, hookDiv.style.height = `${DIV_HOOK_SIZE}px`, hookDiv.style.position = "absolute", hookDiv.style.top = `${DIV_HOOK_POS_X}px`, hookDiv.style.left = `${DIV_HOOK_POS_Y}px`, hookDiv.style.zIndex = DIV_HOOK_ZINDEX.toString(), hookDiv.style.backgroundColor = "#FF0000", hookDiv.title = "select to enable accessibility for this content", hookDiv.addEventListener("focus", () => {
this._isMobileAccessibility = !0, this.activate(), this.destroyTouchHook();
}), document.body.appendChild(hookDiv), this._hookDiv = hookDiv;
}
/**
* Destroys the touch hooks.
* @private
*/
destroyTouchHook() {
this._hookDiv && (document.body.removeChild(this._hookDiv), this._hookDiv = null);
}
/**
* Activating will cause the Accessibility layer to be shown.
* This is called when a user presses the tab key.
* @private
*/
activate() {
this._isActive || (this._isActive = !0, globalThis.document.addEventListener("mousemove", this._onMouseMove, !0), globalThis.removeEventListener("keydown", this._onKeyDown, !1), this.renderer.on("postrender", this.update, this), this.renderer.view.parentNode?.appendChild(this.div));
}
/**
* Deactivating will cause the Accessibility layer to be hidden.
* This is called when a user moves the mouse.
* @private
*/
deactivate() {
!this._isActive || this._isMobileAccessibility || (this._isActive = !1, globalThis.document.removeEventListener("mousemove", this._onMouseMove, !0), globalThis.addEventListener("keydown", this._onKeyDown, !1), this.renderer.off("postrender", this.update), this.div.parentNode?.removeChild(this.div));
}
/**
* This recursive function will run through the scene graph and add any new accessible objects to the DOM layer.
* @private
* @param {PIXI.Container} displayObject - The DisplayObject to check.
*/
updateAccessibleObjects(displayObject) {
if (!displayObject.visible || !displayObject.accessibleChildren)
return;
displayObject.accessible && displayObject.isInteractive() && (displayObject._accessibleActive || this.addChild(displayObject), displayObject.renderId = this.renderId);
const children = displayObject.children;
if (children)
for (let i = 0; i < children.length; i++)
this.updateAccessibleObjects(children[i]);
}
/**
* Before each render this function will ensure that all divs are mapped correctly to their DisplayObjects.
* @private
*/
update() {
const now = performance.now();
if (utils.isMobile.android.device && now < this.androidUpdateCount || (this.androidUpdateCount = now + this.androidUpdateFrequency, !this.renderer.renderingToScreen))
return;
this.renderer.lastObjectRendered && this.updateAccessibleObjects(this.renderer.lastObjectRendered);
const { x, y, width, height } = this.renderer.view.getBoundingClientRect(), { width: viewWidth, height: viewHeight, resolution } = this.renderer, sx = width / viewWidth * resolution, sy = height / viewHeight * resolution;
let div = this.div;
div.style.left = `${x}px`, div.style.top = `${y}px`, div.style.width = `${viewWidth}px`, div.style.height = `${viewHeight}px`;
for (let i = 0; i < this.children.length; i++) {
const child = this.children[i];
if (child.renderId !== this.renderId)
child._accessibleActive = !1, utils.removeItems(this.children, i, 1), this.div.removeChild(child._accessibleDiv), this.pool.push(child._accessibleDiv), child._accessibleDiv = null, i--;
else {
div = child._accessibleDiv;
let hitArea = child.hitArea;
const wt = child.worldTransform;
child.hitArea ? (div.style.left = `${(wt.tx + hitArea.x * wt.a) * sx}px`, div.style.top = `${(wt.ty + hitArea.y * wt.d) * sy}px`, div.style.width = `${hitArea.width * wt.a * sx}px`, div.style.height = `${hitArea.height * wt.d * sy}px`) : (hitArea = child.getBounds(), this.capHitArea(hitArea), div.style.left = `${hitArea.x * sx}px`, div.style.top = `${hitArea.y * sy}px`, div.style.width = `${hitArea.width * sx}px`, div.style.height = `${hitArea.height * sy}px`, div.title !== child.accessibleTitle && child.accessibleTitle !== null && (div.title = child.accessibleTitle), div.getAttribute("aria-label") !== child.accessibleHint && child.accessibleHint !== null && div.setAttribute("aria-label", child.accessibleHint)), (child.accessibleTitle !== div.title || child.tabIndex !== div.tabIndex) && (div.title = child.accessibleTitle, div.tabIndex = child.tabIndex, this.debug && this.updateDebugHTML(div));
}
}
this.renderId++;
}
/**
* private function that will visually add the information to the
* accessability div
* @param {HTMLElement} div -
*/
updateDebugHTML(div) {
div.innerHTML = `type: ${div.type}</br> title : ${div.title}</br> tabIndex: ${div.tabIndex}`;
}
/**
* Adjust the hit area based on the bounds of a display object
* @param {PIXI.Rectangle} hitArea - Bounds of the child
*/
capHitArea(hitArea) {
hitArea.x < 0 && (hitArea.width += hitArea.x, hitArea.x = 0), hitArea.y < 0 && (hitArea.height += hitArea.y, hitArea.y = 0);
const { width: viewWidth, height: viewHeight } = this.renderer;
hitArea.x + hitArea.width > viewWidth && (hitArea.width = viewWidth - hitArea.x), hitArea.y + hitArea.height > viewHeight && (hitArea.height = viewHeight - hitArea.y);
}
/**
* Adds a DisplayObject to the accessibility manager
* @private
* @param {PIXI.DisplayObject} displayObject - The child to make accessible.
*/
addChild(displayObject) {
let div = this.pool.pop();
div || (div = document.createElement("button"), div.style.width = `${DIV_TOUCH_SIZE}px`, div.style.height = `${DIV_TOUCH_SIZE}px`, div.style.backgroundColor = this.debug ? "rgba(255,255,255,0.5)" : "transparent", div.style.position = "absolute", div.style.zIndex = DIV_TOUCH_ZINDEX.toString(), div.style.borderStyle = "none", navigator.userAgent.toLowerCase().includes("chrome") ? div.setAttribute("aria-live", "off") : div.setAttribute("aria-live", "polite"), navigator.userAgent.match(/rv:.*Gecko\//) ? div.setAttribute("aria-relevant", "additions") : div.setAttribute("aria-relevant", "text"), div.addEventListener("click", this._onClick.bind(this)), div.addEventListener("focus", this._onFocus.bind(this)), div.addEventListener("focusout", this._onFocusOut.bind(this))), div.style.pointerEvents = displayObject.accessiblePointerEvents, div.type = displayObject.accessibleType, displayObject.accessibleTitle && displayObject.accessibleTitle !== null ? div.title = displayObject.accessibleTitle : (!displayObject.accessibleHint || displayObject.accessibleHint === null) && (div.title = `displayObject ${displayObject.tabIndex}`), displayObject.accessibleHint && displayObject.accessibleHint !== null && div.setAttribute("aria-label", displayObject.accessibleHint), this.debug && this.updateDebugHTML(div), displayObject._accessibleActive = !0, displayObject._accessibleDiv = div, div.displayObject = displayObject, this.children.push(displayObject), this.div.appendChild(displayObject._accessibleDiv), displayObject._accessibleDiv.tabIndex = displayObject.tabIndex;
}
/**
* Dispatch events with the EventSystem.
* @param e
* @param type
* @private
*/
_dispatchEvent(e, type) {
const { displayObject: target } = e.target, boundry = this.renderer.events.rootBoundary, event = Object.assign(new FederatedEvent(boundry), { target });
boundry.rootTarget = this.renderer.lastObjectRendered, type.forEach((type2) => boundry.dispatchEvent(event, type2));
}
/**
* Maps the div button press to pixi's EventSystem (click)
* @private
* @param {MouseEvent} e - The click event.
*/
_onClick(e) {
this._dispatchEvent(e, ["click", "pointertap", "tap"]);
}
/**
* Maps the div focus events to pixi's EventSystem (mouseover)
* @private
* @param {FocusEvent} e - The focus event.
*/
_onFocus(e) {
e.target.getAttribute("aria-live") || e.target.setAttribute("aria-live", "assertive"), this._dispatchEvent(e, ["mouseover"]);
}
/**
* Maps the div focus events to pixi's EventSystem (mouseout)
* @private
* @param {FocusEvent} e - The focusout event.
*/
_onFocusOut(e) {
e.target.getAttribute("aria-live") || e.target.setAttribute("aria-live", "polite"), this._dispatchEvent(e, ["mouseout"]);
}
/**
* Is called when a key is pressed
* @private
* @param {KeyboardEvent} e - The keydown event.
*/
_onKeyDown(e) {
e.keyCode === KEY_CODE_TAB && this.activate();
}
/**
* Is called when the mouse moves across the renderer element
* @private
* @param {MouseEvent} e - The mouse event.
*/
_onMouseMove(e) {
e.movementX === 0 && e.movementY === 0 || this.deactivate();
}
/** Destroys the accessibility manager */
destroy() {
this.destroyTouchHook(), this.div = null, globalThis.document.removeEventListener("mousemove", this._onMouseMove, !0), globalThis.removeEventListener("keydown", this._onKeyDown), this.pool = null, this.children = null, this.renderer = null;
}
}
AccessibilityManager.extension = {
name: "accessibility",
type: [
ExtensionType.RendererPlugin,
ExtensionType.CanvasRendererPlugin
]
};
extensions.add(AccessibilityManager);
export {
AccessibilityManager
};
//# sourceMappingURL=AccessibilityManager.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,69 @@
"use strict";
const accessibleTarget = {
/**
* Flag for if the object is accessible. If true AccessibilityManager will overlay a
* shadow div with attributes set
* @member {boolean}
* @memberof PIXI.DisplayObject#
*/
accessible: !1,
/**
* Sets the title attribute of the shadow div
* If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]'
* @member {?string}
* @memberof PIXI.DisplayObject#
*/
accessibleTitle: null,
/**
* Sets the aria-label attribute of the shadow div
* @member {string}
* @memberof PIXI.DisplayObject#
*/
accessibleHint: null,
/**
* @member {number}
* @memberof PIXI.DisplayObject#
* @private
* @todo Needs docs.
*/
tabIndex: 0,
/**
* @member {boolean}
* @memberof PIXI.DisplayObject#
* @todo Needs docs.
*/
_accessibleActive: !1,
/**
* @member {boolean}
* @memberof PIXI.DisplayObject#
* @todo Needs docs.
*/
_accessibleDiv: null,
/**
* Specify the type of div the accessible layer is. Screen readers treat the element differently
* depending on this type. Defaults to button.
* @member {string}
* @memberof PIXI.DisplayObject#
* @default 'button'
*/
accessibleType: "button",
/**
* Specify the pointer-events the accessible div will use
* Defaults to auto.
* @member {string}
* @memberof PIXI.DisplayObject#
* @default 'auto'
*/
accessiblePointerEvents: "auto",
/**
* Setting to false will prevent any children inside this container to
* be accessible. Defaults to true.
* @member {boolean}
* @memberof PIXI.DisplayObject#
* @default true
*/
accessibleChildren: !0,
renderId: -1
};
exports.accessibleTarget = accessibleTarget;
//# sourceMappingURL=accessibleTarget.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"accessibleTarget.js","sources":["../src/accessibleTarget.ts"],"sourcesContent":["import type { DisplayObject } from '@pixi/display';\n\nexport type PointerEvents = 'auto'\n| 'none'\n| 'visiblePainted'\n| 'visibleFill'\n| 'visibleStroke'\n| 'visible'\n| 'painted'\n| 'fill'\n| 'stroke'\n| 'all'\n| 'inherit';\n\nexport interface IAccessibleTarget\n{\n accessible: boolean;\n accessibleTitle: string;\n accessibleHint: string;\n tabIndex: number;\n _accessibleActive: boolean;\n _accessibleDiv: IAccessibleHTMLElement;\n accessibleType: string;\n accessiblePointerEvents: PointerEvents;\n accessibleChildren: boolean;\n renderId: number;\n}\n\nexport interface IAccessibleHTMLElement extends HTMLElement\n{\n type?: string;\n displayObject?: DisplayObject;\n}\n\n/**\n * Default property values of accessible objects\n * used by {@link PIXI.AccessibilityManager}.\n * @private\n * @function accessibleTarget\n * @memberof PIXI\n * @type {object}\n * @example\n * import { accessibleTarget } from 'pixi.js';\n *\n * function MyObject() {}\n * Object.assign(MyObject.prototype, accessibleTarget);\n */\nexport const accessibleTarget: IAccessibleTarget = {\n /**\n * Flag for if the object is accessible. If true AccessibilityManager will overlay a\n * shadow div with attributes set\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n accessible: false,\n\n /**\n * Sets the title attribute of the shadow div\n * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]'\n * @member {?string}\n * @memberof PIXI.DisplayObject#\n */\n accessibleTitle: null,\n\n /**\n * Sets the aria-label attribute of the shadow div\n * @member {string}\n * @memberof PIXI.DisplayObject#\n */\n accessibleHint: null,\n\n /**\n * @member {number}\n * @memberof PIXI.DisplayObject#\n * @private\n * @todo Needs docs.\n */\n tabIndex: 0,\n\n /**\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @todo Needs docs.\n */\n _accessibleActive: false,\n\n /**\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @todo Needs docs.\n */\n _accessibleDiv: null,\n\n /**\n * Specify the type of div the accessible layer is. Screen readers treat the element differently\n * depending on this type. Defaults to button.\n * @member {string}\n * @memberof PIXI.DisplayObject#\n * @default 'button'\n */\n accessibleType: 'button',\n\n /**\n * Specify the pointer-events the accessible div will use\n * Defaults to auto.\n * @member {string}\n * @memberof PIXI.DisplayObject#\n * @default 'auto'\n */\n accessiblePointerEvents: 'auto',\n\n /**\n * Setting to false will prevent any children inside this container to\n * be accessible. Defaults to true.\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @default true\n */\n accessibleChildren: true,\n\n renderId: -1,\n};\n"],"names":[],"mappings":";AA+CO,MAAM,mBAAsC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO/C,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQZ,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOjB,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQhB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOV,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOnB,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAShB,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAShB,yBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASzB,oBAAoB;AAAA,EAEpB,UAAU;AACd;;"}

View File

@@ -0,0 +1,70 @@
const accessibleTarget = {
/**
* Flag for if the object is accessible. If true AccessibilityManager will overlay a
* shadow div with attributes set
* @member {boolean}
* @memberof PIXI.DisplayObject#
*/
accessible: !1,
/**
* Sets the title attribute of the shadow div
* If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]'
* @member {?string}
* @memberof PIXI.DisplayObject#
*/
accessibleTitle: null,
/**
* Sets the aria-label attribute of the shadow div
* @member {string}
* @memberof PIXI.DisplayObject#
*/
accessibleHint: null,
/**
* @member {number}
* @memberof PIXI.DisplayObject#
* @private
* @todo Needs docs.
*/
tabIndex: 0,
/**
* @member {boolean}
* @memberof PIXI.DisplayObject#
* @todo Needs docs.
*/
_accessibleActive: !1,
/**
* @member {boolean}
* @memberof PIXI.DisplayObject#
* @todo Needs docs.
*/
_accessibleDiv: null,
/**
* Specify the type of div the accessible layer is. Screen readers treat the element differently
* depending on this type. Defaults to button.
* @member {string}
* @memberof PIXI.DisplayObject#
* @default 'button'
*/
accessibleType: "button",
/**
* Specify the pointer-events the accessible div will use
* Defaults to auto.
* @member {string}
* @memberof PIXI.DisplayObject#
* @default 'auto'
*/
accessiblePointerEvents: "auto",
/**
* Setting to false will prevent any children inside this container to
* be accessible. Defaults to true.
* @member {boolean}
* @memberof PIXI.DisplayObject#
* @default true
*/
accessibleChildren: !0,
renderId: -1
};
export {
accessibleTarget
};
//# sourceMappingURL=accessibleTarget.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"accessibleTarget.mjs","sources":["../src/accessibleTarget.ts"],"sourcesContent":["import type { DisplayObject } from '@pixi/display';\n\nexport type PointerEvents = 'auto'\n| 'none'\n| 'visiblePainted'\n| 'visibleFill'\n| 'visibleStroke'\n| 'visible'\n| 'painted'\n| 'fill'\n| 'stroke'\n| 'all'\n| 'inherit';\n\nexport interface IAccessibleTarget\n{\n accessible: boolean;\n accessibleTitle: string;\n accessibleHint: string;\n tabIndex: number;\n _accessibleActive: boolean;\n _accessibleDiv: IAccessibleHTMLElement;\n accessibleType: string;\n accessiblePointerEvents: PointerEvents;\n accessibleChildren: boolean;\n renderId: number;\n}\n\nexport interface IAccessibleHTMLElement extends HTMLElement\n{\n type?: string;\n displayObject?: DisplayObject;\n}\n\n/**\n * Default property values of accessible objects\n * used by {@link PIXI.AccessibilityManager}.\n * @private\n * @function accessibleTarget\n * @memberof PIXI\n * @type {object}\n * @example\n * import { accessibleTarget } from 'pixi.js';\n *\n * function MyObject() {}\n * Object.assign(MyObject.prototype, accessibleTarget);\n */\nexport const accessibleTarget: IAccessibleTarget = {\n /**\n * Flag for if the object is accessible. If true AccessibilityManager will overlay a\n * shadow div with attributes set\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n accessible: false,\n\n /**\n * Sets the title attribute of the shadow div\n * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]'\n * @member {?string}\n * @memberof PIXI.DisplayObject#\n */\n accessibleTitle: null,\n\n /**\n * Sets the aria-label attribute of the shadow div\n * @member {string}\n * @memberof PIXI.DisplayObject#\n */\n accessibleHint: null,\n\n /**\n * @member {number}\n * @memberof PIXI.DisplayObject#\n * @private\n * @todo Needs docs.\n */\n tabIndex: 0,\n\n /**\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @todo Needs docs.\n */\n _accessibleActive: false,\n\n /**\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @todo Needs docs.\n */\n _accessibleDiv: null,\n\n /**\n * Specify the type of div the accessible layer is. Screen readers treat the element differently\n * depending on this type. Defaults to button.\n * @member {string}\n * @memberof PIXI.DisplayObject#\n * @default 'button'\n */\n accessibleType: 'button',\n\n /**\n * Specify the pointer-events the accessible div will use\n * Defaults to auto.\n * @member {string}\n * @memberof PIXI.DisplayObject#\n * @default 'auto'\n */\n accessiblePointerEvents: 'auto',\n\n /**\n * Setting to false will prevent any children inside this container to\n * be accessible. Defaults to true.\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @default true\n */\n accessibleChildren: true,\n\n renderId: -1,\n};\n"],"names":[],"mappings":"AA+CO,MAAM,mBAAsC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO/C,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQZ,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOjB,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQhB,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOV,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOnB,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAShB,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAShB,yBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASzB,oBAAoB;AAAA,EAEpB,UAAU;AACd;"}

View File

@@ -0,0 +1,5 @@
"use strict";
var AccessibilityManager = require("./AccessibilityManager.js"), accessibleTarget = require("./accessibleTarget.js");
exports.AccessibilityManager = AccessibilityManager.AccessibilityManager;
exports.accessibleTarget = accessibleTarget.accessibleTarget;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}

View File

@@ -0,0 +1,7 @@
import { AccessibilityManager } from "./AccessibilityManager.mjs";
import { accessibleTarget } from "./accessibleTarget.mjs";
export {
AccessibilityManager,
accessibleTarget
};
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}

View File

@@ -0,0 +1,39 @@
{
"name": "@pixi/accessibility",
"version": "7.4.2",
"main": "lib/index.js",
"module": "lib/index.mjs",
"types": "lib/index.d.ts",
"exports": {
".": {
"import": {
"types": "./lib/index.d.ts",
"default": "./lib/index.mjs"
},
"require": {
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
}
}
},
"description": "Accessibility Plugin for visually impaired users",
"author": "Mat Groves",
"homepage": "http://pixijs.com/",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/pixijs/pixijs.git"
},
"publishConfig": {
"access": "public"
},
"files": [
"lib",
"*.d.ts"
],
"peerDependencies": {
"@pixi/core": "7.4.2",
"@pixi/display": "7.4.2",
"@pixi/events": "7.4.2"
}
}

21
resources/app/node_modules/@pixi/app/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License
Copyright (c) 2013-2023 Mathew Groves, Chad Engler
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,57 @@
"use strict";
var core = require("@pixi/core"), display = require("@pixi/display");
const _Application = class _Application2 {
/**
* @param options - The optional application and renderer parameters.
*/
constructor(options) {
this.stage = new display.Container(), options = Object.assign({
forceCanvas: !1
}, options), this.renderer = core.autoDetectRenderer(options), _Application2._plugins.forEach((plugin) => {
plugin.init.call(this, options);
});
}
/** Render the current stage. */
render() {
this.renderer.render(this.stage);
}
/**
* Reference to the renderer's canvas element.
* @member {PIXI.ICanvas}
* @readonly
*/
get view() {
return this.renderer?.view;
}
/**
* Reference to the renderer's screen rectangle. Its safe to use as `filterArea` or `hitArea` for the whole screen.
* @member {PIXI.Rectangle}
* @readonly
*/
get screen() {
return this.renderer?.screen;
}
/**
* Destroy and don't use after this.
* @param {boolean} [removeView=false] - Automatically remove canvas from DOM.
* @param {object|boolean} [stageOptions] - Options parameter. A boolean will act as if all options
* have been set to that value
* @param {boolean} [stageOptions.children=false] - if set to true, all the children will have their destroy
* method called as well. 'stageOptions' will be passed on to those calls.
* @param {boolean} [stageOptions.texture=false] - Only used for child Sprites if stageOptions.children is set
* to true. Should it destroy the texture of the child sprite
* @param {boolean} [stageOptions.baseTexture=false] - Only used for child Sprites if stageOptions.children is set
* to true. Should it destroy the base texture of the child sprite
*/
destroy(removeView, stageOptions) {
const plugins = _Application2._plugins.slice(0);
plugins.reverse(), plugins.forEach((plugin) => {
plugin.destroy.call(this);
}), this.stage.destroy(stageOptions), this.stage = null, this.renderer.destroy(removeView), this.renderer = null;
}
};
_Application._plugins = [];
let Application = _Application;
core.extensions.handleByList(core.ExtensionType.Application, Application._plugins);
exports.Application = Application;
//# sourceMappingURL=Application.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,59 @@
import { autoDetectRenderer, extensions, ExtensionType } from "@pixi/core";
import { Container } from "@pixi/display";
const _Application = class _Application2 {
/**
* @param options - The optional application and renderer parameters.
*/
constructor(options) {
this.stage = new Container(), options = Object.assign({
forceCanvas: !1
}, options), this.renderer = autoDetectRenderer(options), _Application2._plugins.forEach((plugin) => {
plugin.init.call(this, options);
});
}
/** Render the current stage. */
render() {
this.renderer.render(this.stage);
}
/**
* Reference to the renderer's canvas element.
* @member {PIXI.ICanvas}
* @readonly
*/
get view() {
return this.renderer?.view;
}
/**
* Reference to the renderer's screen rectangle. Its safe to use as `filterArea` or `hitArea` for the whole screen.
* @member {PIXI.Rectangle}
* @readonly
*/
get screen() {
return this.renderer?.screen;
}
/**
* Destroy and don't use after this.
* @param {boolean} [removeView=false] - Automatically remove canvas from DOM.
* @param {object|boolean} [stageOptions] - Options parameter. A boolean will act as if all options
* have been set to that value
* @param {boolean} [stageOptions.children=false] - if set to true, all the children will have their destroy
* method called as well. 'stageOptions' will be passed on to those calls.
* @param {boolean} [stageOptions.texture=false] - Only used for child Sprites if stageOptions.children is set
* to true. Should it destroy the texture of the child sprite
* @param {boolean} [stageOptions.baseTexture=false] - Only used for child Sprites if stageOptions.children is set
* to true. Should it destroy the base texture of the child sprite
*/
destroy(removeView, stageOptions) {
const plugins = _Application2._plugins.slice(0);
plugins.reverse(), plugins.forEach((plugin) => {
plugin.destroy.call(this);
}), this.stage.destroy(stageOptions), this.stage = null, this.renderer.destroy(removeView), this.renderer = null;
}
};
_Application._plugins = [];
let Application = _Application;
extensions.handleByList(ExtensionType.Application, Application._plugins);
export {
Application
};
//# sourceMappingURL=Application.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,59 @@
"use strict";
var core = require("@pixi/core");
class ResizePlugin {
/**
* Initialize the plugin with scope of application instance
* @static
* @private
* @param {object} [options] - See application options
*/
static init(options) {
Object.defineProperty(
this,
"resizeTo",
/**
* The HTML element or window to automatically resize the
* renderer's view element to match width and height.
* @member {Window|HTMLElement}
* @name resizeTo
* @memberof PIXI.Application#
*/
{
set(dom) {
globalThis.removeEventListener("resize", this.queueResize), this._resizeTo = dom, dom && (globalThis.addEventListener("resize", this.queueResize), this.resize());
},
get() {
return this._resizeTo;
}
}
), this.queueResize = () => {
this._resizeTo && (this.cancelResize(), this._resizeId = requestAnimationFrame(() => this.resize()));
}, this.cancelResize = () => {
this._resizeId && (cancelAnimationFrame(this._resizeId), this._resizeId = null);
}, this.resize = () => {
if (!this._resizeTo)
return;
this.cancelResize();
let width, height;
if (this._resizeTo === globalThis.window)
width = globalThis.innerWidth, height = globalThis.innerHeight;
else {
const { clientWidth, clientHeight } = this._resizeTo;
width = clientWidth, height = clientHeight;
}
this.renderer.resize(width, height), this.render();
}, this._resizeId = null, this._resizeTo = null, this.resizeTo = options.resizeTo || null;
}
/**
* Clean up the ticker, scoped to application
* @static
* @private
*/
static destroy() {
globalThis.removeEventListener("resize", this.queueResize), this.cancelResize(), this.cancelResize = null, this.queueResize = null, this.resizeTo = null, this.resize = null;
}
}
ResizePlugin.extension = core.ExtensionType.Application;
core.extensions.add(ResizePlugin);
exports.ResizePlugin = ResizePlugin;
//# sourceMappingURL=ResizePlugin.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,60 @@
import { ExtensionType, extensions } from "@pixi/core";
class ResizePlugin {
/**
* Initialize the plugin with scope of application instance
* @static
* @private
* @param {object} [options] - See application options
*/
static init(options) {
Object.defineProperty(
this,
"resizeTo",
/**
* The HTML element or window to automatically resize the
* renderer's view element to match width and height.
* @member {Window|HTMLElement}
* @name resizeTo
* @memberof PIXI.Application#
*/
{
set(dom) {
globalThis.removeEventListener("resize", this.queueResize), this._resizeTo = dom, dom && (globalThis.addEventListener("resize", this.queueResize), this.resize());
},
get() {
return this._resizeTo;
}
}
), this.queueResize = () => {
this._resizeTo && (this.cancelResize(), this._resizeId = requestAnimationFrame(() => this.resize()));
}, this.cancelResize = () => {
this._resizeId && (cancelAnimationFrame(this._resizeId), this._resizeId = null);
}, this.resize = () => {
if (!this._resizeTo)
return;
this.cancelResize();
let width, height;
if (this._resizeTo === globalThis.window)
width = globalThis.innerWidth, height = globalThis.innerHeight;
else {
const { clientWidth, clientHeight } = this._resizeTo;
width = clientWidth, height = clientHeight;
}
this.renderer.resize(width, height), this.render();
}, this._resizeId = null, this._resizeTo = null, this.resizeTo = options.resizeTo || null;
}
/**
* Clean up the ticker, scoped to application
* @static
* @private
*/
static destroy() {
globalThis.removeEventListener("resize", this.queueResize), this.cancelResize(), this.cancelResize = null, this.queueResize = null, this.resizeTo = null, this.resize = null;
}
}
ResizePlugin.extension = ExtensionType.Application;
extensions.add(ResizePlugin);
export {
ResizePlugin
};
//# sourceMappingURL=ResizePlugin.mjs.map

File diff suppressed because one or more lines are too long

5
resources/app/node_modules/@pixi/app/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,5 @@
"use strict";
var Application = require("./Application.js"), ResizePlugin = require("./ResizePlugin.js");
exports.Application = Application.Application;
exports.ResizePlugin = ResizePlugin.ResizePlugin;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}

7
resources/app/node_modules/@pixi/app/lib/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,7 @@
import { Application } from "./Application.mjs";
import { ResizePlugin } from "./ResizePlugin.mjs";
export {
Application,
ResizePlugin
};
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}

38
resources/app/node_modules/@pixi/app/package.json generated vendored Normal file
View File

@@ -0,0 +1,38 @@
{
"name": "@pixi/app",
"version": "7.4.2",
"main": "lib/index.js",
"module": "lib/index.mjs",
"types": "lib/index.d.ts",
"exports": {
".": {
"import": {
"types": "./lib/index.d.ts",
"default": "./lib/index.mjs"
},
"require": {
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
}
}
},
"description": "Convenience class to create a new PixiJS application",
"author": "Mat Groves",
"homepage": "http://pixijs.com/",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/pixijs/pixijs.git"
},
"publishConfig": {
"access": "public"
},
"files": [
"lib",
"*.d.ts"
],
"peerDependencies": {
"@pixi/core": "7.4.2",
"@pixi/display": "7.4.2"
}
}

21
resources/app/node_modules/@pixi/assets/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License
Copyright (c) 2013-2023 Mathew Groves, Chad Engler
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,21 @@
"use strict";
var core = require("@pixi/core");
const assetKeyMap = {
loader: core.ExtensionType.LoadParser,
resolver: core.ExtensionType.ResolveParser,
cache: core.ExtensionType.CacheParser,
detection: core.ExtensionType.DetectionParser
};
core.extensions.handle(core.ExtensionType.Asset, (extension) => {
const ref = extension.ref;
Object.entries(assetKeyMap).filter(([key]) => !!ref[key]).forEach(([key, type]) => core.extensions.add(Object.assign(
ref[key],
// Allow the function to optionally define it's own
// ExtensionMetadata, the use cases here is priority for LoaderParsers
{ extension: ref[key].extension ?? type }
)));
}, (extension) => {
const ref = extension.ref;
Object.keys(assetKeyMap).filter((key) => !!ref[key]).forEach((key) => core.extensions.remove(ref[key]));
});
//# sourceMappingURL=AssetExtension.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AssetExtension.js","sources":["../src/AssetExtension.ts"],"sourcesContent":["import { extensions, ExtensionType } from '@pixi/core';\n\nimport type { CacheParser } from './cache';\nimport type { FormatDetectionParser } from './detections';\nimport type { LoaderParser } from './loader';\nimport type { ResolveURLParser } from './resolver';\n\nconst assetKeyMap = {\n loader: ExtensionType.LoadParser,\n resolver: ExtensionType.ResolveParser,\n cache: ExtensionType.CacheParser,\n detection: ExtensionType.DetectionParser,\n};\n\ntype AssetType = keyof typeof assetKeyMap;\n\n/**\n * This developer convenience object allows developers to group\n * together the various asset parsers into a single object.\n * @memberof PIXI\n */\ninterface AssetExtension<ASSET = any, META_DATA = any>\n{\n extension: ExtensionType.Asset,\n loader?: Partial<LoaderParser<ASSET, META_DATA>>,\n resolver?: Partial<ResolveURLParser>,\n cache?: Partial<CacheParser<ASSET>>,\n detection?: Partial<FormatDetectionParser>,\n}\n\n// Split the Asset extension into it's various parts\n// these are handled in the Assets.ts file\nextensions.handle(ExtensionType.Asset, (extension) =>\n{\n const ref = extension.ref as AssetExtension;\n\n Object.entries(assetKeyMap)\n .filter(([key]) => !!ref[key as AssetType])\n .forEach(([key, type]) => extensions.add(Object.assign(\n ref[key as AssetType],\n // Allow the function to optionally define it's own\n // ExtensionMetadata, the use cases here is priority for LoaderParsers\n { extension: ref[key as AssetType].extension ?? type },\n )));\n}, (extension) =>\n{\n const ref = extension.ref as AssetExtension;\n\n Object.keys(assetKeyMap)\n .filter((key) => !!ref[key as AssetType])\n .forEach((key) => extensions.remove(ref[key as AssetType]));\n});\n\nexport type { AssetExtension };\n"],"names":["ExtensionType","extensions"],"mappings":";;AAOA,MAAM,cAAc;AAAA,EAChB,QAAQA,KAAc,cAAA;AAAA,EACtB,UAAUA,KAAc,cAAA;AAAA,EACxB,OAAOA,KAAc,cAAA;AAAA,EACrB,WAAWA,KAAc,cAAA;AAC7B;AAoBAC,KAAA,WAAW,OAAOD,KAAAA,cAAc,OAAO,CAAC,cACxC;AACI,QAAM,MAAM,UAAU;AAEf,SAAA,QAAQ,WAAW,EACrB,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,IAAI,GAAgB,CAAC,EACzC,QAAQ,CAAC,CAAC,KAAK,IAAI,MAAMC,KAAW,WAAA,IAAI,OAAO;AAAA,IAC5C,IAAI,GAAgB;AAAA;AAAA;AAAA,IAGpB,EAAE,WAAW,IAAI,GAAgB,EAAE,aAAa,KAAK;AAAA,EACxD,CAAA,CAAC;AACV,GAAG,CAAC,cACJ;AACI,QAAM,MAAM,UAAU;AAEf,SAAA,KAAK,WAAW,EAClB,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,GAAgB,CAAC,EACvC,QAAQ,CAAC,QAAQA,KAAA,WAAW,OAAO,IAAI,GAAgB,CAAC,CAAC;AAClE,CAAC;"}

View File

@@ -0,0 +1,20 @@
import { ExtensionType, extensions } from "@pixi/core";
const assetKeyMap = {
loader: ExtensionType.LoadParser,
resolver: ExtensionType.ResolveParser,
cache: ExtensionType.CacheParser,
detection: ExtensionType.DetectionParser
};
extensions.handle(ExtensionType.Asset, (extension) => {
const ref = extension.ref;
Object.entries(assetKeyMap).filter(([key]) => !!ref[key]).forEach(([key, type]) => extensions.add(Object.assign(
ref[key],
// Allow the function to optionally define it's own
// ExtensionMetadata, the use cases here is priority for LoaderParsers
{ extension: ref[key].extension ?? type }
)));
}, (extension) => {
const ref = extension.ref;
Object.keys(assetKeyMap).filter((key) => !!ref[key]).forEach((key) => extensions.remove(ref[key]));
});
//# sourceMappingURL=AssetExtension.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AssetExtension.mjs","sources":["../src/AssetExtension.ts"],"sourcesContent":["import { extensions, ExtensionType } from '@pixi/core';\n\nimport type { CacheParser } from './cache';\nimport type { FormatDetectionParser } from './detections';\nimport type { LoaderParser } from './loader';\nimport type { ResolveURLParser } from './resolver';\n\nconst assetKeyMap = {\n loader: ExtensionType.LoadParser,\n resolver: ExtensionType.ResolveParser,\n cache: ExtensionType.CacheParser,\n detection: ExtensionType.DetectionParser,\n};\n\ntype AssetType = keyof typeof assetKeyMap;\n\n/**\n * This developer convenience object allows developers to group\n * together the various asset parsers into a single object.\n * @memberof PIXI\n */\ninterface AssetExtension<ASSET = any, META_DATA = any>\n{\n extension: ExtensionType.Asset,\n loader?: Partial<LoaderParser<ASSET, META_DATA>>,\n resolver?: Partial<ResolveURLParser>,\n cache?: Partial<CacheParser<ASSET>>,\n detection?: Partial<FormatDetectionParser>,\n}\n\n// Split the Asset extension into it's various parts\n// these are handled in the Assets.ts file\nextensions.handle(ExtensionType.Asset, (extension) =>\n{\n const ref = extension.ref as AssetExtension;\n\n Object.entries(assetKeyMap)\n .filter(([key]) => !!ref[key as AssetType])\n .forEach(([key, type]) => extensions.add(Object.assign(\n ref[key as AssetType],\n // Allow the function to optionally define it's own\n // ExtensionMetadata, the use cases here is priority for LoaderParsers\n { extension: ref[key as AssetType].extension ?? type },\n )));\n}, (extension) =>\n{\n const ref = extension.ref as AssetExtension;\n\n Object.keys(assetKeyMap)\n .filter((key) => !!ref[key as AssetType])\n .forEach((key) => extensions.remove(ref[key as AssetType]));\n});\n\nexport type { AssetExtension };\n"],"names":[],"mappings":";AAOA,MAAM,cAAc;AAAA,EAChB,QAAQ,cAAc;AAAA,EACtB,UAAU,cAAc;AAAA,EACxB,OAAO,cAAc;AAAA,EACrB,WAAW,cAAc;AAC7B;AAoBA,WAAW,OAAO,cAAc,OAAO,CAAC,cACxC;AACI,QAAM,MAAM,UAAU;AAEf,SAAA,QAAQ,WAAW,EACrB,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,IAAI,GAAgB,CAAC,EACzC,QAAQ,CAAC,CAAC,KAAK,IAAI,MAAM,WAAW,IAAI,OAAO;AAAA,IAC5C,IAAI,GAAgB;AAAA;AAAA;AAAA,IAGpB,EAAE,WAAW,IAAI,GAAgB,EAAE,aAAa,KAAK;AAAA,EACxD,CAAA,CAAC;AACV,GAAG,CAAC,cACJ;AACI,QAAM,MAAM,UAAU;AAEf,SAAA,KAAK,WAAW,EAClB,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,GAAgB,CAAC,EACvC,QAAQ,CAAC,QAAQ,WAAW,OAAO,IAAI,GAAgB,CAAC,CAAC;AAClE,CAAC;"}

328
resources/app/node_modules/@pixi/assets/lib/Assets.js generated vendored Normal file
View File

@@ -0,0 +1,328 @@
"use strict";
var core = require("@pixi/core"), BackgroundLoader = require("./BackgroundLoader.js"), Cache = require("./cache/Cache.js"), Loader = require("./loader/Loader.js");
require("./loader/parsers/index.js");
var Resolver = require("./resolver/Resolver.js"), convertToList = require("./utils/convertToList.js"), isSingleItem = require("./utils/isSingleItem.js"), loadTextures = require("./loader/parsers/textures/loadTextures.js");
class AssetsClass {
constructor() {
this._detections = [], this._initialized = !1, this.resolver = new Resolver.Resolver(), this.loader = new Loader.Loader(), this.cache = Cache.Cache, this._backgroundLoader = new BackgroundLoader.BackgroundLoader(this.loader), this._backgroundLoader.active = !0, this.reset();
}
/**
* Best practice is to call this function before any loading commences
* Initiating is the best time to add any customization to the way things are loaded.
*
* you do not need to call this for the Asset class to work, only if you want to set any initial properties
* @param options - options to initialize the Asset manager with
*/
async init(options = {}) {
if (this._initialized) {
console.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");
return;
}
if (this._initialized = !0, options.defaultSearchParams && this.resolver.setDefaultSearchParams(options.defaultSearchParams), options.basePath && (this.resolver.basePath = options.basePath), options.bundleIdentifier && this.resolver.setBundleIdentifier(options.bundleIdentifier), options.manifest) {
let manifest = options.manifest;
typeof manifest == "string" && (manifest = await this.load(manifest)), this.resolver.addManifest(manifest);
}
const resolutionPref = options.texturePreference?.resolution ?? 1, resolution = typeof resolutionPref == "number" ? [resolutionPref] : resolutionPref, formats = await this._detectFormats({
preferredFormats: options.texturePreference?.format,
skipDetections: options.skipDetections,
detections: this._detections
});
this.resolver.prefer({
params: {
format: formats,
resolution
}
}), options.preferences && this.setPreferences(options.preferences);
}
add(aliases, srcs, data, format, loadParser) {
this.resolver.add(aliases, srcs, data, format, loadParser);
}
async load(urls, onProgress) {
this._initialized || await this.init();
const singleAsset = isSingleItem.isSingleItem(urls), urlArray = convertToList.convertToList(urls).map((url) => {
if (typeof url != "string") {
const aliases = this.resolver.getAlias(url);
return aliases.some((alias) => !this.resolver.hasKey(alias)) && this.add(url), Array.isArray(aliases) ? aliases[0] : aliases;
}
return this.resolver.hasKey(url) || this.add({ alias: url, src: url }), url;
}), resolveResults = this.resolver.resolve(urlArray), out = await this._mapLoadToResolve(resolveResults, onProgress);
return singleAsset ? out[urlArray[0]] : out;
}
/**
* This adds a bundle of assets in one go so that you can load them as a group.
* For example you could add a bundle for each screen in you pixi app
* @example
* import { Assets } from 'pixi.js';
*
* Assets.addBundle('animals', {
* bunny: 'bunny.png',
* chicken: 'chicken.png',
* thumper: 'thumper.png',
* });
*
* const assets = await Assets.loadBundle('animals');
* @param bundleId - the id of the bundle to add
* @param assets - a record of the asset or assets that will be chosen from when loading via the specified key
*/
addBundle(bundleId, assets) {
this.resolver.addBundle(bundleId, assets);
}
/**
* Bundles are a way to load multiple assets at once.
* If a manifest has been provided to the init function then you can load a bundle, or bundles.
* you can also add bundles via `addBundle`
* @example
* import { Assets } from 'pixi.js';
*
* // Manifest Example
* const manifest = {
* bundles: [
* {
* name: 'load-screen',
* assets: [
* {
* alias: 'background',
* src: 'sunset.png',
* },
* {
* alias: 'bar',
* src: 'load-bar.{png,webp}',
* },
* ],
* },
* {
* name: 'game-screen',
* assets: [
* {
* alias: 'character',
* src: 'robot.png',
* },
* {
* alias: 'enemy',
* src: 'bad-guy.png',
* },
* ],
* },
* ]
* };
*
* await Assets.init({ manifest });
*
* // Load a bundle...
* loadScreenAssets = await Assets.loadBundle('load-screen');
* // Load another bundle...
* gameScreenAssets = await Assets.loadBundle('game-screen');
* @param bundleIds - the bundle id or ids to load
* @param onProgress - Optional function that is called when progress on asset loading is made.
* The function is passed a single parameter, `progress`, which represents the percentage (0.0 - 1.0)
* of the assets loaded. Do not use this function to detect when assets are complete and available,
* instead use the Promise returned by this function.
* @returns all the bundles assets or a hash of assets for each bundle specified
*/
async loadBundle(bundleIds, onProgress) {
this._initialized || await this.init();
let singleAsset = !1;
typeof bundleIds == "string" && (singleAsset = !0, bundleIds = [bundleIds]);
const resolveResults = this.resolver.resolveBundle(bundleIds), out = {}, keys = Object.keys(resolveResults);
let count = 0, total = 0;
const _onProgress = () => {
onProgress?.(++count / total);
}, promises = keys.map((bundleId) => {
const resolveResult = resolveResults[bundleId];
return total += Object.keys(resolveResult).length, this._mapLoadToResolve(resolveResult, _onProgress).then((resolveResult2) => {
out[bundleId] = resolveResult2;
});
});
return await Promise.all(promises), singleAsset ? out[bundleIds[0]] : out;
}
/**
* Initiate a background load of some assets. It will passively begin to load these assets in the background.
* So when you actually come to loading them you will get a promise that resolves to the loaded assets immediately
*
* An example of this might be that you would background load game assets after your inital load.
* then when you got to actually load your game screen assets when a player goes to the game - the loading
* would already have stared or may even be complete, saving you having to show an interim load bar.
* @example
* import { Assets } from 'pixi.js';
*
* Assets.backgroundLoad('bunny.png');
*
* // later on in your app...
* await Assets.loadBundle('bunny.png'); // Will resolve quicker as loading may have completed!
* @param urls - the url / urls you want to background load
*/
async backgroundLoad(urls) {
this._initialized || await this.init(), typeof urls == "string" && (urls = [urls]);
const resolveResults = this.resolver.resolve(urls);
this._backgroundLoader.add(Object.values(resolveResults));
}
/**
* Initiate a background of a bundle, works exactly like backgroundLoad but for bundles.
* this can only be used if the loader has been initiated with a manifest
* @example
* import { Assets } from 'pixi.js';
*
* await Assets.init({
* manifest: {
* bundles: [
* {
* name: 'load-screen',
* assets: [...],
* },
* ...
* ],
* },
* });
*
* Assets.backgroundLoadBundle('load-screen');
*
* // Later on in your app...
* await Assets.loadBundle('load-screen'); // Will resolve quicker as loading may have completed!
* @param bundleIds - the bundleId / bundleIds you want to background load
*/
async backgroundLoadBundle(bundleIds) {
this._initialized || await this.init(), typeof bundleIds == "string" && (bundleIds = [bundleIds]);
const resolveResults = this.resolver.resolveBundle(bundleIds);
Object.values(resolveResults).forEach((resolveResult) => {
this._backgroundLoader.add(Object.values(resolveResult));
});
}
/**
* Only intended for development purposes.
* This will wipe the resolver and caches.
* You will need to reinitialize the Asset
*/
reset() {
this.resolver.reset(), this.loader.reset(), this.cache.reset(), this._initialized = !1;
}
get(keys) {
if (typeof keys == "string")
return Cache.Cache.get(keys);
const assets = {};
for (let i = 0; i < keys.length; i++)
assets[i] = Cache.Cache.get(keys[i]);
return assets;
}
/**
* helper function to map resolved assets back to loaded assets
* @param resolveResults - the resolve results from the resolver
* @param onProgress - the progress callback
*/
async _mapLoadToResolve(resolveResults, onProgress) {
const resolveArray = Object.values(resolveResults), resolveKeys = Object.keys(resolveResults);
this._backgroundLoader.active = !1;
const loadedAssets = await this.loader.load(resolveArray, onProgress);
this._backgroundLoader.active = !0;
const out = {};
return resolveArray.forEach((resolveResult, i) => {
const asset = loadedAssets[resolveResult.src], keys = [resolveResult.src];
resolveResult.alias && keys.push(...resolveResult.alias), out[resolveKeys[i]] = asset, Cache.Cache.set(keys, asset);
}), out;
}
/**
* Unload an asset or assets. As the Assets class is responsible for creating the assets via the `load` function
* this will make sure to destroy any assets and release them from memory.
* Once unloaded, you will need to load the asset again.
*
* Use this to help manage assets if you find that you have a large app and you want to free up memory.
*
* - it's up to you as the developer to make sure that textures are not actively being used when you unload them,
* Pixi won't break but you will end up with missing assets. Not a good look for the user!
* @example
* import { Assets } from 'pixi.js';
*
* // Load a URL:
* const myImageTexture = await Assets.load('http://some.url.com/image.png'); // => returns a texture
*
* await Assets.unload('http://some.url.com/image.png')
*
* // myImageTexture will be destroyed now.
*
* // Unload multiple assets:
* const textures = await Assets.unload(['thumper', 'chicko']);
* @param urls - the urls to unload
*/
async unload(urls) {
this._initialized || await this.init();
const urlArray = convertToList.convertToList(urls).map((url) => typeof url != "string" ? url.src : url), resolveResults = this.resolver.resolve(urlArray);
await this._unloadFromResolved(resolveResults);
}
/**
* Bundles are a way to manage multiple assets at once.
* this will unload all files in a bundle.
*
* once a bundle has been unloaded, you need to load it again to have access to the assets.
* @example
* import { Assets } from 'pixi.js';
*
* Assets.addBundle({
* 'thumper': 'http://some.url.com/thumper.png',
* })
*
* const assets = await Assets.loadBundle('thumper');
*
* // Now to unload...
*
* await Assets.unloadBundle('thumper');
*
* // All assets in the assets object will now have been destroyed and purged from the cache
* @param bundleIds - the bundle id or ids to unload
*/
async unloadBundle(bundleIds) {
this._initialized || await this.init(), bundleIds = convertToList.convertToList(bundleIds);
const resolveResults = this.resolver.resolveBundle(bundleIds), promises = Object.keys(resolveResults).map((bundleId) => this._unloadFromResolved(resolveResults[bundleId]));
await Promise.all(promises);
}
async _unloadFromResolved(resolveResult) {
const resolveArray = Object.values(resolveResult);
resolveArray.forEach((resolveResult2) => {
Cache.Cache.remove(resolveResult2.src);
}), await this.loader.unload(resolveArray);
}
/**
* Detects the supported formats for the browser, and returns an array of supported formats, respecting
* the users preferred formats order.
* @param options - the options to use when detecting formats
* @param options.preferredFormats - the preferred formats to use
* @param options.skipDetections - if we should skip the detections altogether
* @param options.detections - the detections to use
* @returns - the detected formats
*/
async _detectFormats(options) {
let formats = [];
options.preferredFormats && (formats = Array.isArray(options.preferredFormats) ? options.preferredFormats : [options.preferredFormats]);
for (const detection of options.detections)
options.skipDetections || await detection.test() ? formats = await detection.add(formats) : options.skipDetections || (formats = await detection.remove(formats));
return formats = formats.filter((format, index) => formats.indexOf(format) === index), formats;
}
/** All the detection parsers currently added to the Assets class. */
get detections() {
return this._detections;
}
/**
* @deprecated since 7.2.0
* @see {@link Assets.setPreferences}
*/
get preferWorkers() {
return loadTextures.loadTextures.config.preferWorkers;
}
set preferWorkers(value) {
core.utils.deprecation("7.2.0", "Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead."), this.setPreferences({ preferWorkers: value });
}
/**
* General setter for preferences. This is a helper function to set preferences on all parsers.
* @param preferences - the preferences to set
*/
setPreferences(preferences) {
this.loader.parsers.forEach((parser) => {
parser.config && Object.keys(parser.config).filter((key) => key in preferences).forEach((key) => {
parser.config[key] = preferences[key];
});
});
}
}
const Assets = new AssetsClass();
core.extensions.handleByList(core.ExtensionType.LoadParser, Assets.loader.parsers).handleByList(core.ExtensionType.ResolveParser, Assets.resolver.parsers).handleByList(core.ExtensionType.CacheParser, Assets.cache.parsers).handleByList(core.ExtensionType.DetectionParser, Assets.detections);
exports.Assets = Assets;
exports.AssetsClass = AssetsClass;
//# sourceMappingURL=Assets.js.map

File diff suppressed because one or more lines are too long

335
resources/app/node_modules/@pixi/assets/lib/Assets.mjs generated vendored Normal file
View File

@@ -0,0 +1,335 @@
import { utils, extensions, ExtensionType } from "@pixi/core";
import { BackgroundLoader } from "./BackgroundLoader.mjs";
import { Cache } from "./cache/Cache.mjs";
import { Loader } from "./loader/Loader.mjs";
import "./loader/parsers/index.mjs";
import { Resolver } from "./resolver/Resolver.mjs";
import { convertToList } from "./utils/convertToList.mjs";
import { isSingleItem } from "./utils/isSingleItem.mjs";
import { loadTextures } from "./loader/parsers/textures/loadTextures.mjs";
class AssetsClass {
constructor() {
this._detections = [], this._initialized = !1, this.resolver = new Resolver(), this.loader = new Loader(), this.cache = Cache, this._backgroundLoader = new BackgroundLoader(this.loader), this._backgroundLoader.active = !0, this.reset();
}
/**
* Best practice is to call this function before any loading commences
* Initiating is the best time to add any customization to the way things are loaded.
*
* you do not need to call this for the Asset class to work, only if you want to set any initial properties
* @param options - options to initialize the Asset manager with
*/
async init(options = {}) {
if (this._initialized) {
console.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");
return;
}
if (this._initialized = !0, options.defaultSearchParams && this.resolver.setDefaultSearchParams(options.defaultSearchParams), options.basePath && (this.resolver.basePath = options.basePath), options.bundleIdentifier && this.resolver.setBundleIdentifier(options.bundleIdentifier), options.manifest) {
let manifest = options.manifest;
typeof manifest == "string" && (manifest = await this.load(manifest)), this.resolver.addManifest(manifest);
}
const resolutionPref = options.texturePreference?.resolution ?? 1, resolution = typeof resolutionPref == "number" ? [resolutionPref] : resolutionPref, formats = await this._detectFormats({
preferredFormats: options.texturePreference?.format,
skipDetections: options.skipDetections,
detections: this._detections
});
this.resolver.prefer({
params: {
format: formats,
resolution
}
}), options.preferences && this.setPreferences(options.preferences);
}
add(aliases, srcs, data, format, loadParser) {
this.resolver.add(aliases, srcs, data, format, loadParser);
}
async load(urls, onProgress) {
this._initialized || await this.init();
const singleAsset = isSingleItem(urls), urlArray = convertToList(urls).map((url) => {
if (typeof url != "string") {
const aliases = this.resolver.getAlias(url);
return aliases.some((alias) => !this.resolver.hasKey(alias)) && this.add(url), Array.isArray(aliases) ? aliases[0] : aliases;
}
return this.resolver.hasKey(url) || this.add({ alias: url, src: url }), url;
}), resolveResults = this.resolver.resolve(urlArray), out = await this._mapLoadToResolve(resolveResults, onProgress);
return singleAsset ? out[urlArray[0]] : out;
}
/**
* This adds a bundle of assets in one go so that you can load them as a group.
* For example you could add a bundle for each screen in you pixi app
* @example
* import { Assets } from 'pixi.js';
*
* Assets.addBundle('animals', {
* bunny: 'bunny.png',
* chicken: 'chicken.png',
* thumper: 'thumper.png',
* });
*
* const assets = await Assets.loadBundle('animals');
* @param bundleId - the id of the bundle to add
* @param assets - a record of the asset or assets that will be chosen from when loading via the specified key
*/
addBundle(bundleId, assets) {
this.resolver.addBundle(bundleId, assets);
}
/**
* Bundles are a way to load multiple assets at once.
* If a manifest has been provided to the init function then you can load a bundle, or bundles.
* you can also add bundles via `addBundle`
* @example
* import { Assets } from 'pixi.js';
*
* // Manifest Example
* const manifest = {
* bundles: [
* {
* name: 'load-screen',
* assets: [
* {
* alias: 'background',
* src: 'sunset.png',
* },
* {
* alias: 'bar',
* src: 'load-bar.{png,webp}',
* },
* ],
* },
* {
* name: 'game-screen',
* assets: [
* {
* alias: 'character',
* src: 'robot.png',
* },
* {
* alias: 'enemy',
* src: 'bad-guy.png',
* },
* ],
* },
* ]
* };
*
* await Assets.init({ manifest });
*
* // Load a bundle...
* loadScreenAssets = await Assets.loadBundle('load-screen');
* // Load another bundle...
* gameScreenAssets = await Assets.loadBundle('game-screen');
* @param bundleIds - the bundle id or ids to load
* @param onProgress - Optional function that is called when progress on asset loading is made.
* The function is passed a single parameter, `progress`, which represents the percentage (0.0 - 1.0)
* of the assets loaded. Do not use this function to detect when assets are complete and available,
* instead use the Promise returned by this function.
* @returns all the bundles assets or a hash of assets for each bundle specified
*/
async loadBundle(bundleIds, onProgress) {
this._initialized || await this.init();
let singleAsset = !1;
typeof bundleIds == "string" && (singleAsset = !0, bundleIds = [bundleIds]);
const resolveResults = this.resolver.resolveBundle(bundleIds), out = {}, keys = Object.keys(resolveResults);
let count = 0, total = 0;
const _onProgress = () => {
onProgress?.(++count / total);
}, promises = keys.map((bundleId) => {
const resolveResult = resolveResults[bundleId];
return total += Object.keys(resolveResult).length, this._mapLoadToResolve(resolveResult, _onProgress).then((resolveResult2) => {
out[bundleId] = resolveResult2;
});
});
return await Promise.all(promises), singleAsset ? out[bundleIds[0]] : out;
}
/**
* Initiate a background load of some assets. It will passively begin to load these assets in the background.
* So when you actually come to loading them you will get a promise that resolves to the loaded assets immediately
*
* An example of this might be that you would background load game assets after your inital load.
* then when you got to actually load your game screen assets when a player goes to the game - the loading
* would already have stared or may even be complete, saving you having to show an interim load bar.
* @example
* import { Assets } from 'pixi.js';
*
* Assets.backgroundLoad('bunny.png');
*
* // later on in your app...
* await Assets.loadBundle('bunny.png'); // Will resolve quicker as loading may have completed!
* @param urls - the url / urls you want to background load
*/
async backgroundLoad(urls) {
this._initialized || await this.init(), typeof urls == "string" && (urls = [urls]);
const resolveResults = this.resolver.resolve(urls);
this._backgroundLoader.add(Object.values(resolveResults));
}
/**
* Initiate a background of a bundle, works exactly like backgroundLoad but for bundles.
* this can only be used if the loader has been initiated with a manifest
* @example
* import { Assets } from 'pixi.js';
*
* await Assets.init({
* manifest: {
* bundles: [
* {
* name: 'load-screen',
* assets: [...],
* },
* ...
* ],
* },
* });
*
* Assets.backgroundLoadBundle('load-screen');
*
* // Later on in your app...
* await Assets.loadBundle('load-screen'); // Will resolve quicker as loading may have completed!
* @param bundleIds - the bundleId / bundleIds you want to background load
*/
async backgroundLoadBundle(bundleIds) {
this._initialized || await this.init(), typeof bundleIds == "string" && (bundleIds = [bundleIds]);
const resolveResults = this.resolver.resolveBundle(bundleIds);
Object.values(resolveResults).forEach((resolveResult) => {
this._backgroundLoader.add(Object.values(resolveResult));
});
}
/**
* Only intended for development purposes.
* This will wipe the resolver and caches.
* You will need to reinitialize the Asset
*/
reset() {
this.resolver.reset(), this.loader.reset(), this.cache.reset(), this._initialized = !1;
}
get(keys) {
if (typeof keys == "string")
return Cache.get(keys);
const assets = {};
for (let i = 0; i < keys.length; i++)
assets[i] = Cache.get(keys[i]);
return assets;
}
/**
* helper function to map resolved assets back to loaded assets
* @param resolveResults - the resolve results from the resolver
* @param onProgress - the progress callback
*/
async _mapLoadToResolve(resolveResults, onProgress) {
const resolveArray = Object.values(resolveResults), resolveKeys = Object.keys(resolveResults);
this._backgroundLoader.active = !1;
const loadedAssets = await this.loader.load(resolveArray, onProgress);
this._backgroundLoader.active = !0;
const out = {};
return resolveArray.forEach((resolveResult, i) => {
const asset = loadedAssets[resolveResult.src], keys = [resolveResult.src];
resolveResult.alias && keys.push(...resolveResult.alias), out[resolveKeys[i]] = asset, Cache.set(keys, asset);
}), out;
}
/**
* Unload an asset or assets. As the Assets class is responsible for creating the assets via the `load` function
* this will make sure to destroy any assets and release them from memory.
* Once unloaded, you will need to load the asset again.
*
* Use this to help manage assets if you find that you have a large app and you want to free up memory.
*
* - it's up to you as the developer to make sure that textures are not actively being used when you unload them,
* Pixi won't break but you will end up with missing assets. Not a good look for the user!
* @example
* import { Assets } from 'pixi.js';
*
* // Load a URL:
* const myImageTexture = await Assets.load('http://some.url.com/image.png'); // => returns a texture
*
* await Assets.unload('http://some.url.com/image.png')
*
* // myImageTexture will be destroyed now.
*
* // Unload multiple assets:
* const textures = await Assets.unload(['thumper', 'chicko']);
* @param urls - the urls to unload
*/
async unload(urls) {
this._initialized || await this.init();
const urlArray = convertToList(urls).map((url) => typeof url != "string" ? url.src : url), resolveResults = this.resolver.resolve(urlArray);
await this._unloadFromResolved(resolveResults);
}
/**
* Bundles are a way to manage multiple assets at once.
* this will unload all files in a bundle.
*
* once a bundle has been unloaded, you need to load it again to have access to the assets.
* @example
* import { Assets } from 'pixi.js';
*
* Assets.addBundle({
* 'thumper': 'http://some.url.com/thumper.png',
* })
*
* const assets = await Assets.loadBundle('thumper');
*
* // Now to unload...
*
* await Assets.unloadBundle('thumper');
*
* // All assets in the assets object will now have been destroyed and purged from the cache
* @param bundleIds - the bundle id or ids to unload
*/
async unloadBundle(bundleIds) {
this._initialized || await this.init(), bundleIds = convertToList(bundleIds);
const resolveResults = this.resolver.resolveBundle(bundleIds), promises = Object.keys(resolveResults).map((bundleId) => this._unloadFromResolved(resolveResults[bundleId]));
await Promise.all(promises);
}
async _unloadFromResolved(resolveResult) {
const resolveArray = Object.values(resolveResult);
resolveArray.forEach((resolveResult2) => {
Cache.remove(resolveResult2.src);
}), await this.loader.unload(resolveArray);
}
/**
* Detects the supported formats for the browser, and returns an array of supported formats, respecting
* the users preferred formats order.
* @param options - the options to use when detecting formats
* @param options.preferredFormats - the preferred formats to use
* @param options.skipDetections - if we should skip the detections altogether
* @param options.detections - the detections to use
* @returns - the detected formats
*/
async _detectFormats(options) {
let formats = [];
options.preferredFormats && (formats = Array.isArray(options.preferredFormats) ? options.preferredFormats : [options.preferredFormats]);
for (const detection of options.detections)
options.skipDetections || await detection.test() ? formats = await detection.add(formats) : options.skipDetections || (formats = await detection.remove(formats));
return formats = formats.filter((format, index) => formats.indexOf(format) === index), formats;
}
/** All the detection parsers currently added to the Assets class. */
get detections() {
return this._detections;
}
/**
* @deprecated since 7.2.0
* @see {@link Assets.setPreferences}
*/
get preferWorkers() {
return loadTextures.config.preferWorkers;
}
set preferWorkers(value) {
utils.deprecation("7.2.0", "Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead."), this.setPreferences({ preferWorkers: value });
}
/**
* General setter for preferences. This is a helper function to set preferences on all parsers.
* @param preferences - the preferences to set
*/
setPreferences(preferences) {
this.loader.parsers.forEach((parser) => {
parser.config && Object.keys(parser.config).filter((key) => key in preferences).forEach((key) => {
parser.config[key] = preferences[key];
});
});
}
}
const Assets = new AssetsClass();
extensions.handleByList(ExtensionType.LoadParser, Assets.loader.parsers).handleByList(ExtensionType.ResolveParser, Assets.resolver.parsers).handleByList(ExtensionType.CacheParser, Assets.cache.parsers).handleByList(ExtensionType.DetectionParser, Assets.detections);
export {
Assets,
AssetsClass
};
//# sourceMappingURL=Assets.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,45 @@
"use strict";
class BackgroundLoader {
/**
* @param loader
* @param verbose - should the loader log to the console
*/
constructor(loader, verbose = !1) {
this._loader = loader, this._assetList = [], this._isLoading = !1, this._maxConcurrent = 1, this.verbose = verbose;
}
/**
* Adds an array of assets to load.
* @param assetUrls - assets to load
*/
add(assetUrls) {
assetUrls.forEach((a) => {
this._assetList.push(a);
}), this.verbose && console.log("[BackgroundLoader] assets: ", this._assetList), this._isActive && !this._isLoading && this._next();
}
/**
* Loads the next set of assets. Will try to load as many assets as it can at the same time.
*
* The max assets it will try to load at one time will be 4.
*/
async _next() {
if (this._assetList.length && this._isActive) {
this._isLoading = !0;
const toLoad = [], toLoadAmount = Math.min(this._assetList.length, this._maxConcurrent);
for (let i = 0; i < toLoadAmount; i++)
toLoad.push(this._assetList.pop());
await this._loader.load(toLoad), this._isLoading = !1, this._next();
}
}
/**
* Activate/Deactivate the loading. If set to true then it will immediately continue to load the next asset.
* @returns whether the class is active
*/
get active() {
return this._isActive;
}
set active(value) {
this._isActive !== value && (this._isActive = value, value && !this._isLoading && this._next());
}
}
exports.BackgroundLoader = BackgroundLoader;
//# sourceMappingURL=BackgroundLoader.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BackgroundLoader.js","sources":["../src/BackgroundLoader.ts"],"sourcesContent":["import type { Loader } from './loader/Loader';\nimport type { ResolvedAsset } from './types';\n\n/**\n * Quietly Loads assets in the background.\n * @memberof PIXI\n */\nexport class BackgroundLoader\n{\n /** Whether or not the loader should continue loading. */\n private _isActive: boolean;\n\n /** Assets to load. */\n private readonly _assetList: ResolvedAsset[];\n\n /** Whether or not the loader is loading. */\n private _isLoading: boolean;\n\n /** Number of assets to load at a time. */\n private readonly _maxConcurrent: number;\n\n /** Should the loader log to the console. */\n public verbose: boolean;\n private readonly _loader: Loader;\n\n /**\n * @param loader\n * @param verbose - should the loader log to the console\n */\n constructor(loader: Loader, verbose = false)\n {\n this._loader = loader;\n this._assetList = [];\n this._isLoading = false;\n this._maxConcurrent = 1;\n this.verbose = verbose;\n }\n\n /**\n * Adds an array of assets to load.\n * @param assetUrls - assets to load\n */\n public add(assetUrls: ResolvedAsset[]): void\n {\n assetUrls.forEach((a) =>\n {\n this._assetList.push(a);\n });\n\n if (this.verbose)\n {\n // eslint-disable-next-line no-console\n console.log('[BackgroundLoader] assets: ', this._assetList);\n }\n\n if (this._isActive && !this._isLoading)\n {\n this._next();\n }\n }\n\n /**\n * Loads the next set of assets. Will try to load as many assets as it can at the same time.\n *\n * The max assets it will try to load at one time will be 4.\n */\n private async _next(): Promise<void>\n {\n if (this._assetList.length && this._isActive)\n {\n this._isLoading = true;\n\n const toLoad = [];\n\n const toLoadAmount = Math.min(this._assetList.length, this._maxConcurrent);\n\n for (let i = 0; i < toLoadAmount; i++)\n {\n toLoad.push(this._assetList.pop());\n }\n\n await this._loader.load(toLoad);\n\n this._isLoading = false;\n\n this._next();\n }\n }\n\n /**\n * Activate/Deactivate the loading. If set to true then it will immediately continue to load the next asset.\n * @returns whether the class is active\n */\n get active(): boolean\n {\n return this._isActive;\n }\n\n set active(value: boolean)\n {\n if (this._isActive === value) return;\n\n this._isActive = value;\n\n if (value && !this._isLoading)\n {\n this._next();\n }\n }\n}\n"],"names":[],"mappings":";AAOO,MAAM,iBACb;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBI,YAAY,QAAgB,UAAU,IACtC;AACI,SAAK,UAAU,QACf,KAAK,aAAa,CAAC,GACnB,KAAK,aAAa,IAClB,KAAK,iBAAiB,GACtB,KAAK,UAAU;AAAA,EACnB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,IAAI,WACX;AACc,cAAA,QAAQ,CAAC,MACnB;AACS,WAAA,WAAW,KAAK,CAAC;AAAA,IAAA,CACzB,GAEG,KAAK,WAGL,QAAQ,IAAI,+BAA+B,KAAK,UAAU,GAG1D,KAAK,aAAa,CAAC,KAAK,cAExB,KAAK;EAEb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAc,QACd;AACI,QAAI,KAAK,WAAW,UAAU,KAAK,WACnC;AACI,WAAK,aAAa;AAEZ,YAAA,SAAS,CAAA,GAET,eAAe,KAAK,IAAI,KAAK,WAAW,QAAQ,KAAK,cAAc;AAEhE,eAAA,IAAI,GAAG,IAAI,cAAc;AAE9B,eAAO,KAAK,KAAK,WAAW,IAAK,CAAA;AAG/B,YAAA,KAAK,QAAQ,KAAK,MAAM,GAE9B,KAAK,aAAa,IAElB,KAAK,MAAM;AAAA,IACf;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,SACJ;AACI,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,OAAO,OACX;AACQ,SAAK,cAAc,UAEvB,KAAK,YAAY,OAEb,SAAS,CAAC,KAAK,cAEf,KAAK,MAAM;AAAA,EAEnB;AACJ;;"}

View File

@@ -0,0 +1,46 @@
class BackgroundLoader {
/**
* @param loader
* @param verbose - should the loader log to the console
*/
constructor(loader, verbose = !1) {
this._loader = loader, this._assetList = [], this._isLoading = !1, this._maxConcurrent = 1, this.verbose = verbose;
}
/**
* Adds an array of assets to load.
* @param assetUrls - assets to load
*/
add(assetUrls) {
assetUrls.forEach((a) => {
this._assetList.push(a);
}), this.verbose && console.log("[BackgroundLoader] assets: ", this._assetList), this._isActive && !this._isLoading && this._next();
}
/**
* Loads the next set of assets. Will try to load as many assets as it can at the same time.
*
* The max assets it will try to load at one time will be 4.
*/
async _next() {
if (this._assetList.length && this._isActive) {
this._isLoading = !0;
const toLoad = [], toLoadAmount = Math.min(this._assetList.length, this._maxConcurrent);
for (let i = 0; i < toLoadAmount; i++)
toLoad.push(this._assetList.pop());
await this._loader.load(toLoad), this._isLoading = !1, this._next();
}
}
/**
* Activate/Deactivate the loading. If set to true then it will immediately continue to load the next asset.
* @returns whether the class is active
*/
get active() {
return this._isActive;
}
set active(value) {
this._isActive !== value && (this._isActive = value, value && !this._isLoading && this._next());
}
}
export {
BackgroundLoader
};
//# sourceMappingURL=BackgroundLoader.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BackgroundLoader.mjs","sources":["../src/BackgroundLoader.ts"],"sourcesContent":["import type { Loader } from './loader/Loader';\nimport type { ResolvedAsset } from './types';\n\n/**\n * Quietly Loads assets in the background.\n * @memberof PIXI\n */\nexport class BackgroundLoader\n{\n /** Whether or not the loader should continue loading. */\n private _isActive: boolean;\n\n /** Assets to load. */\n private readonly _assetList: ResolvedAsset[];\n\n /** Whether or not the loader is loading. */\n private _isLoading: boolean;\n\n /** Number of assets to load at a time. */\n private readonly _maxConcurrent: number;\n\n /** Should the loader log to the console. */\n public verbose: boolean;\n private readonly _loader: Loader;\n\n /**\n * @param loader\n * @param verbose - should the loader log to the console\n */\n constructor(loader: Loader, verbose = false)\n {\n this._loader = loader;\n this._assetList = [];\n this._isLoading = false;\n this._maxConcurrent = 1;\n this.verbose = verbose;\n }\n\n /**\n * Adds an array of assets to load.\n * @param assetUrls - assets to load\n */\n public add(assetUrls: ResolvedAsset[]): void\n {\n assetUrls.forEach((a) =>\n {\n this._assetList.push(a);\n });\n\n if (this.verbose)\n {\n // eslint-disable-next-line no-console\n console.log('[BackgroundLoader] assets: ', this._assetList);\n }\n\n if (this._isActive && !this._isLoading)\n {\n this._next();\n }\n }\n\n /**\n * Loads the next set of assets. Will try to load as many assets as it can at the same time.\n *\n * The max assets it will try to load at one time will be 4.\n */\n private async _next(): Promise<void>\n {\n if (this._assetList.length && this._isActive)\n {\n this._isLoading = true;\n\n const toLoad = [];\n\n const toLoadAmount = Math.min(this._assetList.length, this._maxConcurrent);\n\n for (let i = 0; i < toLoadAmount; i++)\n {\n toLoad.push(this._assetList.pop());\n }\n\n await this._loader.load(toLoad);\n\n this._isLoading = false;\n\n this._next();\n }\n }\n\n /**\n * Activate/Deactivate the loading. If set to true then it will immediately continue to load the next asset.\n * @returns whether the class is active\n */\n get active(): boolean\n {\n return this._isActive;\n }\n\n set active(value: boolean)\n {\n if (this._isActive === value) return;\n\n this._isActive = value;\n\n if (value && !this._isLoading)\n {\n this._next();\n }\n }\n}\n"],"names":[],"mappings":"AAOO,MAAM,iBACb;AAAA;AAAA;AAAA;AAAA;AAAA,EAqBI,YAAY,QAAgB,UAAU,IACtC;AACI,SAAK,UAAU,QACf,KAAK,aAAa,CAAC,GACnB,KAAK,aAAa,IAClB,KAAK,iBAAiB,GACtB,KAAK,UAAU;AAAA,EACnB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,IAAI,WACX;AACc,cAAA,QAAQ,CAAC,MACnB;AACS,WAAA,WAAW,KAAK,CAAC;AAAA,IAAA,CACzB,GAEG,KAAK,WAGL,QAAQ,IAAI,+BAA+B,KAAK,UAAU,GAG1D,KAAK,aAAa,CAAC,KAAK,cAExB,KAAK;EAEb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAc,QACd;AACI,QAAI,KAAK,WAAW,UAAU,KAAK,WACnC;AACI,WAAK,aAAa;AAEZ,YAAA,SAAS,CAAA,GAET,eAAe,KAAK,IAAI,KAAK,WAAW,QAAQ,KAAK,cAAc;AAEhE,eAAA,IAAI,GAAG,IAAI,cAAc;AAE9B,eAAO,KAAK,KAAK,WAAW,IAAK,CAAA;AAG/B,YAAA,KAAK,QAAQ,KAAK,MAAM,GAE9B,KAAK,aAAa,IAElB,KAAK,MAAM;AAAA,IACf;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,SACJ;AACI,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,IAAI,OAAO,OACX;AACQ,SAAK,cAAc,UAEvB,KAAK,YAAY,OAEb,SAAS,CAAC,KAAK,cAEf,KAAK,MAAM;AAAA,EAEnB;AACJ;"}

View File

@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: !0 });
const WORKER_CODE = `(function() {
"use strict";
const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
async function checkImageBitmap() {
try {
if (typeof createImageBitmap != "function")
return !1;
const imageBlob = await (await fetch(WHITE_PNG)).blob(), imageBitmap = await createImageBitmap(imageBlob);
return imageBitmap.width === 1 && imageBitmap.height === 1;
} catch {
return !1;
}
}
checkImageBitmap().then((result) => {
self.postMessage(result);
});
})();
`;
let WORKER_URL = null;
class WorkerInstance {
constructor() {
WORKER_URL || (WORKER_URL = URL.createObjectURL(new Blob([WORKER_CODE], { type: "application/javascript" }))), this.worker = new Worker(WORKER_URL);
}
}
WorkerInstance.revokeObjectURL = function() {
WORKER_URL && (URL.revokeObjectURL(WORKER_URL), WORKER_URL = null);
};
exports.default = WorkerInstance;
//# sourceMappingURL=checkImageBitmap.worker.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"checkImageBitmap.worker.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,31 @@
const WORKER_CODE = `(function() {
"use strict";
const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
async function checkImageBitmap() {
try {
if (typeof createImageBitmap != "function")
return !1;
const imageBlob = await (await fetch(WHITE_PNG)).blob(), imageBitmap = await createImageBitmap(imageBlob);
return imageBitmap.width === 1 && imageBitmap.height === 1;
} catch {
return !1;
}
}
checkImageBitmap().then((result) => {
self.postMessage(result);
});
})();
`;
let WORKER_URL = null;
class WorkerInstance {
constructor() {
WORKER_URL || (WORKER_URL = URL.createObjectURL(new Blob([WORKER_CODE], { type: "application/javascript" }))), this.worker = new Worker(WORKER_URL);
}
}
WorkerInstance.revokeObjectURL = function() {
WORKER_URL && (URL.revokeObjectURL(WORKER_URL), WORKER_URL = null);
};
export {
WorkerInstance as default
};
//# sourceMappingURL=checkImageBitmap.worker.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"checkImageBitmap.worker.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,40 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: !0 });
const WORKER_CODE = `(function() {
"use strict";
async function loadImageBitmap(url) {
const response = await fetch(url);
if (!response.ok)
throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \${response.status} \${response.statusText}\`);
const imageBlob = await response.blob();
return await createImageBitmap(imageBlob);
}
self.onmessage = async (event) => {
try {
const imageBitmap = await loadImageBitmap(event.data.data[0]);
self.postMessage({
data: imageBitmap,
uuid: event.data.uuid,
id: event.data.id
}, [imageBitmap]);
} catch (e) {
self.postMessage({
error: e,
uuid: event.data.uuid,
id: event.data.id
});
}
};
})();
`;
let WORKER_URL = null;
class WorkerInstance {
constructor() {
WORKER_URL || (WORKER_URL = URL.createObjectURL(new Blob([WORKER_CODE], { type: "application/javascript" }))), this.worker = new Worker(WORKER_URL);
}
}
WorkerInstance.revokeObjectURL = function() {
WORKER_URL && (URL.revokeObjectURL(WORKER_URL), WORKER_URL = null);
};
exports.default = WorkerInstance;
//# sourceMappingURL=loadImageBitmap.worker.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"loadImageBitmap.worker.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,40 @@
const WORKER_CODE = `(function() {
"use strict";
async function loadImageBitmap(url) {
const response = await fetch(url);
if (!response.ok)
throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \${response.status} \${response.statusText}\`);
const imageBlob = await response.blob();
return await createImageBitmap(imageBlob);
}
self.onmessage = async (event) => {
try {
const imageBitmap = await loadImageBitmap(event.data.data[0]);
self.postMessage({
data: imageBitmap,
uuid: event.data.uuid,
id: event.data.id
}, [imageBitmap]);
} catch (e) {
self.postMessage({
error: e,
uuid: event.data.uuid,
id: event.data.id
});
}
};
})();
`;
let WORKER_URL = null;
class WorkerInstance {
constructor() {
WORKER_URL || (WORKER_URL = URL.createObjectURL(new Blob([WORKER_CODE], { type: "application/javascript" }))), this.worker = new Worker(WORKER_URL);
}
}
WorkerInstance.revokeObjectURL = function() {
WORKER_URL && (URL.revokeObjectURL(WORKER_URL), WORKER_URL = null);
};
export {
WorkerInstance as default
};
//# sourceMappingURL=loadImageBitmap.worker.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"loadImageBitmap.worker.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

View File

@@ -0,0 +1,86 @@
"use strict";
var core = require("@pixi/core");
require("../utils/index.js");
var convertToList = require("../utils/convertToList.js");
class CacheClass {
constructor() {
this._parsers = [], this._cache = /* @__PURE__ */ new Map(), this._cacheMap = /* @__PURE__ */ new Map();
}
/** Clear all entries. */
reset() {
this._cacheMap.clear(), this._cache.clear();
}
/**
* Check if the key exists
* @param key - The key to check
*/
has(key) {
return this._cache.has(key);
}
/**
* Fetch entry by key
* @param key - The key of the entry to get
*/
get(key) {
const result = this._cache.get(key);
return result || console.warn(`[Assets] Asset id ${key} was not found in the Cache`), result;
}
/**
* Set a value by key or keys name
* @param key - The key or keys to set
* @param value - The value to store in the cache or from which cacheable assets will be derived.
*/
set(key, value) {
const keys = convertToList.convertToList(key);
let cacheableAssets;
for (let i = 0; i < this.parsers.length; i++) {
const parser = this.parsers[i];
if (parser.test(value)) {
cacheableAssets = parser.getCacheableAssets(keys, value);
break;
}
}
cacheableAssets || (cacheableAssets = {}, keys.forEach((key2) => {
cacheableAssets[key2] = value;
}));
const cacheKeys = Object.keys(cacheableAssets), cachedAssets = {
cacheKeys,
keys
};
if (keys.forEach((key2) => {
this._cacheMap.set(key2, cachedAssets);
}), cacheKeys.forEach((key2) => {
this._cache.has(key2) && this._cache.get(key2) !== value && console.warn("[Cache] already has key:", key2), this._cache.set(key2, cacheableAssets[key2]);
}), value instanceof core.Texture) {
const texture = value;
keys.forEach((key2) => {
texture.baseTexture !== core.Texture.EMPTY.baseTexture && core.BaseTexture.addToCache(texture.baseTexture, key2), core.Texture.addToCache(texture, key2);
});
}
}
/**
* Remove entry by key
*
* This function will also remove any associated alias from the cache also.
* @param key - The key of the entry to remove
*/
remove(key) {
if (!this._cacheMap.has(key)) {
console.warn(`[Assets] Asset id ${key} was not found in the Cache`);
return;
}
const cacheMap = this._cacheMap.get(key);
cacheMap.cacheKeys.forEach((key2) => {
this._cache.delete(key2);
}), cacheMap.keys.forEach((key2) => {
this._cacheMap.delete(key2);
});
}
/** All loader parsers registered */
get parsers() {
return this._parsers;
}
}
const Cache = new CacheClass();
exports.Cache = Cache;
//# sourceMappingURL=Cache.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,87 @@
import { Texture, BaseTexture } from "@pixi/core";
import "../utils/index.mjs";
import { convertToList } from "../utils/convertToList.mjs";
class CacheClass {
constructor() {
this._parsers = [], this._cache = /* @__PURE__ */ new Map(), this._cacheMap = /* @__PURE__ */ new Map();
}
/** Clear all entries. */
reset() {
this._cacheMap.clear(), this._cache.clear();
}
/**
* Check if the key exists
* @param key - The key to check
*/
has(key) {
return this._cache.has(key);
}
/**
* Fetch entry by key
* @param key - The key of the entry to get
*/
get(key) {
const result = this._cache.get(key);
return result || console.warn(`[Assets] Asset id ${key} was not found in the Cache`), result;
}
/**
* Set a value by key or keys name
* @param key - The key or keys to set
* @param value - The value to store in the cache or from which cacheable assets will be derived.
*/
set(key, value) {
const keys = convertToList(key);
let cacheableAssets;
for (let i = 0; i < this.parsers.length; i++) {
const parser = this.parsers[i];
if (parser.test(value)) {
cacheableAssets = parser.getCacheableAssets(keys, value);
break;
}
}
cacheableAssets || (cacheableAssets = {}, keys.forEach((key2) => {
cacheableAssets[key2] = value;
}));
const cacheKeys = Object.keys(cacheableAssets), cachedAssets = {
cacheKeys,
keys
};
if (keys.forEach((key2) => {
this._cacheMap.set(key2, cachedAssets);
}), cacheKeys.forEach((key2) => {
this._cache.has(key2) && this._cache.get(key2) !== value && console.warn("[Cache] already has key:", key2), this._cache.set(key2, cacheableAssets[key2]);
}), value instanceof Texture) {
const texture = value;
keys.forEach((key2) => {
texture.baseTexture !== Texture.EMPTY.baseTexture && BaseTexture.addToCache(texture.baseTexture, key2), Texture.addToCache(texture, key2);
});
}
}
/**
* Remove entry by key
*
* This function will also remove any associated alias from the cache also.
* @param key - The key of the entry to remove
*/
remove(key) {
if (!this._cacheMap.has(key)) {
console.warn(`[Assets] Asset id ${key} was not found in the Cache`);
return;
}
const cacheMap = this._cacheMap.get(key);
cacheMap.cacheKeys.forEach((key2) => {
this._cache.delete(key2);
}), cacheMap.keys.forEach((key2) => {
this._cacheMap.delete(key2);
});
}
/** All loader parsers registered */
get parsers() {
return this._parsers;
}
}
const Cache = new CacheClass();
export {
Cache
};
//# sourceMappingURL=Cache.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,2 @@
"use strict";
//# sourceMappingURL=CacheParser.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CacheParser.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}

View File

@@ -0,0 +1,2 @@
//# sourceMappingURL=CacheParser.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CacheParser.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}

View File

@@ -0,0 +1,6 @@
"use strict";
var Cache = require("./Cache.js");
require("./CacheParser.js");
require("./parsers/index.js");
exports.Cache = Cache.Cache;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}

View File

@@ -0,0 +1,7 @@
import { Cache } from "./Cache.mjs";
import "./CacheParser.mjs";
import "./parsers/index.mjs";
export {
Cache
};
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}

View File

@@ -0,0 +1,17 @@
"use strict";
var core = require("@pixi/core");
const cacheTextureArray = {
extension: core.ExtensionType.CacheParser,
test: (asset) => Array.isArray(asset) && asset.every((t) => t instanceof core.Texture),
getCacheableAssets: (keys, asset) => {
const out = {};
return keys.forEach((key) => {
asset.forEach((item, i) => {
out[key + (i === 0 ? "" : i + 1)] = item;
});
}), out;
}
};
core.extensions.add(cacheTextureArray);
exports.cacheTextureArray = cacheTextureArray;
//# sourceMappingURL=cacheTextureArray.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"cacheTextureArray.js","sources":["../../../src/cache/parsers/cacheTextureArray.ts"],"sourcesContent":["import { extensions, ExtensionType, Texture } from '@pixi/core';\n\nimport type { CacheParser } from '../CacheParser';\n\nexport const cacheTextureArray: CacheParser<Texture[]> = {\n extension: ExtensionType.CacheParser,\n\n test: (asset: any[]) => Array.isArray(asset) && asset.every((t) => t instanceof Texture),\n\n getCacheableAssets: (keys: string[], asset: Texture[]) =>\n {\n const out: Record<string, Texture> = {};\n\n keys.forEach((key: string) =>\n {\n asset.forEach((item: Texture, i: number) =>\n {\n out[key + (i === 0 ? '' : i + 1)] = item;\n });\n });\n\n return out;\n }\n};\n\nextensions.add(cacheTextureArray);\n"],"names":["ExtensionType","Texture","extensions"],"mappings":";;AAIO,MAAM,oBAA4C;AAAA,EACrD,WAAWA,KAAc,cAAA;AAAA,EAEzB,MAAM,CAAC,UAAiB,MAAM,QAAQ,KAAK,KAAK,MAAM,MAAM,CAAC,MAAM,aAAaC,KAAAA,OAAO;AAAA,EAEvF,oBAAoB,CAAC,MAAgB,UACrC;AACI,UAAM,MAA+B,CAAA;AAEhC,WAAA,KAAA,QAAQ,CAAC,QACd;AACU,YAAA,QAAQ,CAAC,MAAe,MAC9B;AACI,YAAI,OAAO,MAAM,IAAI,KAAK,IAAI,EAAE,IAAI;AAAA,MAAA,CACvC;AAAA,IACJ,CAAA,GAEM;AAAA,EACX;AACJ;AAEAC,KAAAA,WAAW,IAAI,iBAAiB;;"}

View File

@@ -0,0 +1,18 @@
import { ExtensionType, Texture, extensions } from "@pixi/core";
const cacheTextureArray = {
extension: ExtensionType.CacheParser,
test: (asset) => Array.isArray(asset) && asset.every((t) => t instanceof Texture),
getCacheableAssets: (keys, asset) => {
const out = {};
return keys.forEach((key) => {
asset.forEach((item, i) => {
out[key + (i === 0 ? "" : i + 1)] = item;
});
}), out;
}
};
extensions.add(cacheTextureArray);
export {
cacheTextureArray
};
//# sourceMappingURL=cacheTextureArray.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"cacheTextureArray.mjs","sources":["../../../src/cache/parsers/cacheTextureArray.ts"],"sourcesContent":["import { extensions, ExtensionType, Texture } from '@pixi/core';\n\nimport type { CacheParser } from '../CacheParser';\n\nexport const cacheTextureArray: CacheParser<Texture[]> = {\n extension: ExtensionType.CacheParser,\n\n test: (asset: any[]) => Array.isArray(asset) && asset.every((t) => t instanceof Texture),\n\n getCacheableAssets: (keys: string[], asset: Texture[]) =>\n {\n const out: Record<string, Texture> = {};\n\n keys.forEach((key: string) =>\n {\n asset.forEach((item: Texture, i: number) =>\n {\n out[key + (i === 0 ? '' : i + 1)] = item;\n });\n });\n\n return out;\n }\n};\n\nextensions.add(cacheTextureArray);\n"],"names":[],"mappings":";AAIO,MAAM,oBAA4C;AAAA,EACrD,WAAW,cAAc;AAAA,EAEzB,MAAM,CAAC,UAAiB,MAAM,QAAQ,KAAK,KAAK,MAAM,MAAM,CAAC,MAAM,aAAa,OAAO;AAAA,EAEvF,oBAAoB,CAAC,MAAgB,UACrC;AACI,UAAM,MAA+B,CAAA;AAEhC,WAAA,KAAA,QAAQ,CAAC,QACd;AACU,YAAA,QAAQ,CAAC,MAAe,MAC9B;AACI,YAAI,OAAO,MAAM,IAAI,KAAK,IAAI,EAAE,IAAI;AAAA,MAAA,CACvC;AAAA,IACJ,CAAA,GAEM;AAAA,EACX;AACJ;AAEA,WAAW,IAAI,iBAAiB;"}

View File

@@ -0,0 +1,4 @@
"use strict";
var cacheTextureArray = require("./cacheTextureArray.js");
exports.cacheTextureArray = cacheTextureArray.cacheTextureArray;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}

View File

@@ -0,0 +1,5 @@
import { cacheTextureArray } from "./cacheTextureArray.mjs";
export {
cacheTextureArray
};
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}

View File

@@ -0,0 +1,3 @@
"use strict";
require("./parsers/index.js");
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}

View File

@@ -0,0 +1,2 @@
import "./parsers/index.mjs";
//# sourceMappingURL=index.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}

View File

@@ -0,0 +1,17 @@
"use strict";
var core = require("@pixi/core"), testImageFormat = require("../utils/testImageFormat.js");
const detectAvif = {
extension: {
type: core.ExtensionType.DetectionParser,
priority: 1
},
test: async () => testImageFormat.testImageFormat(
// eslint-disable-next-line max-len
"data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="
),
add: async (formats) => [...formats, "avif"],
remove: async (formats) => formats.filter((f) => f !== "avif")
};
core.extensions.add(detectAvif);
exports.detectAvif = detectAvif;
//# sourceMappingURL=detectAvif.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"detectAvif.js","sources":["../../../src/detections/parsers/detectAvif.ts"],"sourcesContent":["import { extensions, ExtensionType } from '@pixi/core';\nimport { testImageFormat } from '../utils/testImageFormat';\n\nimport type { FormatDetectionParser } from '..';\n\nexport const detectAvif: FormatDetectionParser = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 1,\n },\n test: async (): Promise<boolean> => testImageFormat(\n // eslint-disable-next-line max-len\n 'data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A='\n ),\n add: async (formats) => [...formats, 'avif'],\n remove: async (formats) => formats.filter((f) => f !== 'avif'),\n};\n\nextensions.add(detectAvif);\n"],"names":["ExtensionType","testImageFormat","extensions"],"mappings":";;AAKO,MAAM,aAAoC;AAAA,EAC7C,WAAW;AAAA,IACP,MAAMA,KAAc,cAAA;AAAA,IACpB,UAAU;AAAA,EACd;AAAA,EACA,MAAM,YAA8BC,gBAAA;AAAA;AAAA,IAEhC;AAAA,EACJ;AAAA,EACA,KAAK,OAAO,YAAY,CAAC,GAAG,SAAS,MAAM;AAAA,EAC3C,QAAQ,OAAO,YAAY,QAAQ,OAAO,CAAC,MAAM,MAAM,MAAM;AACjE;AAEAC,KAAAA,WAAW,IAAI,UAAU;;"}

View File

@@ -0,0 +1,19 @@
import { ExtensionType, extensions } from "@pixi/core";
import { testImageFormat } from "../utils/testImageFormat.mjs";
const detectAvif = {
extension: {
type: ExtensionType.DetectionParser,
priority: 1
},
test: async () => testImageFormat(
// eslint-disable-next-line max-len
"data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="
),
add: async (formats) => [...formats, "avif"],
remove: async (formats) => formats.filter((f) => f !== "avif")
};
extensions.add(detectAvif);
export {
detectAvif
};
//# sourceMappingURL=detectAvif.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"detectAvif.mjs","sources":["../../../src/detections/parsers/detectAvif.ts"],"sourcesContent":["import { extensions, ExtensionType } from '@pixi/core';\nimport { testImageFormat } from '../utils/testImageFormat';\n\nimport type { FormatDetectionParser } from '..';\n\nexport const detectAvif: FormatDetectionParser = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 1,\n },\n test: async (): Promise<boolean> => testImageFormat(\n // eslint-disable-next-line max-len\n 'data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A='\n ),\n add: async (formats) => [...formats, 'avif'],\n remove: async (formats) => formats.filter((f) => f !== 'avif'),\n};\n\nextensions.add(detectAvif);\n"],"names":[],"mappings":";;AAKO,MAAM,aAAoC;AAAA,EAC7C,WAAW;AAAA,IACP,MAAM,cAAc;AAAA,IACpB,UAAU;AAAA,EACd;AAAA,EACA,MAAM,YAA8B;AAAA;AAAA,IAEhC;AAAA,EACJ;AAAA,EACA,KAAK,OAAO,YAAY,CAAC,GAAG,SAAS,MAAM;AAAA,EAC3C,QAAQ,OAAO,YAAY,QAAQ,OAAO,CAAC,MAAM,MAAM,MAAM;AACjE;AAEA,WAAW,IAAI,UAAU;"}

View File

@@ -0,0 +1,14 @@
"use strict";
var core = require("@pixi/core");
const imageFormats = ["png", "jpg", "jpeg"], detectDefaults = {
extension: {
type: core.ExtensionType.DetectionParser,
priority: -1
},
test: () => Promise.resolve(!0),
add: async (formats) => [...formats, ...imageFormats],
remove: async (formats) => formats.filter((f) => !imageFormats.includes(f))
};
core.extensions.add(detectDefaults);
exports.detectDefaults = detectDefaults;
//# sourceMappingURL=detectDefaults.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"detectDefaults.js","sources":["../../../src/detections/parsers/detectDefaults.ts"],"sourcesContent":["import { extensions, ExtensionType } from '@pixi/core';\n\nimport type { FormatDetectionParser } from '..';\n\nconst imageFormats = ['png', 'jpg', 'jpeg'];\n\nexport const detectDefaults = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: -1,\n },\n test: (): Promise<boolean> => Promise.resolve(true),\n add: async (formats) => [...formats, ...imageFormats],\n remove: async (formats) => formats.filter((f) => !imageFormats.includes(f)),\n} as FormatDetectionParser;\n\nextensions.add(detectDefaults);\n"],"names":["ExtensionType","extensions"],"mappings":";;AAIA,MAAM,eAAe,CAAC,OAAO,OAAO,MAAM,GAE7B,iBAAiB;AAAA,EAC1B,WAAW;AAAA,IACP,MAAMA,KAAc,cAAA;AAAA,IACpB,UAAU;AAAA,EACd;AAAA,EACA,MAAM,MAAwB,QAAQ,QAAQ,EAAI;AAAA,EAClD,KAAK,OAAO,YAAY,CAAC,GAAG,SAAS,GAAG,YAAY;AAAA,EACpD,QAAQ,OAAO,YAAY,QAAQ,OAAO,CAAC,MAAM,CAAC,aAAa,SAAS,CAAC,CAAC;AAC9E;AAEAC,KAAAA,WAAW,IAAI,cAAc;;"}

View File

@@ -0,0 +1,15 @@
import { ExtensionType, extensions } from "@pixi/core";
const imageFormats = ["png", "jpg", "jpeg"], detectDefaults = {
extension: {
type: ExtensionType.DetectionParser,
priority: -1
},
test: () => Promise.resolve(!0),
add: async (formats) => [...formats, ...imageFormats],
remove: async (formats) => formats.filter((f) => !imageFormats.includes(f))
};
extensions.add(detectDefaults);
export {
detectDefaults
};
//# sourceMappingURL=detectDefaults.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"detectDefaults.mjs","sources":["../../../src/detections/parsers/detectDefaults.ts"],"sourcesContent":["import { extensions, ExtensionType } from '@pixi/core';\n\nimport type { FormatDetectionParser } from '..';\n\nconst imageFormats = ['png', 'jpg', 'jpeg'];\n\nexport const detectDefaults = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: -1,\n },\n test: (): Promise<boolean> => Promise.resolve(true),\n add: async (formats) => [...formats, ...imageFormats],\n remove: async (formats) => formats.filter((f) => !imageFormats.includes(f)),\n} as FormatDetectionParser;\n\nextensions.add(detectDefaults);\n"],"names":[],"mappings":";AAIA,MAAM,eAAe,CAAC,OAAO,OAAO,MAAM,GAE7B,iBAAiB;AAAA,EAC1B,WAAW;AAAA,IACP,MAAM,cAAc;AAAA,IACpB,UAAU;AAAA,EACd;AAAA,EACA,MAAM,MAAwB,QAAQ,QAAQ,EAAI;AAAA,EAClD,KAAK,OAAO,YAAY,CAAC,GAAG,SAAS,GAAG,YAAY;AAAA,EACpD,QAAQ,OAAO,YAAY,QAAQ,OAAO,CAAC,MAAM,CAAC,aAAa,SAAS,CAAC,CAAC;AAC9E;AAEA,WAAW,IAAI,cAAc;"}

View File

@@ -0,0 +1,14 @@
"use strict";
var core = require("@pixi/core"), testVideoFormat = require("../utils/testVideoFormat.js");
const detectMp4 = {
extension: {
type: core.ExtensionType.DetectionParser,
priority: 0
},
test: async () => testVideoFormat.testVideoFormat("video/mp4"),
add: async (formats) => [...formats, "mp4", "m4v"],
remove: async (formats) => formats.filter((f) => f !== "mp4" && f !== "m4v")
};
core.extensions.add(detectMp4);
exports.detectMp4 = detectMp4;
//# sourceMappingURL=detectMp4.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"detectMp4.js","sources":["../../../src/detections/parsers/detectMp4.ts"],"sourcesContent":["import { extensions, ExtensionType } from '@pixi/core';\nimport { testVideoFormat } from '../utils/testVideoFormat';\n\nimport type { FormatDetectionParser } from '..';\n\nexport const detectMp4 = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 0,\n },\n test: async (): Promise<boolean> => testVideoFormat('video/mp4'),\n add: async (formats) => [...formats, 'mp4', 'm4v'],\n remove: async (formats) => formats.filter((f) => f !== 'mp4' && f !== 'm4v'),\n} as FormatDetectionParser;\n\nextensions.add(detectMp4);\n"],"names":["ExtensionType","testVideoFormat","extensions"],"mappings":";;AAKO,MAAM,YAAY;AAAA,EACrB,WAAW;AAAA,IACP,MAAMA,KAAc,cAAA;AAAA,IACpB,UAAU;AAAA,EACd;AAAA,EACA,MAAM,YAA8BC,gBAAA,gBAAgB,WAAW;AAAA,EAC/D,KAAK,OAAO,YAAY,CAAC,GAAG,SAAS,OAAO,KAAK;AAAA,EACjD,QAAQ,OAAO,YAAY,QAAQ,OAAO,CAAC,MAAM,MAAM,SAAS,MAAM,KAAK;AAC/E;AAEAC,KAAAA,WAAW,IAAI,SAAS;;"}

View File

@@ -0,0 +1,16 @@
import { ExtensionType, extensions } from "@pixi/core";
import { testVideoFormat } from "../utils/testVideoFormat.mjs";
const detectMp4 = {
extension: {
type: ExtensionType.DetectionParser,
priority: 0
},
test: async () => testVideoFormat("video/mp4"),
add: async (formats) => [...formats, "mp4", "m4v"],
remove: async (formats) => formats.filter((f) => f !== "mp4" && f !== "m4v")
};
extensions.add(detectMp4);
export {
detectMp4
};
//# sourceMappingURL=detectMp4.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"detectMp4.mjs","sources":["../../../src/detections/parsers/detectMp4.ts"],"sourcesContent":["import { extensions, ExtensionType } from '@pixi/core';\nimport { testVideoFormat } from '../utils/testVideoFormat';\n\nimport type { FormatDetectionParser } from '..';\n\nexport const detectMp4 = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 0,\n },\n test: async (): Promise<boolean> => testVideoFormat('video/mp4'),\n add: async (formats) => [...formats, 'mp4', 'm4v'],\n remove: async (formats) => formats.filter((f) => f !== 'mp4' && f !== 'm4v'),\n} as FormatDetectionParser;\n\nextensions.add(detectMp4);\n"],"names":[],"mappings":";;AAKO,MAAM,YAAY;AAAA,EACrB,WAAW;AAAA,IACP,MAAM,cAAc;AAAA,IACpB,UAAU;AAAA,EACd;AAAA,EACA,MAAM,YAA8B,gBAAgB,WAAW;AAAA,EAC/D,KAAK,OAAO,YAAY,CAAC,GAAG,SAAS,OAAO,KAAK;AAAA,EACjD,QAAQ,OAAO,YAAY,QAAQ,OAAO,CAAC,MAAM,MAAM,SAAS,MAAM,KAAK;AAC/E;AAEA,WAAW,IAAI,SAAS;"}

View File

@@ -0,0 +1,14 @@
"use strict";
var core = require("@pixi/core"), testVideoFormat = require("../utils/testVideoFormat.js");
const detectOgv = {
extension: {
type: core.ExtensionType.DetectionParser,
priority: 0
},
test: async () => testVideoFormat.testVideoFormat("video/ogg"),
add: async (formats) => [...formats, "ogv"],
remove: async (formats) => formats.filter((f) => f !== "ogv")
};
core.extensions.add(detectOgv);
exports.detectOgv = detectOgv;
//# sourceMappingURL=detectOgv.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"detectOgv.js","sources":["../../../src/detections/parsers/detectOgv.ts"],"sourcesContent":["import { extensions, ExtensionType } from '@pixi/core';\nimport { testVideoFormat } from '../utils/testVideoFormat';\n\nimport type { FormatDetectionParser } from '..';\n\nexport const detectOgv = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 0,\n },\n test: async (): Promise<boolean> => testVideoFormat('video/ogg'),\n add: async (formats) => [...formats, 'ogv'],\n remove: async (formats) => formats.filter((f) => f !== 'ogv'),\n} as FormatDetectionParser;\n\nextensions.add(detectOgv);\n"],"names":["ExtensionType","testVideoFormat","extensions"],"mappings":";;AAKO,MAAM,YAAY;AAAA,EACrB,WAAW;AAAA,IACP,MAAMA,KAAc,cAAA;AAAA,IACpB,UAAU;AAAA,EACd;AAAA,EACA,MAAM,YAA8BC,gBAAA,gBAAgB,WAAW;AAAA,EAC/D,KAAK,OAAO,YAAY,CAAC,GAAG,SAAS,KAAK;AAAA,EAC1C,QAAQ,OAAO,YAAY,QAAQ,OAAO,CAAC,MAAM,MAAM,KAAK;AAChE;AAEAC,KAAAA,WAAW,IAAI,SAAS;;"}

View File

@@ -0,0 +1,16 @@
import { ExtensionType, extensions } from "@pixi/core";
import { testVideoFormat } from "../utils/testVideoFormat.mjs";
const detectOgv = {
extension: {
type: ExtensionType.DetectionParser,
priority: 0
},
test: async () => testVideoFormat("video/ogg"),
add: async (formats) => [...formats, "ogv"],
remove: async (formats) => formats.filter((f) => f !== "ogv")
};
extensions.add(detectOgv);
export {
detectOgv
};
//# sourceMappingURL=detectOgv.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"detectOgv.mjs","sources":["../../../src/detections/parsers/detectOgv.ts"],"sourcesContent":["import { extensions, ExtensionType } from '@pixi/core';\nimport { testVideoFormat } from '../utils/testVideoFormat';\n\nimport type { FormatDetectionParser } from '..';\n\nexport const detectOgv = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 0,\n },\n test: async (): Promise<boolean> => testVideoFormat('video/ogg'),\n add: async (formats) => [...formats, 'ogv'],\n remove: async (formats) => formats.filter((f) => f !== 'ogv'),\n} as FormatDetectionParser;\n\nextensions.add(detectOgv);\n"],"names":[],"mappings":";;AAKO,MAAM,YAAY;AAAA,EACrB,WAAW;AAAA,IACP,MAAM,cAAc;AAAA,IACpB,UAAU;AAAA,EACd;AAAA,EACA,MAAM,YAA8B,gBAAgB,WAAW;AAAA,EAC/D,KAAK,OAAO,YAAY,CAAC,GAAG,SAAS,KAAK;AAAA,EAC1C,QAAQ,OAAO,YAAY,QAAQ,OAAO,CAAC,MAAM,MAAM,KAAK;AAChE;AAEA,WAAW,IAAI,SAAS;"}

View File

@@ -0,0 +1,14 @@
"use strict";
var core = require("@pixi/core"), testVideoFormat = require("../utils/testVideoFormat.js");
const detectWebm = {
extension: {
type: core.ExtensionType.DetectionParser,
priority: 0
},
test: async () => testVideoFormat.testVideoFormat("video/webm"),
add: async (formats) => [...formats, "webm"],
remove: async (formats) => formats.filter((f) => f !== "webm")
};
core.extensions.add(detectWebm);
exports.detectWebm = detectWebm;
//# sourceMappingURL=detectWebm.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"detectWebm.js","sources":["../../../src/detections/parsers/detectWebm.ts"],"sourcesContent":["import { extensions, ExtensionType } from '@pixi/core';\nimport { testVideoFormat } from '../utils/testVideoFormat';\n\nimport type { FormatDetectionParser } from '..';\n\nexport const detectWebm = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 0,\n },\n test: async (): Promise<boolean> => testVideoFormat('video/webm'),\n add: async (formats) => [...formats, 'webm'],\n remove: async (formats) => formats.filter((f) => f !== 'webm'),\n} as FormatDetectionParser;\n\nextensions.add(detectWebm);\n"],"names":["ExtensionType","testVideoFormat","extensions"],"mappings":";;AAKO,MAAM,aAAa;AAAA,EACtB,WAAW;AAAA,IACP,MAAMA,KAAc,cAAA;AAAA,IACpB,UAAU;AAAA,EACd;AAAA,EACA,MAAM,YAA8BC,gBAAA,gBAAgB,YAAY;AAAA,EAChE,KAAK,OAAO,YAAY,CAAC,GAAG,SAAS,MAAM;AAAA,EAC3C,QAAQ,OAAO,YAAY,QAAQ,OAAO,CAAC,MAAM,MAAM,MAAM;AACjE;AAEAC,KAAAA,WAAW,IAAI,UAAU;;"}

View File

@@ -0,0 +1,16 @@
import { ExtensionType, extensions } from "@pixi/core";
import { testVideoFormat } from "../utils/testVideoFormat.mjs";
const detectWebm = {
extension: {
type: ExtensionType.DetectionParser,
priority: 0
},
test: async () => testVideoFormat("video/webm"),
add: async (formats) => [...formats, "webm"],
remove: async (formats) => formats.filter((f) => f !== "webm")
};
extensions.add(detectWebm);
export {
detectWebm
};
//# sourceMappingURL=detectWebm.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"detectWebm.mjs","sources":["../../../src/detections/parsers/detectWebm.ts"],"sourcesContent":["import { extensions, ExtensionType } from '@pixi/core';\nimport { testVideoFormat } from '../utils/testVideoFormat';\n\nimport type { FormatDetectionParser } from '..';\n\nexport const detectWebm = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 0,\n },\n test: async (): Promise<boolean> => testVideoFormat('video/webm'),\n add: async (formats) => [...formats, 'webm'],\n remove: async (formats) => formats.filter((f) => f !== 'webm'),\n} as FormatDetectionParser;\n\nextensions.add(detectWebm);\n"],"names":[],"mappings":";;AAKO,MAAM,aAAa;AAAA,EACtB,WAAW;AAAA,IACP,MAAM,cAAc;AAAA,IACpB,UAAU;AAAA,EACd;AAAA,EACA,MAAM,YAA8B,gBAAgB,YAAY;AAAA,EAChE,KAAK,OAAO,YAAY,CAAC,GAAG,SAAS,MAAM;AAAA,EAC3C,QAAQ,OAAO,YAAY,QAAQ,OAAO,CAAC,MAAM,MAAM,MAAM;AACjE;AAEA,WAAW,IAAI,UAAU;"}

View File

@@ -0,0 +1,16 @@
"use strict";
var core = require("@pixi/core"), testImageFormat = require("../utils/testImageFormat.js");
const detectWebp = {
extension: {
type: core.ExtensionType.DetectionParser,
priority: 0
},
test: async () => testImageFormat.testImageFormat(
"data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="
),
add: async (formats) => [...formats, "webp"],
remove: async (formats) => formats.filter((f) => f !== "webp")
};
core.extensions.add(detectWebp);
exports.detectWebp = detectWebp;
//# sourceMappingURL=detectWebp.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"detectWebp.js","sources":["../../../src/detections/parsers/detectWebp.ts"],"sourcesContent":["import { extensions, ExtensionType } from '@pixi/core';\nimport { testImageFormat } from '../utils/testImageFormat';\n\nimport type { FormatDetectionParser } from '..';\n\nexport const detectWebp = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 0,\n },\n test: async (): Promise<boolean> => testImageFormat(\n 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA='\n ),\n add: async (formats) => [...formats, 'webp'],\n remove: async (formats) => formats.filter((f) => f !== 'webp'),\n} as FormatDetectionParser;\n\nextensions.add(detectWebp);\n"],"names":["ExtensionType","testImageFormat","extensions"],"mappings":";;AAKO,MAAM,aAAa;AAAA,EACtB,WAAW;AAAA,IACP,MAAMA,KAAc,cAAA;AAAA,IACpB,UAAU;AAAA,EACd;AAAA,EACA,MAAM,YAA8BC,gBAAA;AAAA,IAChC;AAAA,EACJ;AAAA,EACA,KAAK,OAAO,YAAY,CAAC,GAAG,SAAS,MAAM;AAAA,EAC3C,QAAQ,OAAO,YAAY,QAAQ,OAAO,CAAC,MAAM,MAAM,MAAM;AACjE;AAEAC,KAAAA,WAAW,IAAI,UAAU;;"}

View File

@@ -0,0 +1,18 @@
import { ExtensionType, extensions } from "@pixi/core";
import { testImageFormat } from "../utils/testImageFormat.mjs";
const detectWebp = {
extension: {
type: ExtensionType.DetectionParser,
priority: 0
},
test: async () => testImageFormat(
"data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="
),
add: async (formats) => [...formats, "webp"],
remove: async (formats) => formats.filter((f) => f !== "webp")
};
extensions.add(detectWebp);
export {
detectWebp
};
//# sourceMappingURL=detectWebp.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"detectWebp.mjs","sources":["../../../src/detections/parsers/detectWebp.ts"],"sourcesContent":["import { extensions, ExtensionType } from '@pixi/core';\nimport { testImageFormat } from '../utils/testImageFormat';\n\nimport type { FormatDetectionParser } from '..';\n\nexport const detectWebp = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 0,\n },\n test: async (): Promise<boolean> => testImageFormat(\n 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA='\n ),\n add: async (formats) => [...formats, 'webp'],\n remove: async (formats) => formats.filter((f) => f !== 'webp'),\n} as FormatDetectionParser;\n\nextensions.add(detectWebp);\n"],"names":[],"mappings":";;AAKO,MAAM,aAAa;AAAA,EACtB,WAAW;AAAA,IACP,MAAM,cAAc;AAAA,IACpB,UAAU;AAAA,EACd;AAAA,EACA,MAAM,YAA8B;AAAA,IAChC;AAAA,EACJ;AAAA,EACA,KAAK,OAAO,YAAY,CAAC,GAAG,SAAS,MAAM;AAAA,EAC3C,QAAQ,OAAO,YAAY,QAAQ,OAAO,CAAC,MAAM,MAAM,MAAM;AACjE;AAEA,WAAW,IAAI,UAAU;"}

View File

@@ -0,0 +1,9 @@
"use strict";
var detectAvif = require("./detectAvif.js"), detectWebp = require("./detectWebp.js"), detectDefaults = require("./detectDefaults.js"), detectWebm = require("./detectWebm.js"), detectMp4 = require("./detectMp4.js"), detectOgv = require("./detectOgv.js");
exports.detectAvif = detectAvif.detectAvif;
exports.detectWebp = detectWebp.detectWebp;
exports.detectDefaults = detectDefaults.detectDefaults;
exports.detectWebm = detectWebm.detectWebm;
exports.detectMp4 = detectMp4.detectMp4;
exports.detectOgv = detectOgv.detectOgv;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}

View File

@@ -0,0 +1,15 @@
import { detectAvif } from "./detectAvif.mjs";
import { detectWebp } from "./detectWebp.mjs";
import { detectDefaults } from "./detectDefaults.mjs";
import { detectWebm } from "./detectWebm.mjs";
import { detectMp4 } from "./detectMp4.mjs";
import { detectOgv } from "./detectOgv.mjs";
export {
detectAvif,
detectDefaults,
detectMp4,
detectOgv,
detectWebm,
detectWebp
};
//# sourceMappingURL=index.mjs.map

Some files were not shown because too many files have changed in this diff Show More