@laplace.live/persona-sdk 0.14.0 → 0.15.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/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export * from './client/client.ts';
3
3
  export * from './values/custom-effect.ts';
4
4
  export * from './values/effect-schema.ts';
5
5
  export * from './values/guards.ts';
6
+ export * from './values/hotkeys.ts';
6
7
  export * from './values/labels.ts';
7
8
  export * from './values/limits.ts';
8
9
  export * from './values/locale.ts';
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ export * from "./client/client.js";
5
5
  export * from "./values/custom-effect.js";
6
6
  export * from "./values/effect-schema.js";
7
7
  export * from "./values/guards.js";
8
+ export * from "./values/hotkeys.js";
8
9
  export * from "./values/labels.js";
9
10
  export * from "./values/limits.js";
10
11
  export * from "./values/locale.js";
@@ -0,0 +1,2 @@
1
+ /** True when the combo carries a command modifier and so may be registered globally. */
2
+ export declare function hasCommandModifier(accelerator: string | null): boolean;
@@ -0,0 +1,11 @@
1
+ // Hotkey rules every consumer must agree on: main decides OS registration by them, and a
2
+ // client reading `Hotkey.global` off the wire needs the same rule to know the flag can apply.
3
+ // Shift is deliberately absent: Shift+letter is how text is typed, and a global
4
+ // registration consumes the combo system-wide (VTS can allow it because it observes).
5
+ const COMMAND_MODIFIERS = ['Control', 'Alt', 'Super'];
6
+ /** True when the combo carries a command modifier and so may be registered globally. */
7
+ export function hasCommandModifier(accelerator) {
8
+ if (accelerator === null)
9
+ return false;
10
+ return accelerator.split('+').some(t => COMMAND_MODIFIERS.includes(t));
11
+ }
@@ -25,9 +25,11 @@ export interface EventMap {
25
25
  instanceId: string;
26
26
  format: ModelFormat;
27
27
  };
28
+ /** `weights` rides along on instances with `expression-weights`; a drag is not echoed (see `expression.setWeight`). */
28
29
  'expression.changed': {
29
30
  instanceId: string;
30
31
  active: string[];
32
+ weights?: Record<string, number>;
31
33
  };
32
34
  'motion.started': {
33
35
  instanceId: string;
@@ -190,6 +190,17 @@ export interface ExpressionToggleRequest {
190
190
  export interface ExpressionToggleResponse {
191
191
  active: string[];
192
192
  }
193
+ /** Reweight an expression that is already active — a weight on an inactive one would be invisible. */
194
+ export interface ExpressionSetWeightRequest {
195
+ instanceId?: string;
196
+ name: string;
197
+ /** 0..1. */
198
+ weight: number;
199
+ }
200
+ export interface ExpressionSetWeightResponse {
201
+ /** Every active expression's weight, in activation order. */
202
+ weights: Record<string, number>;
203
+ }
193
204
  export interface ExpressionGetPersistenceRequest {
194
205
  modelId?: string;
195
206
  }
@@ -580,6 +591,10 @@ export interface MethodMap {
580
591
  request: ExpressionToggleRequest;
581
592
  response: ExpressionToggleResponse;
582
593
  };
594
+ 'expression.setWeight': {
595
+ request: ExpressionSetWeightRequest;
596
+ response: ExpressionSetWeightResponse;
597
+ };
583
598
  'expression.getPersistence': {
584
599
  request: ExpressionGetPersistenceRequest;
585
600
  response: ExpressionGetPersistenceResponse;
@@ -706,8 +706,16 @@ export type AppCapability = (typeof APP_CAPABILITIES)[number];
706
706
  export declare function isAppCapability(v: unknown): v is AppCapability;
707
707
  /** What a loaded model instance can do; absent capabilities answer `unsupported-for-format`. */
708
708
  export type InstanceCapability = 'motions' | 'expressions' | 'placement-2d' | 'placement-3d' | 'mtoon' | 'idle-clips' | 'pose' | 'live2d-params'
709
+ /** `expression.setWeight`; Cubism expressions carry no user-settable weight, so Live2D lacks it. */
710
+ | 'expression-weights'
709
711
  /** `speech.play` lip-sync; engine-dependent, so gate on the runtime, not the format. */
710
- | 'speech';
712
+ | 'speech'
713
+ /**
714
+ * Draws through the 3D post chain, so the scene's look rows (tone mapping, exposure, LUT)
715
+ * reach it. Always on VRM; on Live2D only under the `three` renderer, so read it off the
716
+ * runtime rather than the format.
717
+ */
718
+ | 'post-fx';
711
719
  export interface InstanceRuntime {
712
720
  instanceId: string;
713
721
  kind: 'model' | 'object';
@@ -724,6 +732,14 @@ export interface Expression {
724
732
  name: string;
725
733
  file: string | null;
726
734
  active: boolean;
735
+ /**
736
+ * A wardrobe piece (`LAPLACE_outfit`), not a face. Group these apart: "Jacket Off"
737
+ * listed between `blinkLeft` and `happy` reads as an expression when it is not one.
738
+ * Absent on formats with no wardrobe.
739
+ */
740
+ outfit?: boolean;
741
+ /** Blend weight (0..1) while active; absent unless the instance has `expression-weights`. */
742
+ weight?: number;
727
743
  }
728
744
  export interface PlayingMotion {
729
745
  group: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laplace.live/persona-sdk",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "TypeScript SDK and wire schema for the LAPLACE Persona plugin API",
5
5
  "license": "MIT",
6
6
  "type": "module",