@octane-xplat/lottie 0.9.0 → 0.10.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 (313) hide show
  1. package/README.md +36 -16
  2. package/dist/native/index.js +10 -9
  3. package/dist/native/octane-client-build.json +1 -1
  4. package/dist/web/index.js +39 -25
  5. package/dist/web/octane-client-build.json +1 -1
  6. package/package.json +25 -3
  7. package/platforms/macos/LICENSE-EpoxyCore-Apache-2.0.txt +201 -0
  8. package/platforms/macos/LICENSE-LRUCache-MIT.txt +22 -0
  9. package/platforms/macos/LICENSE-Lottie-Apache-2.0.txt +201 -0
  10. package/platforms/macos/LICENSE-ZIPFoundation-MIT.txt +21 -0
  11. package/platforms/macos/UPSTREAM.md +13 -0
  12. package/platforms/macos/resources/PrivacyInfo.xcprivacy +23 -0
  13. package/platforms/macos/resources/THIRD-PARTY-NOTICES.txt +10 -0
  14. package/platforms/macos/src/XplatAppKitLottie.swift +246 -0
  15. package/platforms/macos/src/vendor/Lottie/PrivacyInfo.xcprivacy +23 -0
  16. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CAAnimation+TimingConfiguration.swift +81 -0
  17. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CALayer+addAnimation.swift +476 -0
  18. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CombinedShapeAnimation.swift +92 -0
  19. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CustomPathAnimation.swift +89 -0
  20. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/DropShadowAnimation.swift +179 -0
  21. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/EllipseAnimation.swift +53 -0
  22. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/GradientAnimations.swift +287 -0
  23. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/LayerProperty.swift +440 -0
  24. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/OpacityAnimation.swift +53 -0
  25. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/RectangleAnimation.swift +59 -0
  26. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/ShapeAnimation.swift +246 -0
  27. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StarAnimation.swift +119 -0
  28. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StrokeAnimation.swift +96 -0
  29. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/TransformAnimations.swift +380 -0
  30. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/VisibilityAnimation.swift +63 -0
  31. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/CompatibilityTracker.swift +129 -0
  32. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/CoreAnimationLayer.swift +645 -0
  33. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/CALayer+fillBounds.swift +35 -0
  34. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/KeyframeGroup+exactlyOneKeyframe.swift +28 -0
  35. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+combined.swift +345 -0
  36. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+timeRemapping.swift +46 -0
  37. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/AnimationLayer.swift +169 -0
  38. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseAnimationLayer.swift +46 -0
  39. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseCompositionLayer.swift +120 -0
  40. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/CALayer+setupLayerHierarchy.swift +169 -0
  41. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/GradientRenderLayer.swift +101 -0
  42. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ImageLayer.swift +81 -0
  43. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/InfiniteOpaqueAnimationLayer.swift +57 -0
  44. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/LayerModel+makeAnimationLayer.swift +59 -0
  45. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/MaskCompositionLayer.swift +139 -0
  46. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/PreCompLayer.swift +107 -0
  47. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/RepeaterLayer.swift +113 -0
  48. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ShapeItemLayer.swift +346 -0
  49. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ShapeLayer.swift +569 -0
  50. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/SolidLayer.swift +66 -0
  51. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/TextLayer.swift +157 -0
  52. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/TransformLayer.swift +13 -0
  53. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/ValueProviderStore.swift +157 -0
  54. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Collection+Diff.swift +267 -0
  55. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Diffable.swift +19 -0
  56. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/DiffableSection.swift +16 -0
  57. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/IndexChangeset.swift +187 -0
  58. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/SectionedChangeset.swift +22 -0
  59. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Logging/EpoxyLogger.swift +102 -0
  60. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/CallbackContextEpoxyModeled.swift +8 -0
  61. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelArrayBuilder.swift +48 -0
  62. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelProperty.swift +158 -0
  63. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelStorage.swift +88 -0
  64. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModeled.swift +54 -0
  65. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/AnyEpoxyModelProperty.swift +31 -0
  66. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/ClassReference.swift +39 -0
  67. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/AnimatedProviding.swift +10 -0
  68. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DataIDProviding.swift +58 -0
  69. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidDisplayProviding.swift +41 -0
  70. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidEndDisplayingProviding.swift +42 -0
  71. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidSelectProviding.swift +36 -0
  72. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ErasedContentProviding.swift +49 -0
  73. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/MakeViewProviding.swift +61 -0
  74. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetBehaviorsProviding.swift +38 -0
  75. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetContentProviding.swift +38 -0
  76. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/StyleIDProviding.swift +38 -0
  77. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/TraitCollectionProviding.swift +14 -0
  78. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewDifferentiatorProviding.swift +34 -0
  79. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewProviding.swift +13 -0
  80. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/WillDisplayProviding.swift +41 -0
  81. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/ViewEpoxyModeled.swift +10 -0
  82. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/README.md +30 -0
  83. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIIntrinsicContentSizeInvalidator.swift +34 -0
  84. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUILayoutMargins.swift +38 -0
  85. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxyableView+SwiftUIView.swift +165 -0
  86. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/MeasuringViewRepresentable.swift +127 -0
  87. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/SwiftUIMeasurementContainer.swift +468 -0
  88. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/SwiftUIView.swift +146 -0
  89. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIView+SwiftUIView.swift +39 -0
  90. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIViewConfiguringSwiftUIView.swift +41 -0
  91. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/BehaviorsConfigurableView.swift +45 -0
  92. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ContentConfigurableView.swift +36 -0
  93. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/EpoxyableView.swift +5 -0
  94. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/StyledView.swift +43 -0
  95. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ViewType.swift +47 -0
  96. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/LRUCache/LRUCache.swift +257 -0
  97. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/LRUCache/README.md +24 -0
  98. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/README.md +43 -0
  99. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+BackingConfiguration.swift +149 -0
  100. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Deprecated.swift +23 -0
  101. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Helpers.swift +361 -0
  102. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+MemoryFile.swift +205 -0
  103. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Progress.swift +66 -0
  104. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Reading.swift +160 -0
  105. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+ReadingDeprecated.swift +50 -0
  106. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Writing.swift +403 -0
  107. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+WritingDeprecated.swift +95 -0
  108. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+ZIP64.swift +191 -0
  109. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive.swift +404 -0
  110. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+Compression.swift +632 -0
  111. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+CompressionDeprecated.swift +43 -0
  112. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+Serialization.swift +146 -0
  113. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Date+ZIP.swift +101 -0
  114. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+Serialization.swift +191 -0
  115. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+ZIP64.swift +170 -0
  116. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry.swift +669 -0
  117. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIP.swift +405 -0
  118. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIPDeprecated.swift +28 -0
  119. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/README.md +24 -0
  120. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/URL+ZIP.swift +34 -0
  121. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift +177 -0
  122. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/ImageCompositionLayer.swift +54 -0
  123. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift +191 -0
  124. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/NullCompositionLayer.swift +28 -0
  125. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.swift +137 -0
  126. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/ShapeCompositionLayer.swift +60 -0
  127. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/SolidCompositionLayer.swift +57 -0
  128. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/TextCompositionLayer.swift +247 -0
  129. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/MainThreadAnimationLayer.swift +321 -0
  130. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CachedImageProvider.swift +56 -0
  131. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CompositionLayersInitializer.swift +103 -0
  132. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CoreTextRenderLayer.swift +424 -0
  133. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/InvertedMatteLayer.swift +55 -0
  134. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerFontProvider.swift +39 -0
  135. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerImageProvider.swift +52 -0
  136. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerTextProvider.swift +38 -0
  137. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift +149 -0
  138. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Extensions/ItemsExtension.swift +146 -0
  139. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/NodeProperty.swift +62 -0
  140. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyNodeProperty.swift +53 -0
  141. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyValueContainer.swift +26 -0
  142. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/KeypathSearchable.swift +23 -0
  143. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/NodePropertyMap.swift +43 -0
  144. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueContainer.swift +47 -0
  145. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueProviders/GroupInterpolator.swift +39 -0
  146. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueProviders/SingleValueProvider.swift +43 -0
  147. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/DropShadowNode.swift +102 -0
  148. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/LayerEffectNode.swift +25 -0
  149. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/RoundedCornersNode.swift +85 -0
  150. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/TrimPathNode.swift +281 -0
  151. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/GroupOutputNode.swift +74 -0
  152. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PassThroughOutputNode.swift +47 -0
  153. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PathOutputNode.swift +89 -0
  154. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/FillRenderer.swift +69 -0
  155. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientFillRenderer.swift +253 -0
  156. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientStrokeRenderer.swift +64 -0
  157. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/LegacyGradientFillRenderer.swift +158 -0
  158. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/StrokeRenderer.swift +165 -0
  159. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/EllipseNode.swift +143 -0
  160. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/PolygonNode.swift +173 -0
  161. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/RectNode.swift +238 -0
  162. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/ShapeNode.swift +73 -0
  163. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/StarNode.swift +224 -0
  164. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderContainers/GroupNode.swift +162 -0
  165. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/FillNode.swift +88 -0
  166. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientFillNode.swift +103 -0
  167. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientStrokeNode.swift +149 -0
  168. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/StrokeNode.swift +179 -0
  169. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.swift +345 -0
  170. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/AnimatorNode.swift +197 -0
  171. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/PathNode.swift +20 -0
  172. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/RenderNode.swift +60 -0
  173. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeContainerLayer.swift +78 -0
  174. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeRenderLayer.swift +98 -0
  175. package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/Asset.swift +51 -0
  176. package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/AssetLibrary.swift +75 -0
  177. package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/ImageAsset.swift +141 -0
  178. package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/PrecompAsset.swift +47 -0
  179. package/platforms/macos/src/vendor/Lottie/Private/Model/DictionaryInitializable.swift +73 -0
  180. package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieAnimation.swift +57 -0
  181. package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieImageProvider.swift +89 -0
  182. package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieManifest.swift +42 -0
  183. package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieUtils.swift +71 -0
  184. package/platforms/macos/src/vendor/Lottie/Private/Model/Extensions/Bundle.swift +58 -0
  185. package/platforms/macos/src/vendor/Lottie/Private/Model/Extensions/KeyedDecodingContainerExtensions.swift +71 -0
  186. package/platforms/macos/src/vendor/Lottie/Private/Model/Keyframes/KeyframeData.swift +111 -0
  187. package/platforms/macos/src/vendor/Lottie/Private/Model/Keyframes/KeyframeGroup.swift +265 -0
  188. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/DropShadowEffect.swift +52 -0
  189. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/ColorEffectValue.swift +45 -0
  190. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/EffectValue.swift +98 -0
  191. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/Vector1DEffectValue.swift +45 -0
  192. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/LayerEffect.swift +103 -0
  193. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerStyles/DropShadowStyle.swift +79 -0
  194. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerStyles/LayerStyle.swift +85 -0
  195. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/ImageLayerModel.swift +49 -0
  196. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/LayerModel.swift +266 -0
  197. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/PreCompLayerModel.swift +74 -0
  198. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/ShapeLayerModel.swift +50 -0
  199. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/SolidLayerModel.swift +63 -0
  200. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/TextLayerModel.swift +65 -0
  201. package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/DashPattern.swift +42 -0
  202. package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Marker.swift +35 -0
  203. package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Mask.swift +80 -0
  204. package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Transform.swift +261 -0
  205. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Ellipse.swift +79 -0
  206. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Fill.swift +79 -0
  207. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/GradientFill.swift +142 -0
  208. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/GradientStroke.swift +244 -0
  209. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Group.swift +55 -0
  210. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Merge.swift +63 -0
  211. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Rectangle.swift +79 -0
  212. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Repeater.swift +181 -0
  213. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/RoundedCorners.swift +53 -0
  214. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Shape.swift +63 -0
  215. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/ShapeItem.swift +171 -0
  216. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/ShapeTransform.swift +202 -0
  217. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Star.swift +136 -0
  218. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Stroke.swift +144 -0
  219. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Trim.swift +90 -0
  220. package/platforms/macos/src/vendor/Lottie/Private/Model/Text/Font.swift +67 -0
  221. package/platforms/macos/src/vendor/Lottie/Private/Model/Text/Glyph.swift +94 -0
  222. package/platforms/macos/src/vendor/Lottie/Private/Model/Text/TextAnimator.swift +240 -0
  223. package/platforms/macos/src/vendor/Lottie/Private/Model/Text/TextDocument.swift +142 -0
  224. package/platforms/macos/src/vendor/Lottie/Private/RootAnimationLayer.swift +54 -0
  225. package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/AnimatorNodeDebugging.swift +23 -0
  226. package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/LayerDebugging.swift +231 -0
  227. package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/TestHelpers.swift +10 -0
  228. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/AnimationKeypathExtension.swift +303 -0
  229. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/BlendMode+Filter.swift +31 -0
  230. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/CGColor+RGB.swift +45 -0
  231. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/CGFloatExtensions.swift +152 -0
  232. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/DataExtension.swift +33 -0
  233. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/MathKit.swift +454 -0
  234. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/StringExtensions.swift +44 -0
  235. package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/AnimationContext.swift +95 -0
  236. package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/AnyEquatable.swift +23 -0
  237. package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/Binding+Map.swift +19 -0
  238. package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/View+ValueChanged.swift +35 -0
  239. package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/InterpolatableExtensions.swift +143 -0
  240. package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/KeyframeExtensions.swift +47 -0
  241. package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/KeyframeInterpolator.swift +250 -0
  242. package/platforms/macos/src/vendor/Lottie/Private/Utility/LottieAnimationSource.swift +51 -0
  243. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/BezierPath.swift +509 -0
  244. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/BezierPathRoundExtension.swift +163 -0
  245. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CGPointExtension.swift +35 -0
  246. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/ColorExtension.swift +101 -0
  247. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CompoundBezierPath.swift +169 -0
  248. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CurveVertex.swift +190 -0
  249. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/PathElement.swift +78 -0
  250. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/UnitBezier.swift +119 -0
  251. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/VectorsExtensions.swift +368 -0
  252. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimation.swift +179 -0
  253. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationHelpers.swift +317 -0
  254. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationLayer.swift +1582 -0
  255. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationView.swift +1090 -0
  256. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationViewInitializers.swift +226 -0
  257. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottiePlaybackMode.swift +266 -0
  258. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieView.swift +643 -0
  259. package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/AnimationCacheProvider.swift +21 -0
  260. package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/DefaultAnimationCache.swift +67 -0
  261. package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/LRUAnimationCache.swift +11 -0
  262. package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/LottieAnimationCache.swift +15 -0
  263. package/platforms/macos/src/vendor/Lottie/Public/Configuration/DecodingStrategy.swift +15 -0
  264. package/platforms/macos/src/vendor/Lottie/Public/Configuration/LottieConfiguration.swift +54 -0
  265. package/platforms/macos/src/vendor/Lottie/Public/Configuration/LottieURLSession.swift +31 -0
  266. package/platforms/macos/src/vendor/Lottie/Public/Configuration/ReducedMotionOption.swift +128 -0
  267. package/platforms/macos/src/vendor/Lottie/Public/Configuration/RenderingEngineOption.swift +117 -0
  268. package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedButton.swift +128 -0
  269. package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedControl.swift +248 -0
  270. package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedSwitch.swift +271 -0
  271. package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieButton.swift +119 -0
  272. package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieSwitch.swift +144 -0
  273. package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieViewType.swift +79 -0
  274. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/Cache/DotLottieCache.swift +66 -0
  275. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/Cache/DotLottieCacheProvider.swift +21 -0
  276. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieConfiguration.swift +72 -0
  277. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieFile.swift +186 -0
  278. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieFileHelpers.swift +386 -0
  279. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/AnimationKeypath.swift +57 -0
  280. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/AnyValueProvider.swift +132 -0
  281. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/ColorValueProvider.swift +96 -0
  282. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/FloatValueProvider.swift +81 -0
  283. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/GradientValueProvider.swift +138 -0
  284. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/PointValueProvider.swift +81 -0
  285. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/SizeValueProvider.swift +81 -0
  286. package/platforms/macos/src/vendor/Lottie/Public/FontProvider/AnimationFontProvider.swift +41 -0
  287. package/platforms/macos/src/vendor/Lottie/Public/ImageProvider/AnimationImageProvider.swift +43 -0
  288. package/platforms/macos/src/vendor/Lottie/Public/Keyframes/Interpolatable.swift +285 -0
  289. package/platforms/macos/src/vendor/Lottie/Public/Keyframes/Keyframe.swift +98 -0
  290. package/platforms/macos/src/vendor/Lottie/Public/Logging/LottieLogger.swift +138 -0
  291. package/platforms/macos/src/vendor/Lottie/Public/Primitives/AnimationTime.swift +15 -0
  292. package/platforms/macos/src/vendor/Lottie/Public/Primitives/LottieColor.swift +43 -0
  293. package/platforms/macos/src/vendor/Lottie/Public/Primitives/Vectors.swift +36 -0
  294. package/platforms/macos/src/vendor/Lottie/Public/TextProvider/AnimationTextProvider.swift +135 -0
  295. package/platforms/macos/src/vendor/Lottie/Public/iOS/AnimationSubview.swift +19 -0
  296. package/platforms/macos/src/vendor/Lottie/Public/iOS/BundleImageProvider.swift +98 -0
  297. package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleAnimationKeypath.swift +33 -0
  298. package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleAnimationView.swift +567 -0
  299. package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleFontProvider.swift +41 -0
  300. package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleImageProvider.swift +43 -0
  301. package/platforms/macos/src/vendor/Lottie/Public/iOS/FilepathImageProvider.swift +78 -0
  302. package/platforms/macos/src/vendor/Lottie/Public/iOS/LottieAnimationViewBase.swift +85 -0
  303. package/platforms/macos/src/vendor/Lottie/Public/iOS/UIColorExtension.swift +23 -0
  304. package/platforms/macos/src/vendor/Lottie/Public/macOS/AnimationSubview.macOS.swift +19 -0
  305. package/platforms/macos/src/vendor/Lottie/Public/macOS/BundleImageProvider.macOS.swift +90 -0
  306. package/platforms/macos/src/vendor/Lottie/Public/macOS/FilepathImageProvider.macOS.swift +86 -0
  307. package/platforms/macos/src/vendor/Lottie/Public/macOS/LottieAnimationViewBase.macOS.swift +102 -0
  308. package/src/Lottie.macos.tsrx +129 -0
  309. package/src/Lottie.tsrx +3 -2
  310. package/src/Lottie.web.tsrx +28 -11
  311. package/src/index.macos.ts +2 -0
  312. package/src/props.ts +6 -1
  313. package/types/generated/props.d.ts +5 -1
