@clypra-studio/engine 1.0.5 → 1.0.6
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/TransitionDefinition-CQoSb4ZB.d.cts +158 -0
- package/dist/TransitionDefinition-CQoSb4ZB.d.ts +158 -0
- package/dist/index-Da47I6aX.d.cts +139 -0
- package/dist/index-Da47I6aX.d.ts +139 -0
- package/dist/index-lNWEWqab.d.cts +633 -0
- package/dist/index-lNWEWqab.d.ts +633 -0
- package/dist/index.d.cts +8884 -0
- package/dist/index.d.ts +8884 -0
- package/dist/textEffects/index.d.cts +1 -0
- package/dist/textEffects/index.d.ts +1 -0
- package/dist/transitions/index.d.cts +219 -0
- package/dist/transitions/index.d.ts +219 -0
- package/dist/v2/backends/index.d.cts +3 -0
- package/dist/v2/backends/index.d.ts +3 -0
- package/dist/v2/contract/index.d.cts +165 -0
- package/dist/v2/contract/index.d.ts +165 -0
- package/dist/videoEffects/index.d.cts +697 -0
- package/dist/videoEffects/index.d.ts +697 -0
- package/package.json +1 -1
|
@@ -0,0 +1,633 @@
|
|
|
1
|
+
declare const SCENE_VERSION: 1;
|
|
2
|
+
/** Default canvas width in pixels. */
|
|
3
|
+
declare const DEFAULT_CANVAS_WIDTH: 800;
|
|
4
|
+
/** Default canvas height in pixels. */
|
|
5
|
+
declare const DEFAULT_CANVAS_HEIGHT: 200;
|
|
6
|
+
/** Default font size in pixels. */
|
|
7
|
+
declare const DEFAULT_FONT_SIZE: 80;
|
|
8
|
+
/** Default frames per second for new timelines. */
|
|
9
|
+
declare const DEFAULT_FPS: 30;
|
|
10
|
+
/** Default timeline duration in seconds for new scenes. */
|
|
11
|
+
declare const DEFAULT_DURATION: 2;
|
|
12
|
+
type EffectLayerType = "panel" | "glow" | "shadow" | "extrusion" | "duplicateStack" | "stroke" | "fill" | "mask" | "filter" | "customEngine";
|
|
13
|
+
type LayerTarget = "text" | "panel" | "scene" | "previous";
|
|
14
|
+
type CustomEngineId = "ink";
|
|
15
|
+
declare const CUSTOM_ENGINE_IDS: CustomEngineId[];
|
|
16
|
+
declare const LEGACY_RENDERER_MAP: Record<string, CustomEngineId>;
|
|
17
|
+
declare const ENGINE_ID_TO_LEGACY: Record<CustomEngineId, string>;
|
|
18
|
+
interface SceneCanvas {
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
background: string;
|
|
22
|
+
}
|
|
23
|
+
interface SceneText {
|
|
24
|
+
content: string;
|
|
25
|
+
fontFamily: string;
|
|
26
|
+
fontWeight: number;
|
|
27
|
+
fontStyle: "normal" | "italic";
|
|
28
|
+
fontSize: number;
|
|
29
|
+
letterSpacing: number;
|
|
30
|
+
lineHeight: number;
|
|
31
|
+
textPosX: "left" | "center" | "right";
|
|
32
|
+
textPosY: "top" | "middle" | "bottom";
|
|
33
|
+
wrapText?: boolean;
|
|
34
|
+
autoFitText?: boolean;
|
|
35
|
+
perCharFillEnabled?: boolean;
|
|
36
|
+
charFillColors?: string[];
|
|
37
|
+
}
|
|
38
|
+
interface EffectLayer {
|
|
39
|
+
id: string;
|
|
40
|
+
type: EffectLayerType;
|
|
41
|
+
name: string;
|
|
42
|
+
enabled: boolean;
|
|
43
|
+
opacity: number;
|
|
44
|
+
blendMode: GlobalCompositeOperation;
|
|
45
|
+
target: LayerTarget;
|
|
46
|
+
params: Record<string, unknown>;
|
|
47
|
+
}
|
|
48
|
+
interface CompositorSettings {
|
|
49
|
+
blur: number;
|
|
50
|
+
bloom: number;
|
|
51
|
+
bloomThreshold?: number;
|
|
52
|
+
}
|
|
53
|
+
interface Keyframe {
|
|
54
|
+
time: number;
|
|
55
|
+
value: number;
|
|
56
|
+
easing?: "linear" | "easeIn" | "easeOut" | "easeInOut";
|
|
57
|
+
}
|
|
58
|
+
interface AnimTrack {
|
|
59
|
+
layerId: string;
|
|
60
|
+
paramPath: string;
|
|
61
|
+
keyframes: Keyframe[];
|
|
62
|
+
}
|
|
63
|
+
interface Timeline {
|
|
64
|
+
duration: number;
|
|
65
|
+
fps: number;
|
|
66
|
+
loop: boolean;
|
|
67
|
+
tracks: AnimTrack[];
|
|
68
|
+
}
|
|
69
|
+
interface SceneDocument {
|
|
70
|
+
version: typeof SCENE_VERSION;
|
|
71
|
+
effectName: string;
|
|
72
|
+
canvas: SceneCanvas;
|
|
73
|
+
text: SceneText;
|
|
74
|
+
effectLayers: EffectLayer[];
|
|
75
|
+
customEngineId: CustomEngineId | null;
|
|
76
|
+
engineParams?: Record<string, unknown>;
|
|
77
|
+
compositor: CompositorSettings;
|
|
78
|
+
timeline: Timeline;
|
|
79
|
+
/** Legacy flat config cache for gradual UI migration */
|
|
80
|
+
legacyConfig?: TextEffectConfig;
|
|
81
|
+
/** Deep Research extension snippet (not executed until sandboxed) */
|
|
82
|
+
extensionCode?: string | null;
|
|
83
|
+
}
|
|
84
|
+
interface StyleRecipe {
|
|
85
|
+
id: string;
|
|
86
|
+
name: string;
|
|
87
|
+
category?: string;
|
|
88
|
+
layers: EffectLayer[];
|
|
89
|
+
exposed: string[];
|
|
90
|
+
tags: string[];
|
|
91
|
+
customEngineId?: CustomEngineId | null;
|
|
92
|
+
scene?: SceneDocument;
|
|
93
|
+
}
|
|
94
|
+
declare function createEmptyScene(overrides?: Partial<SceneDocument>): SceneDocument;
|
|
95
|
+
declare function newLayerId(): string;
|
|
96
|
+
|
|
97
|
+
interface GradientStop {
|
|
98
|
+
color: string;
|
|
99
|
+
offset: number;
|
|
100
|
+
}
|
|
101
|
+
interface GlowLayer {
|
|
102
|
+
enabled: boolean;
|
|
103
|
+
color: string;
|
|
104
|
+
blur: number;
|
|
105
|
+
opacity: number;
|
|
106
|
+
type: "outer" | "inner";
|
|
107
|
+
strength?: number;
|
|
108
|
+
spread?: number;
|
|
109
|
+
}
|
|
110
|
+
interface TextEffectConfig {
|
|
111
|
+
text: string;
|
|
112
|
+
effectName: string;
|
|
113
|
+
fontFamily: string;
|
|
114
|
+
fontWeight: number;
|
|
115
|
+
fontStyle: "normal" | "italic";
|
|
116
|
+
fontSize: number;
|
|
117
|
+
letterSpacing: number;
|
|
118
|
+
lineHeight: number;
|
|
119
|
+
fillType: "solid" | "linear" | "radial" | "pattern" | "none";
|
|
120
|
+
fillColor: string;
|
|
121
|
+
fillGradientAngle: number;
|
|
122
|
+
fillGradientStops: GradientStop[];
|
|
123
|
+
patternType?: "chalk" | "noise" | "grunge" | "carbon" | "stripes" | "film" | "brushed" | "marble" | "halftone" | "paper";
|
|
124
|
+
/** Pro: independent solid fill color per visible character (reading order) */
|
|
125
|
+
perCharFillEnabled?: boolean;
|
|
126
|
+
charFillColors?: string[];
|
|
127
|
+
strokeEnabled: boolean;
|
|
128
|
+
strokeColor: string;
|
|
129
|
+
strokeWidth: number;
|
|
130
|
+
strokePosition: "outside" | "center" | "inside";
|
|
131
|
+
strokeOpacity: number;
|
|
132
|
+
strokeLineJoin: "round" | "miter" | "bevel";
|
|
133
|
+
strokeBlur?: number;
|
|
134
|
+
strokeType?: "single" | "double" | "neon";
|
|
135
|
+
strokeColorSecondary?: string;
|
|
136
|
+
strokeWidthSecondary?: number;
|
|
137
|
+
strokeFadeRange?: number;
|
|
138
|
+
glowLayers: GlowLayer[];
|
|
139
|
+
shadowEnabled: boolean;
|
|
140
|
+
shadowColor: string;
|
|
141
|
+
shadowBlur: number;
|
|
142
|
+
shadowOffsetX: number;
|
|
143
|
+
shadowOffsetY: number;
|
|
144
|
+
shadowOpacity: number;
|
|
145
|
+
shadowType: "drop" | "inner";
|
|
146
|
+
bevelEnabled: boolean;
|
|
147
|
+
bevelDepth: number;
|
|
148
|
+
bevelHighlight: string;
|
|
149
|
+
bevelShadow: string;
|
|
150
|
+
bevelDirection: "bottom-right" | "bottom" | "right";
|
|
151
|
+
bevelCoreColor?: string;
|
|
152
|
+
bevelEdgeColor?: string;
|
|
153
|
+
bevelEdgeWidth?: number;
|
|
154
|
+
bevelBlur?: number;
|
|
155
|
+
bevelBlurColor?: string;
|
|
156
|
+
bevelPerspectiveEnabled?: boolean;
|
|
157
|
+
bevelVanishingPointX?: number;
|
|
158
|
+
bevelVanishingPointY?: number;
|
|
159
|
+
bevelFocalLength?: number;
|
|
160
|
+
stackEnabled?: boolean;
|
|
161
|
+
stackCount?: number;
|
|
162
|
+
stackOffsetX?: number;
|
|
163
|
+
stackOffsetY?: number;
|
|
164
|
+
stackOpacityDecay?: number;
|
|
165
|
+
stackColor1?: string;
|
|
166
|
+
stackColor2?: string;
|
|
167
|
+
stackColor3?: string;
|
|
168
|
+
stackColor4?: string;
|
|
169
|
+
panelEnabled: boolean;
|
|
170
|
+
panelColor: string;
|
|
171
|
+
panelOpacity: number;
|
|
172
|
+
panelRadius: number;
|
|
173
|
+
panelPaddingX: number;
|
|
174
|
+
panelPaddingY: number;
|
|
175
|
+
panelStrokeEnabled: boolean;
|
|
176
|
+
panelStrokeColor: string;
|
|
177
|
+
panelStrokeWidth: number;
|
|
178
|
+
canvasWidth: number;
|
|
179
|
+
canvasHeight: number;
|
|
180
|
+
textPosX: "left" | "center" | "right";
|
|
181
|
+
textPosY: "top" | "middle" | "bottom";
|
|
182
|
+
/** Scale type to fit safe area inside canvas */
|
|
183
|
+
autoFitText?: boolean;
|
|
184
|
+
/** Wrap long lines to composition safe width */
|
|
185
|
+
wrapText?: boolean;
|
|
186
|
+
inkColor?: string;
|
|
187
|
+
bristleDensity?: number;
|
|
188
|
+
bristleSkipRate?: number;
|
|
189
|
+
dripRate?: number;
|
|
190
|
+
dripMaxLength?: number;
|
|
191
|
+
grainDensity?: number;
|
|
192
|
+
skewX?: number;
|
|
193
|
+
customRenderer?: string;
|
|
194
|
+
}
|
|
195
|
+
interface Preset {
|
|
196
|
+
id: string;
|
|
197
|
+
name: string;
|
|
198
|
+
config: TextEffectConfig;
|
|
199
|
+
/** Cached scene graph (optional; built-ins use recipes cache) */
|
|
200
|
+
scene?: SceneDocument;
|
|
201
|
+
isCustom?: boolean;
|
|
202
|
+
category?: "3d" | "Neon" | "Metallic" | "Glitch" | "Retro" | "Gradient" | "Grunge" | "Outline" | "Shadow" | "Elements" | "Luxury" | "Classic" | "Experimental" | string;
|
|
203
|
+
createdAt?: number;
|
|
204
|
+
}
|
|
205
|
+
interface EffectIndexItem {
|
|
206
|
+
id: string;
|
|
207
|
+
name: string;
|
|
208
|
+
category: string;
|
|
209
|
+
description?: string;
|
|
210
|
+
tags?: string[];
|
|
211
|
+
isPremium?: boolean;
|
|
212
|
+
previewType?: "static" | "video" | "lottie";
|
|
213
|
+
thumbnailUrl?: string;
|
|
214
|
+
thumbnail?: string;
|
|
215
|
+
previewUrl?: string;
|
|
216
|
+
durationMs?: number;
|
|
217
|
+
}
|
|
218
|
+
interface EffectFill {
|
|
219
|
+
type: "solid" | "linear" | "radial" | "pattern" | "none";
|
|
220
|
+
color?: string;
|
|
221
|
+
gradient?: {
|
|
222
|
+
angle: number;
|
|
223
|
+
stops: Array<{
|
|
224
|
+
color: string;
|
|
225
|
+
offset: number;
|
|
226
|
+
}>;
|
|
227
|
+
};
|
|
228
|
+
patternType?: string;
|
|
229
|
+
perCharFillEnabled?: boolean;
|
|
230
|
+
charFillColors?: string[];
|
|
231
|
+
}
|
|
232
|
+
interface EffectStroke {
|
|
233
|
+
color: string;
|
|
234
|
+
width: number;
|
|
235
|
+
position?: "outside" | "center" | "inside";
|
|
236
|
+
opacity?: number;
|
|
237
|
+
lineJoin?: "round" | "miter" | "bevel";
|
|
238
|
+
blur?: number;
|
|
239
|
+
type?: "solid" | "gradient";
|
|
240
|
+
colorSecondary?: string;
|
|
241
|
+
widthSecondary?: number;
|
|
242
|
+
fadeRange?: [number, number];
|
|
243
|
+
}
|
|
244
|
+
interface EffectShadow {
|
|
245
|
+
type?: "drop" | "inner";
|
|
246
|
+
color: string;
|
|
247
|
+
blur: number;
|
|
248
|
+
offset?: {
|
|
249
|
+
x: number;
|
|
250
|
+
y: number;
|
|
251
|
+
};
|
|
252
|
+
offsetX?: number;
|
|
253
|
+
offsetY?: number;
|
|
254
|
+
opacity?: number;
|
|
255
|
+
}
|
|
256
|
+
interface EffectBevel {
|
|
257
|
+
depth: number;
|
|
258
|
+
highlight?: string;
|
|
259
|
+
highlightColor?: string;
|
|
260
|
+
shadow?: string;
|
|
261
|
+
shadowColor?: string;
|
|
262
|
+
direction?: "bottom-right" | "bottom" | "right";
|
|
263
|
+
coreColor?: string;
|
|
264
|
+
edgeColor?: string;
|
|
265
|
+
edgeWidth?: number;
|
|
266
|
+
blur?: number;
|
|
267
|
+
blurColor?: string;
|
|
268
|
+
perspectiveEnabled?: boolean;
|
|
269
|
+
vanishingPointX?: number;
|
|
270
|
+
vanishingPointY?: number;
|
|
271
|
+
focalLength?: number;
|
|
272
|
+
}
|
|
273
|
+
interface EffectGlow {
|
|
274
|
+
color: string;
|
|
275
|
+
blur: number;
|
|
276
|
+
opacity: number;
|
|
277
|
+
type?: "outer" | "inner";
|
|
278
|
+
strength?: number;
|
|
279
|
+
spread?: number;
|
|
280
|
+
}
|
|
281
|
+
interface EffectPanel {
|
|
282
|
+
color: string;
|
|
283
|
+
opacity: number;
|
|
284
|
+
radius: number;
|
|
285
|
+
padding?: {
|
|
286
|
+
x: number;
|
|
287
|
+
y: number;
|
|
288
|
+
};
|
|
289
|
+
paddingX?: number;
|
|
290
|
+
paddingY?: number;
|
|
291
|
+
stroke?: {
|
|
292
|
+
color: string;
|
|
293
|
+
width: number;
|
|
294
|
+
} | null;
|
|
295
|
+
}
|
|
296
|
+
interface EffectStack {
|
|
297
|
+
count: number;
|
|
298
|
+
offsetX: number;
|
|
299
|
+
offsetY: number;
|
|
300
|
+
opacityDecay: number;
|
|
301
|
+
color1?: string;
|
|
302
|
+
color2?: string;
|
|
303
|
+
color3?: string;
|
|
304
|
+
color4?: string;
|
|
305
|
+
}
|
|
306
|
+
interface EffectFullDefinition extends EffectIndexItem {
|
|
307
|
+
version?: string;
|
|
308
|
+
description: string;
|
|
309
|
+
tags: string[];
|
|
310
|
+
font: {
|
|
311
|
+
family: string;
|
|
312
|
+
weight: number;
|
|
313
|
+
style: "normal" | "italic";
|
|
314
|
+
letterSpacing: number;
|
|
315
|
+
lineHeight: number;
|
|
316
|
+
};
|
|
317
|
+
fills: EffectFill[];
|
|
318
|
+
strokes: EffectStroke[];
|
|
319
|
+
shadows: EffectShadow[];
|
|
320
|
+
bevel?: EffectBevel;
|
|
321
|
+
glow?: EffectGlow;
|
|
322
|
+
glows?: EffectGlow[];
|
|
323
|
+
panel?: EffectPanel;
|
|
324
|
+
glitch?: any;
|
|
325
|
+
animation?: {
|
|
326
|
+
type: "none" | "typewriter" | "wave" | "fade" | "glitch";
|
|
327
|
+
speed?: number;
|
|
328
|
+
amplitude?: number;
|
|
329
|
+
frequency?: number;
|
|
330
|
+
};
|
|
331
|
+
background?: any;
|
|
332
|
+
stack?: EffectStack;
|
|
333
|
+
/**
|
|
334
|
+
* Bounding box specification — declares exactly how much space the effect needs
|
|
335
|
+
* beyond the ink bounds. createTextClip uses this instead of guessing.
|
|
336
|
+
*/
|
|
337
|
+
boundingBox?: {
|
|
338
|
+
paddingX: number;
|
|
339
|
+
paddingY: number;
|
|
340
|
+
/**
|
|
341
|
+
* "ink" → box wraps text ink + padding (default, most effects)
|
|
342
|
+
* "panel" → effect renders a filled background; paddingX/Y ARE the
|
|
343
|
+
* visual padding of that panel around the text
|
|
344
|
+
*/
|
|
345
|
+
mode?: "ink" | "panel";
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
interface TextEffectDefinition extends EffectFullDefinition {
|
|
349
|
+
text?: string;
|
|
350
|
+
description: string;
|
|
351
|
+
tags: string[];
|
|
352
|
+
}
|
|
353
|
+
interface EvaluatedTextLayer {
|
|
354
|
+
readonly layerId: string;
|
|
355
|
+
readonly clipId: string;
|
|
356
|
+
readonly role: string;
|
|
357
|
+
readonly zIndex: number;
|
|
358
|
+
readonly layerType: "text";
|
|
359
|
+
readonly x: number;
|
|
360
|
+
readonly y: number;
|
|
361
|
+
readonly width: number;
|
|
362
|
+
readonly height: number;
|
|
363
|
+
readonly rotation: number;
|
|
364
|
+
readonly opacity: number;
|
|
365
|
+
readonly inTransition: boolean;
|
|
366
|
+
readonly blendMode: string;
|
|
367
|
+
readonly time?: number;
|
|
368
|
+
readonly clipStartTime?: number;
|
|
369
|
+
readonly clipDuration?: number;
|
|
370
|
+
readonly text: string;
|
|
371
|
+
readonly fontFamily: string;
|
|
372
|
+
readonly fontSize: number;
|
|
373
|
+
readonly color: string;
|
|
374
|
+
readonly fontWeight: "normal" | "bold" | number;
|
|
375
|
+
readonly fontStyle: "normal" | "italic";
|
|
376
|
+
readonly textAlign: "left" | "center" | "right";
|
|
377
|
+
readonly verticalAlign: "top" | "middle" | "bottom";
|
|
378
|
+
readonly lineHeight: number;
|
|
379
|
+
readonly letterSpacing: number;
|
|
380
|
+
readonly stroke?: {
|
|
381
|
+
color: string;
|
|
382
|
+
width: number;
|
|
383
|
+
};
|
|
384
|
+
readonly shadow?: {
|
|
385
|
+
color: string;
|
|
386
|
+
blur: number;
|
|
387
|
+
offsetX: number;
|
|
388
|
+
offsetY: number;
|
|
389
|
+
};
|
|
390
|
+
readonly background?: {
|
|
391
|
+
color: string;
|
|
392
|
+
padding: number;
|
|
393
|
+
borderRadius: number;
|
|
394
|
+
};
|
|
395
|
+
readonly styleId?: string;
|
|
396
|
+
}
|
|
397
|
+
type TemplateCategory = "lower-third" | "title-card" | "caption" | "callout" | "social" | "countdown";
|
|
398
|
+
type AnimationPreset = "fade" | "slide-up" | "slide-down" | "slide-left" | "slide-right" | "scale-in" | "scale-out" | "blur-in" | "blur-out" | "typewriter" | "none";
|
|
399
|
+
type TemplateEasingFunction = "linear" | "ease-in-out" | "ease-in" | "ease-out" | "ease";
|
|
400
|
+
interface TemplateKeyframe<T> {
|
|
401
|
+
time: number;
|
|
402
|
+
value: T;
|
|
403
|
+
easing?: TemplateEasingFunction;
|
|
404
|
+
}
|
|
405
|
+
type AnimatableValue<T> = T | {
|
|
406
|
+
keyframes: TemplateKeyframe<T>[];
|
|
407
|
+
};
|
|
408
|
+
interface LayerAnimation {
|
|
409
|
+
in: AnimationPreset;
|
|
410
|
+
out: AnimationPreset;
|
|
411
|
+
inDuration: number;
|
|
412
|
+
outDuration: number;
|
|
413
|
+
hold: "full" | number;
|
|
414
|
+
}
|
|
415
|
+
interface TemplateTextLayer {
|
|
416
|
+
kind: "text";
|
|
417
|
+
id: string;
|
|
418
|
+
content: string;
|
|
419
|
+
fontFamily: string;
|
|
420
|
+
fontSize: AnimatableValue<number>;
|
|
421
|
+
fontWeight: AnimatableValue<number>;
|
|
422
|
+
color: AnimatableValue<string>;
|
|
423
|
+
align: "left" | "center" | "right";
|
|
424
|
+
x: AnimatableValue<number>;
|
|
425
|
+
y: AnimatableValue<number>;
|
|
426
|
+
/** Panel width in px, or `"auto"` to size to measured text width + horizontal padding. */
|
|
427
|
+
width: AnimatableValue<number> | "auto";
|
|
428
|
+
/** Panel height in px, or `"auto"` to size to measured ink height + vertical padding.
|
|
429
|
+
* When combined with `overflow: "wrap"`, the panel grows to fit all wrapped lines. */
|
|
430
|
+
height: AnimatableValue<number> | "auto";
|
|
431
|
+
opacity?: AnimatableValue<number>;
|
|
432
|
+
backgroundColor?: AnimatableValue<string>;
|
|
433
|
+
backgroundOpacity?: AnimatableValue<number>;
|
|
434
|
+
backgroundRadius?: AnimatableValue<number>;
|
|
435
|
+
/** Legacy uniform padding — still honoured for backwards compat. Prefer individual sides. */
|
|
436
|
+
padding?: AnimatableValue<number>;
|
|
437
|
+
/** Per-side padding (overrides `padding` when set) */
|
|
438
|
+
paddingTop?: AnimatableValue<number>;
|
|
439
|
+
paddingRight?: AnimatableValue<number>;
|
|
440
|
+
paddingBottom?: AnimatableValue<number>;
|
|
441
|
+
paddingLeft?: AnimatableValue<number>;
|
|
442
|
+
backgroundBorderColor?: AnimatableValue<string>;
|
|
443
|
+
backgroundBorderWidth?: AnimatableValue<number>;
|
|
444
|
+
animation: LayerAnimation;
|
|
445
|
+
role?: "primary" | "secondary" | "accent" | "none";
|
|
446
|
+
overflow?: "wrap" | "shrink" | "expand-panel" | "clip";
|
|
447
|
+
verticalAlign?: "top" | "middle" | "bottom";
|
|
448
|
+
}
|
|
449
|
+
interface TemplateShapeLayer {
|
|
450
|
+
kind: "shape";
|
|
451
|
+
id: string;
|
|
452
|
+
shape: "rect" | "line" | "circle";
|
|
453
|
+
fill: AnimatableValue<string>;
|
|
454
|
+
stroke?: {
|
|
455
|
+
color: AnimatableValue<string>;
|
|
456
|
+
width: AnimatableValue<number>;
|
|
457
|
+
};
|
|
458
|
+
x: AnimatableValue<number>;
|
|
459
|
+
y: AnimatableValue<number>;
|
|
460
|
+
width: AnimatableValue<number>;
|
|
461
|
+
height: AnimatableValue<number>;
|
|
462
|
+
opacity?: AnimatableValue<number>;
|
|
463
|
+
animation: LayerAnimation;
|
|
464
|
+
}
|
|
465
|
+
interface TemplateImageLayer {
|
|
466
|
+
kind: "image";
|
|
467
|
+
id: string;
|
|
468
|
+
url: string;
|
|
469
|
+
x: AnimatableValue<number>;
|
|
470
|
+
y: AnimatableValue<number>;
|
|
471
|
+
width: AnimatableValue<number>;
|
|
472
|
+
height: AnimatableValue<number>;
|
|
473
|
+
opacity?: AnimatableValue<number>;
|
|
474
|
+
animation: LayerAnimation;
|
|
475
|
+
}
|
|
476
|
+
interface TemplateImageLayer {
|
|
477
|
+
kind: "image";
|
|
478
|
+
id: string;
|
|
479
|
+
url: string;
|
|
480
|
+
x: AnimatableValue<number>;
|
|
481
|
+
y: AnimatableValue<number>;
|
|
482
|
+
width: AnimatableValue<number>;
|
|
483
|
+
height: AnimatableValue<number>;
|
|
484
|
+
opacity?: AnimatableValue<number>;
|
|
485
|
+
animation: LayerAnimation;
|
|
486
|
+
}
|
|
487
|
+
type TemplateLayer = TemplateTextLayer | TemplateShapeLayer | TemplateImageLayer;
|
|
488
|
+
interface TextTemplate {
|
|
489
|
+
id: string;
|
|
490
|
+
label: string;
|
|
491
|
+
category: TemplateCategory;
|
|
492
|
+
duration: number;
|
|
493
|
+
canvasWidth: number;
|
|
494
|
+
canvasHeight: number;
|
|
495
|
+
thumbnail?: string;
|
|
496
|
+
preview?: string;
|
|
497
|
+
layers: TemplateLayer[];
|
|
498
|
+
published?: boolean;
|
|
499
|
+
creatorName?: string;
|
|
500
|
+
creatorLink?: string;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
declare function renderTextEffectCore(ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, cfg: TextEffectConfig): void;
|
|
504
|
+
declare class TextEffectRenderer {
|
|
505
|
+
static draw(ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, cfg: TextEffectConfig, _time?: number): void;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/** Style recipes (layer graphs): see `builtInRecipes` in src/engine/recipes.ts */
|
|
509
|
+
declare const defaultConfig: TextEffectConfig;
|
|
510
|
+
declare const builtInPresets: Preset[];
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* Font Loader for Lottie-web
|
|
514
|
+
*
|
|
515
|
+
* This module ensures that font variant names (like "Poppins-Italic") work correctly
|
|
516
|
+
* with lottie-web by dynamically creating @font-face rules that map variant names
|
|
517
|
+
* to the actual loaded fonts with proper styling.
|
|
518
|
+
*/
|
|
519
|
+
interface FontVariant {
|
|
520
|
+
variantName: string;
|
|
521
|
+
baseFontFamily: string;
|
|
522
|
+
weight: number;
|
|
523
|
+
style: "normal" | "italic";
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Injects @font-face rules dynamically to create font variant aliases
|
|
527
|
+
* This ensures lottie-web can find fonts by their variant names
|
|
528
|
+
*/
|
|
529
|
+
declare function injectFontVariantRules(): void;
|
|
530
|
+
/**
|
|
531
|
+
* Waits for base fonts to load, then injects variant rules
|
|
532
|
+
*/
|
|
533
|
+
declare function initializeFontSystem(): Promise<void>;
|
|
534
|
+
/**
|
|
535
|
+
* Checks if a font variant is available for rendering.
|
|
536
|
+
* Uses document.fonts.check() which is the correct API for font availability —
|
|
537
|
+
* unlike measureText() which silently falls back to the system font and always
|
|
538
|
+
* returns a non-zero width regardless of whether the named font loaded.
|
|
539
|
+
*/
|
|
540
|
+
declare function checkFontVariant(variantName: string): boolean;
|
|
541
|
+
/**
|
|
542
|
+
* Font descriptor for loading.
|
|
543
|
+
*/
|
|
544
|
+
interface FontDescriptor {
|
|
545
|
+
family: string;
|
|
546
|
+
weight?: string | number;
|
|
547
|
+
style?: "normal" | "italic";
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Font loading result.
|
|
551
|
+
*/
|
|
552
|
+
interface FontLoadResult {
|
|
553
|
+
font: FontDescriptor;
|
|
554
|
+
loaded: boolean;
|
|
555
|
+
error?: string;
|
|
556
|
+
loadTimeMs: number;
|
|
557
|
+
}
|
|
558
|
+
declare class FontLoader {
|
|
559
|
+
private state;
|
|
560
|
+
ensureFont(descriptor: FontDescriptor): Promise<FontLoadResult>;
|
|
561
|
+
ensureFonts(descriptors: FontDescriptor[]): Promise<FontLoadResult[]>;
|
|
562
|
+
waitForFontsReady(): Promise<void>;
|
|
563
|
+
isLoaded(descriptor: FontDescriptor): boolean;
|
|
564
|
+
getStats(): {
|
|
565
|
+
loaded: number;
|
|
566
|
+
loading: number;
|
|
567
|
+
failed: number;
|
|
568
|
+
};
|
|
569
|
+
clear(): void;
|
|
570
|
+
private loadFont;
|
|
571
|
+
private getFontKey;
|
|
572
|
+
private normalizeFontWeight;
|
|
573
|
+
}
|
|
574
|
+
declare function getFontLoader(): FontLoader;
|
|
575
|
+
declare function resetFontLoader(): void;
|
|
576
|
+
declare function ensureFontsLoaded(descriptors: FontDescriptor[]): Promise<FontLoadResult[]>;
|
|
577
|
+
|
|
578
|
+
declare function resolveCustomEngineId(cfg: TextEffectConfig): CustomEngineId | null;
|
|
579
|
+
/** Lossless migration from flat TextEffectConfig to SceneDocument */
|
|
580
|
+
declare function textEffectConfigToScene(cfg: TextEffectConfig): SceneDocument;
|
|
581
|
+
/** Flatten SceneDocument back to TextEffectConfig for legacy controls and renderer */
|
|
582
|
+
declare function sceneToConfig(doc: SceneDocument): TextEffectConfig;
|
|
583
|
+
declare function syncCompositorFromScene(doc: SceneDocument): CompositorFromScene;
|
|
584
|
+
interface CompositorFromScene {
|
|
585
|
+
blur: number;
|
|
586
|
+
bloom: number;
|
|
587
|
+
bloomThreshold: number;
|
|
588
|
+
}
|
|
589
|
+
/** Apply engine params from scene onto config without require() */
|
|
590
|
+
declare function mergeSceneIntoConfig(doc: SceneDocument, base: TextEffectConfig): TextEffectConfig;
|
|
591
|
+
declare function resolveFontFamilyName(fontFamily: string): string;
|
|
592
|
+
declare function _buildConfig(effect: TextEffectDefinition, text: string, fontSize: number, canvasWidth: number, canvasHeight: number, time?: number, clipStartTime?: number, clipDuration?: number): TextEffectConfig & {
|
|
593
|
+
width: number;
|
|
594
|
+
height: number;
|
|
595
|
+
};
|
|
596
|
+
declare function layerToTextEffectConfig(layer: EvaluatedTextLayer): TextEffectConfig & {
|
|
597
|
+
width: number;
|
|
598
|
+
height: number;
|
|
599
|
+
};
|
|
600
|
+
|
|
601
|
+
declare class WebGLCompositor {
|
|
602
|
+
private gl;
|
|
603
|
+
private program;
|
|
604
|
+
private vao;
|
|
605
|
+
private texture;
|
|
606
|
+
readonly isSupported: boolean;
|
|
607
|
+
constructor();
|
|
608
|
+
private initProgram;
|
|
609
|
+
private compileShader;
|
|
610
|
+
renderToContext(targetCtx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, source: HTMLCanvasElement | OffscreenCanvas, settings: CompositorSettings): void;
|
|
611
|
+
dispose(): void;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
interface EvaluateOptions {
|
|
615
|
+
compositor?: WebGLCompositor | null;
|
|
616
|
+
skipPostFx?: boolean;
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Dispose the shared module-level compositor and release GPU resources.
|
|
620
|
+
* Call on hot-module-reload or application teardown to prevent WebGL context leaks.
|
|
621
|
+
*/
|
|
622
|
+
declare function disposeSharedCompositor(): void;
|
|
623
|
+
/**
|
|
624
|
+
* Single source of truth for rendering a scene at time t.
|
|
625
|
+
*/
|
|
626
|
+
declare function evaluateScene(doc: SceneDocument, time: number, ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, options?: EvaluateOptions): void;
|
|
627
|
+
declare function evaluateConfig(cfg: TextEffectConfig, time: number, ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, options?: EvaluateOptions): void;
|
|
628
|
+
declare function advanceSceneTime(doc: SceneDocument, steps: number): number;
|
|
629
|
+
declare function getSceneTime(doc: SceneDocument): number;
|
|
630
|
+
declare function setSceneTime(doc: SceneDocument, time: number): void;
|
|
631
|
+
declare function resetSceneTime(doc: SceneDocument): void;
|
|
632
|
+
|
|
633
|
+
export { type Timeline as $, type AnimTrack as A, type EffectStack as B, CUSTOM_ENGINE_IDS as C, DEFAULT_CANVAS_HEIGHT as D, type EffectLayer as E, type EffectStroke as F, type GlowLayer as G, type EvaluateOptions as H, type EvaluatedTextLayer as I, type FontDescriptor as J, type Keyframe as K, type FontLoadResult as L, FontLoader as M, type FontVariant as N, LEGACY_RENDERER_MAP as O, type Preset as P, type LayerAnimation as Q, type LayerTarget as R, type SceneDocument as S, type TextEffectConfig as T, SCENE_VERSION as U, type SceneCanvas as V, type SceneText as W, type TemplateImageLayer as X, type TemplateShapeLayer as Y, type TemplateTextLayer as Z, TextEffectRenderer as _, type StyleRecipe as a, WebGLCompositor as a0, _buildConfig as a1, advanceSceneTime as a2, builtInPresets as a3, checkFontVariant as a4, createEmptyScene as a5, defaultConfig as a6, disposeSharedCompositor as a7, ensureFontsLoaded as a8, evaluateConfig as a9, evaluateScene as aa, getFontLoader as ab, getSceneTime as ac, initializeFontSystem as ad, injectFontVariantRules as ae, layerToTextEffectConfig as af, mergeSceneIntoConfig as ag, newLayerId as ah, renderTextEffectCore as ai, resetFontLoader as aj, resetSceneTime as ak, resolveCustomEngineId as al, resolveFontFamilyName as am, sceneToConfig as an, setSceneTime as ao, syncCompositorFromScene as ap, textEffectConfigToScene as aq, type TextEffectDefinition as b, type GradientStop as c, type TextTemplate as d, type TemplateLayer as e, type TemplateCategory as f, type AnimatableValue as g, type TemplateEasingFunction as h, type TemplateKeyframe as i, type AnimationPreset as j, type CompositorFromScene as k, type CompositorSettings as l, type CustomEngineId as m, DEFAULT_CANVAS_WIDTH as n, DEFAULT_DURATION as o, DEFAULT_FONT_SIZE as p, DEFAULT_FPS as q, ENGINE_ID_TO_LEGACY as r, type EffectBevel as s, type EffectFill as t, type EffectFullDefinition as u, type EffectGlow as v, type EffectIndexItem as w, type EffectLayerType as x, type EffectPanel as y, type EffectShadow as z };
|