@pixerate/flair 0.1.1 → 0.3.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/CHANGELOG.md +21 -0
- package/README.md +65 -14
- package/dist/catalog/index.d.ts +5 -4
- package/dist/catalog/index.js +12 -4
- package/dist/{chunk-JWZCPMFG.js → chunk-D7NLHC7K.js} +117 -674
- package/dist/chunk-D7NLHC7K.js.map +1 -0
- package/dist/{chunk-3FAUZOGL.js → chunk-FIJOMGPG.js} +2 -2
- package/dist/{chunk-UQQNZSYL.js → chunk-GTIAOYOK.js} +211 -7
- package/dist/chunk-GTIAOYOK.js.map +1 -0
- package/dist/{chunk-MWVTQFV5.js → chunk-IWKM5FJK.js} +410 -59
- package/dist/chunk-IWKM5FJK.js.map +1 -0
- package/dist/{chunk-HKXOHRCD.js → chunk-VA74HBPK.js} +2 -2
- package/dist/chunk-WAMA45G3.js +998 -0
- package/dist/chunk-WAMA45G3.js.map +1 -0
- package/dist/{chunk-J55UBNAT.js → chunk-WC3VADZC.js} +42 -36
- package/dist/chunk-WC3VADZC.js.map +1 -0
- package/dist/cli.js +12 -11
- package/dist/cli.js.map +1 -1
- package/dist/{controls-DdXMbovi.d.ts → controls-Syr6drzO.d.ts} +4 -3
- package/dist/editor/index.d.ts +101 -49
- package/dist/editor/index.js +198 -99
- package/dist/editor/index.js.map +1 -1
- package/dist/{export-FEBPEEO7.js → export-DH2HMACO.js} +4 -3
- package/dist/index.d.ts +193 -17
- package/dist/index.js +69 -33
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +2 -2
- package/dist/recorder-KEX3U35D.js +10 -0
- package/dist/{renderer-Oyynz-fs.d.ts → renderer-mzvhKzKa.d.ts} +1 -1
- package/dist/types-CsFUZZIv.d.ts +102 -0
- package/package.json +3 -3
- package/dist/chunk-36DTNSHU.js +0 -160
- package/dist/chunk-36DTNSHU.js.map +0 -1
- package/dist/chunk-J55UBNAT.js.map +0 -1
- package/dist/chunk-JWZCPMFG.js.map +0 -1
- package/dist/chunk-MWVTQFV5.js.map +0 -1
- package/dist/chunk-UQQNZSYL.js.map +0 -1
- package/dist/recorder-WJTWMEQN.js +0 -10
- package/dist/types-CkKkavvB.d.ts +0 -71
- /package/dist/{chunk-3FAUZOGL.js.map → chunk-FIJOMGPG.js.map} +0 -0
- /package/dist/{chunk-HKXOHRCD.js.map → chunk-VA74HBPK.js.map} +0 -0
- /package/dist/{export-FEBPEEO7.js.map → export-DH2HMACO.js.map} +0 -0
- /package/dist/{recorder-WJTWMEQN.js.map → recorder-KEX3U35D.js.map} +0 -0
package/dist/editor/index.d.ts
CHANGED
|
@@ -1,60 +1,47 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as ControlValue, a as ControlDef, b as ControlType } from '../controls-
|
|
1
|
+
import { d as VectorControl, c as EffectPreset, E as EffectDefinition } from '../types-CsFUZZIv.js';
|
|
2
|
+
import { C as ControlValue, a as ControlDef, b as ControlType } from '../controls-Syr6drzO.js';
|
|
3
3
|
import { S as SvgMotion } from '../motion-D0TVv2CF.js';
|
|
4
|
+
import { AnimationEasingPreset, AnimationEasing, AnimationTrack, AnimationKeyframe, cubicBezierAt as cubicBezierAt$1, evaluateEasing as evaluateEasing$1 } from '@pixerate/editor/animation';
|
|
5
|
+
export { CubicBezierEasing, SpringEasing } from '@pixerate/editor/animation';
|
|
4
6
|
import { CommandRegistry, CommandSpec } from '@pixerate/editor/commands';
|
|
5
7
|
import { HistoryManager, HistoryState } from '@pixerate/editor/history';
|
|
6
|
-
import { C as CompileError, a as CompileStatus } from '../renderer-
|
|
8
|
+
import { C as CompileError, a as CompileStatus } from '../renderer-mzvhKzKa.js';
|
|
7
9
|
import { C as Clock } from '../clock-BhdXWH-n.js';
|
|
8
|
-
import { AgentToolProvider, McpToolResult, McpToolDefinition } from '@pixerate/editor/
|
|
10
|
+
import { AgentToolProvider, McpToolResult, ToolRegistryOptions, ToolRegistry, McpToolDefinition } from '@pixerate/editor/tools';
|
|
11
|
+
import { ParameterImageOption, ParametersController, ParameterField, ParameterSchema, ParameterValue, ParameterValues } from '@pixerate/editor/parameters';
|
|
9
12
|
|
|
10
13
|
/**
|
|
11
14
|
* Keyframed control values. A track holds keyframes `{ time (ms), value,
|
|
12
15
|
* easing }` for one control; the easing governs the segment leaving its
|
|
13
|
-
* keyframe.
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
+
* keyframe. Easing comes from `@pixerate/editor/animation`, and tracks keep
|
|
17
|
+
* its `AnimationTrack` shape; Flair adds what control values need beyond
|
|
18
|
+
* numbers and colours (vectors, booleans, images, ints).
|
|
16
19
|
*/
|
|
17
20
|
|
|
18
21
|
/** Named easings (CSS keywords plus back and spring curves). */
|
|
19
|
-
type EasingPreset =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
x1: number;
|
|
23
|
-
y1: number;
|
|
24
|
-
x2: number;
|
|
25
|
-
y2: number;
|
|
26
|
-
}
|
|
27
|
-
interface SpringEasing {
|
|
28
|
-
type: "spring";
|
|
29
|
-
/** Default 170. */
|
|
30
|
-
stiffness?: number;
|
|
31
|
-
/** Default 26. */
|
|
32
|
-
damping?: number;
|
|
33
|
-
/** Default 1. */
|
|
34
|
-
mass?: number;
|
|
35
|
-
}
|
|
36
|
-
type Easing = EasingPreset | CubicBezierEasing | SpringEasing;
|
|
22
|
+
type EasingPreset = AnimationEasingPreset;
|
|
23
|
+
type Easing = AnimationEasing;
|
|
24
|
+
|
|
37
25
|
/** Every easing preset, in picker order. */
|
|
38
26
|
declare const EASING_PRESETS: readonly EasingPreset[];
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
27
|
+
/** Eased progress at `u` (0–1) through a segment `durationMs` long (`@pixerate/editor`'s easing engine). */
|
|
28
|
+
declare const evaluateEasing: typeof evaluateEasing$1;
|
|
29
|
+
/** CSS `cubic-bezier(x1, y1, x2, y2)` solved for y at progress x. */
|
|
30
|
+
declare const cubicBezierAt: typeof cubicBezierAt$1;
|
|
31
|
+
/**
|
|
32
|
+
* Whether `value` is an easing (a preset name, a cubic bezier or a spring),
|
|
33
|
+
* with a spring's stiffness, damping and mass above 0 when given.
|
|
34
|
+
*/
|
|
35
|
+
declare function isEasing(value: unknown): value is Easing;
|
|
36
|
+
/** A keyframe of a control: like `AnimationKeyframe`, with any control value (vectors and booleans too). */
|
|
37
|
+
interface Keyframe extends Omit<AnimationKeyframe, "value"> {
|
|
42
38
|
value: ControlValue;
|
|
43
|
-
/** Easing of the segment from this keyframe to the next (default `linear`). */
|
|
44
|
-
easing?: Easing;
|
|
45
39
|
}
|
|
46
|
-
|
|
40
|
+
/** A control's keyframes: `AnimationTrack`'s shape, with control values. */
|
|
41
|
+
interface Track extends Omit<AnimationTrack, "keyframes"> {
|
|
47
42
|
/** Sorted by time, at most one per time. */
|
|
48
43
|
keyframes: Keyframe[];
|
|
49
|
-
/** Disabled tracks keep their keyframes but do not animate (default `true`). */
|
|
50
|
-
enabled?: boolean;
|
|
51
44
|
}
|
|
52
|
-
/** Whether `value` is an easing this module understands. */
|
|
53
|
-
declare function isEasing(value: unknown): value is Easing;
|
|
54
|
-
/** CSS `cubic-bezier(x1, y1, x2, y2)` solved for y at progress x. */
|
|
55
|
-
declare function cubicBezierAt(x1: number, y1: number, x2: number, y2: number, x: number): number;
|
|
56
|
-
/** Eased progress at `u` (0–1) through a segment `durationMs` long. */
|
|
57
|
-
declare function evaluateEasing(easing: Easing | undefined, u: number, durationMs?: number): number;
|
|
58
45
|
/**
|
|
59
46
|
* A control value `t` of the way from `a` to `b`: numbers and vectors blend
|
|
60
47
|
* (overshooting with back and spring easings), colours blend in Oklab, `int`s
|
|
@@ -75,14 +62,18 @@ declare function keyframeTimes(tracks: Record<string, Track>): number[];
|
|
|
75
62
|
* diffed, and written by an agent.
|
|
76
63
|
*/
|
|
77
64
|
|
|
78
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* What is being edited: a fragment shader, or an animated SVG. Both declare
|
|
67
|
+
* their controls in themselves (`// @control`, `{{name: type …}}`); a vector
|
|
68
|
+
* effect's optional `controls` list is for pictures written before that.
|
|
69
|
+
*/
|
|
79
70
|
type EffectSource = {
|
|
80
71
|
kind: "shader";
|
|
81
72
|
source: string;
|
|
82
73
|
} | {
|
|
83
74
|
kind: "vector";
|
|
84
75
|
motion: SvgMotion;
|
|
85
|
-
controls
|
|
76
|
+
controls?: VectorControl[];
|
|
86
77
|
hold?: number;
|
|
87
78
|
};
|
|
88
79
|
interface EffectDocument {
|
|
@@ -221,7 +212,7 @@ declare class EffectEditor {
|
|
|
221
212
|
rename(name: string): EditResult;
|
|
222
213
|
/** Replaces a shader's source. Compile errors arrive later, from the renderer (see `reportCompile`). */
|
|
223
214
|
setSource(source: string): EditResult;
|
|
224
|
-
/** Replaces a vector effect's picture (and optionally
|
|
215
|
+
/** Replaces a vector effect's picture, whose `{{name: type …}}` placeholders declare its controls (and optionally a `controls` list). */
|
|
225
216
|
setMotion(motion: SvgMotion, controls?: Extract<EffectDocument["effect"], {
|
|
226
217
|
kind: "vector";
|
|
227
218
|
}>["controls"]): EditResult;
|
|
@@ -237,7 +228,7 @@ declare class EffectEditor {
|
|
|
237
228
|
setValues(values: Record<string, unknown>): EditResult;
|
|
238
229
|
/** Back to defaults: the named controls, or all of them (values only; tracks stay). */
|
|
239
230
|
resetValues(names?: readonly string[]): EditResult;
|
|
240
|
-
/** Random values in each control's range (colours anywhere), for exploring. */
|
|
231
|
+
/** Random values in each control's range (colours anywhere), for exploring. Images and text keep theirs. */
|
|
241
232
|
randomize(names?: readonly string[], random?: () => number): EditResult;
|
|
242
233
|
applyPreset(name: string): EditResult;
|
|
243
234
|
/** Saves the current values (all, or the named ones) as a preset, replacing one of the same name. */
|
|
@@ -249,6 +240,19 @@ declare class EffectEditor {
|
|
|
249
240
|
setKeyframeEasing(name: string, time: number, easing: Easing): EditResult;
|
|
250
241
|
/** Removes a control's track; it keeps the value it had at the playhead. */
|
|
251
242
|
clearTrack(name: string): EditResult;
|
|
243
|
+
/**
|
|
244
|
+
* Replaces a control's whole track (or removes it with `undefined`), one
|
|
245
|
+
* undo step. Every keyframe is checked like `setKeyframe`; values may be
|
|
246
|
+
* any form the control accepts (colours as "#RRGGBB" too).
|
|
247
|
+
*/
|
|
248
|
+
setTrack(name: string, track: {
|
|
249
|
+
keyframes: readonly {
|
|
250
|
+
time: number;
|
|
251
|
+
value: unknown;
|
|
252
|
+
easing?: unknown;
|
|
253
|
+
}[];
|
|
254
|
+
enabled?: boolean;
|
|
255
|
+
} | undefined): EditResult;
|
|
252
256
|
setTiming(timing: {
|
|
253
257
|
duration?: number;
|
|
254
258
|
loop?: boolean;
|
|
@@ -333,8 +337,8 @@ declare function describeEditor(editor: EffectEditor): {
|
|
|
333
337
|
canUndo: boolean;
|
|
334
338
|
canRedo: boolean;
|
|
335
339
|
};
|
|
340
|
+
vectorControls?: VectorControl[] | undefined;
|
|
336
341
|
motion: SvgMotion;
|
|
337
|
-
vectorControls: VectorControl[];
|
|
338
342
|
name: string;
|
|
339
343
|
basedOn: string | undefined;
|
|
340
344
|
kind: "shader" | "vector";
|
|
@@ -345,7 +349,8 @@ declare function effectCommands(): CommandSpec<EffectEditor>[];
|
|
|
345
349
|
/**
|
|
346
350
|
* Agents edit effects through the editor's commands. Flair ships the tools
|
|
347
351
|
* and the instructions; the model, its credentials and the agent loop are
|
|
348
|
-
* the host's
|
|
352
|
+
* the host's. Serve the tools with `@pixerate/editor/tools`' `ToolRegistry`
|
|
353
|
+
* (MCP `tools/list` and `tools/call`), or call them directly with `callTool`.
|
|
349
354
|
*/
|
|
350
355
|
|
|
351
356
|
interface EffectToolProviderOptions {
|
|
@@ -372,12 +377,21 @@ interface EffectToolProviderOptions {
|
|
|
372
377
|
* - `view_effect`, when `capture` is given: an image of the preview.
|
|
373
378
|
*/
|
|
374
379
|
declare function createEffectToolProvider(editor: EffectEditor, options?: EffectToolProviderOptions): AgentToolProvider;
|
|
380
|
+
/**
|
|
381
|
+
* A `ToolRegistry` (from `@pixerate/editor/tools`) serving the effect editor's
|
|
382
|
+
* tools: `listTools()` and `callTool(name, args)` are MCP's `tools/list` and
|
|
383
|
+
* `tools/call`, with arguments checked against each tool's schema. Register
|
|
384
|
+
* more providers on it to give the agent other tools too.
|
|
385
|
+
*/
|
|
386
|
+
declare function createEffectToolRegistry(editor: EffectEditor, options?: EffectToolProviderOptions & {
|
|
387
|
+
registry?: ToolRegistryOptions;
|
|
388
|
+
}): ToolRegistry;
|
|
375
389
|
/** A provider's tool definitions without their handlers, to send to a model. */
|
|
376
390
|
declare function toolDefinitions(provider: AgentToolProvider): McpToolDefinition[];
|
|
377
391
|
/**
|
|
378
|
-
* Runs one of a provider's tools by name
|
|
379
|
-
*
|
|
380
|
-
*
|
|
392
|
+
* Runs one of a provider's tools by name without a registry: the handler's
|
|
393
|
+
* result comes back as an MCP `tools/call` result, and a thrown error as an
|
|
394
|
+
* `isError` result. (A `ToolRegistry` also checks the arguments first.)
|
|
381
395
|
*/
|
|
382
396
|
declare function callTool(provider: AgentToolProvider, name: string, args?: Record<string, unknown>): Promise<McpToolResult>;
|
|
383
397
|
/** A system prompt for agents that author effects with these tools. Add your product's own guidance to it. */
|
|
@@ -410,4 +424,42 @@ declare function bindShaderRenderer(editor: EffectEditor, renderer: ShaderPrevie
|
|
|
410
424
|
*/
|
|
411
425
|
declare function bindSvgView(editor: EffectEditor, container: HTMLElement): () => void;
|
|
412
426
|
|
|
413
|
-
|
|
427
|
+
/**
|
|
428
|
+
* An effect's controls as a `@pixerate/editor/parameters` schema, and a
|
|
429
|
+
* parameters controller kept in step with an `EffectEditor`. With them, any
|
|
430
|
+
* parameters UI (the ready-made React and Svelte panels, or your own) edits
|
|
431
|
+
* an effect: values, image picks and keyframe diamonds go through the effect
|
|
432
|
+
* editor, so its undo history and agent tools see every change.
|
|
433
|
+
*/
|
|
434
|
+
|
|
435
|
+
interface EffectParameterOptions {
|
|
436
|
+
/** Pictures image controls offer to pick from (any URL still works). */
|
|
437
|
+
images?: readonly ParameterImageOption[];
|
|
438
|
+
/** Schema title (default: none). */
|
|
439
|
+
title?: string;
|
|
440
|
+
}
|
|
441
|
+
/** One control as a parameter field. */
|
|
442
|
+
declare function parameterFieldFor(control: ControlDef, options?: EffectParameterOptions): ParameterField;
|
|
443
|
+
/** An effect's controls as a parameters schema. */
|
|
444
|
+
declare function parameterSchemaFor(controls: readonly ControlDef[], options?: EffectParameterOptions): ParameterSchema;
|
|
445
|
+
/** A control value as a parameter value: colours become `#rrggbb` (`#rrggbbaa` for `vec4`). */
|
|
446
|
+
declare function toParameterValue(control: ControlDef, value: ControlValue): ParameterValue;
|
|
447
|
+
/** Control values as parameter values (see {@link toParameterValue}). */
|
|
448
|
+
declare function toParameterValues(controls: readonly ControlDef[], values: Record<string, ControlValue>): ParameterValues;
|
|
449
|
+
interface EffectParametersBinding {
|
|
450
|
+
/** Drive a parameters UI with it (e.g. `<ParametersPanel controller={…} />`). */
|
|
451
|
+
readonly controller: ParametersController;
|
|
452
|
+
/** Stops following the editor. */
|
|
453
|
+
dispose(): void;
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* A `ParametersController` for the effect in `editor`, kept in step with it:
|
|
457
|
+
* the schema follows the effect's controls (a recompiled shader updates it),
|
|
458
|
+
* values and the playhead follow the editor, and changes made through the
|
|
459
|
+
* controller (fields, keyframe diamonds, reset, randomize) are applied to the
|
|
460
|
+
* editor, which records the undo steps. Use the editor's undo, not the
|
|
461
|
+
* controller's, and its presets (the controller's own presets are not saved).
|
|
462
|
+
*/
|
|
463
|
+
declare function bindEffectParameters(editor: EffectEditor, options?: EffectParameterOptions): EffectParametersBinding;
|
|
464
|
+
|
|
465
|
+
export { type CompileReport, EASING_PRESETS, EFFECT_AGENT_INSTRUCTIONS, type Easing, type EasingPreset, type EditResult, type EffectDocument, EffectEditor, type EffectEditorOptions, type EffectEditorState, type EffectParameterOptions, type EffectParametersBinding, type EffectSource, type EffectToolProviderOptions, type Keyframe, type ShaderPreview, type Track, bindEffectParameters, bindShaderRenderer, bindSvgView, callTool, createEffectDocument, createEffectEditor, createEffectToolProvider, createEffectToolRegistry, cubicBezierAt, describeEditor, documentControls, documentIssues, effectCommands, evaluateEasing, evaluateTrack, interpolateControlValue, isEasing, keyframeTimes, motionAt, normalizeKeyframes, parameterFieldFor, parameterSchemaFor, parseEffectDocument, toParameterValue, toParameterValues, toolDefinitions, valuesAt };
|