@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,45 @@
|
|
|
1
|
+
// Created by Tyler Hedrick on 5/26/20.
|
|
2
|
+
// Copyright © 2020 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
// MARK: - BehaviorsConfigurableView
|
|
5
|
+
|
|
6
|
+
/// A view that can be configured with a `Behaviors` instance that contains the view's non-
|
|
7
|
+
/// `Equatable` properties that can be updated on view instances after initialization, e.g. callback
|
|
8
|
+
/// closures or delegates.
|
|
9
|
+
///
|
|
10
|
+
/// Since it is not possible to establish the equality of two `Behaviors` instances, `Behaviors`
|
|
11
|
+
/// will be set more often than `ContentConfigurableView.Content`, needing to be updated every time
|
|
12
|
+
/// the view's corresponding `EpoxyModeled` instance is updated. As such, setting behaviors should
|
|
13
|
+
/// be as lightweight as possible.
|
|
14
|
+
///
|
|
15
|
+
/// Properties of `Behaviors` should be mutually exclusive with the properties in the
|
|
16
|
+
/// `StyledView.Style` and `ContentConfigurableView.Content`.
|
|
17
|
+
///
|
|
18
|
+
/// - SeeAlso: `ContentConfigurableView`
|
|
19
|
+
/// - SeeAlso: `StyledView`
|
|
20
|
+
/// - SeeAlso: `EpoxyableView`
|
|
21
|
+
protocol BehaviorsConfigurableView: ViewType {
|
|
22
|
+
/// The non-`Equatable` properties that can be changed over of the lifecycle this View's
|
|
23
|
+
/// instances, e.g. callback closures or delegates.
|
|
24
|
+
///
|
|
25
|
+
/// Defaults to `Never` for views that do not have `Behaviors`.
|
|
26
|
+
associatedtype Behaviors = Never
|
|
27
|
+
|
|
28
|
+
/// Updates the behaviors of this view to those in the given `behaviors`, else resets the
|
|
29
|
+
/// behaviors if `nil`.
|
|
30
|
+
///
|
|
31
|
+
/// Behaviors are optional as they must be "resettable" in order for Epoxy to reset the behaviors
|
|
32
|
+
/// on your view when no behaviors are provided.
|
|
33
|
+
func setBehaviors(_ behaviors: Self.Behaviors?)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// MARK: Defaults
|
|
37
|
+
|
|
38
|
+
extension BehaviorsConfigurableView where Behaviors == Never {
|
|
39
|
+
func setBehaviors(_ behaviors: Never?) {
|
|
40
|
+
switch behaviors {
|
|
41
|
+
case nil:
|
|
42
|
+
break
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Created by Laura Skelton on 5/30/17.
|
|
2
|
+
// Copyright © 2017 Airbnb. All rights reserved.
|
|
3
|
+
|
|
4
|
+
// MARK: - ContentConfigurableView
|
|
5
|
+
|
|
6
|
+
/// A view that can be configured with a `Content` instance that contains the view's `Equatable`
|
|
7
|
+
/// properties that can be updated on existing view instances, e.g. text `String`s or image `URL`s.
|
|
8
|
+
///
|
|
9
|
+
/// For performance, it is generally expected that `Content` is only set when it is not equal to the
|
|
10
|
+
/// previous `Content` instance that has been set on a view instance. As a further optimization,
|
|
11
|
+
/// this view can guard updates on the equality of each property of the `Content` against the
|
|
12
|
+
/// current property value when set.
|
|
13
|
+
///
|
|
14
|
+
/// Properties of `Content` should be mutually exclusive with the properties of the
|
|
15
|
+
/// `StyledView.Style` and `BehaviorsConfigurableView.Behaviors`.
|
|
16
|
+
///
|
|
17
|
+
/// - SeeAlso: `BehaviorsConfigurableView`
|
|
18
|
+
/// - SeeAlso: `StyledView`
|
|
19
|
+
/// - SeeAlso: `EpoxyableView`
|
|
20
|
+
protocol ContentConfigurableView: ViewType {
|
|
21
|
+
/// The `Equatable` properties that can be updated on instances of this view, e.g. text `String`s
|
|
22
|
+
/// or image `URL`s.
|
|
23
|
+
///
|
|
24
|
+
/// Defaults to `Never` for views that do not have `Content`.
|
|
25
|
+
associatedtype Content: Equatable = Never
|
|
26
|
+
|
|
27
|
+
/// Updates the content of this view to the properties of the given `content`, optionally
|
|
28
|
+
/// animating the updates.
|
|
29
|
+
func setContent(_ content: Self.Content, animated: Bool)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// MARK: Defaults
|
|
33
|
+
|
|
34
|
+
extension ContentConfigurableView where Content == Never {
|
|
35
|
+
func setContent(_: Never, animated _: Bool) { }
|
|
36
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Created by eric_horacek on 1/13/21.
|
|
2
|
+
// Copyright © 2021 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
/// A `UIView` that can be declaratively configured via a concrete `EpoxyableModel` instance.
|
|
5
|
+
typealias EpoxyableView = BehaviorsConfigurableView & ContentConfigurableView & StyledView
|
package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/StyledView.swift
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Created by Laura Skelton on 4/14/16.
|
|
2
|
+
// Copyright © 2016 Airbnb. All rights reserved.
|
|
3
|
+
|
|
4
|
+
// MARK: - StyledView
|
|
5
|
+
|
|
6
|
+
/// A view that can be initialized with a `Style` instance that contains the view's invariant
|
|
7
|
+
/// configuration parameters, e.g. the `UIButton.ButtonType` of a `UIButton`.
|
|
8
|
+
///
|
|
9
|
+
/// A `Style` is expected to be invariant over the lifecycle of the view; it should not possible to
|
|
10
|
+
/// change the `Style` of a view after it is created. All variant properties of the view should
|
|
11
|
+
/// either be included in the `ContentConfigurableView.Content` if they are `Equatable` (e.g. a
|
|
12
|
+
/// title `String`) or the `BehaviorsConfigurableView.Behaviors` if they are not (e.g. a callback
|
|
13
|
+
/// closure).
|
|
14
|
+
///
|
|
15
|
+
/// A `Style` is `Hashable` to allow views of the same type with equal `Style`s to be reused by
|
|
16
|
+
/// establishing whether their invariant `Style` instances are equal.
|
|
17
|
+
///
|
|
18
|
+
/// Properties of `Style` should be mutually exclusive with the properties of the
|
|
19
|
+
/// `ContentConfigurableView.Content` and `BehaviorsConfigurableView.Behaviors`.
|
|
20
|
+
///
|
|
21
|
+
/// - SeeAlso: `ContentConfigurableView`
|
|
22
|
+
/// - SeeAlso: `BehaviorsConfigurableView`
|
|
23
|
+
/// - SeeAlso: `EpoxyableView`
|
|
24
|
+
protocol StyledView: ViewType {
|
|
25
|
+
/// Creates an instance of this view configured with the given `Style` instance.
|
|
26
|
+
init(style: Style)
|
|
27
|
+
|
|
28
|
+
/// The style type of this view, passed into its initializer to configure the resulting instance.
|
|
29
|
+
///
|
|
30
|
+
/// Defaults to `Never` for views that do not have a `Style`.
|
|
31
|
+
associatedtype Style: Hashable = Never
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// MARK: Defaults
|
|
36
|
+
|
|
37
|
+
extension StyledView where Style == Never {
|
|
38
|
+
init(style: Never) {
|
|
39
|
+
// An empty switch is required to silence the "'self.init' isn't called on all paths before
|
|
40
|
+
// returning from initializer" error.
|
|
41
|
+
switch style { }
|
|
42
|
+
}
|
|
43
|
+
}
|
package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ViewType.swift
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Created by Cal Stephens on 6/26/23.
|
|
2
|
+
// Copyright © 2023 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
import SwiftUI
|
|
5
|
+
|
|
6
|
+
#if os(iOS) || os(tvOS) || os(visionOS)
|
|
7
|
+
import UIKit
|
|
8
|
+
|
|
9
|
+
/// The platform's main view type.
|
|
10
|
+
/// Either `UIView` on iOS/tvOS or `NSView` on macOS.
|
|
11
|
+
typealias ViewType = UIView
|
|
12
|
+
|
|
13
|
+
/// The platform's SwiftUI view representable type.
|
|
14
|
+
/// Either `UIViewRepresentable` on iOS/tvOS or `NSViewRepresentable` on macOS.
|
|
15
|
+
typealias ViewRepresentableType = UIViewRepresentable
|
|
16
|
+
|
|
17
|
+
/// The platform's layout constraint priority type.
|
|
18
|
+
/// Either `UILayoutPriority` on iOS/tvOS or `NSLayoutConstraint.Priority` on macOS.
|
|
19
|
+
typealias LayoutPriorityType = UILayoutPriority
|
|
20
|
+
|
|
21
|
+
extension ViewRepresentableType {
|
|
22
|
+
/// The platform's view type for `ViewRepresentableType`.
|
|
23
|
+
/// Either `UIViewType` on iOS/tvOS or `NSViewType` on macOS.
|
|
24
|
+
typealias RepresentableViewType = UIViewType
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
#elseif os(macOS)
|
|
28
|
+
import AppKit
|
|
29
|
+
|
|
30
|
+
/// The platform's main view type.
|
|
31
|
+
/// Either `UIView` on iOS/tvOS, or `NSView` on macOS.
|
|
32
|
+
typealias ViewType = NSView
|
|
33
|
+
|
|
34
|
+
/// The platform's SwiftUI view representable type.
|
|
35
|
+
/// Either `UIViewRepresentable` on iOS/tvOS, or `NSViewRepresentable` on macOS.
|
|
36
|
+
typealias ViewRepresentableType = NSViewRepresentable
|
|
37
|
+
|
|
38
|
+
/// The platform's layout constraint priority type.
|
|
39
|
+
/// Either `UILayoutPriority` on iOS/tvOS, or `NSLayoutConstraint.Priority` on macOS.
|
|
40
|
+
typealias LayoutPriorityType = NSLayoutConstraint.Priority
|
|
41
|
+
|
|
42
|
+
extension ViewRepresentableType {
|
|
43
|
+
/// The platform's view type for `ViewRepresentableType`.
|
|
44
|
+
/// Either `UIViewType` on iOS/tvOS or `NSViewType` on macOS.
|
|
45
|
+
typealias RepresentableViewType = NSViewType
|
|
46
|
+
}
|
|
47
|
+
#endif
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
//
|
|
2
|
+
// LRUCache.swift
|
|
3
|
+
// LRUCache
|
|
4
|
+
//
|
|
5
|
+
// Version 1.0.2
|
|
6
|
+
//
|
|
7
|
+
// Created by Nick Lockwood on 05/08/2021.
|
|
8
|
+
// Copyright © 2021 Nick Lockwood. All rights reserved.
|
|
9
|
+
//
|
|
10
|
+
// Distributed under the permissive MIT license
|
|
11
|
+
// Get the latest version from here:
|
|
12
|
+
//
|
|
13
|
+
// https://github.com/nicklockwood/LRUCache
|
|
14
|
+
//
|
|
15
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
16
|
+
// of this software and associated documentation files (the "Software"), to deal
|
|
17
|
+
// in the Software without restriction, including without limitation the rights
|
|
18
|
+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
19
|
+
// copies of the Software, and to permit persons to whom the Software is
|
|
20
|
+
// furnished to do so, subject to the following conditions:
|
|
21
|
+
//
|
|
22
|
+
// The above copyright notice and this permission notice shall be included in all
|
|
23
|
+
// copies or substantial portions of the Software.
|
|
24
|
+
//
|
|
25
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
26
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
27
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
29
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
|
+
// SOFTWARE.
|
|
32
|
+
//
|
|
33
|
+
|
|
34
|
+
import Foundation
|
|
35
|
+
|
|
36
|
+
#if canImport(UIKit)
|
|
37
|
+
import UIKit
|
|
38
|
+
|
|
39
|
+
/// Notification that cache should be cleared
|
|
40
|
+
let LRUCacheMemoryWarningNotification: NSNotification.Name =
|
|
41
|
+
UIApplication.didReceiveMemoryWarningNotification
|
|
42
|
+
|
|
43
|
+
#else
|
|
44
|
+
|
|
45
|
+
/// Notification that cache should be cleared
|
|
46
|
+
let LRUCacheMemoryWarningNotification =
|
|
47
|
+
NSNotification.Name("LRUCacheMemoryWarningNotification")
|
|
48
|
+
|
|
49
|
+
#endif
|
|
50
|
+
|
|
51
|
+
// MARK: - LRUCache
|
|
52
|
+
|
|
53
|
+
final class LRUCache<Key: Hashable, Value> {
|
|
54
|
+
|
|
55
|
+
// MARK: Lifecycle
|
|
56
|
+
|
|
57
|
+
/// Initialize the cache with the specified `totalCostLimit` and `countLimit`
|
|
58
|
+
init(
|
|
59
|
+
totalCostLimit: Int = .max,
|
|
60
|
+
countLimit: Int = .max,
|
|
61
|
+
notificationCenter: NotificationCenter = .default
|
|
62
|
+
) {
|
|
63
|
+
self.totalCostLimit = totalCostLimit
|
|
64
|
+
self.countLimit = countLimit
|
|
65
|
+
self.notificationCenter = notificationCenter
|
|
66
|
+
|
|
67
|
+
token = notificationCenter.addObserver(
|
|
68
|
+
forName: LRUCacheMemoryWarningNotification,
|
|
69
|
+
object: nil,
|
|
70
|
+
queue: nil
|
|
71
|
+
) { [weak self] _ in
|
|
72
|
+
self?.removeAllValues()
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
deinit {
|
|
77
|
+
if let token {
|
|
78
|
+
notificationCenter.removeObserver(token)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// MARK: Internal
|
|
83
|
+
|
|
84
|
+
/// The current total cost of values in the cache
|
|
85
|
+
private(set) var totalCost = 0
|
|
86
|
+
|
|
87
|
+
/// The maximum total cost permitted
|
|
88
|
+
var totalCostLimit: Int {
|
|
89
|
+
didSet { clean() }
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/// The maximum number of values permitted
|
|
93
|
+
var countLimit: Int {
|
|
94
|
+
didSet { clean() }
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// MARK: Private
|
|
98
|
+
|
|
99
|
+
private var values = [Key: Container]()
|
|
100
|
+
private unowned(unsafe) var head: Container?
|
|
101
|
+
private unowned(unsafe) var tail: Container?
|
|
102
|
+
private let lock = NSLock()
|
|
103
|
+
private var token: AnyObject?
|
|
104
|
+
private let notificationCenter: NotificationCenter
|
|
105
|
+
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
extension LRUCache {
|
|
109
|
+
/// The number of values currently stored in the cache
|
|
110
|
+
var count: Int {
|
|
111
|
+
values.count
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/// Is the cache empty?
|
|
115
|
+
var isEmpty: Bool {
|
|
116
|
+
values.isEmpty
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/// Returns all values in the cache from oldest to newest
|
|
120
|
+
var allValues: [Value] {
|
|
121
|
+
lock.lock()
|
|
122
|
+
defer { lock.unlock() }
|
|
123
|
+
var values = [Value]()
|
|
124
|
+
var next = head
|
|
125
|
+
while let container = next {
|
|
126
|
+
values.append(container.value)
|
|
127
|
+
next = container.next
|
|
128
|
+
}
|
|
129
|
+
return values
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/// Insert a value into the cache with optional `cost`
|
|
133
|
+
func setValue(_ value: Value?, forKey key: Key, cost: Int = 0) {
|
|
134
|
+
guard let value else {
|
|
135
|
+
removeValue(forKey: key)
|
|
136
|
+
return
|
|
137
|
+
}
|
|
138
|
+
lock.lock()
|
|
139
|
+
if let container = values[key] {
|
|
140
|
+
container.value = value
|
|
141
|
+
totalCost -= container.cost
|
|
142
|
+
container.cost = cost
|
|
143
|
+
remove(container)
|
|
144
|
+
append(container)
|
|
145
|
+
} else {
|
|
146
|
+
let container = Container(
|
|
147
|
+
value: value,
|
|
148
|
+
cost: cost,
|
|
149
|
+
key: key
|
|
150
|
+
)
|
|
151
|
+
values[key] = container
|
|
152
|
+
append(container)
|
|
153
|
+
}
|
|
154
|
+
totalCost += cost
|
|
155
|
+
lock.unlock()
|
|
156
|
+
clean()
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/// Remove a value from the cache and return it
|
|
160
|
+
@discardableResult
|
|
161
|
+
func removeValue(forKey key: Key) -> Value? {
|
|
162
|
+
lock.lock()
|
|
163
|
+
defer { lock.unlock() }
|
|
164
|
+
guard let container = values.removeValue(forKey: key) else {
|
|
165
|
+
return nil
|
|
166
|
+
}
|
|
167
|
+
remove(container)
|
|
168
|
+
totalCost -= container.cost
|
|
169
|
+
return container.value
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/// Fetch a value from the cache
|
|
173
|
+
func value(forKey key: Key) -> Value? {
|
|
174
|
+
lock.lock()
|
|
175
|
+
defer { lock.unlock() }
|
|
176
|
+
if let container = values[key] {
|
|
177
|
+
remove(container)
|
|
178
|
+
append(container)
|
|
179
|
+
return container.value
|
|
180
|
+
}
|
|
181
|
+
return nil
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/// Remove all values from the cache
|
|
185
|
+
func removeAllValues() {
|
|
186
|
+
lock.lock()
|
|
187
|
+
values.removeAll()
|
|
188
|
+
head = nil
|
|
189
|
+
tail = nil
|
|
190
|
+
lock.unlock()
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
extension LRUCache {
|
|
195
|
+
|
|
196
|
+
// MARK: Fileprivate
|
|
197
|
+
|
|
198
|
+
fileprivate final class Container {
|
|
199
|
+
|
|
200
|
+
// MARK: Lifecycle
|
|
201
|
+
|
|
202
|
+
init(value: Value, cost: Int, key: Key) {
|
|
203
|
+
self.value = value
|
|
204
|
+
self.cost = cost
|
|
205
|
+
self.key = key
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// MARK: Internal
|
|
209
|
+
|
|
210
|
+
var value: Value
|
|
211
|
+
var cost: Int
|
|
212
|
+
let key: Key
|
|
213
|
+
unowned(unsafe) var prev: Container?
|
|
214
|
+
unowned(unsafe) var next: Container?
|
|
215
|
+
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// MARK: Private
|
|
219
|
+
|
|
220
|
+
/// Remove container from list (must be called inside lock)
|
|
221
|
+
private func remove(_ container: Container) {
|
|
222
|
+
if head === container {
|
|
223
|
+
head = container.next
|
|
224
|
+
}
|
|
225
|
+
if tail === container {
|
|
226
|
+
tail = container.prev
|
|
227
|
+
}
|
|
228
|
+
container.next?.prev = container.prev
|
|
229
|
+
container.prev?.next = container.next
|
|
230
|
+
container.next = nil
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/// Append container to list (must be called inside lock)
|
|
234
|
+
private func append(_ container: Container) {
|
|
235
|
+
assert(container.next == nil)
|
|
236
|
+
if head == nil {
|
|
237
|
+
head = container
|
|
238
|
+
}
|
|
239
|
+
container.prev = tail
|
|
240
|
+
tail?.next = container
|
|
241
|
+
tail = container
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/// Remove expired values (must be called outside lock)
|
|
245
|
+
private func clean() {
|
|
246
|
+
lock.lock()
|
|
247
|
+
defer { lock.unlock() }
|
|
248
|
+
while
|
|
249
|
+
totalCost > totalCostLimit || count > countLimit,
|
|
250
|
+
let container = head
|
|
251
|
+
{
|
|
252
|
+
remove(container)
|
|
253
|
+
values.removeValue(forKey: container.key)
|
|
254
|
+
totalCost -= container.cost
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
## LRUCache
|
|
2
|
+
|
|
3
|
+
This directory includes the source code of the LRUCache library, from the following release:
|
|
4
|
+
https://github.com/nicklockwood/LRUCache/releases/tag/1.0.4
|
|
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 LRUCache 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 LRUCache.
|
|
16
|
+
When doing this, follow these steps:
|
|
17
|
+
|
|
18
|
+
1. Download the latest release from https://github.com/nicklockwood/LRUCache
|
|
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 EpoxyCore APIs.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
## ZipFoundation
|
|
2
|
+
|
|
3
|
+
This directory includes the source code of libraries that are embedded within lottie-ios.
|
|
4
|
+
|
|
5
|
+
This includes:
|
|
6
|
+
- ZipFoundation (https://github.com/weichsel/ZIPFoundation)
|
|
7
|
+
- EpoxyCore (https://github.com/airbnb/epoxy-ios)
|
|
8
|
+
- LRUCache (https://github.com/nicklockwood/LRUCache)
|
|
9
|
+
|
|
10
|
+
Lottie is distributed via multiple package managers (SPM, Cocoapods, Carthage, and NPM),
|
|
11
|
+
each with different packaging and compilation requirements.
|
|
12
|
+
|
|
13
|
+
Due to limitations of these package managers, we can't depend on / import
|
|
14
|
+
a separates modules / libraries. Instead, we include the source
|
|
15
|
+
directly within the Lottie library and compile everything as a single unit.
|
|
16
|
+
|
|
17
|
+
### Update instructions
|
|
18
|
+
|
|
19
|
+
From time to time we may need to update to a more recent version of one of these libraries.
|
|
20
|
+
When doing this, follow these steps:
|
|
21
|
+
|
|
22
|
+
1. Download the latest release of the library and replace the source code in
|
|
23
|
+
the corresponding directory with the updated code.
|
|
24
|
+
|
|
25
|
+
2. Update the URL in the directory's README.md to indicate what release is being used.
|
|
26
|
+
|
|
27
|
+
3. Change all of the `public` symbols defined in the module to instead be `internal`
|
|
28
|
+
to prevent Lottie from exposing any APIs from other libraries.
|
|
29
|
+
|
|
30
|
+
### Adding a new dependencies
|
|
31
|
+
|
|
32
|
+
1. Create a subdirectory in `EmbeddedLibraries` for the new dependency.
|
|
33
|
+
|
|
34
|
+
2. Add the dependency to the list at the top of this file.
|
|
35
|
+
|
|
36
|
+
3. Add a `README.md` to the directory for the new library, using the same formatting as the `README.md` file used by other dependencies.
|
|
37
|
+
|
|
38
|
+
4. Exclude the new `README.md` file from the lottie-ios package by adding it to the `exclude:` list in `Package.swift`.
|
|
39
|
+
|
|
40
|
+
5. Change all of the `public` symbols defined in the module to instead be `internal`
|
|
41
|
+
to prevent Lottie from exposing any APIs from other libraries.
|
|
42
|
+
|
|
43
|
+
6. If the dependency provides a privacy manifest, incorporate content from that dependency's privacy manifest into Lottie's privacy manifest.
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Archive+BackingConfiguration.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 Archive {
|
|
14
|
+
|
|
15
|
+
struct BackingConfiguration {
|
|
16
|
+
let file: FILEPointer
|
|
17
|
+
let endOfCentralDirectoryRecord: EndOfCentralDirectoryRecord
|
|
18
|
+
let zip64EndOfCentralDirectory: ZIP64EndOfCentralDirectory?
|
|
19
|
+
#if swift(>=5.0)
|
|
20
|
+
let memoryFile: MemoryFile?
|
|
21
|
+
|
|
22
|
+
init(
|
|
23
|
+
file: FILEPointer,
|
|
24
|
+
endOfCentralDirectoryRecord: EndOfCentralDirectoryRecord,
|
|
25
|
+
zip64EndOfCentralDirectory: ZIP64EndOfCentralDirectory? = nil,
|
|
26
|
+
memoryFile: MemoryFile? = nil
|
|
27
|
+
) {
|
|
28
|
+
self.file = file
|
|
29
|
+
self.endOfCentralDirectoryRecord = endOfCentralDirectoryRecord
|
|
30
|
+
self.zip64EndOfCentralDirectory = zip64EndOfCentralDirectory
|
|
31
|
+
self.memoryFile = memoryFile
|
|
32
|
+
}
|
|
33
|
+
#else
|
|
34
|
+
|
|
35
|
+
init(
|
|
36
|
+
file: FILEPointer,
|
|
37
|
+
endOfCentralDirectoryRecord: EndOfCentralDirectoryRecord,
|
|
38
|
+
zip64EndOfCentralDirectory: ZIP64EndOfCentralDirectory?
|
|
39
|
+
) {
|
|
40
|
+
self.file = file
|
|
41
|
+
self.endOfCentralDirectoryRecord = endOfCentralDirectoryRecord
|
|
42
|
+
self.zip64EndOfCentralDirectory = zip64EndOfCentralDirectory
|
|
43
|
+
}
|
|
44
|
+
#endif
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
static func makeBackingConfiguration(for url: URL, mode: AccessMode) throws
|
|
48
|
+
-> BackingConfiguration
|
|
49
|
+
{
|
|
50
|
+
let fileManager = FileManager()
|
|
51
|
+
switch mode {
|
|
52
|
+
case .read:
|
|
53
|
+
let fileSystemRepresentation = fileManager.fileSystemRepresentation(withPath: url.path)
|
|
54
|
+
guard let archiveFile = fopen(fileSystemRepresentation, "rb") else {
|
|
55
|
+
throw POSIXError(errno, path: url.path)
|
|
56
|
+
}
|
|
57
|
+
guard let (eocdRecord, zip64EOCD) = Archive.scanForEndOfCentralDirectoryRecord(in: archiveFile) else {
|
|
58
|
+
fclose(archiveFile)
|
|
59
|
+
throw ArchiveError.missingEndOfCentralDirectoryRecord
|
|
60
|
+
}
|
|
61
|
+
return BackingConfiguration(
|
|
62
|
+
file: archiveFile,
|
|
63
|
+
endOfCentralDirectoryRecord: eocdRecord,
|
|
64
|
+
zip64EndOfCentralDirectory: zip64EOCD
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
case .create:
|
|
68
|
+
let endOfCentralDirectoryRecord = EndOfCentralDirectoryRecord(
|
|
69
|
+
numberOfDisk: 0,
|
|
70
|
+
numberOfDiskStart: 0,
|
|
71
|
+
totalNumberOfEntriesOnDisk: 0,
|
|
72
|
+
totalNumberOfEntriesInCentralDirectory: 0,
|
|
73
|
+
sizeOfCentralDirectory: 0,
|
|
74
|
+
offsetToStartOfCentralDirectory: 0,
|
|
75
|
+
zipFileCommentLength: 0,
|
|
76
|
+
zipFileCommentData: Data()
|
|
77
|
+
)
|
|
78
|
+
try endOfCentralDirectoryRecord.data.write(to: url, options: .withoutOverwriting)
|
|
79
|
+
fallthrough
|
|
80
|
+
|
|
81
|
+
case .update:
|
|
82
|
+
let fileSystemRepresentation = fileManager.fileSystemRepresentation(withPath: url.path)
|
|
83
|
+
guard let archiveFile = fopen(fileSystemRepresentation, "rb+") else {
|
|
84
|
+
throw POSIXError(errno, path: url.path)
|
|
85
|
+
}
|
|
86
|
+
guard let (eocdRecord, zip64EOCD) = Archive.scanForEndOfCentralDirectoryRecord(in: archiveFile) else {
|
|
87
|
+
fclose(archiveFile)
|
|
88
|
+
throw ArchiveError.missingEndOfCentralDirectoryRecord
|
|
89
|
+
}
|
|
90
|
+
fseeko(archiveFile, 0, SEEK_SET)
|
|
91
|
+
return BackingConfiguration(
|
|
92
|
+
file: archiveFile,
|
|
93
|
+
endOfCentralDirectoryRecord: eocdRecord,
|
|
94
|
+
zip64EndOfCentralDirectory: zip64EOCD
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
#if swift(>=5.0)
|
|
100
|
+
static func makeBackingConfiguration(for data: Data, mode: AccessMode) throws
|
|
101
|
+
-> BackingConfiguration
|
|
102
|
+
{
|
|
103
|
+
let memoryFile = MemoryFile(data: data)
|
|
104
|
+
let archiveFile = try memoryFile.open(mode: mode)
|
|
105
|
+
switch mode {
|
|
106
|
+
case .read:
|
|
107
|
+
guard let (eocdRecord, zip64EOCD) = Archive.scanForEndOfCentralDirectoryRecord(in: archiveFile) else {
|
|
108
|
+
throw ArchiveError.missingEndOfCentralDirectoryRecord
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return BackingConfiguration(
|
|
112
|
+
file: archiveFile,
|
|
113
|
+
endOfCentralDirectoryRecord: eocdRecord,
|
|
114
|
+
zip64EndOfCentralDirectory: zip64EOCD,
|
|
115
|
+
memoryFile: memoryFile
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
case .create:
|
|
119
|
+
let endOfCentralDirectoryRecord = EndOfCentralDirectoryRecord(
|
|
120
|
+
numberOfDisk: 0,
|
|
121
|
+
numberOfDiskStart: 0,
|
|
122
|
+
totalNumberOfEntriesOnDisk: 0,
|
|
123
|
+
totalNumberOfEntriesInCentralDirectory: 0,
|
|
124
|
+
sizeOfCentralDirectory: 0,
|
|
125
|
+
offsetToStartOfCentralDirectory: 0,
|
|
126
|
+
zipFileCommentLength: 0,
|
|
127
|
+
zipFileCommentData: Data()
|
|
128
|
+
)
|
|
129
|
+
_ = endOfCentralDirectoryRecord.data.withUnsafeBytes { (buffer: UnsafeRawBufferPointer) in
|
|
130
|
+
fwrite(buffer.baseAddress, buffer.count, 1, archiveFile) // Errors handled during read
|
|
131
|
+
}
|
|
132
|
+
fallthrough
|
|
133
|
+
|
|
134
|
+
case .update:
|
|
135
|
+
guard let (eocdRecord, zip64EOCD) = Archive.scanForEndOfCentralDirectoryRecord(in: archiveFile) else {
|
|
136
|
+
throw ArchiveError.missingEndOfCentralDirectoryRecord
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
fseeko(archiveFile, 0, SEEK_SET)
|
|
140
|
+
return BackingConfiguration(
|
|
141
|
+
file: archiveFile,
|
|
142
|
+
endOfCentralDirectoryRecord: eocdRecord,
|
|
143
|
+
zip64EndOfCentralDirectory: zip64EOCD,
|
|
144
|
+
memoryFile: memoryFile
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
#endif
|
|
149
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Archive+Deprecated.swift
|
|
3
|
+
// ZIPFoundation
|
|
4
|
+
//
|
|
5
|
+
// Created by Thomas Zoechling on 06.02.23.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
extension Archive {
|
|
11
|
+
|
|
12
|
+
@available(*, deprecated, message: "Please use the throwing initializer.")
|
|
13
|
+
convenience init?(url: URL, accessMode mode: AccessMode, preferredEncoding: String.Encoding? = nil) {
|
|
14
|
+
try? self.init(url: url, accessMode: mode, pathEncoding: preferredEncoding)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#if swift(>=5.0)
|
|
18
|
+
@available(*, deprecated, message: "Please use the throwing initializer.")
|
|
19
|
+
convenience init?(data: Data = Data(), accessMode mode: AccessMode, preferredEncoding: String.Encoding? = nil) {
|
|
20
|
+
try? self.init(data: data, accessMode: mode, pathEncoding: preferredEncoding)
|
|
21
|
+
}
|
|
22
|
+
#endif
|
|
23
|
+
}
|