@octane-xplat/lottie 0.0.1 → 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 (361) hide show
  1. package/README.md +56 -2
  2. package/dist/native/cx.mobile.js +11 -0
  3. package/dist/native/escape-props.js +39 -0
  4. package/dist/native/index.js +183 -0
  5. package/dist/native/layout-child.js +38 -0
  6. package/dist/native/octane-client-build.json +8 -0
  7. package/dist/native/vendor/ui-lottie/index.android.js +286 -0
  8. package/dist/native/vendor/ui-lottie/index.ios.js +214 -0
  9. package/dist/native/vendor/ui-lottie/src/lottie/index.common.js +50 -0
  10. package/dist/native/vendor/ui-lottie/src/lottie/utils.js +6 -0
  11. package/dist/web/escape-props.web.js +17 -0
  12. package/dist/web/index.js +346 -0
  13. package/dist/web/layout-child.web.js +47 -0
  14. package/dist/web/octane-client-build.json +8 -0
  15. package/package.json +104 -11
  16. package/platforms/android/include.gradle +7 -0
  17. package/platforms/android/java/com/nativescript/lottie/LottieAnimationView.java +92 -0
  18. package/platforms/android/lottie.aar +0 -0
  19. package/platforms/android/native-api-usage.json +16 -0
  20. package/platforms/ios/Podfile +5 -0
  21. package/platforms/macos/LICENSE-EpoxyCore-Apache-2.0.txt +201 -0
  22. package/platforms/macos/LICENSE-LRUCache-MIT.txt +22 -0
  23. package/platforms/macos/LICENSE-Lottie-Apache-2.0.txt +201 -0
  24. package/platforms/macos/LICENSE-ZIPFoundation-MIT.txt +21 -0
  25. package/platforms/macos/UPSTREAM.md +13 -0
  26. package/platforms/macos/resources/PrivacyInfo.xcprivacy +23 -0
  27. package/platforms/macos/resources/THIRD-PARTY-NOTICES.txt +10 -0
  28. package/platforms/macos/src/XplatAppKitLottie.swift +246 -0
  29. package/platforms/macos/src/vendor/Lottie/PrivacyInfo.xcprivacy +23 -0
  30. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CAAnimation+TimingConfiguration.swift +81 -0
  31. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CALayer+addAnimation.swift +476 -0
  32. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CombinedShapeAnimation.swift +92 -0
  33. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CustomPathAnimation.swift +89 -0
  34. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/DropShadowAnimation.swift +179 -0
  35. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/EllipseAnimation.swift +53 -0
  36. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/GradientAnimations.swift +287 -0
  37. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/LayerProperty.swift +440 -0
  38. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/OpacityAnimation.swift +53 -0
  39. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/RectangleAnimation.swift +59 -0
  40. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/ShapeAnimation.swift +246 -0
  41. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StarAnimation.swift +119 -0
  42. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StrokeAnimation.swift +96 -0
  43. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/TransformAnimations.swift +380 -0
  44. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/VisibilityAnimation.swift +63 -0
  45. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/CompatibilityTracker.swift +129 -0
  46. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/CoreAnimationLayer.swift +645 -0
  47. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/CALayer+fillBounds.swift +35 -0
  48. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/KeyframeGroup+exactlyOneKeyframe.swift +28 -0
  49. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+combined.swift +345 -0
  50. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+timeRemapping.swift +46 -0
  51. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/AnimationLayer.swift +169 -0
  52. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseAnimationLayer.swift +46 -0
  53. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseCompositionLayer.swift +120 -0
  54. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/CALayer+setupLayerHierarchy.swift +169 -0
  55. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/GradientRenderLayer.swift +101 -0
  56. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ImageLayer.swift +81 -0
  57. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/InfiniteOpaqueAnimationLayer.swift +57 -0
  58. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/LayerModel+makeAnimationLayer.swift +59 -0
  59. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/MaskCompositionLayer.swift +139 -0
  60. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/PreCompLayer.swift +107 -0
  61. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/RepeaterLayer.swift +113 -0
  62. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ShapeItemLayer.swift +346 -0
  63. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ShapeLayer.swift +569 -0
  64. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/SolidLayer.swift +66 -0
  65. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/TextLayer.swift +157 -0
  66. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/TransformLayer.swift +13 -0
  67. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/ValueProviderStore.swift +157 -0
  68. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Collection+Diff.swift +267 -0
  69. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Diffable.swift +19 -0
  70. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/DiffableSection.swift +16 -0
  71. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/IndexChangeset.swift +187 -0
  72. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/SectionedChangeset.swift +22 -0
  73. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Logging/EpoxyLogger.swift +102 -0
  74. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/CallbackContextEpoxyModeled.swift +8 -0
  75. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelArrayBuilder.swift +48 -0
  76. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelProperty.swift +158 -0
  77. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelStorage.swift +88 -0
  78. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModeled.swift +54 -0
  79. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/AnyEpoxyModelProperty.swift +31 -0
  80. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/ClassReference.swift +39 -0
  81. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/AnimatedProviding.swift +10 -0
  82. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DataIDProviding.swift +58 -0
  83. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidDisplayProviding.swift +41 -0
  84. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidEndDisplayingProviding.swift +42 -0
  85. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidSelectProviding.swift +36 -0
  86. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ErasedContentProviding.swift +49 -0
  87. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/MakeViewProviding.swift +61 -0
  88. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetBehaviorsProviding.swift +38 -0
  89. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetContentProviding.swift +38 -0
  90. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/StyleIDProviding.swift +38 -0
  91. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/TraitCollectionProviding.swift +14 -0
  92. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewDifferentiatorProviding.swift +34 -0
  93. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewProviding.swift +13 -0
  94. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/WillDisplayProviding.swift +41 -0
  95. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/ViewEpoxyModeled.swift +10 -0
  96. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/README.md +30 -0
  97. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIIntrinsicContentSizeInvalidator.swift +34 -0
  98. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUILayoutMargins.swift +38 -0
  99. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxyableView+SwiftUIView.swift +165 -0
  100. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/MeasuringViewRepresentable.swift +127 -0
  101. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/SwiftUIMeasurementContainer.swift +468 -0
  102. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/SwiftUIView.swift +146 -0
  103. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIView+SwiftUIView.swift +39 -0
  104. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIViewConfiguringSwiftUIView.swift +41 -0
  105. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/BehaviorsConfigurableView.swift +45 -0
  106. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ContentConfigurableView.swift +36 -0
  107. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/EpoxyableView.swift +5 -0
  108. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/StyledView.swift +43 -0
  109. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ViewType.swift +47 -0
  110. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/LRUCache/LRUCache.swift +257 -0
  111. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/LRUCache/README.md +24 -0
  112. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/README.md +43 -0
  113. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+BackingConfiguration.swift +149 -0
  114. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Deprecated.swift +23 -0
  115. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Helpers.swift +361 -0
  116. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+MemoryFile.swift +205 -0
  117. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Progress.swift +66 -0
  118. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Reading.swift +160 -0
  119. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+ReadingDeprecated.swift +50 -0
  120. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Writing.swift +403 -0
  121. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+WritingDeprecated.swift +95 -0
  122. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+ZIP64.swift +191 -0
  123. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive.swift +404 -0
  124. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+Compression.swift +632 -0
  125. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+CompressionDeprecated.swift +43 -0
  126. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+Serialization.swift +146 -0
  127. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Date+ZIP.swift +101 -0
  128. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+Serialization.swift +191 -0
  129. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+ZIP64.swift +170 -0
  130. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry.swift +669 -0
  131. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIP.swift +405 -0
  132. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIPDeprecated.swift +28 -0
  133. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/README.md +24 -0
  134. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/URL+ZIP.swift +34 -0
  135. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift +177 -0
  136. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/ImageCompositionLayer.swift +54 -0
  137. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift +191 -0
  138. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/NullCompositionLayer.swift +28 -0
  139. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.swift +137 -0
  140. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/ShapeCompositionLayer.swift +60 -0
  141. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/SolidCompositionLayer.swift +57 -0
  142. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/TextCompositionLayer.swift +247 -0
  143. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/MainThreadAnimationLayer.swift +321 -0
  144. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CachedImageProvider.swift +56 -0
  145. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CompositionLayersInitializer.swift +103 -0
  146. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CoreTextRenderLayer.swift +424 -0
  147. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/InvertedMatteLayer.swift +55 -0
  148. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerFontProvider.swift +39 -0
  149. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerImageProvider.swift +52 -0
  150. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerTextProvider.swift +38 -0
  151. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift +149 -0
  152. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Extensions/ItemsExtension.swift +146 -0
  153. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/NodeProperty.swift +62 -0
  154. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyNodeProperty.swift +53 -0
  155. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyValueContainer.swift +26 -0
  156. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/KeypathSearchable.swift +23 -0
  157. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/NodePropertyMap.swift +43 -0
  158. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueContainer.swift +47 -0
  159. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueProviders/GroupInterpolator.swift +39 -0
  160. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueProviders/SingleValueProvider.swift +43 -0
  161. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/DropShadowNode.swift +102 -0
  162. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/LayerEffectNode.swift +25 -0
  163. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/RoundedCornersNode.swift +85 -0
  164. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/TrimPathNode.swift +281 -0
  165. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/GroupOutputNode.swift +74 -0
  166. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PassThroughOutputNode.swift +47 -0
  167. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PathOutputNode.swift +89 -0
  168. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/FillRenderer.swift +69 -0
  169. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientFillRenderer.swift +253 -0
  170. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientStrokeRenderer.swift +64 -0
  171. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/LegacyGradientFillRenderer.swift +158 -0
  172. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/StrokeRenderer.swift +165 -0
  173. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/EllipseNode.swift +143 -0
  174. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/PolygonNode.swift +173 -0
  175. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/RectNode.swift +238 -0
  176. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/ShapeNode.swift +73 -0
  177. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/StarNode.swift +224 -0
  178. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderContainers/GroupNode.swift +162 -0
  179. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/FillNode.swift +88 -0
  180. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientFillNode.swift +103 -0
  181. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientStrokeNode.swift +149 -0
  182. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/StrokeNode.swift +179 -0
  183. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.swift +345 -0
  184. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/AnimatorNode.swift +197 -0
  185. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/PathNode.swift +20 -0
  186. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/RenderNode.swift +60 -0
  187. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeContainerLayer.swift +78 -0
  188. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeRenderLayer.swift +98 -0
  189. package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/Asset.swift +51 -0
  190. package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/AssetLibrary.swift +75 -0
  191. package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/ImageAsset.swift +141 -0
  192. package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/PrecompAsset.swift +47 -0
  193. package/platforms/macos/src/vendor/Lottie/Private/Model/DictionaryInitializable.swift +73 -0
  194. package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieAnimation.swift +57 -0
  195. package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieImageProvider.swift +89 -0
  196. package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieManifest.swift +42 -0
  197. package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieUtils.swift +71 -0
  198. package/platforms/macos/src/vendor/Lottie/Private/Model/Extensions/Bundle.swift +58 -0
  199. package/platforms/macos/src/vendor/Lottie/Private/Model/Extensions/KeyedDecodingContainerExtensions.swift +71 -0
  200. package/platforms/macos/src/vendor/Lottie/Private/Model/Keyframes/KeyframeData.swift +111 -0
  201. package/platforms/macos/src/vendor/Lottie/Private/Model/Keyframes/KeyframeGroup.swift +265 -0
  202. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/DropShadowEffect.swift +52 -0
  203. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/ColorEffectValue.swift +45 -0
  204. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/EffectValue.swift +98 -0
  205. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/Vector1DEffectValue.swift +45 -0
  206. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/LayerEffect.swift +103 -0
  207. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerStyles/DropShadowStyle.swift +79 -0
  208. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerStyles/LayerStyle.swift +85 -0
  209. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/ImageLayerModel.swift +49 -0
  210. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/LayerModel.swift +266 -0
  211. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/PreCompLayerModel.swift +74 -0
  212. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/ShapeLayerModel.swift +50 -0
  213. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/SolidLayerModel.swift +63 -0
  214. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/TextLayerModel.swift +65 -0
  215. package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/DashPattern.swift +42 -0
  216. package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Marker.swift +35 -0
  217. package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Mask.swift +80 -0
  218. package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Transform.swift +261 -0
  219. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Ellipse.swift +79 -0
  220. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Fill.swift +79 -0
  221. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/GradientFill.swift +142 -0
  222. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/GradientStroke.swift +244 -0
  223. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Group.swift +55 -0
  224. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Merge.swift +63 -0
  225. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Rectangle.swift +79 -0
  226. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Repeater.swift +181 -0
  227. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/RoundedCorners.swift +53 -0
  228. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Shape.swift +63 -0
  229. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/ShapeItem.swift +171 -0
  230. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/ShapeTransform.swift +202 -0
  231. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Star.swift +136 -0
  232. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Stroke.swift +144 -0
  233. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Trim.swift +90 -0
  234. package/platforms/macos/src/vendor/Lottie/Private/Model/Text/Font.swift +67 -0
  235. package/platforms/macos/src/vendor/Lottie/Private/Model/Text/Glyph.swift +94 -0
  236. package/platforms/macos/src/vendor/Lottie/Private/Model/Text/TextAnimator.swift +240 -0
  237. package/platforms/macos/src/vendor/Lottie/Private/Model/Text/TextDocument.swift +142 -0
  238. package/platforms/macos/src/vendor/Lottie/Private/RootAnimationLayer.swift +54 -0
  239. package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/AnimatorNodeDebugging.swift +23 -0
  240. package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/LayerDebugging.swift +231 -0
  241. package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/TestHelpers.swift +10 -0
  242. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/AnimationKeypathExtension.swift +303 -0
  243. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/BlendMode+Filter.swift +31 -0
  244. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/CGColor+RGB.swift +45 -0
  245. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/CGFloatExtensions.swift +152 -0
  246. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/DataExtension.swift +33 -0
  247. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/MathKit.swift +454 -0
  248. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/StringExtensions.swift +44 -0
  249. package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/AnimationContext.swift +95 -0
  250. package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/AnyEquatable.swift +23 -0
  251. package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/Binding+Map.swift +19 -0
  252. package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/View+ValueChanged.swift +35 -0
  253. package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/InterpolatableExtensions.swift +143 -0
  254. package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/KeyframeExtensions.swift +47 -0
  255. package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/KeyframeInterpolator.swift +250 -0
  256. package/platforms/macos/src/vendor/Lottie/Private/Utility/LottieAnimationSource.swift +51 -0
  257. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/BezierPath.swift +509 -0
  258. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/BezierPathRoundExtension.swift +163 -0
  259. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CGPointExtension.swift +35 -0
  260. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/ColorExtension.swift +101 -0
  261. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CompoundBezierPath.swift +169 -0
  262. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CurveVertex.swift +190 -0
  263. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/PathElement.swift +78 -0
  264. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/UnitBezier.swift +119 -0
  265. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/VectorsExtensions.swift +368 -0
  266. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimation.swift +179 -0
  267. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationHelpers.swift +317 -0
  268. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationLayer.swift +1582 -0
  269. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationView.swift +1090 -0
  270. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationViewInitializers.swift +226 -0
  271. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottiePlaybackMode.swift +266 -0
  272. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieView.swift +643 -0
  273. package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/AnimationCacheProvider.swift +21 -0
  274. package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/DefaultAnimationCache.swift +67 -0
  275. package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/LRUAnimationCache.swift +11 -0
  276. package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/LottieAnimationCache.swift +15 -0
  277. package/platforms/macos/src/vendor/Lottie/Public/Configuration/DecodingStrategy.swift +15 -0
  278. package/platforms/macos/src/vendor/Lottie/Public/Configuration/LottieConfiguration.swift +54 -0
  279. package/platforms/macos/src/vendor/Lottie/Public/Configuration/LottieURLSession.swift +31 -0
  280. package/platforms/macos/src/vendor/Lottie/Public/Configuration/ReducedMotionOption.swift +128 -0
  281. package/platforms/macos/src/vendor/Lottie/Public/Configuration/RenderingEngineOption.swift +117 -0
  282. package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedButton.swift +128 -0
  283. package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedControl.swift +248 -0
  284. package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedSwitch.swift +271 -0
  285. package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieButton.swift +119 -0
  286. package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieSwitch.swift +144 -0
  287. package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieViewType.swift +79 -0
  288. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/Cache/DotLottieCache.swift +66 -0
  289. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/Cache/DotLottieCacheProvider.swift +21 -0
  290. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieConfiguration.swift +72 -0
  291. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieFile.swift +186 -0
  292. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieFileHelpers.swift +386 -0
  293. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/AnimationKeypath.swift +57 -0
  294. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/AnyValueProvider.swift +132 -0
  295. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/ColorValueProvider.swift +96 -0
  296. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/FloatValueProvider.swift +81 -0
  297. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/GradientValueProvider.swift +138 -0
  298. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/PointValueProvider.swift +81 -0
  299. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/SizeValueProvider.swift +81 -0
  300. package/platforms/macos/src/vendor/Lottie/Public/FontProvider/AnimationFontProvider.swift +41 -0
  301. package/platforms/macos/src/vendor/Lottie/Public/ImageProvider/AnimationImageProvider.swift +43 -0
  302. package/platforms/macos/src/vendor/Lottie/Public/Keyframes/Interpolatable.swift +285 -0
  303. package/platforms/macos/src/vendor/Lottie/Public/Keyframes/Keyframe.swift +98 -0
  304. package/platforms/macos/src/vendor/Lottie/Public/Logging/LottieLogger.swift +138 -0
  305. package/platforms/macos/src/vendor/Lottie/Public/Primitives/AnimationTime.swift +15 -0
  306. package/platforms/macos/src/vendor/Lottie/Public/Primitives/LottieColor.swift +43 -0
  307. package/platforms/macos/src/vendor/Lottie/Public/Primitives/Vectors.swift +36 -0
  308. package/platforms/macos/src/vendor/Lottie/Public/TextProvider/AnimationTextProvider.swift +135 -0
  309. package/platforms/macos/src/vendor/Lottie/Public/iOS/AnimationSubview.swift +19 -0
  310. package/platforms/macos/src/vendor/Lottie/Public/iOS/BundleImageProvider.swift +98 -0
  311. package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleAnimationKeypath.swift +33 -0
  312. package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleAnimationView.swift +567 -0
  313. package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleFontProvider.swift +41 -0
  314. package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleImageProvider.swift +43 -0
  315. package/platforms/macos/src/vendor/Lottie/Public/iOS/FilepathImageProvider.swift +78 -0
  316. package/platforms/macos/src/vendor/Lottie/Public/iOS/LottieAnimationViewBase.swift +85 -0
  317. package/platforms/macos/src/vendor/Lottie/Public/iOS/UIColorExtension.swift +23 -0
  318. package/platforms/macos/src/vendor/Lottie/Public/macOS/AnimationSubview.macOS.swift +19 -0
  319. package/platforms/macos/src/vendor/Lottie/Public/macOS/BundleImageProvider.macOS.swift +90 -0
  320. package/platforms/macos/src/vendor/Lottie/Public/macOS/FilepathImageProvider.macOS.swift +86 -0
  321. package/platforms/macos/src/vendor/Lottie/Public/macOS/LottieAnimationViewBase.macOS.swift +102 -0
  322. package/src/Lottie.macos.tsrx +129 -0
  323. package/src/Lottie.tsrx +162 -0
  324. package/src/Lottie.web.tsrx +152 -0
  325. package/src/cx.mobile.ts +8 -0
  326. package/src/escape-props.ts +65 -0
  327. package/src/escape-props.web.ts +25 -0
  328. package/src/index.macos.ts +2 -0
  329. package/src/index.ts +2 -0
  330. package/src/index.web.ts +2 -0
  331. package/src/layout-child.ts +57 -0
  332. package/src/layout-child.web.ts +108 -0
  333. package/src/native-elements.d.ts +8 -0
  334. package/src/props.ts +133 -0
  335. package/src/references.d.ts +3 -0
  336. package/src/vendor/ui-lottie/LICENSE.md +21 -0
  337. package/src/vendor/ui-lottie/src/lottie/index.android.ts +447 -0
  338. package/src/vendor/ui-lottie/src/lottie/index.common.ts +84 -0
  339. package/src/vendor/ui-lottie/src/lottie/index.d.ts +133 -0
  340. package/src/vendor/ui-lottie/src/lottie/index.ios.ts +345 -0
  341. package/src/vendor/ui-lottie/src/lottie/typings/android.d.ts +4149 -0
  342. package/src/vendor/ui-lottie/src/lottie/typings/android.nativescript.d.ts +12 -0
  343. package/src/vendor/ui-lottie/src/lottie/typings/dotlottie.ios.d.ts +14 -0
  344. package/src/vendor/ui-lottie/src/lottie/typings/ios.d.ts +384 -0
  345. package/src/vendor/ui-lottie/src/lottie/utils.ts +9 -0
  346. package/types/generated/.tsrx-typegen-manifest.json +18 -0
  347. package/types/generated/Lottie.d.ts +7 -0
  348. package/types/generated/Lottie.web.d.ts +7 -0
  349. package/types/generated/cx.mobile.d.ts +6 -0
  350. package/types/generated/escape-props.d.ts +15 -0
  351. package/types/generated/escape-props.web.d.ts +5 -0
  352. package/types/generated/index.d.ts +2 -0
  353. package/types/generated/index.web.d.ts +2 -0
  354. package/types/generated/layout-child.d.ts +6 -0
  355. package/types/generated/layout-child.web.d.ts +15 -0
  356. package/types/generated/props.d.ts +110 -0
  357. package/types/generated/vendor/ui-lottie/src/lottie/index.common.d.ts +30 -0
  358. package/types/generated/vendor/ui-lottie/src/lottie/index.ios.d.ts +35 -0
  359. package/types/generated/vendor/ui-lottie/src/lottie/utils.d.ts +1 -0
  360. package/index.d.ts +0 -1
  361. package/index.js +0 -2
