@clypra-studio/engine 1.4.0 → 1.5.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/{chunk-E6O6LZME.js → chunk-7ORA5BPW.js} +14 -299
- package/dist/chunk-7ORA5BPW.js.map +1 -0
- package/dist/chunk-NG4F55V7.js +300 -0
- package/dist/chunk-NG4F55V7.js.map +1 -0
- package/dist/chunk-Q7XYDP4X.js +1898 -0
- package/dist/chunk-Q7XYDP4X.js.map +1 -0
- package/dist/{chunk-3UEOLDJJ.js → chunk-SH7HOGVX.js} +1 -1
- package/dist/chunk-SH7HOGVX.js.map +1 -0
- package/dist/index-B1lFl4p2.d.ts +122 -0
- package/dist/index-Cpps1DKP.d.ts +489 -0
- package/dist/index-DrzRbR7G.d.cts +122 -0
- package/dist/index-WsvrOpAy.d.cts +489 -0
- package/dist/index.cjs +3131 -482
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +185 -103
- package/dist/index.d.ts +185 -103
- package/dist/index.js +1599 -792
- package/dist/index.js.map +1 -1
- package/dist/rendering/index.cjs +3694 -0
- package/dist/rendering/index.cjs.map +1 -0
- package/dist/rendering/index.d.cts +2 -0
- package/dist/rendering/index.d.ts +2 -0
- package/dist/rendering/index.js +21 -0
- package/dist/rendering/index.js.map +1 -0
- package/dist/textEffects/index.cjs +13 -5
- package/dist/textEffects/index.cjs.map +1 -1
- package/dist/textEffects/index.d.cts +2 -1
- package/dist/textEffects/index.d.ts +2 -1
- package/dist/textEffects/index.js +6 -4
- package/dist/{index-C18SQ-y6.d.cts → types-IYwXGYkB.d.cts} +141 -129
- package/dist/{index-C18SQ-y6.d.ts → types-IYwXGYkB.d.ts} +141 -129
- package/dist/videoEffects/index.cjs.map +1 -1
- package/dist/videoEffects/index.js +1 -1
- package/package.json +6 -1
- package/dist/chunk-3UEOLDJJ.js.map +0 -1
- package/dist/chunk-E6O6LZME.js.map +0 -1
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
import { S as SceneDocument, T as TextTemplate, a as TemplateLayer, L as LayerAnimation, b as TemplateKeyframe, R as ResponsiveAnchorConfig, c as TextStyleSpan, d as TextSplitAnimator, e as TemplateVariableDefinition } from './types-IYwXGYkB.js';
|
|
2
|
+
|
|
3
|
+
declare const CANONICAL_SCHEMA_VERSION: 2;
|
|
4
|
+
declare const CANONICAL_RENDERER_VERSION: "1.4.0";
|
|
5
|
+
interface PublishedRevision {
|
|
6
|
+
assetId: string;
|
|
7
|
+
revisionId: string;
|
|
8
|
+
schemaVersion: number;
|
|
9
|
+
contentHash: string;
|
|
10
|
+
rendererVersion: string;
|
|
11
|
+
createdAt: string;
|
|
12
|
+
}
|
|
13
|
+
interface SceneDocumentV2 extends SceneDocument {
|
|
14
|
+
schemaVersion: typeof CANONICAL_SCHEMA_VERSION;
|
|
15
|
+
revision?: PublishedRevision;
|
|
16
|
+
}
|
|
17
|
+
interface TemplateStyleRef {
|
|
18
|
+
effectId: string;
|
|
19
|
+
revisionId: string;
|
|
20
|
+
contentHash: string;
|
|
21
|
+
/** Required for published templates; optional only for unresolved legacy input. */
|
|
22
|
+
snapshot?: SceneDocumentV2;
|
|
23
|
+
parameterOverrides?: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
type TemplateLayerV2 = TemplateLayer & {
|
|
26
|
+
styleRef?: TemplateStyleRef;
|
|
27
|
+
};
|
|
28
|
+
interface TextTemplateDocumentV2 {
|
|
29
|
+
schemaVersion: typeof CANONICAL_SCHEMA_VERSION;
|
|
30
|
+
id: string;
|
|
31
|
+
label: string;
|
|
32
|
+
category: TextTemplate["category"] | string;
|
|
33
|
+
description: string;
|
|
34
|
+
tags: string[];
|
|
35
|
+
duration: number;
|
|
36
|
+
fps: number;
|
|
37
|
+
canvasWidth: number;
|
|
38
|
+
canvasHeight: number;
|
|
39
|
+
layers: TemplateLayerV2[];
|
|
40
|
+
dependencies: TemplateStyleRef[];
|
|
41
|
+
revision?: PublishedRevision;
|
|
42
|
+
thumbnail?: string;
|
|
43
|
+
preview?: string;
|
|
44
|
+
published?: boolean;
|
|
45
|
+
creatorName?: string;
|
|
46
|
+
creatorLink?: string;
|
|
47
|
+
}
|
|
48
|
+
type RenderTarget = "canvas2d" | "native" | "export";
|
|
49
|
+
type CapabilityStatus = "exact" | "approximate" | "rasterized" | "unsupported";
|
|
50
|
+
interface RenderDiagnostic {
|
|
51
|
+
layerId: string;
|
|
52
|
+
layerType: string;
|
|
53
|
+
enabled: boolean;
|
|
54
|
+
contribution: "active" | "disabled" | "unsupported";
|
|
55
|
+
reason: string;
|
|
56
|
+
}
|
|
57
|
+
interface CapabilityReport {
|
|
58
|
+
target: RenderTarget;
|
|
59
|
+
status: CapabilityStatus;
|
|
60
|
+
unsupportedFeatures: string[];
|
|
61
|
+
approximations: string[];
|
|
62
|
+
}
|
|
63
|
+
interface RenderPlan {
|
|
64
|
+
kind: "text-effect" | "text-template";
|
|
65
|
+
width: number;
|
|
66
|
+
height: number;
|
|
67
|
+
duration: number;
|
|
68
|
+
time: number;
|
|
69
|
+
effect?: SceneDocumentV2;
|
|
70
|
+
template?: TextTemplateDocumentV2;
|
|
71
|
+
diagnostics: RenderDiagnostic[];
|
|
72
|
+
capabilities: Record<RenderTarget, CapabilityReport>;
|
|
73
|
+
}
|
|
74
|
+
declare function canonicalContentHash(value: unknown): string;
|
|
75
|
+
declare function canonicalizeSceneDocument(input: SceneDocument): SceneDocumentV2;
|
|
76
|
+
declare function normalizeTextEffect(input: unknown, metadata?: Partial<PublishedRevision>): SceneDocumentV2;
|
|
77
|
+
declare function normalizeTextTemplate(input: unknown, metadata?: Partial<PublishedRevision>): TextTemplateDocumentV2;
|
|
78
|
+
declare function evaluateTextEffect(document: SceneDocumentV2 | unknown, time?: number, _overrides?: Record<string, unknown>): RenderPlan;
|
|
79
|
+
declare function evaluateTextTemplate(document: TextTemplateDocumentV2 | unknown, time?: number, overrides?: Record<string, unknown>): RenderPlan;
|
|
80
|
+
declare function getRenderCapabilities(plan: RenderPlan, target: RenderTarget): CapabilityReport;
|
|
81
|
+
|
|
82
|
+
declare const TEXT_TEMPLATE_KIND: "text-template";
|
|
83
|
+
declare const TEXT_TEMPLATE_SCHEMA_VERSION: 4;
|
|
84
|
+
declare const TEXT_TEMPLATE_RENDERER_VERSION: "1.5.0";
|
|
85
|
+
type TemplateControlType = "text" | "color" | "number" | "boolean" | "enum" | "font" | "media";
|
|
86
|
+
interface TemplateControlOption {
|
|
87
|
+
value: string;
|
|
88
|
+
label: string;
|
|
89
|
+
}
|
|
90
|
+
interface TemplateControlConstraints {
|
|
91
|
+
min?: number;
|
|
92
|
+
max?: number;
|
|
93
|
+
step?: number;
|
|
94
|
+
maxLength?: number;
|
|
95
|
+
multiline?: boolean;
|
|
96
|
+
options?: TemplateControlOption[];
|
|
97
|
+
allowedMimeTypes?: string[];
|
|
98
|
+
}
|
|
99
|
+
interface TemplateControl {
|
|
100
|
+
id: string;
|
|
101
|
+
label: string;
|
|
102
|
+
type: TemplateControlType;
|
|
103
|
+
group?: string;
|
|
104
|
+
description?: string;
|
|
105
|
+
required?: boolean;
|
|
106
|
+
defaultValue: string | number | boolean | null;
|
|
107
|
+
constraints?: TemplateControlConstraints;
|
|
108
|
+
target: {
|
|
109
|
+
nodeId: string;
|
|
110
|
+
propertyPath: string;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
interface TemplateProtectedRegion {
|
|
114
|
+
start: number;
|
|
115
|
+
end: number;
|
|
116
|
+
}
|
|
117
|
+
type TemplateDurationPolicy = "fixed" | "stretch" | "trim" | "loop";
|
|
118
|
+
interface TemplateTimelineMarker {
|
|
119
|
+
id: string;
|
|
120
|
+
label: string;
|
|
121
|
+
time: number;
|
|
122
|
+
color?: string;
|
|
123
|
+
}
|
|
124
|
+
interface TemplateTiming {
|
|
125
|
+
duration: number;
|
|
126
|
+
fps: number;
|
|
127
|
+
durationPolicy: TemplateDurationPolicy;
|
|
128
|
+
intro?: TemplateProtectedRegion;
|
|
129
|
+
outro?: TemplateProtectedRegion;
|
|
130
|
+
loop?: TemplateProtectedRegion;
|
|
131
|
+
markers?: TemplateTimelineMarker[];
|
|
132
|
+
}
|
|
133
|
+
interface TemplateAssetRef {
|
|
134
|
+
id: string;
|
|
135
|
+
name?: string;
|
|
136
|
+
type: "image" | "video" | "audio";
|
|
137
|
+
mimeType: string;
|
|
138
|
+
sizeBytes?: number;
|
|
139
|
+
uri: string;
|
|
140
|
+
contentHash: string;
|
|
141
|
+
}
|
|
142
|
+
interface TemplateFontRef {
|
|
143
|
+
family: string;
|
|
144
|
+
postscriptName?: string;
|
|
145
|
+
style?: string;
|
|
146
|
+
weight?: string | number;
|
|
147
|
+
sourceUrl?: string;
|
|
148
|
+
format?: "woff2" | "ttf" | "otf";
|
|
149
|
+
}
|
|
150
|
+
interface TemplateDependencyManifest {
|
|
151
|
+
assets: TemplateAssetRef[];
|
|
152
|
+
fonts: TemplateFontRef[];
|
|
153
|
+
textEffects: Array<{
|
|
154
|
+
effectId: string;
|
|
155
|
+
revisionId: string;
|
|
156
|
+
contentHash: string;
|
|
157
|
+
snapshot?: unknown;
|
|
158
|
+
}>;
|
|
159
|
+
}
|
|
160
|
+
interface TemplateMetadata {
|
|
161
|
+
id: string;
|
|
162
|
+
label: string;
|
|
163
|
+
category: string;
|
|
164
|
+
description?: string;
|
|
165
|
+
tags: string[];
|
|
166
|
+
creatorName?: string;
|
|
167
|
+
creatorLink?: string;
|
|
168
|
+
thumbnailUrl?: string;
|
|
169
|
+
previewVideoUrl?: string;
|
|
170
|
+
}
|
|
171
|
+
interface TemplateRevision {
|
|
172
|
+
revisionId: string;
|
|
173
|
+
contentHash: string;
|
|
174
|
+
schemaVersion: number;
|
|
175
|
+
rendererVersion: string;
|
|
176
|
+
createdAt: string;
|
|
177
|
+
status?: "pending-review" | "approved" | "deprecated";
|
|
178
|
+
}
|
|
179
|
+
interface TemplatePreviewArtifacts {
|
|
180
|
+
thumbnailUrl?: string;
|
|
181
|
+
previewVideoUrl?: string;
|
|
182
|
+
generatedAt?: string;
|
|
183
|
+
}
|
|
184
|
+
interface TemplateTextNodeStyle {
|
|
185
|
+
fontFamily: string;
|
|
186
|
+
fontSize: number;
|
|
187
|
+
fontWeight: string | number;
|
|
188
|
+
textColor: string;
|
|
189
|
+
textAlign?: "left" | "center" | "right";
|
|
190
|
+
lineHeight?: number;
|
|
191
|
+
letterSpacing?: number;
|
|
192
|
+
overflow?: "wrap" | "shrink" | "expand-panel" | "clip";
|
|
193
|
+
verticalAlign?: "top" | "middle" | "bottom";
|
|
194
|
+
}
|
|
195
|
+
interface TemplateBackgroundPanel {
|
|
196
|
+
color?: string;
|
|
197
|
+
opacity?: number;
|
|
198
|
+
paddingTop?: number;
|
|
199
|
+
paddingRight?: number;
|
|
200
|
+
paddingBottom?: number;
|
|
201
|
+
paddingLeft?: number;
|
|
202
|
+
borderRadius?: number;
|
|
203
|
+
borderColor?: string;
|
|
204
|
+
borderWidth?: number;
|
|
205
|
+
}
|
|
206
|
+
type TemplatePropertyKeyframes = Record<string, {
|
|
207
|
+
keyframes: TemplateKeyframe<unknown>[];
|
|
208
|
+
}>;
|
|
209
|
+
type TemplateNodeAnimation = LayerAnimation & {
|
|
210
|
+
/** Keyframes for geometry/style properties authored by Studio. */
|
|
211
|
+
propertyKeyframes?: TemplatePropertyKeyframes;
|
|
212
|
+
};
|
|
213
|
+
interface TemplateTextNode {
|
|
214
|
+
id: string;
|
|
215
|
+
name?: string;
|
|
216
|
+
type: "text";
|
|
217
|
+
text: string;
|
|
218
|
+
x: number;
|
|
219
|
+
y: number;
|
|
220
|
+
width: number | "auto";
|
|
221
|
+
height: number | "auto";
|
|
222
|
+
visible?: boolean;
|
|
223
|
+
style: TemplateTextNodeStyle;
|
|
224
|
+
backgroundPanel?: TemplateBackgroundPanel;
|
|
225
|
+
animation?: TemplateNodeAnimation;
|
|
226
|
+
spans?: TextStyleSpan[];
|
|
227
|
+
perCharFillEnabled?: boolean;
|
|
228
|
+
charFillColors?: string[];
|
|
229
|
+
splitAnimator?: TextSplitAnimator;
|
|
230
|
+
anchor?: ResponsiveAnchorConfig;
|
|
231
|
+
textEffectRef?: {
|
|
232
|
+
effectId: string;
|
|
233
|
+
revisionId: string;
|
|
234
|
+
contentHash: string;
|
|
235
|
+
snapshot?: unknown;
|
|
236
|
+
};
|
|
237
|
+
parentId?: string;
|
|
238
|
+
}
|
|
239
|
+
interface TemplateShapeNodeStyle {
|
|
240
|
+
fillColor: string;
|
|
241
|
+
fillOpacity?: number;
|
|
242
|
+
strokeColor?: string;
|
|
243
|
+
strokeWidth?: number;
|
|
244
|
+
}
|
|
245
|
+
interface TemplateShapeNode {
|
|
246
|
+
id: string;
|
|
247
|
+
name?: string;
|
|
248
|
+
type: "shape";
|
|
249
|
+
shapeType: "rectangle" | "circle" | "line";
|
|
250
|
+
x: number;
|
|
251
|
+
y: number;
|
|
252
|
+
width: number;
|
|
253
|
+
height: number;
|
|
254
|
+
visible?: boolean;
|
|
255
|
+
style: TemplateShapeNodeStyle;
|
|
256
|
+
animation?: TemplateNodeAnimation;
|
|
257
|
+
anchor?: ResponsiveAnchorConfig;
|
|
258
|
+
parentId?: string;
|
|
259
|
+
}
|
|
260
|
+
interface TemplateImageNode {
|
|
261
|
+
id: string;
|
|
262
|
+
name?: string;
|
|
263
|
+
type: "media";
|
|
264
|
+
mediaType: "image";
|
|
265
|
+
x: number;
|
|
266
|
+
y: number;
|
|
267
|
+
width: number;
|
|
268
|
+
height: number;
|
|
269
|
+
visible?: boolean;
|
|
270
|
+
assetId?: string;
|
|
271
|
+
src?: string;
|
|
272
|
+
style?: {
|
|
273
|
+
opacity?: number;
|
|
274
|
+
};
|
|
275
|
+
animation?: TemplateNodeAnimation;
|
|
276
|
+
anchor?: ResponsiveAnchorConfig;
|
|
277
|
+
parentId?: string;
|
|
278
|
+
}
|
|
279
|
+
interface TextTemplateFlexLayout {
|
|
280
|
+
type: "flex" | "absolute";
|
|
281
|
+
direction: "row" | "column";
|
|
282
|
+
gap: number;
|
|
283
|
+
alignItems: "start" | "center" | "end" | "stretch";
|
|
284
|
+
justifyContent: "start" | "center" | "end" | "space-between" | "space-around";
|
|
285
|
+
paddingTop?: number;
|
|
286
|
+
paddingRight?: number;
|
|
287
|
+
paddingBottom?: number;
|
|
288
|
+
paddingLeft?: number;
|
|
289
|
+
}
|
|
290
|
+
interface TemplateContainerNodeStyle {
|
|
291
|
+
backgroundColor?: string;
|
|
292
|
+
backgroundOpacity?: number;
|
|
293
|
+
borderRadius?: number;
|
|
294
|
+
borderColor?: string;
|
|
295
|
+
borderWidth?: number;
|
|
296
|
+
opacity?: number;
|
|
297
|
+
}
|
|
298
|
+
interface TemplateContainerNode {
|
|
299
|
+
id: string;
|
|
300
|
+
name?: string;
|
|
301
|
+
type: "container";
|
|
302
|
+
layout: TextTemplateFlexLayout;
|
|
303
|
+
x: number;
|
|
304
|
+
y: number;
|
|
305
|
+
width: number | "auto";
|
|
306
|
+
height: number | "auto";
|
|
307
|
+
visible?: boolean;
|
|
308
|
+
style?: TemplateContainerNodeStyle;
|
|
309
|
+
animation?: TemplateNodeAnimation;
|
|
310
|
+
anchor?: ResponsiveAnchorConfig;
|
|
311
|
+
parentId?: string;
|
|
312
|
+
}
|
|
313
|
+
type TemplateNode = TemplateTextNode | TemplateShapeNode | TemplateImageNode | TemplateContainerNode;
|
|
314
|
+
interface TextTemplateCanvas {
|
|
315
|
+
width: number;
|
|
316
|
+
height: number;
|
|
317
|
+
fps?: number;
|
|
318
|
+
backgroundColor?: string;
|
|
319
|
+
}
|
|
320
|
+
interface TextTemplateDocument {
|
|
321
|
+
id: string;
|
|
322
|
+
kind: typeof TEXT_TEMPLATE_KIND;
|
|
323
|
+
schemaVersion: typeof TEXT_TEMPLATE_SCHEMA_VERSION;
|
|
324
|
+
templateVersion: 1;
|
|
325
|
+
canvas: TextTemplateCanvas;
|
|
326
|
+
nodes: TemplateNode[];
|
|
327
|
+
variables?: Record<string, TemplateVariableDefinition>;
|
|
328
|
+
}
|
|
329
|
+
interface TextTemplateArtifact {
|
|
330
|
+
kind: typeof TEXT_TEMPLATE_KIND;
|
|
331
|
+
schemaVersion: typeof TEXT_TEMPLATE_SCHEMA_VERSION;
|
|
332
|
+
metadata: TemplateMetadata;
|
|
333
|
+
document: TextTemplateDocument;
|
|
334
|
+
controls: TemplateControl[];
|
|
335
|
+
timing: TemplateTiming;
|
|
336
|
+
dependencies: TemplateDependencyManifest;
|
|
337
|
+
revision: TemplateRevision;
|
|
338
|
+
previews?: TemplatePreviewArtifacts;
|
|
339
|
+
}
|
|
340
|
+
interface TextTemplateClip {
|
|
341
|
+
kind: "text-template";
|
|
342
|
+
templateId: string;
|
|
343
|
+
revisionId: string;
|
|
344
|
+
contentHash: string;
|
|
345
|
+
templateSnapshot: TextTemplateArtifact;
|
|
346
|
+
controlValues: Record<string, unknown>;
|
|
347
|
+
dependencySnapshot: TemplateDependencyManifest;
|
|
348
|
+
}
|
|
349
|
+
type TemplateRenderTarget = "studio" | "editor" | "export";
|
|
350
|
+
interface TemplateRenderContext {
|
|
351
|
+
time: number;
|
|
352
|
+
target: TemplateRenderTarget;
|
|
353
|
+
controlValues?: Record<string, unknown>;
|
|
354
|
+
clipDuration?: number;
|
|
355
|
+
runtime?: Record<string, unknown> & {
|
|
356
|
+
/** Host-provided font measurement used for deterministic auto layout. */
|
|
357
|
+
measureText?: (text: string, style: TemplateTextNodeStyle) => {
|
|
358
|
+
width: number;
|
|
359
|
+
height?: number;
|
|
360
|
+
};
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
interface CompiledTemplateRenderLayer {
|
|
364
|
+
id: string;
|
|
365
|
+
type: string;
|
|
366
|
+
parentId?: string;
|
|
367
|
+
x: number;
|
|
368
|
+
y: number;
|
|
369
|
+
width: number;
|
|
370
|
+
height: number;
|
|
371
|
+
rotation: number;
|
|
372
|
+
opacity: number;
|
|
373
|
+
visible: boolean;
|
|
374
|
+
text?: string;
|
|
375
|
+
assetId?: string;
|
|
376
|
+
mediaUrl?: string;
|
|
377
|
+
style?: Record<string, unknown>;
|
|
378
|
+
content?: Record<string, unknown>;
|
|
379
|
+
}
|
|
380
|
+
interface TemplateCapabilityReport {
|
|
381
|
+
status: "exact" | "degraded" | "unsupported";
|
|
382
|
+
unsupportedFeatures: string[];
|
|
383
|
+
warnings: string[];
|
|
384
|
+
}
|
|
385
|
+
interface EvaluatedTemplateScene {
|
|
386
|
+
nodes: CompiledTemplateRenderLayer[];
|
|
387
|
+
diagnostics: Array<{
|
|
388
|
+
level: "error" | "warning" | "info";
|
|
389
|
+
code: string;
|
|
390
|
+
message: string;
|
|
391
|
+
nodeId?: string;
|
|
392
|
+
}>;
|
|
393
|
+
}
|
|
394
|
+
interface CompiledTextTemplate {
|
|
395
|
+
kind: typeof TEXT_TEMPLATE_KIND;
|
|
396
|
+
templateId: string;
|
|
397
|
+
revisionId: string;
|
|
398
|
+
contentHash: string;
|
|
399
|
+
width: number;
|
|
400
|
+
height: number;
|
|
401
|
+
duration: number;
|
|
402
|
+
fps: number;
|
|
403
|
+
time: number;
|
|
404
|
+
evaluatedScene: EvaluatedTemplateScene;
|
|
405
|
+
resolvedControls: Record<string, unknown>;
|
|
406
|
+
layers: CompiledTemplateRenderLayer[];
|
|
407
|
+
dependencies: TemplateDependencyManifest;
|
|
408
|
+
capabilities: Record<TemplateRenderTarget, TemplateCapabilityReport>;
|
|
409
|
+
diagnostics: Array<{
|
|
410
|
+
level: "error" | "warning" | "info";
|
|
411
|
+
code: string;
|
|
412
|
+
message: string;
|
|
413
|
+
nodeId?: string;
|
|
414
|
+
}>;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
type RenderEnvironment = "studio" | "editor" | "export" | "thumbnail" | "preview";
|
|
418
|
+
type RenderCapability = "text-effect" | "text-template";
|
|
419
|
+
interface CanonicalRenderContext {
|
|
420
|
+
environment: RenderEnvironment;
|
|
421
|
+
time: number;
|
|
422
|
+
width?: number;
|
|
423
|
+
height?: number;
|
|
424
|
+
clipDuration?: number;
|
|
425
|
+
controlValues?: Record<string, unknown>;
|
|
426
|
+
/** Runtime services are intentionally opaque to the package contract. */
|
|
427
|
+
runtime?: Record<string, unknown>;
|
|
428
|
+
}
|
|
429
|
+
interface RenderDiagnostics {
|
|
430
|
+
level: "info" | "warning" | "error";
|
|
431
|
+
code: string;
|
|
432
|
+
message: string;
|
|
433
|
+
capability?: RenderCapability;
|
|
434
|
+
nodeId?: string;
|
|
435
|
+
}
|
|
436
|
+
interface RenderIdentity {
|
|
437
|
+
capability: RenderCapability;
|
|
438
|
+
revisionId?: string;
|
|
439
|
+
contentHash?: string;
|
|
440
|
+
rendererVersion: string;
|
|
441
|
+
}
|
|
442
|
+
interface CanonicalRenderResult extends RenderIdentity {
|
|
443
|
+
diagnostics: RenderDiagnostics[];
|
|
444
|
+
usedDependencies: string[];
|
|
445
|
+
/** The compiled plan is present for templates and omitted for effects. */
|
|
446
|
+
compiledTemplate?: CompiledTextTemplate;
|
|
447
|
+
}
|
|
448
|
+
interface TextTemplateRenderInput {
|
|
449
|
+
artifact: TextTemplateArtifact;
|
|
450
|
+
context: CanonicalRenderContext;
|
|
451
|
+
}
|
|
452
|
+
interface TextEffectRenderInput {
|
|
453
|
+
/** A scene, a published definition containing scene, or a legacy config. */
|
|
454
|
+
source: SceneDocument | {
|
|
455
|
+
scene?: SceneDocument;
|
|
456
|
+
config?: unknown;
|
|
457
|
+
} | unknown;
|
|
458
|
+
context: CanonicalRenderContext;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
type CanvasLike$1 = CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
|
|
462
|
+
/** Shared effect renderer adapter used by source preview, timeline and export. */
|
|
463
|
+
declare function renderTextEffectToCanvas(ctx: CanvasLike$1, input: TextEffectRenderInput): CanonicalRenderResult;
|
|
464
|
+
|
|
465
|
+
type CanvasLike = CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
|
|
466
|
+
/**
|
|
467
|
+
* Resolve a template from all transport envelopes used by the app. This is
|
|
468
|
+
* the only place where legacy `lottieData`/`elements` compatibility belongs.
|
|
469
|
+
* Summary records intentionally return null: they are not renderable assets.
|
|
470
|
+
*/
|
|
471
|
+
declare function resolveTextTemplateArtifact(input: unknown, options?: {
|
|
472
|
+
allowLegacy?: boolean;
|
|
473
|
+
}): TextTemplateArtifact | null;
|
|
474
|
+
declare function getTextTemplateControls(input: unknown): TextTemplateArtifact["controls"];
|
|
475
|
+
declare function renderTextTemplateToCanvas(ctx: CanvasLike, input: TextTemplateRenderInput): CanonicalRenderResult;
|
|
476
|
+
|
|
477
|
+
type CanonicalRenderInput = {
|
|
478
|
+
capability: "text-template";
|
|
479
|
+
artifact: unknown;
|
|
480
|
+
context: CanonicalRenderContext;
|
|
481
|
+
} | {
|
|
482
|
+
capability: "text-effect";
|
|
483
|
+
source: unknown;
|
|
484
|
+
context: CanonicalRenderContext;
|
|
485
|
+
};
|
|
486
|
+
/** Extensible capability registry for all package-owned render semantics. */
|
|
487
|
+
declare function renderCanonicalToCanvas(ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, input: CanonicalRenderInput): CanonicalRenderResult;
|
|
488
|
+
|
|
489
|
+
export { type TextEffectRenderInput as $, type TemplateControlType as A, type TemplateDependencyManifest as B, type CompiledTextTemplate as C, type TemplateDurationPolicy as D, type EvaluatedTemplateScene as E, type TemplateFontRef as F, type TemplateImageNode as G, type TemplateLayerV2 as H, type TemplateMetadata as I, type TemplateNode as J, type TemplateNodeAnimation as K, type TemplatePreviewArtifacts as L, type TemplatePropertyKeyframes as M, type TemplateProtectedRegion as N, type TemplateRenderTarget as O, type PublishedRevision as P, type TemplateRevision as Q, type RenderPlan as R, type SceneDocumentV2 as S, type TextTemplateArtifact as T, type TemplateShapeNode as U, type TemplateShapeNodeStyle as V, type TemplateStyleRef as W, type TemplateTextNode as X, type TemplateTextNodeStyle as Y, type TemplateTimelineMarker as Z, type TemplateTiming as _, type TemplateRenderContext as a, type TextTemplateCanvas as a0, type TextTemplateClip as a1, type TextTemplateDocument as a2, type TextTemplateDocumentV2 as a3, type TextTemplateFlexLayout as a4, type TextTemplateRenderInput as a5, canonicalContentHash as a6, canonicalizeSceneDocument as a7, evaluateTextEffect as a8, evaluateTextTemplate as a9, getRenderCapabilities as aa, getTextTemplateControls as ab, normalizeTextEffect as ac, normalizeTextTemplate as ad, renderCanonicalToCanvas as ae, renderTextEffectToCanvas as af, renderTextTemplateToCanvas as ag, resolveTextTemplateArtifact as ah, CANONICAL_RENDERER_VERSION as b, CANONICAL_SCHEMA_VERSION as c, type CanonicalRenderContext as d, type CanonicalRenderInput as e, type CanonicalRenderResult as f, type CapabilityReport as g, type CapabilityStatus as h, type CompiledTemplateRenderLayer as i, type RenderCapability as j, type RenderDiagnostic as k, type RenderDiagnostics as l, type RenderEnvironment as m, type RenderIdentity as n, type RenderTarget as o, TEXT_TEMPLATE_KIND as p, TEXT_TEMPLATE_RENDERER_VERSION as q, TEXT_TEMPLATE_SCHEMA_VERSION as r, type TemplateAssetRef as s, type TemplateBackgroundPanel as t, type TemplateCapabilityReport as u, type TemplateContainerNode as v, type TemplateContainerNodeStyle as w, type TemplateControl as x, type TemplateControlConstraints as y, type TemplateControlOption as z };
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { f as TextEffectConfig, P as Preset, h as TextEffectDefinition, N as EvaluatedTextLayer, S as SceneDocument } from './types-IYwXGYkB.cjs';
|
|
2
|
+
|
|
3
|
+
declare function renderTextEffectCore(ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, cfg: TextEffectConfig): void;
|
|
4
|
+
declare class TextEffectRenderer {
|
|
5
|
+
static draw(ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, cfg: TextEffectConfig, _time?: number): void;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** Style recipes (layer graphs): see `builtInRecipes` in src/engine/recipes.ts */
|
|
9
|
+
declare const defaultConfig: TextEffectConfig;
|
|
10
|
+
/**
|
|
11
|
+
* Return a fresh, explicit blank authoring state.
|
|
12
|
+
*
|
|
13
|
+
* A blank state is intentionally different from a loosely spread object:
|
|
14
|
+
* every optional visual contributor is disabled while its parameters remain
|
|
15
|
+
* present for the controls and the canonical scene migration. This prevents
|
|
16
|
+
* object presence (panel/glow/shadow/etc.) from being interpreted as active.
|
|
17
|
+
*/
|
|
18
|
+
declare function createBlankTextEffectConfig(): TextEffectConfig;
|
|
19
|
+
declare const builtInPresets: Preset[];
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Font Loader for Lottie-web
|
|
23
|
+
*
|
|
24
|
+
* This module ensures that font variant names (like "Poppins-Italic") work correctly
|
|
25
|
+
* with lottie-web by dynamically creating @font-face rules that map variant names
|
|
26
|
+
* to the actual loaded fonts with proper styling.
|
|
27
|
+
*/
|
|
28
|
+
interface FontVariant {
|
|
29
|
+
variantName: string;
|
|
30
|
+
baseFontFamily: string;
|
|
31
|
+
weight: number;
|
|
32
|
+
style: "normal" | "italic";
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Injects @font-face rules dynamically to create font variant aliases
|
|
36
|
+
* This ensures lottie-web can find fonts by their variant names
|
|
37
|
+
*/
|
|
38
|
+
declare function injectFontVariantRules(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Waits for base fonts to load, then injects variant rules
|
|
41
|
+
*/
|
|
42
|
+
declare function initializeFontSystem(): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Checks if a font variant is available for rendering.
|
|
45
|
+
* Uses document.fonts.check() which is the correct API for font availability —
|
|
46
|
+
* unlike measureText() which silently falls back to the system font and always
|
|
47
|
+
* returns a non-zero width regardless of whether the named font loaded.
|
|
48
|
+
*/
|
|
49
|
+
declare function checkFontVariant(variantName: string): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Font descriptor for loading.
|
|
52
|
+
*/
|
|
53
|
+
interface FontDescriptor {
|
|
54
|
+
family: string;
|
|
55
|
+
weight?: string | number;
|
|
56
|
+
style?: "normal" | "italic";
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Font loading result.
|
|
60
|
+
*/
|
|
61
|
+
interface FontLoadResult {
|
|
62
|
+
font: FontDescriptor;
|
|
63
|
+
loaded: boolean;
|
|
64
|
+
error?: string;
|
|
65
|
+
loadTimeMs: number;
|
|
66
|
+
}
|
|
67
|
+
declare class FontLoader {
|
|
68
|
+
private state;
|
|
69
|
+
ensureFont(descriptor: FontDescriptor): Promise<FontLoadResult>;
|
|
70
|
+
ensureFonts(descriptors: FontDescriptor[]): Promise<FontLoadResult[]>;
|
|
71
|
+
waitForFontsReady(): Promise<void>;
|
|
72
|
+
isLoaded(descriptor: FontDescriptor): boolean;
|
|
73
|
+
getStats(): {
|
|
74
|
+
loaded: number;
|
|
75
|
+
loading: number;
|
|
76
|
+
failed: number;
|
|
77
|
+
};
|
|
78
|
+
clear(): void;
|
|
79
|
+
private loadFont;
|
|
80
|
+
private getFontKey;
|
|
81
|
+
private normalizeFontWeight;
|
|
82
|
+
}
|
|
83
|
+
declare function getFontLoader(): FontLoader;
|
|
84
|
+
declare function resetFontLoader(): void;
|
|
85
|
+
declare function ensureFontsLoaded(descriptors: FontDescriptor[]): Promise<FontLoadResult[]>;
|
|
86
|
+
|
|
87
|
+
/** Lossless migration from flat TextEffectConfig to SceneDocument */
|
|
88
|
+
declare function textEffectConfigToScene(cfg: TextEffectConfig): SceneDocument;
|
|
89
|
+
/** Flatten SceneDocument back to TextEffectConfig for legacy controls and renderer */
|
|
90
|
+
declare function sceneToConfig(doc: SceneDocument): TextEffectConfig;
|
|
91
|
+
declare function syncCompositorFromScene(doc: SceneDocument): CompositorFromScene;
|
|
92
|
+
interface CompositorFromScene {
|
|
93
|
+
blur: number;
|
|
94
|
+
bloom: number;
|
|
95
|
+
bloomThreshold: number;
|
|
96
|
+
}
|
|
97
|
+
/** Apply engine params from scene onto config without require() */
|
|
98
|
+
declare function mergeSceneIntoConfig(doc: SceneDocument, base: TextEffectConfig): TextEffectConfig;
|
|
99
|
+
declare function resolveFontFamilyName(fontFamily: string): string;
|
|
100
|
+
declare function _buildConfig(effect: TextEffectDefinition, text: string, fontSize: number, canvasWidth: number, canvasHeight: number, time?: number, clipStartTime?: number, clipDuration?: number): TextEffectConfig & {
|
|
101
|
+
width: number;
|
|
102
|
+
height: number;
|
|
103
|
+
};
|
|
104
|
+
declare function layerToTextEffectConfig(layer: EvaluatedTextLayer): TextEffectConfig & {
|
|
105
|
+
width: number;
|
|
106
|
+
height: number;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
interface EvaluateOptions {
|
|
110
|
+
skipPostFx?: boolean;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Single source of truth for rendering a scene at time t.
|
|
114
|
+
*/
|
|
115
|
+
declare function evaluateScene(doc: SceneDocument, time: number, ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, options?: EvaluateOptions): void;
|
|
116
|
+
declare function evaluateConfig(cfg: TextEffectConfig, time: number, ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, options?: EvaluateOptions): void;
|
|
117
|
+
declare function advanceSceneTime(doc: SceneDocument, steps: number): number;
|
|
118
|
+
declare function getSceneTime(doc: SceneDocument): number;
|
|
119
|
+
declare function setSceneTime(doc: SceneDocument, time: number): void;
|
|
120
|
+
declare function resetSceneTime(doc: SceneDocument): void;
|
|
121
|
+
|
|
122
|
+
export { type CompositorFromScene as C, type EvaluateOptions as E, type FontDescriptor as F, TextEffectRenderer as T, _buildConfig as _, type FontLoadResult as a, FontLoader as b, type FontVariant as c, advanceSceneTime as d, builtInPresets as e, checkFontVariant as f, createBlankTextEffectConfig as g, defaultConfig as h, ensureFontsLoaded as i, evaluateConfig as j, evaluateScene as k, getFontLoader as l, getSceneTime as m, initializeFontSystem as n, injectFontVariantRules as o, layerToTextEffectConfig as p, mergeSceneIntoConfig as q, renderTextEffectCore as r, resetFontLoader as s, resetSceneTime as t, resolveFontFamilyName as u, sceneToConfig as v, setSceneTime as w, syncCompositorFromScene as x, textEffectConfigToScene as y };
|