@@ -0,0 +1,111 @@
1
+ //
2
+ // Keyframe.swift
3
+ // lottie-swift
4
+ //
5
+ // Created by Brandon Withrow on 1/7/19.
6
+ //
7
+
8
+ // MARK: - KeyframeData
9
+
10
+ /// A generic class used to parse and remap keyframe json.
11
+ ///
12
+ /// Keyframe json has a couple of different variations and formats depending on the
13
+ /// type of keyframea and also the version of the JSON. By parsing the raw data
14
+ /// we can reconfigure it into a constant format.
15
+ final class KeyframeData<T> {
16
+
17
+ // MARK: Lifecycle
18
+
19
+ init(
20
+ startValue: T?,
21
+ endValue: T?,
22
+ time: AnimationFrameTime?,
23
+ hold: Int?,
24
+ inTangent: LottieVector2D?,
25
+ outTangent: LottieVector2D?,
26
+ spatialInTangent: LottieVector3D?,
27
+ spatialOutTangent: LottieVector3D?
28
+ ) {
29
+ self.startValue = startValue
30
+ self.endValue = endValue
31
+ self.time = time
32
+ self.hold = hold
33
+ self.inTangent = inTangent
34
+ self.outTangent = outTangent
35
+ self.spatialInTangent = spatialInTangent
36
+ self.spatialOutTangent = spatialOutTangent
37
+ }
38
+
39
+ // MARK: Internal
40
+
41
+ enum CodingKeys: String, CodingKey {
42
+ case startValue = "s"
43
+ case endValue = "e"
44
+ case time = "t"
45
+ case hold = "h"
46
+ case inTangent = "i"
47
+ case outTangent = "o"
48
+ case spatialInTangent = "ti"
49
+ case spatialOutTangent = "to"
50
+ }
51
+
52
+ /// The start value of the keyframe
53
+ let startValue: T?
54
+ /// The End value of the keyframe. Note: Newer versions animation json do not have this field.
55
+ let endValue: T?
56
+ /// The time in frames of the keyframe.
57
+ let time: AnimationFrameTime?
58
+ /// A hold keyframe freezes interpolation until the next keyframe that is not a hold.
59
+ let hold: Int?
60
+
61
+ /// The in tangent for the time interpolation curve.
62
+ let inTangent: LottieVector2D?
63
+ /// The out tangent for the time interpolation curve.
64
+ let outTangent: LottieVector2D?
65
+
66
+ /// The spacial in tangent of the vector.
67
+ let spatialInTangent: LottieVector3D?
68
+ /// The spacial out tangent of the vector.
69
+ let spatialOutTangent: LottieVector3D?
70
+
71
+ var isHold: Bool {
72
+ if let hold {
73
+ return hold > 0
74
+ }
75
+ return false
76
+ }
77
+ }
78
+
79
+ // MARK: Encodable
80
+
81
+ extension KeyframeData: Encodable where T: Encodable { }
82
+
83
+ // MARK: Decodable
84
+
85
+ extension KeyframeData: Decodable where T: Decodable { }
86
+
87
+ // MARK: DictionaryInitializable
88
+
89
+ extension KeyframeData: DictionaryInitializable where T: AnyInitializable {
90
+ convenience init(dictionary: [String: Any]) throws {
91
+ let startValue = try? dictionary[CodingKeys.startValue.rawValue].flatMap(T.init)
92
+ let endValue = try? dictionary[CodingKeys.endValue.rawValue].flatMap(T.init)
93
+ let time: AnimationFrameTime? = try? dictionary.value(for: CodingKeys.time)
94
+ let hold: Int? = try? dictionary.value(for: CodingKeys.hold)
95
+ let inTangent: LottieVector2D? = try? dictionary.value(for: CodingKeys.inTangent)
96
+ let outTangent: LottieVector2D? = try? dictionary.value(for: CodingKeys.outTangent)
97
+ let spatialInTangent: LottieVector3D? = try? dictionary.value(for: CodingKeys.spatialInTangent)
98
+ let spatialOutTangent: LottieVector3D? = try? dictionary.value(for: CodingKeys.spatialOutTangent)
99
+
100
+ self.init(
101
+ startValue: startValue,
102
+ endValue: endValue,
103
+ time: time,
104
+ hold: hold,
105
+ inTangent: inTangent,
106
+ outTangent: outTangent,
107
+ spatialInTangent: spatialInTangent,
108
+ spatialOutTangent: spatialOutTangent
109
+ )
110
+ }
111
+ }
@@ -0,0 +1,265 @@
1
+ //
2
+ // KeyframeGroup.swift
3
+ // lottie-swift
4
+ //
5
+ // Created by Brandon Withrow on 1/14/19.
6
+ //
7
+
8
+ // MARK: - KeyframeGroup
9
+
10
+ /// Used for coding/decoding a group of Keyframes by type.
11
+ ///
12
+ /// Keyframe data is wrapped in a dictionary { "k" : KeyframeData }.
13
+ /// The keyframe data can either be an array of keyframes or, if no animation is present, the raw value.
14
+ /// This helper object is needed to properly decode the json.
15
+ final class KeyframeGroup<T> {
16
+
17
+ // MARK: Lifecycle
18
+
19
+ init(
20
+ keyframes: ContiguousArray<Keyframe<T>>,
21
+ unsupportedAfterEffectsExpression: String? = nil
22
+ ) {
23
+ self.keyframes = keyframes
24
+ self.unsupportedAfterEffectsExpression = unsupportedAfterEffectsExpression
25
+ }
26
+
27
+ init(
28
+ _ value: T,
29
+ unsupportedAfterEffectsExpression: String? = nil
30
+ ) {
31
+ keyframes = [Keyframe(value)]
32
+ self.unsupportedAfterEffectsExpression = unsupportedAfterEffectsExpression
33
+ }
34
+
35
+ // MARK: Internal
36
+
37
+ enum KeyframeWrapperKey: String, CodingKey {
38
+ case keyframeData = "k"
39
+ case unsupportedAfterEffectsExpression = "x"
40
+ }
41
+
42
+ let keyframes: ContiguousArray<Keyframe<T>>
43
+
44
+ /// lottie-ios doesn't support After Effects expressions, but we parse them so we can log diagnostics.
45
+ /// More info: https://helpx.adobe.com/after-effects/using/expression-basics.html
46
+ let unsupportedAfterEffectsExpression: String?
47
+
48
+ }
49
+
50
+ // MARK: Decodable
51
+
52
+ extension KeyframeGroup: Decodable where T: Decodable {
53
+ convenience init(from decoder: Decoder) throws {
54
+ let container = try decoder.container(keyedBy: KeyframeWrapperKey.self)
55
+ let unsupportedAfterEffectsExpression = try? container.decode(String.self, forKey: .unsupportedAfterEffectsExpression)
56
+
57
+ if let keyframeData: T = try? container.decode(T.self, forKey: .keyframeData) {
58
+ /// Try to decode raw value; No keyframe data.
59
+ self.init(
60
+ keyframes: [Keyframe<T>(keyframeData)],
61
+ unsupportedAfterEffectsExpression: unsupportedAfterEffectsExpression
62
+ )
63
+ } else {
64
+ // Decode and array of keyframes.
65
+ //
66
+ // Body Movin and Lottie deal with keyframes in different ways.
67
+ //
68
+ // A keyframe object in Body movin defines a span of time with a START
69
+ // and an END, from the current keyframe time to the next keyframe time.
70
+ //
71
+ // A keyframe object in Lottie defines a singular point in time/space.
72
+ // This point has an in-tangent and an out-tangent.
73
+ //
74
+ // To properly decode this we must iterate through keyframes while holding
75
+ // reference to the previous keyframe.
76
+
77
+ var keyframesContainer = try container.nestedUnkeyedContainer(forKey: .keyframeData)
78
+ var keyframes = ContiguousArray<Keyframe<T>>()
79
+ var previousKeyframeData: KeyframeData<T>?
80
+ while !keyframesContainer.isAtEnd {
81
+ // Ensure that Time and Value are present.
82
+
83
+ let keyframeData = try keyframesContainer.decode(KeyframeData<T>.self)
84
+
85
+ guard
86
+ let value: T = keyframeData.startValue ?? previousKeyframeData?.endValue,
87
+ let time = keyframeData.time
88
+ else {
89
+ /// Missing keyframe data. JSON must be corrupt.
90
+ throw DecodingError.dataCorruptedError(
91
+ forKey: KeyframeWrapperKey.keyframeData,
92
+ in: container,
93
+ debugDescription: "Missing keyframe data."
94
+ )
95
+ }
96
+
97
+ keyframes.append(Keyframe<T>(
98
+ value: value,
99
+ time: AnimationFrameTime(time),
100
+ isHold: keyframeData.isHold,
101
+ inTangent: previousKeyframeData?.inTangent,
102
+ outTangent: keyframeData.outTangent,
103
+ spatialInTangent: previousKeyframeData?.spatialInTangent,
104
+ spatialOutTangent: keyframeData.spatialOutTangent
105
+ ))
106
+ previousKeyframeData = keyframeData
107
+ }
108
+ self.init(
109
+ keyframes: keyframes,
110
+ unsupportedAfterEffectsExpression: unsupportedAfterEffectsExpression
111
+ )
112
+ }
113
+ }
114
+ }
115
+
116
+ // MARK: Encodable
117
+
118
+ extension KeyframeGroup: Encodable where T: Encodable {
119
+ func encode(to encoder: Encoder) throws {
120
+ var container = encoder.container(keyedBy: KeyframeWrapperKey.self)
121
+
122
+ if keyframes.count == 1 {
123
+ let keyframe = keyframes[0]
124
+ try container.encode(keyframe.value, forKey: .keyframeData)
125
+ } else {
126
+ var keyframeContainer = container.nestedUnkeyedContainer(forKey: .keyframeData)
127
+
128
+ for i in 1..<keyframes.endIndex {
129
+ let keyframe = keyframes[i - 1]
130
+ let nextKeyframe = keyframes[i]
131
+ let keyframeData = KeyframeData<T>(
132
+ startValue: keyframe.value,
133
+ endValue: nextKeyframe.value,
134
+ time: keyframe.time,
135
+ hold: keyframe.isHold ? 1 : nil,
136
+ inTangent: nextKeyframe.inTangent,
137
+ outTangent: keyframe.outTangent,
138
+ spatialInTangent: nil,
139
+ spatialOutTangent: nil
140
+ )
141
+ try keyframeContainer.encode(keyframeData)
142
+ }
143
+ }
144
+ }
145
+ }
146
+
147
+ // MARK: DictionaryInitializable
148
+
149
+ extension KeyframeGroup: DictionaryInitializable where T: AnyInitializable {
150
+ convenience init(dictionary: [String: Any]) throws {
151
+ var keyframes = ContiguousArray<Keyframe<T>>()
152
+ let unsupportedAfterEffectsExpression = dictionary[KeyframeWrapperKey.unsupportedAfterEffectsExpression.rawValue] as? String
153
+ if
154
+ let rawValue = dictionary[KeyframeWrapperKey.keyframeData.rawValue],
155
+ let value = try? T(value: rawValue)
156
+ {
157
+ keyframes = [Keyframe<T>(value)]
158
+ } else {
159
+ let frameDictionaries: [[String: Any]] =
160
+ if
161
+ let singleFrameDictionary =
162
+ dictionary[KeyframeWrapperKey.keyframeData.rawValue] as? [String: Any]
163
+ {
164
+ [singleFrameDictionary]
165
+ } else {
166
+ try dictionary.value(for: KeyframeWrapperKey.keyframeData)
167
+ }
168
+ var previousKeyframeData: KeyframeData<T>?
169
+ for frameDictionary in frameDictionaries {
170
+ let data = try KeyframeData<T>(dictionary: frameDictionary)
171
+ guard
172
+ let value: T = data.startValue ?? previousKeyframeData?.endValue,
173
+ let time = data.time
174
+ else {
175
+ throw InitializableError.invalidInput()
176
+ }
177
+ keyframes.append(Keyframe<T>(
178
+ value: value,
179
+ time: time,
180
+ isHold: data.isHold,
181
+ inTangent: previousKeyframeData?.inTangent,
182
+ outTangent: data.outTangent,
183
+ spatialInTangent: previousKeyframeData?.spatialInTangent,
184
+ spatialOutTangent: data.spatialOutTangent
185
+ ))
186
+ previousKeyframeData = data
187
+ }
188
+ }
189
+
190
+ self.init(
191
+ keyframes: keyframes,
192
+ unsupportedAfterEffectsExpression: unsupportedAfterEffectsExpression
193
+ )
194
+ }
195
+ }
196
+
197
+ // MARK: Equatable
198
+
199
+ extension KeyframeGroup: Equatable where T: Equatable {
200
+ static func ==(_ lhs: KeyframeGroup<T>, _ rhs: KeyframeGroup<T>) -> Bool {
201
+ lhs.keyframes == rhs.keyframes
202
+ }
203
+ }
204
+
205
+ // MARK: Hashable
206
+
207
+ extension KeyframeGroup: Hashable where T: Hashable {
208
+ func hash(into hasher: inout Hasher) {
209
+ hasher.combine(keyframes)
210
+ }
211
+ }
212
+
213
+ // MARK: Sendable
214
+
215
+ extension KeyframeGroup: Sendable where T: Sendable { }
216
+
217
+ extension Keyframe {
218
+ /// Creates a copy of this `Keyframe` with the same timing data, but a different value
219
+ func withValue<Value>(_ newValue: Value) -> Keyframe<Value> {
220
+ Keyframe<Value>(
221
+ value: newValue,
222
+ time: time,
223
+ isHold: isHold,
224
+ inTangent: inTangent,
225
+ outTangent: outTangent,
226
+ spatialInTangent: spatialInTangent,
227
+ spatialOutTangent: spatialOutTangent
228
+ )
229
+ }
230
+ }
231
+
232
+ extension KeyframeGroup {
233
+ /// Maps the values of each individual keyframe in this group
234
+ func map<NewValue>(_ transformation: (T) throws -> NewValue) rethrows -> KeyframeGroup<NewValue> {
235
+ KeyframeGroup<NewValue>(
236
+ keyframes: ContiguousArray(try keyframes.map { keyframe in
237
+ keyframe.withValue(try transformation(keyframe.value))
238
+ }),
239
+ unsupportedAfterEffectsExpression: unsupportedAfterEffectsExpression
240
+ )
241
+ }
242
+ }
243
+
244
+ // MARK: - AnyKeyframeGroup
245
+
246
+ /// A type-erased wrapper for `KeyframeGroup`s
247
+ protocol AnyKeyframeGroup {
248
+ /// An untyped copy of these keyframes
249
+ var untyped: KeyframeGroup<Any> { get }
250
+
251
+ /// An untyped `KeyframeInterpolator` for these keyframes
252
+ var interpolator: AnyValueProvider { get }
253
+ }
254
+
255
+ // MARK: - KeyframeGroup + AnyKeyframeGroup
256
+
257
+ extension KeyframeGroup: AnyKeyframeGroup where T: AnyInterpolatable {
258
+ var untyped: KeyframeGroup<Any> {
259
+ map { $0 as Any }
260
+ }
261
+
262
+ var interpolator: AnyValueProvider {
263
+ KeyframeInterpolator(keyframes: keyframes)
264
+ }
265
+ }
@@ -0,0 +1,52 @@
1
+ // Created by Cal Stephens on 8/14/23.
2
+ // Copyright © 2023 Airbnb Inc. All rights reserved.
3
+
4
+ // MARK: - DropShadowEffect
5
+
6
+ final class DropShadowEffect: LayerEffect {
7
+
8
+ // MARK: Lifecycle
9
+
10
+ required init(from decoder: Decoder) throws {
11
+ try super.init(from: decoder)
12
+ }
13
+
14
+ required init(dictionary: [String: Any]) throws {
15
+ try super.init(dictionary: dictionary)
16
+ }
17
+
18
+ // MARK: Internal
19
+
20
+ /// The color of the drop shadow
21
+ var color: ColorEffectValue? {
22
+ value(named: "Shadow Color")
23
+ }
24
+
25
+ /// Opacity between 0 and 255
26
+ var opacity: Vector1DEffectValue? {
27
+ value(named: "Opacity")
28
+ }
29
+
30
+ /// The direction / angle of the drop shadow, in degrees
31
+ var direction: Vector1DEffectValue? {
32
+ value(named: "Direction")
33
+ }
34
+
35
+ /// The distance of the drop shadow
36
+ var distance: Vector1DEffectValue? {
37
+ value(named: "Distance")
38
+ }
39
+
40
+ /// The softness of the drop shadow
41
+ var softness: Vector1DEffectValue? {
42
+ value(named: "Softness")
43
+ }
44
+
45
+ }
46
+
47
+ // MARK: @unchecked Sendable
48
+
49
+ /// `DropShadowEffect` inherits `@unchecked Sendable` from `LayerEffect` and
50
+ /// we need to restate that here to avoid a warning in Xcode 16
51
+ // swiftlint:disable:next no_unchecked_sendable
52
+ extension DropShadowEffect: @unchecked Sendable { }
@@ -0,0 +1,45 @@
1
+ // Created by Cal Stephens on 8/14/23.
2
+ // Copyright © 2023 Airbnb Inc. All rights reserved.
3
+
4
+ // MARK: - ColorEffectValue
5
+
6
+ final class ColorEffectValue: EffectValue {
7
+
8
+ // MARK: Lifecycle
9
+
10
+ required init(from decoder: Decoder) throws {
11
+ let container = try decoder.container(keyedBy: CodingKeys.self)
12
+ value = try? container.decode(KeyframeGroup<LottieColor>.self, forKey: .value)
13
+ try super.init(from: decoder)
14
+ }
15
+
16
+ required init(dictionary: [String: Any]) throws {
17
+ let valueDictionary: [String: Any] = try dictionary.value(for: CodingKeys.value)
18
+ value = try KeyframeGroup<LottieColor>(dictionary: valueDictionary)
19
+ try super.init(dictionary: dictionary)
20
+ }
21
+
22
+ // MARK: Internal
23
+
24
+ /// The value of the color
25
+ let value: KeyframeGroup<LottieColor>?
26
+
27
+ override func encode(to encoder: Encoder) throws {
28
+ try super.encode(to: encoder)
29
+ var container = encoder.container(keyedBy: CodingKeys.self)
30
+ try container.encode(value, forKey: .value)
31
+ }
32
+
33
+ // MARK: Private
34
+
35
+ private enum CodingKeys: String, CodingKey {
36
+ case value = "v"
37
+ }
38
+ }
39
+
40
+ // MARK: @unchecked Sendable
41
+
42
+ /// `ColorEffectValue` inherits `@unchecked Sendable` from `EffectValue` and
43
+ /// we need to restate that here to avoid a warning in Xcode 16
44
+ // swiftlint:disable:next no_unchecked_sendable
45
+ extension ColorEffectValue: @unchecked Sendable { }
@@ -0,0 +1,98 @@
1
+ // Created by Cal Stephens on 8/15/23.
2
+ // Copyright © 2023 Airbnb Inc. All rights reserved.
3
+
4
+ // MARK: - EffectValueType
5
+
6
+ /// https://lottiefiles.github.io/lottie-docs/schema/#/$defs/effect-values
7
+ enum EffectValueType: Int, Codable, Sendable {
8
+ case slider = 0
9
+ case angle = 1
10
+ case color = 2
11
+ case unknown = 9999
12
+
13
+ init(from decoder: Decoder) throws {
14
+ self = try EffectValueType(rawValue: decoder.singleValueContainer().decode(RawValue.self)) ?? .unknown
15
+ }
16
+ }
17
+
18
+ // MARK: ClassFamily
19
+
20
+ extension EffectValueType: ClassFamily {
21
+ static var discriminator = Discriminator.type
22
+
23
+ func getType() -> AnyObject.Type {
24
+ switch self {
25
+ case .slider:
26
+ Vector1DEffectValue.self
27
+ case .angle:
28
+ Vector1DEffectValue.self
29
+ case .color:
30
+ ColorEffectValue.self
31
+ case .unknown:
32
+ // Unsupported
33
+ LayerEffect.self
34
+ }
35
+ }
36
+ }
37
+
38
+ // MARK: - EffectValue
39
+
40
+ /// Base class for layer effects
41
+ class EffectValue: Codable, DictionaryInitializable {
42
+
43
+ // MARK: Lifecycle
44
+
45
+ required init(from decoder: Decoder) throws {
46
+ let container = try decoder.container(keyedBy: EffectValue.CodingKeys.self)
47
+ type = try container.decode(EffectValueType.self, forKey: .type)
48
+ name = try container.decode(String.self, forKey: .name)
49
+ }
50
+
51
+ required init(dictionary: [String: Any]) throws {
52
+ type = (try? dictionary.value(for: CodingKeys.type)).flatMap(EffectValueType.init(rawValue:)) ?? .unknown
53
+ name = (try? dictionary.value(for: CodingKeys.name)) ?? "Effect"
54
+ }
55
+
56
+ // MARK: Internal
57
+
58
+ /// The type of effect value
59
+ let type: EffectValueType
60
+
61
+ /// The name of the effect value
62
+ let name: String
63
+
64
+ // MARK: Fileprivate
65
+
66
+ fileprivate enum CodingKeys: String, CodingKey {
67
+ case type = "ty"
68
+ case name = "nm"
69
+ }
70
+ }
71
+
72
+ extension [EffectValue] {
73
+ static func fromDictionaries(_ dictionaries: [[String: Any]]) throws -> [EffectValue] {
74
+ try dictionaries.compactMap { dictionary in
75
+ let shapeType = dictionary[EffectValue.CodingKeys.type.rawValue] as? Int
76
+ switch EffectValueType(rawValue: shapeType ?? EffectValueType.unknown.rawValue) {
77
+ case .slider:
78
+ return try Vector1DEffectValue(dictionary: dictionary)
79
+ case .angle:
80
+ return try Vector1DEffectValue(dictionary: dictionary)
81
+ case .color:
82
+ return try ColorEffectValue(dictionary: dictionary)
83
+ case .unknown:
84
+ // Unsupported
85
+ return try EffectValue(dictionary: dictionary)
86
+ case nil:
87
+ return nil
88
+ }
89
+ }
90
+ }
91
+ }
92
+
93
+ // MARK: - EffectValue + @unchecked Sendable
94
+
95
+ /// Since `EffectValue` isn't `final`, we have to use `@unchecked Sendable` instead of `Sendable.`
96
+ /// All `EffectValue` subclasses are immutable `Sendable` values.
97
+ // swiftlint:disable:next no_unchecked_sendable
98
+ extension EffectValue: @unchecked Sendable { }
@@ -0,0 +1,45 @@
1
+ // Created by Cal Stephens on 8/14/23.
2
+ // Copyright © 2023 Airbnb Inc. All rights reserved.
3
+
4
+ // MARK: - Vector1DEffectValue
5
+
6
+ final class Vector1DEffectValue: EffectValue {
7
+
8
+ // MARK: Lifecycle
9
+
10
+ required init(from decoder: Decoder) throws {
11
+ let container = try decoder.container(keyedBy: CodingKeys.self)
12
+ value = try? container.decode(KeyframeGroup<LottieVector1D>.self, forKey: .value)
13
+ try super.init(from: decoder)
14
+ }
15
+
16
+ required init(dictionary: [String: Any]) throws {
17
+ let valueDictionary: [String: Any] = try dictionary.value(for: CodingKeys.value)
18
+ value = try KeyframeGroup<LottieVector1D>(dictionary: valueDictionary)
19
+ try super.init(dictionary: dictionary)
20
+ }
21
+
22
+ // MARK: Internal
23
+
24
+ /// The value of the slider
25
+ let value: KeyframeGroup<LottieVector1D>?
26
+
27
+ override func encode(to encoder: Encoder) throws {
28
+ try super.encode(to: encoder)
29
+ var container = encoder.container(keyedBy: CodingKeys.self)
30
+ try container.encode(value, forKey: .value)
31
+ }
32
+
33
+ // MARK: Private
34
+
35
+ private enum CodingKeys: String, CodingKey {
36
+ case value = "v"
37
+ }
38
+ }
39
+
40
+ // MARK: @unchecked Sendable
41
+
42
+ /// `Vector1DEffectValue` inherits `@unchecked Sendable` from `EffectValue` and
43
+ /// we need to restate that here to avoid a warning in Xcode 16
44
+ // swiftlint:disable:next no_unchecked_sendable
45
+ extension Vector1DEffectValue: @unchecked Sendable { }