foxact 0.2.43 → 0.2.45
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/compose-context-provider/index.d.ts +5 -2
- package/context-state/index.cjs +1 -1
- package/context-state/index.d.ts +3 -1
- package/context-state/index.mjs +1 -1
- package/create-storage-hook/index.d.ts +2 -1
- package/create-storage-state-factory/index.d.ts +13 -2
- package/current-year/index.cjs +1 -1
- package/current-year/index.d.ts +3 -1
- package/current-year/index.mjs +1 -1
- package/email-protection/index.cjs +2 -0
- package/email-protection/index.d.ts +27 -0
- package/email-protection/index.mjs +2 -0
- package/is-safari/index.cjs +1 -0
- package/is-safari/index.d.ts +3 -0
- package/is-safari/index.mjs +1 -0
- package/noop/index.d.ts +2 -1
- package/open-new-tab/index.cjs +1 -0
- package/open-new-tab/index.d.ts +3 -0
- package/open-new-tab/index.mjs +1 -0
- package/package.json +146 -107
- package/sizes.json +1 -1
- package/typescript-happy-forward-ref/index.d.ts +2 -1
- package/use-abortable-effect/index.d.ts +5 -1
- package/use-composition-input/index.d.ts +2 -1
- package/use-error-boundary/index.cjs +1 -1
- package/use-error-boundary/index.mjs +1 -1
- package/use-fast-click/index.cjs +1 -0
- package/use-fast-click/index.d.ts +6 -0
- package/use-fast-click/index.mjs +1 -0
- package/use-is-online/index.cjs +1 -1
- package/use-is-online/index.d.ts +1 -1
- package/use-is-online/index.mjs +1 -1
- package/use-local-storage/index.d.ts +9 -3
- package/use-next-link/index.d.ts +5 -2
- package/use-react-router-enable-concurrent-navigation/index.d.ts +3 -1
- package/use-react-router-is-match/index.d.ts +5 -1
- package/use-session-storage/index.d.ts +9 -3
- package/use-singleton/index.d.ts +2 -1
- package/use-uncontrolled/index.d.ts +1 -1
- package/use-url-hash-state/index.d.ts +2 -1
- package/compose-context-provider/index.js +0 -1
- package/context-state/index.js +0 -1
- package/create-context-state/index.js +0 -1
- package/create-fixed-array/index.js +0 -1
- package/create-local-storage-state/index.js +0 -1
- package/create-session-storage-state/index.js +0 -1
- package/create-storage-hook/index.js +0 -1
- package/create-storage-state-factory/index.js +0 -1
- package/current-year/index.js +0 -2
- package/fetch-jsonp/index.js +0 -1
- package/invariant/index.js +0 -1
- package/no-ssr/index.js +0 -1
- package/noop/index.js +0 -1
- package/nullthrow/index.js +0 -1
- package/rem/index.js +0 -1
- package/request-idle-callback/index.js +0 -1
- package/types/index.js +0 -1
- package/typescript-happy-forward-ref/index.js +0 -1
- package/use/index.js +0 -1
- package/use-abortable-effect/index.js +0 -1
- package/use-array/index.js +0 -1
- package/use-clipboard/index.js +0 -1
- package/use-component-will-receive-update/index.js +0 -1
- package/use-composition-input/index.js +0 -1
- package/use-debounced-state/index.js +0 -1
- package/use-debounced-value/index.js +0 -1
- package/use-error-boundary/index.js +0 -1
- package/use-intersection/index.js +0 -1
- package/use-is-client/index.js +0 -1
- package/use-is-online/index.js +0 -2
- package/use-isomorphic-layout-effect/index.js +0 -1
- package/use-local-storage/index.js +0 -1
- package/use-map/index.js +0 -1
- package/use-media-query/index.js +0 -2
- package/use-next-link/index.js +0 -1
- package/use-next-pathname/index.js +0 -1
- package/use-page-visibility/index.js +0 -2
- package/use-react-router-enable-concurrent-navigation/index.js +0 -2
- package/use-react-router-is-match/index.js +0 -1
- package/use-retimer/index.js +0 -1
- package/use-session-storage/index.js +0 -1
- package/use-set/index.js +0 -1
- package/use-singleton/index.js +0 -1
- package/use-stable-handler-only-when-you-know-what-you-are-doing-or-you-will-be-fired/index.js +0 -1
- package/use-typescript-happy-callback/index.js +0 -1
- package/use-uncontrolled/index.js +0 -1
- package/use-url-hash-state/index.js +0 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { Foxact } from '../types/index.js';
|
|
2
|
+
import type { Foxact } from '../types/index.js';
|
|
3
|
+
|
|
4
|
+
|
|
3
5
|
|
|
4
6
|
interface ContextComposeProviderProps extends Foxact.PropsWithChildren {
|
|
5
7
|
contexts: React.ReactElement[];
|
|
@@ -7,4 +9,5 @@ interface ContextComposeProviderProps extends Foxact.PropsWithChildren {
|
|
|
7
9
|
/** @see https://foxact.skk.moe/compose-context-provider */
|
|
8
10
|
declare const ComposeContextProvider: react.MemoExoticComponent<({ contexts, children }: ContextComposeProviderProps) => react.ReactNode>;
|
|
9
11
|
|
|
10
|
-
export { ComposeContextProvider
|
|
12
|
+
export { ComposeContextProvider };
|
|
13
|
+
export type { ContextComposeProviderProps };
|
package/context-state/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("react/jsx-runtime");require("client-only");var t=require("react"),r=require("../noop/index.cjs");exports.createContextState=function(n){const o
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime");require("client-only");var t=require("react"),r=require("../noop/index.cjs");exports.createContextState=function(n){const o=t.createContext(n),u=t.createContext(r.noop);return[r=>{let{children:c}=r;const[i,s]=t.useState(n);return e.jsx(o.Provider,{value:i,children:e.jsx(u.Provider,{value:s,children:c})})},()=>t.useContext(o),()=>t.useContext(u),o]};
|
package/context-state/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
-
import { Foxact } from '../types/index.js';
|
|
3
|
+
import type { Foxact } from '../types/index.js';
|
|
4
|
+
|
|
5
|
+
|
|
4
6
|
|
|
5
7
|
/** @see https://foxact.skk.moe/context-state */
|
|
6
8
|
declare function createContextState<T>(initialState: T): readonly [({ children }: Foxact.PropsWithChildren) => react_jsx_runtime.JSX.Element, () => T, () => react.Dispatch<react.SetStateAction<T>>, react.Context<T>];
|
package/context-state/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import"client-only";import{
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import"client-only";import{useContext as t,createContext as e,useState as o}from"react";import{noop as n}from"../noop/index.mjs";function i(i){const c=e(i),m=e(n);return[t=>{let{children:e}=t;const[n,l]=o(i);return r(c.Provider,{value:n,children:r(m.Provider,{value:l,children:e})})},()=>t(c),()=>t(m),c]}export{i as createContextState};
|
|
@@ -26,4 +26,5 @@ declare function createStorage(type: StorageType): {
|
|
|
26
26
|
useSetStorage: <T>(key: string, serializer: Serializer<T>) => (v: T | null) => void;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
export {
|
|
29
|
+
export { createStorage };
|
|
30
|
+
export type { Deserializer, NotUndefined, Serializer, StateHookTuple, StorageType, UseStorageParserOption, UseStorageRawOption };
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import { StateHookTuple, StorageType,
|
|
1
|
+
import type { NotUndefined, StateHookTuple, StorageType, UseStorageParserOption, UseStorageRawOption } from '../create-storage-hook/index.js';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
2
12
|
|
|
3
13
|
type ValueHook<T> = () => T;
|
|
4
14
|
type SetValueHook<T> = () => (value: T) => void;
|
|
@@ -8,4 +18,5 @@ declare function createStorageStateFactory(type: StorageType): {
|
|
|
8
18
|
<T>(key: string, serverValue?: undefined, options?: UseStorageRawOption | UseStorageParserOption<T>): readonly [StateHook<T | null>, ValueHook<T | null>, SetValueHook<T | null>];
|
|
9
19
|
};
|
|
10
20
|
|
|
11
|
-
export {
|
|
21
|
+
export { createStorageStateFactory };
|
|
22
|
+
export type { SetValueHook, StateHook, ValueHook };
|
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
|
|
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(n=>{let{defaultYear:i,...u}=n;"undefined"==typeof window&&void 0===i&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[s,a]=r.useState(i||new Date().getFullYear());return t.useIsomorphicLayoutEffect(()=>{a(new Date().getFullYear())},[]),e.jsx("span",{...u,children:s})});"production"!==process.env.NODE_ENV&&(n.displayName="CurrentYear"),exports.CurrentYear=n;
|
package/current-year/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
-
import { Foxact } from '../types/index.js';
|
|
3
|
+
import type { Foxact } from '../types/index.js';
|
|
4
|
+
|
|
5
|
+
|
|
4
6
|
|
|
5
7
|
interface CurrentYearProps extends Foxact.ComponentProps<'span'> {
|
|
6
8
|
defaultYear?: number;
|
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
|
|
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(r=>{let{defaultYear:o,...i}=r;"undefined"==typeof window&&void 0===o&&console.warn('[foxact/current-year] "defaultYear" is required during the server-side rendering.');const[a,s]=t(o||new Date().getFullYear());return n(()=>{s(new Date().getFullYear())},[]),e("span",{...i,children:a})});"production"!==process.env.NODE_ENV&&(o.displayName="CurrentYear");export{o as CurrentYear};
|
|
@@ -0,0 +1,2 @@
|
|
|
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;
|
|
@@ -0,0 +1,27 @@
|
|
|
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 };
|
|
@@ -0,0 +1,2 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.isSafari=function(){return"undefined"!=typeof window&&"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent&&!!(/version\/[\d._].*?safari/i.test(navigator.userAgent)||/mobile safari [\d._]+/i.test(navigator.userAgent))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(){return"undefined"!=typeof window&&"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent&&!!(/version\/[\d._].*?safari/i.test(navigator.userAgent)||/mobile safari [\d._]+/i.test(navigator.userAgent))}export{e as isSafari};
|
package/noop/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("../is-safari/index.cjs");exports.openInNewTab=function(n){if("undefined"==typeof window)return;if(e.isSafari()){window.open(n,"_blank");return}const r=document.createElement("a");r.href=n,r.target="_blank",r.rel="noopener noreferrer",document.body.appendChild(r),r.click(),Promise.resolve().finally(()=>{r.remove()})};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isSafari as e}from"../is-safari/index.mjs";function n(n){if("undefined"==typeof window)return;if(e()){window.open(n,"_blank");return}const r=document.createElement("a");r.href=n,r.target="_blank",r.rel="noopener noreferrer",document.body.appendChild(r),r.click(),Promise.resolve().finally(()=>{r.remove()})}export{n as openInNewTab};
|