sataruz-captcha 0.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 iisac
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # sataruz-captcha
2
+
3
+ Playing-Captcha — A captcha that's a claw machine.
4
+
5
+ It asks for a toy. You drive the claw with the joystick (or arrow keys), hit the red button, the claw dives down and grabs whatever's under it. Carry the catch over the hatch and drop it in. Right toy and you're verified, wrong toy bounces off the lid and goes back on the pile.
6
+
7
+ No physics engine behind it, just damped springs and scripted phases in one rAF loop. React state only changes when the phase changes, the rest is transforms written through refs, so it stays smooth even on weak devices.
8
+
9
+ Obvious but worth saying: this checks that someone is *playing*, not who they are. Keep it in front of your real checks, don't replace them with it.
10
+
11
+ <video src="https://github.com/user-attachments/assets/bc6bd3f6-173a-4aa8-a2ac-09cb47742179" controls muted loop width="420"></video>
12
+
13
+ Try it live: https://feralui.vercel.app/#/captcha
14
+
15
+ This is part of [FeralUI](https://github.com/mortspace/feralui).
16
+
17
+ ## setup
18
+
19
+ ```bash
20
+ npm install sataruz-captcha
21
+ ```
22
+
23
+ Then copy the `assets/` folder into whatever your app serves statically. The component looks for the character renders under `/sataruz/` and the logo at `/sataruz-captcha.svg` by default. Use the `assetBase` prop to change the location of character assets.
24
+
25
+ ```tsx
26
+ import { SataruzCaptcha } from 'sataruz-captcha'
27
+ import 'sataruz-captcha/sataruz-captcha.css'
28
+
29
+ <SataruzCaptcha onVerify={() => unlock()} />
30
+ ```
31
+
32
+ Leave `target` off and every mount asks for a different random character. Or pin one:
33
+
34
+ ```tsx
35
+ <SataruzCaptcha target="cao_yanbing" onVerify={() => unlock()} />
36
+ ```
37
+
38
+ The 12 character ids: cao_yanbing, irelia, titan, frok, uriel, jormungandr, netherworld, zhuqing, nine, samael, ratu_salju, qingluan.
39
+
40
+ Other props: `title` (the heading), `assetBase`, `className`. That's all of them.
41
+
42
+ ## theming
43
+
44
+ CSS vars on any ancestor:
45
+
46
+ ```css
47
+ :root {
48
+ --clawcap-bg: #ffffff; /* card */
49
+ --clawcap-ink: #1c1c1e; /* text */
50
+ --clawcap-muted: #8a8a8e;
51
+ --clawcap-accent: #1c1c1e; /* dialog button + focus ring */
52
+ --clawcap-action: #ff5159; /* the big red button */
53
+ }
54
+ ```
55
+
56
+ Keyboard runs the whole thing (arrows + space/enter), the joystick is a real slider role, and prefers-reduced-motion swaps the decorative stuff (entrance tumble, confetti, ring pulse) for instant state changes.
57
+
58
+ MIT. Character renders live in assets/sataruz.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1 @@
1
+ <svg height="512pt" viewBox="0 0 512.00032 512" width="512pt" xmlns="http://www.w3.org/2000/svg"><path d="m242.066406 511.621094c-134.90625-7.238282-242.066406-118.910156-242.066406-255.621094 0-141.386719 114.613281-256 256-256s256 114.613281 256 256c0 79.585938-36.316406 150.6875-93.28125 197.640625-16.957031-7.191406-35.636719-11.179687-55.257812-11.179687-51.859376-.003907-97.140626 27.8125-121.394532 69.160156zm0 0" fill="#08e092"/><path d="m330.1875 381.8125c-36.226562-36.222656-39.679688-91.5-7.71875-123.464844 10.859375-10.859375 24.410156-17.617187 38.988281-20.40625-3.808593-9.980468-1.699219-21.707031 6.347657-29.75 10.921874-10.921875 28.625-10.921875 39.546874 0 9.476563 9.476563 10.722657 24.058594 3.753907 34.886719 12.507812 4.9375 24.453125 12.609375 34.828125 22.988281 10.378906 10.375 18.050781 22.320313 22.988281 34.828125 10.828125-6.972656 25.414063-5.722656 34.886719 3.753907 1.074218 1.070312 2.035156 2.210937 2.890625 3.398437-12.015625 58.191406-43.789063 109.15625-87.988281 145.585937-12.480469-5.289062-25.890626-8.839843-39.921876-10.347656-4.960937-10.019531-7.71875-21.082031-7.71875-32.714844 0-1.203124.042969-2.394531.101563-3.585937-14.734375-4.695313-28.917969-13.101563-40.984375-25.171875zm-48.351562 86.527344c-.011719-.007813-.019532-.015625-.027344-.027344-9.472656-9.472656-24.058594-10.722656-34.886719-3.753906-.71875-1.816406-1.5-3.625-2.332031-5.414063 20.949218-15.007812 34.339844-37.910156 34.339844-63.574219 0-15.355468-4.800782-29.71875-13.140626-41.996093 9.753907-4.367188 16.550782-14.152344 16.550782-25.527344 0-15.445313-12.519532-27.964844-27.964844-27.964844-13.398438 0-24.59375 9.429688-27.324219 22.011719-6.488281-2.8125-13.402343-4.976562-20.636719-6.402344-.902343-13.515625-5.515624-26.148437-12.964843-37.117187 9.75-4.367188 16.550781-14.148438 16.550781-25.527344 0-15.445313-12.519531-27.964844-27.964844-27.964844-13.402344 0-24.59375 9.429688-27.324218 22.015625-12.335938-5.355468-26.207032-8.375-40.882813-8.375s-28.546875 3.019532-40.882813 8.375c-2.726562-12.585937-13.921874-22.015625-27.324218-22.015625-15.441406 0-27.960938 12.519531-27.964844 27.964844 0 11.378906 6.800781 21.160156 16.550781 25.527344-4.550781 6.703125-8.039062 14.03125-10.277343 21.800781-7.300782 1.054688-13.683594 4.933594-18.019532 10.488281 24.160156 110.628907 119.839844 194.507813 236.160156 200.75 10.011719-17.066406 23.605469-31.820312 39.765626-43.273437zm0 0" fill="#09a66d"/><path d="m194.722656 386.265625c8.882813 10.355469 8.890625 25.929687.015625 36.296875-8.035156 9.378906-20.636719 12.035156-31.265625 7.980469-2.789062 14.578125-9.546875 28.128906-20.40625 38.988281-.039062.035156-.074218.074219-.113281.113281-6.433594 6.402344-16.53125 7.351563-24.191406 2.476563-49.109375-31.25-86.851563-78.769532-105.625-134.980469 10.640625-10.144531 23.710937-16.515625 37.734375-19.195313-4.054688-10.632812-1.398438-23.234374 7.984375-31.269531 10.363281-8.875 25.941406-8.867187 36.296875.015625 10.929687 9.378906 12.714844 24.96875 5.367187 36.382813 12.507813 4.9375 24.453125 12.613281 34.828125 22.988281 10.378906 10.378906 18.050782 22.320312 22.988282 34.828125 11.417968-7.34375 27.007812-5.558594 36.386718 5.375zm0 0" fill="#028f5d"/><path d="m320 320.628906c0-15.445312 12.519531-27.964844 27.964844-27.964844 13.402344 0 24.59375 9.429688 27.324218 22.015626 12.332032-5.355469 26.207032-8.375 40.882813-8.375s28.546875 3.019531 40.882813 8.375c2.726562-12.585938 13.921874-22.015626 27.324218-22.015626 9.519532 0 17.925782 4.765626 22.976563 12.03125-11.476563 59.582032-43.597657 111.8125-88.640625 148.941407-16.953125-7.191407-35.632813-11.179688-55.253906-11.179688-5.339844 0-10.601563.304688-15.785157.878907-15.070312-14.550782-24.265625-33.917969-24.265625-55.183594 0-15.355469 4.804688-29.71875 13.140625-41.996094-9.753906-4.367188-16.550781-14.148438-16.550781-25.527344zm-28.617188 141.515625c-.199218-20.085937-7.386718-39.328125-21.851562-53.796875-10.859375-10.855468-24.410156-17.617187-38.988281-20.402344 3.808593-9.984374 1.699219-21.710937-6.347657-29.753906-10.921874-10.921875-23.273437-9.113281-34.195312 1.808594-9.476562 9.476562-16.074219 22.25-9.105469 33.078125-12.507812 4.9375-24.453125 12.609375-34.828125 22.988281-10.378906 10.375-18.050781 22.320313-22.988281 34.828125-9.703125-6.246093-22.40625-5.871093-31.765625 1.085938 8.058594 6.777343 16.542969 13.070312 25.402344 18.828125 9.960937 6.472656 21.6875-.871094 32.535156 4.191406 7.632812 3.558594 14.183594 19.894531 22.203125 22.699219 22.289063 7.800781 45.992187 12.589843 70.617187 13.914062 11.925782-20.328125 28.9375-37.382812 49.3125-49.46875zm0 0" fill="#017b4e"/><path d="m341.5 110.667969c0 27.980469-22.683594 50.667969-50.667969 50.667969h-.460937c4.3125-7.457032 6.792968-16.105469 6.792968-25.335938v-25.332031c.003907-27.984375-22.683593-50.667969-50.664062-50.667969h44.332031c27.984375 0 50.667969 22.683594 50.667969 50.667969zm0 0" fill="#017296"/><path d="m510.511719 370.816406c-5.199219 16.121094-22.480469 24.972656-38.597657 19.773438l-75.25-25.066406 18.410157 60.242187c2.800781 9.167969 4.082031 18.4375 4.039062 27.546875-44.292969 36.65625-101.128906 58.6875-163.113281 58.6875-4.917969 0-9.800781-.152344-14.652344-.425781-6.210937-8.328125-11.128906-17.839844-14.339844-28.34375l-16.519531-54.066407-38.285156 67.265626c-.242187.425781-.492187.847656-.753906 1.257812-19.421875-6.792969-37.773438-15.855469-54.734375-26.878906.570312-1.554688 1.265625-3.085938 2.109375-4.578125l53.667969-94.292969c1.71875-3.042969 3.878906-5.671875 6.359374-7.867188 4.03125-3.566406 3.390626-10.011718-1.210937-12.800781-6.09375-3.691406-11.804687-8.136719-17.015625-13.347656-13.414062-13.417969-21.765625-30.160156-25.210938-48.171875-12.953124 4.9375-28.28125 1.816406-38.222656-9.394531-11.335937-12.78125-11.527344-32.296875-.421875-45.28125 11.582031-13.542969 30.867188-15.761719 44.988281-6.671875 6.097657-15.457032 15.582032-30.214844 28.402344-43.035156 12.820313-12.820313 27.578125-22.304688 43.035156-28.402344-9.089843-14.121094-6.871093-33.410156 6.675782-44.992188 12.984375-11.101562 32.5-10.910156 45.28125.425782 11.207031 9.945312 14.328125 25.269531 9.390625 38.222656 18.011719 3.441406 34.753906 11.796875 48.171875 25.210937 26.335937 26.335938 33.203125 65.480469 21.589844 101.910157-1.683594 5.273437 2.351562 10.664062 7.882812 10.429687 3.527344-.148437 7.136719.3125 10.695312 1.457031l127.855469 42.589844c16.117188 5.199219 24.972657 22.480469 19.773438 38.597656zm0 0" fill="#fdb44c"/><path d="m256 512c-4.917969 0-9.800781-.152344-14.652344-.425781-6.210937-8.328125-11.128906-17.839844-14.339844-28.34375l-16.519531-54.066407-38.285156 67.265626c-.242187.425781-.492187.847656-.753906 1.257812-3.335938-1.167969-6.640625-2.398438-9.914063-3.699219-6.410156-2.546875-10.222656-11.601562-16.371094-14.636719-5.792968-2.867187-13.933593.316407-19.46875-2.964843-3.035156-1.796875-6.03125-3.660157-8.984374-5.578125.570312-1.554688 1.269531-3.085938 2.113281-4.578125l53.664062-94.292969c1.722657-3.042969 3.882813-5.671875 6.363281-7.867188 4.03125-3.566406 3.390626-10.011718-1.214843-12.800781-6.089844-3.691406-11.800781-8.136719-17.011719-13.347656-13.414062-13.417969-21.769531-30.160156-25.210938-48.171875-12.957031 4.9375-28.285156 1.816406-38.226562-9.398438-11.371094-12.824218-11.515625-32.421874-.316406-45.398437 8.960937-10.382813 22.464844-14.023437 34.636718-10.96875 6.175782 51.234375 39.601563 94.078125 85.371094 113.589844 10.933594 4.660156 17.105469 16.402343 14.898438 28.082031-1.621094 8.582031-2.46875 17.4375-2.46875 26.492188 0 42.171874 27.21875 89.664062 58.421875 117.894531-10.394531 1.285156-20.984375 1.957031-31.730469 1.957031zm0 0" fill="#fd9d01"/><path d="m500.78125 367.679688c-3.464844 10.746093-14.984375 16.648437-25.730469 13.183593-10.742187-3.464843-16.644531-14.988281-13.179687-25.730469 3.464844-10.746093 14.984375-16.648437 25.730468-13.183593 10.746094 3.464843 16.648438 14.984375 13.179688 25.730469zm-223.683594-156.398438c-16.933594-16.933594-48.800781-12.523438-71.171875 9.851562-22.375 22.375-26.785156 54.238282-9.851562 71.171876 16.933593 16.933593 48.796875 12.523437 71.171875-9.851563 22.375-22.371094 26.785156-54.238281 9.851562-71.171875zm2.109375 120.9375c-31.796875 12.613281-39.871093 72.777344-23.207031 114.792969 16.664062 42.011719 51.761719 49.964843 83.558594 37.351562s48.253906-41.015625 31.585937-83.027343c-16.664062-42.015626-60.140625-81.730469-91.9375-69.117188zm-123.625 131.320312c-9.828125-5.5625-22.300781-2.101562-27.859375 7.726563-.933594 1.644531-1.585937 3.367187-2.027344 5.117187 11.410157 6.757813 23.378907 12.667969 35.835938 17.617188.644531-.816406 1.25-1.671875 1.777344-2.601562 5.558594-9.828126 2.097656-22.300782-7.726563-27.859376zm-12.765625-207.308593c0-10.234375-8.296875-18.535157-18.535156-18.535157-10.234375 0-18.53125 8.300782-18.53125 18.535157 0 10.238281 8.296875 18.535156 18.53125 18.535156 10.238281 0 18.535156-8.296875 18.535156-18.535156zm98.648438-99.164063c10.238281 0 18.535156-8.296875 18.535156-18.53125 0-10.238281-8.296875-18.535156-18.535156-18.535156-10.234375 0-18.53125 8.296875-18.53125 18.535156 0 10.234375 8.296875 18.53125 18.53125 18.53125zm0 0" fill="#fcf498"/><path d="m268.214844 282.332031c-2.992188 11.949219-13.816406 20.824219-26.675782 20.824219-4.144531 0-7.5-3.355469-7.5-7.5 0-4.140625 3.355469-7.5 7.5-7.5 6.164063 0 11.289063-4.488281 12.304688-10.367188l-14.257812-14.261718c-6.875 4.101562-14.746094 4.152344-19.363282-.464844-5.777344-5.773438-4.273437-16.644531 3.359375-24.273438 7.628907-7.628906 18.496094-9.132812 24.269531-3.359374 4.621094 4.617187 4.570313 12.492187.46875 19.363281l13.359376 13.355469c6.824218-.078126 12.355468-5.648438 12.355468-12.492188 0-4.144531 3.359375-7.5 7.5-7.5 4.144532 0 7.5 3.355469 7.5 7.5.003906 12.863281-8.875 23.6875-20.820312 26.675781zm-87.410156-46.894531c-4.460938 4.464844-4.460938 11.703125 0 16.167969 4.464843 4.460937 11.703124 4.460937 16.164062 0 4.464844-4.464844 4.464844-11.703125 0-16.167969-4.460938-4.460938-11.699219-4.460938-16.164062 0zm55.589843-23.257812c4.464844-4.464844 4.464844-11.703126 0-16.164063-4.460937-4.464844-11.699219-4.464844-16.164062 0-4.460938 4.460937-4.460938 11.699219 0 16.164063 4.464843 4.460937 11.703125 4.460937 16.164062 0zm0 0" fill="#e27500"/><path d="m308.789062 56.734375v.171875c0 5.394531-.097656 10.75-.261718 16.085938h-33.167969c-3.769531 6.8125-11.023437 11.429687-19.359375 11.429687s-15.59375-4.617187-19.359375-11.429687h-5.011719c-10.3125 9.273437-16.796875 22.714843-16.796875 37.675781v25.332031c0 8.253906 1.988281 16.039062 5.492188 22.921875.113281.222656.171875.46875.171875.722656 0 .914063-.757813 1.664063-1.671875 1.625-26.644531-1.214843-47.929688-22.996093-48.320313-49.851562-.316406-21.660157 13.507813-40.292969 32.707032-47.832031v-6.75c0-9.296876 7.535156-16.835938 16.835937-16.835938h24.457031v-39.730469c3.8125-.167969 7.640625-.269531 11.496094-.269531s7.683594.101562 11.496094.269531v39.730469h24.457031c9.257813 0 16.832031 7.476562 16.835937 16.734375zm0 0" fill="#017296"/><path d="m269.265625 63.265625c0 7.324219-5.941406 13.265625-13.265625 13.265625s-13.265625-5.941406-13.265625-13.265625c0-7.328125 5.941406-13.265625 13.265625-13.265625s13.265625 5.9375 13.265625 13.265625zm0 0" fill="#024c67"/></svg>
@@ -0,0 +1,22 @@
1
+ import * as react from 'react';
2
+
3
+ type ToyId = 'cao_yanbing' | 'irelia' | 'titan' | 'frok' | 'uriel' | 'jormungandr' | 'netherworld' | 'zhuqing' | 'nine' | 'samael' | 'ratu_salju' | 'qingluan';
4
+ declare const TOY_META: Record<ToyId, {
5
+ label: string;
6
+ accent: string;
7
+ }>;
8
+
9
+ interface SataruzCaptchaProps {
10
+ /** Which toy the challenge asks for. A random toy each mount when omitted. */
11
+ target?: ToyId;
12
+ /** Fired once when the right toy lands in the tray. */
13
+ onVerify?: () => void;
14
+ /** Heading shown above the machine. */
15
+ title?: string;
16
+ /** Where the toy PNGs are served from. */
17
+ assetBase?: string;
18
+ className?: string;
19
+ }
20
+ declare function SataruzCaptcha({ target: targetProp, onVerify, title, assetBase, className, }: SataruzCaptchaProps): react.JSX.Element;
21
+
22
+ export { SataruzCaptcha, type SataruzCaptchaProps, TOY_META, type ToyId };