@fringeworks/react-utils 0.8.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.
Files changed (177) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -0
  3. package/_helpers/_traverseContent.cjs +24 -0
  4. package/_helpers/_traverseContent.d.cts +15 -0
  5. package/_helpers/_traverseContent.d.mts +16 -0
  6. package/_helpers/_traverseContent.mjs +22 -0
  7. package/_helpers/_traverseElement.cjs +23 -0
  8. package/_helpers/_traverseElement.d.cts +15 -0
  9. package/_helpers/_traverseElement.d.mts +16 -0
  10. package/_helpers/_traverseElement.mjs +21 -0
  11. package/_virtual/_rolldown/runtime.cjs +43 -0
  12. package/_virtual/_rolldown/runtime.mjs +18 -0
  13. package/hooks/index.cjs +42 -0
  14. package/hooks/index.d.cts +14 -0
  15. package/hooks/index.d.mts +14 -0
  16. package/hooks/index.mjs +29 -0
  17. package/hooks/useCombinedRefs/index.cjs +3 -0
  18. package/hooks/useCombinedRefs/index.d.cts +2 -0
  19. package/hooks/useCombinedRefs/index.d.mts +2 -0
  20. package/hooks/useCombinedRefs/index.mjs +3 -0
  21. package/hooks/useCombinedRefs/useCombinedRefs.cjs +20 -0
  22. package/hooks/useCombinedRefs/useCombinedRefs.d.cts +10 -0
  23. package/hooks/useCombinedRefs/useCombinedRefs.d.mts +11 -0
  24. package/hooks/useCombinedRefs/useCombinedRefs.mjs +20 -0
  25. package/hooks/useConstant/index.cjs +3 -0
  26. package/hooks/useConstant/index.d.cts +2 -0
  27. package/hooks/useConstant/index.d.mts +2 -0
  28. package/hooks/useConstant/index.mjs +3 -0
  29. package/hooks/useConstant/useConstant.cjs +19 -0
  30. package/hooks/useConstant/useConstant.d.cts +12 -0
  31. package/hooks/useConstant/useConstant.d.mts +13 -0
  32. package/hooks/useConstant/useConstant.mjs +19 -0
  33. package/hooks/useExecutionAt/index.cjs +3 -0
  34. package/hooks/useExecutionAt/index.d.cts +3 -0
  35. package/hooks/useExecutionAt/index.d.mts +3 -0
  36. package/hooks/useExecutionAt/index.mjs +3 -0
  37. package/hooks/useExecutionAt/types.cjs +0 -0
  38. package/hooks/useExecutionAt/types.d.cts +35 -0
  39. package/hooks/useExecutionAt/types.d.mts +35 -0
  40. package/hooks/useExecutionAt/types.mjs +1 -0
  41. package/hooks/useExecutionAt/useExecutionAt.cjs +38 -0
  42. package/hooks/useExecutionAt/useExecutionAt.d.cts +24 -0
  43. package/hooks/useExecutionAt/useExecutionAt.d.mts +25 -0
  44. package/hooks/useExecutionAt/useExecutionAt.mjs +38 -0
  45. package/hooks/useIsMounted/index.cjs +3 -0
  46. package/hooks/useIsMounted/index.d.cts +2 -0
  47. package/hooks/useIsMounted/index.d.mts +2 -0
  48. package/hooks/useIsMounted/index.mjs +3 -0
  49. package/hooks/useIsMounted/useIsMounted.cjs +21 -0
  50. package/hooks/useIsMounted/useIsMounted.d.cts +7 -0
  51. package/hooks/useIsMounted/useIsMounted.d.mts +8 -0
  52. package/hooks/useIsMounted/useIsMounted.mjs +21 -0
  53. package/hooks/useLatestRef/index.cjs +3 -0
  54. package/hooks/useLatestRef/index.d.cts +3 -0
  55. package/hooks/useLatestRef/index.d.mts +3 -0
  56. package/hooks/useLatestRef/index.mjs +3 -0
  57. package/hooks/useLatestRef/types.cjs +0 -0
  58. package/hooks/useLatestRef/types.d.cts +12 -0
  59. package/hooks/useLatestRef/types.d.mts +12 -0
  60. package/hooks/useLatestRef/types.mjs +1 -0
  61. package/hooks/useLatestRef/useLatestRef.cjs +23 -0
  62. package/hooks/useLatestRef/useLatestRef.d.cts +15 -0
  63. package/hooks/useLatestRef/useLatestRef.d.mts +16 -0
  64. package/hooks/useLatestRef/useLatestRef.mjs +23 -0
  65. package/hooks/usePreviousValue/index.cjs +3 -0
  66. package/hooks/usePreviousValue/index.d.cts +3 -0
  67. package/hooks/usePreviousValue/index.d.mts +3 -0
  68. package/hooks/usePreviousValue/index.mjs +3 -0
  69. package/hooks/usePreviousValue/types.cjs +0 -0
  70. package/hooks/usePreviousValue/types.d.cts +18 -0
  71. package/hooks/usePreviousValue/types.d.mts +18 -0
  72. package/hooks/usePreviousValue/types.mjs +1 -0
  73. package/hooks/usePreviousValue/usePreviousValue.cjs +23 -0
  74. package/hooks/usePreviousValue/usePreviousValue.d.cts +11 -0
  75. package/hooks/usePreviousValue/usePreviousValue.d.mts +12 -0
  76. package/hooks/usePreviousValue/usePreviousValue.mjs +23 -0
  77. package/hooks/useStableLength/index.cjs +3 -0
  78. package/hooks/useStableLength/index.d.cts +2 -0
  79. package/hooks/useStableLength/index.d.mts +2 -0
  80. package/hooks/useStableLength/index.mjs +3 -0
  81. package/hooks/useStableLength/useStableLength.cjs +16 -0
  82. package/hooks/useStableLength/useStableLength.d.cts +9 -0
  83. package/hooks/useStableLength/useStableLength.d.mts +10 -0
  84. package/hooks/useStableLength/useStableLength.mjs +16 -0
  85. package/index.cjs +16 -0
  86. package/index.d.cts +4 -0
  87. package/index.d.mts +4 -0
  88. package/index.mjs +4 -0
  89. package/package.json +91 -0
  90. package/types.cjs +0 -0
  91. package/types.d.cts +11 -0
  92. package/types.d.mts +11 -0
  93. package/types.mjs +1 -0
  94. package/utils/applyDefaultProps/applyDefaultProps.cjs +41 -0
  95. package/utils/applyDefaultProps/applyDefaultProps.d.cts +33 -0
  96. package/utils/applyDefaultProps/applyDefaultProps.d.mts +34 -0
  97. package/utils/applyDefaultProps/applyDefaultProps.mjs +40 -0
  98. package/utils/applyDefaultProps/index.cjs +3 -0
  99. package/utils/applyDefaultProps/index.d.cts +3 -0
  100. package/utils/applyDefaultProps/index.d.mts +3 -0
  101. package/utils/applyDefaultProps/index.mjs +3 -0
  102. package/utils/applyDefaultProps/types.cjs +0 -0
  103. package/utils/applyDefaultProps/types.d.cts +27 -0
  104. package/utils/applyDefaultProps/types.d.mts +27 -0
  105. package/utils/applyDefaultProps/types.mjs +1 -0
  106. package/utils/ensureComponent/ensureComponent.cjs +28 -0
  107. package/utils/ensureComponent/ensureComponent.d.cts +10 -0
  108. package/utils/ensureComponent/ensureComponent.d.mts +11 -0
  109. package/utils/ensureComponent/ensureComponent.mjs +28 -0
  110. package/utils/ensureComponent/index.cjs +3 -0
  111. package/utils/ensureComponent/index.d.cts +2 -0
  112. package/utils/ensureComponent/index.d.mts +2 -0
  113. package/utils/ensureComponent/index.mjs +3 -0
  114. package/utils/extendElement/extendElement.cjs +30 -0
  115. package/utils/extendElement/extendElement.d.cts +12 -0
  116. package/utils/extendElement/extendElement.d.mts +13 -0
  117. package/utils/extendElement/extendElement.mjs +30 -0
  118. package/utils/extendElement/index.cjs +3 -0
  119. package/utils/extendElement/index.d.cts +2 -0
  120. package/utils/extendElement/index.d.mts +2 -0
  121. package/utils/extendElement/index.mjs +3 -0
  122. package/utils/forEachContent/forEachContent.cjs +14 -0
  123. package/utils/forEachContent/forEachContent.d.cts +10 -0
  124. package/utils/forEachContent/forEachContent.d.mts +11 -0
  125. package/utils/forEachContent/forEachContent.mjs +14 -0
  126. package/utils/forEachContent/index.cjs +3 -0
  127. package/utils/forEachContent/index.d.cts +2 -0
  128. package/utils/forEachContent/index.d.mts +2 -0
  129. package/utils/forEachContent/index.mjs +3 -0
  130. package/utils/forEachElement/forEachElement.cjs +14 -0
  131. package/utils/forEachElement/forEachElement.d.cts +10 -0
  132. package/utils/forEachElement/forEachElement.d.mts +11 -0
  133. package/utils/forEachElement/forEachElement.mjs +14 -0
  134. package/utils/forEachElement/index.cjs +3 -0
  135. package/utils/forEachElement/index.d.cts +2 -0
  136. package/utils/forEachElement/index.d.mts +2 -0
  137. package/utils/forEachElement/index.mjs +3 -0
  138. package/utils/index.cjs +47 -0
  139. package/utils/index.d.cts +14 -0
  140. package/utils/index.d.mts +14 -0
  141. package/utils/index.mjs +32 -0
  142. package/utils/markAt/index.cjs +3 -0
  143. package/utils/markAt/index.d.cts +3 -0
  144. package/utils/markAt/index.d.mts +3 -0
  145. package/utils/markAt/index.mjs +3 -0
  146. package/utils/markAt/markAt.cjs +14 -0
  147. package/utils/markAt/markAt.d.cts +9 -0
  148. package/utils/markAt/markAt.d.mts +10 -0
  149. package/utils/markAt/markAt.mjs +13 -0
  150. package/utils/markAt/types.cjs +0 -0
  151. package/utils/markAt/types.d.cts +4 -0
  152. package/utils/markAt/types.d.mts +4 -0
  153. package/utils/markAt/types.mjs +1 -0
  154. package/utils/setRefCurrent/index.cjs +3 -0
  155. package/utils/setRefCurrent/index.d.cts +2 -0
  156. package/utils/setRefCurrent/index.d.mts +2 -0
  157. package/utils/setRefCurrent/index.mjs +3 -0
  158. package/utils/setRefCurrent/setRefCurrent.cjs +29 -0
  159. package/utils/setRefCurrent/setRefCurrent.d.cts +11 -0
  160. package/utils/setRefCurrent/setRefCurrent.d.mts +12 -0
  161. package/utils/setRefCurrent/setRefCurrent.mjs +28 -0
  162. package/utils/transformContent/index.cjs +3 -0
  163. package/utils/transformContent/index.d.cts +2 -0
  164. package/utils/transformContent/index.d.mts +2 -0
  165. package/utils/transformContent/index.mjs +3 -0
  166. package/utils/transformContent/transformContent.cjs +16 -0
  167. package/utils/transformContent/transformContent.d.cts +10 -0
  168. package/utils/transformContent/transformContent.d.mts +11 -0
  169. package/utils/transformContent/transformContent.mjs +16 -0
  170. package/utils/transformElement/index.cjs +3 -0
  171. package/utils/transformElement/index.d.cts +2 -0
  172. package/utils/transformElement/index.d.mts +2 -0
  173. package/utils/transformElement/index.mjs +3 -0
  174. package/utils/transformElement/transformElement.cjs +16 -0
  175. package/utils/transformElement/transformElement.d.cts +10 -0
  176. package/utils/transformElement/transformElement.d.mts +11 -0
  177. package/utils/transformElement/transformElement.mjs +16 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mitsuhiro Seino
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # @fringeworks/react-utils
2
+
3
+ A niche library for React.
@@ -0,0 +1,24 @@
1
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
+ let react = require("react");
3
+ let _fringeworks_utils_type_isIterable = require("@fringeworks/utils/type/isIterable");
4
+ _fringeworks_utils_type_isIterable = require_runtime.__toESM(_fringeworks_utils_type_isIterable);
5
+
6
+ //#region src/_helpers/_traverseContent.ts
7
+ /**
8
+ * React.Fragmentを透過し、children内のReactElement、string、numberを処理する
9
+ * @param children エレメントの子要素
10
+ * @param callback コールバック
11
+ * @param collect コールバックの結果を収集する処理
12
+ * @param cursor Fragmentをまたいでindexを連番にする為のカーソル(内部再帰用)
13
+ */
14
+ function _traverseContent(children, callback, collect = () => {}, cursor = { current: 0 }) {
15
+ react.Children.forEach(children, (child) => {
16
+ if ((0, react.isValidElement)(child)) if (child.type === react.Fragment) _traverseContent(child.props.children, callback, collect, cursor);
17
+ else collect(callback(child, cursor.current++));
18
+ else if (typeof child === "string" || typeof child === "number") collect(callback(child, cursor.current++));
19
+ else if ((0, _fringeworks_utils_type_isIterable.default)(child)) _traverseContent(child, callback, collect, cursor);
20
+ });
21
+ }
22
+
23
+ //#endregion
24
+ module.exports = _traverseContent;
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from "react";
2
+
3
+ //#region src/_helpers/_traverseContent.d.ts
4
+ type IndexCursor = {
5
+ current: number;
6
+ };
7
+ /**
8
+ * React.Fragmentを透過し、children内のReactElement、string、numberを処理する
9
+ * @param children エレメントの子要素
10
+ * @param callback コールバック
11
+ * @param collect コールバックの結果を収集する処理
12
+ * @param cursor Fragmentをまたいでindexを連番にする為のカーソル(内部再帰用)
13
+ */
14
+ declare function _traverseContent<N, T>(children: ReactNode, callback: (node: N, index: number) => T, collect?: (value: T) => void, cursor?: IndexCursor): void;
15
+ export = _traverseContent;
@@ -0,0 +1,16 @@
1
+ import { ReactNode } from "react";
2
+
3
+ //#region src/_helpers/_traverseContent.d.ts
4
+ type IndexCursor = {
5
+ current: number;
6
+ };
7
+ /**
8
+ * React.Fragmentを透過し、children内のReactElement、string、numberを処理する
9
+ * @param children エレメントの子要素
10
+ * @param callback コールバック
11
+ * @param collect コールバックの結果を収集する処理
12
+ * @param cursor Fragmentをまたいでindexを連番にする為のカーソル(内部再帰用)
13
+ */
14
+ declare function _traverseContent<N, T>(children: ReactNode, callback: (node: N, index: number) => T, collect?: (value: T) => void, cursor?: IndexCursor): void;
15
+ //#endregion
16
+ export { _traverseContent as default };
@@ -0,0 +1,22 @@
1
+ import { Children, Fragment, isValidElement } from "react";
2
+ import isIterable from "@fringeworks/utils/type/isIterable";
3
+
4
+ //#region src/_helpers/_traverseContent.ts
5
+ /**
6
+ * React.Fragmentを透過し、children内のReactElement、string、numberを処理する
7
+ * @param children エレメントの子要素
8
+ * @param callback コールバック
9
+ * @param collect コールバックの結果を収集する処理
10
+ * @param cursor Fragmentをまたいでindexを連番にする為のカーソル(内部再帰用)
11
+ */
12
+ function _traverseContent(children, callback, collect = () => {}, cursor = { current: 0 }) {
13
+ Children.forEach(children, (child) => {
14
+ if (isValidElement(child)) if (child.type === Fragment) _traverseContent(child.props.children, callback, collect, cursor);
15
+ else collect(callback(child, cursor.current++));
16
+ else if (typeof child === "string" || typeof child === "number") collect(callback(child, cursor.current++));
17
+ else if (isIterable(child)) _traverseContent(child, callback, collect, cursor);
18
+ });
19
+ }
20
+
21
+ //#endregion
22
+ export { _traverseContent as default };
@@ -0,0 +1,23 @@
1
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
+ let react = require("react");
3
+ let _fringeworks_utils_type_isIterable = require("@fringeworks/utils/type/isIterable");
4
+ _fringeworks_utils_type_isIterable = require_runtime.__toESM(_fringeworks_utils_type_isIterable);
5
+
6
+ //#region src/_helpers/_traverseElement.ts
7
+ /**
8
+ * React.Fragmentを透過し、children内のReactElementを処理する
9
+ * @param children エレメントの子要素
10
+ * @param callback コールバック
11
+ * @param collect コールバックの結果を収集する処理
12
+ * @param cursor Fragmentをまたいでindexを連番にする為のカーソル(内部再帰用)
13
+ */
14
+ function _traverseElement(children, callback, collect = () => {}, cursor = { current: 0 }) {
15
+ react.Children.forEach(children, (child) => {
16
+ if ((0, react.isValidElement)(child)) if (child.type === react.Fragment) _traverseElement(child.props.children, callback, collect, cursor);
17
+ else collect(callback(child, cursor.current++));
18
+ else if ((0, _fringeworks_utils_type_isIterable.default)(child) && typeof child !== "string") _traverseElement(child, callback, collect, cursor);
19
+ });
20
+ }
21
+
22
+ //#endregion
23
+ module.exports = _traverseElement;
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from "react";
2
+
3
+ //#region src/_helpers/_traverseElement.d.ts
4
+ type IndexCursor = {
5
+ current: number;
6
+ };
7
+ /**
8
+ * React.Fragmentを透過し、children内のReactElementを処理する
9
+ * @param children エレメントの子要素
10
+ * @param callback コールバック
11
+ * @param collect コールバックの結果を収集する処理
12
+ * @param cursor Fragmentをまたいでindexを連番にする為のカーソル(内部再帰用)
13
+ */
14
+ declare function _traverseElement<N, T>(children: ReactNode, callback: (node: N, index: number) => T, collect?: (value: T) => void, cursor?: IndexCursor): void;
15
+ export = _traverseElement;
@@ -0,0 +1,16 @@
1
+ import { ReactNode } from "react";
2
+
3
+ //#region src/_helpers/_traverseElement.d.ts
4
+ type IndexCursor = {
5
+ current: number;
6
+ };
7
+ /**
8
+ * React.Fragmentを透過し、children内のReactElementを処理する
9
+ * @param children エレメントの子要素
10
+ * @param callback コールバック
11
+ * @param collect コールバックの結果を収集する処理
12
+ * @param cursor Fragmentをまたいでindexを連番にする為のカーソル(内部再帰用)
13
+ */
14
+ declare function _traverseElement<N, T>(children: ReactNode, callback: (node: N, index: number) => T, collect?: (value: T) => void, cursor?: IndexCursor): void;
15
+ //#endregion
16
+ export { _traverseElement as default };
@@ -0,0 +1,21 @@
1
+ import { Children, Fragment, isValidElement } from "react";
2
+ import isIterable from "@fringeworks/utils/type/isIterable";
3
+
4
+ //#region src/_helpers/_traverseElement.ts
5
+ /**
6
+ * React.Fragmentを透過し、children内のReactElementを処理する
7
+ * @param children エレメントの子要素
8
+ * @param callback コールバック
9
+ * @param collect コールバックの結果を収集する処理
10
+ * @param cursor Fragmentをまたいでindexを連番にする為のカーソル(内部再帰用)
11
+ */
12
+ function _traverseElement(children, callback, collect = () => {}, cursor = { current: 0 }) {
13
+ Children.forEach(children, (child) => {
14
+ if (isValidElement(child)) if (child.type === Fragment) _traverseElement(child.props.children, callback, collect, cursor);
15
+ else collect(callback(child, cursor.current++));
16
+ else if (isIterable(child) && typeof child !== "string") _traverseElement(child, callback, collect, cursor);
17
+ });
18
+ }
19
+
20
+ //#endregion
21
+ export { _traverseElement as default };
@@ -0,0 +1,43 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __exportAll = (all, no_symbols) => {
9
+ let target = {};
10
+ for (var name in all) {
11
+ __defProp(target, name, {
12
+ get: all[name],
13
+ enumerable: true
14
+ });
15
+ }
16
+ if (!no_symbols) {
17
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
18
+ }
19
+ return target;
20
+ };
21
+ var __copyProps = (to, from, except, desc) => {
22
+ if (from && typeof from === "object" || typeof from === "function") {
23
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
24
+ key = keys[i];
25
+ if (!__hasOwnProp.call(to, key) && key !== except) {
26
+ __defProp(to, key, {
27
+ get: ((k) => from[k]).bind(null, key),
28
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
29
+ });
30
+ }
31
+ }
32
+ }
33
+ return to;
34
+ };
35
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
36
+ value: mod,
37
+ enumerable: true
38
+ }) : target, mod));
39
+
40
+ //#endregion
41
+
42
+ exports.__exportAll = __exportAll;
43
+ exports.__toESM = __toESM;
@@ -0,0 +1,18 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) {
6
+ __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ }
11
+ if (!no_symbols) {
12
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
13
+ }
14
+ return target;
15
+ };
16
+
17
+ //#endregion
18
+ export { __exportAll };
@@ -0,0 +1,42 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ const require_hooks_useStableLength_useStableLength = require('./useStableLength/useStableLength.cjs');
4
+ require('./useStableLength/index.cjs');
5
+ const require_hooks_useCombinedRefs_useCombinedRefs = require('./useCombinedRefs/useCombinedRefs.cjs');
6
+ require('./useCombinedRefs/index.cjs');
7
+ const require_hooks_useConstant_useConstant = require('./useConstant/useConstant.cjs');
8
+ require('./useConstant/index.cjs');
9
+ const require_hooks_useExecutionAt_useExecutionAt = require('./useExecutionAt/useExecutionAt.cjs');
10
+ require('./useExecutionAt/index.cjs');
11
+ const require_hooks_useIsMounted_useIsMounted = require('./useIsMounted/useIsMounted.cjs');
12
+ require('./useIsMounted/index.cjs');
13
+ const require_hooks_useLatestRef_useLatestRef = require('./useLatestRef/useLatestRef.cjs');
14
+ require('./useLatestRef/index.cjs');
15
+ const require_hooks_usePreviousValue_usePreviousValue = require('./usePreviousValue/usePreviousValue.cjs');
16
+ require('./usePreviousValue/index.cjs');
17
+
18
+ //#region src/hooks/index.ts
19
+ var hooks_exports = /* @__PURE__ */ require_runtime.__exportAll({
20
+ useCombinedRefs: () => require_hooks_useCombinedRefs_useCombinedRefs,
21
+ useConstant: () => require_hooks_useConstant_useConstant,
22
+ useExecutionAt: () => require_hooks_useExecutionAt_useExecutionAt,
23
+ useIsMounted: () => require_hooks_useIsMounted_useIsMounted,
24
+ useLatestRef: () => require_hooks_useLatestRef_useLatestRef,
25
+ usePreviousValue: () => require_hooks_usePreviousValue_usePreviousValue,
26
+ useStableLength: () => require_hooks_useStableLength_useStableLength
27
+ });
28
+
29
+ //#endregion
30
+ Object.defineProperty(exports, 'hooks_exports', {
31
+ enumerable: true,
32
+ get: function () {
33
+ return hooks_exports;
34
+ }
35
+ });
36
+ exports.useCombinedRefs = require_hooks_useCombinedRefs_useCombinedRefs;
37
+ exports.useConstant = require_hooks_useConstant_useConstant;
38
+ exports.useExecutionAt = require_hooks_useExecutionAt_useExecutionAt;
39
+ exports.useIsMounted = require_hooks_useIsMounted_useIsMounted;
40
+ exports.useLatestRef = require_hooks_useLatestRef_useLatestRef;
41
+ exports.usePreviousValue = require_hooks_usePreviousValue_usePreviousValue;
42
+ exports.useStableLength = require_hooks_useStableLength_useStableLength;
@@ -0,0 +1,14 @@
1
+ import useCombinedRefs from "./useCombinedRefs/useCombinedRefs.cjs";
2
+ import useConstant from "./useConstant/useConstant.cjs";
3
+ import useExecutionAt from "./useExecutionAt/useExecutionAt.cjs";
4
+ import useIsMounted from "./useIsMounted/useIsMounted.cjs";
5
+ import useLatestRef from "./useLatestRef/useLatestRef.cjs";
6
+ import usePreviousValue from "./usePreviousValue/usePreviousValue.cjs";
7
+ import useStableLength from "./useStableLength/useStableLength.cjs";
8
+
9
+ //#region src/hooks/index.d.ts
10
+ declare namespace index_d_exports {
11
+ export { useCombinedRefs, useConstant, useExecutionAt, useIsMounted, useLatestRef, usePreviousValue, useStableLength };
12
+ }
13
+ //#endregion
14
+ export { index_d_exports, useCombinedRefs, useConstant, useExecutionAt, useIsMounted, useLatestRef, usePreviousValue, useStableLength };
@@ -0,0 +1,14 @@
1
+ import useCombinedRefs from "./useCombinedRefs/useCombinedRefs.mjs";
2
+ import useConstant from "./useConstant/useConstant.mjs";
3
+ import useExecutionAt from "./useExecutionAt/useExecutionAt.mjs";
4
+ import useIsMounted from "./useIsMounted/useIsMounted.mjs";
5
+ import useLatestRef from "./useLatestRef/useLatestRef.mjs";
6
+ import usePreviousValue from "./usePreviousValue/usePreviousValue.mjs";
7
+ import useStableLength from "./useStableLength/useStableLength.mjs";
8
+
9
+ //#region src/hooks/index.d.ts
10
+ declare namespace index_d_exports {
11
+ export { useCombinedRefs, useConstant, useExecutionAt, useIsMounted, useLatestRef, usePreviousValue, useStableLength };
12
+ }
13
+ //#endregion
14
+ export { index_d_exports, useCombinedRefs, useConstant, useExecutionAt, useIsMounted, useLatestRef, usePreviousValue, useStableLength };
@@ -0,0 +1,29 @@
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
2
+ import useStableLength from "./useStableLength/useStableLength.mjs";
3
+ import "./useStableLength/index.mjs";
4
+ import useCombinedRefs from "./useCombinedRefs/useCombinedRefs.mjs";
5
+ import "./useCombinedRefs/index.mjs";
6
+ import useConstant from "./useConstant/useConstant.mjs";
7
+ import "./useConstant/index.mjs";
8
+ import useExecutionAt from "./useExecutionAt/useExecutionAt.mjs";
9
+ import "./useExecutionAt/index.mjs";
10
+ import useIsMounted from "./useIsMounted/useIsMounted.mjs";
11
+ import "./useIsMounted/index.mjs";
12
+ import useLatestRef from "./useLatestRef/useLatestRef.mjs";
13
+ import "./useLatestRef/index.mjs";
14
+ import usePreviousValue from "./usePreviousValue/usePreviousValue.mjs";
15
+ import "./usePreviousValue/index.mjs";
16
+
17
+ //#region src/hooks/index.ts
18
+ var hooks_exports = /* @__PURE__ */ __exportAll({
19
+ useCombinedRefs: () => useCombinedRefs,
20
+ useConstant: () => useConstant,
21
+ useExecutionAt: () => useExecutionAt,
22
+ useIsMounted: () => useIsMounted,
23
+ useLatestRef: () => useLatestRef,
24
+ usePreviousValue: () => usePreviousValue,
25
+ useStableLength: () => useStableLength
26
+ });
27
+
28
+ //#endregion
29
+ export { hooks_exports, useCombinedRefs, useConstant, useExecutionAt, useIsMounted, useLatestRef, usePreviousValue, useStableLength };
@@ -0,0 +1,3 @@
1
+ const require_hooks_useCombinedRefs_useCombinedRefs = require('./useCombinedRefs.cjs');
2
+
3
+ module.exports = require_hooks_useCombinedRefs_useCombinedRefs;
@@ -0,0 +1,2 @@
1
+ import useCombinedRefs from "./useCombinedRefs.cjs";
2
+ export = useCombinedRefs;
@@ -0,0 +1,2 @@
1
+ import useCombinedRefs from "./useCombinedRefs.mjs";
2
+ export { useCombinedRefs as default };
@@ -0,0 +1,3 @@
1
+ import useCombinedRefs from "./useCombinedRefs.mjs";
2
+
3
+ export { useCombinedRefs as default };
@@ -0,0 +1,20 @@
1
+ const require_utils_setRefCurrent_setRefCurrent = require('../../utils/setRefCurrent/setRefCurrent.cjs');
2
+ const require_hooks_useStableLength_useStableLength = require('../useStableLength/useStableLength.cjs');
3
+ require('../useStableLength/index.cjs');
4
+ let react = require("react");
5
+
6
+ //#region src/hooks/useCombinedRefs/useCombinedRefs.ts
7
+ /**
8
+ * 複数のrefに纏めて値を渡すことができるRefCallbackを取得する
9
+ * @param refs
10
+ * @returns
11
+ */
12
+ function useCombinedRefs(...refs) {
13
+ require_hooks_useStableLength_useStableLength(refs);
14
+ return (0, react.useCallback)((value) => {
15
+ return require_utils_setRefCurrent_setRefCurrent(value, ...refs);
16
+ }, refs);
17
+ }
18
+
19
+ //#endregion
20
+ module.exports = useCombinedRefs;
@@ -0,0 +1,10 @@
1
+ import { Ref, RefCallback } from "react";
2
+
3
+ //#region src/hooks/useCombinedRefs/useCombinedRefs.d.ts
4
+ /**
5
+ * 複数のrefに纏めて値を渡すことができるRefCallbackを取得する
6
+ * @param refs
7
+ * @returns
8
+ */
9
+ declare function useCombinedRefs<T = unknown>(...refs: Ref<T>[]): RefCallback<T>;
10
+ export = useCombinedRefs;
@@ -0,0 +1,11 @@
1
+ import { Ref, RefCallback } from "react";
2
+
3
+ //#region src/hooks/useCombinedRefs/useCombinedRefs.d.ts
4
+ /**
5
+ * 複数のrefに纏めて値を渡すことができるRefCallbackを取得する
6
+ * @param refs
7
+ * @returns
8
+ */
9
+ declare function useCombinedRefs<T = unknown>(...refs: Ref<T>[]): RefCallback<T>;
10
+ //#endregion
11
+ export { useCombinedRefs as default };
@@ -0,0 +1,20 @@
1
+ import setRefCurrent from "../../utils/setRefCurrent/setRefCurrent.mjs";
2
+ import useStableLength from "../useStableLength/useStableLength.mjs";
3
+ import "../useStableLength/index.mjs";
4
+ import { useCallback } from "react";
5
+
6
+ //#region src/hooks/useCombinedRefs/useCombinedRefs.ts
7
+ /**
8
+ * 複数のrefに纏めて値を渡すことができるRefCallbackを取得する
9
+ * @param refs
10
+ * @returns
11
+ */
12
+ function useCombinedRefs(...refs) {
13
+ useStableLength(refs);
14
+ return useCallback((value) => {
15
+ return setRefCurrent(value, ...refs);
16
+ }, refs);
17
+ }
18
+
19
+ //#endregion
20
+ export { useCombinedRefs as default };
@@ -0,0 +1,3 @@
1
+ const require_hooks_useConstant_useConstant = require('./useConstant.cjs');
2
+
3
+ module.exports = require_hooks_useConstant_useConstant;
@@ -0,0 +1,2 @@
1
+ import useConstant from "./useConstant.cjs";
2
+ export = useConstant;
@@ -0,0 +1,2 @@
1
+ import useConstant from "./useConstant.mjs";
2
+ export { useConstant as default };
@@ -0,0 +1,3 @@
1
+ import useConstant from "./useConstant.mjs";
2
+
3
+ export { useConstant as default };
@@ -0,0 +1,19 @@
1
+ let react = require("react");
2
+
3
+ //#region src/hooks/useConstant/useConstant.ts
4
+ /**
5
+ * 初回のレンダリングで作成した値を、アンマウントされるまで返し続けるhook
6
+ *
7
+ * `useMemo`はパフォーマンス最適化のためのhookであり、キャッシュが破棄されないことは保証されていない。
8
+ * 状態を持つインスタンスなど、同一であることが動作の前提となる値はこのhookで保持する。
9
+ *
10
+ * @param factory 値を作成する関数。初回のレンダリングでのみ呼ばれる
11
+ * @returns 値
12
+ */
13
+ function useConstant(factory) {
14
+ const [value] = (0, react.useState)(factory);
15
+ return value;
16
+ }
17
+
18
+ //#endregion
19
+ module.exports = useConstant;
@@ -0,0 +1,12 @@
1
+ //#region src/hooks/useConstant/useConstant.d.ts
2
+ /**
3
+ * 初回のレンダリングで作成した値を、アンマウントされるまで返し続けるhook
4
+ *
5
+ * `useMemo`はパフォーマンス最適化のためのhookであり、キャッシュが破棄されないことは保証されていない。
6
+ * 状態を持つインスタンスなど、同一であることが動作の前提となる値はこのhookで保持する。
7
+ *
8
+ * @param factory 値を作成する関数。初回のレンダリングでのみ呼ばれる
9
+ * @returns 値
10
+ */
11
+ declare function useConstant<T>(factory: () => T): T;
12
+ export = useConstant;
@@ -0,0 +1,13 @@
1
+ //#region src/hooks/useConstant/useConstant.d.ts
2
+ /**
3
+ * 初回のレンダリングで作成した値を、アンマウントされるまで返し続けるhook
4
+ *
5
+ * `useMemo`はパフォーマンス最適化のためのhookであり、キャッシュが破棄されないことは保証されていない。
6
+ * 状態を持つインスタンスなど、同一であることが動作の前提となる値はこのhookで保持する。
7
+ *
8
+ * @param factory 値を作成する関数。初回のレンダリングでのみ呼ばれる
9
+ * @returns 値
10
+ */
11
+ declare function useConstant<T>(factory: () => T): T;
12
+ //#endregion
13
+ export { useConstant as default };
@@ -0,0 +1,19 @@
1
+ import { useState } from "react";
2
+
3
+ //#region src/hooks/useConstant/useConstant.ts
4
+ /**
5
+ * 初回のレンダリングで作成した値を、アンマウントされるまで返し続けるhook
6
+ *
7
+ * `useMemo`はパフォーマンス最適化のためのhookであり、キャッシュが破棄されないことは保証されていない。
8
+ * 状態を持つインスタンスなど、同一であることが動作の前提となる値はこのhookで保持する。
9
+ *
10
+ * @param factory 値を作成する関数。初回のレンダリングでのみ呼ばれる
11
+ * @returns 値
12
+ */
13
+ function useConstant(factory) {
14
+ const [value] = useState(factory);
15
+ return value;
16
+ }
17
+
18
+ //#endregion
19
+ export { useConstant as default };
@@ -0,0 +1,3 @@
1
+ const require_hooks_useExecutionAt_useExecutionAt = require('./useExecutionAt.cjs');
2
+
3
+ module.exports = require_hooks_useExecutionAt_useExecutionAt;
@@ -0,0 +1,3 @@
1
+ import { ExecutionFunction, ExecutionRequest, UseExecutionAtOptions, UseExecutionAtResult } from "./types.cjs";
2
+ import useExecutionAt from "./useExecutionAt.cjs";
3
+ export { type ExecutionFunction, type ExecutionRequest, type UseExecutionAtOptions, type UseExecutionAtResult, useExecutionAt as default };
@@ -0,0 +1,3 @@
1
+ import { ExecutionFunction, ExecutionRequest, UseExecutionAtOptions, UseExecutionAtResult } from "./types.mjs";
2
+ import useExecutionAt from "./useExecutionAt.mjs";
3
+ export { type ExecutionFunction, type ExecutionRequest, type UseExecutionAtOptions, type UseExecutionAtResult, useExecutionAt as default };
@@ -0,0 +1,3 @@
1
+ import useExecutionAt from "./useExecutionAt.mjs";
2
+
3
+ export { useExecutionAt as default };
File without changes
@@ -0,0 +1,35 @@
1
+ import { MarkAtResult } from "../../utils/markAt/types.cjs";
2
+
3
+ //#region src/hooks/useExecutionAt/types.d.ts
4
+ /**
5
+ * オプション
6
+ */
7
+ type UseExecutionAtOptions<P = void> = {
8
+ /**
9
+ * ペイロードの初期値
10
+ */
11
+ initialPayload?: P;
12
+ };
13
+ /**
14
+ * 戻り値
15
+ */
16
+ type UseExecutionAtResult<P = void> = readonly [ExecutionRequest<P>, ExecutionFunction<P>];
17
+ /**
18
+ * 実行時の状態を表す値
19
+ */
20
+ type ExecutionRequest<P = void> = {
21
+ /**
22
+ * 実行される度に増加する値
23
+ */
24
+ readonly at: MarkAtResult;
25
+ /**
26
+ * ペイロード
27
+ */
28
+ readonly payload: P;
29
+ };
30
+ /**
31
+ * 処理実行用関数
32
+ */
33
+ type ExecutionFunction<P = void> = (payload?: P) => void;
34
+ //#endregion
35
+ export { ExecutionFunction, ExecutionRequest, UseExecutionAtOptions, UseExecutionAtResult };
@@ -0,0 +1,35 @@
1
+ import { MarkAtResult } from "../../utils/markAt/types.mjs";
2
+
3
+ //#region src/hooks/useExecutionAt/types.d.ts
4
+ /**
5
+ * オプション
6
+ */
7
+ type UseExecutionAtOptions<P = void> = {
8
+ /**
9
+ * ペイロードの初期値
10
+ */
11
+ initialPayload?: P;
12
+ };
13
+ /**
14
+ * 戻り値
15
+ */
16
+ type UseExecutionAtResult<P = void> = readonly [ExecutionRequest<P>, ExecutionFunction<P>];
17
+ /**
18
+ * 実行時の状態を表す値
19
+ */
20
+ type ExecutionRequest<P = void> = {
21
+ /**
22
+ * 実行される度に増加する値
23
+ */
24
+ readonly at: MarkAtResult;
25
+ /**
26
+ * ペイロード
27
+ */
28
+ readonly payload: P;
29
+ };
30
+ /**
31
+ * 処理実行用関数
32
+ */
33
+ type ExecutionFunction<P = void> = (payload?: P) => void;
34
+ //#endregion
35
+ export { ExecutionFunction, ExecutionRequest, UseExecutionAtOptions, UseExecutionAtResult };
@@ -0,0 +1 @@
1
+ export { };