@fringeworks/react-utils 0.9.2 → 0.11.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/README.ja.md +191 -11
- package/README.md +204 -24
- package/{_helpers → _internal}/_traverseChildren.cjs +1 -1
- package/{_helpers → _internal}/_traverseChildren.d.cts +1 -1
- package/{_helpers → _internal}/_traverseChildren.d.mts +1 -1
- package/{_helpers → _internal}/_traverseChildren.mjs +1 -1
- package/_internal/_useChangeHandler.cjs +48 -0
- package/_internal/_useChangeHandler.d.cts +18 -0
- package/_internal/_useChangeHandler.d.mts +18 -0
- package/_internal/_useChangeHandler.mjs +47 -0
- package/_internal/_useExecutionHandler.cjs +38 -0
- package/_internal/_useExecutionHandler.d.cts +20 -0
- package/_internal/_useExecutionHandler.d.mts +20 -0
- package/_internal/_useExecutionHandler.mjs +37 -0
- package/hooks/index.cjs +26 -2
- package/hooks/index.d.cts +13 -3
- package/hooks/index.d.mts +13 -3
- package/hooks/index.mjs +19 -3
- package/hooks/useChangeEffect/index.cjs +5 -0
- package/hooks/useChangeEffect/index.d.cts +3 -0
- package/hooks/useChangeEffect/index.d.mts +3 -0
- package/hooks/useChangeEffect/index.mjs +3 -0
- package/hooks/useChangeEffect/types.cjs +1 -0
- package/hooks/useChangeEffect/types.d.cts +11 -0
- package/hooks/useChangeEffect/types.d.mts +11 -0
- package/hooks/useChangeEffect/types.mjs +1 -0
- package/hooks/useChangeEffect/useChangeEffect.cjs +37 -0
- package/hooks/useChangeEffect/useChangeEffect.d.cts +27 -0
- package/hooks/useChangeEffect/useChangeEffect.d.mts +27 -0
- package/hooks/useChangeEffect/useChangeEffect.mjs +36 -0
- package/hooks/useChangeLayoutEffect/index.cjs +5 -0
- package/hooks/useChangeLayoutEffect/index.d.cts +2 -0
- package/hooks/useChangeLayoutEffect/index.d.mts +2 -0
- package/hooks/useChangeLayoutEffect/index.mjs +3 -0
- package/hooks/useChangeLayoutEffect/useChangeLayoutEffect.cjs +24 -0
- package/hooks/useChangeLayoutEffect/useChangeLayoutEffect.d.cts +14 -0
- package/hooks/useChangeLayoutEffect/useChangeLayoutEffect.d.mts +14 -0
- package/hooks/useChangeLayoutEffect/useChangeLayoutEffect.mjs +23 -0
- package/hooks/useExecutionEffect/index.cjs +5 -0
- package/hooks/useExecutionEffect/index.d.cts +2 -0
- package/hooks/useExecutionEffect/index.d.mts +2 -0
- package/hooks/useExecutionEffect/index.mjs +3 -0
- package/hooks/useExecutionEffect/useExecutionEffect.cjs +39 -0
- package/hooks/useExecutionEffect/useExecutionEffect.d.cts +30 -0
- package/hooks/useExecutionEffect/useExecutionEffect.d.mts +30 -0
- package/hooks/useExecutionEffect/useExecutionEffect.mjs +38 -0
- package/hooks/useExecutionLayoutEffect/index.cjs +5 -0
- package/hooks/useExecutionLayoutEffect/index.d.cts +2 -0
- package/hooks/useExecutionLayoutEffect/index.d.mts +2 -0
- package/hooks/useExecutionLayoutEffect/index.mjs +3 -0
- package/hooks/useExecutionLayoutEffect/useExecutionLayoutEffect.cjs +24 -0
- package/hooks/useExecutionLayoutEffect/useExecutionLayoutEffect.d.cts +15 -0
- package/hooks/useExecutionLayoutEffect/useExecutionLayoutEffect.d.mts +15 -0
- package/hooks/useExecutionLayoutEffect/useExecutionLayoutEffect.mjs +23 -0
- package/hooks/useExecutionMark/index.cjs +5 -0
- package/hooks/useExecutionMark/index.d.cts +3 -0
- package/hooks/useExecutionMark/index.d.mts +3 -0
- package/hooks/useExecutionMark/index.mjs +3 -0
- package/hooks/useExecutionMark/types.cjs +1 -0
- package/hooks/useExecutionMark/types.d.cts +15 -0
- package/hooks/useExecutionMark/types.d.mts +15 -0
- package/hooks/useExecutionMark/types.mjs +1 -0
- package/hooks/useExecutionMark/useExecutionMark.cjs +29 -0
- package/hooks/useExecutionMark/useExecutionMark.d.cts +19 -0
- package/hooks/useExecutionMark/useExecutionMark.d.mts +19 -0
- package/hooks/useExecutionMark/useExecutionMark.mjs +28 -0
- package/hooks/useIsHydrated/index.cjs +5 -0
- package/hooks/useIsHydrated/index.d.cts +2 -0
- package/hooks/useIsHydrated/index.d.mts +2 -0
- package/hooks/useIsHydrated/index.mjs +3 -0
- package/hooks/useIsHydrated/useIsHydrated.cjs +28 -0
- package/hooks/useIsHydrated/useIsHydrated.d.cts +15 -0
- package/hooks/useIsHydrated/useIsHydrated.d.mts +15 -0
- package/hooks/useIsHydrated/useIsHydrated.mjs +27 -0
- package/hooks/useRerender/index.cjs +5 -0
- package/hooks/useRerender/index.d.cts +2 -0
- package/hooks/useRerender/index.d.mts +2 -0
- package/hooks/useRerender/index.mjs +3 -0
- package/hooks/useRerender/useRerender.cjs +19 -0
- package/hooks/useRerender/useRerender.d.cts +11 -0
- package/hooks/useRerender/useRerender.d.mts +11 -0
- package/hooks/useRerender/useRerender.mjs +18 -0
- package/hooks/useStableCallback/index.cjs +5 -0
- package/hooks/useStableCallback/index.d.cts +2 -0
- package/hooks/useStableCallback/index.d.mts +2 -0
- package/hooks/useStableCallback/index.mjs +3 -0
- package/hooks/useStableCallback/useStableCallback.cjs +25 -0
- package/hooks/useStableCallback/useStableCallback.d.cts +15 -0
- package/hooks/useStableCallback/useStableCallback.d.mts +15 -0
- package/hooks/useStableCallback/useStableCallback.mjs +24 -0
- package/index.cjs +17 -1
- package/index.d.cts +13 -3
- package/index.d.mts +13 -3
- package/index.mjs +10 -2
- package/package.json +81 -1
- package/utils/forEachContent/forEachContent.cjs +2 -2
- package/utils/forEachContent/forEachContent.mjs +1 -1
- package/utils/forEachElement/forEachElement.cjs +2 -2
- package/utils/forEachElement/forEachElement.mjs +1 -1
- package/utils/markAt/types.d.cts +3 -0
- package/utils/markAt/types.d.mts +3 -0
- package/utils/transformContent/transformContent.cjs +2 -2
- package/utils/transformContent/transformContent.mjs +1 -1
- package/utils/transformElement/transformElement.cjs +2 -2
- package/utils/transformElement/transformElement.mjs +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_hooks_useLatestRef_useLatestRef = require("../useLatestRef/useLatestRef.cjs");
|
|
3
|
+
require("../useLatestRef/index.cjs");
|
|
4
|
+
let react = require("react");
|
|
5
|
+
|
|
6
|
+
//#region src/hooks/useStableCallback/useStableCallback.ts
|
|
7
|
+
/**
|
|
8
|
+
* 参照が変わらず、呼ぶと最新のコールバックを実行する関数を返すフック
|
|
9
|
+
*
|
|
10
|
+
* 子のコンポーネントに渡すイベントハンドラーの参照を変えずに、中身は常に最新にする場合に使う。
|
|
11
|
+
* React 19.2 の `useEffectEvent` と違い、子のコンポーネントに渡せる。
|
|
12
|
+
*
|
|
13
|
+
* 最新のコールバックはコミット時に反映されるため、レンダリング中には呼ばないこと(古いコールバックが呼ばれる)。
|
|
14
|
+
* イベントハンドラーやエフェクトの中から呼ぶ。
|
|
15
|
+
*
|
|
16
|
+
* @param callback コールバック
|
|
17
|
+
* @returns 最新のコールバックを呼ぶ関数。参照は常に同じ
|
|
18
|
+
*/
|
|
19
|
+
function useStableCallback(callback) {
|
|
20
|
+
const latestRef = require_hooks_useLatestRef_useLatestRef.default(callback);
|
|
21
|
+
return (0, react.useCallback)((...args) => latestRef.current(...args), [latestRef]);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.default = useStableCallback;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/hooks/useStableCallback/useStableCallback.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* 参照が変わらず、呼ぶと最新のコールバックを実行する関数を返すフック
|
|
4
|
+
*
|
|
5
|
+
* 子のコンポーネントに渡すイベントハンドラーの参照を変えずに、中身は常に最新にする場合に使う。
|
|
6
|
+
* React 19.2 の `useEffectEvent` と違い、子のコンポーネントに渡せる。
|
|
7
|
+
*
|
|
8
|
+
* 最新のコールバックはコミット時に反映されるため、レンダリング中には呼ばないこと(古いコールバックが呼ばれる)。
|
|
9
|
+
* イベントハンドラーやエフェクトの中から呼ぶ。
|
|
10
|
+
*
|
|
11
|
+
* @param callback コールバック
|
|
12
|
+
* @returns 最新のコールバックを呼ぶ関数。参照は常に同じ
|
|
13
|
+
*/
|
|
14
|
+
declare function useStableCallback<A extends unknown[], R>(callback: (...args: A) => R): (...args: A) => R;
|
|
15
|
+
export = useStableCallback;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/hooks/useStableCallback/useStableCallback.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* 参照が変わらず、呼ぶと最新のコールバックを実行する関数を返すフック
|
|
4
|
+
*
|
|
5
|
+
* 子のコンポーネントに渡すイベントハンドラーの参照を変えずに、中身は常に最新にする場合に使う。
|
|
6
|
+
* React 19.2 の `useEffectEvent` と違い、子のコンポーネントに渡せる。
|
|
7
|
+
*
|
|
8
|
+
* 最新のコールバックはコミット時に反映されるため、レンダリング中には呼ばないこと(古いコールバックが呼ばれる)。
|
|
9
|
+
* イベントハンドラーやエフェクトの中から呼ぶ。
|
|
10
|
+
*
|
|
11
|
+
* @param callback コールバック
|
|
12
|
+
* @returns 最新のコールバックを呼ぶ関数。参照は常に同じ
|
|
13
|
+
*/
|
|
14
|
+
export default function useStableCallback<A extends unknown[], R>(callback: (...args: A) => R): (...args: A) => R;
|
|
15
|
+
//#endregion
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import useLatestRef from "../useLatestRef/useLatestRef.mjs";
|
|
2
|
+
import "../useLatestRef/index.mjs";
|
|
3
|
+
import { useCallback } from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/hooks/useStableCallback/useStableCallback.ts
|
|
6
|
+
/**
|
|
7
|
+
* 参照が変わらず、呼ぶと最新のコールバックを実行する関数を返すフック
|
|
8
|
+
*
|
|
9
|
+
* 子のコンポーネントに渡すイベントハンドラーの参照を変えずに、中身は常に最新にする場合に使う。
|
|
10
|
+
* React 19.2 の `useEffectEvent` と違い、子のコンポーネントに渡せる。
|
|
11
|
+
*
|
|
12
|
+
* 最新のコールバックはコミット時に反映されるため、レンダリング中には呼ばないこと(古いコールバックが呼ばれる)。
|
|
13
|
+
* イベントハンドラーやエフェクトの中から呼ぶ。
|
|
14
|
+
*
|
|
15
|
+
* @param callback コールバック
|
|
16
|
+
* @returns 最新のコールバックを呼ぶ関数。参照は常に同じ
|
|
17
|
+
*/
|
|
18
|
+
function useStableCallback(callback) {
|
|
19
|
+
const latestRef = useLatestRef(callback);
|
|
20
|
+
return useCallback((...args) => latestRef.current(...args), [latestRef]);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { useStableCallback as default };
|
package/index.cjs
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_hooks_useLatestRef_useLatestRef = require("./hooks/useLatestRef/useLatestRef.cjs");
|
|
3
|
+
const require_hooks_useChangeEffect_useChangeEffect = require("./hooks/useChangeEffect/useChangeEffect.cjs");
|
|
4
|
+
const require_hooks_useChangeLayoutEffect_useChangeLayoutEffect = require("./hooks/useChangeLayoutEffect/useChangeLayoutEffect.cjs");
|
|
2
5
|
const require_utils_setRefCurrent_setRefCurrent = require("./utils/setRefCurrent/setRefCurrent.cjs");
|
|
3
6
|
const require_hooks_useStableLength_useStableLength = require("./hooks/useStableLength/useStableLength.cjs");
|
|
4
7
|
const require_hooks_useCombinedRefs_useCombinedRefs = require("./hooks/useCombinedRefs/useCombinedRefs.cjs");
|
|
5
8
|
const require_hooks_useConstant_useConstant = require("./hooks/useConstant/useConstant.cjs");
|
|
6
9
|
const require_utils_markAt_markAt = require("./utils/markAt/markAt.cjs");
|
|
7
10
|
const require_hooks_useExecutionAt_useExecutionAt = require("./hooks/useExecutionAt/useExecutionAt.cjs");
|
|
11
|
+
const require_hooks_useExecutionEffect_useExecutionEffect = require("./hooks/useExecutionEffect/useExecutionEffect.cjs");
|
|
12
|
+
const require_hooks_useExecutionLayoutEffect_useExecutionLayoutEffect = require("./hooks/useExecutionLayoutEffect/useExecutionLayoutEffect.cjs");
|
|
13
|
+
const require_hooks_useExecutionMark_useExecutionMark = require("./hooks/useExecutionMark/useExecutionMark.cjs");
|
|
14
|
+
const require_hooks_useIsHydrated_useIsHydrated = require("./hooks/useIsHydrated/useIsHydrated.cjs");
|
|
8
15
|
const require_hooks_useIsMounted_useIsMounted = require("./hooks/useIsMounted/useIsMounted.cjs");
|
|
9
|
-
const require_hooks_useLatestRef_useLatestRef = require("./hooks/useLatestRef/useLatestRef.cjs");
|
|
10
16
|
const require_hooks_usePreviousValue_usePreviousValue = require("./hooks/usePreviousValue/usePreviousValue.cjs");
|
|
17
|
+
const require_hooks_useRerender_useRerender = require("./hooks/useRerender/useRerender.cjs");
|
|
18
|
+
const require_hooks_useStableCallback_useStableCallback = require("./hooks/useStableCallback/useStableCallback.cjs");
|
|
11
19
|
require("./hooks/index.cjs");
|
|
12
20
|
const require_utils_applyDefaultProps_applyDefaultProps = require("./utils/applyDefaultProps/applyDefaultProps.cjs");
|
|
13
21
|
const require_utils_ensureComponent_ensureComponent = require("./utils/ensureComponent/ensureComponent.cjs");
|
|
@@ -29,10 +37,18 @@ exports.markAt = require_utils_markAt_markAt.default;
|
|
|
29
37
|
exports.setRefCurrent = require_utils_setRefCurrent_setRefCurrent.default;
|
|
30
38
|
exports.transformContent = require_utils_transformContent_transformContent.default;
|
|
31
39
|
exports.transformElement = require_utils_transformElement_transformElement.default;
|
|
40
|
+
exports.useChangeEffect = require_hooks_useChangeEffect_useChangeEffect.default;
|
|
41
|
+
exports.useChangeLayoutEffect = require_hooks_useChangeLayoutEffect_useChangeLayoutEffect.default;
|
|
32
42
|
exports.useCombinedRefs = require_hooks_useCombinedRefs_useCombinedRefs.default;
|
|
33
43
|
exports.useConstant = require_hooks_useConstant_useConstant.default;
|
|
34
44
|
exports.useExecutionAt = require_hooks_useExecutionAt_useExecutionAt.default;
|
|
45
|
+
exports.useExecutionEffect = require_hooks_useExecutionEffect_useExecutionEffect.default;
|
|
46
|
+
exports.useExecutionLayoutEffect = require_hooks_useExecutionLayoutEffect_useExecutionLayoutEffect.default;
|
|
47
|
+
exports.useExecutionMark = require_hooks_useExecutionMark_useExecutionMark.default;
|
|
48
|
+
exports.useIsHydrated = require_hooks_useIsHydrated_useIsHydrated.default;
|
|
35
49
|
exports.useIsMounted = require_hooks_useIsMounted_useIsMounted.default;
|
|
36
50
|
exports.useLatestRef = require_hooks_useLatestRef_useLatestRef.default;
|
|
37
51
|
exports.usePreviousValue = require_hooks_usePreviousValue_usePreviousValue.default;
|
|
52
|
+
exports.useRerender = require_hooks_useRerender_useRerender.default;
|
|
53
|
+
exports.useStableCallback = require_hooks_useStableCallback_useStableCallback.default;
|
|
38
54
|
exports.useStableLength = require_hooks_useStableLength_useStableLength.default;
|
package/index.d.cts
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import useConstant from "./hooks/useConstant/useConstant.cjs";
|
|
1
|
+
import { ChangeDependencies } from "./hooks/useChangeEffect/types.cjs";
|
|
3
2
|
import { MarkAtResult } from "./utils/markAt/types.cjs";
|
|
4
3
|
import markAt from "./utils/markAt/markAt.cjs";
|
|
5
4
|
import { ExecutionFunction, ExecutionRequest, UseExecutionAtOptions, UseExecutionAtResult } from "./hooks/useExecutionAt/types.cjs";
|
|
6
5
|
import useExecutionAt from "./hooks/useExecutionAt/useExecutionAt.cjs";
|
|
6
|
+
import { ExecutionMark, UseExecutionMarkResult } from "./hooks/useExecutionMark/types.cjs";
|
|
7
|
+
import useExecutionMark from "./hooks/useExecutionMark/useExecutionMark.cjs";
|
|
8
|
+
import useChangeEffect from "./hooks/useChangeEffect/useChangeEffect.cjs";
|
|
9
|
+
import useChangeLayoutEffect from "./hooks/useChangeLayoutEffect/useChangeLayoutEffect.cjs";
|
|
10
|
+
import useCombinedRefs from "./hooks/useCombinedRefs/useCombinedRefs.cjs";
|
|
11
|
+
import useConstant from "./hooks/useConstant/useConstant.cjs";
|
|
12
|
+
import useExecutionEffect from "./hooks/useExecutionEffect/useExecutionEffect.cjs";
|
|
13
|
+
import useExecutionLayoutEffect from "./hooks/useExecutionLayoutEffect/useExecutionLayoutEffect.cjs";
|
|
14
|
+
import useIsHydrated from "./hooks/useIsHydrated/useIsHydrated.cjs";
|
|
7
15
|
import useIsMounted from "./hooks/useIsMounted/useIsMounted.cjs";
|
|
8
16
|
import { LatestRef } from "./hooks/useLatestRef/types.cjs";
|
|
9
17
|
import useLatestRef from "./hooks/useLatestRef/useLatestRef.cjs";
|
|
10
18
|
import { UsePreviousValueOptions } from "./hooks/usePreviousValue/types.cjs";
|
|
11
19
|
import usePreviousValue from "./hooks/usePreviousValue/usePreviousValue.cjs";
|
|
20
|
+
import useRerender from "./hooks/useRerender/useRerender.cjs";
|
|
21
|
+
import useStableCallback from "./hooks/useStableCallback/useStableCallback.cjs";
|
|
12
22
|
import useStableLength from "./hooks/useStableLength/useStableLength.cjs";
|
|
13
23
|
import "./hooks/index.cjs";
|
|
14
24
|
import { CSSPropertiesWithVars } from "./types.cjs";
|
|
@@ -24,4 +34,4 @@ import setRefCurrent from "./utils/setRefCurrent/setRefCurrent.cjs";
|
|
|
24
34
|
import transformContent from "./utils/transformContent/transformContent.cjs";
|
|
25
35
|
import transformElement from "./utils/transformElement/transformElement.cjs";
|
|
26
36
|
import "./utils/index.cjs";
|
|
27
|
-
export { type AppliedProps, type CSSPropertiesWithVars, type ExecutionFunction, type ExecutionRequest, type ExtendableProps, type LatestRef, type MarkAtResult, type SkippedDefaults, type UseExecutionAtOptions, type UseExecutionAtResult, type UsePreviousValueOptions, applyDefaultProps, ensureComponent, extendElement, forEachContent, forEachElement, getComponentName, markAt, setRefCurrent, transformContent, transformElement, useCombinedRefs, useConstant, useExecutionAt, useIsMounted, useLatestRef, usePreviousValue, useStableLength };
|
|
37
|
+
export { type AppliedProps, type CSSPropertiesWithVars, type ChangeDependencies, type ExecutionFunction, type ExecutionMark, type ExecutionRequest, type ExtendableProps, type LatestRef, type MarkAtResult, type SkippedDefaults, type UseExecutionAtOptions, type UseExecutionAtResult, type UseExecutionMarkResult, type UsePreviousValueOptions, applyDefaultProps, ensureComponent, extendElement, forEachContent, forEachElement, getComponentName, markAt, setRefCurrent, transformContent, transformElement, useChangeEffect, useChangeLayoutEffect, useCombinedRefs, useConstant, useExecutionAt, useExecutionEffect, useExecutionLayoutEffect, useExecutionMark, useIsHydrated, useIsMounted, useLatestRef, usePreviousValue, useRerender, useStableCallback, useStableLength };
|
package/index.d.mts
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import useConstant from "./hooks/useConstant/useConstant.mjs";
|
|
1
|
+
import { ChangeDependencies } from "./hooks/useChangeEffect/types.mjs";
|
|
3
2
|
import { MarkAtResult } from "./utils/markAt/types.mjs";
|
|
4
3
|
import markAt from "./utils/markAt/markAt.mjs";
|
|
5
4
|
import { ExecutionFunction, ExecutionRequest, UseExecutionAtOptions, UseExecutionAtResult } from "./hooks/useExecutionAt/types.mjs";
|
|
6
5
|
import useExecutionAt from "./hooks/useExecutionAt/useExecutionAt.mjs";
|
|
6
|
+
import { ExecutionMark, UseExecutionMarkResult } from "./hooks/useExecutionMark/types.mjs";
|
|
7
|
+
import useExecutionMark from "./hooks/useExecutionMark/useExecutionMark.mjs";
|
|
8
|
+
import useChangeEffect from "./hooks/useChangeEffect/useChangeEffect.mjs";
|
|
9
|
+
import useChangeLayoutEffect from "./hooks/useChangeLayoutEffect/useChangeLayoutEffect.mjs";
|
|
10
|
+
import useCombinedRefs from "./hooks/useCombinedRefs/useCombinedRefs.mjs";
|
|
11
|
+
import useConstant from "./hooks/useConstant/useConstant.mjs";
|
|
12
|
+
import useExecutionEffect from "./hooks/useExecutionEffect/useExecutionEffect.mjs";
|
|
13
|
+
import useExecutionLayoutEffect from "./hooks/useExecutionLayoutEffect/useExecutionLayoutEffect.mjs";
|
|
14
|
+
import useIsHydrated from "./hooks/useIsHydrated/useIsHydrated.mjs";
|
|
7
15
|
import useIsMounted from "./hooks/useIsMounted/useIsMounted.mjs";
|
|
8
16
|
import { LatestRef } from "./hooks/useLatestRef/types.mjs";
|
|
9
17
|
import useLatestRef from "./hooks/useLatestRef/useLatestRef.mjs";
|
|
10
18
|
import { UsePreviousValueOptions } from "./hooks/usePreviousValue/types.mjs";
|
|
11
19
|
import usePreviousValue from "./hooks/usePreviousValue/usePreviousValue.mjs";
|
|
20
|
+
import useRerender from "./hooks/useRerender/useRerender.mjs";
|
|
21
|
+
import useStableCallback from "./hooks/useStableCallback/useStableCallback.mjs";
|
|
12
22
|
import useStableLength from "./hooks/useStableLength/useStableLength.mjs";
|
|
13
23
|
import "./hooks/index.mjs";
|
|
14
24
|
import { CSSPropertiesWithVars } from "./types.mjs";
|
|
@@ -24,4 +34,4 @@ import setRefCurrent from "./utils/setRefCurrent/setRefCurrent.mjs";
|
|
|
24
34
|
import transformContent from "./utils/transformContent/transformContent.mjs";
|
|
25
35
|
import transformElement from "./utils/transformElement/transformElement.mjs";
|
|
26
36
|
import "./utils/index.mjs";
|
|
27
|
-
export { type AppliedProps, type CSSPropertiesWithVars, type ExecutionFunction, type ExecutionRequest, type ExtendableProps, type LatestRef, type MarkAtResult, type SkippedDefaults, type UseExecutionAtOptions, type UseExecutionAtResult, type UsePreviousValueOptions, applyDefaultProps, ensureComponent, extendElement, forEachContent, forEachElement, getComponentName, markAt, setRefCurrent, transformContent, transformElement, useCombinedRefs, useConstant, useExecutionAt, useIsMounted, useLatestRef, usePreviousValue, useStableLength };
|
|
37
|
+
export { type AppliedProps, type CSSPropertiesWithVars, type ChangeDependencies, type ExecutionFunction, type ExecutionMark, type ExecutionRequest, type ExtendableProps, type LatestRef, type MarkAtResult, type SkippedDefaults, type UseExecutionAtOptions, type UseExecutionAtResult, type UseExecutionMarkResult, type UsePreviousValueOptions, applyDefaultProps, ensureComponent, extendElement, forEachContent, forEachElement, getComponentName, markAt, setRefCurrent, transformContent, transformElement, useChangeEffect, useChangeLayoutEffect, useCombinedRefs, useConstant, useExecutionAt, useExecutionEffect, useExecutionLayoutEffect, useExecutionMark, useIsHydrated, useIsMounted, useLatestRef, usePreviousValue, useRerender, useStableCallback, useStableLength };
|
package/index.mjs
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
|
+
import useLatestRef from "./hooks/useLatestRef/useLatestRef.mjs";
|
|
2
|
+
import useChangeEffect from "./hooks/useChangeEffect/useChangeEffect.mjs";
|
|
3
|
+
import useChangeLayoutEffect from "./hooks/useChangeLayoutEffect/useChangeLayoutEffect.mjs";
|
|
1
4
|
import setRefCurrent from "./utils/setRefCurrent/setRefCurrent.mjs";
|
|
2
5
|
import useStableLength from "./hooks/useStableLength/useStableLength.mjs";
|
|
3
6
|
import useCombinedRefs from "./hooks/useCombinedRefs/useCombinedRefs.mjs";
|
|
4
7
|
import useConstant from "./hooks/useConstant/useConstant.mjs";
|
|
5
8
|
import markAt from "./utils/markAt/markAt.mjs";
|
|
6
9
|
import useExecutionAt from "./hooks/useExecutionAt/useExecutionAt.mjs";
|
|
10
|
+
import useExecutionEffect from "./hooks/useExecutionEffect/useExecutionEffect.mjs";
|
|
11
|
+
import useExecutionLayoutEffect from "./hooks/useExecutionLayoutEffect/useExecutionLayoutEffect.mjs";
|
|
12
|
+
import useExecutionMark from "./hooks/useExecutionMark/useExecutionMark.mjs";
|
|
13
|
+
import useIsHydrated from "./hooks/useIsHydrated/useIsHydrated.mjs";
|
|
7
14
|
import useIsMounted from "./hooks/useIsMounted/useIsMounted.mjs";
|
|
8
|
-
import useLatestRef from "./hooks/useLatestRef/useLatestRef.mjs";
|
|
9
15
|
import usePreviousValue from "./hooks/usePreviousValue/usePreviousValue.mjs";
|
|
16
|
+
import useRerender from "./hooks/useRerender/useRerender.mjs";
|
|
17
|
+
import useStableCallback from "./hooks/useStableCallback/useStableCallback.mjs";
|
|
10
18
|
import "./hooks/index.mjs";
|
|
11
19
|
import applyDefaultProps from "./utils/applyDefaultProps/applyDefaultProps.mjs";
|
|
12
20
|
import ensureComponent from "./utils/ensureComponent/ensureComponent.mjs";
|
|
@@ -18,4 +26,4 @@ import transformContent from "./utils/transformContent/transformContent.mjs";
|
|
|
18
26
|
import transformElement from "./utils/transformElement/transformElement.mjs";
|
|
19
27
|
import "./utils/index.mjs";
|
|
20
28
|
|
|
21
|
-
export { applyDefaultProps, ensureComponent, extendElement, forEachContent, forEachElement, getComponentName, markAt, setRefCurrent, transformContent, transformElement, useCombinedRefs, useConstant, useExecutionAt, useIsMounted, useLatestRef, usePreviousValue, useStableLength };
|
|
29
|
+
export { applyDefaultProps, ensureComponent, extendElement, forEachContent, forEachElement, getComponentName, markAt, setRefCurrent, transformContent, transformElement, useChangeEffect, useChangeLayoutEffect, useCombinedRefs, useConstant, useExecutionAt, useExecutionEffect, useExecutionLayoutEffect, useExecutionMark, useIsHydrated, useIsMounted, useLatestRef, usePreviousValue, useRerender, useStableCallback, useStableLength };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fringeworks/react-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "A library some will find handy, providing utilities for React.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react"
|
|
@@ -34,6 +34,26 @@
|
|
|
34
34
|
"default": "./hooks/index.cjs"
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
|
+
"./hooks/useChangeEffect": {
|
|
38
|
+
"import": {
|
|
39
|
+
"types": "./hooks/useChangeEffect/index.d.mts",
|
|
40
|
+
"default": "./hooks/useChangeEffect/index.mjs"
|
|
41
|
+
},
|
|
42
|
+
"require": {
|
|
43
|
+
"types": "./hooks/useChangeEffect/index.d.cts",
|
|
44
|
+
"default": "./hooks/useChangeEffect/index.cjs"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"./hooks/useChangeLayoutEffect": {
|
|
48
|
+
"import": {
|
|
49
|
+
"types": "./hooks/useChangeLayoutEffect/index.d.mts",
|
|
50
|
+
"default": "./hooks/useChangeLayoutEffect/index.mjs"
|
|
51
|
+
},
|
|
52
|
+
"require": {
|
|
53
|
+
"types": "./hooks/useChangeLayoutEffect/index.d.cts",
|
|
54
|
+
"default": "./hooks/useChangeLayoutEffect/index.cjs"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
37
57
|
"./hooks/useCombinedRefs": {
|
|
38
58
|
"import": {
|
|
39
59
|
"types": "./hooks/useCombinedRefs/index.d.mts",
|
|
@@ -64,6 +84,46 @@
|
|
|
64
84
|
"default": "./hooks/useExecutionAt/index.cjs"
|
|
65
85
|
}
|
|
66
86
|
},
|
|
87
|
+
"./hooks/useExecutionEffect": {
|
|
88
|
+
"import": {
|
|
89
|
+
"types": "./hooks/useExecutionEffect/index.d.mts",
|
|
90
|
+
"default": "./hooks/useExecutionEffect/index.mjs"
|
|
91
|
+
},
|
|
92
|
+
"require": {
|
|
93
|
+
"types": "./hooks/useExecutionEffect/index.d.cts",
|
|
94
|
+
"default": "./hooks/useExecutionEffect/index.cjs"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"./hooks/useExecutionLayoutEffect": {
|
|
98
|
+
"import": {
|
|
99
|
+
"types": "./hooks/useExecutionLayoutEffect/index.d.mts",
|
|
100
|
+
"default": "./hooks/useExecutionLayoutEffect/index.mjs"
|
|
101
|
+
},
|
|
102
|
+
"require": {
|
|
103
|
+
"types": "./hooks/useExecutionLayoutEffect/index.d.cts",
|
|
104
|
+
"default": "./hooks/useExecutionLayoutEffect/index.cjs"
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"./hooks/useExecutionMark": {
|
|
108
|
+
"import": {
|
|
109
|
+
"types": "./hooks/useExecutionMark/index.d.mts",
|
|
110
|
+
"default": "./hooks/useExecutionMark/index.mjs"
|
|
111
|
+
},
|
|
112
|
+
"require": {
|
|
113
|
+
"types": "./hooks/useExecutionMark/index.d.cts",
|
|
114
|
+
"default": "./hooks/useExecutionMark/index.cjs"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"./hooks/useIsHydrated": {
|
|
118
|
+
"import": {
|
|
119
|
+
"types": "./hooks/useIsHydrated/index.d.mts",
|
|
120
|
+
"default": "./hooks/useIsHydrated/index.mjs"
|
|
121
|
+
},
|
|
122
|
+
"require": {
|
|
123
|
+
"types": "./hooks/useIsHydrated/index.d.cts",
|
|
124
|
+
"default": "./hooks/useIsHydrated/index.cjs"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
67
127
|
"./hooks/useIsMounted": {
|
|
68
128
|
"import": {
|
|
69
129
|
"types": "./hooks/useIsMounted/index.d.mts",
|
|
@@ -94,6 +154,26 @@
|
|
|
94
154
|
"default": "./hooks/usePreviousValue/index.cjs"
|
|
95
155
|
}
|
|
96
156
|
},
|
|
157
|
+
"./hooks/useRerender": {
|
|
158
|
+
"import": {
|
|
159
|
+
"types": "./hooks/useRerender/index.d.mts",
|
|
160
|
+
"default": "./hooks/useRerender/index.mjs"
|
|
161
|
+
},
|
|
162
|
+
"require": {
|
|
163
|
+
"types": "./hooks/useRerender/index.d.cts",
|
|
164
|
+
"default": "./hooks/useRerender/index.cjs"
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"./hooks/useStableCallback": {
|
|
168
|
+
"import": {
|
|
169
|
+
"types": "./hooks/useStableCallback/index.d.mts",
|
|
170
|
+
"default": "./hooks/useStableCallback/index.mjs"
|
|
171
|
+
},
|
|
172
|
+
"require": {
|
|
173
|
+
"types": "./hooks/useStableCallback/index.d.cts",
|
|
174
|
+
"default": "./hooks/useStableCallback/index.cjs"
|
|
175
|
+
}
|
|
176
|
+
},
|
|
97
177
|
"./hooks/useStableLength": {
|
|
98
178
|
"import": {
|
|
99
179
|
"types": "./hooks/useStableLength/index.d.mts",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
-
const
|
|
2
|
+
const require__internal__traverseChildren = require("../../_internal/_traverseChildren.cjs");
|
|
3
3
|
|
|
4
4
|
//#region src/utils/forEachContent/forEachContent.ts
|
|
5
5
|
/**
|
|
@@ -8,7 +8,7 @@ const require__helpers__traverseChildren = require("../../_helpers/_traverseChil
|
|
|
8
8
|
* @param callback コールバック。indexはFragmentをまたいだ連番
|
|
9
9
|
*/
|
|
10
10
|
function forEachContent(children, callback) {
|
|
11
|
-
|
|
11
|
+
require__internal__traverseChildren.default(children, require__internal__traverseChildren._isContent, callback);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
-
const
|
|
2
|
+
const require__internal__traverseChildren = require("../../_internal/_traverseChildren.cjs");
|
|
3
3
|
let react = require("react");
|
|
4
4
|
|
|
5
5
|
//#region src/utils/forEachElement/forEachElement.ts
|
|
@@ -9,7 +9,7 @@ let react = require("react");
|
|
|
9
9
|
* @param callback コールバック。indexはFragmentをまたいだ連番
|
|
10
10
|
*/
|
|
11
11
|
function forEachElement(children, callback) {
|
|
12
|
-
|
|
12
|
+
require__internal__traverseChildren.default(children, react.isValidElement, callback);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
//#endregion
|
package/utils/markAt/types.d.cts
CHANGED
package/utils/markAt/types.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
-
const
|
|
2
|
+
const require__internal__traverseChildren = require("../../_internal/_traverseChildren.cjs");
|
|
3
3
|
|
|
4
4
|
//#region src/utils/transformContent/transformContent.ts
|
|
5
5
|
/**
|
|
@@ -15,7 +15,7 @@ const require__helpers__traverseChildren = require("../../_helpers/_traverseChil
|
|
|
15
15
|
*/
|
|
16
16
|
function transformContent(children, callback) {
|
|
17
17
|
const result = [];
|
|
18
|
-
|
|
18
|
+
require__internal__traverseChildren.default(children, require__internal__traverseChildren._isContent, callback, (value) => result.push(value));
|
|
19
19
|
return result;
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
-
const
|
|
2
|
+
const require__internal__traverseChildren = require("../../_internal/_traverseChildren.cjs");
|
|
3
3
|
let react = require("react");
|
|
4
4
|
|
|
5
5
|
//#region src/utils/transformElement/transformElement.ts
|
|
@@ -16,7 +16,7 @@ let react = require("react");
|
|
|
16
16
|
*/
|
|
17
17
|
function transformElement(children, callback) {
|
|
18
18
|
const result = [];
|
|
19
|
-
|
|
19
|
+
require__internal__traverseChildren.default(children, react.isValidElement, callback, (value) => result.push(value));
|
|
20
20
|
return result;
|
|
21
21
|
}
|
|
22
22
|
|