use beta edition

This commit is contained in:
2024-09-19 23:13:28 +02:00
parent c20b0ce0cb
commit 486831badb
3651 changed files with 156311 additions and 163993 deletions

1
live2d/node_modules/.bin/gh-pages generated vendored
View File

@@ -1 +0,0 @@
../gh-pages/bin/gh-pages.js

View File

@@ -1 +0,0 @@
../gh-pages/bin/gh-pages-clean.js

1
live2d/node_modules/.bin/semver generated vendored
View File

@@ -1 +0,0 @@
../semver/bin/semver.js

File diff suppressed because it is too large Load Diff

21
live2d/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.

13
live2d/node_modules/@pixi/accessibility/README.md generated vendored Normal file
View File

@@ -0,0 +1,13 @@
# @pixi/accessibility
## Installation
```bash
npm install @pixi/accessibility
```
## Usage
```js
import '@pixi/accessibility';
```

8
live2d/node_modules/@pixi/accessibility/global.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
declare namespace GlobalMixins
{
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface DisplayObject extends Partial<import('@pixi/accessibility').IAccessibleTarget>
{
}
}

View File

@@ -0,0 +1,147 @@
import type { ExtensionMetadata, IRenderer, Rectangle } from '@pixi/core';
import type { IAccessibleHTMLElement } from './accessibleTarget';
/**
* The Accessibility manager recreates the ability to tab and have content read by screen readers.
* This is very important as it can possibly help people with disabilities access PixiJS content.
*
* A DisplayObject can be made accessible just like it can be made interactive. This manager will map the
* events as if the mouse was being used, minimizing the effort required to implement.
*
* An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility`
* @class
* @memberof PIXI
*/
export declare class AccessibilityManager {
/** @ignore */
static extension: ExtensionMetadata;
/** Setting this to true will visually show the divs. */
debug: boolean;
/**
* The renderer this accessibility manager works for.
* @type {PIXI.CanvasRenderer|PIXI.Renderer}
*/
renderer: IRenderer;
/** Internal variable, see isActive getter. */
private _isActive;
/** Internal variable, see isMobileAccessibility getter. */
private _isMobileAccessibility;
/** Button element for handling touch hooks. */
private _hookDiv;
/** This is the dom element that will sit over the PixiJS element. This is where the div overlays will go. */
private div;
/** A simple pool for storing divs. */
private pool;
/** This is a tick used to check if an object is no longer being rendered. */
private renderId;
/** The array of currently active accessible items. */
private children;
/** Count to throttle div updates on android devices. */
private androidUpdateCount;
/** The frequency to update the div elements. */
private androidUpdateFrequency;
/**
* @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer
*/
constructor(renderer: IRenderer);
/**
* Value of `true` if accessibility is currently active and accessibility layers are showing.
* @member {boolean}
* @readonly
*/
get isActive(): boolean;
/**
* Value of `true` if accessibility is enabled for touch devices.
* @member {boolean}
* @readonly
*/
get isMobileAccessibility(): boolean;
/**
* Creates the touch hooks.
* @private
*/
private createTouchHook;
/**
* Destroys the touch hooks.
* @private
*/
private destroyTouchHook;
/**
* Activating will cause the Accessibility layer to be shown.
* This is called when a user presses the tab key.
* @private
*/
private activate;
/**
* Deactivating will cause the Accessibility layer to be hidden.
* This is called when a user moves the mouse.
* @private
*/
private deactivate;
/**
* 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.
*/
private updateAccessibleObjects;
/**
* Before each render this function will ensure that all divs are mapped correctly to their DisplayObjects.
* @private
*/
private update;
/**
* private function that will visually add the information to the
* accessability div
* @param {HTMLElement} div -
*/
updateDebugHTML(div: IAccessibleHTMLElement): void;
/**
* Adjust the hit area based on the bounds of a display object
* @param {PIXI.Rectangle} hitArea - Bounds of the child
*/
capHitArea(hitArea: Rectangle): void;
/**
* Adds a DisplayObject to the accessibility manager
* @private
* @param {PIXI.DisplayObject} displayObject - The child to make accessible.
*/
private addChild;
/**
* Dispatch events with the EventSystem.
* @param e
* @param type
* @private
*/
private _dispatchEvent;
/**
* Maps the div button press to pixi's EventSystem (click)
* @private
* @param {MouseEvent} e - The click event.
*/
private _onClick;
/**
* Maps the div focus events to pixi's EventSystem (mouseover)
* @private
* @param {FocusEvent} e - The focus event.
*/
private _onFocus;
/**
* Maps the div focus events to pixi's EventSystem (mouseout)
* @private
* @param {FocusEvent} e - The focusout event.
*/
private _onFocusOut;
/**
* Is called when a key is pressed
* @private
* @param {KeyboardEvent} e - The keydown event.
*/
private _onKeyDown;
/**
* Is called when the mouse moves across the renderer element
* @private
* @param {MouseEvent} e - The mouse event.
*/
private _onMouseMove;
/** Destroys the accessibility manager */
destroy(): void;
}

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,32 @@
import type { DisplayObject } from '@pixi/display';
export type PointerEvents = 'auto' | 'none' | 'visiblePainted' | 'visibleFill' | 'visibleStroke' | 'visible' | 'painted' | 'fill' | 'stroke' | 'all' | 'inherit';
export interface IAccessibleTarget {
accessible: boolean;
accessibleTitle: string;
accessibleHint: string;
tabIndex: number;
_accessibleActive: boolean;
_accessibleDiv: IAccessibleHTMLElement;
accessibleType: string;
accessiblePointerEvents: PointerEvents;
accessibleChildren: boolean;
renderId: number;
}
export interface IAccessibleHTMLElement extends HTMLElement {
type?: string;
displayObject?: DisplayObject;
}
/**
* Default property values of accessible objects
* used by {@link PIXI.AccessibilityManager}.
* @private
* @function accessibleTarget
* @memberof PIXI
* @type {object}
* @example
* import { accessibleTarget } from 'pixi.js';
*
* function MyObject() {}
* Object.assign(MyObject.prototype, accessibleTarget);
*/
export declare const accessibleTarget: IAccessibleTarget;

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,3 @@
/// <reference path="../global.d.ts" />
export * from './AccessibilityManager';
export * from './accessibleTarget';

