@lordicon/web 1.0.0 → 1.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.
@@ -14,7 +14,9 @@
14
14
 
15
15
  <div>
16
16
  <label for="state-select">Choose state:</label>
17
- <select id="state-select"></select>
17
+ <select id="state-select">
18
+ <option value="*">*</option>
19
+ </select>
18
20
  </div>
19
21
  </body>
20
22
 
@@ -17,7 +17,6 @@ const player = new Player(
17
17
  },
18
18
  );
19
19
 
20
-
21
20
  player.addEventListener('ready', () => {
22
21
  player.play();
23
22
  });
@@ -52,6 +52,7 @@
52
52
  <td>
53
53
  Find out how to manage playback through the player API.
54
54
  </td>
55
+ </tr>
55
56
  </tbody>
56
57
  </table>
57
58
  </body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lordicon/web",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "A lightweight and flexible player for seamlessly embedding, controlling, and customizing animated Lordicon icons in any web application.",
5
5
  "repository": "https://github.com/lordicondev/player-web",
6
6
  "homepage": "https://lordicon.com/",
@@ -24,15 +24,15 @@
24
24
  },
25
25
  "devDependencies": {
26
26
  "@lordicon/internal": "^0.5.0",
27
- "vite": "^6.2.3",
28
- "vite-plugin-dts": "^4.5.4",
29
- "concurrently": "^9.1.2",
30
- "eslint-config-prettier": "^9.1.0",
31
- "eslint": "^8.54.0",
32
- "prettier": "^3.2.5",
33
- "typescript": "^5.3.2",
34
- "@typescript-eslint/eslint-plugin": "^6.12.0",
35
- "@typescript-eslint/parser": "^6.12.0",
27
+ "vite": "^8.0.16",
28
+ "vite-plugin-dts": "^5.0.2",
29
+ "concurrently": "^10.0.3",
30
+ "eslint-config-prettier": "^10.1.8",
31
+ "eslint": "^10.5.0",
32
+ "prettier": "^3.8.4",
33
+ "typescript": "^6.0.3",
34
+ "@typescript-eslint/eslint-plugin": "^8.61.1",
35
+ "@typescript-eslint/parser": "^8.61.1",
36
36
  "@types/node": "^22.13.13"
37
37
  }
38
38
  }
package/src/player.ts CHANGED
@@ -115,6 +115,7 @@ export class Player {
115
115
 
116
116
  protected _state?: IconState;
117
117
  protected _availableStates: IconState[];
118
+ protected _animationFrameRate: number = 0;
118
119
 
119
120
  /**
120
121
  * Creates a new Player instance.
@@ -133,6 +134,9 @@ export class Player {
133
134
  this._iconData = data;
134
135
  this._initialProperties = properties || {};
135
136
 
137
+ // Parse animation frame rate for timing calculations.
138
+ this._animationFrameRate = data.fr || 30;
139
+
136
140
  // Parse available states from Lottie markers.
137
141
  this._availableStates = (data.markers || []).map((c: any) => {
138
142
  const parts: string[] = c.cm.split(':');
@@ -180,7 +184,7 @@ export class Player {
180
184
  }
181
185
 
182
186
  // Fallback to default state if initial is invalid.
183
- if (this._initialProperties.state && !this._state) {
187
+ if (this._initialProperties.state && !this._state && this._initialProperties.state !== '*') {
184
188
  this._state = this._availableStates.filter(c => c.default)[0];
185
189
  }
186
190
  }
@@ -620,6 +624,8 @@ export class Player {
620
624
 
621
625
  if (isNil(state)) {
622
626
  this._state = this._availableStates.filter(c => c.default)[0];
627
+ } else if (state === '*') {
628
+ this._state = undefined;
623
629
  } else if (state) {
624
630
  this._state = this._availableStates.filter(c => c.name === state)[0];
625
631
 
@@ -731,6 +737,14 @@ export class Player {
731
737
  return this._availableStates;
732
738
  }
733
739
 
740
+ /**
741
+ * Gets the frame rate of the animation.
742
+ * @returns Frame rate in frames per second.
743
+ */
744
+ get frameRate() {
745
+ return this._animationFrameRate;
746
+ }
747
+
734
748
  /**
735
749
  * Returns true if the animation is currently playing.
736
750
  */