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.
Files changed (219) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +213 -0
  3. package/dist/DIContainer.d.ts +4 -0
  4. package/dist/DIContainer.js +145 -0
  5. package/dist/SceneBuilder.svelte.d.ts +8574 -0
  6. package/dist/SceneBuilder.svelte.js +409 -0
  7. package/dist/adapters/subtitleHelpers.d.ts +2 -0
  8. package/dist/adapters/subtitleHelpers.js +187 -0
  9. package/dist/animations/AnimationContext.d.ts +17 -0
  10. package/dist/animations/AnimationContext.js +72 -0
  11. package/dist/animations/AnimationPresetsRegister.d.ts +362 -0
  12. package/dist/animations/AnimationPresetsRegister.js +20 -0
  13. package/dist/animations/AnimationSetup.d.ts +8 -0
  14. package/dist/animations/AnimationSetup.js +30 -0
  15. package/dist/animations/SplitTextCache.d.ts +28 -0
  16. package/dist/animations/SplitTextCache.js +68 -0
  17. package/dist/animations/animationBuilder.d.ts +31 -0
  18. package/dist/animations/animationBuilder.js +255 -0
  19. package/dist/animations/animationPreset.d.ts +7 -0
  20. package/dist/animations/animationPreset.js +31 -0
  21. package/dist/animations/builders/AnimationPresetFactory.d.ts +43 -0
  22. package/dist/animations/builders/AnimationPresetFactory.js +139 -0
  23. package/dist/animations/builders/LineHighlighterAnimationBuilder.d.ts +16 -0
  24. package/dist/animations/builders/LineHighlighterAnimationBuilder.js +183 -0
  25. package/dist/animations/builders/WordHighlighterAnimationBuilder.d.ts +15 -0
  26. package/dist/animations/builders/WordHighlighterAnimationBuilder.js +180 -0
  27. package/dist/animations/engines/AnimationEngineAdaptor.d.ts +107 -0
  28. package/dist/animations/engines/AnimationEngineAdaptor.js +1 -0
  29. package/dist/animations/engines/GSAPEngineAdaptor.d.ts +21 -0
  30. package/dist/animations/engines/GSAPEngineAdaptor.js +145 -0
  31. package/dist/animations/presets/index.d.ts +2 -0
  32. package/dist/animations/presets/index.js +3 -0
  33. package/dist/animations/presets/lines.d.ts +52 -0
  34. package/dist/animations/presets/lines.js +547 -0
  35. package/dist/animations/presets/words.d.ts +31 -0
  36. package/dist/animations/presets/words.js +268 -0
  37. package/dist/animations/transformers/AnimationReferenceTransformer.d.ts +9 -0
  38. package/dist/animations/transformers/AnimationReferenceTransformer.js +114 -0
  39. package/dist/builders/PixiComponentBuilder.d.ts +63 -0
  40. package/dist/builders/PixiComponentBuilder.js +112 -0
  41. package/dist/builders/_ComponentState.svelte.d.ts +795 -0
  42. package/dist/builders/_ComponentState.svelte.js +203 -0
  43. package/dist/builders/html/HtmlBuilder.d.ts +66 -0
  44. package/dist/builders/html/HtmlBuilder.js +171 -0
  45. package/dist/builders/html/HtmlBuilderFactory.d.ts +27 -0
  46. package/dist/builders/html/HtmlBuilderFactory.js +30 -0
  47. package/dist/builders/html/StyleBuilder.d.ts +13 -0
  48. package/dist/builders/html/StyleBuilder.js +133 -0
  49. package/dist/builders/html/StyleProcessor.d.ts +9 -0
  50. package/dist/builders/html/StyleProcessor.js +1 -0
  51. package/dist/builders/html/TextComponentHtmlBuilder.d.ts +16 -0
  52. package/dist/builders/html/TextComponentHtmlBuilder.js +93 -0
  53. package/dist/builders/html/TextShadowBuilder.d.ts +60 -0
  54. package/dist/builders/html/TextShadowBuilder.js +227 -0
  55. package/dist/builders/html/processors/AppearanceStyleProcessor.d.ts +5 -0
  56. package/dist/builders/html/processors/AppearanceStyleProcessor.js +57 -0
  57. package/dist/builders/html/processors/TextAppearanceStyleProcessor.d.ts +5 -0
  58. package/dist/builders/html/processors/TextAppearanceStyleProcessor.js +37 -0
  59. package/dist/builders/html/processors/TextEffectsStyleProcessor.d.ts +6 -0
  60. package/dist/builders/html/processors/TextEffectsStyleProcessor.js +68 -0
  61. package/dist/commands/Command.d.ts +6 -0
  62. package/dist/commands/Command.js +1 -0
  63. package/dist/commands/CommandRunner.d.ts +28 -0
  64. package/dist/commands/CommandRunner.js +81 -0
  65. package/dist/commands/CommandTypes.d.ts +11 -0
  66. package/dist/commands/CommandTypes.js +13 -0
  67. package/dist/commands/PauseCommand.d.ts +4 -0
  68. package/dist/commands/PauseCommand.js +5 -0
  69. package/dist/commands/PlayCommand.d.ts +4 -0
  70. package/dist/commands/PlayCommand.js +6 -0
  71. package/dist/commands/RenderCommand.d.ts +15 -0
  72. package/dist/commands/RenderCommand.js +18 -0
  73. package/dist/commands/RenderFrameCommand.d.ts +17 -0
  74. package/dist/commands/RenderFrameCommand.js +93 -0
  75. package/dist/commands/ReplaceSourceOnTimeCommand.d.ts +4 -0
  76. package/dist/commands/ReplaceSourceOnTimeCommand.js +22 -0
  77. package/dist/commands/SeekCommand.d.ts +15 -0
  78. package/dist/commands/SeekCommand.js +39 -0
  79. package/dist/commands/UpdateComponentCommand.d.ts +4 -0
  80. package/dist/commands/UpdateComponentCommand.js +17 -0
  81. package/dist/components/AnimatedGIF.d.ts +201 -0
  82. package/dist/components/AnimatedGIF.js +391 -0
  83. package/dist/components/Component.svelte.d.ts +33 -0
  84. package/dist/components/Component.svelte.js +152 -0
  85. package/dist/components/ComponentContext.svelte.d.ts +33 -0
  86. package/dist/components/ComponentContext.svelte.js +105 -0
  87. package/dist/components/hooks/AnimationHook.d.ts +25 -0
  88. package/dist/components/hooks/AnimationHook.js +180 -0
  89. package/dist/components/hooks/CanvasShapeHook.d.ts +12 -0
  90. package/dist/components/hooks/CanvasShapeHook.js +229 -0
  91. package/dist/components/hooks/HtmlAnimationHook.d.ts +8 -0
  92. package/dist/components/hooks/HtmlAnimationHook.js +70 -0
  93. package/dist/components/hooks/HtmlTextHook.d.ts +16 -0
  94. package/dist/components/hooks/HtmlTextHook.js +102 -0
  95. package/dist/components/hooks/HtmlToCanvasHook.d.ts +16 -0
  96. package/dist/components/hooks/HtmlToCanvasHook.js +148 -0
  97. package/dist/components/hooks/ImageHook.d.ts +10 -0
  98. package/dist/components/hooks/ImageHook.js +45 -0
  99. package/dist/components/hooks/MediaHook.d.ts +15 -0
  100. package/dist/components/hooks/MediaHook.js +252 -0
  101. package/dist/components/hooks/MediaSeekingHook.d.ts +12 -0
  102. package/dist/components/hooks/MediaSeekingHook.js +204 -0
  103. package/dist/components/hooks/PixiDisplayObjectHook.d.ts +15 -0
  104. package/dist/components/hooks/PixiDisplayObjectHook.js +77 -0
  105. package/dist/components/hooks/PixiGifHook.d.ts +15 -0
  106. package/dist/components/hooks/PixiGifHook.js +97 -0
  107. package/dist/components/hooks/PixiProgressShapeHook.d.ts +12 -0
  108. package/dist/components/hooks/PixiProgressShapeHook.js +128 -0
  109. package/dist/components/hooks/PixiSplitScreenDisplayObjectHook.d.ts +21 -0
  110. package/dist/components/hooks/PixiSplitScreenDisplayObjectHook.js +210 -0
  111. package/dist/components/hooks/PixiTextureHook.d.ts +7 -0
  112. package/dist/components/hooks/PixiTextureHook.js +29 -0
  113. package/dist/components/hooks/PixiVideoTextureHook.d.ts +10 -0
  114. package/dist/components/hooks/PixiVideoTextureHook.js +35 -0
  115. package/dist/components/hooks/SubtitlesHook.d.ts +88 -0
  116. package/dist/components/hooks/SubtitlesHook.js +199 -0
  117. package/dist/components/hooks/VerifyGifHook.d.ts +7 -0
  118. package/dist/components/hooks/VerifyGifHook.js +27 -0
  119. package/dist/components/hooks/VerifyImageHook.d.ts +7 -0
  120. package/dist/components/hooks/VerifyImageHook.js +27 -0
  121. package/dist/components/hooks/VerifyMediaHook.d.ts +7 -0
  122. package/dist/components/hooks/VerifyMediaHook.js +21 -0
  123. package/dist/components/hooks/shapes/progress/CustomProgressRenderer.d.ts +8 -0
  124. package/dist/components/hooks/shapes/progress/CustomProgressRenderer.js +53 -0
  125. package/dist/components/hooks/shapes/progress/DoubleProgressRenderer.d.ts +8 -0
  126. package/dist/components/hooks/shapes/progress/DoubleProgressRenderer.js +69 -0
  127. package/dist/components/hooks/shapes/progress/LinearProgressRenderer.d.ts +8 -0
  128. package/dist/components/hooks/shapes/progress/LinearProgressRenderer.js +60 -0
  129. package/dist/components/hooks/shapes/progress/PerimeterProgressRenderer.d.ts +9 -0
  130. package/dist/components/hooks/shapes/progress/PerimeterProgressRenderer.js +213 -0
  131. package/dist/components/hooks/shapes/progress/ProgressRenderer.d.ts +17 -0
  132. package/dist/components/hooks/shapes/progress/ProgressRenderer.js +75 -0
  133. package/dist/components/hooks/shapes/progress/RadialProgressRenderer.d.ts +8 -0
  134. package/dist/components/hooks/shapes/progress/RadialProgressRenderer.js +50 -0
  135. package/dist/components/hooks/shapes/progress/index.d.ts +6 -0
  136. package/dist/components/hooks/shapes/progress/index.js +6 -0
  137. package/dist/composers/componentComposer.d.ts +55 -0
  138. package/dist/composers/componentComposer.js +118 -0
  139. package/dist/composers/layerComposer.d.ts +46 -0
  140. package/dist/composers/layerComposer.js +79 -0
  141. package/dist/composers/sceneComposer.d.ts +48 -0
  142. package/dist/composers/sceneComposer.js +92 -0
  143. package/dist/constants.d.ts +12 -0
  144. package/dist/constants.js +14 -0
  145. package/dist/directors/ComponentDirector.d.ts +20 -0
  146. package/dist/directors/ComponentDirector.js +86 -0
  147. package/dist/factories/SceneBuilderFactory.d.ts +15 -0
  148. package/dist/factories/SceneBuilderFactory.js +51 -0
  149. package/dist/fonts/GoogleFontsProvider.d.ts +12 -0
  150. package/dist/fonts/GoogleFontsProvider.js +125 -0
  151. package/dist/fonts/fontLoader.d.ts +15 -0
  152. package/dist/fonts/fontLoader.js +41 -0
  153. package/dist/fonts/types.d.ts +1 -0
  154. package/dist/fonts/types.js +1 -0
  155. package/dist/index.d.ts +11 -0
  156. package/dist/index.js +14 -0
  157. package/dist/layers/Layer.svelte.d.ts +8492 -0
  158. package/dist/layers/Layer.svelte.js +125 -0
  159. package/dist/managers/AppManager.svelte.d.ts +23 -0
  160. package/dist/managers/AppManager.svelte.js +89 -0
  161. package/dist/managers/ComponentsManager.svelte.d.ts +49 -0
  162. package/dist/managers/ComponentsManager.svelte.js +247 -0
  163. package/dist/managers/DomManager.d.ts +18 -0
  164. package/dist/managers/DomManager.js +73 -0
  165. package/dist/managers/EventManager.d.ts +7 -0
  166. package/dist/managers/EventManager.js +22 -0
  167. package/dist/managers/LayersManager.svelte.d.ts +8499 -0
  168. package/dist/managers/LayersManager.svelte.js +176 -0
  169. package/dist/managers/MediaManager.d.ts +32 -0
  170. package/dist/managers/MediaManager.js +243 -0
  171. package/dist/managers/RenderManager.d.ts +23 -0
  172. package/dist/managers/RenderManager.js +59 -0
  173. package/dist/managers/StateManager.svelte.d.ts +8746 -0
  174. package/dist/managers/StateManager.svelte.js +272 -0
  175. package/dist/managers/SubtitlesManager.svelte.d.ts +261 -0
  176. package/dist/managers/SubtitlesManager.svelte.js +1385 -0
  177. package/dist/managers/TimeManager.svelte.d.ts +6 -0
  178. package/dist/managers/TimeManager.svelte.js +18 -0
  179. package/dist/managers/TimelineManager.svelte.d.ts +25 -0
  180. package/dist/managers/TimelineManager.svelte.js +152 -0
  181. package/dist/registers.d.ts +12 -0
  182. package/dist/registers.js +29 -0
  183. package/dist/schemas/runtime/index.d.ts +3 -0
  184. package/dist/schemas/runtime/index.js +4 -0
  185. package/dist/schemas/runtime/types.d.ts +323 -0
  186. package/dist/schemas/runtime/types.js +12 -0
  187. package/dist/schemas/scene/animations.d.ts +89738 -0
  188. package/dist/schemas/scene/animations.js +211 -0
  189. package/dist/schemas/scene/components.js +515 -0
  190. package/dist/schemas/scene/core.js +160 -0
  191. package/dist/schemas/scene/index.d.ts +22 -0
  192. package/dist/schemas/scene/index.js +10 -0
  193. package/dist/schemas/scene/properties.d.ts +914 -0
  194. package/dist/schemas/scene/properties.js +398 -0
  195. package/dist/schemas/scene/subtitles.d.ts +1141 -0
  196. package/dist/schemas/scene/subtitles.js +111 -0
  197. package/dist/schemas/scene/utils.d.ts +1 -0
  198. package/dist/schemas/scene/utils.js +5 -0
  199. package/dist/seeds/SeedFactory.d.ts +59 -0
  200. package/dist/seeds/SeedFactory.js +99 -0
  201. package/dist/seeds/index.d.ts +8 -0
  202. package/dist/seeds/index.js +8 -0
  203. package/dist/transformers/ColorTransformer.d.ts +5 -0
  204. package/dist/transformers/ColorTransformer.js +67 -0
  205. package/dist/transformers/PixiColorTransformer.d.ts +22 -0
  206. package/dist/transformers/PixiColorTransformer.js +104 -0
  207. package/dist/utils/canvas.d.ts +6 -0
  208. package/dist/utils/canvas.js +18 -0
  209. package/dist/utils/document.d.ts +2 -0
  210. package/dist/utils/document.js +36 -0
  211. package/dist/utils/emoji.d.ts +10 -0
  212. package/dist/utils/emoji.js +51 -0
  213. package/dist/utils/html.d.ts +4 -0
  214. package/dist/utils/html.js +45 -0
  215. package/dist/utils/svgGenerator.d.ts +20 -0
  216. package/dist/utils/svgGenerator.js +103 -0
  217. package/dist/utils/utils.d.ts +5 -0
  218. package/dist/utils/utils.js +125 -0
  219. package/package.json +96 -0
