@varthe/oneko-react 1.0.2 → 1.0.3
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.cjs.js +1 -6
- package/dist/index.es.js +21 -198
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});
|
|
2
|
-
let props = %s;
|
|
3
|
-
<%s {...props} />
|
|
4
|
-
React keys must be passed directly to JSX without using spread:
|
|
5
|
-
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,o,p,m,p),L[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require(`react`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.client.reference`),k=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,j=Array.isArray,M=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var N,P={},F=m.react_stack_bottom_frame.bind(m,o)(),I=M(i(o)),L={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)},e.jsxs=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)}})()})),i=e(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=n():t.exports=r()}))(),a={idle:[[-3,-3]],alert:[[-7,-3]],scratchSelf:[[-5,0],[-6,0],[-7,0]],scratchWallN:[[0,0],[0,-1]],scratchWallS:[[-7,-1],[-6,-2]],scratchWallE:[[-2,-2],[-2,-3]],scratchWallW:[[-4,0],[-4,-1]],tired:[[-3,-2]],sleeping:[[-2,0],[-2,-1]],N:[[-1,-2],[-1,-3]],NE:[[0,-2],[0,-3]],E:[[-3,0],[-3,-1]],SE:[[-5,-1],[-5,-2]],S:[[-6,-3],[-7,-2]],SW:[[-5,-3],[-6,-1]],W:[[-4,-2],[-4,-3]],NW:[[-1,0],[-1,-1]]};function o({offsetX:e=0,speed:n=10,sleepAfter:r=1e4,idleAfter:o=5e3}){let s=(0,t.useRef)(null),c=(0,t.useRef)(null);return(0,t.useEffect)(()=>{if(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches===!0)return;let t=c.current;if(!t)return;let i=s.current,l=i?.getBoundingClientRect(),u=(l?l.left+l.width/2:32)+e,d=l?l.top+l.height/2:32,f=0,p=0,m=0,h=200,g=`sleeping`,_=100,v,y;t.style.left=`${u-16}px`,t.style.top=`${d-16}px`;function b(e,n){let r=a[e],i=r[n%r.length];t.style.backgroundPosition=`${i[0]*32}px ${i[1]*32}px`}function x(){g=null,_=0}function S(){if(h+=1,g===null&&!T&&Date.now()-w>o){let e=[];f<64&&e.push(`scratchWallW`),p<64&&e.push(`scratchWallN`),f>window.innerWidth-64&&e.push(`scratchWallE`),p>window.innerHeight-64&&e.push(`scratchWallS`);let t=e.length>0?e:[`scratchSelf`];g=t[Math.floor(Math.random()*t.length)],T=!0}switch(g){case`sleeping`:if(_<8){b(`tired`,0);break}b(`sleeping`,Math.floor(_/4)),_>192&&x();break;case`scratchWallN`:case`scratchWallS`:case`scratchWallE`:case`scratchWallW`:case`scratchSelf`:b(g,_),_>9&&x();break;default:b(`idle`,0);return}_+=1}function C(){m+=1;let e=u-f,r=d-p,i=Math.sqrt(e**2+r**2);if(i<n||i<48){S();return}if(g=null,_=0,T=!1,h>1){b(`alert`,0),h=Math.min(h,7),--h;return}let a=``;a+=r/i>.5?`N`:``,a+=r/i<-.5?`S`:``,a+=e/i>.5?`W`:``,a+=e/i<-.5?`E`:``,b(a,m),u-=e/i*n,d-=r/i*n,u=Math.min(Math.max(16,u),window.innerWidth-16),d=Math.min(Math.max(16,d),window.innerHeight-16),t.style.left=`${u-16}px`,t.style.top=`${d-16}px`}let w=0,T=!1,E=0,D,O,k,A=!0;function j(e){D||=e,e-D>600&&(D=e,b(`sleeping`,E),E+=1),O=window.requestAnimationFrame(j)}function M(e,n,r=!1){window.cancelAnimationFrame(O),window.clearTimeout(k),A=!1,f=e,p=n,w=Date.now(),h=r?7:0,g=null,_=0,T=!1,v=void 0,t.style.pointerEvents=`none`,t.style.cursor=`default`,document.addEventListener(`mousemove`,R),y=window.requestAnimationFrame(z)}function N(e){t.removeEventListener(`click`,N),M(e.clientX,e.clientY)}function P(e){document.removeEventListener(`mousemove`,P),M(e.clientX,e.clientY,!0)}function F(){A=!0,window.cancelAnimationFrame(y),document.removeEventListener(`mousemove`,R),b(`tired`,0),k=window.setTimeout(()=>{E=0,D=void 0,O=window.requestAnimationFrame(j),document.addEventListener(`mousemove`,P)},1e3)}function I(){if(!A||!i)return;let n=i.getBoundingClientRect();u=n.left+n.width/2+e,d=n.top+n.height/2,t.style.left=`${u-16}px`,t.style.top=`${d-16}px`}function L(){I()}function R(e){f=e.clientX,p=e.clientY,w=Date.now()}function z(e){if(Date.now()-w>r&&g===null){F();return}v||=e,e-v>100&&(v=e,C()),y=window.requestAnimationFrame(z)}return b(`sleeping`,0),t.style.pointerEvents=`auto`,t.style.cursor=`pointer`,O=window.requestAnimationFrame(j),t.addEventListener(`click`,N),window.addEventListener(`resize`,L),document.readyState!==`complete`&&window.addEventListener(`load`,I),()=>{window.cancelAnimationFrame(y),window.cancelAnimationFrame(O),window.clearTimeout(k),document.removeEventListener(`mousemove`,R),document.removeEventListener(`mousemove`,P),t.removeEventListener(`click`,N),window.removeEventListener(`resize`,L),window.removeEventListener(`load`,I)}},[s]),(0,i.jsxs)(t.Fragment,{children:[(0,i.jsx)(`span`,{ref:s,"aria-hidden":`true`,style:{display:`inline-block`,width:0,height:0}}),(0,i.jsx)(`div`,{ref:c,"aria-hidden":`true`,style:{width:32,height:32,position:`fixed`,pointerEvents:`none`,imageRendering:`pixelated`,zIndex:2147483647,backgroundImage:`url(./oneko.gif)`}})]})}exports.Oneko=o;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`react`),t=require(`react/jsx-runtime`);var n={idle:[[-3,-3]],alert:[[-7,-3]],scratchSelf:[[-5,0],[-6,0],[-7,0]],scratchWallN:[[0,0],[0,-1]],scratchWallS:[[-7,-1],[-6,-2]],scratchWallE:[[-2,-2],[-2,-3]],scratchWallW:[[-4,0],[-4,-1]],tired:[[-3,-2]],sleeping:[[-2,0],[-2,-1]],N:[[-1,-2],[-1,-3]],NE:[[0,-2],[0,-3]],E:[[-3,0],[-3,-1]],SE:[[-5,-1],[-5,-2]],S:[[-6,-3],[-7,-2]],SW:[[-5,-3],[-6,-1]],W:[[-4,-2],[-4,-3]],NW:[[-1,0],[-1,-1]]};function r({offsetX:r=0,speed:i=10,sleepAfter:a=1e4,idleAfter:o=5e3}){let s=(0,e.useRef)(null),c=(0,e.useRef)(null);return(0,e.useEffect)(()=>{if(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches===!0)return;let e=c.current;if(!e)return;let t=s.current,l=t?.getBoundingClientRect(),u=(l?l.left+l.width/2:32)+r,d=l?l.top+l.height/2:32,f=0,p=0,m=0,h=200,g=`sleeping`,_=100,v,y;e.style.left=`${u-16}px`,e.style.top=`${d-16}px`;function b(t,r){let i=n[t],a=i[r%i.length];e.style.backgroundPosition=`${a[0]*32}px ${a[1]*32}px`}function x(){g=null,_=0}function S(){if(h+=1,g===null&&!T&&Date.now()-w>o){let e=[];f<64&&e.push(`scratchWallW`),p<64&&e.push(`scratchWallN`),f>window.innerWidth-64&&e.push(`scratchWallE`),p>window.innerHeight-64&&e.push(`scratchWallS`);let t=e.length>0?e:[`scratchSelf`];g=t[Math.floor(Math.random()*t.length)],T=!0}switch(g){case`sleeping`:if(_<8){b(`tired`,0);break}b(`sleeping`,Math.floor(_/4)),_>192&&x();break;case`scratchWallN`:case`scratchWallS`:case`scratchWallE`:case`scratchWallW`:case`scratchSelf`:b(g,_),_>9&&x();break;default:b(`idle`,0);return}_+=1}function C(){m+=1;let t=u-f,n=d-p,r=Math.sqrt(t**2+n**2);if(r<i||r<48){S();return}if(g=null,_=0,T=!1,h>1){b(`alert`,0),h=Math.min(h,7),--h;return}let a=``;a+=n/r>.5?`N`:``,a+=n/r<-.5?`S`:``,a+=t/r>.5?`W`:``,a+=t/r<-.5?`E`:``,b(a,m),u-=t/r*i,d-=n/r*i,u=Math.min(Math.max(16,u),window.innerWidth-16),d=Math.min(Math.max(16,d),window.innerHeight-16),e.style.left=`${u-16}px`,e.style.top=`${d-16}px`}let w=0,T=!1,E=0,D,O,k,A=!0;function j(e){D||=e,e-D>600&&(D=e,b(`sleeping`,E),E+=1),O=window.requestAnimationFrame(j)}function M(t,n,r=!1){window.cancelAnimationFrame(O),window.clearTimeout(k),A=!1,f=t,p=n,w=Date.now(),h=r?7:0,g=null,_=0,T=!1,v=void 0,e.style.pointerEvents=`none`,e.style.cursor=`default`,document.addEventListener(`mousemove`,R),y=window.requestAnimationFrame(z)}function N(t){e.removeEventListener(`click`,N),M(t.clientX,t.clientY)}function P(e){document.removeEventListener(`mousemove`,P),M(e.clientX,e.clientY,!0)}function F(){A=!0,window.cancelAnimationFrame(y),document.removeEventListener(`mousemove`,R),b(`tired`,0),k=window.setTimeout(()=>{E=0,D=void 0,O=window.requestAnimationFrame(j),document.addEventListener(`mousemove`,P)},1e3)}function I(){if(!A||!t)return;let n=t.getBoundingClientRect();u=n.left+n.width/2+r,d=n.top+n.height/2,e.style.left=`${u-16}px`,e.style.top=`${d-16}px`}function L(){I()}function R(e){f=e.clientX,p=e.clientY,w=Date.now()}function z(e){if(Date.now()-w>a&&g===null){F();return}v||=e,e-v>100&&(v=e,C()),y=window.requestAnimationFrame(z)}return b(`sleeping`,0),e.style.pointerEvents=`auto`,e.style.cursor=`pointer`,O=window.requestAnimationFrame(j),e.addEventListener(`click`,N),window.addEventListener(`resize`,L),document.readyState!==`complete`&&window.addEventListener(`load`,I),()=>{window.cancelAnimationFrame(y),window.cancelAnimationFrame(O),window.clearTimeout(k),document.removeEventListener(`mousemove`,R),document.removeEventListener(`mousemove`,P),e.removeEventListener(`click`,N),window.removeEventListener(`resize`,L),window.removeEventListener(`load`,I)}},[s]),(0,t.jsxs)(e.Fragment,{children:[(0,t.jsx)(`span`,{ref:s,"aria-hidden":`true`,style:{display:`inline-block`,width:0,height:0}}),(0,t.jsx)(`div`,{ref:c,"aria-hidden":`true`,style:{width:32,height:32,position:`fixed`,pointerEvents:`none`,imageRendering:`pixelated`,zIndex:2147483647,backgroundImage:`url(./oneko.gif)`}})]})}exports.Oneko=r;
|
package/dist/index.es.js
CHANGED
|
@@ -1,184 +1,7 @@
|
|
|
1
1
|
import { Fragment as e, useEffect as t, useRef as n } from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
6
|
-
}), a = /* @__PURE__ */ r(((e) => {
|
|
7
|
-
var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
8
|
-
function r(e, n, r) {
|
|
9
|
-
var i = null;
|
|
10
|
-
if (r !== void 0 && (i = "" + r), n.key !== void 0 && (i = "" + n.key), "key" in n) for (var a in r = {}, n) a !== "key" && (r[a] = n[a]);
|
|
11
|
-
else r = n;
|
|
12
|
-
return n = r.ref, {
|
|
13
|
-
$$typeof: t,
|
|
14
|
-
type: e,
|
|
15
|
-
key: i,
|
|
16
|
-
ref: n === void 0 ? null : n,
|
|
17
|
-
props: r
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
e.Fragment = n, e.jsx = r, e.jsxs = r;
|
|
21
|
-
})), o = /* @__PURE__ */ r(((e) => {
|
|
22
|
-
process.env.NODE_ENV !== "production" && (function() {
|
|
23
|
-
function t(e) {
|
|
24
|
-
if (e == null) return null;
|
|
25
|
-
if (typeof e == "function") return e.$$typeof === k ? null : e.displayName || e.name || null;
|
|
26
|
-
if (typeof e == "string") return e;
|
|
27
|
-
switch (e) {
|
|
28
|
-
case v: return "Fragment";
|
|
29
|
-
case b: return "Profiler";
|
|
30
|
-
case y: return "StrictMode";
|
|
31
|
-
case w: return "Suspense";
|
|
32
|
-
case T: return "SuspenseList";
|
|
33
|
-
case O: return "Activity";
|
|
34
|
-
}
|
|
35
|
-
if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
|
|
36
|
-
case _: return "Portal";
|
|
37
|
-
case S: return e.displayName || "Context";
|
|
38
|
-
case x: return (e._context.displayName || "Context") + ".Consumer";
|
|
39
|
-
case C:
|
|
40
|
-
var n = e.render;
|
|
41
|
-
return e = e.displayName, e ||= (e = n.displayName || n.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
|
|
42
|
-
case E: return n = e.displayName || null, n === null ? t(e.type) || "Memo" : n;
|
|
43
|
-
case D:
|
|
44
|
-
n = e._payload, e = e._init;
|
|
45
|
-
try {
|
|
46
|
-
return t(e(n));
|
|
47
|
-
} catch {}
|
|
48
|
-
}
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
function n(e) {
|
|
52
|
-
return "" + e;
|
|
53
|
-
}
|
|
54
|
-
function r(e) {
|
|
55
|
-
try {
|
|
56
|
-
n(e);
|
|
57
|
-
var t = !1;
|
|
58
|
-
} catch {
|
|
59
|
-
t = !0;
|
|
60
|
-
}
|
|
61
|
-
if (t) {
|
|
62
|
-
t = console;
|
|
63
|
-
var r = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
64
|
-
return r.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", i), n(e);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
function a(e) {
|
|
68
|
-
if (e === v) return "<>";
|
|
69
|
-
if (typeof e == "object" && e && e.$$typeof === D) return "<...>";
|
|
70
|
-
try {
|
|
71
|
-
var n = t(e);
|
|
72
|
-
return n ? "<" + n + ">" : "<...>";
|
|
73
|
-
} catch {
|
|
74
|
-
return "<...>";
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
function o() {
|
|
78
|
-
var e = A.A;
|
|
79
|
-
return e === null ? null : e.getOwner();
|
|
80
|
-
}
|
|
81
|
-
function s() {
|
|
82
|
-
return Error("react-stack-top-frame");
|
|
83
|
-
}
|
|
84
|
-
function c(e) {
|
|
85
|
-
if (j.call(e, "key")) {
|
|
86
|
-
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
87
|
-
if (t && t.isReactWarning) return !1;
|
|
88
|
-
}
|
|
89
|
-
return e.key !== void 0;
|
|
90
|
-
}
|
|
91
|
-
function l(e, t) {
|
|
92
|
-
function n() {
|
|
93
|
-
P || (P = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
|
|
94
|
-
}
|
|
95
|
-
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
96
|
-
get: n,
|
|
97
|
-
configurable: !0
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
function u() {
|
|
101
|
-
var e = t(this.type);
|
|
102
|
-
return F[e] || (F[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
|
|
103
|
-
}
|
|
104
|
-
function d(e, t, n, r, i, a) {
|
|
105
|
-
var o = n.ref;
|
|
106
|
-
return e = {
|
|
107
|
-
$$typeof: g,
|
|
108
|
-
type: e,
|
|
109
|
-
key: t,
|
|
110
|
-
props: n,
|
|
111
|
-
_owner: r
|
|
112
|
-
}, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
|
|
113
|
-
enumerable: !1,
|
|
114
|
-
value: null
|
|
115
|
-
}) : Object.defineProperty(e, "ref", {
|
|
116
|
-
enumerable: !1,
|
|
117
|
-
get: u
|
|
118
|
-
}), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
119
|
-
configurable: !1,
|
|
120
|
-
enumerable: !1,
|
|
121
|
-
writable: !0,
|
|
122
|
-
value: 0
|
|
123
|
-
}), Object.defineProperty(e, "_debugInfo", {
|
|
124
|
-
configurable: !1,
|
|
125
|
-
enumerable: !1,
|
|
126
|
-
writable: !0,
|
|
127
|
-
value: null
|
|
128
|
-
}), Object.defineProperty(e, "_debugStack", {
|
|
129
|
-
configurable: !1,
|
|
130
|
-
enumerable: !1,
|
|
131
|
-
writable: !0,
|
|
132
|
-
value: i
|
|
133
|
-
}), Object.defineProperty(e, "_debugTask", {
|
|
134
|
-
configurable: !1,
|
|
135
|
-
enumerable: !1,
|
|
136
|
-
writable: !0,
|
|
137
|
-
value: a
|
|
138
|
-
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
139
|
-
}
|
|
140
|
-
function f(e, n, i, a, s, u) {
|
|
141
|
-
var f = n.children;
|
|
142
|
-
if (f !== void 0) if (a) if (M(f)) {
|
|
143
|
-
for (a = 0; a < f.length; a++) p(f[a]);
|
|
144
|
-
Object.freeze && Object.freeze(f);
|
|
145
|
-
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
146
|
-
else p(f);
|
|
147
|
-
if (j.call(n, "key")) {
|
|
148
|
-
f = t(e);
|
|
149
|
-
var m = Object.keys(n).filter(function(e) {
|
|
150
|
-
return e !== "key";
|
|
151
|
-
});
|
|
152
|
-
a = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", R[f + a] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", a, f, m, f), R[f + a] = !0);
|
|
153
|
-
}
|
|
154
|
-
if (f = null, i !== void 0 && (r(i), f = "" + i), c(n) && (r(n.key), f = "" + n.key), "key" in n) for (var h in i = {}, n) h !== "key" && (i[h] = n[h]);
|
|
155
|
-
else i = n;
|
|
156
|
-
return f && l(i, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), d(e, f, i, o(), s, u);
|
|
157
|
-
}
|
|
158
|
-
function p(e) {
|
|
159
|
-
m(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === D && (e._payload.status === "fulfilled" ? m(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
160
|
-
}
|
|
161
|
-
function m(e) {
|
|
162
|
-
return typeof e == "object" && !!e && e.$$typeof === g;
|
|
163
|
-
}
|
|
164
|
-
var h = i("react"), g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), k = Symbol.for("react.client.reference"), A = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, M = Array.isArray, N = console.createTask ? console.createTask : function() {
|
|
165
|
-
return null;
|
|
166
|
-
};
|
|
167
|
-
h = { react_stack_bottom_frame: function(e) {
|
|
168
|
-
return e();
|
|
169
|
-
} };
|
|
170
|
-
var P, F = {}, I = h.react_stack_bottom_frame.bind(h, s)(), L = N(a(s)), R = {};
|
|
171
|
-
e.Fragment = v, e.jsx = function(e, t, n) {
|
|
172
|
-
var r = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
173
|
-
return f(e, t, n, !1, r ? Error("react-stack-top-frame") : I, r ? N(a(e)) : L);
|
|
174
|
-
}, e.jsxs = function(e, t, n) {
|
|
175
|
-
var r = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
176
|
-
return f(e, t, n, !0, r ? Error("react-stack-top-frame") : I, r ? N(a(e)) : L);
|
|
177
|
-
};
|
|
178
|
-
})();
|
|
179
|
-
})), s = (/* @__PURE__ */ r(((e, t) => {
|
|
180
|
-
process.env.NODE_ENV === "production" ? t.exports = a() : t.exports = o();
|
|
181
|
-
})))(), c = {
|
|
2
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
3
|
+
//#region Oneko.tsx
|
|
4
|
+
var a = {
|
|
182
5
|
idle: [[-3, -3]],
|
|
183
6
|
alert: [[-7, -3]],
|
|
184
7
|
scratchSelf: [
|
|
@@ -201,23 +24,23 @@ var r = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), i
|
|
|
201
24
|
W: [[-4, -2], [-4, -3]],
|
|
202
25
|
NW: [[-1, 0], [-1, -1]]
|
|
203
26
|
};
|
|
204
|
-
function
|
|
205
|
-
let
|
|
27
|
+
function o({ offsetX: o = 0, speed: s = 10, sleepAfter: c = 1e4, idleAfter: l = 5e3 }) {
|
|
28
|
+
let u = n(null), d = n(null);
|
|
206
29
|
return t(() => {
|
|
207
30
|
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches === !0) return;
|
|
208
|
-
let e =
|
|
31
|
+
let e = d.current;
|
|
209
32
|
if (!e) return;
|
|
210
|
-
let t =
|
|
211
|
-
e.style.left = `${
|
|
33
|
+
let t = u.current, n = t?.getBoundingClientRect(), r = (n ? n.left + n.width / 2 : 32) + o, i = n ? n.top + n.height / 2 : 32, f = 0, p = 0, m = 0, h = 200, g = "sleeping", _ = 100, v, y;
|
|
34
|
+
e.style.left = `${r - 16}px`, e.style.top = `${i - 16}px`;
|
|
212
35
|
function b(t, n) {
|
|
213
|
-
let r =
|
|
36
|
+
let r = a[t], i = r[n % r.length];
|
|
214
37
|
e.style.backgroundPosition = `${i[0] * 32}px ${i[1] * 32}px`;
|
|
215
38
|
}
|
|
216
39
|
function x() {
|
|
217
40
|
g = null, _ = 0;
|
|
218
41
|
}
|
|
219
42
|
function S() {
|
|
220
|
-
if (h += 1, g === null && !T && Date.now() - w >
|
|
43
|
+
if (h += 1, g === null && !T && Date.now() - w > l) {
|
|
221
44
|
let e = [];
|
|
222
45
|
f < 64 && e.push("scratchWallW"), p < 64 && e.push("scratchWallN"), f > window.innerWidth - 64 && e.push("scratchWallE"), p > window.innerHeight - 64 && e.push("scratchWallS");
|
|
223
46
|
let t = e.length > 0 ? e : ["scratchSelf"];
|
|
@@ -246,8 +69,8 @@ function l({ offsetX: r = 0, speed: i = 10, sleepAfter: a = 1e4, idleAfter: o =
|
|
|
246
69
|
}
|
|
247
70
|
function C() {
|
|
248
71
|
m += 1;
|
|
249
|
-
let t =
|
|
250
|
-
if (
|
|
72
|
+
let t = r - f, n = i - p, a = Math.sqrt(t ** 2 + n ** 2);
|
|
73
|
+
if (a < s || a < 48) {
|
|
251
74
|
S();
|
|
252
75
|
return;
|
|
253
76
|
}
|
|
@@ -255,8 +78,8 @@ function l({ offsetX: r = 0, speed: i = 10, sleepAfter: a = 1e4, idleAfter: o =
|
|
|
255
78
|
b("alert", 0), h = Math.min(h, 7), --h;
|
|
256
79
|
return;
|
|
257
80
|
}
|
|
258
|
-
let
|
|
259
|
-
|
|
81
|
+
let o = "";
|
|
82
|
+
o += n / a > .5 ? "N" : "", o += n / a < -.5 ? "S" : "", o += t / a > .5 ? "W" : "", o += t / a < -.5 ? "E" : "", b(o, m), r -= t / a * s, i -= n / a * s, r = Math.min(Math.max(16, r), window.innerWidth - 16), i = Math.min(Math.max(16, i), window.innerHeight - 16), e.style.left = `${r - 16}px`, e.style.top = `${i - 16}px`;
|
|
260
83
|
}
|
|
261
84
|
let w = 0, T = !1, E = 0, D, O, k, A = !0;
|
|
262
85
|
function j(e) {
|
|
@@ -279,7 +102,7 @@ function l({ offsetX: r = 0, speed: i = 10, sleepAfter: a = 1e4, idleAfter: o =
|
|
|
279
102
|
function I() {
|
|
280
103
|
if (!A || !t) return;
|
|
281
104
|
let n = t.getBoundingClientRect();
|
|
282
|
-
|
|
105
|
+
r = n.left + n.width / 2 + o, i = n.top + n.height / 2, e.style.left = `${r - 16}px`, e.style.top = `${i - 16}px`;
|
|
283
106
|
}
|
|
284
107
|
function L() {
|
|
285
108
|
I();
|
|
@@ -288,7 +111,7 @@ function l({ offsetX: r = 0, speed: i = 10, sleepAfter: a = 1e4, idleAfter: o =
|
|
|
288
111
|
f = e.clientX, p = e.clientY, w = Date.now();
|
|
289
112
|
}
|
|
290
113
|
function z(e) {
|
|
291
|
-
if (Date.now() - w >
|
|
114
|
+
if (Date.now() - w > c && g === null) {
|
|
292
115
|
F();
|
|
293
116
|
return;
|
|
294
117
|
}
|
|
@@ -297,16 +120,16 @@ function l({ offsetX: r = 0, speed: i = 10, sleepAfter: a = 1e4, idleAfter: o =
|
|
|
297
120
|
return b("sleeping", 0), e.style.pointerEvents = "auto", e.style.cursor = "pointer", O = window.requestAnimationFrame(j), e.addEventListener("click", N), window.addEventListener("resize", L), document.readyState !== "complete" && window.addEventListener("load", I), () => {
|
|
298
121
|
window.cancelAnimationFrame(y), window.cancelAnimationFrame(O), window.clearTimeout(k), document.removeEventListener("mousemove", R), document.removeEventListener("mousemove", P), e.removeEventListener("click", N), window.removeEventListener("resize", L), window.removeEventListener("load", I);
|
|
299
122
|
};
|
|
300
|
-
}, [
|
|
301
|
-
ref:
|
|
123
|
+
}, [u]), /* @__PURE__ */ i(e, { children: [/* @__PURE__ */ r("span", {
|
|
124
|
+
ref: u,
|
|
302
125
|
"aria-hidden": "true",
|
|
303
126
|
style: {
|
|
304
127
|
display: "inline-block",
|
|
305
128
|
width: 0,
|
|
306
129
|
height: 0
|
|
307
130
|
}
|
|
308
|
-
}), /* @__PURE__ */ (
|
|
309
|
-
ref:
|
|
131
|
+
}), /* @__PURE__ */ r("div", {
|
|
132
|
+
ref: d,
|
|
310
133
|
"aria-hidden": "true",
|
|
311
134
|
style: {
|
|
312
135
|
width: 32,
|
|
@@ -320,4 +143,4 @@ function l({ offsetX: r = 0, speed: i = 10, sleepAfter: a = 1e4, idleAfter: o =
|
|
|
320
143
|
})] });
|
|
321
144
|
}
|
|
322
145
|
//#endregion
|
|
323
|
-
export {
|
|
146
|
+
export { o as Oneko };
|