@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/README.md
CHANGED
|
@@ -1,3 +1,57 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@octane-xplat/lottie`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
```sh
|
|
4
|
+
pnpm add @octane-xplat/lottie
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
Lottie animations for Octane xplat apps: `lottie-web`'s SVG renderer on web,
|
|
8
|
+
the vendored `@nativescript-community/ui-lottie` engine on iOS and Android,
|
|
9
|
+
and Airbnb Lottie 4.6.1's AppKit view on macOS. The mobile plugin is a git
|
|
10
|
+
submodule (`src/vendor/ui-lottie`) registered through `nativescript.platforms`.
|
|
11
|
+
AppKit compiles its pinned Swift source as part of the app's native leaf build;
|
|
12
|
+
apps do not add another engine dependency.
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
import { Lottie } from '@octane-xplat/lottie'
|
|
16
|
+
|
|
17
|
+
export function Preview() {
|
|
18
|
+
return (
|
|
19
|
+
<Lottie
|
|
20
|
+
src="https://example.com/anim.json"
|
|
21
|
+
autoPlay
|
|
22
|
+
loop
|
|
23
|
+
fit="contain"
|
|
24
|
+
onLoaded={(event) => console.log(event.duration)}
|
|
25
|
+
onEnded={() => console.log('Done')}
|
|
26
|
+
/>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
`data` (an inline animation object) wins over `src` when both are given.
|
|
32
|
+
Controlled `playing`/`progress`/`speed` props are optional — unset, the
|
|
33
|
+
animation is uncontrolled and the `ref` handle still drives it. Progress
|
|
34
|
+
is always normalized 0..1 and durations are milliseconds on every target
|
|
35
|
+
(the iOS plugin natively reports seconds; the leaf normalizes).
|
|
36
|
+
|
|
37
|
+
On AppKit, use inline `data`, raw JSON in `src`, an absolute JSON file path,
|
|
38
|
+
or a `file://` or HTTPS URL. Relative paths, `~/`/`res://` bundle aliases,
|
|
39
|
+
HTTP URLs, `.lottie`/`.zip` archives, and external image assets are not
|
|
40
|
+
supported. See [the platform limits](../../docs/app/primitives.md#lottie-animations)
|
|
41
|
+
and [the investigation record](../../docs/notes/lottie-appkit-investigation.md)
|
|
42
|
+
for the complete boundary and runtime evidence.
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
import { Lottie } from '@octane-xplat/lottie'
|
|
46
|
+
|
|
47
|
+
export function InlineAnimation({ animation }: { animation: object }) {
|
|
48
|
+
return <Lottie data={animation} autoPlay loop={false} fit="contain" />
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Per-target limits — including the expression/CSP boundary on web — are
|
|
53
|
+
recorded in [known limits](../../docs/verify/known-limits.md). Exercised by
|
|
54
|
+
[`LottieDemo`](../demos/src/LottieDemo.tsrx).
|
|
55
|
+
|
|
56
|
+
This is a git submodule checkout: after cloning run
|
|
57
|
+
`git submodule update --init` before building the workspace.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/cx.mobile.ts
|
|
2
|
+
/** NS `className` splits on ' ' only, and the universal driver applies the
|
|
3
|
+
* prop via `String(value)` — an array would arrive comma-joined and match
|
|
4
|
+
* no class at all. Native leaves normalize through cx() before handing
|
|
5
|
+
* className to an intrinsic. (The DOM renderer already flattens arrays,
|
|
6
|
+
* so web leaves don't need this.) */
|
|
7
|
+
function cx(...parts) {
|
|
8
|
+
return parts.flat(Infinity).filter(Boolean).join(" ");
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { cx };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { isAndroid, isIOS } from "@nativescript/core";
|
|
2
|
+
//#region src/escape-props.ts
|
|
3
|
+
/** Apply only the active device's escape bag after the primitive's own props. */
|
|
4
|
+
function applyEscapeProps(view, props) {
|
|
5
|
+
if (!view) return;
|
|
6
|
+
const bag = isIOS ? props.ios : isAndroid ? props.android : void 0;
|
|
7
|
+
if (bag) Object.assign(view, bag);
|
|
8
|
+
}
|
|
9
|
+
var NATIVE_ACCESSIBILITY_ROLES = {
|
|
10
|
+
button: "button",
|
|
11
|
+
link: "link",
|
|
12
|
+
search: "search",
|
|
13
|
+
image: "image",
|
|
14
|
+
heading: "header",
|
|
15
|
+
adjustable: "adjustable",
|
|
16
|
+
summary: "summary",
|
|
17
|
+
text: "text",
|
|
18
|
+
none: "none",
|
|
19
|
+
progressbar: "progressBar",
|
|
20
|
+
checkbox: "checkbox",
|
|
21
|
+
switch: "switch",
|
|
22
|
+
radio: "radioButton",
|
|
23
|
+
spinbutton: "spinButton",
|
|
24
|
+
tab: "button"
|
|
25
|
+
};
|
|
26
|
+
/** Translate the shared/ARIA spelling to NativeScript's narrower role enum. */
|
|
27
|
+
function nativeAccessibilityRole(role) {
|
|
28
|
+
return role ? NATIVE_ACCESSIBILITY_ROLES[role] : void 0;
|
|
29
|
+
}
|
|
30
|
+
/** NativeScript's AccessibilityState is a single enum value, unlike the
|
|
31
|
+
* web's independent ARIA booleans. Priority follows the strongest state. */
|
|
32
|
+
function nativeAccessibilityState(state) {
|
|
33
|
+
if (state?.disabled) return "disabled";
|
|
34
|
+
if (state?.selected) return "selected";
|
|
35
|
+
if (state?.checked === true) return "checked";
|
|
36
|
+
if (state?.checked === false) return "unchecked";
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { applyEscapeProps, nativeAccessibilityRole, nativeAccessibilityState };
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { cx } from "./cx.mobile.js";
|
|
2
|
+
import { applyEscapeProps, nativeAccessibilityRole, nativeAccessibilityState } from "./escape-props.js";
|
|
3
|
+
import { layoutChildProps } from "./layout-child.js";
|
|
4
|
+
import { defineUniversalComponent, hookSlots, registerElement, universalPlan, universalProps, universalValue, useCallback, useEffect, useImperativeHandle, useRef } from "@nativescript-community/octane";
|
|
5
|
+
import { isAndroid } from "@nativescript/core";
|
|
6
|
+
import { LottieView } from "./vendor/ui-lottie";
|
|
7
|
+
//#region src/Lottie.tsrx
|
|
8
|
+
var _hs$ = /* @__PURE__ */ hookSlots(10);
|
|
9
|
+
var _h$0 = /* @__PURE__ */ Symbol(_hs$);
|
|
10
|
+
var _h$1 = /* @__PURE__ */ Symbol(_hs$ + 1);
|
|
11
|
+
var _h$2 = /* @__PURE__ */ Symbol(_hs$ + 2);
|
|
12
|
+
var _h$3 = /* @__PURE__ */ Symbol(_hs$ + 3);
|
|
13
|
+
var _h$4 = /* @__PURE__ */ Symbol(_hs$ + 4);
|
|
14
|
+
var _h$5 = /* @__PURE__ */ Symbol(_hs$ + 5);
|
|
15
|
+
var _h$6 = /* @__PURE__ */ Symbol(_hs$ + 6);
|
|
16
|
+
var _h$7 = /* @__PURE__ */ Symbol(_hs$ + 7);
|
|
17
|
+
var _h$8 = /* @__PURE__ */ Symbol(_hs$ + 8);
|
|
18
|
+
var _h$9 = /* @__PURE__ */ Symbol(_hs$ + 9);
|
|
19
|
+
var __octaneUniversalPlan0 = universalPlan("nativescript", {
|
|
20
|
+
"kind": "host",
|
|
21
|
+
"type": "xplatlottie",
|
|
22
|
+
"propsSlot": 0
|
|
23
|
+
});
|
|
24
|
+
registerElement("xplatlottie", LottieView);
|
|
25
|
+
var clamp01 = (n) => Math.min(1, Math.max(0, n));
|
|
26
|
+
var STRETCH = {
|
|
27
|
+
contain: "aspectFit",
|
|
28
|
+
cover: "aspectFill",
|
|
29
|
+
fill: "fill"
|
|
30
|
+
};
|
|
31
|
+
function durationMs(v) {
|
|
32
|
+
const d = v.duration ?? 0;
|
|
33
|
+
return isAndroid ? d : Math.max(0, d) * 1e3;
|
|
34
|
+
}
|
|
35
|
+
function currentProgress(v) {
|
|
36
|
+
const nv = v.nativeViewProtected;
|
|
37
|
+
return isAndroid ? nv?.getProgress?.() ?? 0 : nv?.currentProgress ?? 0;
|
|
38
|
+
}
|
|
39
|
+
function stopView(v) {
|
|
40
|
+
if (isAndroid) v.cancelAnimation();
|
|
41
|
+
else v.nativeViewProtected?.stop();
|
|
42
|
+
v.progress = 0;
|
|
43
|
+
}
|
|
44
|
+
var Lottie = defineUniversalComponent("nativescript", function Lottie(props) {
|
|
45
|
+
const host = useRef(null, _h$0);
|
|
46
|
+
const appliedSrc = useRef(void 0, _h$1);
|
|
47
|
+
const loadedRef = useRef(false, _h$2);
|
|
48
|
+
useImperativeHandle(props.ref, () => handle(host.current), [], _h$3);
|
|
49
|
+
const bindHost = useCallback((v) => {
|
|
50
|
+
host.current = v;
|
|
51
|
+
}, [], _h$4);
|
|
52
|
+
const wantPlay = () => props.playing ?? props.autoPlay ?? true;
|
|
53
|
+
const onReady = () => {
|
|
54
|
+
const v = host.current;
|
|
55
|
+
if (!v || loadedRef.current) return;
|
|
56
|
+
loadedRef.current = true;
|
|
57
|
+
if (props.speed !== void 0) v.speed = props.speed;
|
|
58
|
+
if (props.progress !== void 0) v.progress = clamp01(props.progress);
|
|
59
|
+
props.onLoaded?.({ duration: durationMs(v) });
|
|
60
|
+
if (wantPlay() && !v.isAnimating()) v.playAnimation();
|
|
61
|
+
};
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
const v = host.current;
|
|
64
|
+
if (!v) return;
|
|
65
|
+
applyEscapeProps(v, props);
|
|
66
|
+
v.stretch = STRETCH[props.fit ?? "contain"];
|
|
67
|
+
v.async = true;
|
|
68
|
+
v.on(LottieView.compositionLoadedEvent, () => onReady());
|
|
69
|
+
v.on(LottieView.loadFailedEvent, (e) => {
|
|
70
|
+
loadedRef.current = false;
|
|
71
|
+
props.onError?.({ message: e?.error ? String(e.error) : "load failed" });
|
|
72
|
+
});
|
|
73
|
+
v.completionBlock = (finished) => {
|
|
74
|
+
if (finished) props.onEnded?.();
|
|
75
|
+
};
|
|
76
|
+
}, [], _h$5);
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
const v = host.current;
|
|
79
|
+
if (!v) return;
|
|
80
|
+
const src = props.data ? JSON.stringify(props.data) : props.src;
|
|
81
|
+
if (src === appliedSrc.current) return;
|
|
82
|
+
appliedSrc.current = src;
|
|
83
|
+
loadedRef.current = false;
|
|
84
|
+
v.src = src ?? "";
|
|
85
|
+
}, [props.src, props.data], _h$6);
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
const v = host.current;
|
|
88
|
+
if (!v || props.playing === void 0) return;
|
|
89
|
+
if (props.playing) {
|
|
90
|
+
if (loadedRef.current) v.resumeAnimation();
|
|
91
|
+
} else v.pauseAnimation();
|
|
92
|
+
}, [props.playing], _h$7);
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
const v = host.current;
|
|
95
|
+
if (!v || props.progress === void 0 || !loadedRef.current) return;
|
|
96
|
+
v.progress = clamp01(props.progress);
|
|
97
|
+
}, [props.progress], _h$8);
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
const v = host.current;
|
|
100
|
+
if (!v || props.speed === void 0 || !loadedRef.current) return;
|
|
101
|
+
v.speed = props.speed;
|
|
102
|
+
}, [props.speed], _h$9);
|
|
103
|
+
const handle = (v) => ({
|
|
104
|
+
play: () => v.resumeAnimation(),
|
|
105
|
+
pause: () => v.pauseAnimation(),
|
|
106
|
+
stop: () => stopView(v),
|
|
107
|
+
seekTo: (p) => {
|
|
108
|
+
v.progress = clamp01(p);
|
|
109
|
+
},
|
|
110
|
+
setSpeed: (n) => {
|
|
111
|
+
v.speed = n;
|
|
112
|
+
},
|
|
113
|
+
progress: () => currentProgress(v),
|
|
114
|
+
duration: () => durationMs(v),
|
|
115
|
+
isPlaying: () => v.isAnimating(),
|
|
116
|
+
native: v
|
|
117
|
+
});
|
|
118
|
+
return universalValue(__octaneUniversalPlan0, [universalProps([
|
|
119
|
+
[
|
|
120
|
+
"set",
|
|
121
|
+
"ref",
|
|
122
|
+
bindHost
|
|
123
|
+
],
|
|
124
|
+
[
|
|
125
|
+
"set",
|
|
126
|
+
"id",
|
|
127
|
+
props.id
|
|
128
|
+
],
|
|
129
|
+
[
|
|
130
|
+
"set",
|
|
131
|
+
"className",
|
|
132
|
+
cx(props.className)
|
|
133
|
+
],
|
|
134
|
+
[
|
|
135
|
+
"set",
|
|
136
|
+
"style",
|
|
137
|
+
props.style
|
|
138
|
+
],
|
|
139
|
+
["spread", layoutChildProps(props)],
|
|
140
|
+
[
|
|
141
|
+
"set",
|
|
142
|
+
"loop",
|
|
143
|
+
props.loop ?? false
|
|
144
|
+
],
|
|
145
|
+
[
|
|
146
|
+
"set",
|
|
147
|
+
"accessible",
|
|
148
|
+
props.accessible
|
|
149
|
+
],
|
|
150
|
+
[
|
|
151
|
+
"set",
|
|
152
|
+
"accessibilityLabel",
|
|
153
|
+
props.accessibilityLabel
|
|
154
|
+
],
|
|
155
|
+
[
|
|
156
|
+
"set",
|
|
157
|
+
"accessibilityRole",
|
|
158
|
+
nativeAccessibilityRole(props.accessibilityRole)
|
|
159
|
+
],
|
|
160
|
+
[
|
|
161
|
+
"set",
|
|
162
|
+
"accessibilityHint",
|
|
163
|
+
props.accessibilityHint
|
|
164
|
+
],
|
|
165
|
+
[
|
|
166
|
+
"set",
|
|
167
|
+
"accessibilityValue",
|
|
168
|
+
props.accessibilityValue
|
|
169
|
+
],
|
|
170
|
+
[
|
|
171
|
+
"set",
|
|
172
|
+
"accessibilityState",
|
|
173
|
+
nativeAccessibilityState(props.accessibilityState)
|
|
174
|
+
],
|
|
175
|
+
[
|
|
176
|
+
"set",
|
|
177
|
+
"accessibilityLiveRegion",
|
|
178
|
+
props.accessibilityLiveRegion
|
|
179
|
+
]
|
|
180
|
+
])]);
|
|
181
|
+
}, { "module": "@nativescript-community/octane" });
|
|
182
|
+
//#endregion
|
|
183
|
+
export { Lottie };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//#region src/layout-child.ts
|
|
2
|
+
var FLEX_JUSTIFY = {
|
|
3
|
+
start: "flex-start",
|
|
4
|
+
end: "flex-end"
|
|
5
|
+
};
|
|
6
|
+
var FLEX_ALIGN = {
|
|
7
|
+
start: "flex-start",
|
|
8
|
+
end: "flex-end"
|
|
9
|
+
};
|
|
10
|
+
/** NativeScript reads these attributes from each child view during parent
|
|
11
|
+
* layout. Values are forwarded with NativeScript's own property names.
|
|
12
|
+
* The flex-container props (justifyContent/alignItems/flexWrap/gap) land on
|
|
13
|
+
* the host flexboxlayout itself — its own attributes, not child metadata. */
|
|
14
|
+
function layoutChildProps(props) {
|
|
15
|
+
const result = {};
|
|
16
|
+
for (const key of [
|
|
17
|
+
"row",
|
|
18
|
+
"col",
|
|
19
|
+
"rowSpan",
|
|
20
|
+
"colSpan",
|
|
21
|
+
"dock",
|
|
22
|
+
"left",
|
|
23
|
+
"top",
|
|
24
|
+
"flexGrow",
|
|
25
|
+
"flexShrink",
|
|
26
|
+
"alignSelf",
|
|
27
|
+
"order"
|
|
28
|
+
]) if (props[key] !== void 0) result[key] = props[key];
|
|
29
|
+
if (props.justifyContent !== void 0) result.justifyContent = FLEX_JUSTIFY[props.justifyContent] ?? props.justifyContent;
|
|
30
|
+
if (props.alignItems !== void 0) result.alignItems = FLEX_ALIGN[props.alignItems] ?? props.alignItems;
|
|
31
|
+
if (props.flexWrap !== void 0) result.flexWrap = props.flexWrap === true ? "wrap" : props.flexWrap === false ? "nowrap" : props.flexWrap;
|
|
32
|
+
if (props.gap !== void 0) result.gap = props.gap;
|
|
33
|
+
if (props.rowGap !== void 0) result.rowGap = props.rowGap;
|
|
34
|
+
if (props.columnGap !== void 0) result.columnGap = props.columnGap;
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { layoutChildProps };
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { LottieViewBase, autoPlayProperty, keyPathColorsProperty, loopProperty, progressProperty, renderModeProperty, srcProperty, stretchProperty } from "./src/lottie/index.common.js";
|
|
2
|
+
import { clamp } from "./src/lottie/utils.js";
|
|
3
|
+
import { Color, File, Http, Utils, knownFolders, path } from "@nativescript/core";
|
|
4
|
+
//#region src/vendor/ui-lottie/src/lottie/index.android.ts
|
|
5
|
+
/**********************************************************************************
|
|
6
|
+
* (c) 2017, Brad Martin.
|
|
7
|
+
* Licensed under the MIT license.
|
|
8
|
+
*
|
|
9
|
+
* Version 1.0.0 bradwaynemartin@gmail.com
|
|
10
|
+
**********************************************************************************/
|
|
11
|
+
var LottieProperty;
|
|
12
|
+
var LottieKeyPath;
|
|
13
|
+
var LottieValueCallback;
|
|
14
|
+
var LottieCompositionFactory;
|
|
15
|
+
var cache = /* @__PURE__ */ new Map();
|
|
16
|
+
async function loadLottieJSON(iconSrc) {
|
|
17
|
+
if (!cache.has(iconSrc)) {
|
|
18
|
+
const r = await File.fromPath(iconSrc).readText();
|
|
19
|
+
cache.set(iconSrc, r);
|
|
20
|
+
return r;
|
|
21
|
+
}
|
|
22
|
+
return cache.get(iconSrc);
|
|
23
|
+
}
|
|
24
|
+
function loadLottieJSONSync(iconSrc) {
|
|
25
|
+
if (!cache.has(iconSrc)) {
|
|
26
|
+
const r = File.fromPath(iconSrc).readTextSync();
|
|
27
|
+
cache.set(iconSrc, r);
|
|
28
|
+
return r;
|
|
29
|
+
}
|
|
30
|
+
return cache.get(iconSrc);
|
|
31
|
+
}
|
|
32
|
+
var RenderMode = {
|
|
33
|
+
get AUTOMATIC() {
|
|
34
|
+
return com.airbnb.lottie.RenderMode.AUTOMATIC;
|
|
35
|
+
},
|
|
36
|
+
get HARDWARE() {
|
|
37
|
+
return com.airbnb.lottie.RenderMode.HARDWARE;
|
|
38
|
+
},
|
|
39
|
+
get SOFTWARE() {
|
|
40
|
+
return com.airbnb.lottie.RenderMode.SOFTWARE;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var LottieView = class extends LottieViewBase {
|
|
44
|
+
constructor(..._args) {
|
|
45
|
+
super(..._args);
|
|
46
|
+
this._cancelled = false;
|
|
47
|
+
}
|
|
48
|
+
createNativeView() {
|
|
49
|
+
return new com.nativescript.lottie.LottieAnimationView(this._context);
|
|
50
|
+
}
|
|
51
|
+
get completionBlock() {
|
|
52
|
+
return this._completionBlock;
|
|
53
|
+
}
|
|
54
|
+
set completionBlock(block) {
|
|
55
|
+
this._completionBlock = block;
|
|
56
|
+
if (block) {
|
|
57
|
+
if (!this.animatorListener) {
|
|
58
|
+
const that = new WeakRef(this);
|
|
59
|
+
this.animatorListener = new android.animation.Animator.AnimatorListener({
|
|
60
|
+
onAnimationCancel: (_animator) => {
|
|
61
|
+
const owner = that?.get();
|
|
62
|
+
if (owner) owner._cancelled = true;
|
|
63
|
+
},
|
|
64
|
+
onAnimationEnd: (_animator) => {
|
|
65
|
+
const owner = that?.get();
|
|
66
|
+
if (owner?._completionBlock) owner._completionBlock(!owner._cancelled);
|
|
67
|
+
if (owner) owner._cancelled = false;
|
|
68
|
+
},
|
|
69
|
+
onAnimationRepeat: (_animator) => {},
|
|
70
|
+
onAnimationStart: (_animator) => {}
|
|
71
|
+
});
|
|
72
|
+
if (this.nativeViewProtected) this.nativeViewProtected.addAnimatorListener(this.animatorListener);
|
|
73
|
+
}
|
|
74
|
+
} else if (this.animatorListener) {
|
|
75
|
+
if (this.nativeViewProtected) this.nativeViewProtected.removeAnimatorListener(this.animatorListener);
|
|
76
|
+
this.animatorListener = null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
initNativeView() {
|
|
80
|
+
if (this.animatorListener) this.nativeViewProtected.addAnimatorListener(this.animatorListener);
|
|
81
|
+
if (!this.loadedListener) {
|
|
82
|
+
const that = new WeakRef(this);
|
|
83
|
+
this.loadedListener = new com.airbnb.lottie.LottieOnCompositionLoadedListener({ onCompositionLoaded: (composition) => {
|
|
84
|
+
const owner = that?.get();
|
|
85
|
+
if (owner) setTimeout(() => {
|
|
86
|
+
owner.notify({
|
|
87
|
+
eventName: LottieViewBase.compositionLoadedEvent,
|
|
88
|
+
composition
|
|
89
|
+
});
|
|
90
|
+
if (owner.autoPlay && !owner.isAnimating()) owner.playAnimation();
|
|
91
|
+
}, 0);
|
|
92
|
+
} });
|
|
93
|
+
}
|
|
94
|
+
this.nativeViewProtected.addLottieOnCompositionLoadedListener(this.loadedListener);
|
|
95
|
+
const that = new WeakRef(this);
|
|
96
|
+
this.nativeViewProtected.setFailureListener(new com.airbnb.lottie.LottieListener({ onResult: (result) => {
|
|
97
|
+
const owner = that?.get();
|
|
98
|
+
if (owner) owner.notify({
|
|
99
|
+
eventName: LottieViewBase.loadFailedEvent,
|
|
100
|
+
error: result
|
|
101
|
+
});
|
|
102
|
+
} }));
|
|
103
|
+
}
|
|
104
|
+
disposeNativeView() {
|
|
105
|
+
if (this.animatorListener) this.nativeViewProtected.removeAnimatorListener(this.animatorListener);
|
|
106
|
+
if (this.loadedListener) this.nativeViewProtected.removeLottieOnCompositionLoadedListener(this.loadedListener);
|
|
107
|
+
super.disposeNativeView();
|
|
108
|
+
}
|
|
109
|
+
setColor(value, keyPath) {
|
|
110
|
+
const nativeView = this.nativeViewProtected;
|
|
111
|
+
if (nativeView && value && keyPath && keyPath.length) {
|
|
112
|
+
if (keyPath[keyPath.length - 1].toLowerCase() === "color") {
|
|
113
|
+
keyPath = [...keyPath];
|
|
114
|
+
keyPath.pop();
|
|
115
|
+
if (keyPath.length === 0) return;
|
|
116
|
+
}
|
|
117
|
+
const nativeKeyPath = Array.create(java.lang.String, keyPath.length);
|
|
118
|
+
for (let index = 0; index < keyPath.length; index++) nativeKeyPath[index] = keyPath[index];
|
|
119
|
+
if (!LottieProperty) LottieProperty = com.airbnb.lottie.LottieProperty;
|
|
120
|
+
if (!LottieValueCallback) LottieValueCallback = com.airbnb.lottie.value.LottieValueCallback;
|
|
121
|
+
if (!LottieKeyPath) LottieKeyPath = com.airbnb.lottie.model.KeyPath;
|
|
122
|
+
const color = value instanceof Color ? value : new Color(value);
|
|
123
|
+
const colorFilter = new com.airbnb.lottie.SimpleColorFilter(color.android);
|
|
124
|
+
nativeView.addValueCallback(new LottieKeyPath(nativeKeyPath), LottieProperty.COLOR_FILTER, new LottieValueCallback(colorFilter));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
setOpacity(value, keyPath) {
|
|
128
|
+
if (this.nativeViewProtected && value != null && keyPath && keyPath.length) {
|
|
129
|
+
if (keyPath[keyPath.length - 1].toLowerCase() === "opacity") {
|
|
130
|
+
keyPath = [...keyPath];
|
|
131
|
+
keyPath.pop();
|
|
132
|
+
if (keyPath.length === 0) return;
|
|
133
|
+
}
|
|
134
|
+
const nativeKeyPath = Array.create(java.lang.String, keyPath.length);
|
|
135
|
+
keyPath.forEach((key, index) => {
|
|
136
|
+
nativeKeyPath[index] = new java.lang.String(key);
|
|
137
|
+
});
|
|
138
|
+
value = clamp(value);
|
|
139
|
+
if (!LottieProperty) LottieProperty = com.airbnb.lottie.LottieProperty;
|
|
140
|
+
if (!LottieValueCallback) LottieValueCallback = com.airbnb.lottie.value.LottieValueCallback;
|
|
141
|
+
if (!LottieKeyPath) LottieKeyPath = com.airbnb.lottie.model.KeyPath;
|
|
142
|
+
this.nativeViewProtected.addValueCallback(new LottieKeyPath(nativeKeyPath), LottieProperty.OPACITY, new LottieValueCallback(new java.lang.Integer(value * 255)));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
playAnimation() {
|
|
146
|
+
if (this.nativeViewProtected) {
|
|
147
|
+
this.nativeViewProtected.setMinAndMaxProgress(0, 1);
|
|
148
|
+
this.nativeViewProtected.playAnimation();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
playAnimationFromProgressToProgress(startProgress, endProgress) {
|
|
152
|
+
if (this.nativeViewProtected) {
|
|
153
|
+
startProgress = startProgress ? clamp(startProgress) : 0;
|
|
154
|
+
endProgress = endProgress ? clamp(endProgress) : 1;
|
|
155
|
+
this.nativeViewProtected.setMinAndMaxProgress(startProgress, endProgress);
|
|
156
|
+
this.nativeViewProtected.playAnimation();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
isAnimating() {
|
|
160
|
+
return this.nativeViewProtected ? this.nativeViewProtected.isAnimating() : false;
|
|
161
|
+
}
|
|
162
|
+
get speed() {
|
|
163
|
+
return this.nativeViewProtected ? this.nativeViewProtected.getSpeed() : void 0;
|
|
164
|
+
}
|
|
165
|
+
set speed(value) {
|
|
166
|
+
if (this.nativeViewProtected && value) this.nativeViewProtected.setSpeed(value);
|
|
167
|
+
}
|
|
168
|
+
get duration() {
|
|
169
|
+
return this.nativeViewProtected ? this.nativeViewProtected.getDuration() : void 0;
|
|
170
|
+
}
|
|
171
|
+
cancelAnimation() {
|
|
172
|
+
if (this.nativeViewProtected) this.nativeViewProtected.cancelAnimation();
|
|
173
|
+
}
|
|
174
|
+
pauseAnimation() {
|
|
175
|
+
if (this.nativeViewProtected) this.nativeViewProtected.pauseAnimation();
|
|
176
|
+
}
|
|
177
|
+
resumeAnimation() {
|
|
178
|
+
if (this.nativeViewProtected) this.nativeViewProtected.resumeAnimation();
|
|
179
|
+
}
|
|
180
|
+
[srcProperty.setNative](src) {
|
|
181
|
+
try {
|
|
182
|
+
if (!LottieCompositionFactory) LottieCompositionFactory = com.airbnb.lottie.LottieCompositionFactory;
|
|
183
|
+
const view = this.nativeViewProtected;
|
|
184
|
+
let result;
|
|
185
|
+
if (!src) {} else if (src[0] === "{") {
|
|
186
|
+
if (this.async) view.setAnimationFromJson(src, null);
|
|
187
|
+
else result = LottieCompositionFactory.fromJsonStringSync(src, null);
|
|
188
|
+
} else if (/^https?:/i.test(src)) {
|
|
189
|
+
const match = /\.(zip|lottie|json)(?=[?#]|$)/i.exec(src);
|
|
190
|
+
const dest = path.join(knownFolders.temp().path, `lottie-${Date.now()}${match ? match[0].toLowerCase() : ".json"}`);
|
|
191
|
+
Http.getFile(src, dest).then(() => {
|
|
192
|
+
this.src = dest;
|
|
193
|
+
}).catch((error) => {
|
|
194
|
+
console.error(error);
|
|
195
|
+
this.notify({
|
|
196
|
+
eventName: "loadFailed",
|
|
197
|
+
error
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
} else if (src.startsWith(Utils.RESOURCE_PREFIX)) {
|
|
201
|
+
const resName = src.replace(Utils.RESOURCE_PREFIX, "");
|
|
202
|
+
if (this.async) view.setAnimation(resName);
|
|
203
|
+
else result = com.airbnb.lottie.LottieCompositionFactory.fromAssetSync(this._context, resName);
|
|
204
|
+
} else {
|
|
205
|
+
if (!/.(json|zip|lottie)$/.test(src)) src += ".json";
|
|
206
|
+
if (src[0] === "~") {
|
|
207
|
+
if (this.async) view.setAnimation("app/" + src.substring(2));
|
|
208
|
+
else result = com.airbnb.lottie.LottieCompositionFactory.fromAssetSync(this._context, "app/" + src.substring(2));
|
|
209
|
+
} else if (!src.startsWith("file:/") && src[0] !== "/") {
|
|
210
|
+
if (this.async) view.setAnimation("app/" + src);
|
|
211
|
+
else result = com.airbnb.lottie.LottieCompositionFactory.fromAssetSync(this._context, src);
|
|
212
|
+
} else {
|
|
213
|
+
const filePath = src.startsWith("file:") ? src.substring(5) : src;
|
|
214
|
+
if (/\.(zip|lottie)$/i.test(filePath)) {
|
|
215
|
+
const stream = new java.util.zip.ZipInputStream(new java.io.FileInputStream(filePath));
|
|
216
|
+
if (this.async) {
|
|
217
|
+
const owner = new WeakRef(this);
|
|
218
|
+
com.airbnb.lottie.LottieCompositionFactory.fromZipStream(stream, null).addListener(new com.airbnb.lottie.LottieListener({ onResult: (composition) => {
|
|
219
|
+
const view = owner.get()?.nativeViewProtected;
|
|
220
|
+
if (view) view.setComposition(composition);
|
|
221
|
+
} })).addFailureListener(new com.airbnb.lottie.LottieListener({ onResult: (error) => console.error(error) }));
|
|
222
|
+
} else result = com.airbnb.lottie.LottieCompositionFactory.fromZipStreamSync(stream, null);
|
|
223
|
+
} else if (this.async) loadLottieJSON(src).then((result) => {
|
|
224
|
+
if (this.nativeViewProtected) this.nativeViewProtected.setAnimationFromJson(result, null);
|
|
225
|
+
});
|
|
226
|
+
else result = LottieCompositionFactory.fromJsonStringSync(loadLottieJSONSync(src), null);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
if (result) {
|
|
230
|
+
if (result.getException()) {
|
|
231
|
+
console.error(result.getException());
|
|
232
|
+
this.notify({
|
|
233
|
+
eventName: LottieViewBase.loadFailedEvent,
|
|
234
|
+
error: result.getException()
|
|
235
|
+
});
|
|
236
|
+
} else view.setComposition(result.getValue());
|
|
237
|
+
}
|
|
238
|
+
if (this.autoPlay) this.playAnimation();
|
|
239
|
+
} catch (error) {
|
|
240
|
+
console.error(error);
|
|
241
|
+
this.notify({
|
|
242
|
+
eventName: LottieViewBase.loadFailedEvent,
|
|
243
|
+
error
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
[loopProperty.setNative](loop) {
|
|
248
|
+
this.nativeViewProtected.setRepeatCount(loop ? -1 : 0);
|
|
249
|
+
}
|
|
250
|
+
[progressProperty.setNative](value) {
|
|
251
|
+
this.nativeViewProtected.setProgress(value);
|
|
252
|
+
}
|
|
253
|
+
[renderModeProperty.setNative](renderMode) {
|
|
254
|
+
this.nativeViewProtected.setRenderMode(renderMode);
|
|
255
|
+
}
|
|
256
|
+
[keyPathColorsProperty.setNative](value) {
|
|
257
|
+
Object.keys(value).forEach((k) => this.setColor(value[k], k.split("|")));
|
|
258
|
+
}
|
|
259
|
+
[autoPlayProperty.setNative](autoPlay) {
|
|
260
|
+
if (autoPlay) {
|
|
261
|
+
if (!this.isAnimating()) this.playAnimation();
|
|
262
|
+
} else {
|
|
263
|
+
this.cancelAnimation();
|
|
264
|
+
if (this.progress) this.nativeViewProtected.setProgress(this.progress);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
[stretchProperty.getDefault]() {
|
|
268
|
+
return "aspectFit";
|
|
269
|
+
}
|
|
270
|
+
[stretchProperty.setNative](value) {
|
|
271
|
+
switch (value) {
|
|
272
|
+
case "aspectFit":
|
|
273
|
+
this.nativeViewProtected.setScaleType(android.widget.ImageView.ScaleType.FIT_CENTER);
|
|
274
|
+
break;
|
|
275
|
+
case "aspectFill":
|
|
276
|
+
this.nativeViewProtected.setScaleType(android.widget.ImageView.ScaleType.CENTER_CROP);
|
|
277
|
+
break;
|
|
278
|
+
case "fill":
|
|
279
|
+
this.nativeViewProtected.setScaleType(android.widget.ImageView.ScaleType.FIT_XY);
|
|
280
|
+
break;
|
|
281
|
+
default: this.nativeViewProtected.setScaleType(android.widget.ImageView.ScaleType.MATRIX);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
//#endregion
|
|
286
|
+
export { LottieView, RenderMode };
|