pictoguys 0.1.0 → 0.1.1

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/README.md CHANGED
@@ -17,7 +17,7 @@
17
17
  </p>
18
18
 
19
19
  <p align="center">
20
- <img src="https://img.shields.io/badge/version-0.1.0-ff69b4" alt="version" />
20
+ <img src="https://img.shields.io/badge/version-0.1.1-ff69b4" alt="version" />
21
21
  <img src="https://img.shields.io/badge/TypeScript-ready-3178c6?logo=typescript&logoColor=white" alt="typescript" />
22
22
  <img src="https://img.shields.io/badge/React-%E2%89%A5%2017-61dafb?logo=react&logoColor=white" alt="react" />
23
23
  <img src="https://img.shields.io/badge/runtime%20deps-0-22c55e" alt="zero deps" />
@@ -258,8 +258,8 @@ Two ways, pick whichever feels easier.
258
258
  <Picto seed="Gizmo" animate="breath" />
259
259
  ```
260
260
 
261
- Animations available: `"blink"`, `"jump"`, `"breath"`, `"dance"`.
262
- `breath` and `dance` loop forever. `blink` and `jump` play once.
261
+ Animations available: `"blink"`, `"jump"`, `"breath"`, `"dance"`, `"sleeping"`.
262
+ `breath`, `dance`, and `sleeping` loop forever. `blink` and `jump` play once.
263
263
 
264
264
  **The hands-on way: tell a specific picto to do something.**
265
265
 
@@ -276,6 +276,7 @@ function Mascot() {
276
276
  <Picto char={guy} size={140} />
277
277
  <button onClick={() => guy.blink()}>blink</button>
278
278
  <button onClick={() => guy.dance()}>dance</button>
279
+ <button onClick={() => guy.sleep()}>sleep</button>
279
280
  <button onClick={() => guy.stop()}>chill</button>
280
281
  </>
281
282
  )
@@ -287,6 +288,7 @@ guy.blink() // one blink
287
288
  guy.jump() // one hop
288
289
  guy.breath() // breathe (loops)
289
290
  guy.dance() // dance (loops)
291
+ guy.sleep() // sleep with Zs (loops)
290
292
  guy.stop() // freeze
291
293
  ```
292
294
 
@@ -305,7 +307,7 @@ guy.stop() // freeze
305
307
  | `char` | `Character` | none | Use a picto you already made (wins). |
306
308
  | `size` | `number` | `120` | Width and height, in pixels. |
307
309
  | `background` | `boolean` | `false` | Set `true` to add a background tile. |
308
- | `animate` | `"blink" \| "jump" \| "breath" \| "dance"` | none | Play an animation on loop or once. |
310
+ | `animate` | `"blink" \| "jump" \| "breath" \| "dance" \| "sleeping"` | none | Play an animation on loop or once. |
309
311
 
310
312
  Any normal `<span>` prop works too (`className`, `style`, `onClick`, and so on),
311
313
  because that is what `<Picto>` renders into.
@@ -101,7 +101,7 @@ declare function gradient(input: string | number): {
101
101
  };
102
102
  declare function resolve(input: CharInput): Resolved;
103
103
 
104
- type AnimName = 'blink' | 'jump' | 'breath' | 'dance';
104
+ type AnimName = 'blink' | 'jump' | 'breath' | 'dance' | 'sleeping';
105
105
  /** name = animation to play, or null to stop. */
