Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | 2260x 21x 109x 4x | import {
asLoadedFileEntryBytes,
findCaseInsensitiveMapPath,
loadFileEntryBytes,
lookupCaseInsensitiveMapEntry,
readFilesIntoEntryMap,
type AssetFileEntry,
type ReadFilesIntoEntryMapOptions,
} from '@be-music/shared-utils/core';
/**
* Single file dropped by the user when loading a beatoraja skin theme. Mirrors the shape exposed by
* `<input type="file" webkitdirectory>` and `DataTransferItem.getAsFileSystemEntry()` so the host UI can hand the
* theme directory straight to {@link readFilesIntoBytesMap}.
*/
export interface BeatorajaSkinInputFile {
readonly name: string;
readonly webkitRelativePath?: string;
arrayBuffer(): Promise<ArrayBuffer>;
}
/**
* Either a fully-resolved byte buffer or a deferred file handle. The skin parser returns deferred entries for large
* binary assets (audio, big PNGs) so the consumer can load them lazily on a worker thread without blocking the
* initial parse.
*/
export type BeatorajaSkinFileEntry = AssetFileEntry<BeatorajaSkinInputFile>;
export function findCaseInsensitivePath(
files: ReadonlyMap<string, BeatorajaSkinFileEntry>,
candidate: string,
): string | undefined {
return findCaseInsensitiveMapPath(files, candidate);
}
export function lookupBytesCaseInsensitive(
files: ReadonlyMap<string, BeatorajaSkinFileEntry>,
candidate: string,
): BeatorajaSkinFileEntry | undefined {
return lookupCaseInsensitiveMapEntry(files, candidate);
}
export async function loadAssetBytes(entry: BeatorajaSkinFileEntry | undefined): Promise<Uint8Array | undefined> {
return loadFileEntryBytes(entry);
}
export function asLoadedBytes(entry: BeatorajaSkinFileEntry | undefined): Uint8Array | undefined {
return asLoadedFileEntryBytes(entry);
}
export async function readFilesIntoBytesMap(
files: ReadonlyArray<BeatorajaSkinInputFile>,
options: ReadFilesIntoEntryMapOptions = {},
): Promise<Map<string, BeatorajaSkinFileEntry>> {
return readFilesIntoEntryMap(files, options);
}
|