@laplace.live/persona-sdk 1.2.0 → 1.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.
@@ -6,6 +6,8 @@ export declare const EFFECT_SCOPES: {
6
6
  readonly colorWheels: readonly ["scene", "layer"];
7
7
  readonly colorShift: readonly ["scene", "layer"];
8
8
  readonly selectColors: readonly ["scene", "layer"];
9
+ readonly gradient: readonly ["scene", "layer"];
10
+ readonly flare: readonly ["scene"];
9
11
  readonly blur: readonly ["scene", "layer"];
10
12
  readonly bloom: readonly ["scene", "layer"];
11
13
  readonly diffusion: readonly ["scene", "layer"];
@@ -66,6 +68,8 @@ export declare const EFFECT_SPECS: Record<EffectKey, Readonly<Record<string, Eff
66
68
  export declare const EFFECT_COLOR_SPECS: Partial<Record<EffectKey, Readonly<Record<string, EffectColorSpec>>>>;
67
69
  /** Boolean defaults, validated alongside numeric and color parameters. */
68
70
  export declare const EFFECT_BOOLEAN_SPECS: Partial<Record<EffectKey, Readonly<Record<string, EffectBooleanSpec>>>>;
71
+ /** Blend-mode order shared by effect editors and shader uniforms. */
72
+ export declare const EFFECT_BLEND_MODES: readonly ["normal", "darken", "multiply", "colorBurn", "linearBurn", "add", "lighten", "screen", "colorDodge", "overlay", "softLight", "hardLight", "vividLight", "linearLight", "pinLight", "hardMix", "difference", "exclusion", "subtract", "divide", "hue", "saturation", "color", "luminosity"];
69
73
  /** Enum defaults and allowed values. */
70
74
  export declare const EFFECT_ENUM_SPECS: Partial<Record<EffectKey, Readonly<Record<string, EffectEnumSpec>>>>;
71
75
  /** Select the layer effects from any value set containing them. */
@@ -8,6 +8,8 @@ export const EFFECT_SCOPES = {
8
8
  colorWheels: ['scene', 'layer'],
9
9
  colorShift: ['scene', 'layer'],
10
10
  selectColors: ['scene', 'layer'],
11
+ gradient: ['scene', 'layer'],
12
+ flare: ['scene'],
11
13
  blur: ['scene', 'layer'],
12
14
  bloom: ['scene', 'layer'],
13
15
  diffusion: ['scene', 'layer'],
@@ -122,6 +124,25 @@ export const EFFECT_SPECS = {
122
124
  saturation: { default: -1, min: -1, max: 1, step: 0.01 },
123
125
  blend: { default: 1, min: 0, max: 1, step: 0.01 },
124
126
  },
127
+ gradient: {
128
+ radius: { default: 1, min: 0, max: 3, step: 0.01 },
129
+ smoothness: { default: 1, min: 0, max: 5, step: 0.01 },
130
+ centerX: { default: 0, min: -1, max: 1, step: 0.01 },
131
+ centerY: { default: 0, min: -1, max: 1, step: 0.01 },
132
+ angle: { default: 0, min: -180, max: 180, step: 1, unit: '°' },
133
+ scaleX: { default: 1, min: 0, max: 2, step: 0.01 },
134
+ scaleY: { default: 0.5, min: 0, max: 2, step: 0.01 },
135
+ opacity: { default: 1, min: 0, max: 1, step: 0.01 },
136
+ },
137
+ flare: {
138
+ intensity: { default: 0, min: 0, max: 1, step: 0.01 },
139
+ size: { default: 0, min: 0, max: 2, step: 0.01 },
140
+ angle: { default: 0, min: -180, max: 180, step: 1, unit: '°' },
141
+ glowOpacity: { default: 1, min: 0, max: 1, step: 0.01 },
142
+ raysScale: { default: 0, min: 0, max: 1, step: 0.01 },
143
+ raysIntensity: { default: 0, min: 0, max: 1, step: 0.01 },
144
+ raysOpacity: { default: 1, min: 0, max: 1, step: 0.01 },
145
+ },
125
146
  blur: {
126
147
  radius: { default: 8, min: 0, max: 64, step: 0.5, unit: 'px' },
127
148
  },
@@ -240,6 +261,14 @@ export const EFFECT_SPECS = {
240
261
  * string param appear.
241
262
  */
242
263
  export const EFFECT_COLOR_SPECS = {
264
+ gradient: {
265
+ color: { default: '#ffffff' },
266
+ backgroundColor: { default: '#000000' },
267
+ },
268
+ flare: {
269
+ color: { default: '#ffffff' },
270
+ raysColor: { default: '#ffffff' },
271
+ },
243
272
  colorWheels: {
244
273
  liftColor: { default: '#ffffff' },
245
274
  gammaColor: { default: '#ffffff' },
@@ -280,6 +309,11 @@ export const EFFECT_COLOR_SPECS = {
280
309
  };
281
310
  /** Boolean defaults, validated alongside numeric and color parameters. */
282
311
  export const EFFECT_BOOLEAN_SPECS = {
312
+ flare: { rays: { default: false } },
313
+ gradient: {
314
+ invert: { default: false },
315
+ transparentBackground: { default: false },
316
+ },
283
317
  blur: { highQuality: { default: false } },
284
318
  bloom: {
285
319
  selectColors: { default: false },
@@ -306,40 +340,50 @@ export const EFFECT_BOOLEAN_SPECS = {
306
340
  color10Enabled: { default: false },
307
341
  },
308
342
  };
343
+ /** Blend-mode order shared by effect editors and shader uniforms. */
344
+ export const EFFECT_BLEND_MODES = [
345
+ 'normal',
346
+ 'darken',
347
+ 'multiply',
348
+ 'colorBurn',
349
+ 'linearBurn',
350
+ 'add',
351
+ 'lighten',
352
+ 'screen',
353
+ 'colorDodge',
354
+ 'overlay',
355
+ 'softLight',
356
+ 'hardLight',
357
+ 'vividLight',
358
+ 'linearLight',
359
+ 'pinLight',
360
+ 'hardMix',
361
+ 'difference',
362
+ 'exclusion',
363
+ 'subtract',
364
+ 'divide',
365
+ 'hue',
366
+ 'saturation',
367
+ 'color',
368
+ 'luminosity',
369
+ ];
309
370
  /** Enum defaults and allowed values. */
310
371
  export const EFFECT_ENUM_SPECS = {
372
+ flare: {
373
+ mode: { default: 'add', values: ['add', 'screen', 'colorDodge'] },
374
+ raysMode: { default: 'sun', values: ['sun', 'shine', 'god'] },
375
+ },
376
+ gradient: {
377
+ type: { default: 'circle', values: ['solid', 'linear', 'circle', 'ellipse'] },
378
+ blendMode: { default: 'normal', values: EFFECT_BLEND_MODES },
379
+ },
311
380
  blur: { mode: { default: 'gaussian', values: ['gaussian', 'bokeh'] } },
312
381
  bloom: { mode: { default: 'normal', values: ['normal', 'streak', 'star'] } },
313
382
  rim: {
314
383
  mode: { default: 'single', values: ['single', 'double', 'sharpenSingle', 'sharpenDouble'] },
315
384
  blendMode: {
316
385
  default: 'overlay',
317
- values: [
318
- 'normal',
319
- 'darken',
320
- 'multiply',
321
- 'colorBurn',
322
- 'linearBurn',
323
- 'add',
324
- 'lighten',
325
- 'screen',
326
- 'colorDodge',
327
- 'overlay',
328
- 'softLight',
329
- 'hardLight',
330
- 'vividLight',
331
- 'linearLight',
332
- 'pinLight',
333
- 'hardMix',
334
- 'difference',
335
- 'exclusion',
336
- 'subtract',
337
- 'divide',
338
- 'hue',
339
- 'saturation',
340
- 'color',
341
- 'luminosity',
342
- ],
386
+ values: EFFECT_BLEND_MODES,
343
387
  },
344
388
  },
345
389
  outline: { quality: { default: 'medium', values: ['low', 'medium', 'high'] } },
@@ -396,7 +440,9 @@ export const ALL_EFFECT_STACK_ORDER = [
396
440
  'colorWheels',
397
441
  'colorShift',
398
442
  'selectColors',
443
+ 'gradient',
399
444
  'blur',
445
+ 'flare',
400
446
  'pixelate',
401
447
  'glitch',
402
448
  'droplets',
@@ -1,3 +1,4 @@
1
+ import type { Hotkey } from '../wire/types.ts';
1
2
  /** True when the combo carries a command modifier and so may be registered globally. */
2
3
  export declare function hasCommandModifier(accelerator: string | null): boolean;
3
4
  /**
@@ -6,3 +7,9 @@ export declare function hasCommandModifier(accelerator: string | null): boolean;
6
7
  * every writer canonicalizes; it does not validate one.
7
8
  */
8
9
  export declare function canRunInBackground(accelerator: string | null): boolean;
10
+ /** True when a model hotkey is meant to fire while Persona sits in the background — what main registers on, and what the globe shows. */
11
+ export declare function hotkeyRunsInBackground(h: Hotkey): boolean;
12
+ /** Accelerators bound by more than one entry — the warning every shortcut list raises. */
13
+ export declare function duplicateAccelerators(bindings: readonly {
14
+ accelerator: string | null;
15
+ }[]): Set<string>;
@@ -20,3 +20,20 @@ export function canRunInBackground(accelerator) {
20
20
  return false;
21
21
  return hasCommandModifier(accelerator) || accelerator.split('+').every(isControllerTriggerName);
22
22
  }
23
+ /** True when a model hotkey is meant to fire while Persona sits in the background — what main registers on, and what the globe shows. */
24
+ export function hotkeyRunsInBackground(h) {
25
+ return h.global && h.active && h.action !== null && canRunInBackground(h.accelerator);
26
+ }
27
+ /** Accelerators bound by more than one entry — the warning every shortcut list raises. */
28
+ export function duplicateAccelerators(bindings) {
29
+ const seen = new Set();
30
+ const dupes = new Set();
31
+ for (const b of bindings) {
32
+ if (b.accelerator === null)
33
+ continue;
34
+ if (seen.has(b.accelerator))
35
+ dupes.add(b.accelerator);
36
+ seen.add(b.accelerator);
37
+ }
38
+ return dupes;
39
+ }
@@ -607,8 +607,50 @@ export interface SceneDroplets {
607
607
  /** Specular glint on drops where the frame is transparent, so rain reads over the desktop (0 to 1). */
608
608
  glints: number;
609
609
  }
610
- /** Blend modes shared with Shoost's rim light. */
610
+ /** Blend modes shared by Shoost's rim light and gradient. */
611
611
  export type EffectBlendMode = 'normal' | 'darken' | 'multiply' | 'colorBurn' | 'linearBurn' | 'add' | 'lighten' | 'screen' | 'colorDodge' | 'overlay' | 'softLight' | 'hardLight' | 'vividLight' | 'linearLight' | 'pinLight' | 'hardMix' | 'difference' | 'exclusion' | 'subtract' | 'divide' | 'hue' | 'saturation' | 'color' | 'luminosity';
612
+ /** Solid, linear, or radial color overlay in scene or source coordinates. */
613
+ export interface EffectGradient {
614
+ enabled: boolean;
615
+ type: 'solid' | 'linear' | 'circle' | 'ellipse';
616
+ blendMode: EffectBlendMode;
617
+ /** Foreground color (hex). */
618
+ color: string;
619
+ /** Outer or background color (hex). */
620
+ backgroundColor: string;
621
+ invert: boolean;
622
+ transparentBackground: boolean;
623
+ radius: number;
624
+ smoothness: number;
625
+ /** Horizontal center offset in normalized coordinates, -1..1. */
626
+ centerX: number;
627
+ /** Vertical center offset in normalized coordinates, -1..1. */
628
+ centerY: number;
629
+ /** Gradient rotation in degrees, -180..180. */
630
+ angle: number;
631
+ scaleX: number;
632
+ scaleY: number;
633
+ opacity: number;
634
+ }
635
+ /** Directional screen-space light with an independent monitor glow. */
636
+ export interface SceneFlare {
637
+ enabled: boolean;
638
+ mode: 'add' | 'screen' | 'colorDodge';
639
+ /** Light color (hex). */
640
+ color: string;
641
+ intensity: number;
642
+ size: number;
643
+ /** Light direction in degrees, -180..180. */
644
+ angle: number;
645
+ glowOpacity: number;
646
+ rays: boolean;
647
+ raysMode: 'sun' | 'shine' | 'god';
648
+ /** Particle-ray color (hex). */
649
+ raysColor: string;
650
+ raysScale: number;
651
+ raysIntensity: number;
652
+ raysOpacity: number;
653
+ }
612
654
  /** Directional silhouette lighting, optionally sharpened or applied to both sides. */
613
655
  export interface SceneRim {
614
656
  enabled: boolean;
@@ -698,6 +740,8 @@ export interface EffectValues {
698
740
  colorWheels: EffectColorWheels;
699
741
  colorShift: EffectColorShift;
700
742
  selectColors: EffectSelectColors;
743
+ gradient: EffectGradient;
744
+ flare: SceneFlare;
701
745
  blur: EffectBlur;
702
746
  chromaticAberration: SceneChromaticAberration;
703
747
  grain: SceneFilmGrain;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laplace.live/persona-sdk",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "TypeScript SDK and wire schema for the LAPLACE Persona plugin API",
5
5
  "license": "MIT",
6
6
  "type": "module",