@aarsteinmedia/dotlottie-player 2.5.12 → 2.5.14

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 CHANGED
@@ -5,7 +5,7 @@ var decorators_js = require('lit/decorators.js');
5
5
  var Lottie = require('lottie-web');
6
6
  var fflate = require('fflate');
7
7
 
8
- var name="@aarsteinmedia/dotlottie-player";var version="2.5.12";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:"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 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",lit:"^3.1.4","lottie-web":"^5.12.2"};var peerDependencies={"@types/react":">= 16.0.0"};var devDependencies={"@custom-elements-manifest/analyzer":"^0.9.9","@rollup/plugin-commonjs":"^25.0.8","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-replace":"^5.0.7","@rollup/plugin-typescript":"^11.1.6","@swc/core":"^1.5.25","@types/node":"^20.14.2","@typescript-eslint/eslint-plugin":"^7.12.0","@typescript-eslint/parser":"^7.12.0",autoprefixer:"^10.4.19","esbuild-sass-plugin":"^3.3.1",eslint:"^8.57.0","eslint-import-resolver-typescript":"^3.6.1","eslint-plugin-import":"^2.29.1","eslint-plugin-jsdoc":"^48.2.9","eslint-plugin-lit":"^1.14.0","postcss-flexbugs-fixes":"^5.0.2",rimraf:"^5.0.7",rollup:"^4.18.0","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-postcss-lit":"^2.1.0","rollup-plugin-serve":"^1.1.1","rollup-plugin-summary":"^2.0.1","rollup-plugin-swc3":"^0.11.2",sass:"^1.77.4","ts-lit-plugin":"^2.0.2",tslib:"^2.6.3",typescript:"^5.4.5"};var customElements="dist/custom-elements.json";var files=["dist","README.md"];var keywords=["lottie","dotlottie","animation","web component","component","lit-element","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,license:license,scripts:scripts,dependencies:dependencies,peerDependencies:peerDependencies,devDependencies:devDependencies,customElements:customElements,files:files,keywords:keywords,publishConfig:publishConfig,engines:engines,funding:funding};
8
+ var name="@aarsteinmedia/dotlottie-player";var version="2.5.14";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:"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 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",lit:"^3.1.4","lottie-web":"^5.12.2"};var peerDependencies={"@types/react":">= 16.0.0"};var devDependencies={"@custom-elements-manifest/analyzer":"^0.9.9","@rollup/plugin-commonjs":"^25.0.8","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-replace":"^5.0.7","@rollup/plugin-typescript":"^11.1.6","@swc/core":"^1.5.29","@types/node":"^20.14.2","@typescript-eslint/eslint-plugin":"^7.13.0","@typescript-eslint/parser":"^7.13.0",autoprefixer:"^10.4.19","esbuild-sass-plugin":"^3.3.1",eslint:"^8.57.0","eslint-import-resolver-typescript":"^3.6.1","eslint-plugin-import":"^2.29.1","eslint-plugin-jsdoc":"^48.2.9","eslint-plugin-lit":"^1.14.0","postcss-flexbugs-fixes":"^5.0.2",rimraf:"^5.0.7",rollup:"^4.18.0","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-postcss-lit":"^2.1.0","rollup-plugin-serve":"^1.1.1","rollup-plugin-summary":"^2.0.1","rollup-plugin-swc3":"^0.11.2",sass:"^1.77.5","ts-lit-plugin":"^2.0.2",tslib:"^2.6.3",typescript:"^5.4.5"};var customElements="dist/custom-elements.json";var files=["dist","README.md"];var keywords=["lottie","dotlottie","animation","web component","component","lit-element","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,license:license,scripts:scripts,dependencies:dependencies,peerDependencies:peerDependencies,devDependencies:devDependencies,customElements:customElements,files:files,keywords:keywords,publishConfig:publishConfig,engines:engines,funding:funding};
9
9
 
10
10
  exports.PlayerState = void 0;
11
11
  (function(PlayerState) {
@@ -85,7 +85,7 @@ const addExt = (ext, str)=>{
85
85
  if (!asset.p || !isImage(asset) && !isAudio(asset)) {
86
86
  continue;
87
87
  }
88
- const { p: file, u: path } = asset, assetId = asset.id || useId(), isEncoded = file.startsWith('data:'), ext = isEncoded ? getExtFromB64(file) : getExt(file), dataURL = isEncoded ? file : await fileToBase64(path ? path.endsWith('/') && `${path}${file}` || `${path}/${file}` : file);
88
+ const { p: file, u: path } = asset, assetId = useId('asset'), isEncoded = file.startsWith('data:'), ext = isEncoded ? getExtFromB64(file) : getExt(file), dataURL = isEncoded ? file : await fileToBase64(path ? path.endsWith('/') && `${path}${file}` || `${path}/${file}` : file);
89
89
  asset.p = `${assetId}.${ext}`;
90
90
  asset.u = '';
91
91
  asset.e = 1;
@@ -239,15 +239,9 @@ const addExt = (ext, str)=>{
239
239
  return;
240
240
  }
241
241
  const ext = str.split('.').pop()?.toLowerCase();
242
- if (ext === 'jpeg') {
243
- return 'jpg';
244
- }
245
242
  return ext;
246
243
  }, getExtFromB64 = (str)=>{
247
244
  const mime = str.split(':')[1].split(';')[0], ext = mime.split('/')[1].split('+')[0];
248
- if (ext === 'jpeg') {
249
- return 'jpg';
250
- }
251
245
  return ext;
252
246
  }, getFilename = (src, keepExt)=>{
253
247
  getExt(src);
@@ -352,7 +346,7 @@ const addExt = (ext, str)=>{
352
346
  return unzipped;
353
347
  }, useId = (prefix)=>{
354
348
  const s4 = ()=>((1 + Math.random()) * 0x10000 | 0).toString(16).substring(1);
355
- return `${prefix ?? `:${s4()}`}-${s4()}`;
349
+ return `${prefix ?? `:${s4()}`}_${s4()}`;
356
350
  };
357
351
 
358
352
  var css_248z = lit.css`*{box-sizing:border-box}:host{--lottie-player-toolbar-height:35px;--lottie-player-toolbar-background-color:#FFF;--lottie-player-toolbar-icon-color:#000;--lottie-player-toolbar-icon-hover-color:#000;--lottie-player-toolbar-icon-active-color:#4285f4;--lottie-player-seeker-track-color:rgba(0, 0, 0, 0.2);--lottie-player-seeker-thumb-color:#4285f4;--lottie-player-seeker-display:block;display:block;width:100%;height:100%}@media (prefers-color-scheme:dark){:host{--lottie-player-toolbar-background-color:#000;--lottie-player-toolbar-icon-color:#FFF;--lottie-player-toolbar-icon-hover-color:#FFF;--lottie-player-seeker-track-color:rgba(255, 255, 255, 0.6)}}.main{display:flex;flex-direction:column;height:100%;width:100%;margin:0;padding:0}.animation{width:100%;height:100%;display:flex}[data-controls=true] .animation{height:calc(100% - 35px)}.animation-container{position:relative}.popover{position:absolute;right:5px;bottom:40px;background-color:var(--lottie-player-toolbar-background-color);border-radius:5px;padding:10px 15px;border:solid 2px var(--lottie-player-toolbar-icon-color);animation:fadeIn .2s ease-in-out}.popover::before{content:"";right:10px;border:7px solid transparent;border-top-color:transparent;margin-right:-7px;height:0;width:0;position:absolute;pointer-events:none;top:100%;border-top-color:var(--lottie-player-toolbar-icon-color)}.toolbar{display:flex;align-items:center;justify-items:center;background:var(--lottie-player-toolbar-background-color);margin:0;height:35px;padding:5px;border-radius:5px;gap:5px}.toolbar.has-error{pointer-events:none;opacity:.5}.toolbar button{cursor:pointer;fill:var(--lottie-player-toolbar-icon-color);color:var(--lottie-player-toolbar-icon-color);display:flex;background:0 0;border:0;padding:0;outline:0;height:100%;margin:0;align-items:center;gap:5px;opacity:.9}.toolbar button:hover{opacity:1}.toolbar button[data-active=true]{opacity:1;fill:var(--lottie-player-toolbar-icon-active-color)}.toolbar button:disabled{opacity:.5}.toolbar button:focus{outline:0}.toolbar button svg{pointer-events:none}.toolbar button svg>*{fill:inherit}.toolbar button.disabled svg{display:none}.progress-container{position:relative;width:100%}.progress-container.simple{margin-right:12px}.seeker{-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:0}.seeker::-webkit-slider-runnable-track,.seeker::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;outline:0}progress{-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:0}.seeker{width:100%;height:20px;border-radius:3px;border:0;cursor:pointer;background-color:transparent;display:var(--lottie-player-seeker-display);color:var(--lottie-player-seeker-thumb-color);margin:0;padding:7.5px 0;position:relative;z-index:1}progress{position:absolute;width:100%;height:5px;border-radius:3px;border:0;top:0;left:0;margin:7.5px 0;background-color:var(--lottie-player-seeker-track-color);pointer-events:none}::-moz-progress-bar{background-color:var(--lottie-player-seeker-thumb-color)}::-webkit-progress-inner-element{border-radius:3px;overflow:hidden}::-webkit-slider-runnable-track{background-color:transparent}::-webkit-progress-value{background-color:var(--lottie-player-seeker-thumb-color)}.seeker::-webkit-slider-thumb{height:15px;width:15px;border-radius:50%;border:0;background-color:var(--lottie-player-seeker-thumb-color);cursor:pointer;-webkit-transition:transform .2s ease-in-out;transition:transform .2s ease-in-out;transform:scale(0)}.seeker:focus::-webkit-slider-thumb,.seeker:hover::-webkit-slider-thumb{transform:scale(1)}.seeker::-moz-range-progress{background-color:var(--lottie-player-seeker-thumb-color);height:5px;border-radius:3px}.seeker::-moz-range-thumb{height:15px;width:15px;border-radius:50%;background-color:var(--lottie-player-seeker-thumb-color);border:0;cursor:pointer;-moz-transition:transform .2s ease-in-out;transition:transform .2s ease-in-out;transform:scale(0)}.seeker:focus::-moz-range-thumb,.seeker:hover::-moz-range-thumb{transform:scale(1)}.seeker::-ms-track{width:100%;height:5px;cursor:pointer;background:0 0;border-color:transparent;color:transparent}.seeker::-ms-fill-upper{background:var(--lottie-player-seeker-track-color);border-radius:3px}.seeker::-ms-fill-lower{background-color:var(--lottie-player-seeker-thumb-color);border-radius:3px}.seeker::-ms-thumb{border:0;height:15px;width:15px;border-radius:50%;background:var(--lottie-player-seeker-thumb-color);cursor:pointer;-ms-transition:transform .2s ease-in-out;transition:transform .2s ease-in-out;transform:scale(0)}.seeker:hover::-ms-thumb{transform:scale(1)}.seeker:focus::-ms-thumb{transform:scale(1)}.seeker:focus::-ms-fill-lower,.seeker:focus::-ms-fill-upper{background:var(--lottie-player-seeker-track-color)}.error{display:flex;margin:auto;justify-content:center;height:100%;align-items:center}.error svg{width:100%;height:auto}@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}`;
@@ -601,7 +595,7 @@ class DotLottiePlayer extends lit.LitElement {
601
595
  return;
602
596
  }
603
597
  const { currentFrame, totalFrames } = this._lottieInstance;
604
- this._seeker = Math.floor(currentFrame / totalFrames * 100);
598
+ this._seeker = Math.round(currentFrame / totalFrames * 100);
605
599
  this.dispatchEvent(new CustomEvent(exports.PlayerEvents.Frame, {
606
600
  detail: {
607
601
  frame: currentFrame,
@@ -623,7 +617,7 @@ class DotLottiePlayer extends lit.LitElement {
623
617
  }
624
618
  }
625
619
  const { currentFrame, totalFrames } = this._lottieInstance;
626
- this._seeker = Math.floor(currentFrame / totalFrames * 100);
620
+ this._seeker = Math.round(currentFrame / totalFrames * 100);
627
621
  this.currentState = exports.PlayerState.Completed;
628
622
  this.dispatchEvent(new CustomEvent(exports.PlayerEvents.Complete, {
629
623
  detail: {
@@ -699,7 +693,7 @@ class DotLottiePlayer extends lit.LitElement {
699
693
  if (!(target instanceof HTMLInputElement) || !this._lottieInstance || isNaN(Number(target.value))) {
700
694
  return;
701
695
  }
702
- this.seek(Math.floor(Number(target.value) / 100 * this._lottieInstance.totalFrames));
696
+ this.seek(Math.round(Number(target.value) / 100 * this._lottieInstance.totalFrames));
703
697
  setTimeout(()=>{
704
698
  if (target.parentElement instanceof HTMLFormElement) {
705
699
  target.parentElement.reset();
@@ -816,7 +810,7 @@ class DotLottiePlayer extends lit.LitElement {
816
810
  if (!matches) {
817
811
  return;
818
812
  }
819
- const frame = Math.floor(matches[2] === '%' ? this._lottieInstance.totalFrames * Number(matches[1]) / 100 : Number(matches[1]));
813
+ const frame = Math.round(matches[2] === '%' ? this._lottieInstance.totalFrames * Number(matches[1]) / 100 : Number(matches[1]));
820
814
  this._seeker = frame;
821
815
  if (this.currentState === exports.PlayerState.Playing || this.currentState === exports.PlayerState.Frozen && this._playerState.prev === exports.PlayerState.Playing) {
822
816
  this._lottieInstance.goToAndPlay(frame, true);
@@ -4,46 +4,7 @@
4
4
  "modules": [
5
5
  {
6
6
  "kind": "javascript-module",
7
- "path": "src/index.ts",
8
- "declarations": [],
9
- "exports": [
10
- {
11
- "kind": "js",
12
- "name": "DotLottiePlayer",
13
- "declaration": {
14
- "name": "DotLottiePlayer",
15
- "module": "src/index.ts"
16
- }
17
- },
18
- {
19
- "kind": "js",
20
- "name": "PlayMode",
21
- "declaration": {
22
- "name": "PlayMode",
23
- "module": "./component/utils"
24
- }
25
- },
26
- {
27
- "kind": "js",
28
- "name": "PlayerEvents",
29
- "declaration": {
30
- "name": "PlayerEvents",
31
- "module": "./component/utils"
32
- }
33
- },
34
- {
35
- "kind": "js",
36
- "name": "PlayerState",
37
- "declaration": {
38
- "name": "PlayerState",
39
- "module": "./component/utils"
40
- }
41
- }
42
- ]
43
- },
44
- {
45
- "kind": "javascript-module",
46
- "path": "src/component/index.ts",
7
+ "path": "src/component.ts",
47
8
  "declarations": [
48
9
  {
49
10
  "kind": "class",
@@ -988,7 +949,7 @@
988
949
  "name": "DotLottiePlayer",
989
950
  "declaration": {
990
951
  "name": "DotLottiePlayer",
991
- "module": "src/component/index.ts"
952
+ "module": "src/component.ts"
992
953
  }
993
954
  },
994
955
  {
@@ -996,20 +957,59 @@
996
957
  "name": "dotlottie-player",
997
958
  "declaration": {
998
959
  "name": "DotLottiePlayer",
999
- "module": "src/component/index.ts"
960
+ "module": "src/component.ts"
961
+ }
962
+ }
963
+ ]
964
+ },
965
+ {
966
+ "kind": "javascript-module",
967
+ "path": "src/index.ts",
968
+ "declarations": [],
969
+ "exports": [
970
+ {
971
+ "kind": "js",
972
+ "name": "DotLottiePlayer",
973
+ "declaration": {
974
+ "name": "DotLottiePlayer",
975
+ "module": "src/index.ts"
976
+ }
977
+ },
978
+ {
979
+ "kind": "js",
980
+ "name": "PlayMode",
981
+ "declaration": {
982
+ "name": "PlayMode",
983
+ "module": "./utils"
984
+ }
985
+ },
986
+ {
987
+ "kind": "js",
988
+ "name": "PlayerEvents",
989
+ "declaration": {
990
+ "name": "PlayerEvents",
991
+ "module": "./utils"
992
+ }
993
+ },
994
+ {
995
+ "kind": "js",
996
+ "name": "PlayerState",
997
+ "declaration": {
998
+ "name": "PlayerState",
999
+ "module": "./utils"
1000
1000
  }
1001
1001
  }
1002
1002
  ]
1003
1003
  },
1004
1004
  {
1005
1005
  "kind": "javascript-module",
1006
- "path": "src/component/types.ts",
1006
+ "path": "src/types.ts",
1007
1007
  "declarations": [],
1008
1008
  "exports": []
1009
1009
  },
1010
1010
  {
1011
1011
  "kind": "javascript-module",
1012
- "path": "src/component/utils.ts",
1012
+ "path": "src/utils.ts",
1013
1013
  "declarations": [
1014
1014
  {
1015
1015
  "kind": "class",
@@ -1026,7 +1026,7 @@
1026
1026
  ],
1027
1027
  "superclass": {
1028
1028
  "name": "Error",
1029
- "module": "src/component/utils.ts"
1029
+ "module": "src/utils.ts"
1030
1030
  }
1031
1031
  },
1032
1032
  {
@@ -1159,7 +1159,7 @@
1159
1159
  "name": "CustomError",
1160
1160
  "declaration": {
1161
1161
  "name": "CustomError",
1162
- "module": "src/component/utils.ts"
1162
+ "module": "src/utils.ts"
1163
1163
  }
1164
1164
  },
1165
1165
  {
@@ -1167,7 +1167,7 @@
1167
1167
  "name": "addExt",
1168
1168
  "declaration": {
1169
1169
  "name": "addExt",
1170
- "module": "src/component/utils.ts"
1170
+ "module": "src/utils.ts"
1171
1171
  }
1172
1172
  },
1173
1173
  {
@@ -1175,7 +1175,7 @@
1175
1175
  "name": "aspectRatio",
1176
1176
  "declaration": {
1177
1177
  "name": "aspectRatio",
1178
- "module": "src/component/utils.ts"
1178
+ "module": "src/utils.ts"
1179
1179
  }
1180
1180
  },
1181
1181
  {
@@ -1183,7 +1183,7 @@
1183
1183
  "name": "base64ToU8",
1184
1184
  "declaration": {
1185
1185
  "name": "base64ToU8",
1186
- "module": "src/component/utils.ts"
1186
+ "module": "src/utils.ts"
1187
1187
  }
1188
1188
  },
1189
1189
  {
@@ -1191,7 +1191,7 @@
1191
1191
  "name": "createDotLottie",
1192
1192
  "declaration": {
1193
1193
  "name": "createDotLottie",
1194
- "module": "src/component/utils.ts"
1194
+ "module": "src/utils.ts"
1195
1195
  }
1196
1196
  },
1197
1197
  {
@@ -1199,7 +1199,7 @@
1199
1199
  "name": "createJSON",
1200
1200
  "declaration": {
1201
1201
  "name": "createJSON",
1202
- "module": "src/component/utils.ts"
1202
+ "module": "src/utils.ts"
1203
1203
  }
1204
1204
  },
1205
1205
  {
@@ -1207,7 +1207,7 @@
1207
1207
  "name": "download",
1208
1208
  "declaration": {
1209
1209
  "name": "download",
1210
- "module": "src/component/utils.ts"
1210
+ "module": "src/utils.ts"
1211
1211
  }
1212
1212
  },
1213
1213
  {
@@ -1215,7 +1215,7 @@
1215
1215
  "name": "fileToBase64",
1216
1216
  "declaration": {
1217
1217
  "name": "fileToBase64",
1218
- "module": "src/component/utils.ts"
1218
+ "module": "src/utils.ts"
1219
1219
  }
1220
1220
  },
1221
1221
  {
@@ -1223,7 +1223,7 @@
1223
1223
  "name": "frameOutput",
1224
1224
  "declaration": {
1225
1225
  "name": "frameOutput",
1226
- "module": "src/component/utils.ts"
1226
+ "module": "src/utils.ts"
1227
1227
  }
1228
1228
  },
1229
1229
  {
@@ -1231,7 +1231,7 @@
1231
1231
  "name": "getAnimationData",
1232
1232
  "declaration": {
1233
1233
  "name": "getAnimationData",
1234
- "module": "src/component/utils.ts"
1234
+ "module": "src/utils.ts"
1235
1235
  }
1236
1236
  },
1237
1237
  {
@@ -1239,7 +1239,7 @@
1239
1239
  "name": "getArrayBuffer",
1240
1240
  "declaration": {
1241
1241
  "name": "getArrayBuffer",
1242
- "module": "src/component/utils.ts"
1242
+ "module": "src/utils.ts"
1243
1243
  }
1244
1244
  },
1245
1245
  {
@@ -1247,7 +1247,7 @@
1247
1247
  "name": "getExt",
1248
1248
  "declaration": {
1249
1249
  "name": "getExt",
1250
- "module": "src/component/utils.ts"
1250
+ "module": "src/utils.ts"
1251
1251
  }
1252
1252
  },
1253
1253
  {
@@ -1255,7 +1255,7 @@
1255
1255
  "name": "getExtFromB64",
1256
1256
  "declaration": {
1257
1257
  "name": "getExtFromB64",
1258
- "module": "src/component/utils.ts"
1258
+ "module": "src/utils.ts"
1259
1259
  }
1260
1260
  },
1261
1261
  {
@@ -1263,7 +1263,7 @@
1263
1263
  "name": "getFilename",
1264
1264
  "declaration": {
1265
1265
  "name": "getFilename",
1266
- "module": "src/component/utils.ts"
1266
+ "module": "src/utils.ts"
1267
1267
  }
1268
1268
  },
1269
1269
  {
@@ -1271,7 +1271,7 @@
1271
1271
  "name": "getLottieJSON",
1272
1272
  "declaration": {
1273
1273
  "name": "getLottieJSON",
1274
- "module": "src/component/utils.ts"
1274
+ "module": "src/utils.ts"
1275
1275
  }
1276
1276
  },
1277
1277
  {
@@ -1279,7 +1279,7 @@
1279
1279
  "name": "getManifest",
1280
1280
  "declaration": {
1281
1281
  "name": "getManifest",
1282
- "module": "src/component/utils.ts"
1282
+ "module": "src/utils.ts"
1283
1283
  }
1284
1284
  },
1285
1285
  {
@@ -1287,7 +1287,7 @@
1287
1287
  "name": "getMimeFromExt",
1288
1288
  "declaration": {
1289
1289
  "name": "getMimeFromExt",
1290
- "module": "src/component/utils.ts"
1290
+ "module": "src/utils.ts"
1291
1291
  }
1292
1292
  },
1293
1293
  {
@@ -1295,7 +1295,7 @@
1295
1295
  "name": "handleErrors",
1296
1296
  "declaration": {
1297
1297
  "name": "handleErrors",
1298
- "module": "src/component/utils.ts"
1298
+ "module": "src/utils.ts"
1299
1299
  }
1300
1300
  },
1301
1301
  {
@@ -1303,7 +1303,7 @@
1303
1303
  "name": "hasExt",
1304
1304
  "declaration": {
1305
1305
  "name": "hasExt",
1306
- "module": "src/component/utils.ts"
1306
+ "module": "src/utils.ts"
1307
1307
  }
1308
1308
  },
1309
1309
  {
@@ -1311,7 +1311,7 @@
1311
1311
  "name": "isAudio",
1312
1312
  "declaration": {
1313
1313
  "name": "isAudio",
1314
- "module": "src/component/utils.ts"
1314
+ "module": "src/utils.ts"
1315
1315
  }
1316
1316
  },
1317
1317
  {
@@ -1319,7 +1319,7 @@
1319
1319
  "name": "isBase64",
1320
1320
  "declaration": {
1321
1321
  "name": "isBase64",
1322
- "module": "src/component/utils.ts"
1322
+ "module": "src/utils.ts"
1323
1323
  }
1324
1324
  },
1325
1325
  {
@@ -1327,7 +1327,7 @@
1327
1327
  "name": "isImage",
1328
1328
  "declaration": {
1329
1329
  "name": "isImage",
1330
- "module": "src/component/utils.ts"
1330
+ "module": "src/utils.ts"
1331
1331
  }
1332
1332
  },
1333
1333
  {
@@ -1335,7 +1335,7 @@
1335
1335
  "name": "isServer",
1336
1336
  "declaration": {
1337
1337
  "name": "isServer",
1338
- "module": "src/component/utils.ts"
1338
+ "module": "src/utils.ts"
1339
1339
  }
1340
1340
  },
1341
1341
  {
@@ -1343,7 +1343,7 @@
1343
1343
  "name": "parseBase64",
1344
1344
  "declaration": {
1345
1345
  "name": "parseBase64",
1346
- "module": "src/component/utils.ts"
1346
+ "module": "src/utils.ts"
1347
1347
  }
1348
1348
  },
1349
1349
  {
@@ -1351,7 +1351,7 @@
1351
1351
  "name": "prepareString",
1352
1352
  "declaration": {
1353
1353
  "name": "prepareString",
1354
- "module": "src/component/utils.ts"
1354
+ "module": "src/utils.ts"
1355
1355
  }
1356
1356
  },
1357
1357
  {
@@ -1359,7 +1359,7 @@
1359
1359
  "name": "resolveAssets",
1360
1360
  "declaration": {
1361
1361
  "name": "resolveAssets",
1362
- "module": "src/component/utils.ts"
1362
+ "module": "src/utils.ts"
1363
1363
  }
1364
1364
  },
1365
1365
  {
@@ -1367,7 +1367,7 @@
1367
1367
  "name": "unzip",
1368
1368
  "declaration": {
1369
1369
  "name": "unzip",
1370
- "module": "src/component/utils.ts"
1370
+ "module": "src/utils.ts"
1371
1371
  }
1372
1372
  },
1373
1373
  {
@@ -1375,7 +1375,7 @@
1375
1375
  "name": "useId",
1376
1376
  "declaration": {
1377
1377
  "name": "useId",
1378
- "module": "src/component/utils.ts"
1378
+ "module": "src/utils.ts"
1379
1379
  }
1380
1380
  }
1381
1381
  ]
package/dist/esm/index.js CHANGED
@@ -3,7 +3,7 @@ import { property, query, state, customElement } from 'lit/decorators.js';
3
3
  import Lottie from 'lottie-web';
4
4
  import { strToU8, zip, strFromU8, unzip as unzip$1 } from 'fflate';
5
5
 
6
- var name="@aarsteinmedia/dotlottie-player";var version="2.5.12";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:"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 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",lit:"^3.1.4","lottie-web":"^5.12.2"};var peerDependencies={"@types/react":">= 16.0.0"};var devDependencies={"@custom-elements-manifest/analyzer":"^0.9.9","@rollup/plugin-commonjs":"^25.0.8","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-replace":"^5.0.7","@rollup/plugin-typescript":"^11.1.6","@swc/core":"^1.5.25","@types/node":"^20.14.2","@typescript-eslint/eslint-plugin":"^7.12.0","@typescript-eslint/parser":"^7.12.0",autoprefixer:"^10.4.19","esbuild-sass-plugin":"^3.3.1",eslint:"^8.57.0","eslint-import-resolver-typescript":"^3.6.1","eslint-plugin-import":"^2.29.1","eslint-plugin-jsdoc":"^48.2.9","eslint-plugin-lit":"^1.14.0","postcss-flexbugs-fixes":"^5.0.2",rimraf:"^5.0.7",rollup:"^4.18.0","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-postcss-lit":"^2.1.0","rollup-plugin-serve":"^1.1.1","rollup-plugin-summary":"^2.0.1","rollup-plugin-swc3":"^0.11.2",sass:"^1.77.4","ts-lit-plugin":"^2.0.2",tslib:"^2.6.3",typescript:"^5.4.5"};var customElements="dist/custom-elements.json";var files=["dist","README.md"];var keywords=["lottie","dotlottie","animation","web component","component","lit-element","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,license:license,scripts:scripts,dependencies:dependencies,peerDependencies:peerDependencies,devDependencies:devDependencies,customElements:customElements,files:files,keywords:keywords,publishConfig:publishConfig,engines:engines,funding:funding};
6
+ var name="@aarsteinmedia/dotlottie-player";var version="2.5.14";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:"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 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",lit:"^3.1.4","lottie-web":"^5.12.2"};var peerDependencies={"@types/react":">= 16.0.0"};var devDependencies={"@custom-elements-manifest/analyzer":"^0.9.9","@rollup/plugin-commonjs":"^25.0.8","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-replace":"^5.0.7","@rollup/plugin-typescript":"^11.1.6","@swc/core":"^1.5.29","@types/node":"^20.14.2","@typescript-eslint/eslint-plugin":"^7.13.0","@typescript-eslint/parser":"^7.13.0",autoprefixer:"^10.4.19","esbuild-sass-plugin":"^3.3.1",eslint:"^8.57.0","eslint-import-resolver-typescript":"^3.6.1","eslint-plugin-import":"^2.29.1","eslint-plugin-jsdoc":"^48.2.9","eslint-plugin-lit":"^1.14.0","postcss-flexbugs-fixes":"^5.0.2",rimraf:"^5.0.7",rollup:"^4.18.0","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-postcss-lit":"^2.1.0","rollup-plugin-serve":"^1.1.1","rollup-plugin-summary":"^2.0.1","rollup-plugin-swc3":"^0.11.2",sass:"^1.77.5","ts-lit-plugin":"^2.0.2",tslib:"^2.6.3",typescript:"^5.4.5"};var customElements="dist/custom-elements.json";var files=["dist","README.md"];var keywords=["lottie","dotlottie","animation","web component","component","lit-element","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,license:license,scripts:scripts,dependencies:dependencies,peerDependencies:peerDependencies,devDependencies:devDependencies,customElements:customElements,files:files,keywords:keywords,publishConfig:publishConfig,engines:engines,funding:funding};
7
7
 
8
8
  var PlayerState;
9
9
  (function(PlayerState) {
@@ -83,7 +83,7 @@ const addExt = (ext, str)=>{
83
83
  if (!asset.p || !isImage(asset) && !isAudio(asset)) {
84
84
  continue;
85
85
  }
86
- const { p: file, u: path } = asset, assetId = asset.id || useId(), isEncoded = file.startsWith('data:'), ext = isEncoded ? getExtFromB64(file) : getExt(file), dataURL = isEncoded ? file : await fileToBase64(path ? path.endsWith('/') && `${path}${file}` || `${path}/${file}` : file);
86
+ const { p: file, u: path } = asset, assetId = useId('asset'), isEncoded = file.startsWith('data:'), ext = isEncoded ? getExtFromB64(file) : getExt(file), dataURL = isEncoded ? file : await fileToBase64(path ? path.endsWith('/') && `${path}${file}` || `${path}/${file}` : file);
87
87
  asset.p = `${assetId}.${ext}`;
88
88
  asset.u = '';
89
89
  asset.e = 1;
@@ -237,15 +237,9 @@ const addExt = (ext, str)=>{
237
237
  return;
238
238
  }
239
239
  const ext = str.split('.').pop()?.toLowerCase();
240
- if (ext === 'jpeg') {
241
- return 'jpg';
242
- }
243
240
  return ext;
244
241
  }, getExtFromB64 = (str)=>{
245
242
  const mime = str.split(':')[1].split(';')[0], ext = mime.split('/')[1].split('+')[0];
246
- if (ext === 'jpeg') {
247
- return 'jpg';
248
- }
249
243
  return ext;
250
244
  }, getFilename = (src, keepExt)=>{
251
245
  getExt(src);
@@ -350,7 +344,7 @@ const addExt = (ext, str)=>{
350
344
  return unzipped;
351
345
  }, useId = (prefix)=>{
352
346
  const s4 = ()=>((1 + Math.random()) * 0x10000 | 0).toString(16).substring(1);
353
- return `${prefix ?? `:${s4()}`}-${s4()}`;
347
+ return `${prefix ?? `:${s4()}`}_${s4()}`;
354
348
  };
355
349
 
356
350
  var css_248z = css`*{box-sizing:border-box}:host{--lottie-player-toolbar-height:35px;--lottie-player-toolbar-background-color:#FFF;--lottie-player-toolbar-icon-color:#000;--lottie-player-toolbar-icon-hover-color:#000;--lottie-player-toolbar-icon-active-color:#4285f4;--lottie-player-seeker-track-color:rgba(0, 0, 0, 0.2);--lottie-player-seeker-thumb-color:#4285f4;--lottie-player-seeker-display:block;display:block;width:100%;height:100%}@media (prefers-color-scheme:dark){:host{--lottie-player-toolbar-background-color:#000;--lottie-player-toolbar-icon-color:#FFF;--lottie-player-toolbar-icon-hover-color:#FFF;--lottie-player-seeker-track-color:rgba(255, 255, 255, 0.6)}}.main{display:flex;flex-direction:column;height:100%;width:100%;margin:0;padding:0}.animation{width:100%;height:100%;display:flex}[data-controls=true] .animation{height:calc(100% - 35px)}.animation-container{position:relative}.popover{position:absolute;right:5px;bottom:40px;background-color:var(--lottie-player-toolbar-background-color);border-radius:5px;padding:10px 15px;border:solid 2px var(--lottie-player-toolbar-icon-color);animation:fadeIn .2s ease-in-out}.popover::before{content:"";right:10px;border:7px solid transparent;border-top-color:transparent;margin-right:-7px;height:0;width:0;position:absolute;pointer-events:none;top:100%;border-top-color:var(--lottie-player-toolbar-icon-color)}.toolbar{display:flex;align-items:center;justify-items:center;background:var(--lottie-player-toolbar-background-color);margin:0;height:35px;padding:5px;border-radius:5px;gap:5px}.toolbar.has-error{pointer-events:none;opacity:.5}.toolbar button{cursor:pointer;fill:var(--lottie-player-toolbar-icon-color);color:var(--lottie-player-toolbar-icon-color);display:flex;background:0 0;border:0;padding:0;outline:0;height:100%;margin:0;align-items:center;gap:5px;opacity:.9}.toolbar button:hover{opacity:1}.toolbar button[data-active=true]{opacity:1;fill:var(--lottie-player-toolbar-icon-active-color)}.toolbar button:disabled{opacity:.5}.toolbar button:focus{outline:0}.toolbar button svg{pointer-events:none}.toolbar button svg>*{fill:inherit}.toolbar button.disabled svg{display:none}.progress-container{position:relative;width:100%}.progress-container.simple{margin-right:12px}.seeker{-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:0}.seeker::-webkit-slider-runnable-track,.seeker::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;outline:0}progress{-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:0}.seeker{width:100%;height:20px;border-radius:3px;border:0;cursor:pointer;background-color:transparent;display:var(--lottie-player-seeker-display);color:var(--lottie-player-seeker-thumb-color);margin:0;padding:7.5px 0;position:relative;z-index:1}progress{position:absolute;width:100%;height:5px;border-radius:3px;border:0;top:0;left:0;margin:7.5px 0;background-color:var(--lottie-player-seeker-track-color);pointer-events:none}::-moz-progress-bar{background-color:var(--lottie-player-seeker-thumb-color)}::-webkit-progress-inner-element{border-radius:3px;overflow:hidden}::-webkit-slider-runnable-track{background-color:transparent}::-webkit-progress-value{background-color:var(--lottie-player-seeker-thumb-color)}.seeker::-webkit-slider-thumb{height:15px;width:15px;border-radius:50%;border:0;background-color:var(--lottie-player-seeker-thumb-color);cursor:pointer;-webkit-transition:transform .2s ease-in-out;transition:transform .2s ease-in-out;transform:scale(0)}.seeker:focus::-webkit-slider-thumb,.seeker:hover::-webkit-slider-thumb{transform:scale(1)}.seeker::-moz-range-progress{background-color:var(--lottie-player-seeker-thumb-color);height:5px;border-radius:3px}.seeker::-moz-range-thumb{height:15px;width:15px;border-radius:50%;background-color:var(--lottie-player-seeker-thumb-color);border:0;cursor:pointer;-moz-transition:transform .2s ease-in-out;transition:transform .2s ease-in-out;transform:scale(0)}.seeker:focus::-moz-range-thumb,.seeker:hover::-moz-range-thumb{transform:scale(1)}.seeker::-ms-track{width:100%;height:5px;cursor:pointer;background:0 0;border-color:transparent;color:transparent}.seeker::-ms-fill-upper{background:var(--lottie-player-seeker-track-color);border-radius:3px}.seeker::-ms-fill-lower{background-color:var(--lottie-player-seeker-thumb-color);border-radius:3px}.seeker::-ms-thumb{border:0;height:15px;width:15px;border-radius:50%;background:var(--lottie-player-seeker-thumb-color);cursor:pointer;-ms-transition:transform .2s ease-in-out;transition:transform .2s ease-in-out;transform:scale(0)}.seeker:hover::-ms-thumb{transform:scale(1)}.seeker:focus::-ms-thumb{transform:scale(1)}.seeker:focus::-ms-fill-lower,.seeker:focus::-ms-fill-upper{background:var(--lottie-player-seeker-track-color)}.error{display:flex;margin:auto;justify-content:center;height:100%;align-items:center}.error svg{width:100%;height:auto}@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}`;
@@ -599,7 +593,7 @@ class DotLottiePlayer extends LitElement {
599
593
  return;
600
594
  }
601
595
  const { currentFrame, totalFrames } = this._lottieInstance;
602
- this._seeker = Math.floor(currentFrame / totalFrames * 100);
596
+ this._seeker = Math.round(currentFrame / totalFrames * 100);
603
597
  this.dispatchEvent(new CustomEvent(PlayerEvents.Frame, {
604
598
  detail: {
605
599
  frame: currentFrame,
@@ -621,7 +615,7 @@ class DotLottiePlayer extends LitElement {
621
615
  }
622
616
  }
623
617
  const { currentFrame, totalFrames } = this._lottieInstance;
624
- this._seeker = Math.floor(currentFrame / totalFrames * 100);
618
+ this._seeker = Math.round(currentFrame / totalFrames * 100);
625
619
  this.currentState = PlayerState.Completed;
626
620
  this.dispatchEvent(new CustomEvent(PlayerEvents.Complete, {
627
621
  detail: {
@@ -697,7 +691,7 @@ class DotLottiePlayer extends LitElement {
697
691
  if (!(target instanceof HTMLInputElement) || !this._lottieInstance || isNaN(Number(target.value))) {
698
692
  return;
699
693
  }
700
- this.seek(Math.floor(Number(target.value) / 100 * this._lottieInstance.totalFrames));
694
+ this.seek(Math.round(Number(target.value) / 100 * this._lottieInstance.totalFrames));
701
695
  setTimeout(()=>{
702
696
  if (target.parentElement instanceof HTMLFormElement) {
703
697
  target.parentElement.reset();
@@ -814,7 +808,7 @@ class DotLottiePlayer extends LitElement {
814
808
  if (!matches) {
815
809
  return;
816
810
  }
817
- const frame = Math.floor(matches[2] === '%' ? this._lottieInstance.totalFrames * Number(matches[1]) / 100 : Number(matches[1]));
811
+ const frame = Math.round(matches[2] === '%' ? this._lottieInstance.totalFrames * Number(matches[1]) / 100 : Number(matches[1]));
818
812
  this._seeker = frame;
819
813
  if (this.currentState === PlayerState.Playing || this.currentState === PlayerState.Frozen && this._playerState.prev === PlayerState.Playing) {
820
814
  this._lottieInstance.goToAndPlay(frame, true);