foxact 0.3.4 → 0.3.6
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/breadcrumbs/index.cjs +1 -0
- package/breadcrumbs/index.d.ts +31 -0
- package/breadcrumbs/index.mjs +1 -0
- package/compose-context-provider/index.d.ts +3 -3
- package/create-breadcrumbs/index.cjs +1 -0
- package/create-breadcrumbs/index.d.ts +1 -0
- package/create-breadcrumbs/index.mjs +1 -0
- package/current-year/index.cjs +1 -1
- package/current-year/index.d.ts +1 -2
- package/current-year/index.mjs +1 -1
- package/package.json +130 -121
- package/sizes.json +1 -1
- package/use-array/index.cjs +1 -1
- package/use-array/index.mjs +1 -1
- package/use-debounced-value/index.cjs +1 -1
- package/use-debounced-value/index.mjs +1 -1
- package/use-intersection/index.cjs +1 -1
- package/use-intersection/index.mjs +1 -1
- package/use-map/index.cjs +1 -1
- package/use-map/index.mjs +1 -1
- package/use-retimer/index.cjs +1 -1
- package/use-retimer/index.mjs +1 -1
- package/use-set/index.cjs +1 -1
- package/use-set/index.mjs +1 -1
- package/use-state-with-deps/index.cjs +1 -1
- package/use-state-with-deps/index.d.ts +3 -5
- package/use-state-with-deps/index.mjs +1 -1
- package/email-protection/index.cjs +0 -2
- package/email-protection/index.d.ts +0 -27
- package/email-protection/index.mjs +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime");require("client-only");var r=require("react"),t=require("../magic-portal/index.cjs");require("react-dom"),require("../context-state/index.cjs"),require("../noop/index.cjs"),require("../no-ssr/index.cjs"),require("../create-stackless-error/index.cjs"),exports.createBreadcrumbs=function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"(Anonymous)";const i=r.createContext([]),[c,s,o]=t.createMagicPortal(n);return[c,s,function(t){let{title:n,href:c,meta:s,children:o}=t;const u=r.useContext(i),a=r.useMemo(()=>[...u,{title:n,href:c,meta:s}],[u,n,c,s]);return e.jsx(i.Provider,{value:a,children:o})},function(t){const{title:n,meta:c}=t,s=r.useContext(i),u=r.useMemo(()=>[...s,{title:n,meta:c}],[s,n,c]),{children:a}=t,l=r.isValidElement(a)?a:a(u);return e.jsx(i.Provider,{value:u,children:e.jsx(o,{children:l})})},function(){return r.useContext(i)}]};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
interface BreadcrumbItemData<T = unknown> {
|
|
2
|
+
title: string;
|
|
3
|
+
href?: string;
|
|
4
|
+
meta?: T;
|
|
5
|
+
}
|
|
6
|
+
interface BreadcrumbItemProps<T = unknown> {
|
|
7
|
+
title: string;
|
|
8
|
+
href: string;
|
|
9
|
+
meta?: T;
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
interface BreadcrumbPageProps<T = unknown> {
|
|
13
|
+
title: string;
|
|
14
|
+
meta?: T;
|
|
15
|
+
children: ((items: Array<BreadcrumbItemData<T>>) => React.ReactNode) | React.ReactElement;
|
|
16
|
+
}
|
|
17
|
+
type BreadcrumbPortalTargetProps<E extends React.ElementType = 'div'> = Omit<React.ComponentPropsWithoutRef<E>, 'children' | 'ref'> & {
|
|
18
|
+
as?: E | null;
|
|
19
|
+
ssrFallback?: React.ReactNode | null;
|
|
20
|
+
};
|
|
21
|
+
/** @see https://foxact.skk.moe/breadcrumbs */
|
|
22
|
+
declare function createBreadcrumbs<T = unknown>(name?: string): [
|
|
23
|
+
BreadcrumbProvider: React.ComponentType<React.PropsWithChildren>,
|
|
24
|
+
BreadcrumbPortalTarget: <E extends React.ElementType = 'div'>(props: BreadcrumbPortalTargetProps<E>) => React.ReactNode,
|
|
25
|
+
BreadcrumbItem: (props: BreadcrumbItemProps<T>) => React.ReactNode,
|
|
26
|
+
BreadcrumbPage: (props: BreadcrumbPageProps<T>) => React.ReactNode | null,
|
|
27
|
+
useBreadcrumbs: () => Array<BreadcrumbItemData<T>>
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
export { createBreadcrumbs };
|
|
31
|
+
export type { BreadcrumbItemData, BreadcrumbItemProps, BreadcrumbPageProps, BreadcrumbPortalTargetProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import"client-only";import{useContext as t,useMemo as e,isValidElement as o,createContext as n}from"react";import{createMagicPortal as i}from"../magic-portal/index.mjs";import"react-dom";import"../context-state/index.mjs";import"../noop/index.mjs";import"../no-ssr/index.mjs";import"../create-stackless-error/index.mjs";function m(){let m=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"(Anonymous)";const c=n([]),[s,d,u]=i(m);return[s,d,function(o){let{title:n,href:i,meta:m,children:s}=o;const d=t(c),u=e(()=>[...d,{title:n,href:i,meta:m}],[d,n,i,m]);return r(c.Provider,{value:u,children:s})},function(n){const{title:i,meta:m}=n,s=t(c),d=e(()=>[...s,{title:i,meta:m}],[s,i,m]),{children:a}=n,l=o(a)?a:a(d);return r(c.Provider,{value:d,children:r(u,{children:l})})},function(){return t(c)}]}export{m as createBreadcrumbs};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { Foxact } from '../types/index.js';
|
|
3
2
|
|
|
4
|
-
interface ContextComposeProviderProps extends
|
|
5
|
-
|
|
3
|
+
interface ContextComposeProviderProps extends React.PropsWithChildren {
|
|
4
|
+
/** Only elements that accept a `children` prop (e.g. context providers) can be composed */
|
|
5
|
+
contexts: Array<React.ReactElement<React.PropsWithChildren>>;
|
|
6
6
|
}
|
|
7
7
|
/** @see https://foxact.skk.moe/compose-context-provider */
|
|
8
8
|
declare const ComposeContextProvider: react.MemoExoticComponent<({ contexts, children }: ContextComposeProviderProps) => react.ReactNode>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("../breadcrumbs/index.cjs");require("react/jsx-runtime"),require("client-only"),require("react"),require("../magic-portal/index.cjs"),require("react-dom"),require("../context-state/index.cjs"),require("../noop/index.cjs"),require("../no-ssr/index.cjs"),require("../create-stackless-error/index.cjs"),exports.createBreadcrumbs=e.createBreadcrumbs;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BreadcrumbItemData, BreadcrumbItemProps, BreadcrumbPageProps, BreadcrumbPortalTargetProps, createBreadcrumbs } from '../breadcrumbs/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{createBreadcrumbs}from"../breadcrumbs/index.mjs";import"react/jsx-runtime";import"client-only";import"react";import"../magic-portal/index.mjs";import"react-dom";import"../context-state/index.mjs";import"../noop/index.mjs";import"../no-ssr/index.mjs";import"../create-stackless-error/index.mjs";
|
package/current-year/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("../use-isomorphic-layout-effect/index.cjs");require("client-only");const n=r.memo(function(n){let{defaultYear:u,...i}=n;"u"<typeof window&&void 0===u&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[o,s]=r.useState(u||new Date().getFullYear());return t.useIsomorphicLayoutEffect(()=>{s(new Date().getFullYear())},[]),e.jsx("span",{...i,children:o})});exports.CurrentYear=n;
|
|
2
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("../use-isomorphic-layout-effect/index.cjs");require("client-only");const n=r.memo(function(n){let{defaultYear:u,...i}=n;"u"<typeof window&&void 0===u&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[o,s]=r.useState(()=>u||new Date().getFullYear());return t.useIsomorphicLayoutEffect(()=>{s(new Date().getFullYear())},[]),e.jsx("span",{...i,children:o})});exports.CurrentYear=n;
|
package/current-year/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
2
|
|
|
4
3
|
interface CurrentYearProps extends React.ComponentProps<'span'> {
|
|
5
4
|
defaultYear?: number;
|
|
6
5
|
}
|
|
7
6
|
/** @see https://foxact.skk.moe/current-year */
|
|
8
|
-
declare const CurrentYear: react.MemoExoticComponent<({ defaultYear, ...restProps }: CurrentYearProps) =>
|
|
7
|
+
declare const CurrentYear: react.MemoExoticComponent<({ defaultYear, ...restProps }: CurrentYearProps) => react.JSX.Element>;
|
|
9
8
|
|
|
10
9
|
export { CurrentYear };
|
package/current-year/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{jsx as e}from"react/jsx-runtime";import{memo as r,useState as t}from"react";import{useIsomorphicLayoutEffect as n}from"../use-isomorphic-layout-effect/index.mjs";import"client-only";const o=r(function(r){let{defaultYear:o,...i}=r;"u"<typeof window&&void 0===o&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[a,u]=t(o||new Date().getFullYear());return n(()=>{u(new Date().getFullYear())},[]),e("span",{...i,children:a})});export{o as CurrentYear};
|
|
2
|
+
import{jsx as e}from"react/jsx-runtime";import{memo as r,useState as t}from"react";import{useIsomorphicLayoutEffect as n}from"../use-isomorphic-layout-effect/index.mjs";import"client-only";const o=r(function(r){let{defaultYear:o,...i}=r;"u"<typeof window&&void 0===o&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[a,u]=t(()=>o||new Date().getFullYear());return n(()=>{u(new Date().getFullYear())},[]),e("span",{...i,children:a})});export{o as CurrentYear};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foxact",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "React Hooks/Utils done right. For browser, SSR, and React Server Components.",
|
|
5
5
|
"homepage": "https://foxact.skk.moe",
|
|
6
6
|
"repository": {
|
|
@@ -52,6 +52,15 @@
|
|
|
52
52
|
"exports": {
|
|
53
53
|
"./package.json": "./package.json",
|
|
54
54
|
"./sizes.json": "./sizes.json",
|
|
55
|
+
"./breadcrumbs": {
|
|
56
|
+
"types": "./breadcrumbs/index.d.ts",
|
|
57
|
+
"import": {
|
|
58
|
+
"types": "./breadcrumbs/index.d.ts",
|
|
59
|
+
"default": "./breadcrumbs/index.mjs"
|
|
60
|
+
},
|
|
61
|
+
"require": "./breadcrumbs/index.cjs",
|
|
62
|
+
"default": "./breadcrumbs/index.cjs"
|
|
63
|
+
},
|
|
55
64
|
"./compose-context-provider": {
|
|
56
65
|
"types": "./compose-context-provider/index.d.ts",
|
|
57
66
|
"import": {
|
|
@@ -61,41 +70,14 @@
|
|
|
61
70
|
"require": "./compose-context-provider/index.cjs",
|
|
62
71
|
"default": "./compose-context-provider/index.cjs"
|
|
63
72
|
},
|
|
64
|
-
"./
|
|
65
|
-
"types": "./
|
|
66
|
-
"import": {
|
|
67
|
-
"types": "./context-reducer/index.d.ts",
|
|
68
|
-
"default": "./context-reducer/index.mjs"
|
|
69
|
-
},
|
|
70
|
-
"require": "./context-reducer/index.cjs",
|
|
71
|
-
"default": "./context-reducer/index.cjs"
|
|
72
|
-
},
|
|
73
|
-
"./create-context-state": {
|
|
74
|
-
"types": "./create-context-state/index.d.ts",
|
|
75
|
-
"import": {
|
|
76
|
-
"types": "./create-context-state/index.d.ts",
|
|
77
|
-
"default": "./create-context-state/index.mjs"
|
|
78
|
-
},
|
|
79
|
-
"require": "./create-context-state/index.cjs",
|
|
80
|
-
"default": "./create-context-state/index.cjs"
|
|
81
|
-
},
|
|
82
|
-
"./create-fixed-array": {
|
|
83
|
-
"types": "./create-fixed-array/index.d.ts",
|
|
84
|
-
"import": {
|
|
85
|
-
"types": "./create-fixed-array/index.d.ts",
|
|
86
|
-
"default": "./create-fixed-array/index.mjs"
|
|
87
|
-
},
|
|
88
|
-
"require": "./create-fixed-array/index.cjs",
|
|
89
|
-
"default": "./create-fixed-array/index.cjs"
|
|
90
|
-
},
|
|
91
|
-
"./create-local-storage-state": {
|
|
92
|
-
"types": "./create-local-storage-state/index.d.ts",
|
|
73
|
+
"./create-breadcrumbs": {
|
|
74
|
+
"types": "./create-breadcrumbs/index.d.ts",
|
|
93
75
|
"import": {
|
|
94
|
-
"types": "./create-
|
|
95
|
-
"default": "./create-
|
|
76
|
+
"types": "./create-breadcrumbs/index.d.ts",
|
|
77
|
+
"default": "./create-breadcrumbs/index.mjs"
|
|
96
78
|
},
|
|
97
|
-
"require": "./create-
|
|
98
|
-
"default": "./create-
|
|
79
|
+
"require": "./create-breadcrumbs/index.cjs",
|
|
80
|
+
"default": "./create-breadcrumbs/index.cjs"
|
|
99
81
|
},
|
|
100
82
|
"./create-context-reducer": {
|
|
101
83
|
"types": "./create-context-reducer/index.d.ts",
|
|
@@ -106,6 +88,15 @@
|
|
|
106
88
|
"require": "./create-context-reducer/index.cjs",
|
|
107
89
|
"default": "./create-context-reducer/index.cjs"
|
|
108
90
|
},
|
|
91
|
+
"./create-context-state": {
|
|
92
|
+
"types": "./create-context-state/index.d.ts",
|
|
93
|
+
"import": {
|
|
94
|
+
"types": "./create-context-state/index.d.ts",
|
|
95
|
+
"default": "./create-context-state/index.mjs"
|
|
96
|
+
},
|
|
97
|
+
"require": "./create-context-state/index.cjs",
|
|
98
|
+
"default": "./create-context-state/index.cjs"
|
|
99
|
+
},
|
|
109
100
|
"./context-state": {
|
|
110
101
|
"types": "./context-state/index.d.ts",
|
|
111
102
|
"import": {
|
|
@@ -115,6 +106,15 @@
|
|
|
115
106
|
"require": "./context-state/index.cjs",
|
|
116
107
|
"default": "./context-state/index.cjs"
|
|
117
108
|
},
|
|
109
|
+
"./create-fixed-array": {
|
|
110
|
+
"types": "./create-fixed-array/index.d.ts",
|
|
111
|
+
"import": {
|
|
112
|
+
"types": "./create-fixed-array/index.d.ts",
|
|
113
|
+
"default": "./create-fixed-array/index.mjs"
|
|
114
|
+
},
|
|
115
|
+
"require": "./create-fixed-array/index.cjs",
|
|
116
|
+
"default": "./create-fixed-array/index.cjs"
|
|
117
|
+
},
|
|
118
118
|
"./create-magic-portal": {
|
|
119
119
|
"types": "./create-magic-portal/index.d.ts",
|
|
120
120
|
"import": {
|
|
@@ -124,6 +124,15 @@
|
|
|
124
124
|
"require": "./create-magic-portal/index.cjs",
|
|
125
125
|
"default": "./create-magic-portal/index.cjs"
|
|
126
126
|
},
|
|
127
|
+
"./create-session-storage-state": {
|
|
128
|
+
"types": "./create-session-storage-state/index.d.ts",
|
|
129
|
+
"import": {
|
|
130
|
+
"types": "./create-session-storage-state/index.d.ts",
|
|
131
|
+
"default": "./create-session-storage-state/index.mjs"
|
|
132
|
+
},
|
|
133
|
+
"require": "./create-session-storage-state/index.cjs",
|
|
134
|
+
"default": "./create-session-storage-state/index.cjs"
|
|
135
|
+
},
|
|
127
136
|
"./create-stackless-error": {
|
|
128
137
|
"types": "./create-stackless-error/index.d.ts",
|
|
129
138
|
"import": {
|
|
@@ -142,15 +151,6 @@
|
|
|
142
151
|
"require": "./create-storage-hook/index.cjs",
|
|
143
152
|
"default": "./create-storage-hook/index.cjs"
|
|
144
153
|
},
|
|
145
|
-
"./create-session-storage-state": {
|
|
146
|
-
"types": "./create-session-storage-state/index.d.ts",
|
|
147
|
-
"import": {
|
|
148
|
-
"types": "./create-session-storage-state/index.d.ts",
|
|
149
|
-
"default": "./create-session-storage-state/index.mjs"
|
|
150
|
-
},
|
|
151
|
-
"require": "./create-session-storage-state/index.cjs",
|
|
152
|
-
"default": "./create-session-storage-state/index.cjs"
|
|
153
|
-
},
|
|
154
154
|
"./create-storage-state-factory": {
|
|
155
155
|
"types": "./create-storage-state-factory/index.d.ts",
|
|
156
156
|
"import": {
|
|
@@ -169,23 +169,23 @@
|
|
|
169
169
|
"require": "./current-year/index.cjs",
|
|
170
170
|
"default": "./current-year/index.cjs"
|
|
171
171
|
},
|
|
172
|
-
"./
|
|
173
|
-
"types": "./
|
|
172
|
+
"./fetch-jsonp": {
|
|
173
|
+
"types": "./fetch-jsonp/index.d.ts",
|
|
174
174
|
"import": {
|
|
175
|
-
"types": "./
|
|
176
|
-
"default": "./
|
|
175
|
+
"types": "./fetch-jsonp/index.d.ts",
|
|
176
|
+
"default": "./fetch-jsonp/index.mjs"
|
|
177
177
|
},
|
|
178
|
-
"require": "./
|
|
179
|
-
"default": "./
|
|
178
|
+
"require": "./fetch-jsonp/index.cjs",
|
|
179
|
+
"default": "./fetch-jsonp/index.cjs"
|
|
180
180
|
},
|
|
181
|
-
"./
|
|
182
|
-
"types": "./
|
|
181
|
+
"./context-reducer": {
|
|
182
|
+
"types": "./context-reducer/index.d.ts",
|
|
183
183
|
"import": {
|
|
184
|
-
"types": "./
|
|
185
|
-
"default": "./
|
|
184
|
+
"types": "./context-reducer/index.d.ts",
|
|
185
|
+
"default": "./context-reducer/index.mjs"
|
|
186
186
|
},
|
|
187
|
-
"require": "./
|
|
188
|
-
"default": "./
|
|
187
|
+
"require": "./context-reducer/index.cjs",
|
|
188
|
+
"default": "./context-reducer/index.cjs"
|
|
189
189
|
},
|
|
190
190
|
"./invariant": {
|
|
191
191
|
"types": "./invariant/index.d.ts",
|
|
@@ -196,14 +196,14 @@
|
|
|
196
196
|
"require": "./invariant/index.cjs",
|
|
197
197
|
"default": "./invariant/index.cjs"
|
|
198
198
|
},
|
|
199
|
-
"./
|
|
200
|
-
"types": "./
|
|
199
|
+
"./is-safari": {
|
|
200
|
+
"types": "./is-safari/index.d.ts",
|
|
201
201
|
"import": {
|
|
202
|
-
"types": "./
|
|
203
|
-
"default": "./
|
|
202
|
+
"types": "./is-safari/index.d.ts",
|
|
203
|
+
"default": "./is-safari/index.mjs"
|
|
204
204
|
},
|
|
205
|
-
"require": "./
|
|
206
|
-
"default": "./
|
|
205
|
+
"require": "./is-safari/index.cjs",
|
|
206
|
+
"default": "./is-safari/index.cjs"
|
|
207
207
|
},
|
|
208
208
|
"./merge-refs": {
|
|
209
209
|
"types": "./merge-refs/index.d.ts",
|
|
@@ -214,15 +214,6 @@
|
|
|
214
214
|
"require": "./merge-refs/index.cjs",
|
|
215
215
|
"default": "./merge-refs/index.cjs"
|
|
216
216
|
},
|
|
217
|
-
"./no-ssr": {
|
|
218
|
-
"types": "./no-ssr/index.d.ts",
|
|
219
|
-
"import": {
|
|
220
|
-
"types": "./no-ssr/index.d.ts",
|
|
221
|
-
"default": "./no-ssr/index.mjs"
|
|
222
|
-
},
|
|
223
|
-
"require": "./no-ssr/index.cjs",
|
|
224
|
-
"default": "./no-ssr/index.cjs"
|
|
225
|
-
},
|
|
226
217
|
"./magic-portal": {
|
|
227
218
|
"types": "./magic-portal/index.d.ts",
|
|
228
219
|
"import": {
|
|
@@ -232,6 +223,15 @@
|
|
|
232
223
|
"require": "./magic-portal/index.cjs",
|
|
233
224
|
"default": "./magic-portal/index.cjs"
|
|
234
225
|
},
|
|
226
|
+
"./no-ssr": {
|
|
227
|
+
"types": "./no-ssr/index.d.ts",
|
|
228
|
+
"import": {
|
|
229
|
+
"types": "./no-ssr/index.d.ts",
|
|
230
|
+
"default": "./no-ssr/index.mjs"
|
|
231
|
+
},
|
|
232
|
+
"require": "./no-ssr/index.cjs",
|
|
233
|
+
"default": "./no-ssr/index.cjs"
|
|
234
|
+
},
|
|
235
235
|
"./noop": {
|
|
236
236
|
"types": "./noop/index.d.ts",
|
|
237
237
|
"import": {
|
|
@@ -304,6 +304,15 @@
|
|
|
304
304
|
"require": "./typescript-happy-forward-ref/index.cjs",
|
|
305
305
|
"default": "./typescript-happy-forward-ref/index.cjs"
|
|
306
306
|
},
|
|
307
|
+
"./create-local-storage-state": {
|
|
308
|
+
"types": "./create-local-storage-state/index.d.ts",
|
|
309
|
+
"import": {
|
|
310
|
+
"types": "./create-local-storage-state/index.d.ts",
|
|
311
|
+
"default": "./create-local-storage-state/index.mjs"
|
|
312
|
+
},
|
|
313
|
+
"require": "./create-local-storage-state/index.cjs",
|
|
314
|
+
"default": "./create-local-storage-state/index.cjs"
|
|
315
|
+
},
|
|
307
316
|
"./use": {
|
|
308
317
|
"types": "./use/index.d.ts",
|
|
309
318
|
"import": {
|
|
@@ -331,15 +340,6 @@
|
|
|
331
340
|
"require": "./use-array/index.cjs",
|
|
332
341
|
"default": "./use-array/index.cjs"
|
|
333
342
|
},
|
|
334
|
-
"./use-clipboard": {
|
|
335
|
-
"types": "./use-clipboard/index.d.ts",
|
|
336
|
-
"import": {
|
|
337
|
-
"types": "./use-clipboard/index.d.ts",
|
|
338
|
-
"default": "./use-clipboard/index.mjs"
|
|
339
|
-
},
|
|
340
|
-
"require": "./use-clipboard/index.cjs",
|
|
341
|
-
"default": "./use-clipboard/index.cjs"
|
|
342
|
-
},
|
|
343
343
|
"./use-component-will-receive-update": {
|
|
344
344
|
"types": "./use-component-will-receive-update/index.d.ts",
|
|
345
345
|
"import": {
|
|
@@ -358,6 +358,15 @@
|
|
|
358
358
|
"require": "./use-composition-input/index.cjs",
|
|
359
359
|
"default": "./use-composition-input/index.cjs"
|
|
360
360
|
},
|
|
361
|
+
"./use-clipboard": {
|
|
362
|
+
"types": "./use-clipboard/index.d.ts",
|
|
363
|
+
"import": {
|
|
364
|
+
"types": "./use-clipboard/index.d.ts",
|
|
365
|
+
"default": "./use-clipboard/index.mjs"
|
|
366
|
+
},
|
|
367
|
+
"require": "./use-clipboard/index.cjs",
|
|
368
|
+
"default": "./use-clipboard/index.cjs"
|
|
369
|
+
},
|
|
361
370
|
"./use-debounced-state": {
|
|
362
371
|
"types": "./use-debounced-state/index.d.ts",
|
|
363
372
|
"import": {
|
|
@@ -412,15 +421,6 @@
|
|
|
412
421
|
"require": "./use-is-client/index.cjs",
|
|
413
422
|
"default": "./use-is-client/index.cjs"
|
|
414
423
|
},
|
|
415
|
-
"./use-isomorphic-layout-effect": {
|
|
416
|
-
"types": "./use-isomorphic-layout-effect/index.d.ts",
|
|
417
|
-
"import": {
|
|
418
|
-
"types": "./use-isomorphic-layout-effect/index.d.ts",
|
|
419
|
-
"default": "./use-isomorphic-layout-effect/index.mjs"
|
|
420
|
-
},
|
|
421
|
-
"require": "./use-isomorphic-layout-effect/index.cjs",
|
|
422
|
-
"default": "./use-isomorphic-layout-effect/index.cjs"
|
|
423
|
-
},
|
|
424
424
|
"./use-is-online": {
|
|
425
425
|
"types": "./use-is-online/index.d.ts",
|
|
426
426
|
"import": {
|
|
@@ -430,6 +430,15 @@
|
|
|
430
430
|
"require": "./use-is-online/index.cjs",
|
|
431
431
|
"default": "./use-is-online/index.cjs"
|
|
432
432
|
},
|
|
433
|
+
"./use-isomorphic-layout-effect": {
|
|
434
|
+
"types": "./use-isomorphic-layout-effect/index.d.ts",
|
|
435
|
+
"import": {
|
|
436
|
+
"types": "./use-isomorphic-layout-effect/index.d.ts",
|
|
437
|
+
"default": "./use-isomorphic-layout-effect/index.mjs"
|
|
438
|
+
},
|
|
439
|
+
"require": "./use-isomorphic-layout-effect/index.cjs",
|
|
440
|
+
"default": "./use-isomorphic-layout-effect/index.cjs"
|
|
441
|
+
},
|
|
433
442
|
"./use-local-storage": {
|
|
434
443
|
"types": "./use-local-storage/index.d.ts",
|
|
435
444
|
"import": {
|
|
@@ -439,15 +448,6 @@
|
|
|
439
448
|
"require": "./use-local-storage/index.cjs",
|
|
440
449
|
"default": "./use-local-storage/index.cjs"
|
|
441
450
|
},
|
|
442
|
-
"./use-map": {
|
|
443
|
-
"types": "./use-map/index.d.ts",
|
|
444
|
-
"import": {
|
|
445
|
-
"types": "./use-map/index.d.ts",
|
|
446
|
-
"default": "./use-map/index.mjs"
|
|
447
|
-
},
|
|
448
|
-
"require": "./use-map/index.cjs",
|
|
449
|
-
"default": "./use-map/index.cjs"
|
|
450
|
-
},
|
|
451
451
|
"./use-media-query": {
|
|
452
452
|
"types": "./use-media-query/index.d.ts",
|
|
453
453
|
"import": {
|
|
@@ -484,6 +484,15 @@
|
|
|
484
484
|
"require": "./use-retimer/index.cjs",
|
|
485
485
|
"default": "./use-retimer/index.cjs"
|
|
486
486
|
},
|
|
487
|
+
"./use-set": {
|
|
488
|
+
"types": "./use-set/index.d.ts",
|
|
489
|
+
"import": {
|
|
490
|
+
"types": "./use-set/index.d.ts",
|
|
491
|
+
"default": "./use-set/index.mjs"
|
|
492
|
+
},
|
|
493
|
+
"require": "./use-set/index.cjs",
|
|
494
|
+
"default": "./use-set/index.cjs"
|
|
495
|
+
},
|
|
487
496
|
"./use-session-storage": {
|
|
488
497
|
"types": "./use-session-storage/index.d.ts",
|
|
489
498
|
"import": {
|
|
@@ -493,6 +502,15 @@
|
|
|
493
502
|
"require": "./use-session-storage/index.cjs",
|
|
494
503
|
"default": "./use-session-storage/index.cjs"
|
|
495
504
|
},
|
|
505
|
+
"./use-map": {
|
|
506
|
+
"types": "./use-map/index.d.ts",
|
|
507
|
+
"import": {
|
|
508
|
+
"types": "./use-map/index.d.ts",
|
|
509
|
+
"default": "./use-map/index.mjs"
|
|
510
|
+
},
|
|
511
|
+
"require": "./use-map/index.cjs",
|
|
512
|
+
"default": "./use-map/index.cjs"
|
|
513
|
+
},
|
|
496
514
|
"./use-singleton": {
|
|
497
515
|
"types": "./use-singleton/index.d.ts",
|
|
498
516
|
"import": {
|
|
@@ -502,15 +520,6 @@
|
|
|
502
520
|
"require": "./use-singleton/index.cjs",
|
|
503
521
|
"default": "./use-singleton/index.cjs"
|
|
504
522
|
},
|
|
505
|
-
"./use-set": {
|
|
506
|
-
"types": "./use-set/index.d.ts",
|
|
507
|
-
"import": {
|
|
508
|
-
"types": "./use-set/index.d.ts",
|
|
509
|
-
"default": "./use-set/index.mjs"
|
|
510
|
-
},
|
|
511
|
-
"require": "./use-set/index.cjs",
|
|
512
|
-
"default": "./use-set/index.cjs"
|
|
513
|
-
},
|
|
514
523
|
"./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired": {
|
|
515
524
|
"types": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.d.ts",
|
|
516
525
|
"import": {
|
|
@@ -520,15 +529,6 @@
|
|
|
520
529
|
"require": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs",
|
|
521
530
|
"default": "./use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs"
|
|
522
531
|
},
|
|
523
|
-
"./use-typescript-happy-callback": {
|
|
524
|
-
"types": "./use-typescript-happy-callback/index.d.ts",
|
|
525
|
-
"import": {
|
|
526
|
-
"types": "./use-typescript-happy-callback/index.d.ts",
|
|
527
|
-
"default": "./use-typescript-happy-callback/index.mjs"
|
|
528
|
-
},
|
|
529
|
-
"require": "./use-typescript-happy-callback/index.cjs",
|
|
530
|
-
"default": "./use-typescript-happy-callback/index.cjs"
|
|
531
|
-
},
|
|
532
532
|
"./use-state-with-deps": {
|
|
533
533
|
"types": "./use-state-with-deps/index.d.ts",
|
|
534
534
|
"import": {
|
|
@@ -538,14 +538,14 @@
|
|
|
538
538
|
"require": "./use-state-with-deps/index.cjs",
|
|
539
539
|
"default": "./use-state-with-deps/index.cjs"
|
|
540
540
|
},
|
|
541
|
-
"./use-
|
|
542
|
-
"types": "./use-
|
|
541
|
+
"./use-typescript-happy-callback": {
|
|
542
|
+
"types": "./use-typescript-happy-callback/index.d.ts",
|
|
543
543
|
"import": {
|
|
544
|
-
"types": "./use-
|
|
545
|
-
"default": "./use-
|
|
544
|
+
"types": "./use-typescript-happy-callback/index.d.ts",
|
|
545
|
+
"default": "./use-typescript-happy-callback/index.mjs"
|
|
546
546
|
},
|
|
547
|
-
"require": "./use-
|
|
548
|
-
"default": "./use-
|
|
547
|
+
"require": "./use-typescript-happy-callback/index.cjs",
|
|
548
|
+
"default": "./use-typescript-happy-callback/index.cjs"
|
|
549
549
|
},
|
|
550
550
|
"./use-url-hash-state": {
|
|
551
551
|
"types": "./use-url-hash-state/index.d.ts",
|
|
@@ -555,6 +555,15 @@
|
|
|
555
555
|
},
|
|
556
556
|
"require": "./use-url-hash-state/index.cjs",
|
|
557
557
|
"default": "./use-url-hash-state/index.cjs"
|
|
558
|
+
},
|
|
559
|
+
"./use-uncontrolled": {
|
|
560
|
+
"types": "./use-uncontrolled/index.d.ts",
|
|
561
|
+
"import": {
|
|
562
|
+
"types": "./use-uncontrolled/index.d.ts",
|
|
563
|
+
"default": "./use-uncontrolled/index.mjs"
|
|
564
|
+
},
|
|
565
|
+
"require": "./use-uncontrolled/index.cjs",
|
|
566
|
+
"default": "./use-uncontrolled/index.cjs"
|
|
558
567
|
}
|
|
559
568
|
}
|
|
560
569
|
}
|
package/sizes.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"total":{"raw":
|
|
1
|
+
{"total":{"raw":28610,"gzip":16853,"br":0},"exports":{"compose-context-provider":{"raw":177,"gzip":155,"br":122},"create-context-state":{"raw":145,"gzip":116,"br":96},"create-breadcrumbs":{"raw":301,"gzip":155,"br":131},"breadcrumbs":{"raw":872,"gzip":440,"br":380},"create-magic-portal":{"raw":268,"gzip":148,"br":121},"context-state":{"raw":402,"gzip":259,"br":218},"create-context-reducer":{"raw":223,"gzip":146,"br":117},"create-fixed-array":{"raw":452,"gzip":282,"br":248},"create-stackless-error":{"raw":278,"gzip":198,"br":162},"create-session-storage-state":{"raw":450,"gzip":223,"br":206},"create-storage-state-factory":{"raw":620,"gzip":341,"br":290},"fetch-jsonp":{"raw":890,"gzip":546,"br":429},"context-reducer":{"raw":557,"gzip":332,"br":319},"current-year":{"raw":528,"gzip":356,"br":292},"invariant":{"raw":178,"gzip":156,"br":118},"is-safari":{"raw":233,"gzip":164,"br":119},"merge-refs":{"raw":525,"gzip":280,"br":235},"no-ssr":{"raw":338,"gzip":267,"br":219},"noop":{"raw":33,"gzip":53,"br":37},"create-storage-hook":{"raw":2462,"gzip":972,"br":852},"magic-portal":{"raw":1083,"gzip":536,"br":472},"nullthrow":{"raw":187,"gzip":163,"br":121},"open-new-tab":{"raw":335,"gzip":255,"br":187},"types":{"raw":0,"gzip":20,"br":1},"noop-component":{"raw":142,"gzip":130,"br":111},"typescript-happy-forward-ref":{"raw":119,"gzip":103,"br":80},"request-idle-callback":{"raw":392,"gzip":221,"br":171},"rem":{"raw":823,"gzip":395,"br":350},"use":{"raw":298,"gzip":197,"br":160},"use-abortable-effect":{"raw":215,"gzip":170,"br":144},"create-local-storage-state":{"raw":446,"gzip":222,"br":209},"use-array":{"raw":334,"gzip":243,"br":206},"use-component-will-receive-update":{"raw":216,"gzip":188,"br":154},"use-composition-input":{"raw":470,"gzip":286,"br":241},"use-debounced-value":{"raw":553,"gzip":358,"br":320},"use-error-boundary":{"raw":252,"gzip":195,"br":165},"use-debounced-state":{"raw":401,"gzip":280,"br":242},"use-is-client":{"raw":204,"gzip":153,"br":121},"use-fast-click":{"raw":622,"gzip":392,"br":317},"use-isomorphic-layout-effect":{"raw":169,"gzip":137,"br":110},"use-intersection":{"raw":1363,"gzip":716,"br":654},"use-is-online":{"raw":370,"gzip":258,"br":220},"use-clipboard":{"raw":2723,"gzip":1332,"br":1140},"use-local-storage":{"raw":428,"gzip":226,"br":198},"use-page-visibility":{"raw":359,"gzip":263,"br":210},"use-media-query":{"raw":648,"gzip":397,"br":332},"use-retimer":{"raw":194,"gzip":166,"br":127},"use-set":{"raw":368,"gzip":247,"br":211},"use-readonly-search-params":{"raw":1164,"gzip":589,"br":496},"use-session-storage":{"raw":434,"gzip":225,"br":210},"use-map":{"raw":384,"gzip":256,"br":220},"use-singleton":{"raw":149,"gzip":135,"br":116},"use-typescript-happy-callback":{"raw":107,"gzip":102,"br":77},"use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired":{"raw":450,"gzip":318,"br":249},"use-uncontrolled":{"raw":388,"gzip":273,"br":230},"use-state-with-deps":{"raw":767,"gzip":489,"br":427},"use-url-hash-state":{"raw":1121,"gzip":628,"br":556}}}
|
package/use-array/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("client-only");var e=require("react");exports.useArray=function(){let
|
|
1
|
+
"use strict";require("client-only");var e=require("react");exports.useArray=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>[];const[r,c]=e.useState(t),l=e.useCallback(e=>c(t=>t.concat(e)),[]);return[r,l,e.useCallback(()=>c([]),[]),e.useCallback(e=>c(t=>{if(e>-1&&e<t.length){const r=t.slice();return r.splice(e,1),r}return t}),[])]};
|
package/use-array/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"client-only";import{useState as t,useCallback as r}from"react";function e(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>[];const[n,o]=t(e),c=r(t=>o(r=>r.concat(t)),[]);return[n,c,r(()=>o([]),[]),r(t=>o(r=>{if(t>-1){const e=r.slice();return e.splice(t,1),e}return r}),[])]}export{e as useArray};
|
|
1
|
+
import"client-only";import{useState as t,useCallback as r}from"react";function e(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>[];const[n,o]=t(e),c=r(t=>o(r=>r.concat(t)),[]);return[n,c,r(()=>o([]),[]),r(t=>o(r=>{if(t>-1&&t<r.length){const e=r.slice();return e.splice(t,1),e}return r}),[])]}export{e as useArray};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("client-only");var e=require("react"),t=require("../use-abortable-effect/index.cjs");exports.useDebouncedValue=function(r
|
|
1
|
+
"use strict";require("client-only");var e=require("react"),t=require("../use-abortable-effect/index.cjs");exports.useDebouncedValue=function(u,r){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("function"==typeof u)throw TypeError("[foxact/use-debounced-value] useDebouncedValue does not support function as value");const[o,c]=e.useState(u),s=e.useRef(!0);return t.useEffect(e=>{let t=null;return e.aborted||(n&&s.current?(s.current=!1,c(u)):t=window.setTimeout(()=>{s.current=!0,c(u)},r)),()=>{t&&window.clearTimeout(t)}},[u,n,r]),o};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"client-only";import{useState as e,useRef as t}from"react";import{useEffect as o}from"../use-abortable-effect/index.mjs";function r(r,n){let u=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("function"==typeof r)throw TypeError("useDebouncedValue does not support function as value");const[i
|
|
1
|
+
import"client-only";import{useState as e,useRef as t}from"react";import{useEffect as o}from"../use-abortable-effect/index.mjs";function r(r,n){let u=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("function"==typeof r)throw TypeError("[foxact/use-debounced-value] useDebouncedValue does not support function as value");const[c,i]=e(r),l=t(!0);return o(e=>{let t=null;return e.aborted||(u&&l.current?(l.current=!1,i(r)):t=window.setTimeout(()=>{l.current=!0,i(r)},n)),()=>{t&&window.clearTimeout(t)}},[r,u,n]),c}export{r as useDebouncedValue};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("client-only");var e=require("react"),
|
|
1
|
+
"use strict";require("client-only");var e=require("react"),n=require("../request-idle-callback/index.cjs"),t=require("../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.cjs");const r="function"==typeof IntersectionObserver,o=new Map,i=[];exports.useIntersection=function(s){let{rootRef:c,rootMargin:u,disabled:l}=s;const[a,f]=e.useState(!1),d=e.useRef(null),b=t.useStableHandler(()=>f(!0));e.useEffect(()=>{if(r){if(l||a)return;const e=d.current;if(null==e?void 0:e.tagName)return function(e,n,t){const{id:r,observer:s,elements:c}=function(e){let n;const t={root:e.root||null,margin:e.rootMargin||""},r=i.find(e=>e.root===t.root&&e.margin===t.margin);if(r&&(n=o.get(r)))return n;const s=new Map;return n={id:t,observer:new IntersectionObserver(e=>{e.forEach(e=>{const n=s.get(e.target),t=e.isIntersecting||e.intersectionRatio>0;n&&t&&n(t)})},e),elements:s},i.push(t),o.set(t,n),n}(t);return c.set(e,n),s.observe(e),function(){if(c.delete(e),s.unobserve(e),0===c.size){s.disconnect(),o.delete(r);const e=i.findIndex(e=>e.root===r.root&&e.margin===r.margin);e>-1&&i.splice(e,1)}}}(e,e=>e&&b(),{root:null==c?void 0:c.current,rootMargin:u})}if(!a){const e=n.requestIdleCallback(b);return()=>n.cancelIdleCallback(e)}},[l,u,c,a,b]);const g=e.useCallback(()=>{f(!1)},[]);return[e.useCallback(e=>{d.current=e},[]),a,g]};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"client-only";import{useState as
|
|
1
|
+
import"client-only";import{useState as n,useRef as e,useEffect as t,useCallback as r}from"react";import{requestIdleCallback as o,cancelIdleCallback as i}from"../request-idle-callback/index.mjs";import{useStableHandler as s}from"../use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.mjs";const c="function"==typeof IntersectionObserver;function u(u){let{rootRef:f,rootMargin:m,disabled:d}=u;const[g,p]=n(!1),b=e(null),v=s(()=>p(!0));t(()=>{if(c){if(d||g)return;const n=b.current;if(null==n?void 0:n.tagName)return function(n,e,t){const{id:r,observer:o,elements:i}=function(n){let e;const t={root:n.root||null,margin:n.rootMargin||""},r=a.find(n=>n.root===t.root&&n.margin===t.margin);if(r&&(e=l.get(r)))return e;const o=new Map;return e={id:t,observer:new IntersectionObserver(n=>{n.forEach(n=>{const e=o.get(n.target),t=n.isIntersecting||n.intersectionRatio>0;e&&t&&e(t)})},n),elements:o},a.push(t),l.set(t,e),e}(t);return i.set(n,e),o.observe(n),function(){if(i.delete(n),o.unobserve(n),0===i.size){o.disconnect(),l.delete(r);const n=a.findIndex(n=>n.root===r.root&&n.margin===r.margin);n>-1&&a.splice(n,1)}}}(n,n=>n&&v(),{root:null==f?void 0:f.current,rootMargin:m})}if(!g){const n=o(v);return()=>i(n)}},[d,m,f,g,v]);const w=r(()=>{p(!1)},[]);return[r(n=>{b.current=n},[]),g,w]}const l=new Map,a=[];export{u as useIntersection};
|
package/use-map/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("client-only");var e=require("react");exports.useMap=function(){let
|
|
1
|
+
"use strict";require("client-only");var e=require("react");exports.useMap=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Map;const[a,n]=e.useState(t),r=e.useCallback((e,t)=>n(a=>{const n=new Map(a);return n.set(e,t),n}),[]),s=e.useCallback(e=>n(t=>{if(!t.has(e))return t;const a=new Map(t);return a.delete(e),a}),[]);return[a,r,s,e.useCallback(()=>n(new Map),[]),e.useCallback(e=>n(e),[])]};
|
package/use-map/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"client-only";import{useState as e,useCallback as t}from"react";function n(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Map;const[o
|
|
1
|
+
import"client-only";import{useState as e,useCallback as t}from"react";function n(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Map;const[r,o]=e(n),p=t((e,t)=>o(n=>{const r=new Map(n);return r.set(e,t),r}),[]),a=t(e=>o(t=>{if(!t.has(e))return t;const n=new Map(t);return n.delete(e),n}),[]);return[r,p,a,t(()=>o(new Map),[]),t(e=>o(e),[])]}export{n as useMap};
|
package/use-retimer/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("client-only");var e=require("react");exports.useRetimer=function(){const r=e.useRef();return e.useCallback(e=>{
|
|
1
|
+
"use strict";require("client-only");var e=require("react");exports.useRetimer=function(){const r=e.useRef(void 0);return e.useCallback(e=>{null!=r.current&&clearTimeout(r.current),r.current=e},[])};
|
package/use-retimer/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"client-only";import{useRef as r,useCallback as
|
|
1
|
+
import"client-only";import{useRef as r,useCallback as t}from"react";function e(){const e=r(void 0);return t(r=>{null!=e.current&&clearTimeout(e.current),e.current=r},[])}export{e as useRetimer};
|
package/use-set/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require("client-only");var e=require("react");exports.useSet=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Set;const[
|
|
1
|
+
"use strict";require("client-only");var e=require("react");exports.useSet=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Set;const[n,r]=e.useState(t),a=e.useCallback(e=>r(t=>t.has(e)?t:new Set([...t,e])),[]),l=e.useCallback(e=>r(t=>{if(!t.has(e))return t;const n=new Set(t);return n.delete(e),n}),[]);return[n,a,l,e.useCallback(()=>r(new Set),[]),e.useCallback(e=>r(e),[])]};
|
package/use-set/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"client-only";import{useState as e,useCallback as t}from"react";function n(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Set;const[o
|
|
1
|
+
import"client-only";import{useState as e,useCallback as t}from"react";function n(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>new Set;const[r,o]=e(n),i=t(e=>o(t=>t.has(e)?t:new Set([...t,e])),[]),c=t(e=>o(t=>{if(!t.has(e))return t;const n=new Set(t);return n.delete(e),n}),[]);return[r,i,c,t(()=>o(new Set),[]),t(e=>o(e),[])]}export{n as useSet};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("react"),t=require("../use-isomorphic-layout-effect/index.cjs");require("client-only")
|
|
1
|
+
"use strict";var e=require("react"),t=require("../use-isomorphic-layout-effect/index.cjs");function s(e,t){Object.defineProperty(e.t,t,{get:()=>(e.d[t]=!0,e.s[t]),enumerable:!0})}function n(e){return{state:e.s,tracked:e.d}}require("client-only");const r=Object.prototype.hasOwnProperty;exports.useStateWithDeps=function(c){const[{inst:u},o]=e.useState(()=>{const e={s:c,d:{},t:{},u:!1};for(const t in c)r.call(c,t)&&s(e,t);return{inst:e}}),i=e.useCallback(e=>{const t="function"==typeof e?e(u.s):e;let n=!1;for(const e in t)r.call(t,e)&&(r.call(u.t,e)||s(u,e),!Object.is(u.s[e],t[e])&&(u.s[e]=t[e],u.d[e]&&(n=!0)));n&&!u.u&&o({inst:u})},[u]);return t.useLayoutEffect(()=>(u.u=!1,()=>{u.u=!0})),"production"!==process.env.NODE_ENV&&e.useDebugValue(u,n),[u.t,i]};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/** @see https://foxact.skk.moe/use-state-with-deps */
|
|
3
2
|
declare function useStateWithDeps<S extends Record<string, any> = Record<string, any>>(initialState: S): [
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
setState: (payload: Partial<S>) => void
|
|
3
|
+
snapshot: Readonly<S>,
|
|
4
|
+
setState: (payload: Partial<S> | ((prevState: Readonly<S>) => Partial<S>)) => void
|
|
7
5
|
];
|
|
8
6
|
|
|
9
7
|
export { useStateWithDeps };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useState as t,
|
|
1
|
+
import{useState as t,useCallback as e,useDebugValue as o}from"react";import{useLayoutEffect as n}from"../use-isomorphic-layout-effect/index.mjs";import"client-only";function r(t,e){Object.defineProperty(t.t,e,{get:()=>(t.d[e]=!0,t.s[e]),enumerable:!0})}function c(t){return{state:t.s,tracked:t.d}}const s=Object.prototype.hasOwnProperty;function i(i){const[{inst:u},p]=t(()=>{const t={s:i,d:{},t:{},u:!1};for(const e in i)s.call(i,e)&&r(t,e);return{inst:t}}),f=e(t=>{const e="function"==typeof t?t(u.s):t;let o=!1;for(const t in e)s.call(e,t)&&(s.call(u.t,t)||r(u,t),!Object.is(u.s[t],e[t])&&(u.s[t]=e[t],u.d[t]&&(o=!0)));o&&!u.u&&p({inst:u})},[u]);return n(()=>(u.u=!1,()=>{u.u=!0})),"production"!==process.env.NODE_ENV&&o(u,c),[u.t,f]}export{i as useStateWithDeps};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
"use strict";var e=require("react"),t=require("../use-isomorphic-layout-effect/index.cjs");require("client-only");const o=e.memo(o=>{let{mailbox:r,domain:i}=o;const[c,s]=e.useState(()=>Math.random().toString(36).slice(2)+"[at]"+i.replace(/\./g,"[dot]"));return t.useIsomorphicLayoutEffect(()=>{s(r+"@"+i)},[i,r]),c});"production"!==process.env.NODE_ENV&&(o.displayName="EmailProtection"),exports.EmailProtection=o;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
|
|
3
|
-
interface EmailProtectionProps {
|
|
4
|
-
/**
|
|
5
|
-
* The mailbox name.
|
|
6
|
-
* If the desired E-Mail addresses are "hello@example.com", then the mailbox name is "hello".
|
|
7
|
-
*
|
|
8
|
-
* By passing the mailbox name and domain separately, the scrapper won't be able to find the
|
|
9
|
-
* mail address even if they scan JavaScript files.
|
|
10
|
-
*/
|
|
11
|
-
mailbox: string;
|
|
12
|
-
/**
|
|
13
|
-
* The domain name.
|
|
14
|
-
* If the desired E-Mail addresses are "hello@example.com", then the domain name is "example.com".
|
|
15
|
-
*
|
|
16
|
-
* By passing the mailbox name and domain separately, the scrapper won't be able to find the
|
|
17
|
-
* mail address even if they scan JavaScript files.
|
|
18
|
-
*/
|
|
19
|
-
domain: string;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* @see https://foxact.skk.moe/email-protection
|
|
23
|
-
*
|
|
24
|
-
*/
|
|
25
|
-
declare const EmailProtection: react.MemoExoticComponent<({ mailbox, domain }: Readonly<EmailProtectionProps>) => React.ReactNode>;
|
|
26
|
-
|
|
27
|
-
export { EmailProtection };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import{memo as o,useState as t}from"react";import{useIsomorphicLayoutEffect as e}from"../use-isomorphic-layout-effect/index.mjs";import"client-only";const r=o(o=>{let{mailbox:r,domain:i}=o;const[c,n]=t(()=>Math.random().toString(36).slice(2)+"[at]"+i.replace(/\./g,"[dot]"));return e(()=>{n(r+"@"+i)},[i,r]),c});"production"!==process.env.NODE_ENV&&(r.displayName="EmailProtection");export{r as EmailProtection};
|