@libshub/gif-tools 1.0.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.
@@ -0,0 +1,2 @@
1
+ .gif-player{line-height:0;display:inline-block;position:relative;overflow:hidden}.gif-player__media{max-width:100%;height:auto;display:block}.gif-player__controls{opacity:0;gap:6px;transition:opacity .2s;display:flex;position:absolute;bottom:8px;right:8px}.gif-player:hover .gif-player__controls,.gif-player--show-controls .gif-player__controls{opacity:1}.gif-player__btn{color:#fff;cursor:pointer;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background:#0000008c;border:none;border-radius:50%;justify-content:center;align-items:center;width:32px;height:32px;padding:0;display:flex}.gif-player__btn:hover{background:#000000bf}.gif-player__btn svg{fill:currentColor;width:16px;height:16px}.gif-player__debug{color:#fff;pointer-events:none;background:#000000a6;border-radius:4px;padding:2px 8px;font-family:ui-monospace,monospace;font-size:12px;line-height:1.4;position:absolute;top:8px;left:8px}
2
+ /*$vite$:1*/
@@ -0,0 +1,542 @@
1
+ import { forwardRef as e, useCallback as t, useEffect as n, useImperativeHandle as r, useRef as i, useState as a } from "react";
2
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
3
+ //#region \0rolldown/runtime.js
4
+ var c = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), l = /* @__PURE__ */ c(((e) => {
5
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.loop = e.conditional = e.parse = void 0, e.parse = function e(t, n) {
6
+ var r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : r;
7
+ if (Array.isArray(n)) n.forEach(function(n) {
8
+ return e(t, n, r, i);
9
+ });
10
+ else if (typeof n == "function") n(t, r, i, e);
11
+ else {
12
+ var a = Object.keys(n)[0];
13
+ Array.isArray(n[a]) ? (i[a] = {}, e(t, n[a], r, i[a])) : i[a] = n[a](t, r, i, e);
14
+ }
15
+ return r;
16
+ }, e.conditional = function(e, t) {
17
+ return function(n, r, i, a) {
18
+ t(n, r, i) && a(n, e, r, i);
19
+ };
20
+ }, e.loop = function(e, t) {
21
+ return function(n, r, i, a) {
22
+ for (var o = [], s = n.pos; t(n, r, i);) {
23
+ var c = {};
24
+ if (a(n, e, r, c), n.pos === s) break;
25
+ s = n.pos, o.push(c);
26
+ }
27
+ return o;
28
+ };
29
+ };
30
+ })), u = /* @__PURE__ */ c(((e) => {
31
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.readBits = e.readArray = e.readUnsigned = e.readString = e.peekBytes = e.readBytes = e.peekByte = e.readByte = e.buildStream = void 0, e.buildStream = function(e) {
32
+ return {
33
+ data: e,
34
+ pos: 0
35
+ };
36
+ };
37
+ var t = function() {
38
+ return function(e) {
39
+ return e.data[e.pos++];
40
+ };
41
+ };
42
+ e.readByte = t, e.peekByte = function() {
43
+ var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
44
+ return function(t) {
45
+ return t.data[t.pos + e];
46
+ };
47
+ };
48
+ var n = function(e) {
49
+ return function(t) {
50
+ return t.data.subarray(t.pos, t.pos += e);
51
+ };
52
+ };
53
+ e.readBytes = n, e.peekBytes = function(e) {
54
+ return function(t) {
55
+ return t.data.subarray(t.pos, t.pos + e);
56
+ };
57
+ }, e.readString = function(e) {
58
+ return function(t) {
59
+ return Array.from(n(e)(t)).map(function(e) {
60
+ return String.fromCharCode(e);
61
+ }).join("");
62
+ };
63
+ }, e.readUnsigned = function(e) {
64
+ return function(t) {
65
+ var r = n(2)(t);
66
+ return e ? (r[1] << 8) + r[0] : (r[0] << 8) + r[1];
67
+ };
68
+ }, e.readArray = function(e, t) {
69
+ return function(r, i, a) {
70
+ for (var o = typeof t == "function" ? t(r, i, a) : t, s = n(e), c = Array(o), l = 0; l < o; l++) c[l] = s(r);
71
+ return c;
72
+ };
73
+ };
74
+ var r = function(e, t, n) {
75
+ for (var r = 0, i = 0; i < n; i++) r += e[t + i] && 2 ** (n - i - 1);
76
+ return r;
77
+ };
78
+ e.readBits = function(e) {
79
+ return function(n) {
80
+ for (var i = t()(n), a = Array(8), o = 0; o < 8; o++) a[7 - o] = !!(i & 1 << o);
81
+ return Object.keys(e).reduce(function(t, n) {
82
+ var i = e[n];
83
+ return i.length ? t[n] = r(a, i.index, i.length) : t[n] = a[i.index], t;
84
+ }, {});
85
+ };
86
+ };
87
+ })), d = /* @__PURE__ */ c(((e) => {
88
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.default = void 0;
89
+ var t = l(), n = u(), r = { blocks: function(e) {
90
+ for (var t = 0, r = [], i = e.data.length, a = 0, o = (0, n.readByte)()(e); o !== t && o; o = (0, n.readByte)()(e)) {
91
+ if (e.pos + o >= i) {
92
+ var s = i - e.pos;
93
+ r.push((0, n.readBytes)(s)(e)), a += s;
94
+ break;
95
+ }
96
+ r.push((0, n.readBytes)(o)(e)), a += o;
97
+ }
98
+ for (var c = new Uint8Array(a), l = 0, u = 0; u < r.length; u++) c.set(r[u], l), l += r[u].length;
99
+ return c;
100
+ } }, i = (0, t.conditional)({ gce: [
101
+ { codes: (0, n.readBytes)(2) },
102
+ { byteSize: (0, n.readByte)() },
103
+ { extras: (0, n.readBits)({
104
+ future: {
105
+ index: 0,
106
+ length: 3
107
+ },
108
+ disposal: {
109
+ index: 3,
110
+ length: 3
111
+ },
112
+ userInput: { index: 6 },
113
+ transparentColorGiven: { index: 7 }
114
+ }) },
115
+ { delay: (0, n.readUnsigned)(!0) },
116
+ { transparentColorIndex: (0, n.readByte)() },
117
+ { terminator: (0, n.readByte)() }
118
+ ] }, function(e) {
119
+ var t = (0, n.peekBytes)(2)(e);
120
+ return t[0] === 33 && t[1] === 249;
121
+ }), a = (0, t.conditional)({ image: [
122
+ { code: (0, n.readByte)() },
123
+ { descriptor: [
124
+ { left: (0, n.readUnsigned)(!0) },
125
+ { top: (0, n.readUnsigned)(!0) },
126
+ { width: (0, n.readUnsigned)(!0) },
127
+ { height: (0, n.readUnsigned)(!0) },
128
+ { lct: (0, n.readBits)({
129
+ exists: { index: 0 },
130
+ interlaced: { index: 1 },
131
+ sort: { index: 2 },
132
+ future: {
133
+ index: 3,
134
+ length: 2
135
+ },
136
+ size: {
137
+ index: 5,
138
+ length: 3
139
+ }
140
+ }) }
141
+ ] },
142
+ (0, t.conditional)({ lct: (0, n.readArray)(3, function(e, t, n) {
143
+ return 2 ** (n.descriptor.lct.size + 1);
144
+ }) }, function(e, t, n) {
145
+ return n.descriptor.lct.exists;
146
+ }),
147
+ { data: [{ minCodeSize: (0, n.readByte)() }, r] }
148
+ ] }, function(e) {
149
+ return (0, n.peekByte)()(e) === 44;
150
+ }), o = (0, t.conditional)({ text: [
151
+ { codes: (0, n.readBytes)(2) },
152
+ { blockSize: (0, n.readByte)() },
153
+ { preData: function(e, t, r) {
154
+ return (0, n.readBytes)(r.text.blockSize)(e);
155
+ } },
156
+ r
157
+ ] }, function(e) {
158
+ var t = (0, n.peekBytes)(2)(e);
159
+ return t[0] === 33 && t[1] === 1;
160
+ }), s = (0, t.conditional)({ application: [
161
+ { codes: (0, n.readBytes)(2) },
162
+ { blockSize: (0, n.readByte)() },
163
+ { id: function(e, t, r) {
164
+ return (0, n.readString)(r.blockSize)(e);
165
+ } },
166
+ r
167
+ ] }, function(e) {
168
+ var t = (0, n.peekBytes)(2)(e);
169
+ return t[0] === 33 && t[1] === 255;
170
+ }), c = (0, t.conditional)({ comment: [{ codes: (0, n.readBytes)(2) }, r] }, function(e) {
171
+ var t = (0, n.peekBytes)(2)(e);
172
+ return t[0] === 33 && t[1] === 254;
173
+ });
174
+ e.default = [
175
+ { header: [{ signature: (0, n.readString)(3) }, { version: (0, n.readString)(3) }] },
176
+ { lsd: [
177
+ { width: (0, n.readUnsigned)(!0) },
178
+ { height: (0, n.readUnsigned)(!0) },
179
+ { gct: (0, n.readBits)({
180
+ exists: { index: 0 },
181
+ resolution: {
182
+ index: 1,
183
+ length: 3
184
+ },
185
+ sort: { index: 4 },
186
+ size: {
187
+ index: 5,
188
+ length: 3
189
+ }
190
+ }) },
191
+ { backgroundColorIndex: (0, n.readByte)() },
192
+ { pixelAspectRatio: (0, n.readByte)() }
193
+ ] },
194
+ (0, t.conditional)({ gct: (0, n.readArray)(3, function(e, t) {
195
+ return 2 ** (t.lsd.gct.size + 1);
196
+ }) }, function(e, t) {
197
+ return t.lsd.gct.exists;
198
+ }),
199
+ { frames: (0, t.loop)([
200
+ i,
201
+ s,
202
+ c,
203
+ a,
204
+ o
205
+ ], function(e) {
206
+ var t = (0, n.peekByte)()(e);
207
+ return t === 33 || t === 44;
208
+ }) }
209
+ ];
210
+ })), f = /* @__PURE__ */ c(((e) => {
211
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.deinterlace = void 0, e.deinterlace = function(e, t) {
212
+ for (var n = Array(e.length), r = e.length / t, i = function(r, i) {
213
+ var a = e.slice(i * t, (i + 1) * t);
214
+ n.splice.apply(n, [r * t, t].concat(a));
215
+ }, a = [
216
+ 0,
217
+ 4,
218
+ 2,
219
+ 1
220
+ ], o = [
221
+ 8,
222
+ 8,
223
+ 4,
224
+ 2
225
+ ], s = 0, c = 0; c < 4; c++) for (var l = a[c]; l < r; l += o[c]) i(l, s), s++;
226
+ return n;
227
+ };
228
+ })), p = /* @__PURE__ */ c(((e) => {
229
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.lzw = void 0, e.lzw = function(e, t, n) {
230
+ var r = 4096, i = -1, a = n, o, s, c, l, u, d, f, p, m, h, g, _, v, y, b, x, S = Array(n), C = Array(r), w = Array(r), T = Array(r + 1);
231
+ for (_ = e, s = 1 << _, u = s + 1, o = s + 2, f = i, l = _ + 1, c = (1 << l) - 1, m = 0; m < s; m++) C[m] = 0, w[m] = m;
232
+ var g = p = v = y = x = b = 0, p, v, y, x, b;
233
+ for (h = 0; h < a;) {
234
+ if (y === 0) {
235
+ if (p < l) {
236
+ g += t[b] << p, p += 8, b++;
237
+ continue;
238
+ }
239
+ if (m = g & c, g >>= l, p -= l, m > o || m == u) break;
240
+ if (m == s) {
241
+ l = _ + 1, c = (1 << l) - 1, o = s + 2, f = i;
242
+ continue;
243
+ }
244
+ if (f == i) {
245
+ T[y++] = w[m], f = m, v = m;
246
+ continue;
247
+ }
248
+ for (d = m, m == o && (T[y++] = v, m = f); m > s;) T[y++] = w[m], m = C[m];
249
+ v = w[m] & 255, T[y++] = v, o < r && (C[o] = f, w[o] = v, o++, (o & c) === 0 && o < r && (l++, c += o)), f = d;
250
+ }
251
+ y--, S[x++] = T[y], h++;
252
+ }
253
+ for (h = x; h < a; h++) S[h] = 0;
254
+ return S;
255
+ };
256
+ })), m = (/* @__PURE__ */ c(((e) => {
257
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.decompressFrames = e.decompressFrame = e.parseGIF = void 0;
258
+ var t = o(d()), n = l(), r = u(), i = f(), a = p();
259
+ function o(e) {
260
+ return e && e.__esModule ? e : { default: e };
261
+ }
262
+ e.parseGIF = function(e) {
263
+ var i = new Uint8Array(e);
264
+ return (0, n.parse)((0, r.buildStream)(i), t.default);
265
+ };
266
+ var s = function(e) {
267
+ for (var t = e.pixels.length, n = new Uint8ClampedArray(t * 4), r = 0; r < t; r++) {
268
+ var i = r * 4, a = e.pixels[r], o = e.colorTable[a] || [
269
+ 0,
270
+ 0,
271
+ 0
272
+ ];
273
+ n[i] = o[0], n[i + 1] = o[1], n[i + 2] = o[2], n[i + 3] = a === e.transparentIndex ? 0 : 255;
274
+ }
275
+ return n;
276
+ }, c = function(e, t, n) {
277
+ if (!e.image) {
278
+ console.warn("gif frame does not have associated image.");
279
+ return;
280
+ }
281
+ var r = e.image, o = r.descriptor.width * r.descriptor.height, c = (0, a.lzw)(r.data.minCodeSize, r.data.blocks, o);
282
+ r.descriptor.lct.interlaced && (c = (0, i.deinterlace)(c, r.descriptor.width));
283
+ var l = {
284
+ pixels: c,
285
+ dims: {
286
+ top: e.image.descriptor.top,
287
+ left: e.image.descriptor.left,
288
+ width: e.image.descriptor.width,
289
+ height: e.image.descriptor.height
290
+ }
291
+ };
292
+ return r.descriptor.lct && r.descriptor.lct.exists ? l.colorTable = r.lct : l.colorTable = t, e.gce && (l.delay = (e.gce.delay || 10) * 10, l.disposalType = e.gce.extras.disposal, e.gce.extras.transparentColorGiven && (l.transparentIndex = e.gce.transparentColorIndex)), n && (l.patch = s(l)), l;
293
+ };
294
+ e.decompressFrame = c, e.decompressFrames = function(e, t) {
295
+ return e.frames.filter(function(e) {
296
+ return e.image;
297
+ }).map(function(n) {
298
+ return c(n, e.gct, t);
299
+ });
300
+ };
301
+ })))(), h = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map();
302
+ async function v(e) {
303
+ let t = await fetch(e, {
304
+ mode: "cors",
305
+ credentials: "omit"
306
+ });
307
+ if (!t.ok) throw Error(`Failed to load gif: ${t.status}`);
308
+ let n = await t.arrayBuffer(), r = performance.now(), i = (0, m.parseGIF)(n), a = (0, m.decompressFrames)(i, !0), o = performance.now() - r;
309
+ if (!a.length) throw Error("GIF has no frames");
310
+ return {
311
+ gif: {
312
+ frames: a,
313
+ width: i.lsd.width,
314
+ height: i.lsd.height
315
+ },
316
+ decodeTimeMs: o
317
+ };
318
+ }
319
+ async function y(e, t) {
320
+ let n = h.get(e);
321
+ if (n) return n.refCount += 1, {
322
+ gif: n.data,
323
+ decodeTimeMs: 0
324
+ };
325
+ if (!t?.skipPending && g.has(e)) {
326
+ let { gif: t } = await g.get(e);
327
+ return h.get(e).refCount += 1, {
328
+ gif: t,
329
+ decodeTimeMs: 0
330
+ };
331
+ }
332
+ let r = (_.get(e) ?? 0) + 1;
333
+ _.set(e, r);
334
+ let i = v(e).then(({ gif: t, decodeTimeMs: n }) => _.get(e) === r ? (g.delete(e), h.set(e, {
335
+ data: t,
336
+ refCount: 0
337
+ }), {
338
+ gif: t,
339
+ decodeTimeMs: n
340
+ }) : {
341
+ gif: t,
342
+ decodeTimeMs: n
343
+ }).catch((t) => {
344
+ throw _.get(e) === r && g.delete(e), t;
345
+ });
346
+ g.set(e, i);
347
+ let { gif: a, decodeTimeMs: o } = await i;
348
+ return _.get(e) === r && (h.get(e).refCount += 1), {
349
+ gif: a,
350
+ decodeTimeMs: o
351
+ };
352
+ }
353
+ function b(e) {
354
+ let t = h.get(e);
355
+ t && (--t.refCount, t.refCount <= 0 && h.delete(e));
356
+ }
357
+ //#endregion
358
+ //#region src/utils/gifController.ts
359
+ function x(e, t, n, r, i = {}) {
360
+ let a = e.getContext("2d");
361
+ if (!a) throw Error("Canvas 2d context unavailable");
362
+ let o = a;
363
+ e.width = n, e.height = r;
364
+ let s = document.createElement("canvas"), c = s.getContext("2d"), l = !1, u = 0, d = 0, f = null, p = null;
365
+ function m() {
366
+ f &&= (clearTimeout(f), null);
367
+ }
368
+ function h(e) {
369
+ let { dims: t } = e;
370
+ (!p || p.width !== t.width || p.height !== t.height) && (s.width = t.width, s.height = t.height, p = c.createImageData(t.width, t.height)), p.data.set(e.patch), c.putImageData(p, 0, 0), o.drawImage(s, t.left, t.top);
371
+ }
372
+ function g(e) {
373
+ let i = t[e];
374
+ i.disposalType === 2 && o.clearRect(0, 0, n, r), h(i);
375
+ }
376
+ function _() {
377
+ let { loopCount: e } = i;
378
+ return e !== void 0 && d >= e;
379
+ }
380
+ function v() {
381
+ m();
382
+ let e = t[u], a = Math.max(e.delay, 0);
383
+ f = setTimeout(() => {
384
+ if (u += 1, u >= t.length) {
385
+ if (d += 1, _()) {
386
+ u = t.length - 1, g(u), l = !1, m(), i.onEnd?.();
387
+ return;
388
+ }
389
+ u = 0, o.clearRect(0, 0, n, r);
390
+ }
391
+ g(u), l && v();
392
+ }, a);
393
+ }
394
+ function y() {
395
+ l || (_() && x(), l = !0, i.onPlay?.(), v());
396
+ }
397
+ function b() {
398
+ l && (l = !1, m(), i.onPause?.());
399
+ }
400
+ function x() {
401
+ b(), u = 0, d = 0, o.clearRect(0, 0, n, r), g(0);
402
+ }
403
+ function S() {
404
+ b(), p = null, s.width = 0, s.height = 0, e.width = 0, e.height = 0;
405
+ }
406
+ return g(0), {
407
+ play: y,
408
+ pause: b,
409
+ reset: x,
410
+ destroy: S,
411
+ isPlaying: () => l,
412
+ getCompletedLoops: () => d
413
+ };
414
+ }
415
+ async function S(e, t, n = {}) {
416
+ let { skipPending: r, onLoaded: i, ...a } = n, { gif: o, decodeTimeMs: s } = await y(t, { skipPending: r });
417
+ i?.(s);
418
+ let c = x(e, o.frames, o.width, o.height, a), l = c.destroy;
419
+ return c.destroy = () => {
420
+ l(), b(t);
421
+ }, c;
422
+ }
423
+ //#endregion
424
+ //#region src/components/GifPlayer.tsx
425
+ var C = e(({ src: e, autoPlay: c = !0, showControls: l = !1, debug: u = !1, loopCount: d, className: f, style: p, width: m, height: h, onPlay: g, onPause: _, onEnd: v, onLoaded: y, onError: b }, x) => {
426
+ let C = i(null), w = i(null), T = i(g), E = i(_), D = i(v), O = i(y), k = i(b), [A, j] = a(c), [M, N] = a(!1), [P, F] = a(null), [I, L] = a(0), R = i(!1);
427
+ T.current = g, E.current = _, D.current = v, O.current = y, k.current = b;
428
+ let z = t(() => {
429
+ w.current?.play(), j(!0);
430
+ }, []), B = t(() => {
431
+ w.current?.pause(), j(!1);
432
+ }, []), V = t(() => {
433
+ w.current?.isPlaying() ? B() : z();
434
+ }, [B, z]), H = t(() => {
435
+ w.current?.reset(), j(!1);
436
+ }, []), U = t(() => {
437
+ R.current = !0, L((e) => e + 1);
438
+ }, []), W = t(() => {
439
+ let t = !1, n = C.current;
440
+ if (!n) return () => {};
441
+ let r = R.current;
442
+ return R.current = !1, N(!1), j(!1), F(null), w.current?.destroy(), w.current = null, S(n, e, {
443
+ skipPending: r,
444
+ loopCount: d,
445
+ onPlay: () => {
446
+ j(!0), T.current?.();
447
+ },
448
+ onPause: () => {
449
+ j(!1), E.current?.();
450
+ },
451
+ onEnd: () => {
452
+ j(!1), D.current?.();
453
+ },
454
+ onLoaded: (e) => {
455
+ F(e), O.current?.(e);
456
+ }
457
+ }).then((e) => {
458
+ if (t) {
459
+ e.destroy();
460
+ return;
461
+ }
462
+ w.current = e, N(!0), c && (e.play(), j(!0));
463
+ }).catch((e) => {
464
+ t || (F(null), k.current?.(e instanceof Error ? e : Error(String(e))));
465
+ }), () => {
466
+ t = !0, w.current?.destroy(), w.current = null;
467
+ };
468
+ }, [
469
+ e,
470
+ d,
471
+ c
472
+ ]);
473
+ return r(x, () => ({
474
+ play: z,
475
+ pause: B,
476
+ toggle: V,
477
+ reset: H,
478
+ reload: U,
479
+ isPlaying: () => w.current?.isPlaying() ?? !1
480
+ }), [
481
+ z,
482
+ B,
483
+ V,
484
+ H,
485
+ U
486
+ ]), n(() => W(), [W, I]), /* @__PURE__ */ s("div", {
487
+ className: [
488
+ "gif-player",
489
+ l && "gif-player--show-controls",
490
+ f
491
+ ].filter(Boolean).join(" "),
492
+ style: p,
493
+ children: [
494
+ /* @__PURE__ */ o("canvas", {
495
+ ref: C,
496
+ className: "gif-player__media",
497
+ role: "img",
498
+ style: {
499
+ ...m === void 0 ? {} : { width: m },
500
+ ...h === void 0 ? {} : { height: h },
501
+ ...M ? {} : { visibility: "hidden" }
502
+ }
503
+ }),
504
+ u && P !== null && /* @__PURE__ */ s("span", {
505
+ className: "gif-player__debug",
506
+ children: [P.toFixed(1), "ms"]
507
+ }),
508
+ l && M && /* @__PURE__ */ o("div", {
509
+ className: "gif-player__controls",
510
+ children: /* @__PURE__ */ o("button", {
511
+ type: "button",
512
+ className: "gif-player__btn",
513
+ onClick: V,
514
+ children: A ? /* @__PURE__ */ s("svg", {
515
+ viewBox: "0 0 24 24",
516
+ "aria-hidden": "true",
517
+ children: [/* @__PURE__ */ o("rect", {
518
+ x: "6",
519
+ y: "4",
520
+ width: "4",
521
+ height: "16",
522
+ rx: "1"
523
+ }), /* @__PURE__ */ o("rect", {
524
+ x: "14",
525
+ y: "4",
526
+ width: "4",
527
+ height: "16",
528
+ rx: "1"
529
+ })]
530
+ }) : /* @__PURE__ */ o("svg", {
531
+ viewBox: "0 0 24 24",
532
+ "aria-hidden": "true",
533
+ children: /* @__PURE__ */ o("path", { d: "M8 5v14l11-7z" })
534
+ })
535
+ })
536
+ })
537
+ ]
538
+ });
539
+ });
540
+ C.displayName = "GifPlayer";
541
+ //#endregion
542
+ export { C as GifPlayer, S as createGifController };
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@libshub/gif-tools",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "module": "./dist/gif-tools.es.js",
6
+ "types": "./dist/index.d.ts",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "exports": {
14
+ ".": {
15
+ "import": "./dist/gif-tools.es.js",
16
+ "types": "./dist/index.d.ts"
17
+ },
18
+ "./style.css": "./dist/gif-tools.css"
19
+ },
20
+ "sideEffects": [
21
+ "**/*.css"
22
+ ],
23
+ "engines": {
24
+ "node": ">=22"
25
+ },
26
+ "scripts": {
27
+ "dev": "vite",
28
+ "build": "tsc -p tsconfig.lib.json && vite build",
29
+ "lint": "eslint .",
30
+ "preview": "vite preview"
31
+ },
32
+ "peerDependencies": {
33
+ "react": ">=17",
34
+ "react-dom": ">=17"
35
+ },
36
+ "devDependencies": {
37
+ "@eslint/js": "^10.0.1",
38
+ "@types/node": "^24.12.3",
39
+ "@types/react": "^17.0.93",
40
+ "@types/react-dom": "^17.0.26",
41
+ "@vitejs/plugin-react": "^6.0.1",
42
+ "react": "^17.0.2",
43
+ "react-dom": "^17.0.2",
44
+ "eslint": "^10.3.0",
45
+ "eslint-plugin-react-hooks": "^7.1.1",
46
+ "eslint-plugin-react-refresh": "^0.5.2",
47
+ "globals": "^17.6.0",
48
+ "typescript": "~6.0.2",
49
+ "typescript-eslint": "^8.59.2",
50
+ "vite": "^8.0.12"
51
+ },
52
+ "dependencies": {
53
+ "gifuct-js": "^2.1.2"
54
+ }
55
+ }