@onoxm/react-hooks 0.1.6 → 0.1.7
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/hooks/useClickOutSide.js +1 -1
- package/dist/hooks/useEventListener.js +1 -1
- package/dist/hooks/useKeyPress.js +1 -1
- package/dist/hooks/utils/dist/utils/common/forEach.js +1 -0
- package/dist/hooks/utils/dist/utils/is/isArray.js +1 -0
- package/dist/hooks/utils/dist/utils/viewTransition/changeThemeClipPathCircle.js +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import{c as m}from "react/compiler-runtime";import{isArray as u}from "./utils/dist/utils/is/isArray.js";import{useEventListener as l}from "./useEventListener.js";const v=(e,c,i)=>{const t=m(10),f=i?.event||"click";let o,a,n,p;return t[0]!==f ?(o=((s)=>{const r=typeof s=="string" ? [s]:s;if(new Set(r).size!==r.length)throw new Error("there are duplicates in the event type");return r;})(f),t[0]=f,t[1]=o):o=t[1],t[2]!==c||t[3]!==e ?(a=(s)=>{if(e)if(u(e))e.map(d).some((r)=>!!r&&r.contains(s.target))||c(s);else{const r=e instanceof HTMLElement ? e:e.current;r&&!r.contains(s.target)&&c(s);}},t[2]=c,t[3]=e,t[4]=a):a=t[4],t[5]!==i?.deps ?(n=i?.deps||[],t[5]=i?.deps,t[6]=n):n=t[6],t[7]!==e||t[8]!==n ?(p={deps:[e,...n]},t[7]=e,t[8]=n,t[9]=p):p=t[9],l(o,a,p);};function d(e){return e instanceof HTMLElement ? e:e.current;}export{v as useClickOutSide};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import{c as L}from "react/compiler-runtime";import{forEach as c}from "./utils/dist/utils/common/forEach.js";import{useEffect as g}from "react";const h=(t,E,m)=>{const e=L(19);let n;e[0]!==m ?(n=m||{},e[0]=m,e[1]=n):n=e[1];const{target:r,deps:p,isDeferred:o}=n;let w;e[2]!==E ?(w=(i)=>E(i),e[2]=E,e[3]=w):w=e[3];const s=w;let a,d,f,v;return e[4]!==t||e[5]!==s||e[6]!==o||e[7]!==r ?(a=()=>(typeof t=="string" ?!o&&(r||window).addEventListener(t,s):c(t,(i)=>!o&&(r||window).addEventListener(i,s)),()=>{typeof t=="string" ?(r||window).removeEventListener(t,s):c(t,(i)=>(r||window).removeEventListener(i,s));}),e[4]=t,e[5]=s,e[6]=o,e[7]=r,e[8]=a):a=e[8],e[9]!==p ?(d=p||[],e[9]=p,e[10]=d):d=e[10],e[11]!==d||e[12]!==r ?(f=[r,...d],e[11]=d,e[12]=r,e[13]=f):f=e[13],g(a,f),e[14]!==t||e[15]!==s||e[16]!==o||e[17]!==r ?(v=o ?()=>{typeof t=="string" ?(r||window).addEventListener(t,s):c(t,(i)=>(r||window).addEventListener(i,s));}:void 0,e[14]=t,e[15]=s,e[16]=o,e[17]=r,e[18]=v):v=e[18],v;};export{h as useEventListener};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEventListener as
|
|
1
|
+
import{forEach as K}from "./utils/dist/utils/common/forEach.js";import{isArray as h}from "./utils/dist/utils/is/isArray.js";import{useEventListener as L}from "./useEventListener.js";const m=(a)=>a.toString().toLocaleLowerCase(),C=(a,y,n)=>{const f=(u)=>L(u,(p)=>((d,e,g)=>{K(d,(l)=>{if(l.includes("+")&&l.length>1){const t=l.split("+"),o=e.ctrlKey&&t.includes("ctrl"),c=e.shiftKey&&t.includes("shift"),i=e.altKey&&t.includes("alt"),r=e.metaKey&&t.includes("meta"),s=(e.ctrlKey||e.metaKey)&&t.includes("commandorcontrol");t.length===2 ?(o||c||i||r||s)&&e.key.toLocaleLowerCase()===t[t.length-1]&&y(e,l):t.length===3&&(o&&c||o&&i||o&&r||o&&s||c&&i||c&&r||c&&s||i&&r||i&&s||r&&s)&&e.key.toLocaleLowerCase()===t[t.length-1]&&y(e,l);}else if(l.includes(m(e.key))){if(g)l===m(e.key)&&y(e,l);else if(!(e.ctrlKey||e.metaKey||e.shiftKey||e.altKey))return y(e,l);}});})(h(a)? a.map((d)=>m(d)):[m(a)],p,n?.exactMatch||!1),{deps:[n?.target,...n?.deps||[]]});h(n?.events)? K(n.events,f):f(n?.events||"keydown");};export{C as useKeyPress};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const n=(o,f)=>{for(const c of o)f(c,o.indexOf(c));};export{n as forEach};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a=(r)=>Array.isArray(r);export{a as isArray};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
import{forEach as v}from "../common/forEach.js";const y=(c)=>{const r="ono-view-transition-clip-path-circle",{element:m,duration:s=300,themeRules:h,onChangeTheme:d}=c,o=h?.()||document.documentElement.classList.contains("dark")? "dark":"light";if(!document.startViewTransition)return d(o==="dark" ? "light":"dark");const u=document.startViewTransition(()=>{const i=document.documentElement.classList.contains("dark");d(i ? "light":"dark");}),{top:w,left:p,width:g,height:x}=m.getBoundingClientRect(),e=p+g/2,n=w+x/2,l=[`circle(0%at ${e}px ${n}px)`,`circle(${Math.hypot(Math.max(e,window.innerWidth-e),Math.max(n,window.innerHeight-n))}px at ${e}px ${n}px)`];((i,a)=>{const t=document.createElement("style");t.setAttribute("type","text/css"),t.setAttribute("data-style-tag",a),t.textContent="::view-transition-old(root),::view-transition-new(root){animation:none;}.dark::view-transition-old(root){z-index:1;}.dark::view-transition-new(root){z-index:999;}::view-transition-old(root){z-index:999;}::view-transition-new(root){z-index:1;}",document.head.appendChild(t);})(0,r),u.ready.then(()=>{document.documentElement.animate({clipPath:o==="light" ? l:l.reverse()},{duration:s,fill:"forwards",easing:"ease-in-out",pseudoElement:o==="light" ? "::view-transition-new(root)":"::view-transition-old(root)"}),setTimeout(()=>((i)=>{const a=document.head.querySelectorAll("style");v([...a],(t)=>{t.getAttribute("data-style-tag")===i&&t.remove();});})(r),s+50);});};export{y as changeThemeClipPathCircle};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onoxm/react-hooks",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.7",
|
|
5
5
|
"description": "Component library by React + Typescript",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/hooks/index.js",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"author": "ono",
|
|
32
32
|
"license": "MIT",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@onoxm/utils": "0.1.
|
|
34
|
+
"@onoxm/utils": "0.1.7"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@types/react": ">=
|
|
38
|
-
"react": ">=
|
|
37
|
+
"@types/react": ">=19",
|
|
38
|
+
"react": ">=19"
|
|
39
39
|
},
|
|
40
40
|
"peerDependenciesMeta": {
|
|
41
41
|
"@types/react": {
|