@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,67 @@
1
+ //
2
+ // DefaultAnimationCache.swift
3
+ // Lottie
4
+ //
5
+ // Created by Marcelo Fabri on 10/18/22.
6
+ //
7
+
8
+ import Foundation
9
+
10
+ // MARK: - DefaultAnimationCache
11
+
12
+ /// A thread-safe Animation Cache that will store animations up to `cacheSize`.
13
+ ///
14
+ /// Once `cacheSize` is reached, animations can be ejected.
15
+ /// The default size of the cache is 100.
16
+ ///
17
+ /// This cache implementation also responds to memory pressure.
18
+ public final class DefaultAnimationCache: AnimationCacheProvider {
19
+
20
+ // MARK: Lifecycle
21
+
22
+ public init() {
23
+ cache.countLimit = Self.defaultCacheCountLimit
24
+ }
25
+
26
+ // MARK: Public
27
+
28
+ /// The global shared Cache.
29
+ public static let sharedCache = DefaultAnimationCache()
30
+
31
+ /// The maximum number of animations that can be stored in the cache.
32
+ public var cacheSize: Int {
33
+ get { cache.countLimit }
34
+ set { cache.countLimit = newValue }
35
+ }
36
+
37
+ /// Clears the Cache.
38
+ public func clearCache() {
39
+ cache.removeAllValues()
40
+ }
41
+
42
+ public func animation(forKey key: String) -> LottieAnimation? {
43
+ cache.value(forKey: key)
44
+ }
45
+
46
+ public func setAnimation(_ animation: LottieAnimation, forKey key: String) {
47
+ cache.setValue(animation, forKey: key)
48
+ }
49
+
50
+ // MARK: Private
51
+
52
+ private static let defaultCacheCountLimit = 100
53
+
54
+ /// The underlying storage of this cache.
55
+ /// - We use the `LRUCache` library instead of `NSCache`, because `NSCache`
56
+ /// clears all cached values when the app is backgrounded instead of
57
+ /// only when the app receives a memory warning notification.
58
+ private let cache = LRUCache<String, LottieAnimation>()
59
+ }
60
+
61
+ // MARK: @unchecked Sendable
62
+
63
+ // LottieAnimationCache has a Sendable requirement, but we can't
64
+ // redesign DefaultAnimationCache to be properly Sendable without
65
+ // making breaking changes.
66
+ // swiftlint:disable:next no_unchecked_sendable
67
+ extension DefaultAnimationCache: @unchecked Sendable { }
@@ -0,0 +1,11 @@
1
+ //
2
+ // LRUAnimationCache.swift
3
+ // lottie-swift
4
+ //
5
+ // Created by Brandon Withrow on 2/5/19.
6
+ //
7
+
8
+ @available(*, deprecated, message: """
9
+ Use DefaultAnimationCache instead, which is thread-safe and automatically responds to memory pressure.
10
+ """)
11
+ public typealias LRUAnimationCache = DefaultAnimationCache
@@ -0,0 +1,15 @@
1
+ //
2
+ // LottieAnimationCache.swift
3
+ // Lottie
4
+ //
5
+ // Created by Marcelo Fabri on 10/17/22.
6
+ //
7
+
8
+ /// A customization point to configure which `AnimationCacheProvider` will be used.
9
+ public enum LottieAnimationCache {
10
+
11
+ /// The animation cache that will be used when loading `LottieAnimation` models.
12
+ /// Using an Animation Cache can increase performance when loading an animation multiple times.
13
+ /// Defaults to DefaultAnimationCache.sharedCache.
14
+ public static var shared: AnimationCacheProvider? = DefaultAnimationCache.sharedCache
15
+ }
@@ -0,0 +1,15 @@
1
+ // Created by Cal Stephens on 7/14/23.
2
+ // Copyright © 2023 Airbnb Inc. All rights reserved.
3
+
4
+ /// How animation files should be decoded
5
+ public enum DecodingStrategy: Hashable {
6
+ /// Use Codable. This is was the default strategy introduced on Lottie 3, but should be rarely
7
+ /// used as it's slower than `dictionaryBased`. Kept here for any possible compatibility issues
8
+ /// that may come up, but consider it soft-deprecated.
9
+ case legacyCodable
10
+
11
+ /// Manually deserialize a dictionary into an Animation.
12
+ /// This should be at least 2-3x faster than using Codable and due to that
13
+ /// it's the default as of Lottie 4.x.
14
+ case dictionaryBased
15
+ }
@@ -0,0 +1,54 @@
1
+ // Created by Cal Stephens on 12/13/21.
2
+ // Copyright © 2021 Airbnb Inc. All rights reserved.
3
+
4
+ import Foundation
5
+ import QuartzCore
6
+
7
+ /// Global configuration options for Lottie animations
8
+ public struct LottieConfiguration: Hashable {
9
+
10
+ // MARK: Lifecycle
11
+
12
+ public init(
13
+ renderingEngine: RenderingEngineOption = .automatic,
14
+ decodingStrategy: DecodingStrategy = .dictionaryBased,
15
+ colorSpace: CGColorSpace = CGColorSpaceCreateDeviceRGB(),
16
+ reducedMotionOption: ReducedMotionOption = .systemReducedMotionToggle
17
+ ) {
18
+ self.renderingEngine = renderingEngine
19
+ self.decodingStrategy = decodingStrategy
20
+ self.colorSpace = colorSpace
21
+ self.reducedMotionOption = reducedMotionOption
22
+ }
23
+
24
+ // MARK: Public
25
+
26
+ /// The global configuration of Lottie,
27
+ /// which applies to all `LottieAnimationView`s by default.
28
+ public static var shared = LottieConfiguration()
29
+
30
+ /// The default URL session used to load remote Lottie animations.
31
+ /// - Defaults to `URLSession.shared`
32
+ /// - Set this to a custom `LottieURLSession` implementation to control network behavior,
33
+ /// such as disabling network requests during screenshot tests.
34
+ public static var defaultURLSession: LottieURLSession = URLSession.shared
35
+
36
+ /// The rendering engine implementation to use when displaying an animation
37
+ /// - Defaults to `RenderingEngineOption.automatic`, which uses the
38
+ /// Core Animation rendering engine for supported animations, and
39
+ /// falls back to using the Main Thread rendering engine for
40
+ /// animations that use features not supported by the Core Animation engine.
41
+ public var renderingEngine: RenderingEngineOption
42
+
43
+ /// The decoding implementation to use when parsing an animation JSON file
44
+ public var decodingStrategy: DecodingStrategy
45
+
46
+ /// Options for controlling animation behavior in response to user / system "reduced motion" configuration.
47
+ /// - Defaults to `ReducedMotionOption.systemReducedMotionToggle`, which returns `.reducedMotion`
48
+ /// when the system `UIAccessibility.isReduceMotionEnabled` option is `true`.
49
+ public var reducedMotionOption: ReducedMotionOption
50
+
51
+ /// The color space to be used for rendering
52
+ /// - Defaults to `CGColorSpaceCreateDeviceRGB()`
53
+ public var colorSpace: CGColorSpace
54
+ }
@@ -0,0 +1,31 @@
1
+ // Created by Andy Bartholomew on 12/2/24.
2
+ // Copyright © 2024 Airbnb Inc. All rights reserved.
3
+
4
+ import Foundation
5
+
6
+ // MARK: - LottieURLSession
7
+
8
+ /// A protocol that abstracts URL session functionality for loading Lottie animations.
9
+ public protocol LottieURLSession: Sendable {
10
+ /// Creates a data task that retrieves the contents of the specified URL.
11
+ ///
12
+ /// - Parameters:
13
+ /// - url: The URL to retrieve.
14
+ /// - completionHandler: The completion handler to call when the load request is complete.
15
+ /// - Returns: A `URLSessionDataTask` that can be resumed or cancelled, or `nil` for mock implementations.
16
+ func lottieDataTask(
17
+ with url: URL,
18
+ completionHandler: @escaping @Sendable (Data?, URLResponse?, (any Error)?) -> Void
19
+ ) -> URLSessionDataTask?
20
+ }
21
+
22
+ // MARK: - URLSession + LottieURLSession
23
+
24
+ extension URLSession: LottieURLSession {
25
+ public func lottieDataTask(
26
+ with url: URL,
27
+ completionHandler: @escaping @Sendable (Data?, URLResponse?, (any Error)?) -> Void
28
+ ) -> URLSessionDataTask? {
29
+ dataTask(with: url, completionHandler: completionHandler)
30
+ }
31
+ }
@@ -0,0 +1,128 @@
1
+ // Created by Cal Stephens on 7/14/23.
2
+ // Copyright © 2023 Airbnb Inc. All rights reserved.
3
+
4
+ #if canImport(UIKit)
5
+ import UIKit
6
+ #elseif canImport(AppKit)
7
+ import AppKit
8
+ #endif
9
+
10
+ // MARK: - ReducedMotionOption
11
+
12
+ /// Options for controlling animation behavior in response to user / system "reduced motion" configuration
13
+ public enum ReducedMotionOption {
14
+ /// Always use the specific given `ReducedMotionMode` value.
15
+ case specific(ReducedMotionMode)
16
+
17
+ /// Dynamically check the given `ReducedMotionOptionProvider` each time an animation begins.
18
+ /// - Includes a Hashable `dataID` to support `ReducedMotionOption`'s `Hashable` requirement,
19
+ /// which is required due to `LottieConfiguration`'s existing `Hashable` requirement.
20
+ case dynamic(ReducedMotionOptionProvider, dataID: AnyHashable)
21
+ }
22
+
23
+ extension ReducedMotionOption {
24
+ /// The standard behavior where Lottie animations play normally with no overrides.
25
+ /// By default this mode is used when the system "reduced motion" option is disabled.
26
+ public static var standardMotion: ReducedMotionOption {
27
+ .specific(.standardMotion)
28
+ }
29
+
30
+ /// Lottie animations with a "reduced motion" marker will play that marker instead of any other animations.
31
+ /// By default this mode is used when the system "reduced motion" option is enabled.
32
+ /// - Valid marker names include "reduced motion", "reducedMotion", "reduced_motion" (case insensitive).
33
+ public static var reducedMotion: ReducedMotionOption {
34
+ .specific(.reducedMotion)
35
+ }
36
+
37
+ /// Animations are disabled and render statically at their first frame instead of playing.
38
+ /// This is useful for snapshot testing where animation non-determinism can cause flaky tests.
39
+ public static var disabledMotion: ReducedMotionOption {
40
+ .specific(.disabledMotion)
41
+ }
42
+
43
+ /// A `ReducedMotionOptionProvider` that returns `.reducedMotion` when
44
+ /// the system `UIAccessibility.isReduceMotionEnabled` option is `true`.
45
+ /// This is the default option of `LottieConfiguration`.
46
+ public static var systemReducedMotionToggle: ReducedMotionOption {
47
+ .dynamic(SystemReducedMotionOptionProvider(), dataID: ObjectIdentifier(SystemReducedMotionOptionProvider.self))
48
+ }
49
+ }
50
+
51
+ extension ReducedMotionOption {
52
+ /// The current `ReducedMotionMode` based on the currently selected option.
53
+ public var currentReducedMotionMode: ReducedMotionMode {
54
+ switch self {
55
+ case .specific(let specificMode):
56
+ specificMode
57
+ case .dynamic(let optionProvider, _):
58
+ optionProvider.currentReducedMotionMode
59
+ }
60
+ }
61
+ }
62
+
63
+ // MARK: Hashable
64
+
65
+ extension ReducedMotionOption: Hashable {
66
+ public static func ==(_ lhs: ReducedMotionOption, _ rhs: ReducedMotionOption) -> Bool {
67
+ switch (lhs, rhs) {
68
+ case (.specific(let lhsMode), .specific(let rhsMode)):
69
+ lhsMode == rhsMode
70
+ case (.dynamic(_, let lhsDataID), .dynamic(_, dataID: let rhsDataID)):
71
+ lhsDataID == rhsDataID
72
+ case (.dynamic, .specific), (.specific, .dynamic):
73
+ false
74
+ }
75
+ }
76
+
77
+ public func hash(into hasher: inout Hasher) {
78
+ switch self {
79
+ case .specific(let mode):
80
+ hasher.combine(mode)
81
+ case .dynamic(_, let dataID):
82
+ hasher.combine(dataID)
83
+ }
84
+ }
85
+ }
86
+
87
+ // MARK: - ReducedMotionMode
88
+
89
+ public enum ReducedMotionMode: Hashable {
90
+ /// The default behavior where Lottie animations play normally with no overrides
91
+ /// By default this mode is used when the system "reduced motion" option is disabled.
92
+ case standardMotion
93
+
94
+ /// Lottie animations with a "reduced motion" marker will play that marker instead of any other animations.
95
+ /// By default this mode is used when the system "reduced motion" option is enabled.
96
+ case reducedMotion
97
+
98
+ /// Animations are disabled and render statically at their first frame instead of playing.
99
+ /// This is useful for snapshot testing where animation non-determinism can cause flaky tests.
100
+ case disabledMotion
101
+ }
102
+
103
+ // MARK: - ReducedMotionOptionProvider
104
+
105
+ /// A type that returns a dynamic `ReducedMotionMode` which is checked when playing a Lottie animation.
106
+ public protocol ReducedMotionOptionProvider {
107
+ var currentReducedMotionMode: ReducedMotionMode { get }
108
+ }
109
+
110
+ // MARK: - SystemReducedMotionOptionProvider
111
+
112
+ /// A `ReducedMotionOptionProvider` that returns `.reducedMotion` when
113
+ /// the system `UIAccessibility.isReduceMotionEnabled` option is `true`.
114
+ public struct SystemReducedMotionOptionProvider: ReducedMotionOptionProvider {
115
+ public init() { }
116
+
117
+ public var currentReducedMotionMode: ReducedMotionMode {
118
+ #if canImport(UIKit)
119
+ if UIAccessibility.isReduceMotionEnabled {
120
+ return .reducedMotion
121
+ } else {
122
+ return .standardMotion
123
+ }
124
+ #else
125
+ return .standardMotion
126
+ #endif
127
+ }
128
+ }
@@ -0,0 +1,117 @@
1
+ // Created by Cal Stephens on 7/14/23.
2
+ // Copyright © 2023 Airbnb Inc. All rights reserved.
3
+
4
+ // MARK: - RenderingEngineOption
5
+
6
+ public enum RenderingEngineOption: Hashable {
7
+ /// Uses the Core Animation engine for supported animations, and falls back to using
8
+ /// the Main Thread engine for animations that use features not supported by the
9
+ /// Core Animation engine.
10
+ case automatic
11
+
12
+ /// Uses the specified rendering engine
13
+ case specific(RenderingEngine)
14
+
15
+ // MARK: Public
16
+
17
+ /// The Main Thread rendering engine, which supports all Lottie features
18
+ /// but runs on the main thread, which comes with some CPU overhead and
19
+ /// can cause the animation to play at a low framerate when the CPU is busy.
20
+ public static var mainThread: RenderingEngineOption {
21
+ .specific(.mainThread)
22
+ }
23
+
24
+ /// The Core Animation rendering engine, that animates using Core Animation
25
+ /// and has better performance characteristics than the Main Thread engine,
26
+ /// but doesn't support all Lottie features.
27
+ /// - In general, prefer using `RenderingEngineOption.automatic` over
28
+ /// `RenderingEngineOption.coreAnimation`. The Core Animation rendering
29
+ /// engine doesn't support all features supported by the Main Thread
30
+ /// rendering engine. When using `RenderingEngineOption.automatic`,
31
+ /// Lottie will automatically fall back to the Main Thread engine
32
+ /// when necessary.
33
+ public static var coreAnimation: RenderingEngineOption {
34
+ .specific(.coreAnimation)
35
+ }
36
+ }
37
+
38
+ // MARK: - RenderingEngine
39
+
40
+ /// The rendering engine implementation to use when displaying an animation
41
+ public enum RenderingEngine: Hashable {
42
+ /// The Main Thread rendering engine, which supports all Lottie features
43
+ /// but runs on the main thread, which comes with some CPU overhead and
44
+ /// can cause the animation to play at a low framerate when the CPU is busy.
45
+ case mainThread
46
+
47
+ /// The Core Animation rendering engine, that animates using Core Animation
48
+ /// and has better performance characteristics than the Main Thread engine,
49
+ /// but doesn't support all Lottie features.
50
+ case coreAnimation
51
+ }
52
+
53
+ // MARK: - RenderingEngineOption + RawRepresentable, CustomStringConvertible
54
+
55
+ extension RenderingEngineOption: RawRepresentable, CustomStringConvertible {
56
+
57
+ // MARK: Lifecycle
58
+
59
+ public init?(rawValue: String) {
60
+ if rawValue == "Automatic" {
61
+ self = .automatic
62
+ } else if let engine = RenderingEngine(rawValue: rawValue) {
63
+ self = .specific(engine)
64
+ } else {
65
+ return nil
66
+ }
67
+ }
68
+
69
+ // MARK: Public
70
+
71
+ public var rawValue: String {
72
+ switch self {
73
+ case .automatic:
74
+ "Automatic"
75
+ case .specific(let engine):
76
+ engine.rawValue
77
+ }
78
+ }
79
+
80
+ public var description: String {
81
+ rawValue
82
+ }
83
+
84
+ }
85
+
86
+ // MARK: - RenderingEngine + RawRepresentable, CustomStringConvertible
87
+
88
+ extension RenderingEngine: RawRepresentable, CustomStringConvertible {
89
+
90
+ // MARK: Lifecycle
91
+
92
+ public init?(rawValue: String) {
93
+ switch rawValue {
94
+ case "Main Thread":
95
+ self = .mainThread
96
+ case "Core Animation":
97
+ self = .coreAnimation
98
+ default:
99
+ return nil
100
+ }
101
+ }
102
+
103
+ // MARK: Public
104
+
105
+ public var rawValue: String {
106
+ switch self {
107
+ case .mainThread:
108
+ "Main Thread"
109
+ case .coreAnimation:
110
+ "Core Animation"
111
+ }
112
+ }
113
+
114
+ public var description: String {
115
+ rawValue
116
+ }
117
+ }
@@ -0,0 +1,128 @@
1
+ //
2
+ // AnimatedButton.swift
3
+ // lottie-swift
4
+ //
5
+ // Created by Brandon Withrow on 2/4/19.
6
+ //
7
+
8
+ #if canImport(UIKit)
9
+ import UIKit
10
+ #elseif canImport(AppKit)
11
+ import AppKit
12
+ #endif
13
+
14
+ // MARK: - AnimatedButton
15
+
16
+ /// An interactive button that plays an animation when pressed.
17
+ open class AnimatedButton: AnimatedControl {
18
+
19
+ // MARK: Lifecycle
20
+
21
+ public override init(
22
+ animation: LottieAnimation?,
23
+ configuration: LottieConfiguration = .shared
24
+ ) {
25
+ super.init(animation: animation, configuration: configuration)
26
+
27
+ #if canImport(UIKit)
28
+ isAccessibilityElement = true
29
+ #elseif canImport(AppKit)
30
+ setAccessibilityElement(true)
31
+ #endif
32
+ }
33
+
34
+ public override init() {
35
+ super.init()
36
+
37
+ #if canImport(UIKit)
38
+ isAccessibilityElement = true
39
+ #elseif canImport(AppKit)
40
+ setAccessibilityElement(true)
41
+ #endif
42
+ }
43
+
44
+ required public init?(coder aDecoder: NSCoder) {
45
+ super.init(coder: aDecoder)
46
+
47
+ #if canImport(UIKit)
48
+ isAccessibilityElement = true
49
+ #elseif canImport(AppKit)
50
+ setAccessibilityElement(true)
51
+ #endif
52
+ }
53
+
54
+ // MARK: Open
55
+
56
+ #if canImport(UIKit)
57
+ open override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
58
+ let _ = super.beginTracking(touch, with: event)
59
+ let touchEvent = UIControl.Event.touchDown
60
+ if let playRange = rangesForEvents[touchEvent.id] {
61
+ animationView.play(fromProgress: playRange.from, toProgress: playRange.to, loopMode: .playOnce)
62
+ }
63
+ return true
64
+ }
65
+
66
+ open override func endTracking(_ touch: UITouch?, with event: UIEvent?) {
67
+ super.endTracking(touch, with: event)
68
+ let touchEvent: UIControl.Event
69
+ if let touch, bounds.contains(touch.location(in: self)) {
70
+ touchEvent = UIControl.Event.touchUpInside
71
+ performAction?()
72
+ } else {
73
+ touchEvent = UIControl.Event.touchUpOutside
74
+ }
75
+
76
+ if let playRange = rangesForEvents[touchEvent.id] {
77
+ animationView.play(fromProgress: playRange.from, toProgress: playRange.to, loopMode: .playOnce)
78
+ }
79
+ }
80
+
81
+ #elseif canImport(AppKit)
82
+ open override func handle(_ event: LottieNSControlEvent) {
83
+ super.handle(event)
84
+
85
+ if let playRange = rangesForEvents[event.id] {
86
+ animationView.play(fromProgress: playRange.from, toProgress: playRange.to, loopMode: .playOnce)
87
+ }
88
+
89
+ if event == .touchUpInside {
90
+ performAction?()
91
+ }
92
+ }
93
+ #endif
94
+
95
+ // MARK: Public
96
+
97
+ /// A closure that is called when the button is pressed / clicked
98
+ public var performAction: (() -> Void)?
99
+
100
+ #if canImport(UIKit)
101
+ public override var accessibilityTraits: UIAccessibilityTraits {
102
+ set { super.accessibilityTraits = newValue }
103
+ get { super.accessibilityTraits.union(.button) }
104
+ }
105
+ #endif
106
+
107
+ /// Sets the play range for the given UIControlEvent.
108
+ public func setPlayRange(fromProgress: AnimationProgressTime, toProgress: AnimationProgressTime, event: LottieControlEvent) {
109
+ rangesForEvents[event.id] = (from: fromProgress, to: toProgress)
110
+ }
111
+
112
+ /// Sets the play range for the given UIControlEvent.
113
+ public func setPlayRange(fromMarker fromName: String, toMarker toName: String, event: LottieControlEvent) {
114
+ if
115
+ let start = animationView.progressTime(forMarker: fromName),
116
+ let end = animationView.progressTime(forMarker: toName)
117
+ {
118
+ rangesForEvents[event.id] = (from: start, to: end)
119
+ }
120
+ }
121
+
122
+ // MARK: Private
123
+
124
+ private var rangesForEvents: [AnyHashable: (from: CGFloat, to: CGFloat)] = [LottieControlEvent.touchUpInside.id: (
125
+ from: 0,
126
+ to: 1
127
+ )]
128
+ }