@laplace.live/persona-sdk 0.10.0 → 0.11.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SceneEffects } from '../wire/types.ts';
|
|
1
|
+
import type { SceneEffects, ToggleEffectKey } from '../wire/types.ts';
|
|
2
2
|
/** Slider + healing metadata for one numeric effect parameter. */
|
|
3
3
|
export interface EffectParamSpec {
|
|
4
4
|
default: number;
|
|
@@ -14,12 +14,6 @@ export interface EffectParamSpec {
|
|
|
14
14
|
export interface EffectColorSpec {
|
|
15
15
|
default: string;
|
|
16
16
|
}
|
|
17
|
-
/** Keys of {@link SceneEffects} that follow the `{ enabled } + params` pattern. */
|
|
18
|
-
export type ToggleEffectKey = {
|
|
19
|
-
[K in keyof SceneEffects]: SceneEffects[K] extends {
|
|
20
|
-
enabled: boolean;
|
|
21
|
-
} ? K : never;
|
|
22
|
-
}[keyof SceneEffects];
|
|
23
17
|
export declare const EFFECT_SPECS: Record<ToggleEffectKey, Readonly<Record<string, EffectParamSpec>>>;
|
|
24
18
|
/**
|
|
25
19
|
* Hex-color params, keyed like {@link EFFECT_SPECS} — generic walkers (healing,
|
|
@@ -36,5 +30,12 @@ export declare const TOGGLE_EFFECT_KEYS: readonly ToggleEffectKey[];
|
|
|
36
30
|
export declare const SCENE_SPACE_EFFECT_KEYS: readonly ToggleEffectKey[];
|
|
37
31
|
/** Registry effects the post chain composes — {@link TOGGLE_EFFECT_KEYS} minus the scene-space ones. */
|
|
38
32
|
export declare const POST_EFFECT_KEYS: readonly ToggleEffectKey[];
|
|
33
|
+
/** The canonical `effectLayers`: registry order, junk dropped, every switched-on effect included. */
|
|
34
|
+
export declare function effectLayerKeys(listed: readonly unknown[], effects: Pick<SceneEffects, ToggleEffectKey>): ToggleEffectKey[];
|
|
35
|
+
/**
|
|
36
|
+
* Composition order, bottom to top, with user-authored effects as one `'custom'` group.
|
|
37
|
+
* Display-only: the desktop chain's `rebuild()` is the order that runs — a stage moved there moves here too.
|
|
38
|
+
*/
|
|
39
|
+
export declare const EFFECT_STACK_ORDER: readonly (ToggleEffectKey | 'custom')[];
|
|
39
40
|
/** Every registry effect at its defaults — the derived half of a fresh {@link SceneEffects}. */
|
|
40
41
|
export declare function defaultToggleEffects(): Pick<SceneEffects, ToggleEffectKey>;
|
|
@@ -177,6 +177,32 @@ export const TOGGLE_EFFECT_KEYS = Object.keys(EFFECT_SPECS);
|
|
|
177
177
|
export const SCENE_SPACE_EFFECT_KEYS = ['rain', 'snow'];
|
|
178
178
|
/** Registry effects the post chain composes — {@link TOGGLE_EFFECT_KEYS} minus the scene-space ones. */
|
|
179
179
|
export const POST_EFFECT_KEYS = TOGGLE_EFFECT_KEYS.filter(key => !SCENE_SPACE_EFFECT_KEYS.includes(key));
|
|
180
|
+
/** The canonical `effectLayers`: registry order, junk dropped, every switched-on effect included. */
|
|
181
|
+
export function effectLayerKeys(listed, effects) {
|
|
182
|
+
return TOGGLE_EFFECT_KEYS.filter(key => listed.includes(key) || effects[key].enabled);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Composition order, bottom to top, with user-authored effects as one `'custom'` group.
|
|
186
|
+
* Display-only: the desktop chain's `rebuild()` is the order that runs — a stage moved there moves here too.
|
|
187
|
+
*/
|
|
188
|
+
export const EFFECT_STACK_ORDER = [
|
|
189
|
+
'rain',
|
|
190
|
+
'snow',
|
|
191
|
+
'dof',
|
|
192
|
+
'rim',
|
|
193
|
+
'outline',
|
|
194
|
+
'dropShadow',
|
|
195
|
+
'chromaticAberration',
|
|
196
|
+
'bloom',
|
|
197
|
+
'diffusion',
|
|
198
|
+
'color',
|
|
199
|
+
'pixelate',
|
|
200
|
+
'glitch',
|
|
201
|
+
'droplets',
|
|
202
|
+
'custom',
|
|
203
|
+
'grain',
|
|
204
|
+
'vignette',
|
|
205
|
+
];
|
|
180
206
|
/** Every registry effect at its defaults — the derived half of a fresh {@link SceneEffects}. */
|
|
181
207
|
export function defaultToggleEffects() {
|
|
182
208
|
const out = {};
|
package/dist/wire/types.d.ts
CHANGED
|
@@ -3,8 +3,11 @@ export type ModelFormat = 'live2d' | 'vrm';
|
|
|
3
3
|
export type ContentOrigin = 'bundled' | 'user';
|
|
4
4
|
/** How a registered file is labelled. Wider than an object's content kinds: `.hdr` is only ever an environment map. */
|
|
5
5
|
export type AssetKind = 'image' | 'video' | 'prop' | 'ibl' | 'lut' | 'animation';
|
|
6
|
-
/**
|
|
7
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Every content kind the Inventory can list. `pngtuber` is schema-ready before any
|
|
8
|
+
* producer exists; `effect` rows are post-processing effects (built-in or installed), not files.
|
|
9
|
+
*/
|
|
10
|
+
export type InventoryKind = ModelFormat | 'pngtuber' | AssetKind | 'effect';
|
|
8
11
|
/**
|
|
9
12
|
* What every registry entry carries, model or asset alike. `kind` is always *what
|
|
10
13
|
* the thing is* and `origin` always *where it came from* — the two were once
|
|
@@ -539,6 +542,12 @@ export interface SceneEffects {
|
|
|
539
542
|
rain: SceneRain;
|
|
540
543
|
snow: SceneSnow;
|
|
541
544
|
}
|
|
545
|
+
/** Keys of {@link SceneEffects} that follow the `{ enabled } + params` pattern. */
|
|
546
|
+
export type ToggleEffectKey = {
|
|
547
|
+
[K in keyof SceneEffects]: SceneEffects[K] extends {
|
|
548
|
+
enabled: boolean;
|
|
549
|
+
} ? K : never;
|
|
550
|
+
}[keyof SceneEffects];
|
|
542
551
|
/**
|
|
543
552
|
* One user-authored effect's placement in a scene. Deliberately a sibling of
|
|
544
553
|
* {@link SceneEffects} rather than a key inside it: `ToggleEffectKey` is derived
|
|
@@ -568,6 +577,11 @@ export interface SceneEnvironment {
|
|
|
568
577
|
showSkybox: boolean;
|
|
569
578
|
fog: SceneFog;
|
|
570
579
|
effects: SceneEffects;
|
|
580
|
+
/**
|
|
581
|
+
* Built-in effects added as layers, in registry order — one keeps its row and tuning while
|
|
582
|
+
* switched off. Healing lists every switched-on effect, so a patch that switches one on adds its layer.
|
|
583
|
+
*/
|
|
584
|
+
effectLayers: ToggleEffectKey[];
|
|
571
585
|
/**
|
|
572
586
|
* User-authored effects, in the order they compose. They run as a group at one
|
|
573
587
|
* fixed point in the post chain — after grading and the screen-space warps,
|