@laplace.live/persona-sdk 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types.d.ts +33 -26
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -1,45 +1,48 @@
|
|
|
1
1
|
export type ModelFormat = 'live2d' | 'vrm';
|
|
2
|
-
export type ModelKind = 'bundled' | 'user';
|
|
3
2
|
/** Where an item came from: shipped with the app, or added by the user. */
|
|
4
3
|
export type ContentOrigin = 'bundled' | 'user';
|
|
5
|
-
/**
|
|
6
|
-
export
|
|
7
|
-
|
|
4
|
+
/** How a registered file is labelled. Wider than an object's content kinds: `.hdr` is only ever an environment map. */
|
|
5
|
+
export type AssetKind = 'image' | 'video' | 'prop' | 'ibl' | 'lut' | 'animation';
|
|
6
|
+
/** Every content kind the Inventory can list. `pngtuber` is schema-ready before any producer exists. */
|
|
7
|
+
export type InventoryKind = ModelFormat | 'pngtuber' | AssetKind;
|
|
8
|
+
/**
|
|
9
|
+
* What every registry entry carries, model or asset alike. `kind` is always *what
|
|
10
|
+
* the thing is* and `origin` always *where it came from* — the two were once
|
|
11
|
+
* `format`/`kind` on models and `kind`/`origin` on assets, which made `kind` mean
|
|
12
|
+
* opposite things on the two types.
|
|
13
|
+
*
|
|
14
|
+
* Paths deliberately never cross the wire; the registries keep those private.
|
|
15
|
+
*/
|
|
16
|
+
export interface ContentRef {
|
|
17
|
+
/** Stable slug, unique per installed item. Scene refs key off it. */
|
|
8
18
|
id: string;
|
|
9
19
|
name: string;
|
|
10
|
-
kind:
|
|
11
|
-
|
|
20
|
+
kind: InventoryKind;
|
|
21
|
+
origin: ContentOrigin;
|
|
12
22
|
/** Creator credit, for attribution in pickers. */
|
|
13
23
|
author?: string;
|
|
14
24
|
/** Creator or content homepage (https). */
|
|
15
25
|
url?: string;
|
|
16
26
|
}
|
|
17
|
-
/**
|
|
18
|
-
export
|
|
27
|
+
/** A model as the registry lists it. */
|
|
28
|
+
export interface ModelRef extends ContentRef {
|
|
29
|
+
kind: ModelFormat;
|
|
30
|
+
}
|
|
19
31
|
/** A registered object-source file. `exists` is false once the file is gone from disk. */
|
|
20
|
-
export interface AssetRef {
|
|
21
|
-
id: string;
|
|
22
|
-
name: string;
|
|
32
|
+
export interface AssetRef extends ContentRef {
|
|
23
33
|
/** What the extension makes it — an object created from it starts on this kind. */
|
|
24
34
|
kind: AssetKind;
|
|
25
|
-
origin: ContentOrigin;
|
|
26
35
|
exists: boolean;
|
|
27
|
-
/** Creator credit, for attribution in pickers. */
|
|
28
|
-
author?: string;
|
|
29
|
-
/** Creator or content homepage (https). */
|
|
30
|
-
url?: string;
|
|
31
36
|
}
|
|
32
|
-
/** Every content kind the Inventory can list. `pngtuber` is schema-ready before any producer exists. */
|
|
33
|
-
export type InventoryKind = 'live2d' | 'vrm' | 'pngtuber' | 'image' | 'video' | 'prop';
|
|
34
37
|
/**
|
|
35
38
|
* Content metadata decoupled from any on-disk file — local registry entries and
|
|
36
39
|
* remote catalog rows both map into it. `id` is stable forever: scene refs key
|
|
37
40
|
* off it, and it must survive a ship-in-app → download-from-CDN migration.
|
|
41
|
+
*
|
|
42
|
+
* A {@link ContentRef} minus `origin`, which a remote row has no answer for until
|
|
43
|
+
* it is installed, plus what only a catalog knows (thumbnail, payload, revision).
|
|
38
44
|
*/
|
|
39
|
-
export interface CatalogItem {
|
|
40
|
-
id: string;
|
|
41
|
-
kind: InventoryKind;
|
|
42
|
-
name: string;
|
|
45
|
+
export interface CatalogItem extends Omit<ContentRef, 'origin'> {
|
|
43
46
|
/** `persona://` for local items; CDN https for metadata-only rows. */
|
|
44
47
|
thumbnailUrl?: string;
|
|
45
48
|
/** Payload location + integrity when not on disk; absent = already local. */
|
|
@@ -209,11 +212,11 @@ export interface SceneObjectItem {
|
|
|
209
212
|
/** Anything the stage renders. Array order in {@link Scene.items} is z-order within each space. */
|
|
210
213
|
export type SceneItem = SceneModelItem | SceneObjectItem;
|
|
211
214
|
export type BackgroundMode = 'transparent' | 'color' | 'image';
|
|
212
|
-
/** `
|
|
215
|
+
/** `imageAssetId` names a registered asset; an id this app cannot resolve renders transparent. */
|
|
213
216
|
export interface SceneBackground {
|
|
214
217
|
mode: BackgroundMode;
|
|
215
218
|
color: string;
|
|
216
|
-
|
|
219
|
+
imageAssetId: string | null;
|
|
217
220
|
}
|
|
218
221
|
export interface SceneBehavior {
|
|
219
222
|
lookAtCursor: boolean;
|
|
@@ -405,11 +408,15 @@ export interface AnchorOption {
|
|
|
405
408
|
anchor: AttachAnchor;
|
|
406
409
|
label: string;
|
|
407
410
|
}
|
|
408
|
-
/**
|
|
411
|
+
/**
|
|
412
|
+
* Panel-style model info block. Format-specific fields mirror the app's `ModelInfo`.
|
|
413
|
+
* `format` stays the union's discriminant here — this is a runtime diagnostic, not
|
|
414
|
+
* content metadata, so it does not follow {@link ContentRef}'s `kind`.
|
|
415
|
+
*/
|
|
409
416
|
export interface ModelInfo {
|
|
410
417
|
format: ModelFormat;
|
|
411
418
|
name: string;
|
|
412
|
-
|
|
419
|
+
origin: ContentOrigin;
|
|
413
420
|
file: string;
|
|
414
421
|
loadMs: number;
|
|
415
422
|
/** Format-specific details (canvas/params/textures for Live2D, spec/bones for VRM). */
|