@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,386 @@
1
+ //
2
+ // DotLottieFileHelpers.swift
3
+ // Lottie
4
+ //
5
+ // Created by Evandro Hoffmann on 20/10/22.
6
+ //
7
+
8
+ import Foundation
9
+
10
+ extension DotLottieFile {
11
+
12
+ public enum SynchronouslyBlockingCurrentThread {
13
+ /// Loads an DotLottie from a specific filepath synchronously. Returns a `Result<DotLottieFile, Error>`
14
+ /// Please use the asynchronous methods whenever possible. This operation will block the Thread it is running in.
15
+ ///
16
+ /// - Parameter filepath: The absolute filepath of the lottie to load. EG "/User/Me/starAnimation.lottie"
17
+ /// - Parameter dotLottieCache: A cache for holding loaded lotties. Defaults to `LRUDotLottieCache.sharedCache`. Optional.
18
+ public static func loadedFrom(
19
+ filepath: String,
20
+ dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache
21
+ ) -> Result<DotLottieFile, Error> {
22
+ LottieLogger.shared.assert(
23
+ !Thread.isMainThread,
24
+ "`DotLottieFile.SynchronouslyBlockingCurrentThread` methods shouldn't be called on the main thread."
25
+ )
26
+
27
+ /// Check cache for lottie
28
+ if
29
+ let dotLottieCache,
30
+ let lottie = dotLottieCache.file(forKey: filepath)
31
+ {
32
+ return .success(lottie)
33
+ }
34
+
35
+ do {
36
+ /// Decode the lottie.
37
+ let url = URL(fileURLWithPath: filepath)
38
+ let data = try Data(contentsOf: url)
39
+ let lottie = try DotLottieFile(data: data, filename: url.deletingPathExtension().lastPathComponent)
40
+ dotLottieCache?.setFile(lottie, forKey: filepath)
41
+ return .success(lottie)
42
+ } catch {
43
+ /// Decoding Error.
44
+ return .failure(error)
45
+ }
46
+ }
47
+
48
+ /// Loads a DotLottie model from a bundle by its name synchronously. Returns a `Result<DotLottieFile, Error>`
49
+ /// Please use the asynchronous methods whenever possible. This operation will block the Thread it is running in.
50
+ ///
51
+ /// - Parameter name: The name of the lottie file without the lottie extension. EG "StarAnimation"
52
+ /// - Parameter bundle: The bundle in which the lottie is located. Defaults to `Bundle.main`
53
+ /// - Parameter subdirectory: A subdirectory in the bundle in which the lottie is located. Optional.
54
+ /// - Parameter dotLottieCache: A cache for holding loaded lotties. Defaults to `LRUDotLottieCache.sharedCache`. Optional.
55
+ public static func named(
56
+ _ name: String,
57
+ bundle: Bundle = Bundle.main,
58
+ subdirectory: String? = nil,
59
+ dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache
60
+ ) -> Result<DotLottieFile, Error> {
61
+ LottieLogger.shared.assert(
62
+ !Thread.isMainThread,
63
+ "`DotLottieFile.SynchronouslyBlockingCurrentThread` methods shouldn't be called on the main thread."
64
+ )
65
+
66
+ /// Create a cache key for the lottie.
67
+ let cacheKey = bundle.bundlePath + (subdirectory ?? "") + "/" + name
68
+
69
+ /// Check cache for lottie
70
+ if
71
+ let dotLottieCache,
72
+ let lottie = dotLottieCache.file(forKey: cacheKey)
73
+ {
74
+ return .success(lottie)
75
+ }
76
+
77
+ do {
78
+ /// Decode animation.
79
+ let data = try bundle.dotLottieData(name, subdirectory: subdirectory)
80
+ let lottie = try DotLottieFile(data: data, filename: name)
81
+ dotLottieCache?.setFile(lottie, forKey: cacheKey)
82
+ return .success(lottie)
83
+ } catch {
84
+ /// Decoding error.
85
+ LottieLogger.shared.warn("Error when decoding lottie \"\(name)\": \(error)")
86
+ return .failure(error)
87
+ }
88
+ }
89
+
90
+ /// Loads an DotLottie from a data synchronously. Returns a `Result<DotLottieFile, Error>`
91
+ ///
92
+ /// Please use the asynchronous methods whenever possible. This operation will block the Thread it is running in.
93
+ ///
94
+ /// - Parameters:
95
+ /// - data: The data(`Foundation.Data`) object to load DotLottie from
96
+ /// - filename: The name of the lottie file without the lottie extension. eg. "StarAnimation"
97
+ public static func loadedFrom(
98
+ data: Data,
99
+ filename: String
100
+ ) -> Result<DotLottieFile, Error> {
101
+ LottieLogger.shared.assert(
102
+ !Thread.isMainThread,
103
+ "`DotLottieFile.SynchronouslyBlockingCurrentThread` methods shouldn't be called on the main thread."
104
+ )
105
+
106
+ do {
107
+ let dotLottieFile = try DotLottieFile(data: data, filename: filename)
108
+ return .success(dotLottieFile)
109
+ } catch {
110
+ return .failure(error)
111
+ }
112
+ }
113
+ }
114
+
115
+ /// Loads a DotLottie model from a bundle by its name. Returns `nil` if a file is not found.
116
+ ///
117
+ /// - Parameter name: The name of the lottie file without the lottie extension. EG "StarAnimation"
118
+ /// - Parameter bundle: The bundle in which the lottie is located. Defaults to `Bundle.main`
119
+ /// - Parameter subdirectory: A subdirectory in the bundle in which the lottie is located. Optional.
120
+ /// - Parameter dotLottieCache: A cache for holding loaded lotties. Defaults to `LRUDotLottieCache.sharedCache`. Optional.
121
+ public static func named(
122
+ _ name: String,
123
+ bundle: Bundle = Bundle.main,
124
+ subdirectory: String? = nil,
125
+ dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache
126
+ ) async throws -> DotLottieFile {
127
+ try await withCheckedThrowingContinuation { continuation in
128
+ DotLottieFile.named(name, bundle: bundle, subdirectory: subdirectory, dotLottieCache: dotLottieCache) { result in
129
+ continuation.resume(with: result)
130
+ }
131
+ }
132
+ }
133
+
134
+ /// Loads a DotLottie model from a bundle by its name. Returns `nil` if a file is not found.
135
+ ///
136
+ /// - Parameter name: The name of the lottie file without the lottie extension. EG "StarAnimation"
137
+ /// - Parameter bundle: The bundle in which the lottie is located. Defaults to `Bundle.main`
138
+ /// - Parameter subdirectory: A subdirectory in the bundle in which the lottie is located. Optional.
139
+ /// - Parameter dotLottieCache: A cache for holding loaded lotties. Defaults to `LRUDotLottieCache.sharedCache`. Optional.
140
+ /// - Parameter dispatchQueue: A dispatch queue used to load animations. Defaults to `DispatchQueue.global()`. Optional.
141
+ /// - Parameter handleResult: A closure to be called when the file has loaded.
142
+ public static func named(
143
+ _ name: String,
144
+ bundle: Bundle = Bundle.main,
145
+ subdirectory: String? = nil,
146
+ dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache,
147
+ dispatchQueue: DispatchQueue = .dotLottie,
148
+ handleResult: @escaping (Result<DotLottieFile, Error>) -> Void
149
+ ) {
150
+ dispatchQueue.async {
151
+ let result = SynchronouslyBlockingCurrentThread.named(
152
+ name,
153
+ bundle: bundle,
154
+ subdirectory: subdirectory,
155
+ dotLottieCache: dotLottieCache
156
+ )
157
+
158
+ DispatchQueue.main.async {
159
+ handleResult(result)
160
+ }
161
+ }
162
+ }
163
+
164
+ /// Loads an DotLottie from a specific filepath.
165
+ /// - Parameter filepath: The absolute filepath of the lottie to load. EG "/User/Me/starAnimation.lottie"
166
+ /// - Parameter dotLottieCache: A cache for holding loaded lotties. Defaults to `LRUDotLottieCache.sharedCache`. Optional.
167
+ public static func loadedFrom(
168
+ filepath: String,
169
+ dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache
170
+ ) async throws -> DotLottieFile {
171
+ try await withCheckedThrowingContinuation { continuation in
172
+ DotLottieFile.loadedFrom(filepath: filepath, dotLottieCache: dotLottieCache) { result in
173
+ continuation.resume(with: result)
174
+ }
175
+ }
176
+ }
177
+
178
+ /// Loads an DotLottie from a specific filepath.
179
+ /// - Parameter filepath: The absolute filepath of the lottie to load. EG "/User/Me/starAnimation.lottie"
180
+ /// - Parameter dotLottieCache: A cache for holding loaded lotties. Defaults to `LRUDotLottieCache.sharedCache`. Optional.
181
+ /// - Parameter dispatchQueue: A dispatch queue used to load animations. Defaults to `DispatchQueue.global()`. Optional.
182
+ /// - Parameter handleResult: A closure to be called when the file has loaded.
183
+ public static func loadedFrom(
184
+ filepath: String,
185
+ dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache,
186
+ dispatchQueue: DispatchQueue = .dotLottie,
187
+ handleResult: @escaping (Result<DotLottieFile, Error>) -> Void
188
+ ) {
189
+ dispatchQueue.async {
190
+ let result = SynchronouslyBlockingCurrentThread.loadedFrom(
191
+ filepath: filepath,
192
+ dotLottieCache: dotLottieCache
193
+ )
194
+
195
+ DispatchQueue.main.async {
196
+ handleResult(result)
197
+ }
198
+ }
199
+ }
200
+
201
+ /// Loads a DotLottie model from the asset catalog by its name. Returns `nil` if a lottie is not found.
202
+ /// - Parameter name: The name of the lottie file in the asset catalog. EG "StarAnimation"
203
+ /// - Parameter bundle: The bundle in which the lottie is located. Defaults to `Bundle.main`
204
+ /// - Parameter dotLottieCache: A cache for holding loaded lottie files. Defaults to `LRUDotLottieCache.sharedCache` Optional.
205
+ public static func asset(
206
+ named name: String,
207
+ bundle: Bundle = Bundle.main,
208
+ dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache
209
+ ) async throws -> DotLottieFile {
210
+ try await withCheckedThrowingContinuation { continuation in
211
+ DotLottieFile.asset(named: name, bundle: bundle, dotLottieCache: dotLottieCache) { result in
212
+ continuation.resume(with: result)
213
+ }
214
+ }
215
+ }
216
+
217
+ /// Loads a DotLottie model from the asset catalog by its name. Returns `nil` if a lottie is not found.
218
+ /// - Parameter name: The name of the lottie file in the asset catalog. EG "StarAnimation"
219
+ /// - Parameter bundle: The bundle in which the lottie is located. Defaults to `Bundle.main`
220
+ /// - Parameter dotLottieCache: A cache for holding loaded lottie files. Defaults to `LRUDotLottieCache.sharedCache` Optional.
221
+ /// - Parameter dispatchQueue: A dispatch queue used to load animations. Defaults to `DispatchQueue.global()`. Optional.
222
+ /// - Parameter handleResult: A closure to be called when the file has loaded.
223
+ public static func asset(
224
+ named name: String,
225
+ bundle: Bundle = Bundle.main,
226
+ dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache,
227
+ dispatchQueue: DispatchQueue = .dotLottie,
228
+ handleResult: @escaping (Result<DotLottieFile, Error>) -> Void
229
+ ) {
230
+ dispatchQueue.async {
231
+ /// Create a cache key for the lottie.
232
+ let cacheKey = bundle.bundlePath + "/" + name
233
+
234
+ /// Check cache for lottie
235
+ if
236
+ let dotLottieCache,
237
+ let lottie = dotLottieCache.file(forKey: cacheKey)
238
+ {
239
+ /// If found, return the lottie.
240
+ DispatchQueue.main.async {
241
+ handleResult(.success(lottie))
242
+ }
243
+ return
244
+ }
245
+
246
+ do {
247
+ /// Load data from Asset
248
+ let data = try Data(assetName: name, in: bundle)
249
+
250
+ /// Decode lottie.
251
+ let lottie = try DotLottieFile(data: data, filename: name)
252
+ dotLottieCache?.setFile(lottie, forKey: cacheKey)
253
+ DispatchQueue.main.async {
254
+ handleResult(.success(lottie))
255
+ }
256
+ } catch {
257
+ /// Decoding error.
258
+ DispatchQueue.main.async {
259
+ handleResult(.failure(error))
260
+ }
261
+ }
262
+ }
263
+ }
264
+
265
+ /// Loads a DotLottie animation asynchronously from the URL.
266
+ ///
267
+ /// - Parameter url: The url to load the animation from.
268
+ /// - Parameter session: The `LottieURLSession` used to load the animation. Defaults to `LottieConfiguration.defaultURLSession`.
269
+ /// - Parameter dotLottieCache: A cache for holding loaded animations. Defaults to `DotLottieCache.sharedCache`. Optional.
270
+ ///
271
+ /// - Returns: Loaded DotLottie animation.
272
+ public static func loadedFrom(
273
+ url: URL,
274
+ session: LottieURLSession = LottieConfiguration.defaultURLSession,
275
+ dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache
276
+ ) async throws -> DotLottieFile {
277
+ var dataTask: URLSessionDataTask?
278
+ let cancelTask = { dataTask?.cancel() }
279
+ return try await withTaskCancellationHandler {
280
+ try await withCheckedThrowingContinuation { continuation in
281
+ dataTask = DotLottieFile.loadedFrom(url: url, session: session, dotLottieCache: dotLottieCache) { result in
282
+ continuation.resume(with: result)
283
+ }
284
+ }
285
+ } onCancel: {
286
+ cancelTask()
287
+ }
288
+ }
289
+
290
+ /// Loads a DotLottie animation asynchronously from the URL.
291
+ ///
292
+ /// - Parameter url: The url to load the animation from.
293
+ /// - Parameter session: The `LottieURLSession` used to load the animation. Defaults to `LottieConfiguration.defaultURLSession`.
294
+ /// - Parameter dotLottieCache: A cache for holding loaded animations. Defaults to `DotLottieCache.sharedCache`. Optional.
295
+ /// - Parameter handleResult: A closure to be called when the animation has loaded.
296
+ ///
297
+ /// - Returns: `URLSessionDataTask` that can be used to cancel the request, or `nil` if the animation was loaded from cache.
298
+ @discardableResult
299
+ public static func loadedFrom(
300
+ url: URL,
301
+ session: LottieURLSession = LottieConfiguration.defaultURLSession,
302
+ dotLottieCache: DotLottieCacheProvider? = DotLottieCache.sharedCache,
303
+ handleResult: @escaping (Result<DotLottieFile, Error>) -> Void
304
+ ) -> URLSessionDataTask? {
305
+ if let dotLottieCache, let lottie = dotLottieCache.file(forKey: url.absoluteString) {
306
+ handleResult(.success(lottie))
307
+ return nil
308
+ } else {
309
+ let task = session.lottieDataTask(with: url) { data, _, error in
310
+ do {
311
+ if let error {
312
+ throw error
313
+ }
314
+ guard let data else {
315
+ throw DotLottieError.noDataLoaded
316
+ }
317
+ let lottie = try DotLottieFile(data: data, filename: url.deletingPathExtension().lastPathComponent)
318
+ DispatchQueue.main.async {
319
+ dotLottieCache?.setFile(lottie, forKey: url.absoluteString)
320
+ handleResult(.success(lottie))
321
+ }
322
+ } catch {
323
+ DispatchQueue.main.async {
324
+ handleResult(.failure(error))
325
+ }
326
+ }
327
+ }
328
+ task?.resume()
329
+ return task
330
+ }
331
+ }
332
+
333
+ /// Loads an DotLottie from a data asynchronously.
334
+ ///
335
+ /// - Parameters:
336
+ /// - data: The data(`Foundation.Data`) object to load DotLottie from
337
+ /// - filename: The name of the lottie file without the lottie extension. eg. "StarAnimation"
338
+ /// - dispatchQueue: A dispatch queue used to load animations. Defaults to `DispatchQueue.global()`. Optional.
339
+ /// - handleResult: A closure to be called when the file has loaded.
340
+ public static func loadedFrom(
341
+ data: Data,
342
+ filename: String,
343
+ dispatchQueue: DispatchQueue = .dotLottie,
344
+ handleResult: @escaping (Result<DotLottieFile, Error>) -> Void
345
+ ) {
346
+ dispatchQueue.async {
347
+ do {
348
+ let dotLottie = try DotLottieFile(data: data, filename: filename)
349
+ DispatchQueue.main.async {
350
+ handleResult(.success(dotLottie))
351
+ }
352
+ } catch {
353
+ DispatchQueue.main.async {
354
+ handleResult(.failure(error))
355
+ }
356
+ }
357
+ }
358
+ }
359
+
360
+ /// Loads an DotLottie from a data asynchronously.
361
+ ///
362
+ /// - Parameters:
363
+ /// - data: The data(`Foundation.Data`) object to load DotLottie from
364
+ /// - filename: The name of the lottie file without the lottie extension. eg. "StarAnimation"
365
+ /// - dispatchQueue: A dispatch queue used to load animations. Defaults to `DispatchQueue.global()`. Optional.
366
+ public static func loadedFrom(
367
+ data: Data,
368
+ filename: String,
369
+ dispatchQueue: DispatchQueue = .dotLottie
370
+ ) async throws -> DotLottieFile {
371
+ try await withCheckedThrowingContinuation { continuation in
372
+ loadedFrom(data: data, filename: filename, dispatchQueue: dispatchQueue) { result in
373
+ continuation.resume(with: result)
374
+ }
375
+ }
376
+ }
377
+ }
378
+
379
+ extension DispatchQueue {
380
+ /// A serial dispatch queue ensures that IO related to loading dot Lottie files don't overlap,
381
+ /// which can trigger file loading errors due to concurrent unzipping on a single archive.
382
+ public static let dotLottie = DispatchQueue(
383
+ label: "com.airbnb.lottie.dot-lottie",
384
+ qos: .userInitiated
385
+ )
386
+ }
@@ -0,0 +1,57 @@
1
+ //
2
+ // AnimationKeypath.swift
3
+ // lottie-swift
4
+ //
5
+ // Created by Brandon Withrow on 2/4/19.
6
+ //
7
+
8
+ /// `AnimationKeypath` is an object that describes a keypath search for nodes in the
9
+ /// animation JSON. `AnimationKeypath` matches views and properties inside of `LottieAnimationView`
10
+ /// to their backing `LottieAnimation` model by name.
11
+ ///
12
+ /// A keypath can be used to set properties on an existing animation, or can be validated
13
+ /// with an existing `LottieAnimation`.
14
+ ///
15
+ /// `AnimationKeypath` can describe a specific object, or can use wildcards for fuzzy matching
16
+ /// of objects. Acceptable wildcards are either "*" (star) or "**" (double star).
17
+ /// Single star will search a single depth for the next object.
18
+ /// Double star will search any depth.
19
+ ///
20
+ /// Read More at https://airbnb.io/lottie/#/ios?id=dynamic-animation-properties
21
+ ///
22
+ /// EG:
23
+ /// @"Layer.Shape Group.Stroke 1.Color"
24
+ /// Represents a specific color node on a specific stroke.
25
+ ///
26
+ /// @"**.Stroke 1.Color"
27
+ /// Represents the color node for every Stroke named "Stroke 1" in the animation.
28
+ public struct AnimationKeypath: Hashable, ExpressibleByStringLiteral {
29
+
30
+ // MARK: Lifecycle
31
+
32
+ /// Creates a keypath from a dot-separated string. The string is separated by "."
33
+ public init(keypath: String) {
34
+ keys = keypath.components(separatedBy: ".")
35
+ }
36
+
37
+ /// Creates a keypath from a dot-separated string
38
+ public init(stringLiteral: String) {
39
+ self.init(keypath: stringLiteral)
40
+ }
41
+
42
+ /// Creates a keypath from a list of strings.
43
+ public init(keys: [String]) {
44
+ self.keys = keys
45
+ }
46
+
47
+ // MARK: Public
48
+
49
+ /// The dot-separated key values that represent this keypath.
50
+ public internal(set) var keys: [String]
51
+
52
+ /// The `String` representation of this keypath
53
+ public var string: String {
54
+ keys.joined(separator: ".")
55
+ }
56
+
57
+ }
@@ -0,0 +1,132 @@
1
+ //
2
+ // AnyValueProvider.swift
3
+ // lottie-swift
4
+ //
5
+ // Created by Brandon Withrow on 1/30/19.
6
+ //
7
+
8
+ import Foundation
9
+
10
+ // MARK: - AnyValueProvider
11
+
12
+ /// `AnyValueProvider` is a protocol that return animation data for a property at a
13
+ /// given time. Every frame a `LottieAnimationView` queries all of its properties and asks
14
+ /// if their ValueProvider has an update. If it does the LottieAnimationView will read the
15
+ /// property and update that portion of the animation.
16
+ ///
17
+ /// Value Providers can be used to dynamically set animation properties at run time.
18
+ public protocol AnyValueProvider {
19
+
20
+ /// The Type of the value provider
21
+ var valueType: Any.Type { get }
22
+
23
+ /// The type-erased storage for this Value Provider
24
+ var typeErasedStorage: AnyValueProviderStorage { get }
25
+
26
+ /// Asks the provider if it has an update for the given frame.
27
+ func hasUpdate(frame: AnimationFrameTime) -> Bool
28
+
29
+ }
30
+
31
+ extension AnyValueProvider {
32
+ /// Asks the provider to update the container with its value for the frame.
33
+ public func value(frame: AnimationFrameTime) -> Any {
34
+ typeErasedStorage.value(frame: frame)
35
+ }
36
+ }
37
+
38
+ // MARK: - ValueProvider
39
+
40
+ /// A base protocol for strongly-typed Value Providers
41
+ protocol ValueProvider: AnyValueProvider {
42
+ associatedtype Value: AnyInterpolatable
43
+
44
+ /// The strongly-typed storage for this Value Provider
45
+ var storage: ValueProviderStorage<Value> { get }
46
+ }
47
+
48
+ extension ValueProvider {
49
+ public var typeErasedStorage: AnyValueProviderStorage {
50
+ switch storage {
51
+ case .closure(let typedClosure):
52
+ .closure(typedClosure)
53
+
54
+ case .singleValue(let typedValue):
55
+ .singleValue(typedValue)
56
+
57
+ case .keyframes(let keyframes):
58
+ .keyframes(
59
+ keyframes.map { keyframe in
60
+ keyframe.withValue(keyframe.value as Any)
61
+ },
62
+ interpolate: storage.value(frame:)
63
+ )
64
+ }
65
+ }
66
+ }
67
+
68
+ // MARK: - ValueProviderStorage
69
+
70
+ /// The underlying storage of a `ValueProvider`
71
+ public enum ValueProviderStorage<T: AnyInterpolatable> {
72
+ /// The value provider stores a single value that is used on all frames
73
+ case singleValue(T)
74
+
75
+ /// The value provider stores a group of keyframes
76
+ /// - The main-thread rendering engine interpolates values in these keyframes
77
+ /// using `T`'s `Interpolatable` implementation.
78
+ /// - The Core Animation rendering engine constructs a `CAKeyframeAnimation`
79
+ /// using these keyframes. The Core Animation render server performs
80
+ /// the interpolation, without calling `T`'s `Interpolatable` implementation.
81
+ case keyframes([Keyframe<T>])
82
+
83
+ /// The value provider stores a closure that is invoked on every frame
84
+ /// - This is only supported by the main-thread rendering engine
85
+ case closure((AnimationFrameTime) -> T)
86
+
87
+ // MARK: Internal
88
+
89
+ func value(frame: AnimationFrameTime) -> T {
90
+ switch self {
91
+ case .singleValue(let value):
92
+ value
93
+
94
+ case .closure(let closure):
95
+ closure(frame)
96
+
97
+ case .keyframes(let keyframes):
98
+ KeyframeInterpolator(keyframes: ContiguousArray(keyframes)).storage.value(frame: frame)
99
+ }
100
+ }
101
+ }
102
+
103
+ // MARK: - AnyValueProviderStorage
104
+
105
+ /// A type-erased representation of `ValueProviderStorage`
106
+ public enum AnyValueProviderStorage {
107
+ /// The value provider stores a single value that is used on all frames
108
+ case singleValue(Any)
109
+
110
+ /// The value provider stores a group of keyframes
111
+ /// - Since we can't interpolate a type-erased `KeyframeGroup`,
112
+ /// the interpolation has to be performed in the `interpolate` closure.
113
+ case keyframes([Keyframe<Any>], interpolate: (AnimationFrameTime) -> Any)
114
+
115
+ /// The value provider stores a closure that is invoked on every frame
116
+ case closure((AnimationFrameTime) -> Any)
117
+
118
+ // MARK: Internal
119
+
120
+ func value(frame: AnimationFrameTime) -> Any {
121
+ switch self {
122
+ case .singleValue(let value):
123
+ value
124
+
125
+ case .closure(let closure):
126
+ closure(frame)
127
+
128
+ case .keyframes(_, let valueForFrame):
129
+ valueForFrame(frame)
130
+ }
131
+ }
132
+ }
@@ -0,0 +1,96 @@
1
+ //
2
+ // ColorValueProvider.swift
3
+ // lottie-swift
4
+ //
5
+ // Created by Brandon Withrow on 2/4/19.
6
+ //
7
+
8
+ import CoreGraphics
9
+ import Foundation
10
+
11
+ // MARK: - ColorValueProvider
12
+
13
+ /// A `ValueProvider` that returns a CGColor Value
14
+ public final class ColorValueProvider: ValueProvider {
15
+
16
+ // MARK: Lifecycle
17
+
18
+ /// Initializes with a block provider
19
+ public init(block: @escaping ColorValueBlock) {
20
+ self.block = block
21
+ color = LottieColor(r: 0, g: 0, b: 0, a: 1)
22
+ keyframes = nil
23
+ identity = UUID()
24
+ }
25
+
26
+ /// Initializes with a single color.
27
+ public init(_ color: LottieColor) {
28
+ self.color = color
29
+ block = nil
30
+ keyframes = nil
31
+ hasUpdate = true
32
+ identity = color
33
+ }
34
+
35
+ /// Initializes with multiple colors, with timing information
36
+ public init(_ keyframes: [Keyframe<LottieColor>]) {
37
+ self.keyframes = keyframes
38
+ color = LottieColor(r: 0, g: 0, b: 0, a: 1)
39
+ block = nil
40
+ hasUpdate = true
41
+ identity = keyframes
42
+ }
43
+
44
+ // MARK: Public
45
+
46
+ /// Returns a LottieColor for a CGColor(Frame Time)
47
+ public typealias ColorValueBlock = (CGFloat) -> LottieColor
48
+
49
+ /// The color value of the provider.
50
+ public var color: LottieColor {
51
+ didSet {
52
+ hasUpdate = true
53
+ }
54
+ }
55
+
56
+ public var valueType: Any.Type {
57
+ LottieColor.self
58
+ }
59
+
60
+ public var storage: ValueProviderStorage<LottieColor> {
61
+ if let block {
62
+ return .closure { frame in
63
+ self.hasUpdate = false
64
+ return block(frame)
65
+ }
66
+ } else if let keyframes {
67
+ return .keyframes(keyframes)
68
+ } else {
69
+ hasUpdate = false
70
+ return .singleValue(color)
71
+ }
72
+ }
73
+
74
+ public func hasUpdate(frame _: CGFloat) -> Bool {
75
+ if block != nil {
76
+ return true
77
+ }
78
+ return hasUpdate
79
+ }
80
+
81
+ // MARK: Private
82
+
83
+ private var hasUpdate = true
84
+
85
+ private var block: ColorValueBlock?
86
+ private var keyframes: [Keyframe<LottieColor>]?
87
+ private var identity: AnyHashable
88
+ }
89
+
90
+ // MARK: Equatable
91
+
92
+ extension ColorValueProvider: Equatable {
93
+ public static func ==(_ lhs: ColorValueProvider, _ rhs: ColorValueProvider) -> Bool {
94
+ lhs.identity == rhs.identity
95
+ }
96
+ }