@laplace.live/persona-sdk 0.3.0 → 0.5.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 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
- /** A model as the registry lists it. Paths deliberately never cross the wire. */
6
- export interface ModelRef {
7
- /** Stable slug, unique per installed model. */
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: ModelKind;
11
- format: ModelFormat;
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
- /** How a registered file is labelled. Wider than an object's content kinds: `.hdr` is only ever an environment map. */
18
- export type AssetKind = 'image' | 'video' | 'prop' | 'ibl' | 'lut';
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
- /** `imagePath` is accepted but survives only when the app has allowlisted it via its own picker. */
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
- imagePath: string | null;
219
+ imageAssetId: string | null;
217
220
  }
218
221
  export interface SceneBehavior {
219
222
  lookAtCursor: boolean;
@@ -232,6 +235,13 @@ export interface SceneCamera {
232
235
  fov: number;
233
236
  }
234
237
  export type SceneLightType = 'directional' | 'point' | 'ambient';
238
+ /**
239
+ * Per-light shadow tier. `off` is the old `castShadow: false`; the rest raise
240
+ * shadow-map resolution. A point light pays 6 cube faces for the same tier a
241
+ * directional light covers with one map, so it gets the smaller of the pair.
242
+ */
243
+ export declare const SHADOW_QUALITY_LEVELS: readonly ["off", "low", "medium", "high", "extra"];
244
+ export type ShadowQuality = (typeof SHADOW_QUALITY_LEVELS)[number];
235
245
  /**
236
246
  * One scene light. Angles are degrees. Directional lights aim with
237
247
  * azimuth/elevation and sit at x/y/z (which moves their handle and shadow
@@ -250,7 +260,7 @@ export interface SceneLight {
250
260
  z: number;
251
261
  range: number;
252
262
  /** Ambient light is directionless, so it never casts whatever this says. */
253
- castShadow: boolean;
263
+ shadowQuality: ShadowQuality;
254
264
  /** Penumbra width in shadow-map texels — a stylistic dial; the filter widens the edge uniformly. */
255
265
  shadowRadius: number;
256
266
  }
@@ -308,17 +318,39 @@ export interface SceneDepthOfField {
308
318
  bokehScale: number;
309
319
  focusRange: number;
310
320
  }
311
- /** Overlay/stylization gimmicks, each independently switchable. */
312
- export interface SceneStylize {
313
- pixelate: {
314
- enabled: boolean;
315
- granularity: number;
316
- };
317
- glitch: {
318
- enabled: boolean;
319
- };
321
+ /** Broadcast-style glitch bursts: slice tears, RGB split, block corruption, analog noise. */
322
+ export interface SceneGlitch {
323
+ enabled: boolean;
324
+ /** Overall strength (0 to 2). */
325
+ intensity: number;
326
+ /** How fast the glitch pattern mutates. 1 re-rolls the tear 24 times per second. */
327
+ speed: number;
328
+ /** Seconds between bursts. 0 keeps the glitch running constantly. */
329
+ interval: number;
330
+ /** How long each burst lasts, in seconds. */
331
+ duration: number;
332
+ /** Horizontal slices the tear snaps to. Lower is chunkier. */
333
+ slices: number;
334
+ /** How far torn slices shift sideways, in output pixels. */
335
+ shift: number;
336
+ /** Chromatic RGB split during bursts, in output pixels. */
337
+ rgbShift: number;
338
+ /** Amount of corrupted block artifacts during bursts (0 to 1). */
339
+ blocks: number;
340
+ /** Analog noise and scanline flicker during bursts (0 to 1). */
341
+ noise: number;
342
+ }
343
+ /** Mosaic over the frame. `granularity` is pixels per block. */
344
+ export interface ScenePixelate {
345
+ enabled: boolean;
346
+ granularity: number;
320
347
  }
321
- /** Post-processing over the rendered 3D frame. Everything off skips the effect chain entirely. */
348
+ /**
349
+ * Post-processing over the rendered 3D frame. Everything off skips the effect
350
+ * chain entirely. Deliberately flat: every toggle-plus-numbers effect sits at
351
+ * the top level so tooling (defaults, healing, editors) can walk the effect
352
+ * registry generically. Grouping is a panel concern, not a data one.
353
+ */
322
354
  export interface SceneEffects {
323
355
  toneMapping: SceneToneMapping;
324
356
  /** Scene brightness multiplied in before the tone curve; 1 is neutral. Works in every mode, including `none`. */
@@ -330,7 +362,8 @@ export interface SceneEffects {
330
362
  grain: SceneFilmGrain;
331
363
  lut: SceneLut;
332
364
  dof: SceneDepthOfField;
333
- stylize: SceneStylize;
365
+ pixelate: ScenePixelate;
366
+ glitch: SceneGlitch;
334
367
  }
335
368
  /**
336
369
  * Image-based lighting for the 3D stage: an environment map, whether to show it
@@ -405,11 +438,15 @@ export interface AnchorOption {
405
438
  anchor: AttachAnchor;
406
439
  label: string;
407
440
  }
408
- /** Panel-style model info block. Format-specific fields mirror the app's `ModelInfo`. */
441
+ /**
442
+ * Panel-style model info block. Format-specific fields mirror the app's `ModelInfo`.
443
+ * `format` stays the union's discriminant here — this is a runtime diagnostic, not
444
+ * content metadata, so it does not follow {@link ContentRef}'s `kind`.
445
+ */
409
446
  export interface ModelInfo {
410
447
  format: ModelFormat;
411
448
  name: string;
412
- kind: ModelKind;
449
+ origin: ContentOrigin;
413
450
  file: string;
414
451
  loadMs: number;
415
452
  /** Format-specific details (canvas/params/textures for Live2D, spec/bones for VRM). */
package/dist/types.js CHANGED
@@ -1,6 +1,12 @@
1
1
  // The API's data model: the entity shapes that requests, responses, and events
2
2
  // carry. Structural mirrors of the app's scene/settings models, minus anything
3
3
  // filesystem-shaped — model refs are sanitized to ids, never directories.
4
+ /**
5
+ * Per-light shadow tier. `off` is the old `castShadow: false`; the rest raise
6
+ * shadow-map resolution. A point light pays 6 cube faces for the same tier a
7
+ * directional light covers with one map, so it gets the smaller of the pair.
8
+ */
9
+ export const SHADOW_QUALITY_LEVELS = ['off', 'low', 'medium', 'high', 'extra'];
4
10
  export const EFFECTS_QUALITY_LEVELS = ['low', 'medium', 'high'];
5
11
  /**
6
12
  * Accepted values for `performance.fpsLimit`; 0 = unlimited. Anything else is snapped
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laplace.live/persona-sdk",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "TypeScript SDK and wire schema for the LAPLACE Persona plugin API",
5
5
  "license": "MIT",
6
6
  "type": "module",