@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
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
// Created by Cal Stephens on 2/9/22.
|
|
2
|
+
// Copyright © 2022 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
import QuartzCore
|
|
5
|
+
|
|
6
|
+
/// The `CALayer` type responsible for rendering `TextLayer`s
|
|
7
|
+
final class TextLayer: BaseCompositionLayer {
|
|
8
|
+
|
|
9
|
+
// MARK: Lifecycle
|
|
10
|
+
|
|
11
|
+
init(
|
|
12
|
+
textLayerModel: TextLayerModel,
|
|
13
|
+
context: LayerContext
|
|
14
|
+
) throws {
|
|
15
|
+
self.textLayerModel = textLayerModel
|
|
16
|
+
super.init(layerModel: textLayerModel)
|
|
17
|
+
setupSublayers()
|
|
18
|
+
try configureRenderLayer(with: context)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
required init?(coder _: NSCoder) {
|
|
22
|
+
fatalError("init(coder:) has not been implemented")
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/// Called by CoreAnimation to create a shadow copy of this layer
|
|
26
|
+
/// More details: https://developer.apple.com/documentation/quartzcore/calayer/1410842-init
|
|
27
|
+
override init(layer: Any) {
|
|
28
|
+
guard let typedLayer = layer as? Self else {
|
|
29
|
+
fatalError("\(Self.self).init(layer:) incorrectly called with \(type(of: layer))")
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
textLayerModel = typedLayer.textLayerModel
|
|
33
|
+
super.init(layer: typedLayer)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// MARK: Internal
|
|
37
|
+
|
|
38
|
+
override func setupAnimations(context: LayerAnimationContext) throws {
|
|
39
|
+
try super.setupAnimations(context: context)
|
|
40
|
+
let textAnimationContext = context.addingKeypathComponent(textLayerModel.name)
|
|
41
|
+
|
|
42
|
+
let sourceText = try textLayerModel.text.exactlyOneKeyframe(
|
|
43
|
+
context: textAnimationContext,
|
|
44
|
+
description: "text layer text"
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
// Prior to Lottie 4.3.0 the Core Animation rendering engine always just used `LegacyAnimationTextProvider`
|
|
48
|
+
// but incorrectly called it with the full keypath string, unlike the Main Thread rendering engine
|
|
49
|
+
// which only used the last component of the keypath. Starting in Lottie 4.3.0 we use `AnimationKeypathTextProvider`
|
|
50
|
+
// instead if implemented.
|
|
51
|
+
if let keypathTextValue = context.textProvider.text(for: textAnimationContext.currentKeypath, sourceText: sourceText.text) {
|
|
52
|
+
renderLayer.text = keypathTextValue
|
|
53
|
+
} else if let legacyTextProvider = context.textProvider as? LegacyAnimationTextProvider {
|
|
54
|
+
renderLayer.text = legacyTextProvider.textFor(
|
|
55
|
+
keypathName: textAnimationContext.currentKeypath.fullPath,
|
|
56
|
+
sourceText: sourceText.text
|
|
57
|
+
)
|
|
58
|
+
} else {
|
|
59
|
+
renderLayer.text = sourceText.text
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Apply the custom contents scale for this layer if it was provided
|
|
63
|
+
if
|
|
64
|
+
let contentsScaleProvider = context.textProvider as? TextContentsScaleProvider,
|
|
65
|
+
let contentsScale = contentsScaleProvider.contentsScale(for: textAnimationContext.currentKeypath)
|
|
66
|
+
{
|
|
67
|
+
renderLayer.contentsScale = contentsScale
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
renderLayer.sizeToFit()
|
|
71
|
+
|
|
72
|
+
// Check if there are any dynamic color overrides for this text layer.
|
|
73
|
+
// NOTE: The Core Animation engine currently only supports static color overrides for text.
|
|
74
|
+
// Animated ValueProviders will only have their first keyframe applied.
|
|
75
|
+
if
|
|
76
|
+
let customFillColor = try textAnimationContext.valueProviderStore.customKeyframes(
|
|
77
|
+
of: .color,
|
|
78
|
+
for: textAnimationContext
|
|
79
|
+
.currentKeypath
|
|
80
|
+
.appendingKey(PropertyName.color.rawValue),
|
|
81
|
+
context: textAnimationContext
|
|
82
|
+
)
|
|
83
|
+
{
|
|
84
|
+
if customFillColor.keyframes.count > 1 {
|
|
85
|
+
try textAnimationContext.logCompatibilityIssue("""
|
|
86
|
+
The Core Animation rendering engine currently doesn't support animated text color overrides.
|
|
87
|
+
""")
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
renderLayer.fillColor = customFillColor.keyframes[0].value
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if
|
|
94
|
+
let customStrokeColor = try textAnimationContext.valueProviderStore.customKeyframes(
|
|
95
|
+
of: .color,
|
|
96
|
+
for: textAnimationContext
|
|
97
|
+
.currentKeypath
|
|
98
|
+
.appendingKey(PropertyName.strokeColor.rawValue),
|
|
99
|
+
context: textAnimationContext
|
|
100
|
+
)
|
|
101
|
+
{
|
|
102
|
+
renderLayer.strokeColor = customStrokeColor.keyframes[0].value
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
func configureRenderLayer(with context: LayerContext) throws {
|
|
107
|
+
// We can't use `CATextLayer`, because it doesn't support enough features we use.
|
|
108
|
+
// Instead, we use the same `CoreTextRenderLayer` (with a custom `draw` implementation)
|
|
109
|
+
// used by the Main Thread rendering engine. This means the Core Animation engine can't
|
|
110
|
+
// _animate_ text properties, but it can display static text without any issues.
|
|
111
|
+
let text = try textLayerModel.text.exactlyOneKeyframe(context: context, description: "text layer text")
|
|
112
|
+
|
|
113
|
+
// The Core Animation engine doesn't currently support `TextAnimator`s.
|
|
114
|
+
// - We could add support for animating the transform-related properties without much trouble.
|
|
115
|
+
// - We may be able to support animating `fillColor` by getting clever with layer blend modes
|
|
116
|
+
// or masks (e.g. use `CoreTextRenderLayer` to draw black glyphs, and then fill them in
|
|
117
|
+
// using a `CAShapeLayer`).
|
|
118
|
+
if !textLayerModel.animators.isEmpty {
|
|
119
|
+
try context.logCompatibilityIssue("""
|
|
120
|
+
The Core Animation rendering engine currently doesn't support text animators.
|
|
121
|
+
""")
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
renderLayer.font = context.fontProvider.fontFor(family: text.fontFamily, size: CGFloat(text.fontSize))
|
|
125
|
+
|
|
126
|
+
renderLayer.alignment = text.justification.textAlignment
|
|
127
|
+
renderLayer.lineHeight = CGFloat(text.lineHeight)
|
|
128
|
+
renderLayer.tracking = (CGFloat(text.fontSize) * CGFloat(text.tracking)) / 1000
|
|
129
|
+
|
|
130
|
+
renderLayer.fillColor = text.fillColorData?.cgColorValue
|
|
131
|
+
renderLayer.strokeColor = text.strokeColorData?.cgColorValue
|
|
132
|
+
renderLayer.strokeWidth = CGFloat(text.strokeWidth ?? 0)
|
|
133
|
+
renderLayer.strokeOnTop = text.strokeOverFill ?? false
|
|
134
|
+
|
|
135
|
+
renderLayer.preferredSize = text.textFrameSize?.sizeValue
|
|
136
|
+
renderLayer.sizeToFit()
|
|
137
|
+
|
|
138
|
+
renderLayer.transform = CATransform3DIdentity
|
|
139
|
+
renderLayer.position = text.textFramePosition?.pointValue ?? .zero
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// MARK: Private
|
|
143
|
+
|
|
144
|
+
private let textLayerModel: TextLayerModel
|
|
145
|
+
private let renderLayer = CoreTextRenderLayer()
|
|
146
|
+
|
|
147
|
+
private func setupSublayers() {
|
|
148
|
+
// Place the text render layer in an additional container
|
|
149
|
+
// - Direct sublayers of a `BaseCompositionLayer` always fill the bounds
|
|
150
|
+
// of their superlayer -- so this container will be the bounds of self,
|
|
151
|
+
// and the text render layer can be positioned anywhere.
|
|
152
|
+
let textContainerLayer = CALayer()
|
|
153
|
+
textContainerLayer.addSublayer(renderLayer)
|
|
154
|
+
addSublayer(textContainerLayer)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Created by Cal Stephens on 12/21/21.
|
|
2
|
+
// Copyright © 2021 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
/// The CALayer type responsible for only rendering the `transform` of a `LayerModel`
|
|
5
|
+
final class TransformLayer: BaseCompositionLayer {
|
|
6
|
+
|
|
7
|
+
/// `TransformLayer`s don't render any visible content,
|
|
8
|
+
/// they just `transform` their sublayers
|
|
9
|
+
override var renderLayerContents: Bool {
|
|
10
|
+
false
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
// Created by Cal Stephens on 1/13/22.
|
|
2
|
+
// Copyright © 2022 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
import QuartzCore
|
|
5
|
+
|
|
6
|
+
// MARK: - ValueProviderStore
|
|
7
|
+
|
|
8
|
+
/// Registration and storage for `AnyValueProvider`s that can dynamically
|
|
9
|
+
/// provide custom values for `AnimationKeypath`s within a `LottieAnimation`.
|
|
10
|
+
final class ValueProviderStore {
|
|
11
|
+
|
|
12
|
+
// MARK: Lifecycle
|
|
13
|
+
|
|
14
|
+
init(logger: LottieLogger) {
|
|
15
|
+
self.logger = logger
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// MARK: Internal
|
|
19
|
+
|
|
20
|
+
/// Registers an `AnyValueProvider` for the given `AnimationKeypath`
|
|
21
|
+
func setValueProvider(_ valueProvider: AnyValueProvider, keypath: AnimationKeypath) {
|
|
22
|
+
logger.assert(
|
|
23
|
+
valueProvider.typeErasedStorage.isSupportedByCoreAnimationRenderingEngine,
|
|
24
|
+
"""
|
|
25
|
+
The Core Animation rendering engine doesn't support Value Providers that vend a closure,
|
|
26
|
+
because that would require calling the closure on the main thread once per frame.
|
|
27
|
+
"""
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
let supportedProperties = PropertyName.allCases.map { $0.rawValue }
|
|
31
|
+
let propertyBeingCustomized = keypath.keys.last ?? ""
|
|
32
|
+
|
|
33
|
+
logger.assert(
|
|
34
|
+
supportedProperties.contains(propertyBeingCustomized),
|
|
35
|
+
"""
|
|
36
|
+
The Core Animation rendering engine currently doesn't support customizing "\(propertyBeingCustomized)" \
|
|
37
|
+
properties. Supported properties are: \(supportedProperties.joined(separator: ", ")).
|
|
38
|
+
"""
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
valueProviders.removeAll(where: { $0.keypath == keypath })
|
|
42
|
+
valueProviders.append((keypath: keypath, valueProvider: valueProvider))
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/// Removes all ValueProviders for the given `AnimationKeypath`
|
|
46
|
+
func removeValueProvider(for keypath: AnimationKeypath) {
|
|
47
|
+
valueProviders.removeAll(where: { $0.keypath.matches(keypath) })
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/// Retrieves the custom value keyframes for the given property,
|
|
51
|
+
/// if an `AnyValueProvider` was registered for the given keypath.
|
|
52
|
+
func customKeyframes<Value>(
|
|
53
|
+
of customizableProperty: CustomizableProperty<Value>,
|
|
54
|
+
for keypath: AnimationKeypath,
|
|
55
|
+
context: LayerAnimationContext
|
|
56
|
+
) throws -> KeyframeGroup<Value>? {
|
|
57
|
+
context.recordHierarchyKeypath?(keypath.fullPath)
|
|
58
|
+
|
|
59
|
+
guard let anyValueProvider = valueProvider(for: keypath) else {
|
|
60
|
+
return nil
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Retrieve the type-erased keyframes from the custom `ValueProvider`
|
|
64
|
+
let typeErasedKeyframes: [Keyframe<Any>]
|
|
65
|
+
switch anyValueProvider.typeErasedStorage {
|
|
66
|
+
case .singleValue(let typeErasedValue):
|
|
67
|
+
typeErasedKeyframes = [Keyframe(typeErasedValue)]
|
|
68
|
+
|
|
69
|
+
case .keyframes(let keyframes, _):
|
|
70
|
+
typeErasedKeyframes = keyframes
|
|
71
|
+
|
|
72
|
+
case .closure:
|
|
73
|
+
try context.logCompatibilityIssue("""
|
|
74
|
+
The Core Animation rendering engine doesn't support Value Providers that vend a closure,
|
|
75
|
+
because that would require calling the closure on the main thread once per frame.
|
|
76
|
+
""")
|
|
77
|
+
return nil
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Convert the type-erased keyframe values using this `CustomizableProperty`'s conversion closure
|
|
81
|
+
let typedKeyframes = typeErasedKeyframes.compactMap { typeErasedKeyframe -> Keyframe<Value>? in
|
|
82
|
+
guard let convertedValue = customizableProperty.conversion(typeErasedKeyframe.value, anyValueProvider) else {
|
|
83
|
+
logger.assertionFailure("""
|
|
84
|
+
Could not convert value of type \(type(of: typeErasedKeyframe.value)) from \(anyValueProvider) to expected type \(
|
|
85
|
+
Value
|
|
86
|
+
.self)
|
|
87
|
+
""")
|
|
88
|
+
return nil
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return typeErasedKeyframe.withValue(convertedValue)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Verify that all of the keyframes were successfully converted to the expected type
|
|
95
|
+
guard typedKeyframes.count == typeErasedKeyframes.count else {
|
|
96
|
+
return nil
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return KeyframeGroup(keyframes: ContiguousArray(typedKeyframes))
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// MARK: Private
|
|
103
|
+
|
|
104
|
+
private let logger: LottieLogger
|
|
105
|
+
private var valueProviders = [(keypath: AnimationKeypath, valueProvider: AnyValueProvider)]()
|
|
106
|
+
|
|
107
|
+
/// Retrieves the most-recently-registered Value Provider that matches the given keypath.
|
|
108
|
+
private func valueProvider(for keypath: AnimationKeypath) -> AnyValueProvider? {
|
|
109
|
+
// Find the last keypath matching the given keypath,
|
|
110
|
+
// so we return the value provider that was registered most-recently
|
|
111
|
+
valueProviders.last(where: { registeredKeypath, _ in
|
|
112
|
+
keypath.matches(registeredKeypath)
|
|
113
|
+
})?.valueProvider
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
extension AnyValueProviderStorage {
|
|
119
|
+
/// Whether or not this type of value provider is supported
|
|
120
|
+
/// by the new Core Animation rendering engine
|
|
121
|
+
var isSupportedByCoreAnimationRenderingEngine: Bool {
|
|
122
|
+
switch self {
|
|
123
|
+
case .singleValue, .keyframes:
|
|
124
|
+
true
|
|
125
|
+
case .closure:
|
|
126
|
+
false
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
extension AnimationKeypath {
|
|
132
|
+
/// Whether or not this keypath from the animation hierarchy
|
|
133
|
+
/// matches the given keypath (which may contain wildcards)
|
|
134
|
+
func matches(_ keypath: AnimationKeypath) -> Bool {
|
|
135
|
+
var regex = "^" // match the start of the string
|
|
136
|
+
+ keypath.keys.joined(separator: "\\.") // match this keypath, escaping "." characters
|
|
137
|
+
+ "$" // match the end of the string
|
|
138
|
+
|
|
139
|
+
// Replace the ** and * wildcards with markers that are guaranteed to be unique
|
|
140
|
+
// and won't conflict with regex syntax (e.g. `.*`).
|
|
141
|
+
let doubleWildcardMarker = UUID().uuidString
|
|
142
|
+
let singleWildcardMarker = UUID().uuidString
|
|
143
|
+
regex = regex.replacingOccurrences(of: "**", with: doubleWildcardMarker)
|
|
144
|
+
regex = regex.replacingOccurrences(of: "*", with: singleWildcardMarker)
|
|
145
|
+
|
|
146
|
+
// "**" wildcards match zero or more path segments separated by "\\."
|
|
147
|
+
// - "**.Color" matches any of "Color", "Layer 1.Color", and "Layer 1.Layer 2.Color"
|
|
148
|
+
regex = regex.replacingOccurrences(of: "\(doubleWildcardMarker)\\.", with: ".*")
|
|
149
|
+
regex = regex.replacingOccurrences(of: doubleWildcardMarker, with: ".*")
|
|
150
|
+
|
|
151
|
+
// "*" wildcards match exactly one path component
|
|
152
|
+
// - "*.Color" matches "Layer 1.Color" but not "Layer 1.Layer 2.Color"
|
|
153
|
+
regex = regex.replacingOccurrences(of: singleWildcardMarker, with: "[^.]+")
|
|
154
|
+
|
|
155
|
+
return fullPath.range(of: regex, options: .regularExpression) != nil
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
// Created by Laura Skelton on 11/25/16.
|
|
2
|
+
// Copyright © 2016 Airbnb. All rights reserved.
|
|
3
|
+
|
|
4
|
+
// MARK: - Collection
|
|
5
|
+
|
|
6
|
+
extension Collection where Element: Diffable, Index == Int {
|
|
7
|
+
|
|
8
|
+
/// Diffs two collections (e.g. `Array`s) of `Diffable` items, returning an `IndexChangeset`
|
|
9
|
+
/// representing the minimal set of changes to get from the other collection to this collection.
|
|
10
|
+
///
|
|
11
|
+
/// - Parameters:
|
|
12
|
+
/// - from other: The collection of old data.
|
|
13
|
+
func makeChangeset(from other: Self) -> IndexChangeset {
|
|
14
|
+
// Arranging the elements contiguously prior to diffing improves performance by ~40%.
|
|
15
|
+
let new = ContiguousArray(self)
|
|
16
|
+
let old = ContiguousArray(other)
|
|
17
|
+
|
|
18
|
+
/// The entries in both this and the other collection, keyed by their `dataID`s.
|
|
19
|
+
var entries = [AnyHashable: EpoxyEntry](minimumCapacity: new.count)
|
|
20
|
+
var duplicates = [EpoxyEntry]()
|
|
21
|
+
|
|
22
|
+
var newResults = ContiguousArray<NewRecord>()
|
|
23
|
+
newResults.reserveCapacity(new.count)
|
|
24
|
+
|
|
25
|
+
for index in new.indices {
|
|
26
|
+
let id = new[index].diffIdentifier
|
|
27
|
+
let entry = entries[id, default: EpoxyEntry()]
|
|
28
|
+
if entry.trackNewIndex(index) {
|
|
29
|
+
duplicates.append(entry)
|
|
30
|
+
}
|
|
31
|
+
entries[id] = entry
|
|
32
|
+
newResults.append(NewRecord(entry: entry))
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var oldResults = ContiguousArray<OldRecord>()
|
|
36
|
+
oldResults.reserveCapacity(old.count)
|
|
37
|
+
|
|
38
|
+
for index in old.indices {
|
|
39
|
+
let id = old[index].diffIdentifier
|
|
40
|
+
let entry = entries[id]
|
|
41
|
+
entry?.pushOldIndex(index)
|
|
42
|
+
oldResults.append(OldRecord(entry: entry))
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
for newIndex in new.indices {
|
|
46
|
+
let entry = newResults[newIndex].entry
|
|
47
|
+
if let oldIndex = entry.popOldIndex() {
|
|
48
|
+
let newItem = new[newIndex]
|
|
49
|
+
let oldItem = other[oldIndex]
|
|
50
|
+
|
|
51
|
+
if !oldItem.isDiffableItemEqual(to: newItem) {
|
|
52
|
+
entry.isUpdated = true
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
newResults[newIndex].correspondingOldIndex = oldIndex
|
|
56
|
+
oldResults[oldIndex].correspondingNewIndex = newIndex
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var deletes = [Int]()
|
|
61
|
+
var deleteOffsets = [Int]()
|
|
62
|
+
deleteOffsets.reserveCapacity(old.count)
|
|
63
|
+
var runningDeleteOffset = 0
|
|
64
|
+
|
|
65
|
+
for index in old.indices {
|
|
66
|
+
deleteOffsets.append(runningDeleteOffset)
|
|
67
|
+
|
|
68
|
+
let record = oldResults[index]
|
|
69
|
+
|
|
70
|
+
if record.correspondingNewIndex == nil {
|
|
71
|
+
deletes.append(index)
|
|
72
|
+
runningDeleteOffset += 1
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
var inserts = [Int]()
|
|
77
|
+
var updates = [(Int, Int)]()
|
|
78
|
+
var moves = [(Int, Int)]()
|
|
79
|
+
var insertOffsets = [Int]()
|
|
80
|
+
insertOffsets.reserveCapacity(new.count)
|
|
81
|
+
var runningInsertOffset = 0
|
|
82
|
+
|
|
83
|
+
for index in new.indices {
|
|
84
|
+
insertOffsets.append(runningInsertOffset)
|
|
85
|
+
|
|
86
|
+
let record = newResults[index]
|
|
87
|
+
|
|
88
|
+
if let oldArrayIndex = record.correspondingOldIndex {
|
|
89
|
+
if record.entry.isUpdated {
|
|
90
|
+
updates.append((oldArrayIndex, index))
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
let insertOffset = insertOffsets[index]
|
|
94
|
+
let deleteOffset = deleteOffsets[oldArrayIndex]
|
|
95
|
+
if (oldArrayIndex - deleteOffset + insertOffset) != index {
|
|
96
|
+
moves.append((oldArrayIndex, index))
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
} else {
|
|
100
|
+
inserts.append(index)
|
|
101
|
+
runningInsertOffset += 1
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
EpoxyLogger.shared.assert(
|
|
106
|
+
old.count + inserts.count - deletes.count == new.count,
|
|
107
|
+
"Failed sanity check for old count with changes matching new count."
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
return IndexChangeset(
|
|
111
|
+
inserts: inserts,
|
|
112
|
+
deletes: deletes,
|
|
113
|
+
updates: updates,
|
|
114
|
+
moves: moves,
|
|
115
|
+
newIndices: oldResults.map { $0.correspondingNewIndex },
|
|
116
|
+
duplicates: duplicates.map { $0.newIndices }
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/// Diffs between two collections (eg. `Array`s) of `Diffable` items, and returns an `IndexPathChangeset`
|
|
121
|
+
/// representing the minimal set of changes to get from the other collection to this collection.
|
|
122
|
+
///
|
|
123
|
+
/// - Parameters:
|
|
124
|
+
/// - from other: The collection of old data.
|
|
125
|
+
/// - fromSection: The section the other collection's data exists within. Defaults to `0`.
|
|
126
|
+
/// - toSection: The section this collection's data exists within. Defaults to `0`.
|
|
127
|
+
func makeIndexPathChangeset(
|
|
128
|
+
from other: Self,
|
|
129
|
+
fromSection: Int = 0,
|
|
130
|
+
toSection: Int = 0
|
|
131
|
+
) -> IndexPathChangeset {
|
|
132
|
+
let indexChangeset = makeChangeset(from: other)
|
|
133
|
+
|
|
134
|
+
return IndexPathChangeset(
|
|
135
|
+
inserts: indexChangeset.inserts.map { index in
|
|
136
|
+
[toSection, index]
|
|
137
|
+
},
|
|
138
|
+
deletes: indexChangeset.deletes.map { index in
|
|
139
|
+
[fromSection, index]
|
|
140
|
+
},
|
|
141
|
+
updates: indexChangeset.updates.map { fromIndex, toIndex in
|
|
142
|
+
([fromSection, fromIndex], [toSection, toIndex])
|
|
143
|
+
},
|
|
144
|
+
moves: indexChangeset.moves.map { fromIndex, toIndex in
|
|
145
|
+
([fromSection, fromIndex], [toSection, toIndex])
|
|
146
|
+
},
|
|
147
|
+
duplicates: indexChangeset.duplicates.map { duplicate in
|
|
148
|
+
duplicate.map { index in
|
|
149
|
+
[toSection, index]
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/// Diffs between two collections (e.g. `Array`s) of `Diffable` items, returning an
|
|
156
|
+
/// `IndexSetChangeset` representing the minimal set of changes to get from the other collection
|
|
157
|
+
/// to this collection.
|
|
158
|
+
///
|
|
159
|
+
/// - Parameters:
|
|
160
|
+
/// - from other: The collection of old data.
|
|
161
|
+
func makeIndexSetChangeset(from other: Self) -> IndexSetChangeset {
|
|
162
|
+
let indexChangeset = makeChangeset(from: other)
|
|
163
|
+
|
|
164
|
+
return IndexSetChangeset(
|
|
165
|
+
inserts: .init(indexChangeset.inserts),
|
|
166
|
+
deletes: .init(indexChangeset.deletes),
|
|
167
|
+
updates: indexChangeset.updates,
|
|
168
|
+
moves: indexChangeset.moves,
|
|
169
|
+
newIndices: indexChangeset.newIndices,
|
|
170
|
+
duplicates: indexChangeset.duplicates.map { .init($0) }
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
extension Collection where Element: DiffableSection, Index == Int {
|
|
177
|
+
/// Diffs between two collections (e.g. `Array`s) of `DiffableSection` items, returning an
|
|
178
|
+
/// `SectionedChangeset` representing the minimal set of changes to get from the other collection
|
|
179
|
+
/// to this collection.
|
|
180
|
+
///
|
|
181
|
+
/// - Parameters:
|
|
182
|
+
/// - from other: The collection of old data.
|
|
183
|
+
func makeSectionedChangeset(from other: Self) -> SectionedChangeset {
|
|
184
|
+
let sectionChangeset = makeIndexSetChangeset(from: other)
|
|
185
|
+
var itemChangeset = IndexPathChangeset()
|
|
186
|
+
|
|
187
|
+
for fromSectionIndex in other.indices {
|
|
188
|
+
guard let toSectionIndex = sectionChangeset.newIndices[fromSectionIndex] else {
|
|
189
|
+
continue
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
let fromItems = other[fromSectionIndex].diffableItems
|
|
193
|
+
let toItems = self[toSectionIndex].diffableItems
|
|
194
|
+
|
|
195
|
+
let itemIndexChangeset = toItems.makeIndexPathChangeset(
|
|
196
|
+
from: fromItems,
|
|
197
|
+
fromSection: fromSectionIndex,
|
|
198
|
+
toSection: toSectionIndex
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
itemChangeset += itemIndexChangeset
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return SectionedChangeset(sectionChangeset: sectionChangeset, itemChangeset: itemChangeset)
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// MARK: - EpoxyEntry
|
|
209
|
+
|
|
210
|
+
/// A bookkeeping reference type for the diffing algorithm.
|
|
211
|
+
private final class EpoxyEntry {
|
|
212
|
+
|
|
213
|
+
// MARK: Internal
|
|
214
|
+
|
|
215
|
+
private(set) var oldIndices = [Int]()
|
|
216
|
+
private(set) var newIndices = [Int]()
|
|
217
|
+
var isUpdated = false
|
|
218
|
+
|
|
219
|
+
/// Tracks an index from the new indices, returning `true` if this entry has previously tracked
|
|
220
|
+
/// a new index as a means to identify duplicates and `false` otherwise.
|
|
221
|
+
func trackNewIndex(_ index: Int) -> Bool {
|
|
222
|
+
let previouslyEmpty = newIndices.isEmpty
|
|
223
|
+
|
|
224
|
+
newIndices.append(index)
|
|
225
|
+
|
|
226
|
+
// We've encountered a duplicate, return true so we can track it.
|
|
227
|
+
if !previouslyEmpty, newIndices.count == 2 {
|
|
228
|
+
return true
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return false
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
func pushOldIndex(_ index: Int) {
|
|
235
|
+
oldIndices.append(index)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
func popOldIndex() -> Int? {
|
|
239
|
+
guard currentOldIndex < oldIndices.endIndex else {
|
|
240
|
+
return nil
|
|
241
|
+
}
|
|
242
|
+
defer {
|
|
243
|
+
currentOldIndex += 1
|
|
244
|
+
}
|
|
245
|
+
return oldIndices[currentOldIndex]
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// MARK: Private
|
|
249
|
+
|
|
250
|
+
private var currentOldIndex = 0
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// MARK: - OldRecord
|
|
254
|
+
|
|
255
|
+
/// A bookkeeping type for pairing up an old element with its new index.
|
|
256
|
+
private struct OldRecord {
|
|
257
|
+
var entry: EpoxyEntry?
|
|
258
|
+
var correspondingNewIndex: Int? = nil
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// MARK: - NewRecord
|
|
262
|
+
|
|
263
|
+
/// A bookkeeping type for pairing up a new element with its old index.
|
|
264
|
+
private struct NewRecord {
|
|
265
|
+
var entry: EpoxyEntry
|
|
266
|
+
var correspondingOldIndex: Int? = nil
|
|
267
|
+
}
|
package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Diffable.swift
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Created by Laura Skelton on 5/11/17.
|
|
2
|
+
// Copyright © 2017 Airbnb. All rights reserved.
|
|
3
|
+
|
|
4
|
+
// MARK: - Diffable
|
|
5
|
+
|
|
6
|
+
/// A protocol that allows us to check identity and equality between items for the purposes of
|
|
7
|
+
/// diffing.
|
|
8
|
+
protocol Diffable {
|
|
9
|
+
|
|
10
|
+
/// The identifier to use when checking identity while diffing.
|
|
11
|
+
var diffIdentifier: AnyHashable { get }
|
|
12
|
+
|
|
13
|
+
/// Checks for equality between items when diffing.
|
|
14
|
+
///
|
|
15
|
+
/// - Parameters:
|
|
16
|
+
/// - otherDiffableItem: The other item to check equality against while diffing.
|
|
17
|
+
func isDiffableItemEqual(to otherDiffableItem: Diffable) -> Bool
|
|
18
|
+
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Created by eric_horacek on 12/9/20.
|
|
2
|
+
// Copyright © 2020 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
// MARK: - DiffableSection
|
|
5
|
+
|
|
6
|
+
/// A protocol that allows us to check identity and equality between sections of `Diffable` items
|
|
7
|
+
/// for the purposes of diffing.
|
|
8
|
+
protocol DiffableSection: Diffable {
|
|
9
|
+
/// The diffable items in this section.
|
|
10
|
+
associatedtype DiffableItems: Collection where
|
|
11
|
+
DiffableItems.Index == Int,
|
|
12
|
+
DiffableItems.Element: Diffable
|
|
13
|
+
|
|
14
|
+
/// The diffable items in this section.
|
|
15
|
+
var diffableItems: DiffableItems { get }
|
|
16
|
+
}
|