@clypra/engine 1.0.1 → 1.1.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/README.md +386 -0
- package/dist/index.cjs +227 -106
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +120 -1
- package/dist/index.d.ts +120 -1
- package/dist/index.js +211 -106
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
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;
|
|
2
12
|
type EffectLayerType = "panel" | "glow" | "shadow" | "extrusion" | "duplicateStack" | "stroke" | "fill" | "mask" | "filter" | "customEngine";
|
|
3
13
|
type LayerTarget = "text" | "panel" | "scene" | "previous";
|
|
4
14
|
type CustomEngineId = "ink";
|
|
@@ -889,6 +899,115 @@ declare function updateKeyframe(doc: SceneDocument, trackIndex: number, keyframe
|
|
|
889
899
|
declare function removeKeyframe(doc: SceneDocument, trackIndex: number, keyframeIndex: number): SceneDocument;
|
|
890
900
|
declare function duplicateTrackAtPlayhead(doc: SceneDocument, trackIndex: number, previewTime: number): SceneDocument;
|
|
891
901
|
|
|
902
|
+
/**
|
|
903
|
+
* Platform Capability Detection
|
|
904
|
+
*
|
|
905
|
+
* Single source of truth for Canvas 2D / WebGL feature detection
|
|
906
|
+
* across WKWebView (macOS Tauri), WebView2 (Windows Tauri), and
|
|
907
|
+
* standard browser environments.
|
|
908
|
+
*
|
|
909
|
+
* All results are cached after the first call. Never call DOM APIs
|
|
910
|
+
* on every frame — detect once, branch always.
|
|
911
|
+
*
|
|
912
|
+
* Covers:
|
|
913
|
+
* - ctx.filter (absent on WKWebView < Safari 18 / macOS Sequoia)
|
|
914
|
+
* - ctx.roundRect (absent on older WebView2 and Safari < 15.4)
|
|
915
|
+
* - ctx.letterSpacing (absent on older WebView2 and Safari < 16.1)
|
|
916
|
+
* - OffscreenCanvas (absent on WKWebView < Safari 16.4)
|
|
917
|
+
* - WebGL2 (absent on very old WebView2 builds)
|
|
918
|
+
*/
|
|
919
|
+
/**
|
|
920
|
+
* Returns true when CanvasRenderingContext2D.filter is supported and
|
|
921
|
+
* actually applies (some WebViews accept the assignment silently but ignore it).
|
|
922
|
+
*
|
|
923
|
+
* Used to decide whether stroke-blur and glow effects should go through
|
|
924
|
+
* the WebGLCompositor fallback path.
|
|
925
|
+
*/
|
|
926
|
+
declare function supportsCtxFilter(): boolean;
|
|
927
|
+
/**
|
|
928
|
+
* Returns true when CanvasRenderingContext2D.roundRect() exists.
|
|
929
|
+
*
|
|
930
|
+
* Used to decide whether to fall back to the manual quadraticCurveTo
|
|
931
|
+
* rounded-rect implementation in panel rendering.
|
|
932
|
+
*/
|
|
933
|
+
declare function supportsRoundRect(): boolean;
|
|
934
|
+
/**
|
|
935
|
+
* Returns true when CanvasRenderingContext2D.letterSpacing is supported
|
|
936
|
+
* as an assignable CSS property.
|
|
937
|
+
*
|
|
938
|
+
* When false, letter-spacing must be emulated by drawing characters
|
|
939
|
+
* individually (or accepted as absent for fallback quality).
|
|
940
|
+
*/
|
|
941
|
+
declare function supportsLetterSpacing(): boolean;
|
|
942
|
+
/**
|
|
943
|
+
* Returns true when OffscreenCanvas is available in this environment.
|
|
944
|
+
*
|
|
945
|
+
* When false, fall back to document.createElement('canvas') for
|
|
946
|
+
* intermediate rendering and ensure cleanup of DOM nodes.
|
|
947
|
+
*/
|
|
948
|
+
declare function supportsOffscreenCanvas(): boolean;
|
|
949
|
+
/**
|
|
950
|
+
* Returns true when WebGL2 is available.
|
|
951
|
+
*
|
|
952
|
+
* When false, WebGLCompositor.isSupported will also be false.
|
|
953
|
+
* Bloom/blur post-FX will be silently skipped.
|
|
954
|
+
*/
|
|
955
|
+
declare function supportsWebGL2(): boolean;
|
|
956
|
+
declare function createCanvas(width: number, height: number): HTMLCanvasElement | OffscreenCanvas;
|
|
957
|
+
/**
|
|
958
|
+
* Release a DOM canvas created via createCanvas() when OffscreenCanvas
|
|
959
|
+
* was unavailable. No-op for OffscreenCanvas instances.
|
|
960
|
+
*
|
|
961
|
+
* Call this after extracting ImageBitmap / ImageData from an intermediate
|
|
962
|
+
* canvas to prevent DOM leak at 30fps render loops.
|
|
963
|
+
*/
|
|
964
|
+
declare function releaseCanvas(canvas: HTMLCanvasElement | OffscreenCanvas): void;
|
|
965
|
+
/**
|
|
966
|
+
* Reset all cached capability flags (for testing only).
|
|
967
|
+
*/
|
|
968
|
+
declare function _resetPlatformCache(): void;
|
|
969
|
+
|
|
970
|
+
/**
|
|
971
|
+
* Canvas 2D utility helpers
|
|
972
|
+
*
|
|
973
|
+
* Cross-platform polyfills and small drawing helpers shared by the
|
|
974
|
+
* renderer, rasterizer, and any other Canvas 2D consumers.
|
|
975
|
+
*/
|
|
976
|
+
type Ctx2D = CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
|
|
977
|
+
/**
|
|
978
|
+
* Draw a rounded rectangle path, compatible with all WebView targets.
|
|
979
|
+
*
|
|
980
|
+
* Uses the native ctx.roundRect() when available (Chrome 99+, Safari 15.4+,
|
|
981
|
+
* WebView2 1.0.1108+). Falls back to manual quadraticCurveTo() on older
|
|
982
|
+
* WKWebView / WebView2 builds.
|
|
983
|
+
*
|
|
984
|
+
* Callers must still call ctx.fill() / ctx.stroke() after this.
|
|
985
|
+
*
|
|
986
|
+
* @param ctx - 2D rendering context
|
|
987
|
+
* @param x - top-left x
|
|
988
|
+
* @param y - top-left y
|
|
989
|
+
* @param w - width
|
|
990
|
+
* @param h - height
|
|
991
|
+
* @param r - corner radius (uniform, clamped to half the shorter side)
|
|
992
|
+
*/
|
|
993
|
+
declare function drawRoundedRect(ctx: Ctx2D, x: number, y: number, w: number, h: number, r: number): void;
|
|
994
|
+
/**
|
|
995
|
+
* Apply letterSpacing to a canvas context when the CSS property is
|
|
996
|
+
* supported. Returns the previous value so callers can restore it.
|
|
997
|
+
*
|
|
998
|
+
* When letterSpacing is NOT supported by the current WebView, returns
|
|
999
|
+
* the current value unchanged and applies no mutation.
|
|
1000
|
+
*
|
|
1001
|
+
* @param ctx - 2D rendering context
|
|
1002
|
+
* @param value - spacing in pixels (pass 0 to reset)
|
|
1003
|
+
* @returns previous letterSpacing string ("0px" if unknown)
|
|
1004
|
+
*/
|
|
1005
|
+
declare function applyLetterSpacing(ctx: Ctx2D, value: number): string;
|
|
1006
|
+
/**
|
|
1007
|
+
* Restore letterSpacing to a previously saved value.
|
|
1008
|
+
*/
|
|
1009
|
+
declare function restoreLetterSpacing(ctx: Ctx2D, saved: string): void;
|
|
1010
|
+
|
|
892
1011
|
declare class InkBrushEngine {
|
|
893
1012
|
private cfg;
|
|
894
1013
|
private bristleLines;
|
|
@@ -900,4 +1019,4 @@ declare class InkBrushEngine {
|
|
|
900
1019
|
drawFrame(ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
901
1020
|
}
|
|
902
1021
|
|
|
903
|
-
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_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, addImageLayer, addKeyframeAtTime, addOrUpdateKeyframe, addShapeLayer, addSolidLayer, addTextLayer, addTrack, addVectorShape, advanceSceneTime, alignToLottieJ, applyFillColorToAll, 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, createDefaultRevealTrack, createEmptyScene, createPulseOpacityTrack, defaultConfig, deleteKeyframe, downloadDotLottie, downloadLottieJson, downloadPngSequenceZip, downloadSceneWebM, drawPerCharText, 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, removeKeyframe, removeTrack, renderPngSequence, renderSceneWebM, renderTextEffectCore, resetSceneTime, resizeCharFillColors, resolveAnimatedScalar, resolveCustomEngineId, scanLottieFonts, scanTextLayers, sceneToConfig, setCharFillColor, setSceneTime, setTracks, shouldUsePerCharFill, snapshotScene, sortKeyframes, syncCompositorFromScene, textEffectConfigToScene, trackId, updateKeyframe, updateStaticProperty, updateTimeline, updateTrack, updateTrackMatte, upsertKeyframe, waitForFontsReady, wrapTextToWidth };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
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;
|
|
2
12
|
type EffectLayerType = "panel" | "glow" | "shadow" | "extrusion" | "duplicateStack" | "stroke" | "fill" | "mask" | "filter" | "customEngine";
|
|
3
13
|
type LayerTarget = "text" | "panel" | "scene" | "previous";
|
|
4
14
|
type CustomEngineId = "ink";
|
|
@@ -889,6 +899,115 @@ declare function updateKeyframe(doc: SceneDocument, trackIndex: number, keyframe
|
|
|
889
899
|
declare function removeKeyframe(doc: SceneDocument, trackIndex: number, keyframeIndex: number): SceneDocument;
|
|
890
900
|
declare function duplicateTrackAtPlayhead(doc: SceneDocument, trackIndex: number, previewTime: number): SceneDocument;
|
|
891
901
|
|
|
902
|
+
/**
|
|
903
|
+
* Platform Capability Detection
|
|
904
|
+
*
|
|
905
|
+
* Single source of truth for Canvas 2D / WebGL feature detection
|
|
906
|
+
* across WKWebView (macOS Tauri), WebView2 (Windows Tauri), and
|
|
907
|
+
* standard browser environments.
|
|
908
|
+
*
|
|
909
|
+
* All results are cached after the first call. Never call DOM APIs
|
|
910
|
+
* on every frame — detect once, branch always.
|
|
911
|
+
*
|
|
912
|
+
* Covers:
|
|
913
|
+
* - ctx.filter (absent on WKWebView < Safari 18 / macOS Sequoia)
|
|
914
|
+
* - ctx.roundRect (absent on older WebView2 and Safari < 15.4)
|
|
915
|
+
* - ctx.letterSpacing (absent on older WebView2 and Safari < 16.1)
|
|
916
|
+
* - OffscreenCanvas (absent on WKWebView < Safari 16.4)
|
|
917
|
+
* - WebGL2 (absent on very old WebView2 builds)
|
|
918
|
+
*/
|
|
919
|
+
/**
|
|
920
|
+
* Returns true when CanvasRenderingContext2D.filter is supported and
|
|
921
|
+
* actually applies (some WebViews accept the assignment silently but ignore it).
|
|
922
|
+
*
|
|
923
|
+
* Used to decide whether stroke-blur and glow effects should go through
|
|
924
|
+
* the WebGLCompositor fallback path.
|
|
925
|
+
*/
|
|
926
|
+
declare function supportsCtxFilter(): boolean;
|
|
927
|
+
/**
|
|
928
|
+
* Returns true when CanvasRenderingContext2D.roundRect() exists.
|
|
929
|
+
*
|
|
930
|
+
* Used to decide whether to fall back to the manual quadraticCurveTo
|
|
931
|
+
* rounded-rect implementation in panel rendering.
|
|
932
|
+
*/
|
|
933
|
+
declare function supportsRoundRect(): boolean;
|
|
934
|
+
/**
|
|
935
|
+
* Returns true when CanvasRenderingContext2D.letterSpacing is supported
|
|
936
|
+
* as an assignable CSS property.
|
|
937
|
+
*
|
|
938
|
+
* When false, letter-spacing must be emulated by drawing characters
|
|
939
|
+
* individually (or accepted as absent for fallback quality).
|
|
940
|
+
*/
|
|
941
|
+
declare function supportsLetterSpacing(): boolean;
|
|
942
|
+
/**
|
|
943
|
+
* Returns true when OffscreenCanvas is available in this environment.
|
|
944
|
+
*
|
|
945
|
+
* When false, fall back to document.createElement('canvas') for
|
|
946
|
+
* intermediate rendering and ensure cleanup of DOM nodes.
|
|
947
|
+
*/
|
|
948
|
+
declare function supportsOffscreenCanvas(): boolean;
|
|
949
|
+
/**
|
|
950
|
+
* Returns true when WebGL2 is available.
|
|
951
|
+
*
|
|
952
|
+
* When false, WebGLCompositor.isSupported will also be false.
|
|
953
|
+
* Bloom/blur post-FX will be silently skipped.
|
|
954
|
+
*/
|
|
955
|
+
declare function supportsWebGL2(): boolean;
|
|
956
|
+
declare function createCanvas(width: number, height: number): HTMLCanvasElement | OffscreenCanvas;
|
|
957
|
+
/**
|
|
958
|
+
* Release a DOM canvas created via createCanvas() when OffscreenCanvas
|
|
959
|
+
* was unavailable. No-op for OffscreenCanvas instances.
|
|
960
|
+
*
|
|
961
|
+
* Call this after extracting ImageBitmap / ImageData from an intermediate
|
|
962
|
+
* canvas to prevent DOM leak at 30fps render loops.
|
|
963
|
+
*/
|
|
964
|
+
declare function releaseCanvas(canvas: HTMLCanvasElement | OffscreenCanvas): void;
|
|
965
|
+
/**
|
|
966
|
+
* Reset all cached capability flags (for testing only).
|
|
967
|
+
*/
|
|
968
|
+
declare function _resetPlatformCache(): void;
|
|
969
|
+
|
|
970
|
+
/**
|
|
971
|
+
* Canvas 2D utility helpers
|
|
972
|
+
*
|
|
973
|
+
* Cross-platform polyfills and small drawing helpers shared by the
|
|
974
|
+
* renderer, rasterizer, and any other Canvas 2D consumers.
|
|
975
|
+
*/
|
|
976
|
+
type Ctx2D = CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
|
|
977
|
+
/**
|
|
978
|
+
* Draw a rounded rectangle path, compatible with all WebView targets.
|
|
979
|
+
*
|
|
980
|
+
* Uses the native ctx.roundRect() when available (Chrome 99+, Safari 15.4+,
|
|
981
|
+
* WebView2 1.0.1108+). Falls back to manual quadraticCurveTo() on older
|
|
982
|
+
* WKWebView / WebView2 builds.
|
|
983
|
+
*
|
|
984
|
+
* Callers must still call ctx.fill() / ctx.stroke() after this.
|
|
985
|
+
*
|
|
986
|
+
* @param ctx - 2D rendering context
|
|
987
|
+
* @param x - top-left x
|
|
988
|
+
* @param y - top-left y
|
|
989
|
+
* @param w - width
|
|
990
|
+
* @param h - height
|
|
991
|
+
* @param r - corner radius (uniform, clamped to half the shorter side)
|
|
992
|
+
*/
|
|
993
|
+
declare function drawRoundedRect(ctx: Ctx2D, x: number, y: number, w: number, h: number, r: number): void;
|
|
994
|
+
/**
|
|
995
|
+
* Apply letterSpacing to a canvas context when the CSS property is
|
|
996
|
+
* supported. Returns the previous value so callers can restore it.
|
|
997
|
+
*
|
|
998
|
+
* When letterSpacing is NOT supported by the current WebView, returns
|
|
999
|
+
* the current value unchanged and applies no mutation.
|
|
1000
|
+
*
|
|
1001
|
+
* @param ctx - 2D rendering context
|
|
1002
|
+
* @param value - spacing in pixels (pass 0 to reset)
|
|
1003
|
+
* @returns previous letterSpacing string ("0px" if unknown)
|
|
1004
|
+
*/
|
|
1005
|
+
declare function applyLetterSpacing(ctx: Ctx2D, value: number): string;
|
|
1006
|
+
/**
|
|
1007
|
+
* Restore letterSpacing to a previously saved value.
|
|
1008
|
+
*/
|
|
1009
|
+
declare function restoreLetterSpacing(ctx: Ctx2D, saved: string): void;
|
|
1010
|
+
|
|
892
1011
|
declare class InkBrushEngine {
|
|
893
1012
|
private cfg;
|
|
894
1013
|
private bristleLines;
|
|
@@ -900,4 +1019,4 @@ declare class InkBrushEngine {
|
|
|
900
1019
|
drawFrame(ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D): void;
|
|
901
1020
|
}
|
|
902
1021
|
|
|
903
|
-
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_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, addImageLayer, addKeyframeAtTime, addOrUpdateKeyframe, addShapeLayer, addSolidLayer, addTextLayer, addTrack, addVectorShape, advanceSceneTime, alignToLottieJ, applyFillColorToAll, 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, createDefaultRevealTrack, createEmptyScene, createPulseOpacityTrack, defaultConfig, deleteKeyframe, downloadDotLottie, downloadLottieJson, downloadPngSequenceZip, downloadSceneWebM, drawPerCharText, 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, removeKeyframe, removeTrack, renderPngSequence, renderSceneWebM, renderTextEffectCore, resetSceneTime, resizeCharFillColors, resolveAnimatedScalar, resolveCustomEngineId, scanLottieFonts, scanTextLayers, sceneToConfig, setCharFillColor, setSceneTime, setTracks, shouldUsePerCharFill, snapshotScene, sortKeyframes, syncCompositorFromScene, textEffectConfigToScene, trackId, updateKeyframe, updateStaticProperty, updateTimeline, updateTrack, updateTrackMatte, upsertKeyframe, waitForFontsReady, wrapTextToWidth };
|
|
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 };
|