@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.
- package/README.md +56 -2
- package/dist/native/cx.mobile.js +11 -0
- package/dist/native/escape-props.js +39 -0
- package/dist/native/index.js +183 -0
- package/dist/native/layout-child.js +38 -0
- package/dist/native/octane-client-build.json +8 -0
- package/dist/native/vendor/ui-lottie/index.android.js +286 -0
- package/dist/native/vendor/ui-lottie/index.ios.js +214 -0
- package/dist/native/vendor/ui-lottie/src/lottie/index.common.js +50 -0
- package/dist/native/vendor/ui-lottie/src/lottie/utils.js +6 -0
- package/dist/web/escape-props.web.js +17 -0
- package/dist/web/index.js +346 -0
- package/dist/web/layout-child.web.js +47 -0
- package/dist/web/octane-client-build.json +8 -0
- package/package.json +104 -11
- package/platforms/android/include.gradle +7 -0
- package/platforms/android/java/com/nativescript/lottie/LottieAnimationView.java +92 -0
- package/platforms/android/lottie.aar +0 -0
- package/platforms/android/native-api-usage.json +16 -0
- package/platforms/ios/Podfile +5 -0
- package/platforms/macos/LICENSE-EpoxyCore-Apache-2.0.txt +201 -0
- package/platforms/macos/LICENSE-LRUCache-MIT.txt +22 -0
- package/platforms/macos/LICENSE-Lottie-Apache-2.0.txt +201 -0
- package/platforms/macos/LICENSE-ZIPFoundation-MIT.txt +21 -0
- package/platforms/macos/UPSTREAM.md +13 -0
- package/platforms/macos/resources/PrivacyInfo.xcprivacy +23 -0
- package/platforms/macos/resources/THIRD-PARTY-NOTICES.txt +10 -0
- package/platforms/macos/src/XplatAppKitLottie.swift +246 -0
- package/platforms/macos/src/vendor/Lottie/PrivacyInfo.xcprivacy +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CAAnimation+TimingConfiguration.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CALayer+addAnimation.swift +476 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CombinedShapeAnimation.swift +92 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CustomPathAnimation.swift +89 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/DropShadowAnimation.swift +179 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/EllipseAnimation.swift +53 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/GradientAnimations.swift +287 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/LayerProperty.swift +440 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/OpacityAnimation.swift +53 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/RectangleAnimation.swift +59 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/ShapeAnimation.swift +246 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StarAnimation.swift +119 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StrokeAnimation.swift +96 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/TransformAnimations.swift +380 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/VisibilityAnimation.swift +63 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/CompatibilityTracker.swift +129 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/CoreAnimationLayer.swift +645 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/CALayer+fillBounds.swift +35 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/KeyframeGroup+exactlyOneKeyframe.swift +28 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+combined.swift +345 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+timeRemapping.swift +46 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/AnimationLayer.swift +169 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseAnimationLayer.swift +46 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseCompositionLayer.swift +120 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/CALayer+setupLayerHierarchy.swift +169 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/GradientRenderLayer.swift +101 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ImageLayer.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/InfiniteOpaqueAnimationLayer.swift +57 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/LayerModel+makeAnimationLayer.swift +59 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/MaskCompositionLayer.swift +139 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/PreCompLayer.swift +107 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/RepeaterLayer.swift +113 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ShapeItemLayer.swift +346 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ShapeLayer.swift +569 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/SolidLayer.swift +66 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/TextLayer.swift +157 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/TransformLayer.swift +13 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/ValueProviderStore.swift +157 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Collection+Diff.swift +267 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Diffable.swift +19 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/DiffableSection.swift +16 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/IndexChangeset.swift +187 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/SectionedChangeset.swift +22 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Logging/EpoxyLogger.swift +102 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/CallbackContextEpoxyModeled.swift +8 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelArrayBuilder.swift +48 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelProperty.swift +158 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelStorage.swift +88 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModeled.swift +54 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/AnyEpoxyModelProperty.swift +31 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/ClassReference.swift +39 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/AnimatedProviding.swift +10 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DataIDProviding.swift +58 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidDisplayProviding.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidEndDisplayingProviding.swift +42 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidSelectProviding.swift +36 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ErasedContentProviding.swift +49 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/MakeViewProviding.swift +61 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetBehaviorsProviding.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetContentProviding.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/StyleIDProviding.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/TraitCollectionProviding.swift +14 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewDifferentiatorProviding.swift +34 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewProviding.swift +13 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/WillDisplayProviding.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/ViewEpoxyModeled.swift +10 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/README.md +30 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIIntrinsicContentSizeInvalidator.swift +34 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUILayoutMargins.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxyableView+SwiftUIView.swift +165 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/MeasuringViewRepresentable.swift +127 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/SwiftUIMeasurementContainer.swift +468 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/SwiftUIView.swift +146 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIView+SwiftUIView.swift +39 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIViewConfiguringSwiftUIView.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/BehaviorsConfigurableView.swift +45 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ContentConfigurableView.swift +36 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/EpoxyableView.swift +5 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/StyledView.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ViewType.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/LRUCache/LRUCache.swift +257 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/LRUCache/README.md +24 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/README.md +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+BackingConfiguration.swift +149 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Deprecated.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Helpers.swift +361 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+MemoryFile.swift +205 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Progress.swift +66 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Reading.swift +160 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+ReadingDeprecated.swift +50 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Writing.swift +403 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+WritingDeprecated.swift +95 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+ZIP64.swift +191 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive.swift +404 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+Compression.swift +632 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+CompressionDeprecated.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+Serialization.swift +146 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Date+ZIP.swift +101 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+Serialization.swift +191 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+ZIP64.swift +170 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry.swift +669 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIP.swift +405 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIPDeprecated.swift +28 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/README.md +24 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/URL+ZIP.swift +34 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift +177 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/ImageCompositionLayer.swift +54 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift +191 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/NullCompositionLayer.swift +28 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.swift +137 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/ShapeCompositionLayer.swift +60 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/SolidCompositionLayer.swift +57 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/TextCompositionLayer.swift +247 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/MainThreadAnimationLayer.swift +321 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CachedImageProvider.swift +56 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CompositionLayersInitializer.swift +103 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CoreTextRenderLayer.swift +424 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/InvertedMatteLayer.swift +55 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerFontProvider.swift +39 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerImageProvider.swift +52 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerTextProvider.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift +149 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Extensions/ItemsExtension.swift +146 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/NodeProperty.swift +62 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyNodeProperty.swift +53 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyValueContainer.swift +26 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/KeypathSearchable.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/NodePropertyMap.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueContainer.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueProviders/GroupInterpolator.swift +39 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueProviders/SingleValueProvider.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/DropShadowNode.swift +102 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/LayerEffectNode.swift +25 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/RoundedCornersNode.swift +85 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/TrimPathNode.swift +281 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/GroupOutputNode.swift +74 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PassThroughOutputNode.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PathOutputNode.swift +89 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/FillRenderer.swift +69 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientFillRenderer.swift +253 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientStrokeRenderer.swift +64 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/LegacyGradientFillRenderer.swift +158 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/StrokeRenderer.swift +165 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/EllipseNode.swift +143 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/PolygonNode.swift +173 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/RectNode.swift +238 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/ShapeNode.swift +73 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/StarNode.swift +224 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderContainers/GroupNode.swift +162 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/FillNode.swift +88 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientFillNode.swift +103 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientStrokeNode.swift +149 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/StrokeNode.swift +179 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.swift +345 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/AnimatorNode.swift +197 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/PathNode.swift +20 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/RenderNode.swift +60 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeContainerLayer.swift +78 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeRenderLayer.swift +98 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/Asset.swift +51 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/AssetLibrary.swift +75 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/ImageAsset.swift +141 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/PrecompAsset.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DictionaryInitializable.swift +73 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieAnimation.swift +57 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieImageProvider.swift +89 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieManifest.swift +42 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieUtils.swift +71 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Extensions/Bundle.swift +58 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Extensions/KeyedDecodingContainerExtensions.swift +71 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Keyframes/KeyframeData.swift +111 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Keyframes/KeyframeGroup.swift +265 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/DropShadowEffect.swift +52 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/ColorEffectValue.swift +45 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/EffectValue.swift +98 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/Vector1DEffectValue.swift +45 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/LayerEffect.swift +103 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerStyles/DropShadowStyle.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerStyles/LayerStyle.swift +85 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/ImageLayerModel.swift +49 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/LayerModel.swift +266 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/PreCompLayerModel.swift +74 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/ShapeLayerModel.swift +50 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/SolidLayerModel.swift +63 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/TextLayerModel.swift +65 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/DashPattern.swift +42 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Marker.swift +35 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Mask.swift +80 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Transform.swift +261 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Ellipse.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Fill.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/GradientFill.swift +142 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/GradientStroke.swift +244 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Group.swift +55 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Merge.swift +63 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Rectangle.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Repeater.swift +181 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/RoundedCorners.swift +53 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Shape.swift +63 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/ShapeItem.swift +171 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/ShapeTransform.swift +202 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Star.swift +136 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Stroke.swift +144 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Trim.swift +90 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Text/Font.swift +67 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Text/Glyph.swift +94 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Text/TextAnimator.swift +240 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Text/TextDocument.swift +142 -0
- package/platforms/macos/src/vendor/Lottie/Private/RootAnimationLayer.swift +54 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/AnimatorNodeDebugging.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/LayerDebugging.swift +231 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/TestHelpers.swift +10 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/AnimationKeypathExtension.swift +303 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/BlendMode+Filter.swift +31 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/CGColor+RGB.swift +45 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/CGFloatExtensions.swift +152 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/DataExtension.swift +33 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/MathKit.swift +454 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/StringExtensions.swift +44 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/AnimationContext.swift +95 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/AnyEquatable.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/Binding+Map.swift +19 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/View+ValueChanged.swift +35 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/InterpolatableExtensions.swift +143 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/KeyframeExtensions.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/KeyframeInterpolator.swift +250 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/LottieAnimationSource.swift +51 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/BezierPath.swift +509 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/BezierPathRoundExtension.swift +163 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CGPointExtension.swift +35 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/ColorExtension.swift +101 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CompoundBezierPath.swift +169 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CurveVertex.swift +190 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/PathElement.swift +78 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/UnitBezier.swift +119 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/VectorsExtensions.swift +368 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimation.swift +179 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationHelpers.swift +317 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationLayer.swift +1582 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationView.swift +1090 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationViewInitializers.swift +226 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottiePlaybackMode.swift +266 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieView.swift +643 -0
- package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/AnimationCacheProvider.swift +21 -0
- package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/DefaultAnimationCache.swift +67 -0
- package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/LRUAnimationCache.swift +11 -0
- package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/LottieAnimationCache.swift +15 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/DecodingStrategy.swift +15 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/LottieConfiguration.swift +54 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/LottieURLSession.swift +31 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/ReducedMotionOption.swift +128 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/RenderingEngineOption.swift +117 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedButton.swift +128 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedControl.swift +248 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedSwitch.swift +271 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieButton.swift +119 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieSwitch.swift +144 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieViewType.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/Cache/DotLottieCache.swift +66 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/Cache/DotLottieCacheProvider.swift +21 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieConfiguration.swift +72 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieFile.swift +186 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieFileHelpers.swift +386 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/AnimationKeypath.swift +57 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/AnyValueProvider.swift +132 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/ColorValueProvider.swift +96 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/FloatValueProvider.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/GradientValueProvider.swift +138 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/PointValueProvider.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/SizeValueProvider.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Public/FontProvider/AnimationFontProvider.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Public/ImageProvider/AnimationImageProvider.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Public/Keyframes/Interpolatable.swift +285 -0
- package/platforms/macos/src/vendor/Lottie/Public/Keyframes/Keyframe.swift +98 -0
- package/platforms/macos/src/vendor/Lottie/Public/Logging/LottieLogger.swift +138 -0
- package/platforms/macos/src/vendor/Lottie/Public/Primitives/AnimationTime.swift +15 -0
- package/platforms/macos/src/vendor/Lottie/Public/Primitives/LottieColor.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Public/Primitives/Vectors.swift +36 -0
- package/platforms/macos/src/vendor/Lottie/Public/TextProvider/AnimationTextProvider.swift +135 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/AnimationSubview.swift +19 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/BundleImageProvider.swift +98 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleAnimationKeypath.swift +33 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleAnimationView.swift +567 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleFontProvider.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleImageProvider.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/FilepathImageProvider.swift +78 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/LottieAnimationViewBase.swift +85 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/UIColorExtension.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Public/macOS/AnimationSubview.macOS.swift +19 -0
- package/platforms/macos/src/vendor/Lottie/Public/macOS/BundleImageProvider.macOS.swift +90 -0
- package/platforms/macos/src/vendor/Lottie/Public/macOS/FilepathImageProvider.macOS.swift +86 -0
- package/platforms/macos/src/vendor/Lottie/Public/macOS/LottieAnimationViewBase.macOS.swift +102 -0
- package/src/Lottie.macos.tsrx +129 -0
- package/src/Lottie.tsrx +162 -0
- package/src/Lottie.web.tsrx +152 -0
- package/src/cx.mobile.ts +8 -0
- package/src/escape-props.ts +65 -0
- package/src/escape-props.web.ts +25 -0
- package/src/index.macos.ts +2 -0
- package/src/index.ts +2 -0
- package/src/index.web.ts +2 -0
- package/src/layout-child.ts +57 -0
- package/src/layout-child.web.ts +108 -0
- package/src/native-elements.d.ts +8 -0
- package/src/props.ts +133 -0
- package/src/references.d.ts +3 -0
- package/src/vendor/ui-lottie/LICENSE.md +21 -0
- package/src/vendor/ui-lottie/src/lottie/index.android.ts +447 -0
- package/src/vendor/ui-lottie/src/lottie/index.common.ts +84 -0
- package/src/vendor/ui-lottie/src/lottie/index.d.ts +133 -0
- package/src/vendor/ui-lottie/src/lottie/index.ios.ts +345 -0
- package/src/vendor/ui-lottie/src/lottie/typings/android.d.ts +4149 -0
- package/src/vendor/ui-lottie/src/lottie/typings/android.nativescript.d.ts +12 -0
- package/src/vendor/ui-lottie/src/lottie/typings/dotlottie.ios.d.ts +14 -0
- package/src/vendor/ui-lottie/src/lottie/typings/ios.d.ts +384 -0
- package/src/vendor/ui-lottie/src/lottie/utils.ts +9 -0
- package/types/generated/.tsrx-typegen-manifest.json +18 -0
- package/types/generated/Lottie.d.ts +7 -0
- package/types/generated/Lottie.web.d.ts +7 -0
- package/types/generated/cx.mobile.d.ts +6 -0
- package/types/generated/escape-props.d.ts +15 -0
- package/types/generated/escape-props.web.d.ts +5 -0
- package/types/generated/index.d.ts +2 -0
- package/types/generated/index.web.d.ts +2 -0
- package/types/generated/layout-child.d.ts +6 -0
- package/types/generated/layout-child.web.d.ts +15 -0
- package/types/generated/props.d.ts +110 -0
- package/types/generated/vendor/ui-lottie/src/lottie/index.common.d.ts +30 -0
- package/types/generated/vendor/ui-lottie/src/lottie/index.ios.d.ts +35 -0
- package/types/generated/vendor/ui-lottie/src/lottie/utils.d.ts +1 -0
- package/index.d.ts +0 -1
- package/index.js +0 -2
package/src/props.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { Octane } from 'octane/jsx-runtime'
|
|
2
|
+
|
|
3
|
+
export interface LayoutChildProps {
|
|
4
|
+
row?: number
|
|
5
|
+
col?: number
|
|
6
|
+
rowSpan?: number
|
|
7
|
+
colSpan?: number
|
|
8
|
+
dock?: 'left' | 'top' | 'right' | 'bottom'
|
|
9
|
+
left?: number
|
|
10
|
+
top?: number
|
|
11
|
+
flexGrow?: number
|
|
12
|
+
flexShrink?: number
|
|
13
|
+
alignSelf?: string
|
|
14
|
+
order?: number
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Flex-container props shared by View/Row/Pressable — RN vocabulary, applied
|
|
18
|
+
* to the host flexboxlayout natively and the element's style on web.
|
|
19
|
+
* `gap` is a dip number (px on web); NS supports it on FlexboxLayout only. */
|
|
20
|
+
export interface FlexContainerProps {
|
|
21
|
+
justifyContent?: 'start' | 'center' | 'end' | 'space-between' | 'space-around' | 'space-evenly'
|
|
22
|
+
alignItems?: 'start' | 'center' | 'end' | 'stretch' | 'baseline'
|
|
23
|
+
flexWrap?: boolean | 'wrap' | 'nowrap' | 'wrap-reverse'
|
|
24
|
+
gap?: number | string
|
|
25
|
+
rowGap?: number | string
|
|
26
|
+
columnGap?: number | string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type Role =
|
|
30
|
+
| 'button'
|
|
31
|
+
| 'link'
|
|
32
|
+
| 'search'
|
|
33
|
+
| 'image'
|
|
34
|
+
| 'heading'
|
|
35
|
+
| 'adjustable'
|
|
36
|
+
| 'summary'
|
|
37
|
+
| 'text'
|
|
38
|
+
| 'none'
|
|
39
|
+
| 'progressbar'
|
|
40
|
+
| 'checkbox'
|
|
41
|
+
| 'switch'
|
|
42
|
+
| 'radio'
|
|
43
|
+
| 'spinbutton'
|
|
44
|
+
| 'tab'
|
|
45
|
+
|
|
46
|
+
export interface AccessibilityProps {
|
|
47
|
+
accessible?: boolean
|
|
48
|
+
accessibilityLabel?: string
|
|
49
|
+
accessibilityRole?: Role
|
|
50
|
+
accessibilityHint?: string
|
|
51
|
+
accessibilityValue?: string
|
|
52
|
+
accessibilityState?: {
|
|
53
|
+
disabled?: boolean
|
|
54
|
+
selected?: boolean
|
|
55
|
+
checked?: boolean
|
|
56
|
+
}
|
|
57
|
+
accessibilityLiveRegion?: 'none' | 'polite' | 'assertive'
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export type LottieFit = 'contain' | 'cover' | 'fill'
|
|
61
|
+
|
|
62
|
+
export interface LottieEvent {
|
|
63
|
+
/** Animation duration in milliseconds once loaded (0 before then). */
|
|
64
|
+
duration?: number
|
|
65
|
+
/** Failure description. */
|
|
66
|
+
message?: string
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface LottieHandle {
|
|
70
|
+
play(): void
|
|
71
|
+
pause(): void
|
|
72
|
+
/** Stop and reset the playhead to the start. */
|
|
73
|
+
stop(): void
|
|
74
|
+
/** Seek to a normalized position, 0..1. */
|
|
75
|
+
seekTo(progress: number): void
|
|
76
|
+
/** Playback speed multiplier (1 = normal). */
|
|
77
|
+
setSpeed(n: number): void
|
|
78
|
+
/** Current playhead position, 0..1. */
|
|
79
|
+
progress(): number
|
|
80
|
+
/** Animation duration in milliseconds (0 before load). */
|
|
81
|
+
duration(): number
|
|
82
|
+
isPlaying(): boolean
|
|
83
|
+
/** The platform surface (lottie-web AnimationItem / plugin LottieView). */
|
|
84
|
+
native: any
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Lottie animation — lottie-web (svg renderer) on web, vendored
|
|
88
|
+
* ui-lottie (`src/vendor/ui-lottie` submodule, `octane-xplat/ui-lottie`
|
|
89
|
+
* @ `xplat-vendored`) on native.
|
|
90
|
+
* On web, lottie-web evaluates expressions embedded in animation data as
|
|
91
|
+
* JavaScript. Load only trusted animation data; expression-bearing files
|
|
92
|
+
* require a CSP that allows `unsafe-eval`.
|
|
93
|
+
* Progress is always normalized 0..1 and durations are milliseconds on
|
|
94
|
+
* every platform (the native plugin reports seconds on iOS). */
|
|
95
|
+
export interface LottieProps extends LayoutChildProps, AccessibilityProps {
|
|
96
|
+
className?: any
|
|
97
|
+
style?: any
|
|
98
|
+
id?: string
|
|
99
|
+
/** Remote URL; native also accepts `~/` bundle paths, absolute file
|
|
100
|
+
* paths, `res://` names, `.lottie`/`.zip` containers, and raw JSON
|
|
101
|
+
* strings starting with `{`. */
|
|
102
|
+
src?: string
|
|
103
|
+
/** Inline animation object — wins over `src` when both are given. */
|
|
104
|
+
data?: object
|
|
105
|
+
/** Start playing as soon as the composition loads. Default true —
|
|
106
|
+
* matches lottie-web; the native plugin's own default is false. */
|
|
107
|
+
autoPlay?: boolean
|
|
108
|
+
/** Repeat forever. Default false — a finite play is the least
|
|
109
|
+
* surprising shared contract (lottie-web's own default is true). */
|
|
110
|
+
loop?: boolean
|
|
111
|
+
/** Controlled playback — leave unset for uncontrolled play. */
|
|
112
|
+
playing?: boolean
|
|
113
|
+
/** Controlled playhead position, 0..1. */
|
|
114
|
+
progress?: number
|
|
115
|
+
/** Playback speed multiplier (1 = normal). */
|
|
116
|
+
speed?: number
|
|
117
|
+
/** Content fitting inside the frame: `contain` (letterbox, default),
|
|
118
|
+
* `cover` (crop to fill), `fill` (stretch). */
|
|
119
|
+
fit?: LottieFit
|
|
120
|
+
/** Composition parsed and ready — `e.duration` is the length in ms. */
|
|
121
|
+
onLoaded?: (e: LottieEvent) => void
|
|
122
|
+
/** Reached the end; does not fire per loop iteration. */
|
|
123
|
+
onEnded?: () => void
|
|
124
|
+
/** Load or parse failure. */
|
|
125
|
+
onError?: (e: LottieEvent) => void
|
|
126
|
+
/** Imperative handle — play/pause/seek plus `native` for anything the
|
|
127
|
+
* shared props don't cover. */
|
|
128
|
+
ref?: Octane.Ref<LottieHandle>
|
|
129
|
+
/** Platform escape hatches, applied after the shared props. */
|
|
130
|
+
ios?: Record<string, any>
|
|
131
|
+
android?: Record<string, any>
|
|
132
|
+
web?: Record<string, any>
|
|
133
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
nativescript-lottie
|
|
4
|
+
Copyright (c) 2017, Brad Martin
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
7
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
8
|
+
the Software without restriction, including without limitation the rights to
|
|
9
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
10
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
11
|
+
subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
18
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
19
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
20
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
21
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
/**********************************************************************************
|
|
2
|
+
* (c) 2017, Brad Martin.
|
|
3
|
+
* Licensed under the MIT license.
|
|
4
|
+
*
|
|
5
|
+
* Version 1.0.0 bradwaynemartin@gmail.com
|
|
6
|
+
**********************************************************************************/
|
|
7
|
+
|
|
8
|
+
// Vendored from @nativescript-community/ui-lottie (MIT), fork branch
|
|
9
|
+
// xplat-fixes on octane-xplat/ui-lottie — device-probed fixes for dead
|
|
10
|
+
// sync-src, missing events/pause-resume, URL/.lottie sources, async
|
|
11
|
+
// autoPlay, completion dedupe, opacity scale, Podfile pin.
|
|
12
|
+
// @ts-nocheck — vendored upstream code, not strict-clean; kept
|
|
13
|
+
// diff-identical to the fork so fix branches stay PR-able.
|
|
14
|
+
/// <reference path="./typings/android.d.ts" />
|
|
15
|
+
import { Color, File, Http, Utils, knownFolders, path } from '@nativescript/core';
|
|
16
|
+
import { LottieViewBase, autoPlayProperty, keyPathColorsProperty, loopProperty, progressProperty, renderModeProperty, srcProperty, stretchProperty } from './index.common';
|
|
17
|
+
import { clamp } from './utils';
|
|
18
|
+
|
|
19
|
+
let LottieProperty: typeof com.airbnb.lottie.LottieProperty;
|
|
20
|
+
let LottieKeyPath: typeof com.airbnb.lottie.model.KeyPath;
|
|
21
|
+
let LottieValueCallback: typeof com.airbnb.lottie.value.LottieValueCallback;
|
|
22
|
+
let LottieCompositionFactory: typeof com.airbnb.lottie.LottieCompositionFactory;
|
|
23
|
+
|
|
24
|
+
const cache = new Map();
|
|
25
|
+
async function loadLottieJSON(iconSrc) {
|
|
26
|
+
if (!cache.has(iconSrc)) {
|
|
27
|
+
const file = File.fromPath(iconSrc);
|
|
28
|
+
const r = await file.readText();
|
|
29
|
+
cache.set(iconSrc, r);
|
|
30
|
+
return r;
|
|
31
|
+
}
|
|
32
|
+
return cache.get(iconSrc);
|
|
33
|
+
}
|
|
34
|
+
function loadLottieJSONSync(iconSrc) {
|
|
35
|
+
if (!cache.has(iconSrc)) {
|
|
36
|
+
const file = File.fromPath(iconSrc);
|
|
37
|
+
const r = file.readTextSync();
|
|
38
|
+
cache.set(iconSrc, r);
|
|
39
|
+
return r;
|
|
40
|
+
}
|
|
41
|
+
return cache.get(iconSrc);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const RenderMode = {
|
|
45
|
+
get AUTOMATIC() {
|
|
46
|
+
return com.airbnb.lottie.RenderMode.AUTOMATIC;
|
|
47
|
+
},
|
|
48
|
+
get HARDWARE() {
|
|
49
|
+
return com.airbnb.lottie.RenderMode.HARDWARE;
|
|
50
|
+
},
|
|
51
|
+
get SOFTWARE() {
|
|
52
|
+
return com.airbnb.lottie.RenderMode.SOFTWARE;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export class LottieView extends LottieViewBase {
|
|
57
|
+
nativeViewProtected: com.airbnb.lottie.LottieAnimationView;
|
|
58
|
+
|
|
59
|
+
public createNativeView() {
|
|
60
|
+
return new com.nativescript.lottie.LottieAnimationView(this._context);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
animatorListener: android.animation.Animator.AnimatorListener;
|
|
64
|
+
loadedListener: com.airbnb.lottie.LottieOnCompositionLoadedListener;
|
|
65
|
+
_completionBlock;
|
|
66
|
+
_cancelled = false;
|
|
67
|
+
//@ts-ignore
|
|
68
|
+
get completionBlock() {
|
|
69
|
+
return this._completionBlock;
|
|
70
|
+
}
|
|
71
|
+
set completionBlock(block) {
|
|
72
|
+
this._completionBlock = block;
|
|
73
|
+
if (block) {
|
|
74
|
+
if (!this.animatorListener) {
|
|
75
|
+
const that = new WeakRef(this);
|
|
76
|
+
this.animatorListener = new android.animation.Animator.AnimatorListener({
|
|
77
|
+
onAnimationCancel: (_animator) => {
|
|
78
|
+
// ValueAnimator.cancel() fires onAnimationCancel AND then
|
|
79
|
+
// onAnimationEnd — report once, in onAnimationEnd, with the
|
|
80
|
+
// correct finished flag (matching iOS, where pause()/stop()
|
|
81
|
+
// invoke the completion block a single time with false).
|
|
82
|
+
const owner = that?.get();
|
|
83
|
+
if (owner) {
|
|
84
|
+
owner._cancelled = true;
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
onAnimationEnd: (_animator) => {
|
|
88
|
+
const owner = that?.get();
|
|
89
|
+
if (owner?._completionBlock) {
|
|
90
|
+
owner._completionBlock(!owner._cancelled);
|
|
91
|
+
}
|
|
92
|
+
if (owner) {
|
|
93
|
+
owner._cancelled = false;
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
onAnimationRepeat: (_animator) => {
|
|
97
|
+
// noop
|
|
98
|
+
},
|
|
99
|
+
onAnimationStart: (_animator) => {
|
|
100
|
+
// noop
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
if (this.nativeViewProtected) {
|
|
104
|
+
this.nativeViewProtected.addAnimatorListener(this.animatorListener);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
} else if (this.animatorListener) {
|
|
108
|
+
if (this.nativeViewProtected) {
|
|
109
|
+
this.nativeViewProtected.removeAnimatorListener(this.animatorListener);
|
|
110
|
+
}
|
|
111
|
+
this.animatorListener = null;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
public initNativeView(): void {
|
|
115
|
+
if (this.animatorListener) {
|
|
116
|
+
this.nativeViewProtected.addAnimatorListener(this.animatorListener);
|
|
117
|
+
}
|
|
118
|
+
if (!this.loadedListener) {
|
|
119
|
+
const that = new WeakRef(this);
|
|
120
|
+
this.loadedListener = new com.airbnb.lottie.LottieOnCompositionLoadedListener({
|
|
121
|
+
onCompositionLoaded: (composition) => {
|
|
122
|
+
const owner = that?.get();
|
|
123
|
+
if (owner) {
|
|
124
|
+
// delay just a bit so that it get received in sync load
|
|
125
|
+
setTimeout(() => {
|
|
126
|
+
owner.notify({ eventName: LottieViewBase.compositionLoadedEvent, composition });
|
|
127
|
+
// async loads arrive after the autoPlay property
|
|
128
|
+
// setter ran — playAnimation() there was a no-op on
|
|
129
|
+
// an empty view, so re-trigger on composition arrival.
|
|
130
|
+
if (owner.autoPlay && !owner.isAnimating()) {
|
|
131
|
+
owner.playAnimation();
|
|
132
|
+
}
|
|
133
|
+
}, 0);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
this.nativeViewProtected.addLottieOnCompositionLoadedListener(this.loadedListener);
|
|
139
|
+
const that = new WeakRef(this);
|
|
140
|
+
this.nativeViewProtected.setFailureListener(
|
|
141
|
+
new com.airbnb.lottie.LottieListener<java.lang.Throwable>({
|
|
142
|
+
onResult: (result) => {
|
|
143
|
+
const owner = that?.get();
|
|
144
|
+
if (owner) {
|
|
145
|
+
owner.notify({ eventName: LottieViewBase.loadFailedEvent, error: result });
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
})
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
public disposeNativeView(): void {
|
|
153
|
+
if (this.animatorListener) {
|
|
154
|
+
this.nativeViewProtected.removeAnimatorListener(this.animatorListener);
|
|
155
|
+
}
|
|
156
|
+
if (this.loadedListener) {
|
|
157
|
+
this.nativeViewProtected.removeLottieOnCompositionLoadedListener(this.loadedListener);
|
|
158
|
+
}
|
|
159
|
+
super.disposeNativeView();
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
public setColor(value: Color | string, keyPath: string[]): void {
|
|
163
|
+
const nativeView = this.nativeViewProtected;
|
|
164
|
+
if (nativeView && value && keyPath && keyPath.length) {
|
|
165
|
+
if (keyPath[keyPath.length - 1].toLowerCase() === 'color') {
|
|
166
|
+
keyPath = [...keyPath];
|
|
167
|
+
keyPath.pop(); // android specifies the property as an enum parameter.
|
|
168
|
+
if (keyPath.length === 0) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
const nativeKeyPath: any[] = Array.create(java.lang.String, keyPath.length);
|
|
173
|
+
for (let index = 0; index < keyPath.length; index++) {
|
|
174
|
+
nativeKeyPath[index] = keyPath[index];
|
|
175
|
+
}
|
|
176
|
+
if (!LottieProperty) {
|
|
177
|
+
LottieProperty = com.airbnb.lottie.LottieProperty;
|
|
178
|
+
}
|
|
179
|
+
if (!LottieValueCallback) {
|
|
180
|
+
LottieValueCallback = com.airbnb.lottie.value.LottieValueCallback;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (!LottieKeyPath) {
|
|
184
|
+
LottieKeyPath = com.airbnb.lottie.model.KeyPath;
|
|
185
|
+
}
|
|
186
|
+
// by using color filter we change all colors (STROKE_COLOR and COLOR)
|
|
187
|
+
const color = value instanceof Color ? value : new Color(value);
|
|
188
|
+
// const colorFilter = new android.graphics.PorterDuffColorFilter(value.android, android.graphics.PorterDuff.Mode.SRC_ATOP) ;
|
|
189
|
+
const colorFilter = new com.airbnb.lottie.SimpleColorFilter(color.android);
|
|
190
|
+
nativeView.addValueCallback(new LottieKeyPath(nativeKeyPath as any), LottieProperty.COLOR_FILTER, new LottieValueCallback(colorFilter));
|
|
191
|
+
// nativeView.addValueCallback(
|
|
192
|
+
// new LottieKeyPath(nativeKeyPath as any),
|
|
193
|
+
// LottieProperty.COLOR,
|
|
194
|
+
// new LottieValueCallback(java.lang.Integer.valueOf(value.android))
|
|
195
|
+
// );
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
public setOpacity(value: number, keyPath: string[]): void {
|
|
200
|
+
if (this.nativeViewProtected && value != null && keyPath && keyPath.length) {
|
|
201
|
+
if (keyPath[keyPath.length - 1].toLowerCase() === 'opacity') {
|
|
202
|
+
keyPath = [...keyPath];
|
|
203
|
+
keyPath.pop(); // android specifies the property as an enum parameter.
|
|
204
|
+
if (keyPath.length === 0) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const nativeKeyPath: java.lang.String[] = Array.create(java.lang.String, keyPath.length);
|
|
209
|
+
keyPath.forEach((key, index) => {
|
|
210
|
+
nativeKeyPath[index] = new java.lang.String(key);
|
|
211
|
+
});
|
|
212
|
+
value = clamp(value);
|
|
213
|
+
if (!LottieProperty) {
|
|
214
|
+
LottieProperty = com.airbnb.lottie.LottieProperty;
|
|
215
|
+
}
|
|
216
|
+
if (!LottieValueCallback) {
|
|
217
|
+
LottieValueCallback = com.airbnb.lottie.value.LottieValueCallback;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (!LottieKeyPath) {
|
|
221
|
+
LottieKeyPath = com.airbnb.lottie.model.KeyPath;
|
|
222
|
+
}
|
|
223
|
+
// LottieProperty.OPACITY is an Integer on a 0–255 scale (matching
|
|
224
|
+
// Paint#setAlpha), not a 0–100 percentage.
|
|
225
|
+
this.nativeViewProtected.addValueCallback(new LottieKeyPath(nativeKeyPath as any), LottieProperty.OPACITY, new LottieValueCallback(new java.lang.Integer(value * 255)));
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
public playAnimation(): void {
|
|
230
|
+
if (this.nativeViewProtected) {
|
|
231
|
+
this.nativeViewProtected.setMinAndMaxProgress(0, 1);
|
|
232
|
+
this.nativeViewProtected.playAnimation();
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
public playAnimationFromProgressToProgress(startProgress: number, endProgress: number): void {
|
|
237
|
+
if (this.nativeViewProtected) {
|
|
238
|
+
startProgress = startProgress ? clamp(startProgress) : 0;
|
|
239
|
+
endProgress = endProgress ? clamp(endProgress) : 1;
|
|
240
|
+
this.nativeViewProtected.setMinAndMaxProgress(startProgress, endProgress);
|
|
241
|
+
this.nativeViewProtected.playAnimation();
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
public isAnimating(): boolean {
|
|
246
|
+
return this.nativeViewProtected ? this.nativeViewProtected.isAnimating() : false;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
public get speed(): number | undefined {
|
|
250
|
+
return this.nativeViewProtected ? this.nativeViewProtected.getSpeed() : undefined;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
public set speed(value: number) {
|
|
254
|
+
if (this.nativeViewProtected && value) {
|
|
255
|
+
this.nativeViewProtected.setSpeed(value);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
public get duration(): number | undefined {
|
|
260
|
+
return this.nativeViewProtected ? this.nativeViewProtected.getDuration() : undefined;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
public cancelAnimation(): void {
|
|
264
|
+
if (this.nativeViewProtected) {
|
|
265
|
+
this.nativeViewProtected.cancelAnimation();
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
public pauseAnimation(): void {
|
|
270
|
+
if (this.nativeViewProtected) {
|
|
271
|
+
this.nativeViewProtected.pauseAnimation();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
public resumeAnimation(): void {
|
|
276
|
+
if (this.nativeViewProtected) {
|
|
277
|
+
this.nativeViewProtected.resumeAnimation();
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
[srcProperty.setNative](src: string) {
|
|
282
|
+
try {
|
|
283
|
+
if (!LottieCompositionFactory) {
|
|
284
|
+
LottieCompositionFactory = com.airbnb.lottie.LottieCompositionFactory;
|
|
285
|
+
}
|
|
286
|
+
const view = this.nativeViewProtected;
|
|
287
|
+
let result: com.airbnb.lottie.LottieResult<com.airbnb.lottie.LottieComposition>;
|
|
288
|
+
if (!src) {
|
|
289
|
+
// lottie does not support "clearing the animation"
|
|
290
|
+
// view.setAnimation(null);
|
|
291
|
+
} else if (src[0] === '{') {
|
|
292
|
+
if (this.async) {
|
|
293
|
+
view.setAnimationFromJson(src, null);
|
|
294
|
+
} else {
|
|
295
|
+
result = LottieCompositionFactory.fromJsonStringSync(src, null);
|
|
296
|
+
}
|
|
297
|
+
} else if (/^https?:/i.test(src)) {
|
|
298
|
+
// Remote URL — download to a temp file and re-enter as a
|
|
299
|
+
// local path. (Android could use LottieCompositionFactory.
|
|
300
|
+
// fromUrl, but the download path works identically on iOS
|
|
301
|
+
// and flows failures through loadFailed.)
|
|
302
|
+
const match = /\.(zip|lottie|json)(?=[?#]|$)/i.exec(src);
|
|
303
|
+
const dest = path.join(knownFolders.temp().path, `lottie-${Date.now()}${match ? match[0].toLowerCase() : '.json'}`);
|
|
304
|
+
Http.getFile(src, dest)
|
|
305
|
+
.then(() => {
|
|
306
|
+
this.src = dest;
|
|
307
|
+
})
|
|
308
|
+
.catch((error) => {
|
|
309
|
+
console.error(error);
|
|
310
|
+
this.notify({ eventName: 'loadFailed', error });
|
|
311
|
+
});
|
|
312
|
+
} else if (src.startsWith(Utils.RESOURCE_PREFIX)) {
|
|
313
|
+
const resName = src.replace(Utils.RESOURCE_PREFIX, '');
|
|
314
|
+
if (this.async) {
|
|
315
|
+
view.setAnimation(resName);
|
|
316
|
+
} else {
|
|
317
|
+
result = com.airbnb.lottie.LottieCompositionFactory.fromAssetSync(this._context, resName);
|
|
318
|
+
}
|
|
319
|
+
} else {
|
|
320
|
+
if (!/.(json|zip|lottie)$/.test(src)) {
|
|
321
|
+
src += '.json';
|
|
322
|
+
}
|
|
323
|
+
if (src[0] === '~') {
|
|
324
|
+
if (this.async) {
|
|
325
|
+
view.setAnimation('app/' + src.substring(2));
|
|
326
|
+
} else {
|
|
327
|
+
result = com.airbnb.lottie.LottieCompositionFactory.fromAssetSync(this._context, 'app/' + src.substring(2));
|
|
328
|
+
}
|
|
329
|
+
} else if (!src.startsWith('file:/') && src[0] !== '/') {
|
|
330
|
+
if (this.async) {
|
|
331
|
+
view.setAnimation('app/' + src);
|
|
332
|
+
} else {
|
|
333
|
+
result = com.airbnb.lottie.LottieCompositionFactory.fromAssetSync(this._context, src);
|
|
334
|
+
}
|
|
335
|
+
} else {
|
|
336
|
+
const filePath = src.startsWith('file:') ? src.substring('file:'.length) : src;
|
|
337
|
+
if (/\.(zip|lottie)$/i.test(filePath)) {
|
|
338
|
+
// Binary containers can't survive File.readText — hand
|
|
339
|
+
// a ZipInputStream to the factory instead.
|
|
340
|
+
const stream = new java.util.zip.ZipInputStream(new java.io.FileInputStream(filePath));
|
|
341
|
+
if (this.async) {
|
|
342
|
+
const owner = new WeakRef(this);
|
|
343
|
+
com.airbnb.lottie.LottieCompositionFactory.fromZipStream(stream, null)
|
|
344
|
+
.addListener(
|
|
345
|
+
new com.airbnb.lottie.LottieListener<com.airbnb.lottie.LottieComposition>({
|
|
346
|
+
onResult: (composition) => {
|
|
347
|
+
const view = owner.get()?.nativeViewProtected;
|
|
348
|
+
if (view) {
|
|
349
|
+
view.setComposition(composition);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
})
|
|
353
|
+
)
|
|
354
|
+
.addFailureListener(
|
|
355
|
+
new com.airbnb.lottie.LottieListener<java.lang.Throwable>({
|
|
356
|
+
onResult: (error) => console.error(error)
|
|
357
|
+
})
|
|
358
|
+
);
|
|
359
|
+
} else {
|
|
360
|
+
result = com.airbnb.lottie.LottieCompositionFactory.fromZipStreamSync(stream, null);
|
|
361
|
+
}
|
|
362
|
+
} else if (this.async) {
|
|
363
|
+
loadLottieJSON(src).then((result) => {
|
|
364
|
+
if (this.nativeViewProtected) {
|
|
365
|
+
this.nativeViewProtected.setAnimationFromJson(result, null);
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
} else {
|
|
369
|
+
result = LottieCompositionFactory.fromJsonStringSync(loadLottieJSONSync(src), null);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
if (result) {
|
|
374
|
+
if (result.getException()) {
|
|
375
|
+
console.error(result.getException());
|
|
376
|
+
this.notify({ eventName: LottieViewBase.loadFailedEvent, error: result.getException() });
|
|
377
|
+
// view.setComposition(null);
|
|
378
|
+
} else {
|
|
379
|
+
view.setComposition(result.getValue());
|
|
380
|
+
|
|
381
|
+
//in sync loading we need to fire it ourselves
|
|
382
|
+
// if we dont differ it from now it wont be received
|
|
383
|
+
// setTimeout(() => {
|
|
384
|
+
// this.notify({ eventName: 'compositionLoaded', composition: result.getValue() });
|
|
385
|
+
// }, 0);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
if (this.autoPlay) {
|
|
389
|
+
this.playAnimation();
|
|
390
|
+
}
|
|
391
|
+
} catch (error) {
|
|
392
|
+
console.error(error);
|
|
393
|
+
this.notify({ eventName: LottieViewBase.loadFailedEvent, error });
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
[loopProperty.setNative](loop: boolean) {
|
|
398
|
+
this.nativeViewProtected.setRepeatCount(loop ? -1 /* android.animation.ValueAnimator.INFINITE */ : 0);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
[progressProperty.setNative](value: number) {
|
|
402
|
+
this.nativeViewProtected.setProgress(value);
|
|
403
|
+
}
|
|
404
|
+
[renderModeProperty.setNative](renderMode) {
|
|
405
|
+
this.nativeViewProtected.setRenderMode(renderMode);
|
|
406
|
+
}
|
|
407
|
+
[keyPathColorsProperty.setNative](value) {
|
|
408
|
+
Object.keys(value).forEach((k) => this.setColor(value[k], k.split('|')));
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
[autoPlayProperty.setNative](autoPlay: boolean) {
|
|
412
|
+
if (autoPlay) {
|
|
413
|
+
if (!this.isAnimating()) {
|
|
414
|
+
this.playAnimation();
|
|
415
|
+
}
|
|
416
|
+
} else {
|
|
417
|
+
// disable check for now as isAnimating always returns false
|
|
418
|
+
// if (this.isAnimating()) {
|
|
419
|
+
this.cancelAnimation();
|
|
420
|
+
if (this.progress) {
|
|
421
|
+
this.nativeViewProtected.setProgress(this.progress);
|
|
422
|
+
}
|
|
423
|
+
// }
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
[stretchProperty.getDefault](): 'aspectFit' {
|
|
428
|
+
return 'aspectFit';
|
|
429
|
+
}
|
|
430
|
+
[stretchProperty.setNative](value: 'none' | 'aspectFill' | 'aspectFit' | 'fill') {
|
|
431
|
+
switch (value) {
|
|
432
|
+
case 'aspectFit':
|
|
433
|
+
this.nativeViewProtected.setScaleType(android.widget.ImageView.ScaleType.FIT_CENTER);
|
|
434
|
+
break;
|
|
435
|
+
case 'aspectFill':
|
|
436
|
+
this.nativeViewProtected.setScaleType(android.widget.ImageView.ScaleType.CENTER_CROP);
|
|
437
|
+
break;
|
|
438
|
+
case 'fill':
|
|
439
|
+
this.nativeViewProtected.setScaleType(android.widget.ImageView.ScaleType.FIT_XY);
|
|
440
|
+
break;
|
|
441
|
+
case 'none':
|
|
442
|
+
default:
|
|
443
|
+
this.nativeViewProtected.setScaleType(android.widget.ImageView.ScaleType.MATRIX);
|
|
444
|
+
break;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**********************************************************************************
|
|
2
|
+
* (c) 2017, Nathan Walker.
|
|
3
|
+
* Licensed under the MIT license.
|
|
4
|
+
*
|
|
5
|
+
* Version 1.0.0 walkerrunpdx@gmail.com
|
|
6
|
+
**********************************************************************************/
|
|
7
|
+
|
|
8
|
+
// Vendored from @nativescript-community/ui-lottie (MIT), fork branch
|
|
9
|
+
// xplat-fixes on octane-xplat/ui-lottie — device-probed fixes for dead
|
|
10
|
+
// sync-src, missing events/pause-resume, URL/.lottie sources, async
|
|
11
|
+
// autoPlay, completion dedupe, opacity scale, Podfile pin.
|
|
12
|
+
// @ts-nocheck — vendored upstream code, not strict-clean. Kept
|
|
13
|
+
// close to the fork so fix branches stay PR-able; divergences are
|
|
14
|
+
// commented inline.
|
|
15
|
+
import { CoreTypes, Property, View, booleanConverter } from '@nativescript/core';
|
|
16
|
+
// KeyPathColors lives here — upstream's `from '.'` self-import
|
|
17
|
+
// doesn't resolve in a vendored layout.
|
|
18
|
+
export interface KeyPathColors {
|
|
19
|
+
[k: string]: Color | string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class LottieViewBase extends View {
|
|
23
|
+
public static compositionLoadedEvent = 'compositionLoaded';
|
|
24
|
+
public static loadFailedEvent = 'loadFailed';
|
|
25
|
+
// `declare`, not plain fields — under useDefineForClassFields (esbuild/
|
|
26
|
+
// rolldown, es2022+) plain declarations emit instance fields that shadow
|
|
27
|
+
// the Property accessors register() installs, silently breaking every
|
|
28
|
+
// property set. Upstream's tsc emit never hit this; vendored fork fix.
|
|
29
|
+
public declare stretch: CoreTypes.ImageStretchType;
|
|
30
|
+
public declare async: boolean;
|
|
31
|
+
public declare src: string;
|
|
32
|
+
public declare loop: boolean;
|
|
33
|
+
public declare autoPlay: boolean;
|
|
34
|
+
public declare progress: number;
|
|
35
|
+
public declare keyPathColors: KeyPathColors;
|
|
36
|
+
public declare completionBlock: (animationFinished: boolean) => void;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const srcProperty = new Property<LottieViewBase, string>({
|
|
40
|
+
name: 'src'
|
|
41
|
+
});
|
|
42
|
+
srcProperty.register(LottieViewBase);
|
|
43
|
+
|
|
44
|
+
export const asyncProperty = new Property<LottieViewBase, boolean>({
|
|
45
|
+
name: 'async',
|
|
46
|
+
defaultValue: false,
|
|
47
|
+
valueConverter: booleanConverter
|
|
48
|
+
});
|
|
49
|
+
asyncProperty.register(LottieViewBase);
|
|
50
|
+
export const loopProperty = new Property<LottieViewBase, boolean>({
|
|
51
|
+
name: 'loop',
|
|
52
|
+
defaultValue: false,
|
|
53
|
+
valueConverter: booleanConverter
|
|
54
|
+
});
|
|
55
|
+
loopProperty.register(LottieViewBase);
|
|
56
|
+
|
|
57
|
+
export const autoPlayProperty = new Property<LottieViewBase, boolean>({
|
|
58
|
+
name: 'autoPlay',
|
|
59
|
+
defaultValue: false,
|
|
60
|
+
valueConverter: booleanConverter
|
|
61
|
+
});
|
|
62
|
+
autoPlayProperty.register(LottieViewBase);
|
|
63
|
+
|
|
64
|
+
export const renderModeProperty = new Property<LottieViewBase, number>({
|
|
65
|
+
name: 'renderMode'
|
|
66
|
+
});
|
|
67
|
+
renderModeProperty.register(LottieViewBase);
|
|
68
|
+
|
|
69
|
+
export const progressProperty = new Property<LottieViewBase, number>({
|
|
70
|
+
name: 'progress'
|
|
71
|
+
});
|
|
72
|
+
progressProperty.register(LottieViewBase);
|
|
73
|
+
|
|
74
|
+
export const stretchProperty = new Property<LottieViewBase, CoreTypes.ImageStretchType>({
|
|
75
|
+
name: 'stretch',
|
|
76
|
+
defaultValue: 'aspectFit',
|
|
77
|
+
affectsLayout: global.isIOS
|
|
78
|
+
});
|
|
79
|
+
stretchProperty.register(LottieViewBase);
|
|
80
|
+
|
|
81
|
+
export const keyPathColorsProperty = new Property<LottieViewBase, KeyPathColors>({
|
|
82
|
+
name: 'keyPathColors'
|
|
83
|
+
});
|
|
84
|
+
keyPathColorsProperty.register(LottieViewBase);
|