visualfries 0.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/LICENSE +21 -0
- package/README.md +213 -0
- package/dist/DIContainer.d.ts +4 -0
- package/dist/DIContainer.js +145 -0
- package/dist/SceneBuilder.svelte.d.ts +8574 -0
- package/dist/SceneBuilder.svelte.js +409 -0
- package/dist/adapters/subtitleHelpers.d.ts +2 -0
- package/dist/adapters/subtitleHelpers.js +187 -0
- package/dist/animations/AnimationContext.d.ts +17 -0
- package/dist/animations/AnimationContext.js +72 -0
- package/dist/animations/AnimationPresetsRegister.d.ts +362 -0
- package/dist/animations/AnimationPresetsRegister.js +20 -0
- package/dist/animations/AnimationSetup.d.ts +8 -0
- package/dist/animations/AnimationSetup.js +30 -0
- package/dist/animations/SplitTextCache.d.ts +28 -0
- package/dist/animations/SplitTextCache.js +68 -0
- package/dist/animations/animationBuilder.d.ts +31 -0
- package/dist/animations/animationBuilder.js +255 -0
- package/dist/animations/animationPreset.d.ts +7 -0
- package/dist/animations/animationPreset.js +31 -0
- package/dist/animations/builders/AnimationPresetFactory.d.ts +43 -0
- package/dist/animations/builders/AnimationPresetFactory.js +139 -0
- package/dist/animations/builders/LineHighlighterAnimationBuilder.d.ts +16 -0
- package/dist/animations/builders/LineHighlighterAnimationBuilder.js +183 -0
- package/dist/animations/builders/WordHighlighterAnimationBuilder.d.ts +15 -0
- package/dist/animations/builders/WordHighlighterAnimationBuilder.js +180 -0
- package/dist/animations/engines/AnimationEngineAdaptor.d.ts +107 -0
- package/dist/animations/engines/AnimationEngineAdaptor.js +1 -0
- package/dist/animations/engines/GSAPEngineAdaptor.d.ts +21 -0
- package/dist/animations/engines/GSAPEngineAdaptor.js +145 -0
- package/dist/animations/presets/index.d.ts +2 -0
- package/dist/animations/presets/index.js +3 -0
- package/dist/animations/presets/lines.d.ts +52 -0
- package/dist/animations/presets/lines.js +547 -0
- package/dist/animations/presets/words.d.ts +31 -0
- package/dist/animations/presets/words.js +268 -0
- package/dist/animations/transformers/AnimationReferenceTransformer.d.ts +9 -0
- package/dist/animations/transformers/AnimationReferenceTransformer.js +114 -0
- package/dist/builders/PixiComponentBuilder.d.ts +63 -0
- package/dist/builders/PixiComponentBuilder.js +112 -0
- package/dist/builders/_ComponentState.svelte.d.ts +795 -0
- package/dist/builders/_ComponentState.svelte.js +203 -0
- package/dist/builders/html/HtmlBuilder.d.ts +66 -0
- package/dist/builders/html/HtmlBuilder.js +171 -0
- package/dist/builders/html/HtmlBuilderFactory.d.ts +27 -0
- package/dist/builders/html/HtmlBuilderFactory.js +30 -0
- package/dist/builders/html/StyleBuilder.d.ts +13 -0
- package/dist/builders/html/StyleBuilder.js +133 -0
- package/dist/builders/html/StyleProcessor.d.ts +9 -0
- package/dist/builders/html/StyleProcessor.js +1 -0
- package/dist/builders/html/TextComponentHtmlBuilder.d.ts +16 -0
- package/dist/builders/html/TextComponentHtmlBuilder.js +93 -0
- package/dist/builders/html/TextShadowBuilder.d.ts +60 -0
- package/dist/builders/html/TextShadowBuilder.js +227 -0
- package/dist/builders/html/processors/AppearanceStyleProcessor.d.ts +5 -0
- package/dist/builders/html/processors/AppearanceStyleProcessor.js +57 -0
- package/dist/builders/html/processors/TextAppearanceStyleProcessor.d.ts +5 -0
- package/dist/builders/html/processors/TextAppearanceStyleProcessor.js +37 -0
- package/dist/builders/html/processors/TextEffectsStyleProcessor.d.ts +6 -0
- package/dist/builders/html/processors/TextEffectsStyleProcessor.js +68 -0
- package/dist/commands/Command.d.ts +6 -0
- package/dist/commands/Command.js +1 -0
- package/dist/commands/CommandRunner.d.ts +28 -0
- package/dist/commands/CommandRunner.js +81 -0
- package/dist/commands/CommandTypes.d.ts +11 -0
- package/dist/commands/CommandTypes.js +13 -0
- package/dist/commands/PauseCommand.d.ts +4 -0
- package/dist/commands/PauseCommand.js +5 -0
- package/dist/commands/PlayCommand.d.ts +4 -0
- package/dist/commands/PlayCommand.js +6 -0
- package/dist/commands/RenderCommand.d.ts +15 -0
- package/dist/commands/RenderCommand.js +18 -0
- package/dist/commands/RenderFrameCommand.d.ts +17 -0
- package/dist/commands/RenderFrameCommand.js +93 -0
- package/dist/commands/ReplaceSourceOnTimeCommand.d.ts +4 -0
- package/dist/commands/ReplaceSourceOnTimeCommand.js +22 -0
- package/dist/commands/SeekCommand.d.ts +15 -0
- package/dist/commands/SeekCommand.js +39 -0
- package/dist/commands/UpdateComponentCommand.d.ts +4 -0
- package/dist/commands/UpdateComponentCommand.js +17 -0
- package/dist/components/AnimatedGIF.d.ts +201 -0
- package/dist/components/AnimatedGIF.js +391 -0
- package/dist/components/Component.svelte.d.ts +33 -0
- package/dist/components/Component.svelte.js +152 -0
- package/dist/components/ComponentContext.svelte.d.ts +33 -0
- package/dist/components/ComponentContext.svelte.js +105 -0
- package/dist/components/hooks/AnimationHook.d.ts +25 -0
- package/dist/components/hooks/AnimationHook.js +180 -0
- package/dist/components/hooks/CanvasShapeHook.d.ts +12 -0
- package/dist/components/hooks/CanvasShapeHook.js +229 -0
- package/dist/components/hooks/HtmlAnimationHook.d.ts +8 -0
- package/dist/components/hooks/HtmlAnimationHook.js +70 -0
- package/dist/components/hooks/HtmlTextHook.d.ts +16 -0
- package/dist/components/hooks/HtmlTextHook.js +102 -0
- package/dist/components/hooks/HtmlToCanvasHook.d.ts +16 -0
- package/dist/components/hooks/HtmlToCanvasHook.js +148 -0
- package/dist/components/hooks/ImageHook.d.ts +10 -0
- package/dist/components/hooks/ImageHook.js +45 -0
- package/dist/components/hooks/MediaHook.d.ts +15 -0
- package/dist/components/hooks/MediaHook.js +252 -0
- package/dist/components/hooks/MediaSeekingHook.d.ts +12 -0
- package/dist/components/hooks/MediaSeekingHook.js +204 -0
- package/dist/components/hooks/PixiDisplayObjectHook.d.ts +15 -0
- package/dist/components/hooks/PixiDisplayObjectHook.js +77 -0
- package/dist/components/hooks/PixiGifHook.d.ts +15 -0
- package/dist/components/hooks/PixiGifHook.js +97 -0
- package/dist/components/hooks/PixiProgressShapeHook.d.ts +12 -0
- package/dist/components/hooks/PixiProgressShapeHook.js +128 -0
- package/dist/components/hooks/PixiSplitScreenDisplayObjectHook.d.ts +21 -0
- package/dist/components/hooks/PixiSplitScreenDisplayObjectHook.js +210 -0
- package/dist/components/hooks/PixiTextureHook.d.ts +7 -0
- package/dist/components/hooks/PixiTextureHook.js +29 -0
- package/dist/components/hooks/PixiVideoTextureHook.d.ts +10 -0
- package/dist/components/hooks/PixiVideoTextureHook.js +35 -0
- package/dist/components/hooks/SubtitlesHook.d.ts +88 -0
- package/dist/components/hooks/SubtitlesHook.js +199 -0
- package/dist/components/hooks/VerifyGifHook.d.ts +7 -0
- package/dist/components/hooks/VerifyGifHook.js +27 -0
- package/dist/components/hooks/VerifyImageHook.d.ts +7 -0
- package/dist/components/hooks/VerifyImageHook.js +27 -0
- package/dist/components/hooks/VerifyMediaHook.d.ts +7 -0
- package/dist/components/hooks/VerifyMediaHook.js +21 -0
- package/dist/components/hooks/shapes/progress/CustomProgressRenderer.d.ts +8 -0
- package/dist/components/hooks/shapes/progress/CustomProgressRenderer.js +53 -0
- package/dist/components/hooks/shapes/progress/DoubleProgressRenderer.d.ts +8 -0
- package/dist/components/hooks/shapes/progress/DoubleProgressRenderer.js +69 -0
- package/dist/components/hooks/shapes/progress/LinearProgressRenderer.d.ts +8 -0
- package/dist/components/hooks/shapes/progress/LinearProgressRenderer.js +60 -0
- package/dist/components/hooks/shapes/progress/PerimeterProgressRenderer.d.ts +9 -0
- package/dist/components/hooks/shapes/progress/PerimeterProgressRenderer.js +213 -0
- package/dist/components/hooks/shapes/progress/ProgressRenderer.d.ts +17 -0
- package/dist/components/hooks/shapes/progress/ProgressRenderer.js +75 -0
- package/dist/components/hooks/shapes/progress/RadialProgressRenderer.d.ts +8 -0
- package/dist/components/hooks/shapes/progress/RadialProgressRenderer.js +50 -0
- package/dist/components/hooks/shapes/progress/index.d.ts +6 -0
- package/dist/components/hooks/shapes/progress/index.js +6 -0
- package/dist/composers/componentComposer.d.ts +55 -0
- package/dist/composers/componentComposer.js +118 -0
- package/dist/composers/layerComposer.d.ts +46 -0
- package/dist/composers/layerComposer.js +79 -0
- package/dist/composers/sceneComposer.d.ts +48 -0
- package/dist/composers/sceneComposer.js +92 -0
- package/dist/constants.d.ts +12 -0
- package/dist/constants.js +14 -0
- package/dist/directors/ComponentDirector.d.ts +20 -0
- package/dist/directors/ComponentDirector.js +86 -0
- package/dist/factories/SceneBuilderFactory.d.ts +15 -0
- package/dist/factories/SceneBuilderFactory.js +51 -0
- package/dist/fonts/GoogleFontsProvider.d.ts +12 -0
- package/dist/fonts/GoogleFontsProvider.js +125 -0
- package/dist/fonts/fontLoader.d.ts +15 -0
- package/dist/fonts/fontLoader.js +41 -0
- package/dist/fonts/types.d.ts +1 -0
- package/dist/fonts/types.js +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +14 -0
- package/dist/layers/Layer.svelte.d.ts +8492 -0
- package/dist/layers/Layer.svelte.js +125 -0
- package/dist/managers/AppManager.svelte.d.ts +23 -0
- package/dist/managers/AppManager.svelte.js +89 -0
- package/dist/managers/ComponentsManager.svelte.d.ts +49 -0
- package/dist/managers/ComponentsManager.svelte.js +247 -0
- package/dist/managers/DomManager.d.ts +18 -0
- package/dist/managers/DomManager.js +73 -0
- package/dist/managers/EventManager.d.ts +7 -0
- package/dist/managers/EventManager.js +22 -0
- package/dist/managers/LayersManager.svelte.d.ts +8499 -0
- package/dist/managers/LayersManager.svelte.js +176 -0
- package/dist/managers/MediaManager.d.ts +32 -0
- package/dist/managers/MediaManager.js +243 -0
- package/dist/managers/RenderManager.d.ts +23 -0
- package/dist/managers/RenderManager.js +59 -0
- package/dist/managers/StateManager.svelte.d.ts +8746 -0
- package/dist/managers/StateManager.svelte.js +272 -0
- package/dist/managers/SubtitlesManager.svelte.d.ts +261 -0
- package/dist/managers/SubtitlesManager.svelte.js +1385 -0
- package/dist/managers/TimeManager.svelte.d.ts +6 -0
- package/dist/managers/TimeManager.svelte.js +18 -0
- package/dist/managers/TimelineManager.svelte.d.ts +25 -0
- package/dist/managers/TimelineManager.svelte.js +152 -0
- package/dist/registers.d.ts +12 -0
- package/dist/registers.js +29 -0
- package/dist/schemas/runtime/index.d.ts +3 -0
- package/dist/schemas/runtime/index.js +4 -0
- package/dist/schemas/runtime/types.d.ts +323 -0
- package/dist/schemas/runtime/types.js +12 -0
- package/dist/schemas/scene/animations.d.ts +89738 -0
- package/dist/schemas/scene/animations.js +211 -0
- package/dist/schemas/scene/components.js +515 -0
- package/dist/schemas/scene/core.js +160 -0
- package/dist/schemas/scene/index.d.ts +22 -0
- package/dist/schemas/scene/index.js +10 -0
- package/dist/schemas/scene/properties.d.ts +914 -0
- package/dist/schemas/scene/properties.js +398 -0
- package/dist/schemas/scene/subtitles.d.ts +1141 -0
- package/dist/schemas/scene/subtitles.js +111 -0
- package/dist/schemas/scene/utils.d.ts +1 -0
- package/dist/schemas/scene/utils.js +5 -0
- package/dist/seeds/SeedFactory.d.ts +59 -0
- package/dist/seeds/SeedFactory.js +99 -0
- package/dist/seeds/index.d.ts +8 -0
- package/dist/seeds/index.js +8 -0
- package/dist/transformers/ColorTransformer.d.ts +5 -0
- package/dist/transformers/ColorTransformer.js +67 -0
- package/dist/transformers/PixiColorTransformer.d.ts +22 -0
- package/dist/transformers/PixiColorTransformer.js +104 -0
- package/dist/utils/canvas.d.ts +6 -0
- package/dist/utils/canvas.js +18 -0
- package/dist/utils/document.d.ts +2 -0
- package/dist/utils/document.js +36 -0
- package/dist/utils/emoji.d.ts +10 -0
- package/dist/utils/emoji.js +51 -0
- package/dist/utils/html.d.ts +4 -0
- package/dist/utils/html.js +45 -0
- package/dist/utils/svgGenerator.d.ts +20 -0
- package/dist/utils/svgGenerator.js +103 -0
- package/dist/utils/utils.d.ts +5 -0
- package/dist/utils/utils.js +125 -0
- package/package.json +96 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { sanitizeText, wrapEmojis } from '../../utils/html.js';
|
|
2
|
+
import { get } from 'lodash-es';
|
|
3
|
+
import { HtmlBuilder } from './HtmlBuilder.js';
|
|
4
|
+
import { StyleBuilder } from './StyleBuilder.js';
|
|
5
|
+
export class TextComponentHtmlBuilder {
|
|
6
|
+
component;
|
|
7
|
+
document;
|
|
8
|
+
constructor(component, document) {
|
|
9
|
+
this.component = component;
|
|
10
|
+
this.document = document;
|
|
11
|
+
}
|
|
12
|
+
getWrapperConfig() {
|
|
13
|
+
// wrapper is always just one
|
|
14
|
+
const { appearance, id } = this.component;
|
|
15
|
+
const styleBuilder = new StyleBuilder(this.component);
|
|
16
|
+
const onlyStyles = [
|
|
17
|
+
'left',
|
|
18
|
+
'top',
|
|
19
|
+
'position',
|
|
20
|
+
'fontFamily',
|
|
21
|
+
'fontWeight',
|
|
22
|
+
'width',
|
|
23
|
+
'height',
|
|
24
|
+
'justifyContent',
|
|
25
|
+
'alignItems',
|
|
26
|
+
'display'
|
|
27
|
+
];
|
|
28
|
+
if (get(appearance, 'background.enabled', false) &&
|
|
29
|
+
get(appearance, 'background.target') === 'wrapper') {
|
|
30
|
+
onlyStyles.push('background');
|
|
31
|
+
onlyStyles.push('borderRadius');
|
|
32
|
+
onlyStyles.push('backgroundColor');
|
|
33
|
+
}
|
|
34
|
+
styleBuilder.only(onlyStyles);
|
|
35
|
+
const style = styleBuilder.build();
|
|
36
|
+
return {
|
|
37
|
+
id: `cf-text-wrapper-${id}`, // Convention for wrapper ID
|
|
38
|
+
style
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
getElementConfig() {
|
|
42
|
+
// we can have multiple elements depending on the appearance
|
|
43
|
+
const { text, id, appearance } = this.component; // Keep text and id for innerHTML and element id
|
|
44
|
+
const styleBuilder = new StyleBuilder(this.component);
|
|
45
|
+
const omitStyles = [
|
|
46
|
+
'left',
|
|
47
|
+
'top',
|
|
48
|
+
'position',
|
|
49
|
+
'justifyContent',
|
|
50
|
+
'alignItems',
|
|
51
|
+
'display',
|
|
52
|
+
'width',
|
|
53
|
+
'height'
|
|
54
|
+
];
|
|
55
|
+
let addPadding = false;
|
|
56
|
+
if (get(appearance, 'background.enabled', false)) {
|
|
57
|
+
// omit background if target is wrapper
|
|
58
|
+
if (get(appearance, 'background.target') === 'wrapper') {
|
|
59
|
+
omitStyles.push('background');
|
|
60
|
+
omitStyles.push('borderRadius');
|
|
61
|
+
omitStyles.push('backgroundColor');
|
|
62
|
+
}
|
|
63
|
+
if (get(appearance, 'background.target') === 'element') {
|
|
64
|
+
addPadding = true;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
styleBuilder.omit(omitStyles);
|
|
68
|
+
const style = styleBuilder.build();
|
|
69
|
+
if (addPadding && !style.padding) {
|
|
70
|
+
style.padding = '0.22em';
|
|
71
|
+
}
|
|
72
|
+
// Process text for HTML
|
|
73
|
+
const processedText = text ? wrapEmojis(text.replace(/<br>/g, '<br />')) : '';
|
|
74
|
+
const safeHtml = sanitizeText(processedText);
|
|
75
|
+
return {
|
|
76
|
+
id: `elem-${id}`,
|
|
77
|
+
innerHTML: safeHtml,
|
|
78
|
+
style
|
|
79
|
+
// dir: 'auto' is default from HtmlBuilder
|
|
80
|
+
// classList: ['con-el'] is default from HtmlBuilder
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
build() {
|
|
84
|
+
const htmlBuilder = new HtmlBuilder(this.document);
|
|
85
|
+
htmlBuilder.withWrapper(this.getWrapperConfig()).withElement(this.getElementConfig());
|
|
86
|
+
return htmlBuilder.build();
|
|
87
|
+
}
|
|
88
|
+
buildAndExtractStyles() {
|
|
89
|
+
const htmlBuilder = new HtmlBuilder(this.document);
|
|
90
|
+
htmlBuilder.withWrapper(this.getWrapperConfig()).withElement(this.getElementConfig());
|
|
91
|
+
return htmlBuilder.buildAndExtractStyles();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum of supported text shadow preset types.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum TextEffectPresetName {
|
|
5
|
+
DEFAULT = "default",
|
|
6
|
+
CLASSIC = "classic",
|
|
7
|
+
EMERGING = "emerging",
|
|
8
|
+
GLOW = "glow",
|
|
9
|
+
TEXT = "text",
|
|
10
|
+
BOLD = "bold",
|
|
11
|
+
NEON = "neon",
|
|
12
|
+
ANAGLYPH = "anaglyph",
|
|
13
|
+
FIRE = "fire",
|
|
14
|
+
THREE_D = "3d",
|
|
15
|
+
FROSTY = "frosty",
|
|
16
|
+
INK = "ink",
|
|
17
|
+
RAINBOW = "rainbow",
|
|
18
|
+
OUTLINE = "outline",
|
|
19
|
+
STROKE = "stroke"
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Configuration options for building a text shadow.
|
|
23
|
+
*/
|
|
24
|
+
interface TextShadowBuildConfig {
|
|
25
|
+
preset: string;
|
|
26
|
+
size: number;
|
|
27
|
+
color: string;
|
|
28
|
+
opacity: number;
|
|
29
|
+
textColor?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Utility class for building CSS text-shadow values based on different presets.
|
|
33
|
+
*/
|
|
34
|
+
export declare class TextShadowBuilder {
|
|
35
|
+
/**
|
|
36
|
+
* Map of preset names to their corresponding shadow generation strategies.
|
|
37
|
+
*/
|
|
38
|
+
private static strategies;
|
|
39
|
+
/**
|
|
40
|
+
* Helper method to create a funky shadow string for specific presets.
|
|
41
|
+
* @param toSize The maximum size for the shadow.
|
|
42
|
+
* @param color The shadow color.
|
|
43
|
+
* @returns A CSS text-shadow string.
|
|
44
|
+
*/
|
|
45
|
+
private static funkyShadowString;
|
|
46
|
+
/**
|
|
47
|
+
* Builds a CSS text-shadow value based on the provided configuration.
|
|
48
|
+
* @param config The configuration for the text shadow.
|
|
49
|
+
* @returns A CSS text-shadow string or 'none' if size is <= 0.
|
|
50
|
+
*/
|
|
51
|
+
static build(config: TextShadowBuildConfig): string;
|
|
52
|
+
/**
|
|
53
|
+
* Builds a CSS filter drop-shadow value by converting a text-shadow string.
|
|
54
|
+
* This is used to apply shadows to elements with transparent text, such as those with gradient fills.
|
|
55
|
+
* @param config The configuration for the text shadow.
|
|
56
|
+
* @returns A CSS filter string with one or more drop-shadow() functions, or 'none'.
|
|
57
|
+
*/
|
|
58
|
+
static buildDropShadow(config: TextShadowBuildConfig): string;
|
|
59
|
+
}
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import tinycolor from 'tinycolor2';
|
|
2
|
+
/**
|
|
3
|
+
* Enum of supported text shadow preset types.
|
|
4
|
+
*/
|
|
5
|
+
export var TextEffectPresetName;
|
|
6
|
+
(function (TextEffectPresetName) {
|
|
7
|
+
TextEffectPresetName["DEFAULT"] = "default";
|
|
8
|
+
TextEffectPresetName["CLASSIC"] = "classic";
|
|
9
|
+
TextEffectPresetName["EMERGING"] = "emerging";
|
|
10
|
+
TextEffectPresetName["GLOW"] = "glow";
|
|
11
|
+
TextEffectPresetName["TEXT"] = "text";
|
|
12
|
+
TextEffectPresetName["BOLD"] = "bold";
|
|
13
|
+
TextEffectPresetName["NEON"] = "neon";
|
|
14
|
+
TextEffectPresetName["ANAGLYPH"] = "anaglyph";
|
|
15
|
+
TextEffectPresetName["FIRE"] = "fire";
|
|
16
|
+
TextEffectPresetName["THREE_D"] = "3d";
|
|
17
|
+
TextEffectPresetName["FROSTY"] = "frosty";
|
|
18
|
+
TextEffectPresetName["INK"] = "ink";
|
|
19
|
+
TextEffectPresetName["RAINBOW"] = "rainbow";
|
|
20
|
+
TextEffectPresetName["OUTLINE"] = "outline";
|
|
21
|
+
TextEffectPresetName["STROKE"] = "stroke";
|
|
22
|
+
})(TextEffectPresetName || (TextEffectPresetName = {}));
|
|
23
|
+
/**
|
|
24
|
+
* Utility class for building CSS text-shadow values based on different presets.
|
|
25
|
+
*/
|
|
26
|
+
export class TextShadowBuilder {
|
|
27
|
+
/**
|
|
28
|
+
* Map of preset names to their corresponding shadow generation strategies.
|
|
29
|
+
*/
|
|
30
|
+
static strategies = {
|
|
31
|
+
[TextEffectPresetName.CLASSIC]: ({ size, shadowColor }) => {
|
|
32
|
+
return `0 0 ${size}em ${shadowColor}`;
|
|
33
|
+
},
|
|
34
|
+
[TextEffectPresetName.EMERGING]: ({ size, shadowColor, textColor }) => {
|
|
35
|
+
if (!textColor)
|
|
36
|
+
textColor = '#FFFFFF';
|
|
37
|
+
const c1 = tinycolor.mix(shadowColor, textColor, 10).toString('hex8');
|
|
38
|
+
const c2 = tinycolor.mix(shadowColor, textColor, 15).toString('hex8');
|
|
39
|
+
const c3 = tinycolor.mix(shadowColor, textColor, 30).toString('hex8');
|
|
40
|
+
const c4 = tinycolor.mix(shadowColor, textColor, 45).toString('hex8');
|
|
41
|
+
const c5 = tinycolor.mix(shadowColor, textColor, 60).toString('hex8');
|
|
42
|
+
const c6 = tinycolor.mix(shadowColor, textColor, 75).toString('hex8');
|
|
43
|
+
const c7 = tinycolor.mix(shadowColor, textColor, 90).toString('hex8');
|
|
44
|
+
return `0 ${(2 / 23) * size}em ${(2 / 23) * size}em ${c7}, ${(-2 / 23) * size}em ${(5 / 23) * size}em ${(1 / 23) * size}em ${c6}, ${(-4 / 23) * size}em ${(8 / 23) * size}em 0em ${c5}, ${(-6 / 23) * size}em ${(11 / 23) * size}em 0em ${c4}, ${(-8 / 23) * size}em ${(14 / 23) * size}em 0em ${c3}, ${(-10 / 23) * size}em ${(17 / 23) * size}em 0em ${c2}, ${(-12 / 23) * size}em ${(20 / 23) * size}em 0em ${c1}, ${(-14 / 23) * size}em ${size}em 0em ${shadowColor}`;
|
|
45
|
+
},
|
|
46
|
+
[TextEffectPresetName.GLOW]: ({ size, shadowColor }) => {
|
|
47
|
+
const shadowsBuffer = [];
|
|
48
|
+
const step = size / 7;
|
|
49
|
+
for (let i = 0; i < size; i += step) {
|
|
50
|
+
if (shadowsBuffer.length < 2) {
|
|
51
|
+
shadowsBuffer.push(`0px 0px ${i}em #fff`);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
shadowsBuffer.push(`0px 0px ${i}em ${shadowColor}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return shadowsBuffer.join(', ');
|
|
58
|
+
},
|
|
59
|
+
[TextEffectPresetName.TEXT]: ({ size, shadowColor }) => {
|
|
60
|
+
return `${size}em ${size}em 0 ${shadowColor}`;
|
|
61
|
+
},
|
|
62
|
+
[TextEffectPresetName.BOLD]: ({ size, shadowColor }) => {
|
|
63
|
+
return TextShadowBuilder.funkyShadowString(size, shadowColor);
|
|
64
|
+
},
|
|
65
|
+
[TextEffectPresetName.NEON]: ({ size, shadowColor }) => {
|
|
66
|
+
const shadows = [];
|
|
67
|
+
for (let i = 1; i <= 3; i++) {
|
|
68
|
+
shadows.push(`0 0 ${i * size}em ${shadowColor}, 0 0 ${(i * size) / 2}em ${shadowColor}`);
|
|
69
|
+
}
|
|
70
|
+
return shadows.join(', ');
|
|
71
|
+
},
|
|
72
|
+
[TextEffectPresetName.ANAGLYPH]: ({ size, shadowColor }) => {
|
|
73
|
+
// We maintain the opacity from the shadowColor which already includes it
|
|
74
|
+
const baseColor = tinycolor(shadowColor);
|
|
75
|
+
const opacity = baseColor.getAlpha();
|
|
76
|
+
const c2 = baseColor.clone().spin(120).setAlpha(opacity).toString('hex8');
|
|
77
|
+
return `${size}em ${size}em ${shadowColor}, -${size}em -${size}em ${c2}`;
|
|
78
|
+
},
|
|
79
|
+
[TextEffectPresetName.FIRE]: ({ size, shadowColor }) => {
|
|
80
|
+
return `0 0 ${size}em ${shadowColor}, 0 0 ${size / 2}em ${shadowColor}, 0 0 ${size / 4}em ${shadowColor}, 0 0 ${size / 8}em ${shadowColor}`;
|
|
81
|
+
},
|
|
82
|
+
[TextEffectPresetName.THREE_D]: ({ size, shadowColor }) => {
|
|
83
|
+
const baseColor = tinycolor(shadowColor);
|
|
84
|
+
const opacity = baseColor.getAlpha();
|
|
85
|
+
const depth = size * 10;
|
|
86
|
+
const shadows = [];
|
|
87
|
+
for (let i = 1; i <= depth; i++) {
|
|
88
|
+
const stepOpacity = opacity - i * (opacity / depth);
|
|
89
|
+
shadows.push(`${i * 0.01}em ${i * 0.01}em rgba(0, 0, 0, ${stepOpacity > 0 ? stepOpacity : 0})`);
|
|
90
|
+
}
|
|
91
|
+
return shadows.join(', ');
|
|
92
|
+
},
|
|
93
|
+
[TextEffectPresetName.RAINBOW]: ({ size, shadowColor }) => {
|
|
94
|
+
const baseColor = tinycolor(shadowColor);
|
|
95
|
+
const opacity = baseColor.getAlpha();
|
|
96
|
+
const shadows = [];
|
|
97
|
+
const colorSteps = 7;
|
|
98
|
+
const hueStep = 360 / colorSteps;
|
|
99
|
+
const offsetIncrement = size * 0.1;
|
|
100
|
+
const offsetStart = offsetIncrement;
|
|
101
|
+
for (let i = 0; i < colorSteps; i++) {
|
|
102
|
+
const hueShift = i * hueStep;
|
|
103
|
+
const rainbowColor = baseColor.clone().spin(hueShift).setAlpha(opacity).toString('hex8');
|
|
104
|
+
const offset = offsetStart + i * offsetIncrement;
|
|
105
|
+
shadows.push(`${offset}em ${offset}em 0 ${rainbowColor}`);
|
|
106
|
+
}
|
|
107
|
+
return shadows.join(', ');
|
|
108
|
+
},
|
|
109
|
+
[TextEffectPresetName.FROSTY]: ({ size, shadowColor }) => {
|
|
110
|
+
const baseColor = tinycolor(shadowColor);
|
|
111
|
+
const opacity = baseColor.getAlpha();
|
|
112
|
+
const frostEffect = tinycolor
|
|
113
|
+
.mix(shadowColor, '#FFFFFF', 50)
|
|
114
|
+
.setAlpha(opacity)
|
|
115
|
+
.toString('hex8');
|
|
116
|
+
const shadows = [];
|
|
117
|
+
for (let i = 1; i <= size * 5; i++) {
|
|
118
|
+
shadows.push(`0 0 ${i * 0.05}em ${frostEffect}`);
|
|
119
|
+
}
|
|
120
|
+
return shadows.join(', ');
|
|
121
|
+
},
|
|
122
|
+
[TextEffectPresetName.OUTLINE]: ({ size, shadowColor }) => {
|
|
123
|
+
const shadows = [];
|
|
124
|
+
const STEPS = 32; // Fixed number of steps for consistent quality
|
|
125
|
+
for (let i = 0; i < STEPS; i++) {
|
|
126
|
+
const angle = (i / STEPS) * 2 * Math.PI;
|
|
127
|
+
const x = Math.cos(angle) * size;
|
|
128
|
+
const y = Math.sin(angle) * size;
|
|
129
|
+
shadows.push(`${x}em ${y}em 0 ${shadowColor}`);
|
|
130
|
+
}
|
|
131
|
+
return shadows.join(', ');
|
|
132
|
+
},
|
|
133
|
+
[TextEffectPresetName.STROKE]: ({ size, shadowColor }) => {
|
|
134
|
+
// Stroke is essentially a thicker outline
|
|
135
|
+
return TextShadowBuilder.strategies[TextEffectPresetName.OUTLINE]({
|
|
136
|
+
size,
|
|
137
|
+
shadowColor
|
|
138
|
+
});
|
|
139
|
+
},
|
|
140
|
+
[TextEffectPresetName.INK]: ({ size, shadowColor }) => {
|
|
141
|
+
// Implementation for ink effect
|
|
142
|
+
const shadows = [];
|
|
143
|
+
const inkSteps = 5;
|
|
144
|
+
for (let i = 1; i <= inkSteps; i++) {
|
|
145
|
+
const offset = (i / inkSteps) * size;
|
|
146
|
+
shadows.push(`${offset}em ${offset}em 0 ${shadowColor}`);
|
|
147
|
+
shadows.push(`-${offset}em ${offset}em 0 ${shadowColor}`);
|
|
148
|
+
shadows.push(`${offset}em -${offset}em 0 ${shadowColor}`);
|
|
149
|
+
shadows.push(`-${offset}em -${offset}em 0 ${shadowColor}`);
|
|
150
|
+
}
|
|
151
|
+
return shadows.join(', ');
|
|
152
|
+
},
|
|
153
|
+
[TextEffectPresetName.DEFAULT]: ({ size, shadowColor }) => {
|
|
154
|
+
let lineColor = '#000000';
|
|
155
|
+
const parsedColor = tinycolor(shadowColor);
|
|
156
|
+
if (parsedColor.isValid() && parsedColor.isDark()) {
|
|
157
|
+
lineColor = '#FFFFFF';
|
|
158
|
+
}
|
|
159
|
+
return `0 0 ${size}em ${shadowColor}, 0.015em 0.015em 0.03em ${lineColor}`;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Helper method to create a funky shadow string for specific presets.
|
|
164
|
+
* @param toSize The maximum size for the shadow.
|
|
165
|
+
* @param color The shadow color.
|
|
166
|
+
* @returns A CSS text-shadow string.
|
|
167
|
+
*/
|
|
168
|
+
static funkyShadowString(toSize, color) {
|
|
169
|
+
const shadows = [];
|
|
170
|
+
for (let i = -0.07; i <= toSize; i += 0.01) {
|
|
171
|
+
shadows.push(`${i}em ${i}em ${color}`);
|
|
172
|
+
}
|
|
173
|
+
return shadows.join(', ');
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Builds a CSS text-shadow value based on the provided configuration.
|
|
177
|
+
* @param config The configuration for the text shadow.
|
|
178
|
+
* @returns A CSS text-shadow string or 'none' if size is <= 0.
|
|
179
|
+
*/
|
|
180
|
+
static build(config) {
|
|
181
|
+
const { preset, size, color, opacity, textColor } = config;
|
|
182
|
+
// If size is less than or equal to 0, return 'none' (no shadow)
|
|
183
|
+
if (size <= 0) {
|
|
184
|
+
return 'none';
|
|
185
|
+
}
|
|
186
|
+
// Process the color with opacity
|
|
187
|
+
const colorObj = tinycolor(color);
|
|
188
|
+
const shadowColor = colorObj.setAlpha(opacity).toString('hex8');
|
|
189
|
+
// Get the appropriate strategy based on presetName
|
|
190
|
+
const strategy = TextShadowBuilder.strategies[preset];
|
|
191
|
+
// If no strategy is found, fall back to 'classic' or return 'none'
|
|
192
|
+
if (!strategy) {
|
|
193
|
+
console.warn(`TextShadowBuilder: Unknown preset name "${preset}". Falling back to "classic".`);
|
|
194
|
+
return TextShadowBuilder.strategies[TextEffectPresetName.CLASSIC]({
|
|
195
|
+
size,
|
|
196
|
+
shadowColor
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
// Execute the strategy with the processed params
|
|
200
|
+
return strategy({
|
|
201
|
+
size,
|
|
202
|
+
shadowColor,
|
|
203
|
+
textColor
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Builds a CSS filter drop-shadow value by converting a text-shadow string.
|
|
208
|
+
* This is used to apply shadows to elements with transparent text, such as those with gradient fills.
|
|
209
|
+
* @param config The configuration for the text shadow.
|
|
210
|
+
* @returns A CSS filter string with one or more drop-shadow() functions, or 'none'.
|
|
211
|
+
*/
|
|
212
|
+
static buildDropShadow(config) {
|
|
213
|
+
const textShadowString = this.build(config);
|
|
214
|
+
if (textShadowString === 'none' || !textShadowString) {
|
|
215
|
+
return 'none';
|
|
216
|
+
}
|
|
217
|
+
// Split the text-shadow string by commas, but be careful not to split inside `rgba()` or other color functions.
|
|
218
|
+
// A simple split by comma is usually sufficient here as the color functions are at the end.
|
|
219
|
+
const shadows = textShadowString.split(/,(?=\s*[\d-])/);
|
|
220
|
+
const dropShadows = shadows.map((shadow) => {
|
|
221
|
+
// Trim and wrap each individual shadow definition in its own drop-shadow() function.
|
|
222
|
+
return `drop-shadow(${shadow.trim()})`;
|
|
223
|
+
});
|
|
224
|
+
// Join the individual drop-shadow() functions with spaces for the final filter property.
|
|
225
|
+
return dropShadows.join(' ');
|
|
226
|
+
}
|
|
227
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { StyleProcessor } from '../StyleProcessor.js';
|
|
2
|
+
import type { Appearance } from '../../..';
|
|
3
|
+
export declare class AppearanceStyleProcessor implements StyleProcessor<Appearance | undefined> {
|
|
4
|
+
process(appearance: Appearance | undefined): Record<string, any>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ColorTransformer } from '../../../transformers/ColorTransformer.js';
|
|
2
|
+
import { get } from 'lodash-es';
|
|
3
|
+
export class AppearanceStyleProcessor {
|
|
4
|
+
process(appearance) {
|
|
5
|
+
if (!appearance)
|
|
6
|
+
return {};
|
|
7
|
+
let styles = {
|
|
8
|
+
width: `${appearance.width}px`,
|
|
9
|
+
height: `${appearance.height}px`
|
|
10
|
+
};
|
|
11
|
+
// Width and height are usually set directly by HtmlBuilder on the wrapper,
|
|
12
|
+
// but if they were to be part of the inline style object, they'd go here.
|
|
13
|
+
// For now, assuming HtmlBuilder handles this for the primary dimensions.
|
|
14
|
+
// styles.width = `${appearance.width}px`;
|
|
15
|
+
// styles.height = `${appearance.height}px`;
|
|
16
|
+
if (appearance.opacity !== undefined && appearance.opacity !== 1) {
|
|
17
|
+
styles.opacity = appearance.opacity.toString();
|
|
18
|
+
}
|
|
19
|
+
const hasRotation = appearance.rotation && appearance.rotation !== 0;
|
|
20
|
+
const hasScale = (appearance.scaleX !== undefined && appearance.scaleX !== 1) ||
|
|
21
|
+
(appearance.scaleY !== undefined && appearance.scaleY !== 1);
|
|
22
|
+
if (hasRotation || hasScale) {
|
|
23
|
+
let transform = `translate(${appearance.x || 0}px, ${appearance.y || 0}px)`;
|
|
24
|
+
if (hasRotation)
|
|
25
|
+
transform += ` rotate(${appearance.rotation}deg)`;
|
|
26
|
+
if (hasScale) {
|
|
27
|
+
transform += ` scale(${appearance.scaleX ?? 1}, ${appearance.scaleY ?? 1})`;
|
|
28
|
+
}
|
|
29
|
+
styles.transform = transform;
|
|
30
|
+
// If the wrapper is already at (0,0) and this element is being transformed from that origin
|
|
31
|
+
styles.top = '0px';
|
|
32
|
+
styles.left = '0px';
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
if (appearance.x !== undefined)
|
|
36
|
+
styles.left = `${appearance.x}px`;
|
|
37
|
+
if (appearance.y !== undefined)
|
|
38
|
+
styles.top = `${appearance.y}px`;
|
|
39
|
+
}
|
|
40
|
+
// Add alignment styles
|
|
41
|
+
if (appearance.horizontalAlign) {
|
|
42
|
+
styles.justifyContent = appearance.horizontalAlign;
|
|
43
|
+
}
|
|
44
|
+
if (appearance.verticalAlign) {
|
|
45
|
+
styles.alignItems = appearance.verticalAlign;
|
|
46
|
+
}
|
|
47
|
+
// Handle background
|
|
48
|
+
if (appearance.background && get(appearance.background, 'enabled')) {
|
|
49
|
+
const color = ColorTransformer.transform(get(appearance.background, 'color', '#000000'), 'background');
|
|
50
|
+
if (get(appearance, 'background.radius', 0) > 0) {
|
|
51
|
+
styles.borderRadius = `${get(appearance.background, 'radius')}em`;
|
|
52
|
+
}
|
|
53
|
+
styles = { ...styles, ...color };
|
|
54
|
+
}
|
|
55
|
+
return styles;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { StyleProcessor } from '../StyleProcessor.js';
|
|
2
|
+
import type { TextAppearance } from '../../..';
|
|
3
|
+
export declare class TextAppearanceStyleProcessor implements StyleProcessor<TextAppearance | undefined> {
|
|
4
|
+
process(textAppearance: TextAppearance | undefined): Record<string, any>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ColorTransformer } from '../../../transformers/ColorTransformer.js';
|
|
2
|
+
export class TextAppearanceStyleProcessor {
|
|
3
|
+
process(textAppearance) {
|
|
4
|
+
let styles = {};
|
|
5
|
+
if (!textAppearance)
|
|
6
|
+
return styles;
|
|
7
|
+
if (textAppearance.fontFamily)
|
|
8
|
+
styles.fontFamily = textAppearance.fontFamily;
|
|
9
|
+
if (textAppearance.fontWeight)
|
|
10
|
+
styles.fontWeight = String(textAppearance.fontWeight);
|
|
11
|
+
if (textAppearance.textAlign)
|
|
12
|
+
styles.textAlign = textAppearance.textAlign;
|
|
13
|
+
const fontSize = textAppearance.fontSize;
|
|
14
|
+
if (fontSize) {
|
|
15
|
+
styles.fontSize =
|
|
16
|
+
typeof fontSize === 'number'
|
|
17
|
+
? `${fontSize}px`
|
|
18
|
+
: `${fontSize.value}${fontSize.unit || 'px'}`;
|
|
19
|
+
}
|
|
20
|
+
const lineHeight = textAppearance.lineHeight;
|
|
21
|
+
if (lineHeight) {
|
|
22
|
+
styles.lineHeight = `${lineHeight.value}${lineHeight.unit || 'em'}`;
|
|
23
|
+
}
|
|
24
|
+
const letterSpacing = textAppearance.letterSpacing;
|
|
25
|
+
if (letterSpacing) {
|
|
26
|
+
styles.letterSpacing = `${letterSpacing.value}${letterSpacing.unit || 'px'}`;
|
|
27
|
+
}
|
|
28
|
+
if (textAppearance.color) {
|
|
29
|
+
const color = ColorTransformer.transform(textAppearance.color, 'text');
|
|
30
|
+
styles = { ...styles, ...color };
|
|
31
|
+
}
|
|
32
|
+
if (textAppearance.textTransform && textAppearance.textTransform !== 'none') {
|
|
33
|
+
styles.textTransform = textAppearance.textTransform;
|
|
34
|
+
}
|
|
35
|
+
return styles;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { StyleProcessor } from '../StyleProcessor.js';
|
|
2
|
+
type ComponentEffectsMap = Record<string, any>;
|
|
3
|
+
export declare class TextEffectsStyleProcessor implements StyleProcessor<ComponentEffectsMap | undefined> {
|
|
4
|
+
process(effectsMap: ComponentEffectsMap | undefined): Record<string, any>;
|
|
5
|
+
}
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { TextEffectPresetName, TextShadowBuilder } from '../TextShadowBuilder.js';
|
|
3
|
+
const GenericTextEffectShape = z.object({
|
|
4
|
+
enabled: z.boolean().optional(),
|
|
5
|
+
preset: z.nativeEnum(TextEffectPresetName).optional(),
|
|
6
|
+
size: z.number().optional(),
|
|
7
|
+
color: z.string().optional(),
|
|
8
|
+
opacity: z.number().optional()
|
|
9
|
+
});
|
|
10
|
+
export class TextEffectsStyleProcessor {
|
|
11
|
+
process(effectsMap) {
|
|
12
|
+
const styles = {};
|
|
13
|
+
if (!effectsMap)
|
|
14
|
+
return styles;
|
|
15
|
+
const shadowStrings = [];
|
|
16
|
+
// text-stroke
|
|
17
|
+
if (effectsMap.textOutline) {
|
|
18
|
+
const data = effectsMap.textOutline;
|
|
19
|
+
const parsedEffect = GenericTextEffectShape.safeParse(data);
|
|
20
|
+
if (parsedEffect.success &&
|
|
21
|
+
parsedEffect.data.enabled &&
|
|
22
|
+
parsedEffect.data.size &&
|
|
23
|
+
parsedEffect.data.size > 0) {
|
|
24
|
+
const data = parsedEffect.data;
|
|
25
|
+
const size = data.size || 0.3;
|
|
26
|
+
const color = data.color || '#000000';
|
|
27
|
+
const shadow = TextShadowBuilder.build({
|
|
28
|
+
preset: TextEffectPresetName.OUTLINE,
|
|
29
|
+
size,
|
|
30
|
+
color,
|
|
31
|
+
opacity: data.opacity || 1
|
|
32
|
+
});
|
|
33
|
+
if (shadow && shadow !== 'none') {
|
|
34
|
+
shadowStrings.push(shadow);
|
|
35
|
+
}
|
|
36
|
+
// styles.webkitTextStroke = `${size}em ${color}`;
|
|
37
|
+
// styles.webkitTextFillColor = 'white';
|
|
38
|
+
// styles.paintOrder = 'stroke fill';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
for (const effectName in effectsMap) {
|
|
42
|
+
const effect = effectsMap[effectName];
|
|
43
|
+
if (effect.type === 'textShadow') {
|
|
44
|
+
const parsedEffect = GenericTextEffectShape.safeParse(effect);
|
|
45
|
+
if (parsedEffect.success &&
|
|
46
|
+
parsedEffect.data.enabled &&
|
|
47
|
+
parsedEffect.data.size &&
|
|
48
|
+
parsedEffect.data.size > 0) {
|
|
49
|
+
const data = parsedEffect.data;
|
|
50
|
+
const preset = data.preset || TextEffectPresetName.CLASSIC;
|
|
51
|
+
const shadow = TextShadowBuilder.build({
|
|
52
|
+
preset,
|
|
53
|
+
size: data.size || 0.3,
|
|
54
|
+
color: data.color || '#000000',
|
|
55
|
+
opacity: data.opacity || 1
|
|
56
|
+
});
|
|
57
|
+
if (shadow && shadow !== 'none') {
|
|
58
|
+
shadowStrings.push(shadow);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (shadowStrings.length > 0) {
|
|
64
|
+
styles.textShadow = shadowStrings.join(', ');
|
|
65
|
+
}
|
|
66
|
+
return styles;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { CommandType } from './CommandTypes.js';
|
|
2
|
+
import { PlayCommand } from './PlayCommand.js';
|
|
3
|
+
import { PauseCommand } from './PauseCommand.js';
|
|
4
|
+
import { SeekCommand } from './SeekCommand.js';
|
|
5
|
+
import { UpdateComponentCommand } from './UpdateComponentCommand.js';
|
|
6
|
+
import { RenderCommand } from './RenderCommand.js';
|
|
7
|
+
import { ReplaceSourceOnTimeCommand } from './ReplaceSourceOnTimeCommand.js';
|
|
8
|
+
import { RenderFrameCommand } from './RenderFrameCommand.js';
|
|
9
|
+
export declare class CommandRunner {
|
|
10
|
+
private playCommand;
|
|
11
|
+
private pauseCommand;
|
|
12
|
+
private seekCommand;
|
|
13
|
+
private replaceSourceOnTimeCommand;
|
|
14
|
+
private renderFrameCommand;
|
|
15
|
+
private updateComponentCommand;
|
|
16
|
+
private renderCommand;
|
|
17
|
+
constructor(cradle: {
|
|
18
|
+
playCommand: PlayCommand;
|
|
19
|
+
pauseCommand: PauseCommand;
|
|
20
|
+
seekCommand: SeekCommand;
|
|
21
|
+
replaceSourceOnTimeCommand: ReplaceSourceOnTimeCommand;
|
|
22
|
+
renderFrameCommand: RenderFrameCommand;
|
|
23
|
+
updateComponentCommand: UpdateComponentCommand;
|
|
24
|
+
renderCommand: RenderCommand;
|
|
25
|
+
});
|
|
26
|
+
run<T = void>(commandType: CommandType, props?: unknown): Promise<T>;
|
|
27
|
+
runSync<T>(commandType: CommandType, props?: unknown): T;
|
|
28
|
+
}
|