@dotlottie/dotlottie-js
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -15,3 +15,3 @@ import { strToU8, zip, unzip, strFromU8 } from 'fflate'; | ||
name: "@dotlottie/dotlottie-js", | ||
version: "0.4.1", | ||
version: "0.4.2", | ||
type: "module", | ||
@@ -18,0 +18,0 @@ description: "This library helps in creating and modifying .lottie files.", |
import { unzip, strFromU8, strToU8, zip } from 'fflate'; | ||
import { nativeEnum, object, optional, boolean, string, union, literal, number, array, record, any, safeParse } from 'valibot'; | ||
import { nativeEnum, object, optional, boolean, string, union, literal, number, array, record, any, safeParse, flatten } from 'valibot'; | ||
import phash from 'sharp-phash'; | ||
@@ -15,3 +15,3 @@ | ||
name: "@dotlottie/dotlottie-js", | ||
version: "0.4.1", | ||
version: "0.4.2", | ||
type: "module", | ||
@@ -281,3 +281,3 @@ description: "This library helps in creating and modifying .lottie files.", | ||
if (!manifestValidationResult.success) { | ||
const error = `Invalid .lottie file, manifest.json structure is invalid, ${manifestValidationResult.error.toString()}`; | ||
const error = `Invalid .lottie file, manifest.json structure is invalid, ${JSON.stringify(flatten(manifestValidationResult.error).nested, null, 2)}`; | ||
return { success: false, error }; | ||
@@ -317,3 +317,6 @@ } | ||
async function getImages(dotLottie, filter) { | ||
const unzippedImages = await unzipDotLottie(dotLottie, (file) => file.name.startsWith("images/") && (!filter || filter(file))); | ||
const unzippedImages = await unzipDotLottie(dotLottie, (file) => { | ||
const name = file.name.replace("images/", ""); | ||
return file.name.startsWith("images/") && (!filter || filter({ ...file, name })); | ||
}); | ||
const images = {}; | ||
@@ -344,3 +347,3 @@ for (const imagePath in unzippedImages) { | ||
for (const [imageId, animationIdsSet] of imagesMap) { | ||
const imageDataURL = unzippedImages[`images/${imageId}`]; | ||
const imageDataURL = unzippedImages[imageId]; | ||
if (imageDataURL) { | ||
@@ -371,3 +374,3 @@ for (const animationId of animationIdsSet) { | ||
const animationsMap = { | ||
animationId: animationData | ||
[animationId]: animationData | ||
}; | ||
@@ -379,3 +382,6 @@ await inlineImageAssets(dotLottie, animationsMap); | ||
const animationsMap = {}; | ||
const unzippedAnimations = await unzipDotLottie(dotLottie, (file) => file.name.startsWith("animations/") && (!filter || filter(file))); | ||
const unzippedAnimations = await unzipDotLottie(dotLottie, (file) => { | ||
const filename = file.name.replace("animations/", "").replace(".json", ""); | ||
return file.name.startsWith("animations/") && (!filter || filter({ ...file, name: filename })); | ||
}); | ||
for (const animationPath in unzippedAnimations) { | ||
@@ -397,3 +403,6 @@ const data = unzippedAnimations[animationPath]; | ||
const themesMap = {}; | ||
const unzippedThemes = await unzipDotLottie(dotLottie, (file) => file.name.startsWith("themes/") && (!filter || filter(file))); | ||
const unzippedThemes = await unzipDotLottie(dotLottie, (file) => { | ||
const name = file.name.replace("themes/", "").replace(".lss", ""); | ||
return file.name.startsWith("themes/") && (!filter || filter({ ...file, name })); | ||
}); | ||
for (const themePath in unzippedThemes) { | ||
@@ -400,0 +409,0 @@ const data = unzippedThemes[themePath]; |
{ | ||
"name": "@dotlottie/dotlottie-js", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "This library helps in creating and modifying .lottie files.", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1487214
15605