@clypra/engine 1.1.0 → 1.1.1
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 +13 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -4
- package/dist/index.d.ts +12 -4
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -235,7 +235,10 @@ declare function injectFontVariantRules(): void;
|
|
|
235
235
|
*/
|
|
236
236
|
declare function initializeFontSystem(): Promise<void>;
|
|
237
237
|
/**
|
|
238
|
-
* Checks if a font variant is available for rendering
|
|
238
|
+
* Checks if a font variant is available for rendering.
|
|
239
|
+
* Uses document.fonts.check() which is the correct API for font availability —
|
|
240
|
+
* unlike measureText() which silently falls back to the system font and always
|
|
241
|
+
* returns a non-zero width regardless of whether the named font loaded.
|
|
239
242
|
*/
|
|
240
243
|
declare function checkFontVariant(variantName: string): boolean;
|
|
241
244
|
|
|
@@ -270,6 +273,11 @@ interface EvaluateOptions {
|
|
|
270
273
|
compositor?: WebGLCompositor | null;
|
|
271
274
|
skipPostFx?: boolean;
|
|
272
275
|
}
|
|
276
|
+
/**
|
|
277
|
+
* Dispose the shared module-level compositor and release GPU resources.
|
|
278
|
+
* Call on hot-module-reload or application teardown to prevent WebGL context leaks.
|
|
279
|
+
*/
|
|
280
|
+
declare function disposeSharedCompositor(): void;
|
|
273
281
|
/**
|
|
274
282
|
* Single source of truth for rendering a scene at time t.
|
|
275
283
|
*/
|
|
@@ -958,8 +966,8 @@ declare function createCanvas(width: number, height: number): HTMLCanvasElement
|
|
|
958
966
|
* Release a DOM canvas created via createCanvas() when OffscreenCanvas
|
|
959
967
|
* was unavailable. No-op for OffscreenCanvas instances.
|
|
960
968
|
*
|
|
961
|
-
*
|
|
962
|
-
*
|
|
969
|
+
* Sets width/height to 0 to release the backing store immediately rather
|
|
970
|
+
* than waiting for GC. Call this after extracting ImageBitmap/ImageData.
|
|
963
971
|
*/
|
|
964
972
|
declare function releaseCanvas(canvas: HTMLCanvasElement | OffscreenCanvas): void;
|
|
965
973
|
/**
|
|
@@ -1019,4 +1027,4 @@ declare class InkBrushEngine {
|
|
|
1019
1027
|
drawFrame(ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1020
1028
|
}
|
|
1021
1029
|
|
|
1022
|
-
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, 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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -235,7 +235,10 @@ declare function injectFontVariantRules(): void;
|
|
|
235
235
|
*/
|
|
236
236
|
declare function initializeFontSystem(): Promise<void>;
|
|
237
237
|
/**
|
|
238
|
-
* Checks if a font variant is available for rendering
|
|
238
|
+
* Checks if a font variant is available for rendering.
|
|
239
|
+
* Uses document.fonts.check() which is the correct API for font availability —
|
|
240
|
+
* unlike measureText() which silently falls back to the system font and always
|
|
241
|
+
* returns a non-zero width regardless of whether the named font loaded.
|
|
239
242
|
*/
|
|
240
243
|
declare function checkFontVariant(variantName: string): boolean;
|
|
241
244
|
|
|
@@ -270,6 +273,11 @@ interface EvaluateOptions {
|
|
|
270
273
|
compositor?: WebGLCompositor | null;
|
|
271
274
|
skipPostFx?: boolean;
|
|
272
275
|
}
|
|
276
|
+
/**
|
|
277
|
+
* Dispose the shared module-level compositor and release GPU resources.
|
|
278
|
+
* Call on hot-module-reload or application teardown to prevent WebGL context leaks.
|
|
279
|
+
*/
|
|
280
|
+
declare function disposeSharedCompositor(): void;
|
|
273
281
|
/**
|
|
274
282
|
* Single source of truth for rendering a scene at time t.
|
|
275
283
|
*/
|
|
@@ -958,8 +966,8 @@ declare function createCanvas(width: number, height: number): HTMLCanvasElement
|
|
|
958
966
|
* Release a DOM canvas created via createCanvas() when OffscreenCanvas
|
|
959
967
|
* was unavailable. No-op for OffscreenCanvas instances.
|
|
960
968
|
*
|
|
961
|
-
*
|
|
962
|
-
*
|
|
969
|
+
* Sets width/height to 0 to release the backing store immediately rather
|
|
970
|
+
* than waiting for GC. Call this after extracting ImageBitmap/ImageData.
|
|
963
971
|
*/
|
|
964
972
|
declare function releaseCanvas(canvas: HTMLCanvasElement | OffscreenCanvas): void;
|
|
965
973
|
/**
|
|
@@ -1019,4 +1027,4 @@ declare class InkBrushEngine {
|
|
|
1019
1027
|
drawFrame(ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
1020
1028
|
}
|
|
1021
1029
|
|
|
1022
|
-
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, 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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -115,7 +115,7 @@ function layoutWithFontSize(ctx, cfg, fontSize, lines) {
|
|
|
115
115
|
ctx.font = fontStr;
|
|
116
116
|
const lineWidths = lines.map((line) => measureLine(ctx, line, letterSpacing));
|
|
117
117
|
const maxLineWidth = Math.max(...lineWidths, 1);
|
|
118
|
-
const textBlockHeight = fontSize
|
|
118
|
+
const textBlockHeight = lines.length === 1 ? fontSize : (lines.length - 1) * fontSize * lineHeight + fontSize;
|
|
119
119
|
let align = "center";
|
|
120
120
|
let startX = cWidth / 2;
|
|
121
121
|
if (cfg.textPosX === "left") {
|
|
@@ -376,9 +376,8 @@ function createCanvas(width, height) {
|
|
|
376
376
|
}
|
|
377
377
|
function releaseCanvas(canvas) {
|
|
378
378
|
if (canvas instanceof OffscreenCanvas) return;
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
}
|
|
379
|
+
canvas.width = 0;
|
|
380
|
+
canvas.height = 0;
|
|
382
381
|
}
|
|
383
382
|
function _resetPlatformCache() {
|
|
384
383
|
_ctxFilter = null;
|
|
@@ -1905,7 +1904,7 @@ function renderTextEffectCore(ctx, cfg) {
|
|
|
1905
1904
|
ctx.globalCompositeOperation = "source-atop";
|
|
1906
1905
|
const renderCount = Math.max(1, Math.min(20, layer2.strength ?? 1));
|
|
1907
1906
|
for (let i = 0; i < renderCount; i++) {
|
|
1908
|
-
renderWithShadowTrick("fill", layer2.color, layer2.blur, 0, 0, layer2.opacity, "
|
|
1907
|
+
renderWithShadowTrick("fill", layer2.color, layer2.blur, 0, 0, layer2.opacity, "#000000", layer2.spread ?? 0);
|
|
1909
1908
|
}
|
|
1910
1909
|
ctx.restore();
|
|
1911
1910
|
}
|
|
@@ -1913,7 +1912,7 @@ function renderTextEffectCore(ctx, cfg) {
|
|
|
1913
1912
|
if (shadowEnabled && shadowType === "inner" && shadowOpacity > 0) {
|
|
1914
1913
|
ctx.save();
|
|
1915
1914
|
ctx.globalCompositeOperation = "source-atop";
|
|
1916
|
-
renderWithShadowTrick("fill", shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY, shadowOpacity, "
|
|
1915
|
+
renderWithShadowTrick("fill", shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY, shadowOpacity, "#000000");
|
|
1917
1916
|
ctx.restore();
|
|
1918
1917
|
}
|
|
1919
1918
|
if (isGlitch) {
|
|
@@ -2346,12 +2345,8 @@ async function initializeFontSystem() {
|
|
|
2346
2345
|
}
|
|
2347
2346
|
}
|
|
2348
2347
|
function checkFontVariant(variantName) {
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
if (!ctx) return false;
|
|
2352
|
-
ctx.font = `16px "${variantName}"`;
|
|
2353
|
-
const metrics = ctx.measureText("Test");
|
|
2354
|
-
return metrics.width > 0;
|
|
2348
|
+
if (typeof document === "undefined" || !document.fonts) return false;
|
|
2349
|
+
return document.fonts.check(`16px "${variantName}"`);
|
|
2355
2350
|
}
|
|
2356
2351
|
|
|
2357
2352
|
// src/engine/timelineDefaults.ts
|
|
@@ -3009,6 +3004,10 @@ function getCompositor() {
|
|
|
3009
3004
|
}
|
|
3010
3005
|
return sharedCompositor;
|
|
3011
3006
|
}
|
|
3007
|
+
function disposeSharedCompositor() {
|
|
3008
|
+
sharedCompositor?.dispose();
|
|
3009
|
+
sharedCompositor = null;
|
|
3010
|
+
}
|
|
3012
3011
|
function evaluateScene(doc, time, ctx, options = {}) {
|
|
3013
3012
|
const animated = applyTimelineAtTime(doc, time);
|
|
3014
3013
|
const cfg = sceneToConfig(animated);
|
|
@@ -6102,6 +6101,7 @@ export {
|
|
|
6102
6101
|
createPulseOpacityTrack,
|
|
6103
6102
|
defaultConfig,
|
|
6104
6103
|
deleteKeyframe,
|
|
6104
|
+
disposeSharedCompositor,
|
|
6105
6105
|
downloadDotLottie,
|
|
6106
6106
|
downloadLottieJson,
|
|
6107
6107
|
downloadPngSequenceZip,
|