@clypra/engine 1.1.1 → 1.1.2
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.cjs +413 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +157 -1
- package/dist/index.d.ts +157 -1
- package/dist/index.js +405 -35
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -202,6 +202,96 @@ interface Preset {
|
|
|
202
202
|
category?: "3d" | "Neon" | "Metallic" | "Glitch" | "Retro" | "Gradient" | "Grunge" | "Outline" | "Shadow" | "Elements" | "Luxury" | "Classic" | "Experimental" | string;
|
|
203
203
|
createdAt?: number;
|
|
204
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 EffectFullDefinition extends EffectIndexItem {
|
|
219
|
+
version?: string;
|
|
220
|
+
description: string;
|
|
221
|
+
tags: string[];
|
|
222
|
+
font: {
|
|
223
|
+
family: string;
|
|
224
|
+
weight: number;
|
|
225
|
+
style: "normal" | "italic";
|
|
226
|
+
letterSpacing: number;
|
|
227
|
+
lineHeight: number;
|
|
228
|
+
};
|
|
229
|
+
fills: any[];
|
|
230
|
+
strokes: any[];
|
|
231
|
+
shadows: any[];
|
|
232
|
+
bevel?: any;
|
|
233
|
+
glow?: any;
|
|
234
|
+
glows?: any[];
|
|
235
|
+
panel?: any;
|
|
236
|
+
glitch?: any;
|
|
237
|
+
animation?: {
|
|
238
|
+
type: "none" | "typewriter" | "wave" | "fade" | "glitch";
|
|
239
|
+
speed?: number;
|
|
240
|
+
amplitude?: number;
|
|
241
|
+
frequency?: number;
|
|
242
|
+
};
|
|
243
|
+
background?: any;
|
|
244
|
+
stack?: any;
|
|
245
|
+
}
|
|
246
|
+
interface TextEffectDefinition extends EffectFullDefinition {
|
|
247
|
+
text?: string;
|
|
248
|
+
description: string;
|
|
249
|
+
tags: string[];
|
|
250
|
+
}
|
|
251
|
+
interface EvaluatedTextLayer {
|
|
252
|
+
readonly layerId: string;
|
|
253
|
+
readonly clipId: string;
|
|
254
|
+
readonly role: string;
|
|
255
|
+
readonly zIndex: number;
|
|
256
|
+
readonly layerType: "text";
|
|
257
|
+
readonly x: number;
|
|
258
|
+
readonly y: number;
|
|
259
|
+
readonly width: number;
|
|
260
|
+
readonly height: number;
|
|
261
|
+
readonly rotation: number;
|
|
262
|
+
readonly opacity: number;
|
|
263
|
+
readonly inTransition: boolean;
|
|
264
|
+
readonly blendMode: string;
|
|
265
|
+
readonly time?: number;
|
|
266
|
+
readonly clipStartTime?: number;
|
|
267
|
+
readonly clipDuration?: number;
|
|
268
|
+
readonly text: string;
|
|
269
|
+
readonly fontFamily: string;
|
|
270
|
+
readonly fontSize: number;
|
|
271
|
+
readonly color: string;
|
|
272
|
+
readonly fontWeight: "normal" | "bold" | number;
|
|
273
|
+
readonly fontStyle: "normal" | "italic";
|
|
274
|
+
readonly textAlign: "left" | "center" | "right";
|
|
275
|
+
readonly verticalAlign: "top" | "middle" | "bottom";
|
|
276
|
+
readonly lineHeight: number;
|
|
277
|
+
readonly letterSpacing: number;
|
|
278
|
+
readonly stroke?: {
|
|
279
|
+
color: string;
|
|
280
|
+
width: number;
|
|
281
|
+
};
|
|
282
|
+
readonly shadow?: {
|
|
283
|
+
color: string;
|
|
284
|
+
blur: number;
|
|
285
|
+
offsetX: number;
|
|
286
|
+
offsetY: number;
|
|
287
|
+
};
|
|
288
|
+
readonly background?: {
|
|
289
|
+
color: string;
|
|
290
|
+
padding: number;
|
|
291
|
+
borderRadius: number;
|
|
292
|
+
};
|
|
293
|
+
readonly styleId?: string;
|
|
294
|
+
}
|
|
205
295
|
|
|
206
296
|
declare function renderTextEffectCore(ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, cfg: TextEffectConfig): void;
|
|
207
297
|
declare class TextEffectRenderer {
|
|
@@ -241,6 +331,42 @@ declare function initializeFontSystem(): Promise<void>;
|
|
|
241
331
|
* returns a non-zero width regardless of whether the named font loaded.
|
|
242
332
|
*/
|
|
243
333
|
declare function checkFontVariant(variantName: string): boolean;
|
|
334
|
+
/**
|
|
335
|
+
* Font descriptor for loading.
|
|
336
|
+
*/
|
|
337
|
+
interface FontDescriptor {
|
|
338
|
+
family: string;
|
|
339
|
+
weight?: string | number;
|
|
340
|
+
style?: "normal" | "italic";
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Font loading result.
|
|
344
|
+
*/
|
|
345
|
+
interface FontLoadResult {
|
|
346
|
+
font: FontDescriptor;
|
|
347
|
+
loaded: boolean;
|
|
348
|
+
error?: string;
|
|
349
|
+
loadTimeMs: number;
|
|
350
|
+
}
|
|
351
|
+
declare class FontLoader {
|
|
352
|
+
private state;
|
|
353
|
+
ensureFont(descriptor: FontDescriptor): Promise<FontLoadResult>;
|
|
354
|
+
ensureFonts(descriptors: FontDescriptor[]): Promise<FontLoadResult[]>;
|
|
355
|
+
waitForFontsReady(): Promise<void>;
|
|
356
|
+
isLoaded(descriptor: FontDescriptor): boolean;
|
|
357
|
+
getStats(): {
|
|
358
|
+
loaded: number;
|
|
359
|
+
loading: number;
|
|
360
|
+
failed: number;
|
|
361
|
+
};
|
|
362
|
+
clear(): void;
|
|
363
|
+
private loadFont;
|
|
364
|
+
private getFontKey;
|
|
365
|
+
private normalizeFontWeight;
|
|
366
|
+
}
|
|
367
|
+
declare function getFontLoader(): FontLoader;
|
|
368
|
+
declare function resetFontLoader(): void;
|
|
369
|
+
declare function ensureFontsLoaded(descriptors: FontDescriptor[]): Promise<FontLoadResult[]>;
|
|
244
370
|
|
|
245
371
|
declare function resolveCustomEngineId(cfg: TextEffectConfig): CustomEngineId | null;
|
|
246
372
|
/** Lossless migration from flat TextEffectConfig to SceneDocument */
|
|
@@ -255,6 +381,15 @@ interface CompositorFromScene {
|
|
|
255
381
|
}
|
|
256
382
|
/** Apply engine params from scene onto config without require() */
|
|
257
383
|
declare function mergeSceneIntoConfig(doc: SceneDocument, base: TextEffectConfig): TextEffectConfig;
|
|
384
|
+
declare function resolveFontFamilyName(fontFamily: string): string;
|
|
385
|
+
declare function _buildConfig(effect: TextEffectDefinition, text: string, fontSize: number, canvasWidth: number, canvasHeight: number, time?: number, clipStartTime?: number, clipDuration?: number): TextEffectConfig & {
|
|
386
|
+
width: number;
|
|
387
|
+
height: number;
|
|
388
|
+
};
|
|
389
|
+
declare function layerToTextEffectConfig(layer: EvaluatedTextLayer): TextEffectConfig & {
|
|
390
|
+
width: number;
|
|
391
|
+
height: number;
|
|
392
|
+
};
|
|
258
393
|
|
|
259
394
|
declare class WebGLCompositor {
|
|
260
395
|
private gl;
|
|
@@ -974,6 +1109,27 @@ declare function releaseCanvas(canvas: HTMLCanvasElement | OffscreenCanvas): voi
|
|
|
974
1109
|
* Reset all cached capability flags (for testing only).
|
|
975
1110
|
*/
|
|
976
1111
|
declare function _resetPlatformCache(): void;
|
|
1112
|
+
/**
|
|
1113
|
+
* Unified resource allocator and manager for OffscreenCanvas and DOM Canvas pools.
|
|
1114
|
+
* Prevents GC thrashing and backing store leaks across WKWebView and standard browsers.
|
|
1115
|
+
*/
|
|
1116
|
+
declare class CanvasDevice {
|
|
1117
|
+
private static canvases;
|
|
1118
|
+
private static maxPoolSize;
|
|
1119
|
+
/**
|
|
1120
|
+
* Acquire a Canvas context from the pool or create a new one.
|
|
1121
|
+
* If a canvas is pulled from the pool, it is resized to the target dimensions.
|
|
1122
|
+
*/
|
|
1123
|
+
static acquire(width: number, height: number): HTMLCanvasElement | OffscreenCanvas;
|
|
1124
|
+
/**
|
|
1125
|
+
* Release a canvas back to the pool, or free its resources immediately if pool is full.
|
|
1126
|
+
*/
|
|
1127
|
+
static release(canvas: HTMLCanvasElement | OffscreenCanvas): void;
|
|
1128
|
+
/**
|
|
1129
|
+
* Disposes all pooled canvases to release GPU/memory backing stores.
|
|
1130
|
+
*/
|
|
1131
|
+
static clearPool(): void;
|
|
1132
|
+
}
|
|
977
1133
|
|
|
978
1134
|
/**
|
|
979
1135
|
* Canvas 2D utility helpers
|
|
@@ -1027,4 +1183,4 @@ declare class InkBrushEngine {
|
|
|
1027
1183
|
drawFrame(ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1028
1184
|
}
|
|
1029
1185
|
|
|
1030
|
-
export { type AnimBuildOpts, type AnimKeyframe, type AnimTrack, type AnimTrackDef, type AnimatableParamDef, type AnimationCategory, type BatchInjection, COMPOSITION_PRESETS, CUSTOM_ENGINE_IDS, type CompositionPreset, type CompositorFromScene, type CompositorSettings, type CustomEngineId, DEFAULT_CANVAS_HEIGHT, DEFAULT_CANVAS_WIDTH, DEFAULT_DURATION, DEFAULT_FONT_SIZE, DEFAULT_FPS, DEFAULT_TEXT_STYLE, type DotLottieManifest, type DrawPerCharTextOptions, EMPHASIS_PRESETS, ENGINE_ID_TO_LEGACY, ENTRANCE_PRESETS, EXIT_PRESETS, type EasingControlPoint, type EffectLayer, type EffectLayerType, type EvaluateOptions, FONT_WEIGHT_OPTIONS, type FillType, type FontVariant, type GifExportOptions, type GifFrame, type GlowLayer, type GradientDir, type GradientStop, InkBrushEngine, type Keyframe, LEGACY_RENDERER_MAP, LOOP_PRESETS, LOTTIE_ANIM_PRESETS, LOTTIE_TEMPLATE_PRESETS, type LayerTarget, type LottieAnimPreset, type LottieFileInfo, type LottieFontEntry, type LottieFontUsage, type LottieGradientStop, type LottieKeyframe, type LottiePropertyPath, type LottieTemplatePreset, type ParsedTextLayer, type PngSequenceFrame, type PngSequenceOptions, type Preset, SCENE_VERSION, SUPPORTED_FONT_FAMILIES, type SceneCanvas, type SceneDocument, type SceneText, type StyleRecipe, TEMPLATE_CATEGORIES, type TemplatePresetCategory, type TextAlign, type TextCustomization, type TextEffectConfig, TextEffectRenderer, type TextLayerConfig, type TextLayerStyle, type TextLayoutBounds, type TextLayoutResult, type TextStyleOverride, type Timeline, WEBM_EXPORT_MAX_FRAMES, WebGLCompositor, type WebMExportOptions, _resetPlatformCache, addImageLayer, addKeyframeAtTime, addOrUpdateKeyframe, addShapeLayer, addSolidLayer, addTextLayer, addTrack, addVectorShape, advanceSceneTime, alignToLottieJ, applyFillColorToAll, applyLetterSpacing, applyMaskReveal, applyRecipeToScene, applyStyleToLottie, applyStyleToLottieLayer, applyTimelineAtTime, bakeAnimationIntoLayer, blendConfigs, blendScenes, buildDotLottie, buildFontEntries, buildLottieFontName, buildPngSequenceZip, builtInPresets, builtInRecipes, captureLottieFrames, checkFontVariant, clearAnimationFromLayer, clearFontCache, clearRecipeCache, cloneSceneWithNewIds, computeAutoFitFontSize, computeFitZoom, computeTextLayout, countTextGlyphs, createBlankLottie, createCanvas, createDefaultRevealTrack, createEmptyScene, createPulseOpacityTrack, defaultConfig, deleteKeyframe, disposeSharedCompositor, downloadDotLottie, downloadLottieJson, downloadPngSequenceZip, downloadSceneWebM, drawPerCharText, drawRoundedRect, duplicateTrackAtPlayhead, ease, enableKeyframing, encodeGif, ensureDefaultTimeline, ensureFontInLottie, evaluateConfig, evaluateScene, findTrackIndex, getAnimPreset, getAnimatableParamDef, getAnimatableParamsForLayer, getDefaultText, getLayerById, getPresetScene, getSceneTime, getSupportedWebMMimeType, getTemplatePreset, getTemplatesByCategory, getWebMFrameCount, hexToLottieColor, hexToLottieRgb, initializeFontSystem, injectBatch, injectColor, injectFontVariantRules, injectGlobalTextStyle, injectSolidColor, injectText, injectTextStyle, isWebMExportSupported, loadLottieFonts, lottieColorToHex, lottieJToAlign, measureTextFits, mergeSceneIntoConfig, moveKeyframe, newLayerId, parseHistorySnapshot, parseLottieJson, preloadGoogleFont, presetToRecipe, pruneTracksForLayer, rainbowCharFillColors, readLayerScalar, readStyleFromLottieLayer, reindexLayers, releaseCanvas, removeKeyframe, removeTrack, renderPngSequence, renderSceneWebM, renderTextEffectCore, resetSceneTime, resizeCharFillColors, resolveAnimatedScalar, resolveCustomEngineId, restoreLetterSpacing, scanLottieFonts, scanTextLayers, sceneToConfig, setCharFillColor, setSceneTime, setTracks, shouldUsePerCharFill, snapshotScene, sortKeyframes, supportsCtxFilter, supportsLetterSpacing, supportsOffscreenCanvas, supportsRoundRect, supportsWebGL2, syncCompositorFromScene, textEffectConfigToScene, trackId, updateKeyframe, updateStaticProperty, updateTimeline, updateTrack, updateTrackMatte, upsertKeyframe, waitForFontsReady, wrapTextToWidth };
|
|
1186
|
+
export { type AnimBuildOpts, type AnimKeyframe, type AnimTrack, type AnimTrackDef, type AnimatableParamDef, type AnimationCategory, type BatchInjection, COMPOSITION_PRESETS, CUSTOM_ENGINE_IDS, CanvasDevice, type CompositionPreset, type CompositorFromScene, type CompositorSettings, type CustomEngineId, DEFAULT_CANVAS_HEIGHT, DEFAULT_CANVAS_WIDTH, DEFAULT_DURATION, DEFAULT_FONT_SIZE, DEFAULT_FPS, DEFAULT_TEXT_STYLE, type DotLottieManifest, type DrawPerCharTextOptions, EMPHASIS_PRESETS, ENGINE_ID_TO_LEGACY, ENTRANCE_PRESETS, EXIT_PRESETS, type EasingControlPoint, type EffectFullDefinition, type EffectIndexItem, type EffectLayer, type EffectLayerType, type EvaluateOptions, type EvaluatedTextLayer, FONT_WEIGHT_OPTIONS, type FillType, type FontDescriptor, type FontLoadResult, FontLoader, type FontVariant, type GifExportOptions, type GifFrame, type GlowLayer, type GradientDir, type GradientStop, InkBrushEngine, type Keyframe, LEGACY_RENDERER_MAP, LOOP_PRESETS, LOTTIE_ANIM_PRESETS, LOTTIE_TEMPLATE_PRESETS, type LayerTarget, type LottieAnimPreset, type LottieFileInfo, type LottieFontEntry, type LottieFontUsage, type LottieGradientStop, type LottieKeyframe, type LottiePropertyPath, type LottieTemplatePreset, type ParsedTextLayer, type PngSequenceFrame, type PngSequenceOptions, type Preset, SCENE_VERSION, SUPPORTED_FONT_FAMILIES, type SceneCanvas, type SceneDocument, type SceneText, type StyleRecipe, TEMPLATE_CATEGORIES, type TemplatePresetCategory, type TextAlign, type TextCustomization, type TextEffectConfig, type TextEffectDefinition, TextEffectRenderer, type TextLayerConfig, type TextLayerStyle, type TextLayoutBounds, type TextLayoutResult, type TextStyleOverride, type Timeline, WEBM_EXPORT_MAX_FRAMES, WebGLCompositor, type WebMExportOptions, _buildConfig, _resetPlatformCache, addImageLayer, addKeyframeAtTime, addOrUpdateKeyframe, addShapeLayer, addSolidLayer, addTextLayer, addTrack, addVectorShape, advanceSceneTime, alignToLottieJ, applyFillColorToAll, applyLetterSpacing, applyMaskReveal, applyRecipeToScene, applyStyleToLottie, applyStyleToLottieLayer, applyTimelineAtTime, bakeAnimationIntoLayer, blendConfigs, blendScenes, buildDotLottie, buildFontEntries, buildLottieFontName, buildPngSequenceZip, builtInPresets, builtInRecipes, captureLottieFrames, checkFontVariant, clearAnimationFromLayer, clearFontCache, clearRecipeCache, cloneSceneWithNewIds, computeAutoFitFontSize, computeFitZoom, computeTextLayout, countTextGlyphs, createBlankLottie, createCanvas, createDefaultRevealTrack, createEmptyScene, createPulseOpacityTrack, defaultConfig, deleteKeyframe, disposeSharedCompositor, downloadDotLottie, downloadLottieJson, downloadPngSequenceZip, downloadSceneWebM, drawPerCharText, drawRoundedRect, duplicateTrackAtPlayhead, ease, enableKeyframing, encodeGif, ensureDefaultTimeline, ensureFontInLottie, ensureFontsLoaded, evaluateConfig, evaluateScene, findTrackIndex, getAnimPreset, getAnimatableParamDef, getAnimatableParamsForLayer, getDefaultText, getFontLoader, getLayerById, getPresetScene, getSceneTime, getSupportedWebMMimeType, getTemplatePreset, getTemplatesByCategory, getWebMFrameCount, hexToLottieColor, hexToLottieRgb, initializeFontSystem, injectBatch, injectColor, injectFontVariantRules, injectGlobalTextStyle, injectSolidColor, injectText, injectTextStyle, isWebMExportSupported, layerToTextEffectConfig, loadLottieFonts, lottieColorToHex, lottieJToAlign, measureTextFits, mergeSceneIntoConfig, moveKeyframe, newLayerId, parseHistorySnapshot, parseLottieJson, preloadGoogleFont, presetToRecipe, pruneTracksForLayer, rainbowCharFillColors, readLayerScalar, readStyleFromLottieLayer, reindexLayers, releaseCanvas, removeKeyframe, removeTrack, renderPngSequence, renderSceneWebM, renderTextEffectCore, resetFontLoader, resetSceneTime, resizeCharFillColors, resolveAnimatedScalar, resolveCustomEngineId, resolveFontFamilyName, restoreLetterSpacing, scanLottieFonts, scanTextLayers, sceneToConfig, setCharFillColor, setSceneTime, setTracks, shouldUsePerCharFill, snapshotScene, sortKeyframes, supportsCtxFilter, supportsLetterSpacing, supportsOffscreenCanvas, supportsRoundRect, supportsWebGL2, syncCompositorFromScene, textEffectConfigToScene, trackId, updateKeyframe, updateStaticProperty, updateTimeline, updateTrack, updateTrackMatte, upsertKeyframe, waitForFontsReady, wrapTextToWidth };
|
package/dist/index.d.ts
CHANGED
|
@@ -202,6 +202,96 @@ interface Preset {
|
|
|
202
202
|
category?: "3d" | "Neon" | "Metallic" | "Glitch" | "Retro" | "Gradient" | "Grunge" | "Outline" | "Shadow" | "Elements" | "Luxury" | "Classic" | "Experimental" | string;
|
|
203
203
|
createdAt?: number;
|
|
204
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 EffectFullDefinition extends EffectIndexItem {
|
|
219
|
+
version?: string;
|
|
220
|
+
description: string;
|
|
221
|
+
tags: string[];
|
|
222
|
+
font: {
|
|
223
|
+
family: string;
|
|
224
|
+
weight: number;
|
|
225
|
+
style: "normal" | "italic";
|
|
226
|
+
letterSpacing: number;
|
|
227
|
+
lineHeight: number;
|
|
228
|
+
};
|
|
229
|
+
fills: any[];
|
|
230
|
+
strokes: any[];
|
|
231
|
+
shadows: any[];
|
|
232
|
+
bevel?: any;
|
|
233
|
+
glow?: any;
|
|
234
|
+
glows?: any[];
|
|
235
|
+
panel?: any;
|
|
236
|
+
glitch?: any;
|
|
237
|
+
animation?: {
|
|
238
|
+
type: "none" | "typewriter" | "wave" | "fade" | "glitch";
|
|
239
|
+
speed?: number;
|
|
240
|
+
amplitude?: number;
|
|
241
|
+
frequency?: number;
|
|
242
|
+
};
|
|
243
|
+
background?: any;
|
|
244
|
+
stack?: any;
|
|
245
|
+
}
|
|
246
|
+
interface TextEffectDefinition extends EffectFullDefinition {
|
|
247
|
+
text?: string;
|
|
248
|
+
description: string;
|
|
249
|
+
tags: string[];
|
|
250
|
+
}
|
|
251
|
+
interface EvaluatedTextLayer {
|
|
252
|
+
readonly layerId: string;
|
|
253
|
+
readonly clipId: string;
|
|
254
|
+
readonly role: string;
|
|
255
|
+
readonly zIndex: number;
|
|
256
|
+
readonly layerType: "text";
|
|
257
|
+
readonly x: number;
|
|
258
|
+
readonly y: number;
|
|
259
|
+
readonly width: number;
|
|
260
|
+
readonly height: number;
|
|
261
|
+
readonly rotation: number;
|
|
262
|
+
readonly opacity: number;
|
|
263
|
+
readonly inTransition: boolean;
|
|
264
|
+
readonly blendMode: string;
|
|
265
|
+
readonly time?: number;
|
|
266
|
+
readonly clipStartTime?: number;
|
|
267
|
+
readonly clipDuration?: number;
|
|
268
|
+
readonly text: string;
|
|
269
|
+
readonly fontFamily: string;
|
|
270
|
+
readonly fontSize: number;
|
|
271
|
+
readonly color: string;
|
|
272
|
+
readonly fontWeight: "normal" | "bold" | number;
|
|
273
|
+
readonly fontStyle: "normal" | "italic";
|
|
274
|
+
readonly textAlign: "left" | "center" | "right";
|
|
275
|
+
readonly verticalAlign: "top" | "middle" | "bottom";
|
|
276
|
+
readonly lineHeight: number;
|
|
277
|
+
readonly letterSpacing: number;
|
|
278
|
+
readonly stroke?: {
|
|
279
|
+
color: string;
|
|
280
|
+
width: number;
|
|
281
|
+
};
|
|
282
|
+
readonly shadow?: {
|
|
283
|
+
color: string;
|
|
284
|
+
blur: number;
|
|
285
|
+
offsetX: number;
|
|
286
|
+
offsetY: number;
|
|
287
|
+
};
|
|
288
|
+
readonly background?: {
|
|
289
|
+
color: string;
|
|
290
|
+
padding: number;
|
|
291
|
+
borderRadius: number;
|
|
292
|
+
};
|
|
293
|
+
readonly styleId?: string;
|
|
294
|
+
}
|
|
205
295
|
|
|
206
296
|
declare function renderTextEffectCore(ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, cfg: TextEffectConfig): void;
|
|
207
297
|
declare class TextEffectRenderer {
|
|
@@ -241,6 +331,42 @@ declare function initializeFontSystem(): Promise<void>;
|
|
|
241
331
|
* returns a non-zero width regardless of whether the named font loaded.
|
|
242
332
|
*/
|
|
243
333
|
declare function checkFontVariant(variantName: string): boolean;
|
|
334
|
+
/**
|
|
335
|
+
* Font descriptor for loading.
|
|
336
|
+
*/
|
|
337
|
+
interface FontDescriptor {
|
|
338
|
+
family: string;
|
|
339
|
+
weight?: string | number;
|
|
340
|
+
style?: "normal" | "italic";
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Font loading result.
|
|
344
|
+
*/
|
|
345
|
+
interface FontLoadResult {
|
|
346
|
+
font: FontDescriptor;
|
|
347
|
+
loaded: boolean;
|
|
348
|
+
error?: string;
|
|
349
|
+
loadTimeMs: number;
|
|
350
|
+
}
|
|
351
|
+
declare class FontLoader {
|
|
352
|
+
private state;
|
|
353
|
+
ensureFont(descriptor: FontDescriptor): Promise<FontLoadResult>;
|
|
354
|
+
ensureFonts(descriptors: FontDescriptor[]): Promise<FontLoadResult[]>;
|
|
355
|
+
waitForFontsReady(): Promise<void>;
|
|
356
|
+
isLoaded(descriptor: FontDescriptor): boolean;
|
|
357
|
+
getStats(): {
|
|
358
|
+
loaded: number;
|
|
359
|
+
loading: number;
|
|
360
|
+
failed: number;
|
|
361
|
+
};
|
|
362
|
+
clear(): void;
|
|
363
|
+
private loadFont;
|
|
364
|
+
private getFontKey;
|
|
365
|
+
private normalizeFontWeight;
|
|
366
|
+
}
|
|
367
|
+
declare function getFontLoader(): FontLoader;
|
|
368
|
+
declare function resetFontLoader(): void;
|
|
369
|
+
declare function ensureFontsLoaded(descriptors: FontDescriptor[]): Promise<FontLoadResult[]>;
|
|
244
370
|
|
|
245
371
|
declare function resolveCustomEngineId(cfg: TextEffectConfig): CustomEngineId | null;
|
|
246
372
|
/** Lossless migration from flat TextEffectConfig to SceneDocument */
|
|
@@ -255,6 +381,15 @@ interface CompositorFromScene {
|
|
|
255
381
|
}
|
|
256
382
|
/** Apply engine params from scene onto config without require() */
|
|
257
383
|
declare function mergeSceneIntoConfig(doc: SceneDocument, base: TextEffectConfig): TextEffectConfig;
|
|
384
|
+
declare function resolveFontFamilyName(fontFamily: string): string;
|
|
385
|
+
declare function _buildConfig(effect: TextEffectDefinition, text: string, fontSize: number, canvasWidth: number, canvasHeight: number, time?: number, clipStartTime?: number, clipDuration?: number): TextEffectConfig & {
|
|
386
|
+
width: number;
|
|
387
|
+
height: number;
|
|
388
|
+
};
|
|
389
|
+
declare function layerToTextEffectConfig(layer: EvaluatedTextLayer): TextEffectConfig & {
|
|
390
|
+
width: number;
|
|
391
|
+
height: number;
|
|
392
|
+
};
|
|
258
393
|
|
|
259
394
|
declare class WebGLCompositor {
|
|
260
395
|
private gl;
|
|
@@ -974,6 +1109,27 @@ declare function releaseCanvas(canvas: HTMLCanvasElement | OffscreenCanvas): voi
|
|
|
974
1109
|
* Reset all cached capability flags (for testing only).
|
|
975
1110
|
*/
|
|
976
1111
|
declare function _resetPlatformCache(): void;
|
|
1112
|
+
/**
|
|
1113
|
+
* Unified resource allocator and manager for OffscreenCanvas and DOM Canvas pools.
|
|
1114
|
+
* Prevents GC thrashing and backing store leaks across WKWebView and standard browsers.
|
|
1115
|
+
*/
|
|
1116
|
+
declare class CanvasDevice {
|
|
1117
|
+
private static canvases;
|
|
1118
|
+
private static maxPoolSize;
|
|
1119
|
+
/**
|
|
1120
|
+
* Acquire a Canvas context from the pool or create a new one.
|
|
1121
|
+
* If a canvas is pulled from the pool, it is resized to the target dimensions.
|
|
1122
|
+
*/
|
|
1123
|
+
static acquire(width: number, height: number): HTMLCanvasElement | OffscreenCanvas;
|
|
1124
|
+
/**
|
|
1125
|
+
* Release a canvas back to the pool, or free its resources immediately if pool is full.
|
|
1126
|
+
*/
|
|
1127
|
+
static release(canvas: HTMLCanvasElement | OffscreenCanvas): void;
|
|
1128
|
+
/**
|
|
1129
|
+
* Disposes all pooled canvases to release GPU/memory backing stores.
|
|
1130
|
+
*/
|
|
1131
|
+
static clearPool(): void;
|
|
1132
|
+
}
|
|
977
1133
|
|
|
978
1134
|
/**
|
|
979
1135
|
* Canvas 2D utility helpers
|
|
@@ -1027,4 +1183,4 @@ declare class InkBrushEngine {
|
|
|
1027
1183
|
drawFrame(ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1028
1184
|
}
|
|
1029
1185
|
|
|
1030
|
-
export { type AnimBuildOpts, type AnimKeyframe, type AnimTrack, type AnimTrackDef, type AnimatableParamDef, type AnimationCategory, type BatchInjection, COMPOSITION_PRESETS, CUSTOM_ENGINE_IDS, type CompositionPreset, type CompositorFromScene, type CompositorSettings, type CustomEngineId, DEFAULT_CANVAS_HEIGHT, DEFAULT_CANVAS_WIDTH, DEFAULT_DURATION, DEFAULT_FONT_SIZE, DEFAULT_FPS, DEFAULT_TEXT_STYLE, type DotLottieManifest, type DrawPerCharTextOptions, EMPHASIS_PRESETS, ENGINE_ID_TO_LEGACY, ENTRANCE_PRESETS, EXIT_PRESETS, type EasingControlPoint, type EffectLayer, type EffectLayerType, type EvaluateOptions, FONT_WEIGHT_OPTIONS, type FillType, type FontVariant, type GifExportOptions, type GifFrame, type GlowLayer, type GradientDir, type GradientStop, InkBrushEngine, type Keyframe, LEGACY_RENDERER_MAP, LOOP_PRESETS, LOTTIE_ANIM_PRESETS, LOTTIE_TEMPLATE_PRESETS, type LayerTarget, type LottieAnimPreset, type LottieFileInfo, type LottieFontEntry, type LottieFontUsage, type LottieGradientStop, type LottieKeyframe, type LottiePropertyPath, type LottieTemplatePreset, type ParsedTextLayer, type PngSequenceFrame, type PngSequenceOptions, type Preset, SCENE_VERSION, SUPPORTED_FONT_FAMILIES, type SceneCanvas, type SceneDocument, type SceneText, type StyleRecipe, TEMPLATE_CATEGORIES, type TemplatePresetCategory, type TextAlign, type TextCustomization, type TextEffectConfig, TextEffectRenderer, type TextLayerConfig, type TextLayerStyle, type TextLayoutBounds, type TextLayoutResult, type TextStyleOverride, type Timeline, WEBM_EXPORT_MAX_FRAMES, WebGLCompositor, type WebMExportOptions, _resetPlatformCache, addImageLayer, addKeyframeAtTime, addOrUpdateKeyframe, addShapeLayer, addSolidLayer, addTextLayer, addTrack, addVectorShape, advanceSceneTime, alignToLottieJ, applyFillColorToAll, applyLetterSpacing, applyMaskReveal, applyRecipeToScene, applyStyleToLottie, applyStyleToLottieLayer, applyTimelineAtTime, bakeAnimationIntoLayer, blendConfigs, blendScenes, buildDotLottie, buildFontEntries, buildLottieFontName, buildPngSequenceZip, builtInPresets, builtInRecipes, captureLottieFrames, checkFontVariant, clearAnimationFromLayer, clearFontCache, clearRecipeCache, cloneSceneWithNewIds, computeAutoFitFontSize, computeFitZoom, computeTextLayout, countTextGlyphs, createBlankLottie, createCanvas, createDefaultRevealTrack, createEmptyScene, createPulseOpacityTrack, defaultConfig, deleteKeyframe, disposeSharedCompositor, downloadDotLottie, downloadLottieJson, downloadPngSequenceZip, downloadSceneWebM, drawPerCharText, drawRoundedRect, duplicateTrackAtPlayhead, ease, enableKeyframing, encodeGif, ensureDefaultTimeline, ensureFontInLottie, evaluateConfig, evaluateScene, findTrackIndex, getAnimPreset, getAnimatableParamDef, getAnimatableParamsForLayer, getDefaultText, getLayerById, getPresetScene, getSceneTime, getSupportedWebMMimeType, getTemplatePreset, getTemplatesByCategory, getWebMFrameCount, hexToLottieColor, hexToLottieRgb, initializeFontSystem, injectBatch, injectColor, injectFontVariantRules, injectGlobalTextStyle, injectSolidColor, injectText, injectTextStyle, isWebMExportSupported, loadLottieFonts, lottieColorToHex, lottieJToAlign, measureTextFits, mergeSceneIntoConfig, moveKeyframe, newLayerId, parseHistorySnapshot, parseLottieJson, preloadGoogleFont, presetToRecipe, pruneTracksForLayer, rainbowCharFillColors, readLayerScalar, readStyleFromLottieLayer, reindexLayers, releaseCanvas, removeKeyframe, removeTrack, renderPngSequence, renderSceneWebM, renderTextEffectCore, resetSceneTime, resizeCharFillColors, resolveAnimatedScalar, resolveCustomEngineId, restoreLetterSpacing, scanLottieFonts, scanTextLayers, sceneToConfig, setCharFillColor, setSceneTime, setTracks, shouldUsePerCharFill, snapshotScene, sortKeyframes, supportsCtxFilter, supportsLetterSpacing, supportsOffscreenCanvas, supportsRoundRect, supportsWebGL2, syncCompositorFromScene, textEffectConfigToScene, trackId, updateKeyframe, updateStaticProperty, updateTimeline, updateTrack, updateTrackMatte, upsertKeyframe, waitForFontsReady, wrapTextToWidth };
|
|
1186
|
+
export { type AnimBuildOpts, type AnimKeyframe, type AnimTrack, type AnimTrackDef, type AnimatableParamDef, type AnimationCategory, type BatchInjection, COMPOSITION_PRESETS, CUSTOM_ENGINE_IDS, CanvasDevice, type CompositionPreset, type CompositorFromScene, type CompositorSettings, type CustomEngineId, DEFAULT_CANVAS_HEIGHT, DEFAULT_CANVAS_WIDTH, DEFAULT_DURATION, DEFAULT_FONT_SIZE, DEFAULT_FPS, DEFAULT_TEXT_STYLE, type DotLottieManifest, type DrawPerCharTextOptions, EMPHASIS_PRESETS, ENGINE_ID_TO_LEGACY, ENTRANCE_PRESETS, EXIT_PRESETS, type EasingControlPoint, type EffectFullDefinition, type EffectIndexItem, type EffectLayer, type EffectLayerType, type EvaluateOptions, type EvaluatedTextLayer, FONT_WEIGHT_OPTIONS, type FillType, type FontDescriptor, type FontLoadResult, FontLoader, type FontVariant, type GifExportOptions, type GifFrame, type GlowLayer, type GradientDir, type GradientStop, InkBrushEngine, type Keyframe, LEGACY_RENDERER_MAP, LOOP_PRESETS, LOTTIE_ANIM_PRESETS, LOTTIE_TEMPLATE_PRESETS, type LayerTarget, type LottieAnimPreset, type LottieFileInfo, type LottieFontEntry, type LottieFontUsage, type LottieGradientStop, type LottieKeyframe, type LottiePropertyPath, type LottieTemplatePreset, type ParsedTextLayer, type PngSequenceFrame, type PngSequenceOptions, type Preset, SCENE_VERSION, SUPPORTED_FONT_FAMILIES, type SceneCanvas, type SceneDocument, type SceneText, type StyleRecipe, TEMPLATE_CATEGORIES, type TemplatePresetCategory, type TextAlign, type TextCustomization, type TextEffectConfig, type TextEffectDefinition, TextEffectRenderer, type TextLayerConfig, type TextLayerStyle, type TextLayoutBounds, type TextLayoutResult, type TextStyleOverride, type Timeline, WEBM_EXPORT_MAX_FRAMES, WebGLCompositor, type WebMExportOptions, _buildConfig, _resetPlatformCache, addImageLayer, addKeyframeAtTime, addOrUpdateKeyframe, addShapeLayer, addSolidLayer, addTextLayer, addTrack, addVectorShape, advanceSceneTime, alignToLottieJ, applyFillColorToAll, applyLetterSpacing, applyMaskReveal, applyRecipeToScene, applyStyleToLottie, applyStyleToLottieLayer, applyTimelineAtTime, bakeAnimationIntoLayer, blendConfigs, blendScenes, buildDotLottie, buildFontEntries, buildLottieFontName, buildPngSequenceZip, builtInPresets, builtInRecipes, captureLottieFrames, checkFontVariant, clearAnimationFromLayer, clearFontCache, clearRecipeCache, cloneSceneWithNewIds, computeAutoFitFontSize, computeFitZoom, computeTextLayout, countTextGlyphs, createBlankLottie, createCanvas, createDefaultRevealTrack, createEmptyScene, createPulseOpacityTrack, defaultConfig, deleteKeyframe, disposeSharedCompositor, downloadDotLottie, downloadLottieJson, downloadPngSequenceZip, downloadSceneWebM, drawPerCharText, drawRoundedRect, duplicateTrackAtPlayhead, ease, enableKeyframing, encodeGif, ensureDefaultTimeline, ensureFontInLottie, ensureFontsLoaded, evaluateConfig, evaluateScene, findTrackIndex, getAnimPreset, getAnimatableParamDef, getAnimatableParamsForLayer, getDefaultText, getFontLoader, getLayerById, getPresetScene, getSceneTime, getSupportedWebMMimeType, getTemplatePreset, getTemplatesByCategory, getWebMFrameCount, hexToLottieColor, hexToLottieRgb, initializeFontSystem, injectBatch, injectColor, injectFontVariantRules, injectGlobalTextStyle, injectSolidColor, injectText, injectTextStyle, isWebMExportSupported, layerToTextEffectConfig, loadLottieFonts, lottieColorToHex, lottieJToAlign, measureTextFits, mergeSceneIntoConfig, moveKeyframe, newLayerId, parseHistorySnapshot, parseLottieJson, preloadGoogleFont, presetToRecipe, pruneTracksForLayer, rainbowCharFillColors, readLayerScalar, readStyleFromLottieLayer, reindexLayers, releaseCanvas, removeKeyframe, removeTrack, renderPngSequence, renderSceneWebM, renderTextEffectCore, resetFontLoader, resetSceneTime, resizeCharFillColors, resolveAnimatedScalar, resolveCustomEngineId, resolveFontFamilyName, restoreLetterSpacing, scanLottieFonts, scanTextLayers, sceneToConfig, setCharFillColor, setSceneTime, setTracks, shouldUsePerCharFill, snapshotScene, sortKeyframes, supportsCtxFilter, supportsLetterSpacing, supportsOffscreenCanvas, supportsRoundRect, supportsWebGL2, syncCompositorFromScene, textEffectConfigToScene, trackId, updateKeyframe, updateStaticProperty, updateTimeline, updateTrack, updateTrackMatte, upsertKeyframe, waitForFontsReady, wrapTextToWidth };
|