@@ -0,0 +1,211 @@
1
+ import { z } from 'zod';
2
+ // Utility for numbers that might be strings (e.g., "50%") or actual numbers
3
+ const numberOrStringPercentage = z.union([z.number(), z.string().regex(/^(\d+(\.\d+)?%?)$/)]);
4
+ const PropertyFromDataShape = z.object({
5
+ fromData: z.string(),
6
+ mode: z.enum(['cycle', 'useFallback', 'clamp']).optional().default('cycle'),
7
+ fallbackValue: z.any().optional() // Can be any type, as property values vary
8
+ });
9
+ const DynamicByIndexValueShape = z.object({
10
+ /**
11
+ * Specifies that the value should be determined dynamically, typically based on an element's index.
12
+ */
13
+ type: z.literal('byIndex'),
14
+ /**
15
+ * A string representation of a JavaScript expression to be evaluated for each target element.
16
+ * This expression can use 'index' (the current element's index in the target list)
17
+ * and 'data' (the entire animation preset's resolved data context).
18
+ * Example: "index % 2 === 0 ? 100 : 50"
19
+ * Example: "data.baseValue + index * 10"
20
+ */
21
+ expression: z.string(),
22
+ /**
23
+ * An optional fallback value to be used if the expression evaluation fails
24
+ * or if the expression itself is invalid.
25
+ */
26
+ fallbackValue: z.any().optional()
27
+ });
28
+ const PropertyValueShape = z.union([
29
+ z.string(),
30
+ z.number(),
31
+ z.boolean(),
32
+ z.null(), // Direct primitive values
33
+ PropertyFromDataShape, // For { fromData: "key", mode?, fallbackValue? }
34
+ DynamicByIndexValueShape // For { type: "byIndex", expression: "..." }
35
+ ]);
36
+ // === Stagger Definition ===
37
+ const StaggerObjectShape = z
38
+ .object({
39
+ type: z.literal('fromData').optional(), // Only "fromData" has a special type currently
40
+ dataKey: z.string().optional(), // Required if type is "fromData"
41
+ referencePoint: z.literal('tweenStart').optional(), // Mostly for "fromData"
42
+ each: z.number().optional(),
43
+ from: z.union([z.string(), z.number()]).optional(), // "start", "center", "end", "edges", "random", index
44
+ grid: z
45
+ .tuple([z.union([z.literal('auto'), z.number()]), z.union([z.literal('auto'), z.number()])])
46
+ .optional(),
47
+ axis: z.enum(['x', 'y']).optional(),
48
+ ease: z.string().optional(), // Easing function string
49
+ amount: z.number().optional()
50
+ })
51
+ .refine((data) => !(data.type === 'fromData' && !data.dataKey), {
52
+ message: "dataKey is required when stagger type is 'fromData'",
53
+ path: ['dataKey']
54
+ });
55
+ const StaggerShape = z.union([
56
+ z.number(), // Shorthand for { each: <number> }
57
+ StaggerObjectShape
58
+ ]);
59
+ const BaseAnimatableProperties = z
60
+ .object({
61
+ opacity: PropertyValueShape.optional(),
62
+ x: PropertyValueShape.optional(),
63
+ y: PropertyValueShape.optional(),
64
+ scale: PropertyValueShape.optional(),
65
+ scaleX: PropertyValueShape.optional(),
66
+ scaleY: PropertyValueShape.optional(),
67
+ rotation: PropertyValueShape.optional(),
68
+ width: PropertyValueShape.optional(),
69
+ height: PropertyValueShape.optional(),
70
+ color: PropertyValueShape.optional()
71
+ // ... add more common animatable properties explicitly
72
+ })
73
+ .catchall(PropertyValueShape); // ANY other property added here must also be a PropertyValueShape
74
+ // TweenVarsShape defines the structure of the 'vars' object for a tween
75
+ const TweenVarsShape = z
76
+ .object({
77
+ // Explicitly define 'from' as an object whose values are animatable properties
78
+ from: BaseAnimatableProperties.optional(),
79
+ // Tween control properties (not animatable states themselves, but control the tween)
80
+ duration: PropertyValueShape.optional(), // Can be a number, or fromData for dynamic duration
81
+ ease: z.string().optional(),
82
+ delay: PropertyValueShape.optional(), // Can be a number, or fromData
83
+ stagger: StaggerShape.optional()
84
+ // Add other GSAP control params like repeat, yoyo, overwrite etc. explicitly if needed
85
+ // repeat: z.number().optional(),
86
+ // yoyo: z.boolean().optional(),
87
+ // For all other properties at this level (the "to" state or direct state for "set"/"from"),
88
+ // they should conform to BaseAnimatableProperties. We use .merge() or handle them with a catchall
89
+ // A simpler way is to use .catchall() here and ensure 'from', 'duration', etc. are NOT PropertyValueShape.
90
+ // Let's try with making the "to" state properties part of the catchall.
91
+ })
92
+ .catchall(z.any()); // This catchall is for the 'to' properties like opacity, x, y etc.
93
+ // Refinement to ensure the catchall doesn't incorrectly try to validate our specific control properties
94
+ // or 'from' as if they were simple PropertyValueShapes.
95
+ const FinalTweenVarsShape = TweenVarsShape.refine((vars) => {
96
+ const knownControlKeys = [
97
+ 'from',
98
+ 'duration',
99
+ 'ease',
100
+ 'delay',
101
+ 'stagger' /* add other known controls like repeat, yoyo */
102
+ ];
103
+ for (const key in vars) {
104
+ if (knownControlKeys.includes(key)) {
105
+ // Validation for these known keys is handled by their explicit Shape definitions
106
+ // (e.g., 'from' is BaseAnimatableProperties, 'stagger' is StaggerShape)
107
+ continue;
108
+ }
109
+ // For any other key (which should be an animatable "to" property),
110
+ // it must conform to PropertyValueShape (which is handled by the .catchall).
111
+ // This refine is more about being explicit; the catchall *should* work,
112
+ // but the previous error indicates a conflict in how Zod resolves the index signature.
113
+ // The key is that 'from' itself is NOT a PropertyValueShape, its *contents* are.
114
+ }
115
+ return true;
116
+ }).refine((vars) => {
117
+ // This is the original refine for 'from' being required with 'fromTo'
118
+ // This refine should be on TweenDefinitionShape, as it needs 'method'
119
+ return true;
120
+ });
121
+ // === Position Definition ===
122
+ const PositionObjectShape = z.object({
123
+ anchor: z.string(), // "componentStart", "componentEnd", "componentCenter", or a timeline item ID
124
+ anchorPoint: z.enum(['start', 'end']).optional(), // Only if anchor is another timeline item id
125
+ alignTween: z.enum(['start', 'end', 'center']).optional().default('start'),
126
+ offset: z
127
+ .string()
128
+ .regex(/^[+\-]?\d+(\.\d+)?s?$/)
129
+ .optional()
130
+ .default('0s') // e.g., "0s", "+=0.5s", "-1s"
131
+ });
132
+ const AnimationTimelinePositionShape = z.union([
133
+ z.string(), // Time value, label, relative position, "in", "out"
134
+ z.number(), // Time value, label, relative position, "in", "out"
135
+ PositionObjectShape
136
+ ]);
137
+ const TweenDefinitionShape = z
138
+ .object({
139
+ method: z.enum(['to', 'from', 'fromTo', 'set']),
140
+ position: AnimationTimelinePositionShape.optional(),
141
+ vars: FinalTweenVarsShape // Use the refined Shape
142
+ })
143
+ .refine((data) => {
144
+ if (data.method === 'fromTo' && !data.vars.from) {
145
+ return false;
146
+ }
147
+ if (data.method !== 'fromTo' && data.vars.from !== undefined) {
148
+ // Optionally make this an error:
149
+ // console.warn(`'vars.from' is only applicable when method is 'fromTo'. Found with method '${data.method}'.`);
150
+ // return false;
151
+ }
152
+ return true;
153
+ }, {
154
+ message: "'vars.from' is required when method is 'fromTo' (and only then).",
155
+ path: ['vars', 'from'] // More specific path
156
+ });
157
+ export const KeyframeAnimationShape = z.object({
158
+ /** Identifier for this keyframe-like animation definition */
159
+ id: z.string().optional(), // Optional if it's an inline anonymous definition
160
+ /** The single tween definition that constitutes this animation */
161
+ tween: TweenDefinitionShape, // Using your existing TweenDefinitionShape
162
+ /**
163
+ * Optional target for this single tween.
164
+ * Defaults to "container" if not specified.
165
+ */
166
+ target: z.string().default('container').optional()
167
+ // revertAfterComplete: z.boolean().optional().default(false), // this probably does not make sense here
168
+ });
169
+ // === Timeline Item Definition ===
170
+ const AnimationSequenceItemShape = z.object({
171
+ id: z.string().optional(),
172
+ target: z.string().optional(), // "container", "words", "lines", "chars", or CSS selector
173
+ position: AnimationTimelinePositionShape.optional(),
174
+ tweens: z.array(TweenDefinitionShape).min(1)
175
+ });
176
+ // === Setup Step Definition ===
177
+ const SetupStylePropertiesShape = z.object({}).catchall(PropertyValueShape);
178
+ const SetupStepBaseShape = z.object({
179
+ type: z.string()
180
+ // target: z.string().optional(), // If you add specific targeting for setup steps
181
+ });
182
+ const SetupStyleStepShape = SetupStepBaseShape.extend({
183
+ type: z.literal('style'),
184
+ properties: SetupStylePropertiesShape
185
+ });
186
+ const SetupSplitTextStepShape = SetupStepBaseShape.extend({
187
+ type: z.literal('splitText'),
188
+ by: z.enum(['words', 'lines', 'chars'])
189
+ });
190
+ const SetupStepShape = z.discriminatedUnion('type', [
191
+ SetupStyleStepShape,
192
+ SetupSplitTextStepShape
193
+ // ... add other setup step types here
194
+ ]);
195
+ // === Root Animation Preset Shape ===
196
+ export const AnimationPresetShape = z.object({
197
+ id: z.string(),
198
+ presetId: z.string().optional(),
199
+ version: z.string().optional(),
200
+ description: z.string().optional(),
201
+ duration: z.number().positive().optional(),
202
+ data: z.record(z.any()).default({}).optional(),
203
+ setup: z.array(SetupStepShape).default([]).optional(),
204
+ revertAfterComplete: z.boolean().default(false).optional(),
205
+ timeline: z.array(AnimationSequenceItemShape) // .min(1) - cancelled as we can have system presets that predefine the timeline so we can use this in component animations list as well
206
+ });
207
+ export const AnimationReferenceShape = z.union([
208
+ z.string(), // 1. Preset name (string ID)
209
+ AnimationPresetShape, // 2. Full AnimationPresetShape object
210
+ KeyframeAnimationShape // 3. Simplified KeyframeAnimationShape object
211
+ ]);