@@ -0,0 +1,162 @@
1
+ /** @jsxImportSource @nativescript-community/octane */
2
+ import { useImperativeHandle, useCallback, useEffect, useRef } from 'octane';
3
+ import { registerElement } from '@nativescript-community/octane';
4
+ import { isAndroid } from '@nativescript/core';
5
+ import { LottieView } from './vendor/ui-lottie/src/lottie';
6
+ import type { LottieHandle, LottieProps } from './props';
7
+ import { cx } from './cx.mobile';
8
+ import { applyEscapeProps, nativeAccessibilityRole, nativeAccessibilityState } from './escape-props';
9
+ import { layoutChildProps } from './layout-child';
10
+
11
+ registerElement('xplatlottie', LottieView);
12
+
13
+ const clamp01 = (n: number) => Math.min(1, Math.max(0, n));
14
+
15
+ const STRETCH: Record<string, string> = {
16
+ contain: 'aspectFit',
17
+ cover: 'aspectFill',
18
+ fill: 'fill',
19
+ };
20
+
21
+ /** Duration in ms on both platforms — the plugin's `duration` reports
22
+ * seconds on iOS and ms on Android. */
23
+ function durationMs(v: LottieView): number {
24
+ const d = v.duration ?? 0;
25
+ return isAndroid ? d : Math.max(0, d) * 1000;
26
+ }
27
+
28
+ function currentProgress(v: LottieView): number {
29
+ // the native type is platform-divergent (LottieAnimationView vs
30
+ // CompatibleAnimationView) — runtime branch is the narrowing.
31
+ const nv = v.nativeViewProtected as any;
32
+ return isAndroid ? (nv?.getProgress?.() ?? 0) : (nv?.currentProgress ?? 0);
33
+ }
34
+
35
+ /** Stop = pause + reset playhead. iOS `stop()` resets to the start;
36
+ * Android's `cancelAnimation()` ends the animator and the next
37
+ * `playAnimation()` restarts from 0. */
38
+ function stopView(v: LottieView) {
39
+ if (isAndroid) v.cancelAnimation();
40
+ else v.nativeViewProtected?.stop();
41
+
42
+ v.progress = 0;
43
+ }
44
+
45
+ /** Lottie — vendored ui-lottie surface (see src/plugin). The plugin
46
+ * doesn't diff props, so src/play-state/speed/progress land imperatively
47
+ * in effects. `async` stays forced on: it keeps the load path uniform
48
+ * (one code path for inline/file/URL/.lottie) and avoids main-thread
49
+ * parse jank; autoPlay is re-applied when the composition lands. */
50
+ export function Lottie(props: LottieProps) @{
51
+ const host = useRef<LottieView | null>(null);
52
+ const appliedSrc = useRef<string | undefined>(undefined);
53
+ const loadedRef = useRef(false);
54
+
55
+ useImperativeHandle(props.ref, () => handle(host.current!), []);
56
+
57
+ const bindHost = useCallback((v: LottieView) => {
58
+ host.current = v;
59
+ }, []);
60
+
61
+ const wantPlay = () => props.playing ?? props.autoPlay ?? true;
62
+
63
+ const onReady = () => {
64
+ const v = host.current;
65
+ if (!v || loadedRef.current) return;
66
+ loadedRef.current = true;
67
+ if (props.speed !== undefined) v.speed = props.speed;
68
+ if (props.progress !== undefined) v.progress = clamp01(props.progress);
69
+ props.onLoaded?.({ duration: durationMs(v) });
70
+ if (wantPlay() && !v.isAnimating()) v.playAnimation();
71
+ };
72
+
73
+ // Mount wiring — events first so a synchronous src assignment can't
74
+ // race past them.
75
+ useEffect(() => {
76
+ const v = host.current;
77
+ if (!v) return;
78
+ applyEscapeProps(v, props);
79
+ v.stretch = STRETCH[props.fit ?? 'contain'] as any;
80
+ v.async = true;
81
+
82
+ v.on(LottieView.compositionLoadedEvent, () => onReady());
83
+ v.on(LottieView.loadFailedEvent, (e: any) => {
84
+ loadedRef.current = false;
85
+ props.onError?.({ message: e?.error ? String(e.error) : 'load failed' });
86
+ });
87
+
88
+ // The vendored fix reports a single `false` on cancel — only a
89
+ // `true` finish reaches onEnded.
90
+ v.completionBlock = (finished: boolean) => {
91
+ if (finished) props.onEnded?.();
92
+ };
93
+
94
+ }, []);
95
+
96
+ // src — applied imperatively after the listeners exist.
97
+ useEffect(() => {
98
+ const v = host.current;
99
+ if (!v) return;
100
+ const src = props.data ? JSON.stringify(props.data) : props.src;
101
+ if (src === appliedSrc.current) return;
102
+ appliedSrc.current = src;
103
+ loadedRef.current = false;
104
+ v.src = src ?? '';
105
+ }, [props.src, props.data]);
106
+
107
+ // Controlled `playing` — play state is a method call, not a prop.
108
+ useEffect(() => {
109
+ const v = host.current;
110
+ if (!v || props.playing === undefined) return;
111
+ if (props.playing) {
112
+ if (loadedRef.current) v.resumeAnimation();
113
+ // not loaded yet — onReady picks it up via wantPlay()
114
+ } else {
115
+ v.pauseAnimation();
116
+ }
117
+ }, [props.playing]);
118
+
119
+ useEffect(() => {
120
+ const v = host.current;
121
+ if (!v || props.progress === undefined || !loadedRef.current) return;
122
+ v.progress = clamp01(props.progress);
123
+ }, [props.progress]);
124
+
125
+ useEffect(() => {
126
+ const v = host.current;
127
+ if (!v || props.speed === undefined || !loadedRef.current) return;
128
+ v.speed = props.speed;
129
+ }, [props.speed]);
130
+
131
+ const handle = (v: LottieView): LottieHandle => ({
132
+ play: () => v.resumeAnimation(),
133
+ pause: () => v.pauseAnimation(),
134
+ stop: () => stopView(v),
135
+ seekTo: (p: number) => {
136
+ v.progress = clamp01(p);
137
+ },
138
+ setSpeed: (n: number) => {
139
+ v.speed = n;
140
+ },
141
+ progress: () => currentProgress(v),
142
+ duration: () => durationMs(v),
143
+ isPlaying: () => v.isAnimating(),
144
+ native: v,
145
+ });
146
+
147
+ <xplatlottie
148
+ ref={bindHost}
149
+ id={props.id}
150
+ className={cx(props.className)}
151
+ style={props.style}
152
+ {...layoutChildProps(props)}
153
+ loop={props.loop ?? false}
154
+ accessible={props.accessible}
155
+ accessibilityLabel={props.accessibilityLabel}
156
+ accessibilityRole={nativeAccessibilityRole(props.accessibilityRole) as any}
157
+ accessibilityHint={props.accessibilityHint}
158
+ accessibilityValue={props.accessibilityValue}
159
+ accessibilityState={nativeAccessibilityState(props.accessibilityState) as any}
160
+ accessibilityLiveRegion={props.accessibilityLiveRegion as any}
161
+ />
162
+ }
@@ -0,0 +1,152 @@
1
+ import lottie, { type AnimationItem } from 'lottie-web';
2
+ import { useState, useImperativeHandle, useEffect, useRef } from 'octane';
3
+ import type { LottieHandle, LottieProps } from './props';
4
+ import { applyEscapeProps } from './escape-props.web';
5
+ import { layoutChildProps } from './layout-child.web';
6
+
7
+ const PRESERVE: Record<string, string> = {
8
+ contain: 'xMidYMid meet',
9
+ cover: 'xMidYMid slice',
10
+ fill: 'none',
11
+ };
12
+
13
+ const clamp01 = (n: number) => Math.min(1, Math.max(0, n));
14
+
15
+ /** Lottie — lottie-web's svg renderer in a plain container div. Everything
16
+ * is imperative: `src`/`data` rebuild the AnimationItem, the rest are
17
+ * method calls applied in effects. Progress is normalized 0..1
18
+ * (lottie-web speaks frames); durations arrive in seconds and are
19
+ * surfaced as ms. */
20
+ export function Lottie(props: LottieProps) @{
21
+ const [animation, setAnimation] = useState<AnimationItem | null>(null);
22
+ const el = useRef<HTMLDivElement | null>(null);
23
+ const anim = useRef<AnimationItem | null>(null);
24
+ const ready = useRef(false);
25
+
26
+ const wantPlay = () => props.playing ?? props.autoPlay ?? true;
27
+
28
+ const build = (host: HTMLDivElement) => {
29
+ anim.current?.destroy();
30
+ anim.current = null;
31
+ setAnimation(null);
32
+ ready.current = false;
33
+
34
+ let animationData: object | undefined;
35
+ try {
36
+ animationData = props.data ?? (props.src?.startsWith('{') ? JSON.parse(props.src) : undefined);
37
+ } catch (error) {
38
+ props.onError?.({ message: error instanceof Error ? error.message : String(error) });
39
+ return;
40
+ }
41
+
42
+ const path = animationData ? undefined : props.src;
43
+ if (!animationData && !path) return;
44
+
45
+ let a: AnimationItem;
46
+ try {
47
+ a = lottie.loadAnimation({
48
+ container: host,
49
+ renderer: 'svg',
50
+ loop: props.loop ?? false,
51
+ autoplay: false, // leaf owns play state — uniform with native
52
+ animationData,
53
+ path,
54
+ rendererSettings: { preserveAspectRatio: PRESERVE[props.fit ?? 'contain'] },
55
+ });
56
+ } catch (error) {
57
+ props.onError?.({ message: error instanceof Error ? error.message : String(error) });
58
+ return;
59
+ }
60
+
61
+ anim.current = a;
62
+ setAnimation(a);
63
+
64
+ a.addEventListener('DOMLoaded', () => {
65
+ ready.current = true;
66
+ if (props.speed !== undefined) a.setSpeed(props.speed);
67
+ if (props.progress !== undefined) seekTo(props.progress);
68
+ props.onLoaded?.({ duration: a.getDuration() * 1000 });
69
+ if (wantPlay()) a.play();
70
+ });
71
+
72
+ a.addEventListener('complete', () => props.onEnded?.());
73
+ a.addEventListener('data_failed', () => props.onError?.({ message: 'animation data failed to load' }));
74
+ a.addEventListener('error', () => props.onError?.({ message: 'animation failed' }));
75
+ };
76
+
77
+ const seekTo = (p: number) => {
78
+ const a = anim.current;
79
+ if (!a) return;
80
+ const frame = clamp01(p) * a.totalFrames;
81
+ // goToAndStop parks the playhead — keep playing state instead.
82
+ if (a.isPaused) a.goToAndStop(frame, true);
83
+ else a.goToAndPlay(frame, true);
84
+ };
85
+
86
+ // Build once the container exists; rebuild on src/data/fit changes.
87
+ useEffect(() => {
88
+ const host = el.current;
89
+ if (!host) return;
90
+ build(host);
91
+ return () => {
92
+ anim.current?.destroy();
93
+ anim.current = null;
94
+ ready.current = false;
95
+ };
96
+ }, [props.src, props.data, props.fit]);
97
+
98
+ useEffect(() => {
99
+ if (props.loop !== undefined && anim.current) {
100
+ anim.current.loop = props.loop;
101
+ }
102
+ }, [props.loop]);
103
+
104
+ useEffect(() => {
105
+ if (props.playing === undefined || !anim.current || !ready.current) return;
106
+ if (props.playing) anim.current.play();
107
+ else anim.current.pause();
108
+ }, [props.playing]);
109
+
110
+ useEffect(() => {
111
+ if (props.progress === undefined) return;
112
+ seekTo(props.progress);
113
+ }, [props.progress]);
114
+
115
+ useEffect(() => {
116
+ if (props.speed !== undefined) anim.current?.setSpeed(props.speed);
117
+ }, [props.speed]);
118
+
119
+ const handle = (a: AnimationItem): LottieHandle => ({
120
+ play: () => a.play(),
121
+ pause: () => a.pause(),
122
+ stop: () => a.stop(),
123
+ seekTo,
124
+ setSpeed: (n: number) => a.setSpeed(n),
125
+ progress: () => (a.totalFrames ? a.currentRawFrame / a.totalFrames : 0),
126
+ duration: () => a.getDuration() * 1000,
127
+ isPlaying: () => !a.isPaused,
128
+ native: a,
129
+ });
130
+
131
+ useImperativeHandle<LottieHandle | null>(props.ref, () => animation ? handle(animation) : null, [animation]);
132
+
133
+ <div
134
+ ref={(v: HTMLDivElement | null) => {
135
+ el.current = v;
136
+ if (!v) return;
137
+ applyEscapeProps(v, props);
138
+ }}
139
+ id={props.id}
140
+ className={props.className}
141
+ {...layoutChildProps(props, props.style)}
142
+ role={props.accessibilityRole ?? 'img'}
143
+ aria-label={props.accessibilityLabel}
144
+ aria-hidden={props.accessible === false ? true : undefined}
145
+ aria-description={props.accessibilityHint}
146
+ aria-valuetext={props.accessibilityValue}
147
+ aria-disabled={props.accessibilityState?.disabled}
148
+ aria-selected={props.accessibilityState?.selected}
149
+ aria-checked={props.accessibilityState?.checked}
150
+ aria-live={props.accessibilityLiveRegion === 'none' ? 'off' : props.accessibilityLiveRegion}
151
+ />
152
+ }
@@ -0,0 +1,8 @@
1
+ /** NS `className` splits on ' ' only, and the universal driver applies the
2
+ * prop via `String(value)` — an array would arrive comma-joined and match
3
+ * no class at all. Native leaves normalize through cx() before handing
4
+ * className to an intrinsic. (The DOM renderer already flattens arrays,
5
+ * so web leaves don't need this.) */
6
+ export function cx(...parts: any[]): string {
7
+ return parts.flat(Infinity).filter(Boolean).join(' ')
8
+ }
@@ -0,0 +1,65 @@
1
+ import { isAndroid, isIOS } from '@nativescript/core'
2
+ import type { Role } from './props'
3
+
4
+ /** Apply only the active device's escape bag after the primitive's own props. */
5
+ export function applyEscapeProps(view: any, props: { ios?: any; android?: any }): void {
6
+ if (!view) {
7
+ return
8
+ }
9
+
10
+ const bag = isIOS ? props.ios : isAndroid ? props.android : undefined
11
+ if (bag) {
12
+ Object.assign(view, bag)
13
+ }
14
+ }
15
+
16
+ const NATIVE_ACCESSIBILITY_ROLES: Record<Role, string> = {
17
+ button: 'button',
18
+ link: 'link',
19
+ search: 'search',
20
+ image: 'image',
21
+ heading: 'header',
22
+ adjustable: 'adjustable',
23
+ summary: 'summary',
24
+ text: 'text',
25
+ none: 'none',
26
+ progressbar: 'progressBar',
27
+ checkbox: 'checkbox',
28
+ switch: 'switch',
29
+ radio: 'radioButton',
30
+ spinbutton: 'spinButton',
31
+ // NativeScript has no tab role; a tab is still an actionable button and
32
+ // its selected state is carried separately by accessibilityState.
33
+ tab: 'button',
34
+ }
35
+
36
+ /** Translate the shared/ARIA spelling to NativeScript's narrower role enum. */
37
+ export function nativeAccessibilityRole(role?: Role): string | undefined {
38
+ return role ? NATIVE_ACCESSIBILITY_ROLES[role] : undefined
39
+ }
40
+
41
+ /** NativeScript's AccessibilityState is a single enum value, unlike the
42
+ * web's independent ARIA booleans. Priority follows the strongest state. */
43
+ export function nativeAccessibilityState(state?: {
44
+ disabled?: boolean
45
+ selected?: boolean
46
+ checked?: boolean
47
+ }): string | undefined {
48
+ if (state?.disabled) {
49
+ return 'disabled'
50
+ }
51
+
52
+ if (state?.selected) {
53
+ return 'selected'
54
+ }
55
+
56
+ if (state?.checked === true) {
57
+ return 'checked'
58
+ }
59
+
60
+ if (state?.checked === false) {
61
+ return 'unchecked'
62
+ }
63
+
64
+ return undefined
65
+ }
@@ -0,0 +1,25 @@
1
+ /** Apply DOM escape props after the primitive's own props. Dash-named keys
2
+ * are attributes; other keys use the DOM property where available. */
3
+ export function applyEscapeProps(element: any, props: { web?: any }): void {
4
+ if (!element || !props.web) {
5
+ return
6
+ }
7
+
8
+ for (const [key, value] of Object.entries(props.web)) {
9
+ if (key.includes('-')) {
10
+ if (value == null || value === false) {
11
+ element.removeAttribute(key)
12
+ } else {
13
+ element.setAttribute(key, value === true ? '' : String(value))
14
+ }
15
+ } else if (key in element) {
16
+ try {
17
+ element[key] = value
18
+ } catch {
19
+ element.setAttribute(key, String(value))
20
+ }
21
+ } else if (value != null) {
22
+ element.setAttribute(key, String(value))
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,2 @@
1
+ export { Lottie } from './Lottie.macos.tsrx'
2
+ export type { LottieEvent, LottieFit, LottieHandle, LottieProps } from './props'
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { Lottie } from './Lottie.tsrx'
2
+ export type { LottieEvent, LottieFit, LottieHandle, LottieProps } from './props'
@@ -0,0 +1,2 @@
1
+ export { Lottie } from './Lottie.web.tsrx'
2
+ export type { LottieEvent, LottieFit, LottieHandle, LottieProps } from './props'
@@ -0,0 +1,57 @@
1
+ import type { LayoutChildProps, FlexContainerProps } from './props'
2
+
3
+ // start/end shorthand → flex-start/flex-end.
4
+ const FLEX_JUSTIFY: Record<string, string> = { start: 'flex-start', end: 'flex-end' }
5
+ const FLEX_ALIGN: Record<string, string> = { start: 'flex-start', end: 'flex-end' }
6
+
7
+ /** NativeScript reads these attributes from each child view during parent
8
+ * layout. Values are forwarded with NativeScript's own property names.
9
+ * The flex-container props (justifyContent/alignItems/flexWrap/gap) land on
10
+ * the host flexboxlayout itself — its own attributes, not child metadata. */
11
+ export function layoutChildProps(props: LayoutChildProps & Partial<FlexContainerProps>) {
12
+ const result: Record<string, any> = {}
13
+ for (const key of [
14
+ 'row',
15
+ 'col',
16
+ 'rowSpan',
17
+ 'colSpan',
18
+ 'dock',
19
+ 'left',
20
+ 'top',
21
+ 'flexGrow',
22
+ 'flexShrink',
23
+ 'alignSelf',
24
+ 'order',
25
+ ] as const) {
26
+ if (props[key] !== undefined) {
27
+ result[key] = props[key]
28
+ }
29
+ }
30
+
31
+ if (props.justifyContent !== undefined) {
32
+ result.justifyContent = FLEX_JUSTIFY[props.justifyContent] ?? props.justifyContent
33
+ }
34
+
35
+ if (props.alignItems !== undefined) {
36
+ result.alignItems = FLEX_ALIGN[props.alignItems] ?? props.alignItems
37
+ }
38
+
39
+ if (props.flexWrap !== undefined) {
40
+ result.flexWrap =
41
+ props.flexWrap === true ? 'wrap' : props.flexWrap === false ? 'nowrap' : props.flexWrap
42
+ }
43
+
44
+ if (props.gap !== undefined) {
45
+ result.gap = props.gap
46
+ }
47
+
48
+ if (props.rowGap !== undefined) {
49
+ result.rowGap = props.rowGap
50
+ }
51
+
52
+ if (props.columnGap !== undefined) {
53
+ result.columnGap = props.columnGap
54
+ }
55
+
56
+ return result
57
+ }
@@ -0,0 +1,108 @@
1
+ import type { LayoutChildProps, FlexContainerProps } from './props'
2
+
3
+ /** The shared contract is "numbers are dips" (RN semantics), but octane's DOM
4
+ * renderer keeps React's unitless list — lineHeight is unitless there, so
5
+ * `style={{lineHeight: 40}}` would render a 40× multiplier instead of 40px.
6
+ * lineHeight is the one unitless-in-React prop that is a length in the
7
+ * shared vocabulary; force the px suffix. */
8
+ export function normStyle(style: any) {
9
+ if (style && typeof style.lineHeight === 'number') {
10
+ return { ...style, lineHeight: style.lineHeight + 'px' }
11
+ }
12
+
13
+ return style
14
+ }
15
+
16
+ // start/end shorthand → flex-start/flex-end (valid in both engines).
17
+ const FLEX_JUSTIFY: Record<string, string> = {
18
+ start: 'flex-start',
19
+ end: 'flex-end',
20
+ }
21
+
22
+ const FLEX_ALIGN: Record<string, string> = {
23
+ start: 'flex-start',
24
+ end: 'flex-end',
25
+ }
26
+
27
+ /** Convert parent-layout metadata to CSS on the web leaf. Native's `dock`
28
+ * attribute has no CSS equivalent and is ignored on web. Grid indices are
29
+ * zero-based in the shared API, matching NativeScript. */
30
+ export function layoutChildProps(
31
+ props: LayoutChildProps & Partial<FlexContainerProps> & { style?: any },
32
+ baseStyle = props.style,
33
+ ) {
34
+ const style = { ...normStyle(baseStyle) }
35
+ if (props.row !== undefined) {
36
+ style.gridRow = `${props.row + 1} / span ${props.rowSpan ?? 1}`
37
+ } else if (props.rowSpan !== undefined) {
38
+ style.gridRow = `span ${props.rowSpan}`
39
+ }
40
+
41
+ if (props.col !== undefined) {
42
+ style.gridColumn = `${props.col + 1} / span ${props.colSpan ?? 1}`
43
+ } else if (props.colSpan !== undefined) {
44
+ style.gridColumn = `span ${props.colSpan}`
45
+ }
46
+
47
+ if (props.left !== undefined) {
48
+ style.left = props.left
49
+ }
50
+
51
+ if (props.top !== undefined) {
52
+ style.top = props.top
53
+ }
54
+
55
+ if (props.flexGrow !== undefined) {
56
+ style.flexGrow = props.flexGrow
57
+ }
58
+
59
+ if (props.flexShrink !== undefined) {
60
+ style.flexShrink = props.flexShrink
61
+ }
62
+
63
+ if (props.alignSelf !== undefined) {
64
+ style.alignSelf = props.alignSelf
65
+ }
66
+
67
+ if (props.order !== undefined) {
68
+ style.order = props.order
69
+ }
70
+
71
+ // Flex-container props (View/Row/Pressable hosts) — RN vocabulary on the
72
+ // element style. Numbers become px via octane's style normalization.
73
+ if (props.justifyContent !== undefined) {
74
+ style.justifyContent = FLEX_JUSTIFY[props.justifyContent] ?? props.justifyContent
75
+ }
76
+
77
+ if (props.alignItems !== undefined) {
78
+ style.alignItems = FLEX_ALIGN[props.alignItems] ?? props.alignItems
79
+ }
80
+
81
+ if (props.flexWrap !== undefined) {
82
+ style.flexWrap =
83
+ props.flexWrap === true ? 'wrap' : props.flexWrap === false ? 'nowrap' : props.flexWrap
84
+ }
85
+
86
+ if (props.gap !== undefined) {
87
+ style.gap = props.gap
88
+ }
89
+
90
+ if (props.rowGap !== undefined) {
91
+ style.rowGap = props.rowGap
92
+ }
93
+
94
+ if (props.columnGap !== undefined) {
95
+ style.columnGap = props.columnGap
96
+ }
97
+
98
+ // The shared contract is "numbers are dips" (RN semantics), but octane's
99
+ // DOM renderer keeps React's unitless list — lineHeight is unitless there,
100
+ // so `style={{lineHeight: 40}}` would render a 40× multiplier instead of
101
+ // 40px. lineHeight is the one unitless-in-React prop that is a length in
102
+ // the shared vocabulary; force the px suffix.
103
+ if (typeof style.lineHeight === 'number') {
104
+ style.lineHeight = style.lineHeight + 'px'
105
+ }
106
+
107
+ return { style }
108
+ }
@@ -0,0 +1,8 @@
1
+ import { LottieView } from './vendor/ui-lottie/src/lottie'
2
+ import type { Attributes } from '@nativescript-community/octane/intrinsics'
3
+
4
+ declare module '@nativescript-community/octane/intrinsics' {
5
+ interface NativeScriptElements {
6
+ xplatlottie: Attributes<typeof LottieView>
7
+ }
8
+ }