106
106
  interface AnimEvent {
107
107
  name: AnimName | null;
@@ -131,6 +131,8 @@ declare class Character {
131
131
  breath(): this;
132
132
  /** Dance (loops until stop or another animation). */
133
133
  dance(): this;
134
+ /** Sleep (loops until stop or another animation). */
135
+ sleep(): this;
134
136
  /** Stop any running animation. */
135
137
  stop(): this;
136
138
  /** @internal — used by <Picto> to react to animation calls. */
@@ -101,7 +101,7 @@ declare function gradient(input: string | number): {
101
101
  };
102
102
  declare function resolve(input: CharInput): Resolved;
103
103
 
104
- type AnimName = 'blink' | 'jump' | 'breath' | 'dance';
104
+ type AnimName = 'blink' | 'jump' | 'breath' | 'dance' | 'sleeping';
105
105
  /** name = animation to play, or null to stop. */
106
106
  interface AnimEvent {
107
107
  name: AnimName | null;
@@ -131,6 +131,8 @@ declare class Character {
131
131
  breath(): this;
132
132
  /** Dance (loops until stop or another animation). */
133
133
  dance(): this;
134
+ /** Sleep (loops until stop or another animation). */
135
+ sleep(): this;
134
136
  /** Stop any running animation. */
135
137
  stop(): this;
136
138
  /** @internal — used by <Picto> to react to animation calls. */
@@ -339,6 +339,10 @@ var Character = class {
339
339
  dance() {
340
340
  return this._emit("dance");
341
341
  }
342
+ /** Sleep (loops until stop or another animation). */
343
+ sleep() {
344
+ return this._emit("sleeping");
345
+ }
342
346
  /** Stop any running animation. */
343
347
  stop() {
344
348
  return this._emit(null);
@@ -1,4 +1,4 @@
1
- import { gradient, Character } from './chunk-MHPZBNYL.js';
1
+ import { gradient, Character } from './chunk-7CLVRJRG.js';
2
2
 
3
3
  // src/picto.ts
4
4
  function character(input = 0) {
@@ -1,4 +1,4 @@
1
- import { Character } from './chunk-MHPZBNYL.js';
1
+ import { Character } from './chunk-7CLVRJRG.js';
2
2
  import * as React from 'react';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
@@ -33,6 +33,78 @@ var ANIMS = {
33
33
  }
34
34
  }
35
35
  };
36
+ var SVG_NS = "http://www.w3.org/2000/svg";
37
+ var ZZZ_PATHS = [
38
+ [
39
+ "M20 3H14V0H26V3H23V6H20V3Z",
40
+ "M14 9H17V6H20V9H26V12H14V9Z"
41
+ ],
42
+ [
43
+ "M9 15H5V13H13V15H11V17H9V15Z",
44
+ "M5 19H7V17H9V19H13V21H5V19Z"
45
+ ],
46
+ [
47
+ "M3 23V24H2V23H0V22H4V23H3Z",
48
+ "M0 25H1V24H2V25H4V26H0V25Z"
49
+ ]
50
+ ];
51
+ function makeSleepZzz() {
52
+ const wrap = document.createElementNS(SVG_NS, "g");
53
+ wrap.setAttribute("class", "sleep-zzz");
54
+ wrap.setAttribute("transform", "translate(24 -2) scale(0.55)");
55
+ wrap.style.pointerEvents = "none";
56
+ for (let i = 0; i < ZZZ_PATHS.length; i++) {
57
+ const z = document.createElementNS(SVG_NS, "g");
58
+ z.setAttribute("class", `sleep-zzz-${i}`);
59
+ z.style.willChange = "transform";
60
+ for (const d of ZZZ_PATHS[i]) {
61
+ const path = document.createElementNS(SVG_NS, "path");
62
+ path.setAttribute("d", d);
63
+ path.setAttribute("fill", i === 0 ? "#3B2199" : i === 1 ? "#4F6FC4" : "#6CA3E2");
64
+ z.appendChild(path);
65
+ }
66
+ wrap.appendChild(z);
67
+ }
68
+ return wrap;
69
+ }
70
+ function runSleepingAnim(svg) {
71
+ const char = svg.querySelector(".char");
72
+ const eyes = svg.querySelector(".eyes");
73
+ if (!char || !eyes) return () => {
74
+ };
75
+ const zzz = makeSleepZzz();
76
+ svg.appendChild(zzz);
77
+ svg.style.overflow = "visible";
78
+ char.style.transformBox = "fill-box";
79
+ char.style.transformOrigin = "50% 100%";
80
+ char.style.willChange = "transform";
81
+ eyes.style.transformBox = "fill-box";
82
+ eyes.style.transformOrigin = "center";
83
+ eyes.style.willChange = "transform";
84
+ eyes.style.transform = "scaleY(0.08)";
85
+ const zs = Array.from(zzz.children);
86
+ let raf = 0;
87
+ let start = 0;
88
+ const step = (ts) => {
89
+ if (!char.isConnected || !eyes.isConnected || !zzz.isConnected) return;
90
+ if (!start) start = ts;
91
+ const p = (ts - start) / 2800 % 1;
92
+ const breath = Math.sin(TAU * p);
93
+ char.style.transform = `scaleY(${1 + 0.025 * breath}) scaleX(${1 - 0.012 * breath})`;
94
+ for (let i = 0; i < zs.length; i++) {
95
+ const y = Math.sin(TAU * p + i * 0.85) * 1.6;
96
+ zs[i].style.transform = `translateY(${y}px)`;
97
+ }
98
+ raf = requestAnimationFrame(step);
99
+ };
100
+ raf = requestAnimationFrame(step);
101
+ return () => {
102
+ cancelAnimationFrame(raf);
103
+ char.style.transform = "";
104
+ eyes.style.transform = "";
105
+ zzz.remove();
106
+ };
107
+ }
36
108
  var reactUseId = React.useId;
37
109
  var fallbackId = 0;
38
110
  function usePictoUid() {
@@ -40,6 +112,7 @@ function usePictoUid() {
40
112
  return "p" + id.replace(/[^a-zA-Z0-9_-]/g, "") + "_";
41
113
  }
42
114
  function runAnim(svg, name) {
115
+ if (name === "sleeping") return runSleepingAnim(svg);
43
116
  const a = ANIMS[name];
44
117
  const target = svg.querySelector("." + a.target);
45
118
  if (!target) return () => {
package/dist/core.cjs CHANGED
@@ -359,6 +359,10 @@ var Character = class {
359
359
  dance() {
360
360
  return this._emit("dance");
361
361
  }
362
+ /** Sleep (loops until stop or another animation). */
363
+ sleep() {
364
+ return this._emit("sleeping");
365
+ }
362
366
  /** Stop any running animation. */
363
367
  stop() {
364
368
  return this._emit(null);
package/dist/core.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { c as CharInput, d as Character, b as CharConfig, j as gradient } from './character-DAS3IMm1.cjs';
2
- export { A as AnimEvent, a as AnimName, B as BGS, C as COLORS, e as ComposeArgs, D as DEFAULT_TUNING, E as EyeKind, M as Mode, O as OneOrMany, P as PREFIXES, f as PalEntry, R as Resolved, S as SHAPES, g as SvgOptions, T as Tuning, h as buildPalette, i as compose, r as resolve } from './character-DAS3IMm1.cjs';
1
+ import { c as CharInput, d as Character, b as CharConfig, j as gradient } from './character-DxUH8H-l.cjs';
2
+ export { A as AnimEvent, a as AnimName, B as BGS, C as COLORS, e as ComposeArgs, D as DEFAULT_TUNING, E as EyeKind, M as Mode, O as OneOrMany, P as PREFIXES, f as PalEntry, R as Resolved, S as SHAPES, g as SvgOptions, T as Tuning, h as buildPalette, i as compose, r as resolve } from './character-DxUH8H-l.cjs';
3
3
  export { hashSeed, mulberry32 } from './rng.cjs';
4
4
 
5
5
  /** Create a picto from a seed, a string, or an explicit config object. */
package/dist/core.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { c as CharInput, d as Character, b as CharConfig, j as gradient } from './character-DAS3IMm1.js';
2
- export { A as AnimEvent, a as AnimName, B as BGS, C as COLORS, e as ComposeArgs, D as DEFAULT_TUNING, E as EyeKind, M as Mode, O as OneOrMany, P as PREFIXES, f as PalEntry, R as Resolved, S as SHAPES, g as SvgOptions, T as Tuning, h as buildPalette, i as compose, r as resolve } from './character-DAS3IMm1.js';
1
+ import { c as CharInput, d as Character, b as CharConfig, j as gradient } from './character-DxUH8H-l.js';
2
+ export { A as AnimEvent, a as AnimName, B as BGS, C as COLORS, e as ComposeArgs, D as DEFAULT_TUNING, E as EyeKind, M as Mode, O as OneOrMany, P as PREFIXES, f as PalEntry, R as Resolved, S as SHAPES, g as SvgOptions, T as Tuning, h as buildPalette, i as compose, r as resolve } from './character-DxUH8H-l.js';
3
3
  export { hashSeed, mulberry32 } from './rng.js';
4
4
 
5
5
  /** Create a picto from a seed, a string, or an explicit config object. */
package/dist/core.js CHANGED
@@ -1,3 +1,3 @@
1
- export { character, picto, preset } from './chunk-RSKU5HRZ.js';
2
- export { BGS, COLORS, Character, DEFAULT_TUNING, PARTS, PREFIXES, SHAPES, buildPalette, compose, gradient, resolve } from './chunk-MHPZBNYL.js';
1
+ export { character, picto, preset } from './chunk-ETGCETAD.js';
2
+ export { BGS, COLORS, Character, DEFAULT_TUNING, PARTS, PREFIXES, SHAPES, buildPalette, compose, gradient, resolve } from './chunk-7CLVRJRG.js';
3
3
  export { hashSeed, mulberry32 } from './chunk-2W2JD54I.js';
package/dist/index.cjs CHANGED
@@ -382,6 +382,10 @@ var Character = class {
382
382
  dance() {
383
383
  return this._emit("dance");
384
384
  }
385
+ /** Sleep (loops until stop or another animation). */
386
+ sleep() {
387
+ return this._emit("sleeping");
388
+ }
385
389
  /** Stop any running animation. */
386
390
  stop() {
387
391
  return this._emit(null);
@@ -444,6 +448,78 @@ var ANIMS = {
444
448
  }
445
449
  }
446
450
  };
451
+ var SVG_NS = "http://www.w3.org/2000/svg";
452
+ var ZZZ_PATHS = [
453
+ [
454
+ "M20 3H14V0H26V3H23V6H20V3Z",
455
+ "M14 9H17V6H20V9H26V12H14V9Z"
456
+ ],
457
+ [
458
+ "M9 15H5V13H13V15H11V17H9V15Z",
459
+ "M5 19H7V17H9V19H13V21H5V19Z"
460
+ ],
461
+ [
462
+ "M3 23V24H2V23H0V22H4V23H3Z",
463
+ "M0 25H1V24H2V25H4V26H0V25Z"
464
+ ]
465
+ ];
466
+ function makeSleepZzz() {
467
+ const wrap = document.createElementNS(SVG_NS, "g");
468
+ wrap.setAttribute("class", "sleep-zzz");
469
+ wrap.setAttribute("transform", "translate(24 -2) scale(0.55)");
470
+ wrap.style.pointerEvents = "none";
471
+ for (let i = 0; i < ZZZ_PATHS.length; i++) {
472
+ const z = document.createElementNS(SVG_NS, "g");
473
+ z.setAttribute("class", `sleep-zzz-${i}`);
474
+ z.style.willChange = "transform";
475
+ for (const d of ZZZ_PATHS[i]) {
476
+ const path = document.createElementNS(SVG_NS, "path");
477
+ path.setAttribute("d", d);
478
+ path.setAttribute("fill", i === 0 ? "#3B2199" : i === 1 ? "#4F6FC4" : "#6CA3E2");
479
+ z.appendChild(path);
480
+ }
481
+ wrap.appendChild(z);
482
+ }
483
+ return wrap;
484
+ }
485
+ function runSleepingAnim(svg) {
486
+ const char = svg.querySelector(".char");
487
+ const eyes = svg.querySelector(".eyes");
488
+ if (!char || !eyes) return () => {
489
+ };
490
+ const zzz = makeSleepZzz();
491
+ svg.appendChild(zzz);
492
+ svg.style.overflow = "visible";
493
+ char.style.transformBox = "fill-box";
494
+ char.style.transformOrigin = "50% 100%";
495
+ char.style.willChange = "transform";
496
+ eyes.style.transformBox = "fill-box";
497
+ eyes.style.transformOrigin = "center";
498
+ eyes.style.willChange = "transform";
499
+ eyes.style.transform = "scaleY(0.08)";
500
+ const zs = Array.from(zzz.children);
501
+ let raf = 0;
502
+ let start = 0;
503
+ const step = (ts) => {
504
+ if (!char.isConnected || !eyes.isConnected || !zzz.isConnected) return;
505
+ if (!start) start = ts;
506
+ const p = (ts - start) / 2800 % 1;
507
+ const breath = Math.sin(TAU * p);
508
+ char.style.transform = `scaleY(${1 + 0.025 * breath}) scaleX(${1 - 0.012 * breath})`;
509
+ for (let i = 0; i < zs.length; i++) {
510
+ const y = Math.sin(TAU * p + i * 0.85) * 1.6;
511
+ zs[i].style.transform = `translateY(${y}px)`;
512
+ }
513
+ raf = requestAnimationFrame(step);
514
+ };
515
+ raf = requestAnimationFrame(step);
516
+ return () => {
517
+ cancelAnimationFrame(raf);
518
+ char.style.transform = "";
519
+ eyes.style.transform = "";
520
+ zzz.remove();
521
+ };
522
+ }
447
523
  var reactUseId = React__namespace.useId;
448
524
  var fallbackId = 0;
449
525
  function usePictoUid() {
@@ -451,6 +527,7 @@ function usePictoUid() {
451
527
  return "p" + id.replace(/[^a-zA-Z0-9_-]/g, "") + "_";
452
528
  }
453
529
  function runAnim(svg, name) {
530
+ if (name === "sleeping") return runSleepingAnim(svg);
454
531
  const a = ANIMS[name];
455
532
  const target = svg.querySelector("." + a.target);
456
533
  if (!target) return () => {
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { PARTS, Parts, Preset, character, picto, preset } from './core.cjs';
2
- export { A as AnimEvent, a as AnimName, B as BGS, C as COLORS, b as CharConfig, c as CharInput, d as Character, e as ComposeArgs, D as DEFAULT_TUNING, E as EyeKind, M as Mode, O as OneOrMany, P as PREFIXES, f as PalEntry, R as Resolved, S as SHAPES, g as SvgOptions, T as Tuning, h as buildPalette, i as compose, j as gradient, r as resolve } from './character-DAS3IMm1.cjs';
2
+ export { A as AnimEvent, a as AnimName, B as BGS, C as COLORS, b as CharConfig, c as CharInput, d as Character, e as ComposeArgs, D as DEFAULT_TUNING, E as EyeKind, M as Mode, O as OneOrMany, P as PREFIXES, f as PalEntry, R as Resolved, S as SHAPES, g as SvgOptions, T as Tuning, h as buildPalette, i as compose, j as gradient, r as resolve } from './character-DxUH8H-l.cjs';
3
3
  export { hashSeed, mulberry32 } from './rng.cjs';
4
4
  export { Picto, PictoProps } from './react.cjs';
5
5
  import 'react';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { PARTS, Parts, Preset, character, picto, preset } from './core.js';
2
- export { A as AnimEvent, a as AnimName, B as BGS, C as COLORS, b as CharConfig, c as CharInput, d as Character, e as ComposeArgs, D as DEFAULT_TUNING, E as EyeKind, M as Mode, O as OneOrMany, P as PREFIXES, f as PalEntry, R as Resolved, S as SHAPES, g as SvgOptions, T as Tuning, h as buildPalette, i as compose, j as gradient, r as resolve } from './character-DAS3IMm1.js';
2
+ export { A as AnimEvent, a as AnimName, B as BGS, C as COLORS, b as CharConfig, c as CharInput, d as Character, e as ComposeArgs, D as DEFAULT_TUNING, E as EyeKind, M as Mode, O as OneOrMany, P as PREFIXES, f as PalEntry, R as Resolved, S as SHAPES, g as SvgOptions, T as Tuning, h as buildPalette, i as compose, j as gradient, r as resolve } from './character-DxUH8H-l.js';
3
3
  export { hashSeed, mulberry32 } from './rng.js';
4
4
  export { Picto, PictoProps } from './react.js';
5
5
  import 'react';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { character, picto, preset } from './chunk-RSKU5HRZ.js';
2
- export { Picto } from './chunk-74VFD4AY.js';
3
- export { BGS, COLORS, Character, DEFAULT_TUNING, PARTS, PREFIXES, SHAPES, buildPalette, compose, gradient, resolve } from './chunk-MHPZBNYL.js';
1
+ export { character, picto, preset } from './chunk-ETGCETAD.js';
2
+ export { Picto } from './chunk-OF2R5NOW.js';
3
+ export { BGS, COLORS, Character, DEFAULT_TUNING, PARTS, PREFIXES, SHAPES, buildPalette, compose, gradient, resolve } from './chunk-7CLVRJRG.js';
4
4
  export { hashSeed, mulberry32 } from './chunk-2W2JD54I.js';
package/dist/react.cjs CHANGED
@@ -381,6 +381,10 @@ var Character = class {
381
381
  dance() {
382
382
  return this._emit("dance");
383
383
  }
384
+ /** Sleep (loops until stop or another animation). */
385
+ sleep() {
386
+ return this._emit("sleeping");
387
+ }
384
388
  /** Stop any running animation. */
385
389
  stop() {
386
390
  return this._emit(null);
@@ -428,6 +432,78 @@ var ANIMS = {
428
432
  }
429
433
  }
430
434
  };
435
+ var SVG_NS = "http://www.w3.org/2000/svg";
436
+ var ZZZ_PATHS = [
437
+ [
438
+ "M20 3H14V0H26V3H23V6H20V3Z",
439
+ "M14 9H17V6H20V9H26V12H14V9Z"
440
+ ],
441
+ [
442
+ "M9 15H5V13H13V15H11V17H9V15Z",
443
+ "M5 19H7V17H9V19H13V21H5V19Z"
444
+ ],
445
+ [
446
+ "M3 23V24H2V23H0V22H4V23H3Z",
447
+ "M0 25H1V24H2V25H4V26H0V25Z"
448
+ ]
449
+ ];
450
+ function makeSleepZzz() {
451
+ const wrap = document.createElementNS(SVG_NS, "g");
452
+ wrap.setAttribute("class", "sleep-zzz");
453
+ wrap.setAttribute("transform", "translate(24 -2) scale(0.55)");
454
+ wrap.style.pointerEvents = "none";
455
+ for (let i = 0; i < ZZZ_PATHS.length; i++) {
456
+ const z = document.createElementNS(SVG_NS, "g");
457
+ z.setAttribute("class", `sleep-zzz-${i}`);
458
+ z.style.willChange = "transform";
459
+ for (const d of ZZZ_PATHS[i]) {
460
+ const path = document.createElementNS(SVG_NS, "path");
461
+ path.setAttribute("d", d);
462
+ path.setAttribute("fill", i === 0 ? "#3B2199" : i === 1 ? "#4F6FC4" : "#6CA3E2");
463
+ z.appendChild(path);
464
+ }
465
+ wrap.appendChild(z);
466
+ }
467
+ return wrap;
468
+ }
469
+ function runSleepingAnim(svg) {
470
+ const char = svg.querySelector(".char");
471
+ const eyes = svg.querySelector(".eyes");
472
+ if (!char || !eyes) return () => {
473
+ };
474
+ const zzz = makeSleepZzz();
475
+ svg.appendChild(zzz);
476
+ svg.style.overflow = "visible";
477
+ char.style.transformBox = "fill-box";
478
+ char.style.transformOrigin = "50% 100%";
479
+ char.style.willChange = "transform";
480
+ eyes.style.transformBox = "fill-box";
481
+ eyes.style.transformOrigin = "center";
482
+ eyes.style.willChange = "transform";
483
+ eyes.style.transform = "scaleY(0.08)";
484
+ const zs = Array.from(zzz.children);
485
+ let raf = 0;
486
+ let start = 0;
487
+ const step = (ts) => {
488
+ if (!char.isConnected || !eyes.isConnected || !zzz.isConnected) return;
489
+ if (!start) start = ts;
490
+ const p = (ts - start) / 2800 % 1;
491
+ const breath = Math.sin(TAU * p);
492
+ char.style.transform = `scaleY(${1 + 0.025 * breath}) scaleX(${1 - 0.012 * breath})`;
493
+ for (let i = 0; i < zs.length; i++) {
494
+ const y = Math.sin(TAU * p + i * 0.85) * 1.6;
495
+ zs[i].style.transform = `translateY(${y}px)`;
496
+ }
497
+ raf = requestAnimationFrame(step);
498
+ };
499
+ raf = requestAnimationFrame(step);
500
+ return () => {
501
+ cancelAnimationFrame(raf);
502
+ char.style.transform = "";
503
+ eyes.style.transform = "";
504
+ zzz.remove();
505
+ };
506
+ }
431
507
  var reactUseId = React__namespace.useId;
432
508
  var fallbackId = 0;
433
509
  function usePictoUid() {
@@ -435,6 +511,7 @@ function usePictoUid() {
435
511
  return "p" + id.replace(/[^a-zA-Z0-9_-]/g, "") + "_";
436
512
  }
437
513
  function runAnim(svg, name) {
514
+ if (name === "sleeping") return runSleepingAnim(svg);
438
515
  const a = ANIMS[name];
439
516
  const target = svg.querySelector("." + a.target);
440
517
  if (!target) return () => {
package/dist/react.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { d as Character, b as CharConfig, a as AnimName } from './character-DAS3IMm1.cjs';
2
+ import { d as Character, b as CharConfig, a as AnimName } from './character-DxUH8H-l.cjs';
3
3
 
4
4
  interface PictoProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'> {
5
5
  /** An existing character (e.g. from picto.character). Wins over seed/config. */
package/dist/react.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { d as Character, b as CharConfig, a as AnimName } from './character-DAS3IMm1.js';
2
+ import { d as Character, b as CharConfig, a as AnimName } from './character-DxUH8H-l.js';
3
3
 
4
4
  interface PictoProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'> {
5
5
  /** An existing character (e.g. from picto.character). Wins over seed/config. */
package/dist/react.js CHANGED
@@ -1,3 +1,3 @@
1
- export { Picto } from './chunk-74VFD4AY.js';
2
- import './chunk-MHPZBNYL.js';
1
+ export { Picto } from './chunk-OF2R5NOW.js';
2
+ import './chunk-7CLVRJRG.js';
3
3
  import './chunk-2W2JD54I.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pictoguys",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Tiny React library for procedural SVG characters. Seed in, character out.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",