5
live2d/node_modules/@pixi/accessibility/lib/index.js generated vendored Normal file
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":";;"}

43
live2d/node_modules/@pixi/accessibility/package.json generated vendored Normal file
View File

@@ -0,0 +1,43 @@
{
"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",
"contributors": [
"Matt Karl <matt@mattkarl.com>"
],
"homepage": "http://pixijs.com/",
"bugs": "https://github.com/pixijs/pixijs/issues",
"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
live2d/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.

22
live2d/node_modules/@pixi/app/README.md generated vendored Normal file
View File

@@ -0,0 +1,22 @@
# @pixi/app
## Installation
```bash
npm install @pixi/app
```
## Usage
```js
import { Application } from '@pixi/app';
const app = new Application();
document.body.appendChild(app.view);
```
### Plugins
PixiJS provides a few plugins to add features to the Application. These can be installed from the following packages. Use `extensions.add` to use these plugins. _Note: if you are using pixi.js or pixi.js-legacy bundles, this is unnecessary since plugins are installed automatically by default._
* **TickerPlugin** from `@pixi/ticker`

15
live2d/node_modules/@pixi/app/global.d.ts generated vendored Normal file
View File

@@ -0,0 +1,15 @@
declare namespace GlobalMixins
{
interface Application
{
resizeTo: Window | HTMLElement;
resize(): void;
queueResize: () => void;
cancelResize: () => void;
}
interface IApplicationOptions
{
resizeTo?: Window | HTMLElement;
}
}

88
live2d/node_modules/@pixi/app/lib/Application.d.ts generated vendored Normal file
View File

@@ -0,0 +1,88 @@
import { Container } from '@pixi/display';
import type { ICanvas, IRenderer, IRendererOptionsAuto, Rectangle } from '@pixi/core';
import type { IDestroyOptions } from '@pixi/display';
/**
* Any plugin that's usable for Application should contain these methods.
* @memberof PIXI
*/
export interface IApplicationPlugin {
/**
* Called when Application is constructed, scoped to Application instance.
* Passes in `options` as the only argument, which are Application constructor options.
* @param {object} options - Application options.
*/
init(options: Partial<IApplicationOptions>): void;
/** Called when destroying Application, scoped to Application instance. */
destroy(): void;
}
/**
* Application options supplied to constructor.
* @memberof PIXI
*/
export interface IApplicationOptions extends IRendererOptionsAuto, GlobalMixins.IApplicationOptions {
}
export interface Application extends GlobalMixins.Application {
}
/**
* Convenience class to create a new PixiJS application.
*
* This class automatically creates the renderer, ticker and root container.
* @example
* import { Application, Sprite } from 'pixi.js';
*
* // Create the application
* const app = new Application();
*
* // Add the view to the DOM
* document.body.appendChild(app.view);
*
* // ex, add display objects
* app.stage.addChild(Sprite.from('something.png'));
* @class
* @memberof PIXI
*/
export declare class Application<VIEW extends ICanvas = ICanvas> {
/** Collection of installed plugins. */
static _plugins: IApplicationPlugin[];
/**
* The root display container that's rendered.
* @member {PIXI.Container}
*/
stage: Container;
/**
* WebGL renderer if available, otherwise CanvasRenderer.
* @member {PIXI.Renderer|PIXI.CanvasRenderer}
*/
renderer: IRenderer<VIEW>;
/**
* @param options - The optional application and renderer parameters.
*/
constructor(options?: Partial<IApplicationOptions>);
/** Render the current stage. */
render(): void;
/**
* Reference to the renderer's canvas element.
* @member {PIXI.ICanvas}
* @readonly
*/
get view(): 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(): Rectangle;
/**
* 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?: boolean, stageOptions?: IDestroyOptions | boolean): void;
}

57
live2d/node_modules/@pixi/app/lib/Application.js generated vendored Normal file
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

1
live2d/node_modules/@pixi/app/lib/Application.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

59
live2d/node_modules/@pixi/app/lib/Application.mjs generated vendored Normal file
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

40
live2d/node_modules/@pixi/app/lib/ResizePlugin.d.ts generated vendored Normal file
View File

@@ -0,0 +1,40 @@
import type { ExtensionMetadata, Renderer } from '@pixi/core';
type ResizeableRenderer = Pick<Renderer, 'resize'>;
export interface ResizePluginOptions {
/**
* Element to automatically resize stage to.
* @memberof PIXI.IApplicationOptions
*/
resizeTo?: Window | HTMLElement;
}
/**
* Middleware for for Application's resize functionality
* @private
* @class
*/
export declare class ResizePlugin {
/** @ignore */
static extension: ExtensionMetadata;
static resizeTo: Window | HTMLElement;
static resize: () => void;
static renderer: ResizeableRenderer;
static queueResize: () => void;
static render: () => void;
private static _resizeId;
private static _resizeTo;
private static cancelResize;
/**
* Initialize the plugin with scope of application instance
* @static
* @private
* @param {object} [options] - See application options
*/
static init(options: ResizePluginOptions): void;
/**
* Clean up the ticker, scoped to application
* @static
* @private
*/
static destroy(): void;
}
export {};

59
live2d/node_modules/@pixi/app/lib/ResizePlugin.js generated vendored Normal file
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

60
live2d/node_modules/@pixi/app/lib/ResizePlugin.mjs generated vendored Normal file
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

3
live2d/node_modules/@pixi/app/lib/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
/// <reference path="../global.d.ts" />
export * from './Application';
export * from './ResizePlugin';

5
live2d/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

1
live2d/node_modules/@pixi/app/lib/index.js.map generated vendored Normal file
View File

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

7
live2d/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

1
live2d/node_modules/@pixi/app/lib/index.mjs.map generated vendored Normal file
View File

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

42
live2d/node_modules/@pixi/app/package.json generated vendored Normal file
View File

@@ -0,0 +1,42 @@
{
"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",
"contributors": [
"Matt Karl <matt@mattkarl.com>"
],
"homepage": "http://pixijs.com/",
"bugs": "https://github.com/pixijs/pixijs/issues",
"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
live2d/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.

10
live2d/node_modules/@pixi/assets/README.md generated vendored Normal file
View File

@@ -0,0 +1,10 @@
# @pixi/assets
This package contains the assets class for PixiJS
managing the resolving and loading of assets.
## Installation
```bash
npm install @pixi/assets
```

8
live2d/node_modules/@pixi/assets/global.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
declare namespace GlobalMixins
{
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface AssetsPreferences
{
}
}

View File

@@ -0,0 +1,18 @@
import { ExtensionType } from '@pixi/core';
import type { CacheParser } from './cache';
import type { FormatDetectionParser } from './detections';
import type { LoaderParser } from './loader';
import type { ResolveURLParser } from './resolver';
/**
* This developer convenience object allows developers to group
* together the various asset parsers into a single object.
* @memberof PIXI
*/
interface AssetExtension<ASSET = any, META_DATA = any> {
extension: ExtensionType.Asset;
loader?: Partial<LoaderParser<ASSET, META_DATA>>;
resolver?: Partial<ResolveURLParser>;
cache?: Partial<CacheParser<ASSET>>;
detection?: Partial<FormatDetectionParser>;
}
export type { AssetExtension };

21
live2d/node_modules/@pixi/assets/lib/AssetExtension.js generated vendored Normal file
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;"}

509
live2d/node_modules/@pixi/assets/lib/Assets.d.ts generated vendored Normal file
View File

@@ -0,0 +1,509 @@
import { Cache } from './cache/Cache';
import { Loader } from './loader/Loader';
import { Resolver } from './resolver/Resolver';
import type { FormatDetectionParser } from './detections';
import type { LoadTextureConfig } from './loader/parsers';
import type { BundleIdentifierOptions } from './resolver/Resolver';
import type { ArrayOr, AssetsBundle, AssetsManifest, LoadParserName, ResolvedAsset, UnresolvedAsset } from './types';
export type ProgressCallback = (progress: number) => void;
/**
* Extensible preferences that can be used, for instance, when configuring loaders.
* @since 7.2.0
* @memberof PIXI
*/
export interface AssetsPreferences extends LoadTextureConfig, GlobalMixins.AssetsPreferences {
}
/**
* Initialization options object for Asset Class.
* @memberof PIXI
*/
export interface AssetInitOptions {
/** a base path for any assets loaded */
basePath?: string;
/** a default URL parameter string to append to all assets loaded */
defaultSearchParams?: string | Record<string, any>;
/**
* a manifest to tell the asset loader upfront what all your assets are
* this can be the manifest object itself, or a URL to the manifest.
*/
manifest?: string | AssetsManifest;
/**
* optional preferences for which textures preferences you have when resolving assets
* for example you might set the resolution to 0.5 if the user is on a rubbish old phone
* or you might set the resolution to 2 if the user is on a retina display
*/
texturePreference?: {
/** the resolution order you prefer, can be an array (priority order - first is prefered) or a single resolutions */
resolution?: number | number[];
/**
* the formats you prefer, by default this will be:
* ['avif', 'webp', 'png', 'jpg', 'jpeg', 'webm', 'mp4', 'm4v', 'ogv']
*/
format?: ArrayOr<string>;
};
/**
* If true, don't attempt to detect whether browser has preferred formats available.
* May result in increased performance as it skips detection step.
*/
skipDetections?: boolean;
/** advanced - override how bundlesIds are generated */
bundleIdentifier?: BundleIdentifierOptions;
/** Optional loader preferences */
preferences?: Partial<AssetsPreferences>;
}
/**
* A one stop shop for all Pixi resource management!
* Super modern and easy to use, with enough flexibility to customize and do what you need!
* @memberof PIXI
* @namespace Assets
*
* Only one Asset Class exists accessed via the Global Asset object.
*
* It has four main responsibilities:
* 1. Allows users to map URLs to keys and resolve them according to the user's browser capabilities
* 2. Loads the resources and transforms them into assets that developers understand.
* 3. Caches the assets and provides a way to access them.
* 4. Allow developers to unload assets and clear the cache.
*
* It also has a few advanced features:
* 1. Allows developers to provide a manifest upfront of all assets and help manage them via 'bundles'.
* 2. Allows users to background load assets. Shortening (or eliminating) load times and improving UX. With this feature,
* in-game loading bars can be a thing of the past!
*
* ### Assets Loading
*
* Do not be afraid to load things multiple times - under the hood, it will NEVER load anything more than once.
*
* For example:
*
* ```js
* import { Assets } from 'pixi.js';
*
* promise1 = Assets.load('bunny.png')
* promise2 = Assets.load('bunny.png')
*
* // promise1 === promise2
* ```
*
* Here both promises will be the same. Once resolved... Forever resolved! It makes for really easy resource management!
*
* Out of the box it supports the following files:
* - textures (avif, webp, png, jpg, gif, svg)
* - sprite sheets (json)
* - bitmap fonts (xml, fnt, txt)
* - web fonts (ttf, woff, woff2)
* - json files (json)
* - text files (txt)
*
* More types can be added fairly easily by creating additional loader parsers.
*
* ### Textures
* - Textures are loaded as ImageBitmap on a worker thread where possible.
* Leading to much less janky load + parse times.
* - By default, we will prefer to load AVIF and WebP image files if you specify them.
* But if the browser doesn't support AVIF or WebP we will fall back to png and jpg.
* - Textures can also be accessed via Texture.from(...) and now use this asset manager under the hood!
* - Don't worry if you set preferences for textures that don't exist (for example you prefer 2x resolutions images
* but only 1x is available for that texture, the Asset manager will pick that up as a fallback automatically)
*
* #### Sprite sheets
* - It's hard to know what resolution a sprite sheet is without loading it first, to address this
* there is a naming convention we have added that will let Pixi understand the image format and resolution
* of the spritesheet via its file name:
*
* `my-spritesheet{resolution}.{imageFormat}.json`
*
* For example:
*
* `my-spritesheet@2x.webp.json` // 2x resolution, WebP sprite sheet
* `my-spritesheet@0.5x.png.json` // 0.5x resolution, png sprite sheet
*
* This is optional! You can just load a sprite sheet as normal.
* This is only useful if you have a bunch of different res / formatted spritesheets.
*
* ### Fonts
* Web fonts will be loaded with all weights.
* It is possible to load only specific weights by doing the following:
*
* ```js
* import { Assets } from 'pixi.js';
*
* // Load specific weights..
* await Assets.load({
* data: {
* weights: ['normal'], // Only loads the weight
* },
* src: `outfit.woff2`,
* });
*
* // Load everything...
* await Assets.load(`outfit.woff2`);
* ```
*
* ### Background Loading
* Background loading will load stuff for you passively behind the scenes. To minimize jank,
* it will only load one asset at a time. As soon as a developer calls `Assets.load(...)` the
* background loader is paused and requested assets are loaded as a priority.
* Don't worry if something is in there that's already loaded, it will just get skipped!
*
* You still need to call `Assets.load(...)` to get an asset that has been loaded in the background.
* It's just that this promise will resolve instantly if the asset
* has already been loaded.
*
* ### Manifest and Bundles
* - Manifest is a JSON file that contains a list of all assets and their properties.
* - Bundles are a way to group assets together.
*
* ```js
* 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');
* ```
* @example
* import { Assets } from 'pixi.js';
*
* const bunny = await Assets.load('bunny.png');
*/
export declare class AssetsClass {
/** the resolver to map various urls */
resolver: Resolver;
/**
* The loader, loads stuff!
* @type {PIXI.AssetLoader}
*/
loader: Loader;
/**
* The global cache of all assets within PixiJS
* @type {PIXI.Cache}
*/
cache: typeof Cache;
/** takes care of loading assets in the background */
private readonly _backgroundLoader;
private _detections;
private _initialized;
constructor();
/**
* 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
*/
init(options?: AssetInitOptions): Promise<void>;
/** @deprecated */
add(a: ArrayOr<string>, s?: string | string[], d?: unknown, f?: string, lp?: LoadParserName): void;
/**
* Allows you to specify how to resolve any assets load requests.
* There are a few ways to add things here as shown below:
* @example
* import { Assets } from 'pixi.js';
*
* // Simple
* Assets.add({alias: 'bunnyBooBoo', src: 'bunny.png'});
* const bunny = await Assets.load('bunnyBooBoo');
*
* // Multiple keys:
* Assets.add({alias: ['burger', 'chicken'], src: 'bunny.png'});
*
* const bunny = await Assets.load('burger');
* const bunny2 = await Assets.load('chicken');
*
* // passing options to to the object
* Assets.add({
* alias: 'bunnyBooBooSmooth',
* src: 'bunny{png,webp}',
* data: { scaleMode: SCALE_MODES.NEAREST }, // Base texture options
* });
*
* // Multiple assets
*
* // The following all do the same thing:
*
* Assets.add({alias: 'bunnyBooBoo', src: 'bunny{png,webp}'});
*
* Assets.add({
* alias: 'bunnyBooBoo',
* src: [
* 'bunny.png',
* 'bunny.webp',
* ],
* });
*
* const bunny = await Assets.load('bunnyBooBoo'); // Will try to load WebP if available
* @param data - the data to add
* @param data.aliases - the key or keys that you will reference when loading this asset
* @param data.srcs - the asset or assets that will be chosen from when loading via the specified key
* @param data.data - asset-specific data that will be passed to the loaders
* - Useful if you want to initiate loaded objects with specific data
* @param data.format - the format of the asset
* @param data.loadParser - the name of the load parser to use
*/
add(data: (ArrayOr<UnresolvedAsset>)): void;
/**
* Loads your assets! You pass in a key or URL and it will return a promise that
* resolves to the loaded asset. If multiple assets a requested, it will return a hash of assets.
*
* Don't worry about loading things multiple times, behind the scenes assets are only ever loaded
* once and the same promise reused behind the scenes so you can safely call this function multiple
* times with the same key and it will always return the same asset.
* @example
* import { Assets } from 'pixi.js';
*
* // Load a URL:
* const myImageTexture = await Assets.load('http://some.url.com/image.png'); // => returns a texture
*
* Assets.add('thumper', 'bunny.png');
* Assets.add('chicko', 'chicken.png');
*
* // Load multiple assets:
* const textures = await Assets.load(['thumper', 'chicko']); // => {thumper: Texture, chicko: Texture}
* @param urls - the urls 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.
* @returns - the assets that were loaded, either a single asset or a hash of assets
*/
load<T = any>(urls: string | UnresolvedAsset, onProgress?: ProgressCallback): Promise<T>;
load<T = any>(urls: string[] | UnresolvedAsset[], onProgress?: ProgressCallback): Promise<Record<string, T>>;
/**
* 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: string, assets: AssetsBundle['assets']): void;
/**
* 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
*/
loadBundle(bundleIds: ArrayOr<string>, onProgress?: ProgressCallback): Promise<any>;
/**
* 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
*/
backgroundLoad(urls: ArrayOr<string>): Promise<void>;
/**
* 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
*/
backgroundLoadBundle(bundleIds: ArrayOr<string>): Promise<void>;
/**
* Only intended for development purposes.
* This will wipe the resolver and caches.
* You will need to reinitialize the Asset
*/
reset(): void;
/**
* Instantly gets an asset already loaded from the cache. If the asset has not yet been loaded,
* it will return undefined. So it's on you! When in doubt just use `Assets.load` instead.
* (Remember, the loader will never load things more than once!)
* @param keys - The key or keys for the assets that you want to access
* @returns - The assets or hash of assets requested
*/
get<T = any>(keys: string): T;
get<T = any>(keys: string[]): Record<string, T>;
/**
* helper function to map resolved assets back to loaded assets
* @param resolveResults - the resolve results from the resolver
* @param onProgress - the progress callback
*/
private _mapLoadToResolve;
/**
* 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
*/
unload(urls: ArrayOr<string> | ResolvedAsset | ResolvedAsset[]): Promise<void>;
/**
* 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
*/
unloadBundle(bundleIds: ArrayOr<string>): Promise<void>;
private _unloadFromResolved;
/**
* 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
*/
private _detectFormats;
/** All the detection parsers currently added to the Assets class. */
get detections(): FormatDetectionParser[];
/**
* @deprecated since 7.2.0
* @see {@link Assets.setPreferences}
*/
get preferWorkers(): boolean;
set preferWorkers(value: boolean);
/**
* General setter for preferences. This is a helper function to set preferences on all parsers.
* @param preferences - the preferences to set
*/
setPreferences(preferences: Partial<AssetsPreferences>): void;
}
export declare const Assets: AssetsClass;

328
live2d/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

1
live2d/node_modules/@pixi/assets/lib/Assets.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

335
live2d/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

1
live2d/node_modules/@pixi/assets/lib/Assets.mjs.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,41 @@
import type { Loader } from './loader/Loader';
import type { ResolvedAsset } from './types';
/**
* Quietly Loads assets in the background.
* @memberof PIXI
*/
export declare class BackgroundLoader {
/** Whether or not the loader should continue loading. */
private _isActive;
/** Assets to load. */
private readonly _assetList;
/** Whether or not the loader is loading. */
private _isLoading;
/** Number of assets to load at a time. */
private readonly _maxConcurrent;
/** Should the loader log to the console. */
verbose: boolean;
private readonly _loader;
/**
* @param loader
* @param verbose - should the loader log to the console
*/
constructor(loader: Loader, verbose?: boolean);
/**
* Adds an array of assets to load.
* @param assetUrls - assets to load
*/
add(assetUrls: ResolvedAsset[]): void;
/**
* 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.
*/
private _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(): boolean;
set active(value: boolean);
}

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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

50
live2d/node_modules/@pixi/assets/lib/cache/Cache.d.ts generated vendored Normal file
View File

@@ -0,0 +1,50 @@
import type { CacheParser } from './CacheParser';
/**
* A single Cache for all assets.
*
* When assets are added to the cache via set they normally are added to the cache as key-value pairs.
*
* With this cache, you can add parsers that will take the object and convert it to a list of assets that can be cached.
* for example a cacheSprite Sheet parser will add all of the textures found within its sprite sheet directly to the cache.
*
* This gives devs the flexibility to cache any type of object however we want.
*
* It is not intended that this class is created by developers - it is part of the Asset package.
* This is the first major system of PixiJS' main Assets class.
* @memberof PIXI
* @class Cache
*/
declare class CacheClass {
private _parsers;
private readonly _cache;
private readonly _cacheMap;
/** Clear all entries. */
reset(): void;
/**
* Check if the key exists
* @param key - The key to check
*/
has(key: string): boolean;
/**
* Fetch entry by key
* @param key - The key of the entry to get
*/
get<T = any>(key: string): T;
/**
* 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: string | string[], value: unknown): void;
/**
* 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: string): void;
/** All loader parsers registered */
get parsers(): CacheParser[];
}
export declare const Cache: CacheClass;
export {};

86
live2d/node_modules/@pixi/assets/lib/cache/Cache.js generated vendored Normal file
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

87
live2d/node_modules/@pixi/assets/lib/cache/Cache.mjs generated vendored Normal file
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,31 @@
import type { ExtensionMetadata } from '@pixi/core';
/**
* For every asset that is cached, it will call the parsers test function
* the flow is as follows:
*
* 1. `cacheParser.test()`: Test the asset.
* 2. `cacheParser.getCacheableAssets()`: If the test passes call the getCacheableAssets function with the asset
*
* Useful if you want to add more than just a raw asset to the cache
* (for example a spritesheet will want to make all its sub textures easily accessible in the cache)
* @memberof PIXI
*/
export interface CacheParser<T = any> {
extension?: ExtensionMetadata;
/** A config to adjust the parser */
config?: Record<string, any>;
/**
* Gets called by the cache when a dev caches an asset
* @param asset - the asset to test
*/
test: (asset: T) => boolean;
/**
* If the test passes, this function is called to get the cacheable assets
* an example may be that a spritesheet object will return all the sub textures it has so they can
* be cached.
* @param keys - The keys to cache the assets under
* @param asset - The asset to get the cacheable assets from
* @returns A key-value pair of cacheable assets
*/
getCacheableAssets: (keys: string[], asset: T) => Record<string, any>;
}

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,3 @@
export * from './Cache';
export * from './CacheParser';
export * from './parsers';

6
live2d/node_modules/@pixi/assets/lib/cache/index.js generated vendored Normal file
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":";;;;;"}

7
live2d/node_modules/@pixi/assets/lib/cache/index.mjs generated vendored Normal file
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,3 @@
import { Texture } from '@pixi/core';
import type { CacheParser } from '../CacheParser';
export declare const cacheTextureArray: CacheParser<Texture[]>;

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 @@
export * from './cacheTextureArray';

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,26 @@
import type { ExtensionMetadata } from '@pixi/core';
/**
* Format detection is useful for detecting feature support
* on the current platform.
* @memberof PIXI
*/
export interface FormatDetectionParser {
/** Should be ExtensionType.DetectionParser */
extension?: ExtensionMetadata;
/** Browser/platform feature detection supported if return true */
test: () => Promise<boolean>;
/**
* Add formats (file extensions) to the existing list of formats.
* Return an new array with added formats, do not mutate the formats argument.
* @returns {Promise<string[]>} - Promise that resolves to the new formats array.
*/
add: (formats: string[]) => Promise<string[]>;
/**
* Remove formats (file extensions) from the list of supported formats.
* This is used when uninstalling this DetectionParser.
* Return an new array with filtered formats, do not mutate the formats argument.
* @returns {Promise<string[]>} - Promise that resolves to the new formats array.
*/
remove: (formats: string[]) => Promise<string[]>;
}
export * from './parsers';

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,2 @@
import type { FormatDetectionParser } from '..';
export declare const detectAvif: FormatDetectionParser;

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

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