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,26 +1,9 @@
|
||||
export interface UploadedFont {
|
||||
/** Content-addressed name in `data/fonts/`: `{sha256}.{ttf|otf|woff|woff2}` (see `isFontFile`). */
|
||||
file: string;
|
||||
/** The name the file was uploaded under, '' when the server knows none. Never a path. */
|
||||
name: string;
|
||||
bytes: number;
|
||||
}
|
||||
|
||||
/** A typeface the server holds, whether any project references it or not. */
|
||||
export interface StoredFont {
|
||||
file: string;
|
||||
name: string;
|
||||
bytes: number;
|
||||
updatedAt: string;
|
||||
}
|
||||
import type { FileStore, StoredFile, UploadedFile } from './FileStore';
|
||||
|
||||
/**
|
||||
* Raw bytes, like an image upload: the server derives name and format from the file itself. Unlike
|
||||
* an image a font is never re-encoded on the way, so what the server stores is what was picked.
|
||||
* Stored in `data/fonts/` as `{sha256}.{ttf|otf|woff|woff2}`. Unlike an image a font is never
|
||||
* re-encoded on the way, so what the server stores is what was picked.
|
||||
*/
|
||||
export interface FontStore {
|
||||
/** `name` is kept beside the file as its caption; the stored file is always the hash. */
|
||||
upload(bytes: Blob | ArrayBuffer, type: string, name?: string): Promise<UploadedFont>;
|
||||
list(): Promise<StoredFont[]>;
|
||||
delete(file: string): Promise<void>;
|
||||
}
|
||||
export type UploadedFont = UploadedFile;
|
||||
export type StoredFont = StoredFile;
|
||||
export type FontStore = FileStore<UploadedFont, StoredFont>;
|
||||
Reference in new issue
Block a user