@octane-xplat/lottie 0.9.0 → 0.11.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 +36 -16
- package/dist/native/index.js +10 -9
- package/dist/native/octane-client-build.json +1 -1
- package/dist/web/index.js +39 -25
- package/dist/web/octane-client-build.json +1 -1
- package/package.json +25 -3
- 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 +6 -4
- package/src/Lottie.web.tsrx +28 -11
- package/src/index.macos.ts +2 -0
- package/src/props.ts +6 -1
- package/types/generated/props.d.ts +5 -1
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
//
|
|
2
|
+
// FileManager+ZIP.swift
|
|
3
|
+
// ZIPFoundation
|
|
4
|
+
//
|
|
5
|
+
// Copyright © 2017-2025 Thomas Zoechling, https://www.peakstep.com and the ZIP Foundation project authors.
|
|
6
|
+
// Released under the MIT License.
|
|
7
|
+
//
|
|
8
|
+
// See https://github.com/weichsel/ZIPFoundation/blob/master/LICENSE for license information.
|
|
9
|
+
//
|
|
10
|
+
|
|
11
|
+
import Foundation
|
|
12
|
+
|
|
13
|
+
extension FileManager {
|
|
14
|
+
|
|
15
|
+
typealias CentralDirectoryStructure = Entry.CentralDirectoryStructure
|
|
16
|
+
|
|
17
|
+
class func attributes(from entry: Entry) -> [FileAttributeKey: Any] {
|
|
18
|
+
let centralDirectoryStructure = entry.centralDirectoryStructure
|
|
19
|
+
let entryType = entry.type
|
|
20
|
+
let fileTime = centralDirectoryStructure.lastModFileTime
|
|
21
|
+
let fileDate = centralDirectoryStructure.lastModFileDate
|
|
22
|
+
let defaultPermissions = entryType == .directory ? defaultDirectoryPermissions : defaultFilePermissions
|
|
23
|
+
var attributes = [.posixPermissions: defaultPermissions] as [FileAttributeKey: Any]
|
|
24
|
+
attributes[.modificationDate] = Date(dateTime: (fileDate, fileTime))
|
|
25
|
+
let versionMadeBy = centralDirectoryStructure.versionMadeBy
|
|
26
|
+
guard let osType = Entry.OSType(rawValue: UInt(versionMadeBy >> 8)) else { return attributes }
|
|
27
|
+
|
|
28
|
+
let externalFileAttributes = centralDirectoryStructure.externalFileAttributes
|
|
29
|
+
let permissions = permissions(for: externalFileAttributes, osType: osType, entryType: entryType)
|
|
30
|
+
attributes[.posixPermissions] = NSNumber(value: permissions)
|
|
31
|
+
return attributes
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
class func permissions(
|
|
35
|
+
for externalFileAttributes: UInt32,
|
|
36
|
+
osType: Entry.OSType,
|
|
37
|
+
entryType: Entry.EntryType
|
|
38
|
+
) -> UInt16 {
|
|
39
|
+
switch osType {
|
|
40
|
+
case .unix, .osx:
|
|
41
|
+
let permissions = mode_t(externalFileAttributes >> 16) & ~S_IFMT
|
|
42
|
+
let defaultPermissions = entryType == .directory ? defaultDirectoryPermissions : defaultFilePermissions
|
|
43
|
+
return permissions == 0 ? defaultPermissions : UInt16(permissions)
|
|
44
|
+
|
|
45
|
+
default:
|
|
46
|
+
return entryType == .directory ? defaultDirectoryPermissions : defaultFilePermissions
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
class func externalFileAttributesForEntry(of type: Entry.EntryType, permissions: UInt16) -> UInt32 {
|
|
51
|
+
let typeInt =
|
|
52
|
+
switch type {
|
|
53
|
+
case .file:
|
|
54
|
+
UInt16(S_IFREG)
|
|
55
|
+
case .directory:
|
|
56
|
+
UInt16(S_IFDIR)
|
|
57
|
+
case .symlink:
|
|
58
|
+
UInt16(S_IFLNK)
|
|
59
|
+
}
|
|
60
|
+
var externalFileAttributes = UInt32(typeInt | UInt16(permissions))
|
|
61
|
+
externalFileAttributes = (externalFileAttributes << 16)
|
|
62
|
+
return externalFileAttributes
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
class func permissionsForItem(at URL: URL) throws -> UInt16 {
|
|
66
|
+
let fileManager = FileManager()
|
|
67
|
+
let entryFileSystemRepresentation = fileManager.fileSystemRepresentation(withPath: URL.path)
|
|
68
|
+
var fileStat = stat()
|
|
69
|
+
lstat(entryFileSystemRepresentation, &fileStat)
|
|
70
|
+
let permissions = fileStat.st_mode
|
|
71
|
+
return UInt16(permissions)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
class func fileModificationDateTimeForItem(at url: URL) throws -> Date {
|
|
75
|
+
let fileManager = FileManager()
|
|
76
|
+
guard fileManager.itemExists(at: url) else {
|
|
77
|
+
throw CocoaError(.fileReadNoSuchFile, userInfo: [NSFilePathErrorKey: url.path])
|
|
78
|
+
}
|
|
79
|
+
let entryFileSystemRepresentation = fileManager.fileSystemRepresentation(withPath: url.path)
|
|
80
|
+
var fileStat = stat()
|
|
81
|
+
lstat(entryFileSystemRepresentation, &fileStat)
|
|
82
|
+
#if os(macOS) || os(iOS) || os(tvOS) || os(visionOS) || os(watchOS)
|
|
83
|
+
let modTimeSpec = fileStat.st_mtimespec
|
|
84
|
+
#else
|
|
85
|
+
let modTimeSpec = fileStat.st_mtim
|
|
86
|
+
#endif
|
|
87
|
+
|
|
88
|
+
let timeStamp = TimeInterval(modTimeSpec.tv_sec) + TimeInterval(modTimeSpec.tv_nsec) / 1000000000.0
|
|
89
|
+
return Date(timeIntervalSince1970: timeStamp)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
class func fileSizeForItem(at url: URL) throws -> Int64 {
|
|
93
|
+
let fileManager = FileManager()
|
|
94
|
+
guard fileManager.itemExists(at: url) else {
|
|
95
|
+
throw CocoaError(.fileReadNoSuchFile, userInfo: [NSFilePathErrorKey: url.path])
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
let entryFileSystemRepresentation = fileManager.fileSystemRepresentation(withPath: url.path)
|
|
99
|
+
var stats = stat()
|
|
100
|
+
lstat(entryFileSystemRepresentation, &stats)
|
|
101
|
+
guard stats.st_size >= 0 else { throw CocoaError(.fileReadTooLarge, userInfo: [NSFilePathErrorKey: url.path]) }
|
|
102
|
+
|
|
103
|
+
// `st_size` is a signed int value
|
|
104
|
+
return Int64(stats.st_size)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
class func typeForItem(at url: URL) throws -> Entry.EntryType {
|
|
108
|
+
let fileManager = FileManager()
|
|
109
|
+
guard url.isFileURL, fileManager.itemExists(at: url) else {
|
|
110
|
+
throw CocoaError(.fileReadNoSuchFile, userInfo: [NSFilePathErrorKey: url.path])
|
|
111
|
+
}
|
|
112
|
+
let entryFileSystemRepresentation = fileManager.fileSystemRepresentation(withPath: url.path)
|
|
113
|
+
var fileStat = stat()
|
|
114
|
+
lstat(entryFileSystemRepresentation, &fileStat)
|
|
115
|
+
return Entry.EntryType(mode: mode_t(fileStat.st_mode))
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/// Zips the file or directory contents at the specified source URL to the destination URL.
|
|
119
|
+
///
|
|
120
|
+
/// If the item at the source URL is a directory, the directory itself will be
|
|
121
|
+
/// represented within the ZIP `Archive`. Calling this method with a directory URL
|
|
122
|
+
/// `file:///path/directory/` will create an archive with a `directory/` entry at the root level.
|
|
123
|
+
/// You can override this behavior by passing `false` for `shouldKeepParent`. In that case, the contents
|
|
124
|
+
/// of the source directory will be placed at the root of the archive.
|
|
125
|
+
/// - Parameters:
|
|
126
|
+
/// - sourceURL: The file URL pointing to an existing file or directory.
|
|
127
|
+
/// - destinationURL: The file URL that identifies the destination of the zip operation.
|
|
128
|
+
/// - shouldKeepParent: Indicates that the directory name of a source item should be used as root element
|
|
129
|
+
/// within the archive. Default is `true`.
|
|
130
|
+
/// - compressionMethod: Indicates the `CompressionMethod` that should be applied.
|
|
131
|
+
/// By default, `zipItem` will create uncompressed archives.
|
|
132
|
+
/// - progress: A progress object that can be used to track or cancel the zip operation.
|
|
133
|
+
/// - Throws: Throws an error if the source item does not exist or the destination URL is not writable.
|
|
134
|
+
func zipItem(
|
|
135
|
+
at sourceURL: URL,
|
|
136
|
+
to destinationURL: URL,
|
|
137
|
+
shouldKeepParent: Bool = true,
|
|
138
|
+
compressionMethod: CompressionMethod = .none,
|
|
139
|
+
progress: Progress? = nil
|
|
140
|
+
) throws {
|
|
141
|
+
let fileManager = FileManager()
|
|
142
|
+
guard fileManager.itemExists(at: sourceURL) else {
|
|
143
|
+
throw CocoaError(.fileReadNoSuchFile, userInfo: [NSFilePathErrorKey: sourceURL.path])
|
|
144
|
+
}
|
|
145
|
+
guard !fileManager.itemExists(at: destinationURL) else {
|
|
146
|
+
throw CocoaError(.fileWriteFileExists, userInfo: [NSFilePathErrorKey: destinationURL.path])
|
|
147
|
+
}
|
|
148
|
+
let archive = try Archive(url: destinationURL, accessMode: .create)
|
|
149
|
+
let isDirectory = try FileManager.typeForItem(at: sourceURL) == .directory
|
|
150
|
+
if isDirectory {
|
|
151
|
+
var subPaths = try subpathsOfDirectory(atPath: sourceURL.path)
|
|
152
|
+
// Enforce an entry for the root directory to preserve its file attributes
|
|
153
|
+
if shouldKeepParent { subPaths.append("") }
|
|
154
|
+
var totalUnitCount = Int64(0)
|
|
155
|
+
if let progress {
|
|
156
|
+
totalUnitCount = subPaths.reduce(Int64(0)) {
|
|
157
|
+
let itemURL = sourceURL.appendingPathComponent($1)
|
|
158
|
+
let itemSize = archive.totalUnitCountForAddingItem(at: itemURL)
|
|
159
|
+
return $0 + itemSize
|
|
160
|
+
}
|
|
161
|
+
progress.totalUnitCount = totalUnitCount
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// If the caller wants to keep the parent directory, we use the lastPathComponent of the source URL
|
|
165
|
+
// as common base for all entries (similar to macOS' Archive Utility.app)
|
|
166
|
+
let directoryPrefix = sourceURL.lastPathComponent
|
|
167
|
+
for entryPath in subPaths {
|
|
168
|
+
let finalEntryPath = shouldKeepParent ? directoryPrefix + "/" + entryPath : entryPath
|
|
169
|
+
let finalBaseURL = shouldKeepParent ? sourceURL.deletingLastPathComponent() : sourceURL
|
|
170
|
+
if let progress {
|
|
171
|
+
let itemURL = sourceURL.appendingPathComponent(entryPath)
|
|
172
|
+
let entryProgress = archive.makeProgressForAddingItem(at: itemURL)
|
|
173
|
+
progress.addChild(entryProgress, withPendingUnitCount: entryProgress.totalUnitCount)
|
|
174
|
+
try archive.addEntry(
|
|
175
|
+
with: finalEntryPath,
|
|
176
|
+
relativeTo: finalBaseURL,
|
|
177
|
+
compressionMethod: compressionMethod,
|
|
178
|
+
progress: entryProgress
|
|
179
|
+
)
|
|
180
|
+
} else {
|
|
181
|
+
try archive.addEntry(
|
|
182
|
+
with: finalEntryPath,
|
|
183
|
+
relativeTo: finalBaseURL,
|
|
184
|
+
compressionMethod: compressionMethod
|
|
185
|
+
)
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
} else {
|
|
189
|
+
progress?.totalUnitCount = archive.totalUnitCountForAddingItem(at: sourceURL)
|
|
190
|
+
let baseURL = sourceURL.deletingLastPathComponent()
|
|
191
|
+
try archive.addEntry(
|
|
192
|
+
with: sourceURL.lastPathComponent,
|
|
193
|
+
relativeTo: baseURL,
|
|
194
|
+
compressionMethod: compressionMethod,
|
|
195
|
+
progress: progress
|
|
196
|
+
)
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/// Unzips the contents at the specified source URL to the destination URL.
|
|
201
|
+
///
|
|
202
|
+
/// - Parameters:
|
|
203
|
+
/// - sourceURL: The file URL pointing to an existing ZIP file.
|
|
204
|
+
/// - destinationURL: The file URL that identifies the destination directory of the unzip operation.
|
|
205
|
+
/// - skipCRC32: Optional flag to skip calculation of the CRC32 checksum to improve performance.
|
|
206
|
+
/// - allowUncontainedSymlinks: Optional flag to allow symlinks that point to paths outside the destination.
|
|
207
|
+
/// - progress: A progress object that can be used to track or cancel the unzip operation.
|
|
208
|
+
/// - pathEncoding: Encoding for entry paths. Overrides the encoding specified in the archive.
|
|
209
|
+
/// - Throws: Throws an error if the source item does not exist or the destination URL is not writable.
|
|
210
|
+
func unzipItem(
|
|
211
|
+
at sourceURL: URL,
|
|
212
|
+
to destinationURL: URL,
|
|
213
|
+
skipCRC32: Bool = false,
|
|
214
|
+
allowUncontainedSymlinks: Bool = false,
|
|
215
|
+
progress: Progress? = nil,
|
|
216
|
+
pathEncoding: String.Encoding? = nil
|
|
217
|
+
) throws {
|
|
218
|
+
let fileManager = FileManager()
|
|
219
|
+
guard fileManager.itemExists(at: sourceURL) else {
|
|
220
|
+
throw CocoaError(.fileReadNoSuchFile, userInfo: [NSFilePathErrorKey: sourceURL.path])
|
|
221
|
+
}
|
|
222
|
+
let archive = try Archive(url: sourceURL, accessMode: .read, pathEncoding: pathEncoding)
|
|
223
|
+
var totalUnitCount = Int64(0)
|
|
224
|
+
if let progress {
|
|
225
|
+
totalUnitCount = archive.reduce(0) { $0 + archive.totalUnitCountForReading($1) }
|
|
226
|
+
progress.totalUnitCount = totalUnitCount
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
for entry in archive {
|
|
230
|
+
let path = pathEncoding == nil ? entry.path : entry.path(using: pathEncoding!)
|
|
231
|
+
let entryURL = destinationURL.appendingPathComponent(path)
|
|
232
|
+
guard entryURL.isContained(in: destinationURL) else {
|
|
233
|
+
throw CocoaError(
|
|
234
|
+
.fileReadInvalidFileName,
|
|
235
|
+
userInfo: [NSFilePathErrorKey: entryURL.path]
|
|
236
|
+
)
|
|
237
|
+
}
|
|
238
|
+
let crc32: CRC32
|
|
239
|
+
if let progress {
|
|
240
|
+
let entryProgress = archive.makeProgressForReading(entry)
|
|
241
|
+
progress.addChild(entryProgress, withPendingUnitCount: entryProgress.totalUnitCount)
|
|
242
|
+
crc32 = try archive.extract(
|
|
243
|
+
entry,
|
|
244
|
+
to: entryURL,
|
|
245
|
+
skipCRC32: skipCRC32,
|
|
246
|
+
allowUncontainedSymlinks: allowUncontainedSymlinks,
|
|
247
|
+
progress: entryProgress
|
|
248
|
+
)
|
|
249
|
+
} else {
|
|
250
|
+
crc32 = try archive.extract(
|
|
251
|
+
entry,
|
|
252
|
+
to: entryURL,
|
|
253
|
+
skipCRC32: skipCRC32,
|
|
254
|
+
allowUncontainedSymlinks: allowUncontainedSymlinks
|
|
255
|
+
)
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
func verifyChecksumIfNecessary() throws {
|
|
259
|
+
if skipCRC32 == false, crc32 != entry.checksum {
|
|
260
|
+
throw Archive.ArchiveError.invalidCRC32
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
try verifyChecksumIfNecessary()
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
func itemExists(at url: URL) -> Bool {
|
|
268
|
+
// Use `URL.checkResourceIsReachable()` instead of `FileManager.fileExists()` here
|
|
269
|
+
// because we don't want implicit symlink resolution.
|
|
270
|
+
// As per documentation, `FileManager.fileExists()` traverses symlinks and therefore a broken symlink
|
|
271
|
+
// would throw a `.fileReadNoSuchFile` false positive error.
|
|
272
|
+
// For ZIP files it may be intended to archive "broken" symlinks because they might be
|
|
273
|
+
// resolvable again when extracting the archive to a different destination.
|
|
274
|
+
(try? url.checkResourceIsReachable()) == true
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
func createParentDirectoryStructure(for url: URL) throws {
|
|
278
|
+
let parentDirectoryURL = url.deletingLastPathComponent()
|
|
279
|
+
try createDirectory(at: parentDirectoryURL, withIntermediateDirectories: true, attributes: nil)
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
func transferAttributes(from entry: Entry, toItemAtURL url: URL) throws {
|
|
283
|
+
let attributes = FileManager.attributes(from: entry)
|
|
284
|
+
switch entry.type {
|
|
285
|
+
case .directory, .file:
|
|
286
|
+
try setAttributes(attributes, ofItemAtURL: url)
|
|
287
|
+
case .symlink:
|
|
288
|
+
try setAttributes(attributes, ofItemAtURL: url, traverseLink: false)
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
func setAttributes(_ attributes: [FileAttributeKey: Any], ofItemAtURL url: URL, traverseLink: Bool = true) throws {
|
|
293
|
+
// `FileManager.setAttributes` traverses symlinks and applies the attributes to
|
|
294
|
+
// the symlink destination. Since we want to be able to create symlinks where
|
|
295
|
+
// the destination isn't available (yet), we want to directly apply entry attributes
|
|
296
|
+
// to the symlink (vs. the destination file).
|
|
297
|
+
guard traverseLink == false else {
|
|
298
|
+
try setAttributes(attributes, ofItemAtPath: url.path)
|
|
299
|
+
return
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
#if os(macOS) || os(iOS) || os(tvOS) || os(visionOS) || os(watchOS)
|
|
303
|
+
guard let posixPermissions = attributes[.posixPermissions] as? NSNumber else {
|
|
304
|
+
throw Entry.EntryError.missingPermissionsAttributeError
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
try setSymlinkPermissions(posixPermissions, ofItemAtURL: url)
|
|
308
|
+
|
|
309
|
+
guard let modificationDate = attributes[.modificationDate] as? Date else {
|
|
310
|
+
throw Entry.EntryError.missingModificationDateAttributeError
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
try setSymlinkModificationDate(modificationDate, ofItemAtURL: url)
|
|
314
|
+
#else
|
|
315
|
+
// Since non-Darwin POSIX platforms ignore permissions on symlinks and swift-corelibs-foundation
|
|
316
|
+
// currently doesn't support setting the modification date, this codepath is currently a no-op
|
|
317
|
+
// on these platforms.
|
|
318
|
+
return
|
|
319
|
+
#endif
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
func setSymlinkPermissions(_ posixPermissions: NSNumber, ofItemAtURL url: URL) throws {
|
|
323
|
+
let fileSystemRepresentation = fileSystemRepresentation(withPath: url.path)
|
|
324
|
+
let modeT = posixPermissions.uint16Value
|
|
325
|
+
guard lchmod(fileSystemRepresentation, mode_t(modeT)) == 0 else {
|
|
326
|
+
throw POSIXError(errno, path: url.path)
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
func setSymlinkModificationDate(_ modificationDate: Date, ofItemAtURL url: URL) throws {
|
|
331
|
+
let fileSystemRepresentation = fileSystemRepresentation(withPath: url.path)
|
|
332
|
+
var fileStat = stat()
|
|
333
|
+
guard lstat(fileSystemRepresentation, &fileStat) == 0 else {
|
|
334
|
+
throw POSIXError(errno, path: url.path)
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
let accessDate = fileStat.lastAccessDate
|
|
338
|
+
let array = [
|
|
339
|
+
timeval(timeIntervalSince1970: accessDate.timeIntervalSince1970),
|
|
340
|
+
timeval(timeIntervalSince1970: modificationDate.timeIntervalSince1970),
|
|
341
|
+
]
|
|
342
|
+
try array.withUnsafeBufferPointer {
|
|
343
|
+
guard lutimes(fileSystemRepresentation, $0.baseAddress) == 0 else {
|
|
344
|
+
throw POSIXError(errno, path: url.path)
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
extension POSIXError {
|
|
352
|
+
|
|
353
|
+
init(_ code: Int32, path: String) {
|
|
354
|
+
let errorCode = POSIXError.Code(rawValue: code) ?? .EPERM
|
|
355
|
+
self = .init(errorCode, userInfo: [NSFilePathErrorKey: path])
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
extension CocoaError {
|
|
360
|
+
|
|
361
|
+
#if swift(>=4.2)
|
|
362
|
+
#else
|
|
363
|
+
|
|
364
|
+
#if os(macOS) || os(iOS) || os(tvOS) || os(visionOS) || os(watchOS)
|
|
365
|
+
#else
|
|
366
|
+
|
|
367
|
+
// The swift-corelibs-foundation version of NSError.swift was missing a convenience method to create
|
|
368
|
+
// error objects from error codes. (https://github.com/apple/swift-corelibs-foundation/pull/1420)
|
|
369
|
+
// We have to provide an implementation for non-Darwin platforms using Swift versions < 4.2.
|
|
370
|
+
|
|
371
|
+
static func error(_ code: CocoaError.Code, userInfo: [AnyHashable: Any]? = nil, url: URL? = nil) -> Error {
|
|
372
|
+
var info: [String: Any] = userInfo as? [String: Any] ?? [:]
|
|
373
|
+
if let url {
|
|
374
|
+
info[NSURLErrorKey] = url
|
|
375
|
+
}
|
|
376
|
+
return NSError(domain: NSCocoaErrorDomain, code: code.rawValue, userInfo: info)
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
#endif
|
|
380
|
+
#endif
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
extension URL {
|
|
384
|
+
|
|
385
|
+
func isContained(in parentDirectoryURL: URL) -> Bool {
|
|
386
|
+
// Ensure this URL is contained in the passed in URL
|
|
387
|
+
let parentDirectoryURL = URL(fileURLWithPath: parentDirectoryURL.path, isDirectory: true).standardized
|
|
388
|
+
// Maliciously crafted ZIP files can contain entries using a prepended path delimiter `/` in combination
|
|
389
|
+
// with the parent directory shorthand `..` to bypass our containment check.
|
|
390
|
+
// When a malicious entry path like e.g. `/../secret.txt` gets appended to the destination
|
|
391
|
+
// directory URL (e.g. `file:///tmp/`), the resulting URL `file:///tmp//../secret.txt` gets expanded
|
|
392
|
+
// to `file:///tmp/secret` when using `URL.standardized`. This URL would pass the check performed
|
|
393
|
+
// in `isContained(in:)`.
|
|
394
|
+
// Lower level API like POSIX `fopen` - which is used at a later point during extraction - expands
|
|
395
|
+
// `/tmp//../secret.txt` to `/secret.txt` though. This would lead to an escape to the parent directory.
|
|
396
|
+
// To avoid that, we replicate the behavior of `fopen`s path expansion and replace all double delimiters
|
|
397
|
+
// with single delimiters.
|
|
398
|
+
// More details: https://github.com/weichsel/ZIPFoundation/issues/281
|
|
399
|
+
let sanitizedEntryPathURL: URL = {
|
|
400
|
+
let sanitizedPath = self.path.replacingOccurrences(of: "//", with: "/")
|
|
401
|
+
return URL(fileURLWithPath: sanitizedPath)
|
|
402
|
+
}()
|
|
403
|
+
return sanitizedEntryPathURL.standardized.absoluteString.hasPrefix(parentDirectoryURL.absoluteString)
|
|
404
|
+
}
|
|
405
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//
|
|
2
|
+
// FileManager+ZIPDeprecated.swift
|
|
3
|
+
// ZIPFoundation
|
|
4
|
+
//
|
|
5
|
+
// Created by Thomas Zoechling on 06.02.23.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
extension FileManager {
|
|
11
|
+
|
|
12
|
+
@available(*, deprecated, renamed: "unzipItem(at:to:skipCRC32:progress:pathEncoding:)")
|
|
13
|
+
func unzipItem(
|
|
14
|
+
at sourceURL: URL,
|
|
15
|
+
to destinationURL: URL,
|
|
16
|
+
skipCRC32: Bool = false,
|
|
17
|
+
progress: Progress? = nil,
|
|
18
|
+
preferredEncoding: String.Encoding?
|
|
19
|
+
) throws {
|
|
20
|
+
try unzipItem(
|
|
21
|
+
at: sourceURL,
|
|
22
|
+
to: destinationURL,
|
|
23
|
+
skipCRC32: skipCRC32,
|
|
24
|
+
progress: progress,
|
|
25
|
+
pathEncoding: preferredEncoding
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
## ZipFoundation
|
|
2
|
+
|
|
3
|
+
This directory includes the source code of the ZIPFoundation library, from the following release:
|
|
4
|
+
https://github.com/weichsel/ZIPFoundation/releases/tag/0.9.20
|
|
5
|
+
|
|
6
|
+
Lottie is distributed via multiple package managers (SPM, Cocoapods, Carthage, and NPM),
|
|
7
|
+
each with different packaging and compilation requirements.
|
|
8
|
+
|
|
9
|
+
Due to limitations of these package managers, we can't depend on / import
|
|
10
|
+
a separate ZIPFoundation module / library. Instead, we include the source
|
|
11
|
+
directly within the Lottie library and compile everything as a single unit.
|
|
12
|
+
|
|
13
|
+
### Update instructions
|
|
14
|
+
|
|
15
|
+
From time to time we may need to update to a more recent version of ZIPFoundation.
|
|
16
|
+
When doing this, follow these steps:
|
|
17
|
+
|
|
18
|
+
1. Download the latest release from https://github.com/weichsel/ZIPFoundation
|
|
19
|
+
and replace the source code in this directory with the updated code.
|
|
20
|
+
|
|
21
|
+
2. Update the URL at the top of this file to indicate what release is being used.
|
|
22
|
+
|
|
23
|
+
3. Change all of the `public` symbols defined in this module to instead be `internal`
|
|
24
|
+
to prevent Lottie from exposing any ZIPFoundation APIs.
|
package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/URL+ZIP.swift
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//
|
|
2
|
+
// URL+ZIP.swift
|
|
3
|
+
// ZIPFoundation
|
|
4
|
+
//
|
|
5
|
+
// Copyright © 2017-2025 Thomas Zoechling, https://www.peakstep.com and the ZIP Foundation project authors.
|
|
6
|
+
// Released under the MIT License.
|
|
7
|
+
//
|
|
8
|
+
// See https://github.com/weichsel/ZIPFoundation/blob/master/LICENSE for license information.
|
|
9
|
+
//
|
|
10
|
+
|
|
11
|
+
import Foundation
|
|
12
|
+
|
|
13
|
+
extension URL {
|
|
14
|
+
|
|
15
|
+
static func temporaryReplacementDirectoryURL(for archive: Archive) -> URL {
|
|
16
|
+
#if swift(>=5.0) || os(macOS) || os(iOS) || os(tvOS) || os(visionOS) || os(watchOS)
|
|
17
|
+
if
|
|
18
|
+
archive.url.isFileURL,
|
|
19
|
+
let tempDir = try? FileManager().url(
|
|
20
|
+
for: .itemReplacementDirectory,
|
|
21
|
+
in: .userDomainMask,
|
|
22
|
+
appropriateFor: archive.url,
|
|
23
|
+
create: true
|
|
24
|
+
)
|
|
25
|
+
{
|
|
26
|
+
return tempDir
|
|
27
|
+
}
|
|
28
|
+
#endif
|
|
29
|
+
|
|
30
|
+
return URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(
|
|
31
|
+
ProcessInfo.processInfo.globallyUniqueString
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
//
|
|
2
|
+
// LayerContainer.swift
|
|
3
|
+
// lottie-swift
|
|
4
|
+
//
|
|
5
|
+
// Created by Brandon Withrow on 1/22/19.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import QuartzCore
|
|
9
|
+
|
|
10
|
+
// MARK: - CompositionLayer
|
|
11
|
+
|
|
12
|
+
/// The base class for a child layer of CompositionContainer
|
|
13
|
+
class CompositionLayer: CALayer, KeypathSearchable {
|
|
14
|
+
|
|
15
|
+
// MARK: Lifecycle
|
|
16
|
+
|
|
17
|
+
init(layer: LayerModel, size: CGSize) {
|
|
18
|
+
transformNode = LayerTransformNode(transform: layer.transform)
|
|
19
|
+
if let masks = layer.masks?.filter({ $0.mode != .none }), !masks.isEmpty {
|
|
20
|
+
maskLayer = MaskContainerLayer(masks: masks)
|
|
21
|
+
} else {
|
|
22
|
+
maskLayer = nil
|
|
23
|
+
}
|
|
24
|
+
matteType = layer.matte
|
|
25
|
+
inFrame = layer.inFrame.cgFloat
|
|
26
|
+
outFrame = layer.outFrame.cgFloat
|
|
27
|
+
timeStretch = layer.timeStretch.cgFloat
|
|
28
|
+
startFrame = layer.startTime.cgFloat
|
|
29
|
+
keypathName = layer.name
|
|
30
|
+
childKeypaths = [transformNode.transformProperties]
|
|
31
|
+
super.init()
|
|
32
|
+
anchorPoint = .zero
|
|
33
|
+
actions = [
|
|
34
|
+
"opacity": NSNull(),
|
|
35
|
+
"transform": NSNull(),
|
|
36
|
+
"bounds": NSNull(),
|
|
37
|
+
"anchorPoint": NSNull(),
|
|
38
|
+
"sublayerTransform": NSNull(),
|
|
39
|
+
"shadowOpacity": NSNull(),
|
|
40
|
+
"shadowOffset": NSNull(),
|
|
41
|
+
"shadowColor": NSNull(),
|
|
42
|
+
"shadowRadius": NSNull(),
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
contentsLayer.anchorPoint = .zero
|
|
46
|
+
contentsLayer.bounds = CGRect(origin: .zero, size: size)
|
|
47
|
+
contentsLayer.actions = [
|
|
48
|
+
"opacity": NSNull(),
|
|
49
|
+
"transform": NSNull(),
|
|
50
|
+
"bounds": NSNull(),
|
|
51
|
+
"anchorPoint": NSNull(),
|
|
52
|
+
"sublayerTransform": NSNull(),
|
|
53
|
+
"hidden": NSNull(),
|
|
54
|
+
]
|
|
55
|
+
compositingFilter = layer.blendMode.filterName
|
|
56
|
+
addSublayer(contentsLayer)
|
|
57
|
+
|
|
58
|
+
if let maskLayer {
|
|
59
|
+
contentsLayer.mask = maskLayer
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// There are two different drop shadow schemas, either using `DropShadowEffect` or `DropShadowStyle`.
|
|
63
|
+
// If both happen to be present, prefer the `DropShadowEffect` (which is the drop shadow schema
|
|
64
|
+
// supported on other platforms).
|
|
65
|
+
let dropShadowEffect = layer.effects.first(where: { $0 is DropShadowEffect }) as? DropShadowModel
|
|
66
|
+
let dropShadowStyle = layer.styles.first(where: { $0 is DropShadowStyle }) as? DropShadowModel
|
|
67
|
+
if let dropShadowModel = dropShadowEffect ?? dropShadowStyle {
|
|
68
|
+
layerEffectNodes.append(DropShadowNode(model: dropShadowModel))
|
|
69
|
+
}
|
|
70
|
+
name = layer.name
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
override init(layer: Any) {
|
|
74
|
+
/// Used for creating shadow model layers. Read More here: https://developer.apple.com/documentation/quartzcore/calayer/1410842-init
|
|
75
|
+
guard let layer = layer as? CompositionLayer else {
|
|
76
|
+
fatalError("Wrong Layer Class")
|
|
77
|
+
}
|
|
78
|
+
transformNode = layer.transformNode
|
|
79
|
+
matteType = layer.matteType
|
|
80
|
+
inFrame = layer.inFrame
|
|
81
|
+
outFrame = layer.outFrame
|
|
82
|
+
timeStretch = layer.timeStretch
|
|
83
|
+
startFrame = layer.startFrame
|
|
84
|
+
keypathName = layer.keypathName
|
|
85
|
+
childKeypaths = [transformNode.transformProperties]
|
|
86
|
+
maskLayer = nil
|
|
87
|
+
layerEffectNodes = layer.layerEffectNodes
|
|
88
|
+
super.init(layer: layer)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
required init?(coder _: NSCoder) {
|
|
92
|
+
fatalError("init(coder:) has not been implemented")
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// MARK: Internal
|
|
96
|
+
|
|
97
|
+
weak var layerDelegate: CompositionLayerDelegate?
|
|
98
|
+
|
|
99
|
+
let transformNode: LayerTransformNode
|
|
100
|
+
|
|
101
|
+
let contentsLayer = CALayer()
|
|
102
|
+
|
|
103
|
+
let maskLayer: MaskContainerLayer?
|
|
104
|
+
|
|
105
|
+
let matteType: MatteType?
|
|
106
|
+
|
|
107
|
+
let inFrame: CGFloat
|
|
108
|
+
let outFrame: CGFloat
|
|
109
|
+
let startFrame: CGFloat
|
|
110
|
+
let timeStretch: CGFloat
|
|
111
|
+
|
|
112
|
+
var layerEffectNodes = [LayerEffectNode]()
|
|
113
|
+
|
|
114
|
+
let keypathName: String
|
|
115
|
+
|
|
116
|
+
final var childKeypaths: [KeypathSearchable]
|
|
117
|
+
|
|
118
|
+
var renderScale: CGFloat = 1 {
|
|
119
|
+
didSet {
|
|
120
|
+
updateRenderScale()
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
var matteLayer: CompositionLayer? {
|
|
125
|
+
didSet {
|
|
126
|
+
if let matte = matteLayer {
|
|
127
|
+
if let type = matteType, type == .invert {
|
|
128
|
+
mask = InvertedMatteLayer(inputMatte: matte)
|
|
129
|
+
} else {
|
|
130
|
+
mask = matte
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
mask = nil
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
var keypathProperties: [String: AnyNodeProperty] {
|
|
139
|
+
[:]
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
var keypathLayer: CALayer? {
|
|
143
|
+
contentsLayer
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
final func displayWithFrame(frame: CGFloat, forceUpdates: Bool) {
|
|
147
|
+
transformNode.updateTree(frame, forceUpdates: forceUpdates)
|
|
148
|
+
let layerVisible = frame.isInRangeOrEqual(inFrame, outFrame)
|
|
149
|
+
/// Only update contents if current time is within the layers time bounds.
|
|
150
|
+
if layerVisible {
|
|
151
|
+
displayContentsWithFrame(frame: frame, forceUpdates: forceUpdates)
|
|
152
|
+
maskLayer?.updateWithFrame(frame: frame, forceUpdates: forceUpdates)
|
|
153
|
+
}
|
|
154
|
+
contentsLayer.transform = transformNode.globalTransform
|
|
155
|
+
contentsLayer.opacity = transformNode.opacity
|
|
156
|
+
contentsLayer.isHidden = !layerVisible
|
|
157
|
+
layerDelegate?.frameUpdated(frame: frame)
|
|
158
|
+
|
|
159
|
+
for layerEffectNode in layerEffectNodes {
|
|
160
|
+
layerEffectNode.updateWithFrame(layer: self, frame: frame)
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
func displayContentsWithFrame(frame _: CGFloat, forceUpdates _: Bool) {
|
|
165
|
+
/// To be overridden by subclass
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
func updateRenderScale() {
|
|
169
|
+
contentsScale = renderScale
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// MARK: - CompositionLayerDelegate
|
|
174
|
+
|
|
175
|
+
protocol CompositionLayerDelegate: AnyObject {
|
|
176
|
+
func frameUpdated(frame: CGFloat)
|
|
177
|
+
}
|