@aarsteinmedia/dotlottie-player 3.0.9 → 3.1.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/dist/cjs/index.js +19 -12
- package/dist/esm/index.js +19 -12
- package/dist/index.d.ts +9 -1
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var Lottie = require('lottie-web');
|
|
4
4
|
var fflate = require('fflate');
|
|
5
5
|
|
|
6
|
-
var name="@aarsteinmedia/dotlottie-player";var version="3.0
|
|
6
|
+
var name="@aarsteinmedia/dotlottie-player";var version="3.1.0";var description="Web Component for playing Lottie animations in your web app. Previously @johanaarstein/dotlottie-player";var exports$1={".":{"import":"./dist/esm/index.js",node:"./dist/esm/index.js",require:"./dist/cjs/index.js",types:"./dist/index.d.ts"}};var main="./dist/esm/index.js";var unpkg="./dist/index.js";var module$1="./dist/esm/index.js";var types="./dist/index.d.ts";var type="module";var homepage="https://www.aarstein.media/en/dotlottie-player";var repository={url:"git+https://github.com/aarsteinmedia/dotlottie-player.git",type:"git"};var bugs="https://github.com/aarsteinmedia/dotlottie-player/issues";var author={name:"Johan Martin Aarstein",email:"johan@aarstein.media",url:"https://www.aarstein.media",organization:"Aarstein Media"};var contributors=[{name:"Anthony Colpron",email:"anthonycolpron@gmail.com",url:"https://github.com/anthony-colpron"}];var license="GPL-2.0-or-later";var scripts={build:"rimraf ./dist && rollup -c","build:types":"rimraf ./types && tsc","build:cem":"npx cem analyze --config cem.config.mjs",prod:"pnpm build:types && pnpm build && pnpm build:cem",dev:"rollup -c -w --environment NODE_ENV:development",lint:"tsc && eslint . --ext .ts","lint:fix":"eslint . --ext .ts --fix"};var dependencies={fflate:"^0.8.2","lottie-web":"^5.12.2"};var peerDependencies={"@types/react":">= 16.0.0"};var devDependencies={"@custom-elements-manifest/analyzer":"^0.10.3","@rollup/plugin-commonjs":"^26.0.1","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-typescript":"^11.1.6","@swc/core":"^1.7.22","@types/node":"^22.5.2","@typescript-eslint/eslint-plugin":"^8.4.0","@typescript-eslint/parser":"^8.4.0",autoprefixer:"^10.4.20","esbuild-sass-plugin":"^3.3.1",eslint:"^8.57.0","eslint-config-prettier":"^9.1.0","eslint-import-resolver-typescript":"^3.6.3","eslint-plugin-import":"^2.29.1","eslint-plugin-jsdoc":"^48.11.0","eslint-plugin-prettier":"^5.2.1","postcss-flexbugs-fixes":"^5.0.2",prettier:"^3.3.3",rimraf:"^6.0.1",rollup:"^4.21.2","rollup-plugin-dts":"^6.1.1","rollup-plugin-html-literals":"^1.1.8","rollup-plugin-livereload":"^2.0.5","rollup-plugin-postcss":"^4.0.2","rollup-plugin-serve":"^1.1.1","rollup-plugin-summary":"^2.0.1","rollup-plugin-swc3":"^0.11.2",sass:"^1.77.8",tslib:"^2.7.0",typescript:"^5.5.4"};var customElements$1="dist/custom-elements.json";var files=["dist","README.md"];var keywords=["lottie","dotlottie","animation","web component","svg","vector","player"];var publishConfig={access:"public"};var engines={node:">= 8.17.0"};var funding={type:"paypal",url:"https://www.paypal.com/donate/?hosted_button_id=E7C7DMN8KSQ6A"};var pkg = {name:name,version:version,description:description,exports:exports$1,main:main,unpkg:unpkg,module:module$1,types:types,type:type,homepage:homepage,repository:repository,bugs:bugs,author:author,contributors:contributors,license:license,scripts:scripts,dependencies:dependencies,peerDependencies:peerDependencies,devDependencies:devDependencies,customElements:customElements$1,files:files,keywords:keywords,publishConfig:publishConfig,engines:engines,funding:funding};
|
|
7
7
|
|
|
8
8
|
var ObjectFit;
|
|
9
9
|
(function(ObjectFit) {
|
|
@@ -85,11 +85,11 @@ const addExt = (ext, str)=>{
|
|
|
85
85
|
if (!animations?.length || !manifest) {
|
|
86
86
|
throw new Error(`Missing or malformed required parameter(s):\n ${animations?.length ? '- manifest\n' : ''} ${manifest ? '- animations\n' : ''}`);
|
|
87
87
|
}
|
|
88
|
-
const name = addExt('lottie', fileName) || `${useId()}.lottie`, dotlottie = {
|
|
88
|
+
const manifestCompressionLevel = 0, animationCompressionLevel = 9, name = addExt('lottie', fileName) || `${useId()}.lottie`, dotlottie = {
|
|
89
89
|
'manifest.json': [
|
|
90
90
|
fflate.strToU8(JSON.stringify(manifest), true),
|
|
91
91
|
{
|
|
92
|
-
level:
|
|
92
|
+
level: manifestCompressionLevel
|
|
93
93
|
}
|
|
94
94
|
]
|
|
95
95
|
};
|
|
@@ -105,14 +105,14 @@ const addExt = (ext, str)=>{
|
|
|
105
105
|
dotlottie[`${isAudio(asset) ? 'audio' : 'images'}/${assetId}.${ext}`] = [
|
|
106
106
|
base64ToU8(dataURL),
|
|
107
107
|
{
|
|
108
|
-
level:
|
|
108
|
+
level: animationCompressionLevel
|
|
109
109
|
}
|
|
110
110
|
];
|
|
111
111
|
}
|
|
112
112
|
dotlottie[`animations/${manifest.animations[i].id}.json`] = [
|
|
113
113
|
fflate.strToU8(JSON.stringify(animation), true),
|
|
114
114
|
{
|
|
115
|
-
level:
|
|
115
|
+
level: animationCompressionLevel
|
|
116
116
|
}
|
|
117
117
|
];
|
|
118
118
|
}
|
|
@@ -291,6 +291,7 @@ const addExt = (ext, str)=>{
|
|
|
291
291
|
case 'png':
|
|
292
292
|
case 'gif':
|
|
293
293
|
case 'webp':
|
|
294
|
+
case 'avif':
|
|
294
295
|
return `image/${ext}`;
|
|
295
296
|
case 'mp3':
|
|
296
297
|
case 'mpeg':
|
|
@@ -1141,14 +1142,20 @@ class DotLottiePlayer extends EnhancedElement {
|
|
|
1141
1142
|
];
|
|
1142
1143
|
animations?.push(...animationsToAdd);
|
|
1143
1144
|
}
|
|
1144
|
-
return
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1145
|
+
return {
|
|
1146
|
+
success: true,
|
|
1147
|
+
result: await createDotLottie({
|
|
1148
|
+
animations,
|
|
1149
|
+
manifest,
|
|
1150
|
+
fileName,
|
|
1151
|
+
shouldDownload
|
|
1152
|
+
})
|
|
1153
|
+
};
|
|
1150
1154
|
} catch (err) {
|
|
1151
|
-
|
|
1155
|
+
return {
|
|
1156
|
+
success: false,
|
|
1157
|
+
error: handleErrors(err).message
|
|
1158
|
+
};
|
|
1152
1159
|
}
|
|
1153
1160
|
}
|
|
1154
1161
|
getLottie() {
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Lottie from 'lottie-web';
|
|
2
2
|
import { strToU8, zip, strFromU8, unzip as unzip$1 } from 'fflate';
|
|
3
3
|
|
|
4
|
-
var name="@aarsteinmedia/dotlottie-player";var version="3.0
|
|
4
|
+
var name="@aarsteinmedia/dotlottie-player";var version="3.1.0";var description="Web Component for playing Lottie animations in your web app. Previously @johanaarstein/dotlottie-player";var exports={".":{"import":"./dist/esm/index.js",node:"./dist/esm/index.js",require:"./dist/cjs/index.js",types:"./dist/index.d.ts"}};var main="./dist/esm/index.js";var unpkg="./dist/index.js";var module="./dist/esm/index.js";var types="./dist/index.d.ts";var type="module";var homepage="https://www.aarstein.media/en/dotlottie-player";var repository={url:"git+https://github.com/aarsteinmedia/dotlottie-player.git",type:"git"};var bugs="https://github.com/aarsteinmedia/dotlottie-player/issues";var author={name:"Johan Martin Aarstein",email:"johan@aarstein.media",url:"https://www.aarstein.media",organization:"Aarstein Media"};var contributors=[{name:"Anthony Colpron",email:"anthonycolpron@gmail.com",url:"https://github.com/anthony-colpron"}];var license="GPL-2.0-or-later";var scripts={build:"rimraf ./dist && rollup -c","build:types":"rimraf ./types && tsc","build:cem":"npx cem analyze --config cem.config.mjs",prod:"pnpm build:types && pnpm build && pnpm build:cem",dev:"rollup -c -w --environment NODE_ENV:development",lint:"tsc && eslint . --ext .ts","lint:fix":"eslint . --ext .ts --fix"};var dependencies={fflate:"^0.8.2","lottie-web":"^5.12.2"};var peerDependencies={"@types/react":">= 16.0.0"};var devDependencies={"@custom-elements-manifest/analyzer":"^0.10.3","@rollup/plugin-commonjs":"^26.0.1","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-typescript":"^11.1.6","@swc/core":"^1.7.22","@types/node":"^22.5.2","@typescript-eslint/eslint-plugin":"^8.4.0","@typescript-eslint/parser":"^8.4.0",autoprefixer:"^10.4.20","esbuild-sass-plugin":"^3.3.1",eslint:"^8.57.0","eslint-config-prettier":"^9.1.0","eslint-import-resolver-typescript":"^3.6.3","eslint-plugin-import":"^2.29.1","eslint-plugin-jsdoc":"^48.11.0","eslint-plugin-prettier":"^5.2.1","postcss-flexbugs-fixes":"^5.0.2",prettier:"^3.3.3",rimraf:"^6.0.1",rollup:"^4.21.2","rollup-plugin-dts":"^6.1.1","rollup-plugin-html-literals":"^1.1.8","rollup-plugin-livereload":"^2.0.5","rollup-plugin-postcss":"^4.0.2","rollup-plugin-serve":"^1.1.1","rollup-plugin-summary":"^2.0.1","rollup-plugin-swc3":"^0.11.2",sass:"^1.77.8",tslib:"^2.7.0",typescript:"^5.5.4"};var customElements$1="dist/custom-elements.json";var files=["dist","README.md"];var keywords=["lottie","dotlottie","animation","web component","svg","vector","player"];var publishConfig={access:"public"};var engines={node:">= 8.17.0"};var funding={type:"paypal",url:"https://www.paypal.com/donate/?hosted_button_id=E7C7DMN8KSQ6A"};var pkg = {name:name,version:version,description:description,exports:exports,main:main,unpkg:unpkg,module:module,types:types,type:type,homepage:homepage,repository:repository,bugs:bugs,author:author,contributors:contributors,license:license,scripts:scripts,dependencies:dependencies,peerDependencies:peerDependencies,devDependencies:devDependencies,customElements:customElements$1,files:files,keywords:keywords,publishConfig:publishConfig,engines:engines,funding:funding};
|
|
5
5
|
|
|
6
6
|
var ObjectFit;
|
|
7
7
|
(function(ObjectFit) {
|
|
@@ -83,11 +83,11 @@ const addExt = (ext, str)=>{
|
|
|
83
83
|
if (!animations?.length || !manifest) {
|
|
84
84
|
throw new Error(`Missing or malformed required parameter(s):\n ${animations?.length ? '- manifest\n' : ''} ${manifest ? '- animations\n' : ''}`);
|
|
85
85
|
}
|
|
86
|
-
const name = addExt('lottie', fileName) || `${useId()}.lottie`, dotlottie = {
|
|
86
|
+
const manifestCompressionLevel = 0, animationCompressionLevel = 9, name = addExt('lottie', fileName) || `${useId()}.lottie`, dotlottie = {
|
|
87
87
|
'manifest.json': [
|
|
88
88
|
strToU8(JSON.stringify(manifest), true),
|
|
89
89
|
{
|
|
90
|
-
level:
|
|
90
|
+
level: manifestCompressionLevel
|
|
91
91
|
}
|
|
92
92
|
]
|
|
93
93
|
};
|
|
@@ -103,14 +103,14 @@ const addExt = (ext, str)=>{
|
|
|
103
103
|
dotlottie[`${isAudio(asset) ? 'audio' : 'images'}/${assetId}.${ext}`] = [
|
|
104
104
|
base64ToU8(dataURL),
|
|
105
105
|
{
|
|
106
|
-
level:
|
|
106
|
+
level: animationCompressionLevel
|
|
107
107
|
}
|
|
108
108
|
];
|
|
109
109
|
}
|
|
110
110
|
dotlottie[`animations/${manifest.animations[i].id}.json`] = [
|
|
111
111
|
strToU8(JSON.stringify(animation), true),
|
|
112
112
|
{
|
|
113
|
-
level:
|
|
113
|
+
level: animationCompressionLevel
|
|
114
114
|
}
|
|
115
115
|
];
|
|
116
116
|
}
|
|
@@ -289,6 +289,7 @@ const addExt = (ext, str)=>{
|
|
|
289
289
|
case 'png':
|
|
290
290
|
case 'gif':
|
|
291
291
|
case 'webp':
|
|
292
|
+
case 'avif':
|
|
292
293
|
return `image/${ext}`;
|
|
293
294
|
case 'mp3':
|
|
294
295
|
case 'mpeg':
|
|
@@ -1139,14 +1140,20 @@ class DotLottiePlayer extends EnhancedElement {
|
|
|
1139
1140
|
];
|
|
1140
1141
|
animations?.push(...animationsToAdd);
|
|
1141
1142
|
}
|
|
1142
|
-
return
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1143
|
+
return {
|
|
1144
|
+
success: true,
|
|
1145
|
+
result: await createDotLottie({
|
|
1146
|
+
animations,
|
|
1147
|
+
manifest,
|
|
1148
|
+
fileName,
|
|
1149
|
+
shouldDownload
|
|
1150
|
+
})
|
|
1151
|
+
};
|
|
1148
1152
|
} catch (err) {
|
|
1149
|
-
|
|
1153
|
+
return {
|
|
1154
|
+
success: false,
|
|
1155
|
+
error: handleErrors(err).message
|
|
1156
|
+
};
|
|
1150
1157
|
}
|
|
1151
1158
|
}
|
|
1152
1159
|
getLottie() {
|
package/dist/index.d.ts
CHANGED
|
@@ -232,7 +232,15 @@ declare class DotLottiePlayer extends EnhancedElement {
|
|
|
232
232
|
private _handleScroll;
|
|
233
233
|
private _handleSeekChange;
|
|
234
234
|
private _isLottie;
|
|
235
|
-
addAnimation(configs: AnimationAttributes[], fileName?: string, shouldDownload?: boolean): Promise<
|
|
235
|
+
addAnimation(configs: AnimationAttributes[], fileName?: string, shouldDownload?: boolean): Promise<{
|
|
236
|
+
success: boolean;
|
|
237
|
+
result: void | ArrayBuffer;
|
|
238
|
+
error?: undefined;
|
|
239
|
+
} | {
|
|
240
|
+
success: boolean;
|
|
241
|
+
error: string;
|
|
242
|
+
result?: undefined;
|
|
243
|
+
}>;
|
|
236
244
|
getLottie(): AnimationItem | null;
|
|
237
245
|
play(): Promise<void>;
|
|
238
246
|
pause(): void;
|