react-simplikit 0.0.24 → 0.0.25

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.
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/hooks/useIsomorphicLayoutEffect/index.ts
21
+ var useIsomorphicLayoutEffect_exports = {};
22
+ __export(useIsomorphicLayoutEffect_exports, {
23
+ useIsomorphicLayoutEffect: () => useIsomorphicLayoutEffect
24
+ });
25
+ module.exports = __toCommonJS(useIsomorphicLayoutEffect_exports);
26
+
27
+ // src/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.ts
28
+ var import_react = require("react");
29
+ var isServer = typeof window === "undefined";
30
+ var useIsomorphicLayoutEffect = isServer ? import_react.useEffect : import_react.useLayoutEffect;
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ useIsomorphicLayoutEffect
34
+ });
@@ -0,0 +1,25 @@
1
+ import { useEffect } from 'react';
2
+
3
+ /**
4
+ * @description
5
+ * During SSR, there is no DOM to synchronously measure or mutate, so React warns about using useLayoutEffect.
6
+ *
7
+ * This hook provides the behavior of useLayoutEffect in the browser without triggering SSR warnings.
8
+ *
9
+ * It runs synchronously after DOM updates but before paint, making it ideal for:
10
+ * - Measuring DOM elements after render
11
+ * - Applying DOM changes before paint
12
+ * - Preventing UI flashes or layout shifts
13
+ * - Supporting both client and server environments safely
14
+ *
15
+ * @param {React.EffectCallback} effect - The effect function.
16
+ * @param {React.DependencyList} [deps] - An optional array of dependencies.
17
+ *
18
+ * @example
19
+ * useIsomorphicLayoutEffect(() => {
20
+ * // Code to be executed during the layout phase on the client side
21
+ * }, [dep1, dep2, ...]);
22
+ */
23
+ declare const useIsomorphicLayoutEffect: typeof useEffect;
24
+
25
+ export { useIsomorphicLayoutEffect };
@@ -0,0 +1,25 @@
1
+ import { useEffect } from 'react';
2
+
3
+ /**
4
+ * @description
5
+ * During SSR, there is no DOM to synchronously measure or mutate, so React warns about using useLayoutEffect.
6
+ *
7
+ * This hook provides the behavior of useLayoutEffect in the browser without triggering SSR warnings.
8
+ *
9
+ * It runs synchronously after DOM updates but before paint, making it ideal for:
10
+ * - Measuring DOM elements after render
11
+ * - Applying DOM changes before paint
12
+ * - Preventing UI flashes or layout shifts
13
+ * - Supporting both client and server environments safely
14
+ *
15
+ * @param {React.EffectCallback} effect - The effect function.
16
+ * @param {React.DependencyList} [deps] - An optional array of dependencies.
17
+ *
18
+ * @example
19
+ * useIsomorphicLayoutEffect(() => {
20
+ * // Code to be executed during the layout phase on the client side
21
+ * }, [dep1, dep2, ...]);
22
+ */
23
+ declare const useIsomorphicLayoutEffect: typeof useEffect;
24
+
25
+ export { useIsomorphicLayoutEffect };
@@ -0,0 +1,7 @@
1
+ // src/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.ts
2
+ import { useEffect, useLayoutEffect } from "react";
3
+ var isServer = typeof window === "undefined";
4
+ var useIsomorphicLayoutEffect = isServer ? useEffect : useLayoutEffect;
5
+ export {
6
+ useIsomorphicLayoutEffect
7
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-simplikit",
3
- "version": "0.0.24",
3
+ "version": "0.0.25",
4
4
  "main": "./dist/index.cjs",
5
5
  "type": "module",
6
6
  "sideEffects": false,