Three stores, three importers and three pickers that differ only in their type are one of each (#85)
Refactoring round one: HttpFontStore/HttpSoundStore/HttpTextureStore collapse into a generic HttpFileStore over a FileStore contract; fontImport/soundImport/textureImport share assetImport with an ImportKind per sort; ImagePicker/FontPicker/SoundPicker sit on FilePicker and describe only their row. The group/comment drag logic leaves GraphCanvas for annotationDrag.ts (with its own unit test), declaredRows.ts replaces the duplicated row build in particles.ts and shaders.ts, and dead code in font/sound/compile/emission/transform/actions is gone. README: asset list, check count 958, the two-job CI, the Scenes wiki page. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
15bdfdf07a
commit
cc6db5f350
42 files changed
+1375
-1650
No files matched your search
@@ -1,38 +1,18 @@
|
||||
export interface UploadedTexture {
|
||||
/** Content-addressed name in `data/textures/`: `{sha256}.{png|jpg|webp|gif}` (see `isTextureFile`). */
|
||||
file: string;
|
||||
/**
|
||||
* The name the file was uploaded under, '' when the server knows none. A picture may be
|
||||
* re-encoded on the way, so this can be a `.png` name on a file stored as `.webp`.
|
||||
*/
|
||||
name: string;
|
||||
import type { FileStore, StoredFile, UploadedFile } from './FileStore';
|
||||
|
||||
/**
|
||||
* Stored in `data/textures/` as `{sha256}.{png|jpg|webp|gif}`. A picture may be re-encoded on the
|
||||
* way, so `name` can be a `.png` name on a file stored as `.webp`.
|
||||
*/
|
||||
export interface UploadedTexture extends UploadedFile {
|
||||
width: number;
|
||||
height: number;
|
||||
bytes: number;
|
||||
}
|
||||
|
||||
/** A file the server holds, whether any project references it or not. */
|
||||
export interface StoredTexture {
|
||||
file: string;
|
||||
name: string;
|
||||
export interface StoredTexture extends StoredFile {
|
||||
/** 0 × 0 when the server could not read the header; such a file cannot become an asset. */
|
||||
width: number;
|
||||
height: number;
|
||||
bytes: number;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* An upload is raw bytes rather than a multipart form: name, size and format are derived from the
|
||||
* image itself on the server, so there is nothing else to send.
|
||||
*/
|
||||
export interface TextureStore {
|
||||
/**
|
||||
* `type` only fills the Content-Type header – the server trusts the bytes, not the label – and
|
||||
* uploading the same picture twice yields the same file, the hash of its content. `name` is the
|
||||
* caption kept beside it; uploading the same bytes under a new name renames what pickers show.
|
||||
*/
|
||||
upload(bytes: Blob | ArrayBuffer, type: string, name?: string): Promise<UploadedTexture>;
|
||||
list(): Promise<StoredTexture[]>;
|
||||
delete(file: string): Promise<void>;
|
||||
}
|
||||
export type TextureStore = FileStore<UploadedTexture, StoredTexture>;
|
||||
Reference in new issue
Block a user