@lordicon/utils-lottie 0.9.5 → 0.9.6

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- const S = {
1
+ const O = {
2
2
  aliceblue: "#f0f8ff",
3
3
  antiquewhite: "#faebd7",
4
4
  aqua: "#00ffff",
@@ -141,13 +141,13 @@ const S = {
141
141
  yellow: "#ffff00",
142
142
  yellowgreen: "#9acd32"
143
143
  };
144
- function y(e) {
145
- return e.startsWith("#") ? e.length === 4 ? `#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}` : e : S[e.toLowerCase()] || "#000000";
144
+ function h(e) {
145
+ return e.startsWith("#") ? e.length === 4 ? `#${e[1]}${e[1]}${e[2]}${e[2]}${e[3]}${e[3]}` : e : O[e.toLowerCase()] || "#000000";
146
146
  }
147
- function H(e) {
147
+ function U(e) {
148
148
  return !e || typeof e != "string" ? void 0 : e.split(",").filter((r) => r).map((r) => r.split(":")).filter((r) => r.length == 2).reduce((r, t) => {
149
149
  const o = t[0];
150
- return r[o.toLowerCase()] = y(t[1]), r;
150
+ return r[o.toLowerCase()] = h(t[1]), r;
151
151
  }, {});
152
152
  }
153
153
  function C(e) {
@@ -165,7 +165,7 @@ function $(e) {
165
165
  function j(e) {
166
166
  return structuredClone(e);
167
167
  }
168
- function R(e) {
168
+ function H(e) {
169
169
  return e == null;
170
170
  }
171
171
  function m(e) {
@@ -181,7 +181,7 @@ function z(e, f) {
181
181
  }
182
182
  return !0;
183
183
  }
184
- function U(e, f, r) {
184
+ function F(e, f, r) {
185
185
  const t = Array.isArray(f) ? f : f.split(".");
186
186
  let o = e;
187
187
  for (const n of t) {
@@ -207,10 +207,10 @@ function d(e) {
207
207
  function g(e) {
208
208
  return Math.round(e * 255);
209
209
  }
210
- function B(e) {
210
+ function E(e) {
211
211
  return "#" + k(e.r) + k(e.g) + k(e.b);
212
212
  }
213
- function q(e) {
213
+ function P(e) {
214
214
  let f = parseInt(e[0] != "#" ? e : e.substring(1), 16);
215
215
  return {
216
216
  r: f >> 16 & 255,
@@ -218,23 +218,23 @@ function q(e) {
218
218
  b: f & 255
219
219
  };
220
220
  }
221
- function h(e) {
221
+ function y(e) {
222
222
  const {
223
223
  r: f,
224
224
  g: r,
225
225
  b: t
226
- } = q(e);
226
+ } = P(e);
227
227
  return [d(f), d(r), d(t)];
228
228
  }
229
- function E(e) {
229
+ function T(e) {
230
230
  const f = {
231
231
  r: g(e[0]),
232
232
  g: g(e[1]),
233
233
  b: g(e[2])
234
234
  };
235
- return B(f);
235
+ return E(f);
236
236
  }
237
- function x(e, { lottieInstance: f } = {}) {
237
+ function S(e, { lottieInstance: f } = {}) {
238
238
  const r = [];
239
239
  return !e || !e.layers || e.layers.forEach((t, o) => {
240
240
  !t.nm || !t.ef || t.ef.forEach((n, s) => {
@@ -261,17 +261,17 @@ function W(e, f) {
261
261
  for (const r of f)
262
262
  a(e, r.path, r.value);
263
263
  }
264
- function O(e, f, r) {
264
+ function x(e, f, r) {
265
265
  for (const t of f)
266
- t.type === "color" ? typeof r == "object" && "r" in r && "g" in r && "b" in r ? a(e, t.path, [d(r.r), d(r.g), d(r.b)]) : Array.isArray(r) ? a(e, t.path, r) : typeof r == "string" && a(e, t.path, h(y(r))) : t.type === "point" ? typeof r == "object" && "x" in r && "y" in r ? (a(e, t.path + ".0", r.x), a(e, t.path + ".1", r.y)) : Array.isArray(r) && (a(e, t.path + ".0", r[0]), a(e, t.path + ".1", r[1])) : a(e, t.path, r);
266
+ t.type === "color" ? typeof r == "object" && "r" in r && "g" in r && "b" in r ? a(e, t.path, [d(r.r), d(r.g), d(r.b)]) : Array.isArray(r) ? a(e, t.path, r) : typeof r == "string" && a(e, t.path, y(h(r))) : t.type === "point" ? typeof r == "object" && "x" in r && "y" in r ? (a(e, t.path + ".0", r.x), a(e, t.path + ".1", r.y)) : Array.isArray(r) && (a(e, t.path + ".0", r[0]), a(e, t.path + ".1", r[1])) : a(e, t.path, r);
267
267
  }
268
268
  function v(e, f) {
269
269
  if (Object.keys(f).length > 0) {
270
- const t = x(e).filter((o) => o.type === "color");
270
+ const t = S(e).filter((o) => o.type === "color");
271
271
  for (const o of t) {
272
- const n = E(o.value);
272
+ const n = T(o.value);
273
273
  for (const [s, i] of Object.entries(f))
274
- n === s && a(e, o.path, h(i));
274
+ n === s && a(e, o.path, y(i));
275
275
  }
276
276
  return e;
277
277
  } else
@@ -285,7 +285,7 @@ function p(e, f) {
285
285
  }
286
286
  return e.x && typeof e.x == "string" && e.x.includes(f) && r.push(e), r;
287
287
  }
288
- function L(e, f, r) {
288
+ function q(e, f, r) {
289
289
  const t = C(r);
290
290
  if (!t)
291
291
  return;
@@ -312,18 +312,18 @@ function L(e, f, r) {
312
312
  }
313
313
  }
314
314
  for (const n of f)
315
- (n.name === "stroke" || n.name === "stroke-layers") && O(e, [n], t);
315
+ (n.name === "stroke" || n.name === "stroke-layers") && x(e, [n], t);
316
316
  }
317
- function P(e, f, r) {
317
+ function B(e, f, r) {
318
318
  for (const t of Object.keys(r)) {
319
- const o = y(r[t]), n = p(e, `effect('${t}')('Color')`);
319
+ const o = h(r[t]), n = p(e, `effect('${t}')('Color')`);
320
320
  for (const s of n)
321
- s.k = [...h(o), 1];
321
+ s.k = [...y(o), 1];
322
322
  for (const s of f)
323
- s.name === t && O(e, [s], o);
323
+ s.name === t && x(e, [s], o);
324
324
  }
325
325
  }
326
- function M(e, f, r) {
326
+ function L(e, f, r) {
327
327
  const t = $(r);
328
328
  if (t)
329
329
  for (const o of e.markers || []) {
@@ -331,7 +331,7 @@ function M(e, f, r) {
331
331
  o.cm = i, i === t && (o.cm = `default:${i}`, e.ip = o.tm, e.op = o.tm + o.dr);
332
332
  }
333
333
  }
334
- function T(e, f, r) {
334
+ function M(e, f, r) {
335
335
  const t = $(r);
336
336
  if (!t)
337
337
  return;
@@ -372,40 +372,52 @@ function _(e, f, r) {
372
372
  for (const n of f)
373
373
  n.name === "stroke" || n.name;
374
374
  }
375
- function F(e, f, r) {
376
- const t = x(e), o = j(e);
377
- return f.stroke && L(o, t, f.stroke), f.colors && P(o, t, f.colors), f.state && M(o, t, f.state), (r === "partial" || r === "full") && f.stroke && _(o, t, f.stroke), r === "full" && f.state && T(o, t, f.state), o;
375
+ function D(e, f, r) {
376
+ const t = S(e), o = j(e);
377
+ return f.stroke && q(o, t, f.stroke), f.colors && B(o, t, f.colors), f.state && L(o, t, f.state), (r === "partial" || r === "full") && f.stroke && _(o, t, f.stroke), r === "full" && f.state && M(o, t, f.state), o;
378
378
  }
379
- function K(e) {
379
+ const R = ["default"];
380
+ function G(e) {
380
381
  return !e || !e.markers || !Array.isArray(e.markers) ? [] : e.markers.map((f) => {
381
- const [r, t] = f.cm.split(":");
382
- return {
382
+ const r = f.cm.split(":"), t = {
383
383
  time: f.tm,
384
384
  duration: f.dr,
385
- name: t || r,
386
- default: !!(t && r.includes("default"))
385
+ name: "",
386
+ default: !1,
387
+ params: []
387
388
  };
389
+ for (; R.includes(r[0]); ) {
390
+ switch (r[0]) {
391
+ case "default":
392
+ t.default = !0;
393
+ break;
394
+ default:
395
+ throw new Error(`Unsupported state flag: ${r[0]}`);
396
+ }
397
+ r.shift();
398
+ }
399
+ return t.name = r[0], t.params = r.slice(1, r.length), t;
388
400
  });
389
401
  }
390
402
  export {
391
- F as customizeIcon,
403
+ D as customizeIcon,
392
404
  j as deepClone,
393
- x as extractLottieProperties,
394
- U as get,
405
+ S as extractLottieProperties,
406
+ F as get,
395
407
  z as has,
396
- q as hexToRgb,
397
- h as hexToTupleColor,
398
- R as isNil,
408
+ P as hexToRgb,
409
+ y as hexToTupleColor,
410
+ H as isNil,
399
411
  m as isObjectLike,
400
- y as parseColor,
401
- H as parseColors,
412
+ h as parseColor,
413
+ U as parseColors,
402
414
  $ as parseState,
403
415
  C as parseStroke,
404
- K as readStates,
416
+ G as readStates,
405
417
  v as remapColors,
406
418
  W as resetLottieProperties,
407
- B as rgbToHex,
419
+ E as rgbToHex,
408
420
  a as set,
409
- E as tupleColorToHex,
410
- O as updateLottieProperties
421
+ T as tupleColorToHex,
422
+ x as updateLottieProperties
411
423
  };
@@ -83,5 +83,6 @@ export interface IconState {
83
83
  name: string;
84
84
  time: number;
85
85
  duration: number;
86
+ params: string[];
86
87
  default?: boolean;
87
88
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lordicon/utils-lottie",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "author": "Marcin Baszczewski <marcin@baszczewski.pl> (https://www.baszczewski.pl/)",
5
5
  "homepage": "https://lordicon.com/",
6
6
  "repository": "https://github.com/lordicondev/utils-lottie",