jean-react-utils 0.2.2 → 0.2.3
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/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +51 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -13
package/dist/index.mjs
CHANGED
|
@@ -41,12 +41,12 @@ var require_use_sync_external_store_shim_production = __commonJS({
|
|
|
41
41
|
return x2 === y3 && (0 !== x2 || 1 / x2 === 1 / y3) || x2 !== x2 && y3 !== y3;
|
|
42
42
|
}
|
|
43
43
|
var objectIs = "function" === typeof Object.is ? Object.is : is;
|
|
44
|
-
var
|
|
45
|
-
var
|
|
44
|
+
var useState5 = React3.useState;
|
|
45
|
+
var useEffect3 = React3.useEffect;
|
|
46
46
|
var useLayoutEffect = React3.useLayoutEffect;
|
|
47
47
|
var useDebugValue2 = React3.useDebugValue;
|
|
48
48
|
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
49
|
-
var value = getSnapshot(), _useState =
|
|
49
|
+
var value = getSnapshot(), _useState = useState5({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
|
|
50
50
|
useLayoutEffect(
|
|
51
51
|
function() {
|
|
52
52
|
inst.value = value;
|
|
@@ -55,7 +55,7 @@ var require_use_sync_external_store_shim_production = __commonJS({
|
|
|
55
55
|
},
|
|
56
56
|
[subscribe, value, getSnapshot]
|
|
57
57
|
);
|
|
58
|
-
|
|
58
|
+
useEffect3(
|
|
59
59
|
function() {
|
|
60
60
|
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
61
61
|
return subscribe(function() {
|
|
@@ -104,7 +104,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
104
104
|
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
105
105
|
), didWarnUncachedGetSnapshot = true);
|
|
106
106
|
}
|
|
107
|
-
cachedValue =
|
|
107
|
+
cachedValue = useState5({
|
|
108
108
|
inst: { value, getSnapshot }
|
|
109
109
|
});
|
|
110
110
|
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
|
|
@@ -116,7 +116,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
116
116
|
},
|
|
117
117
|
[subscribe, value, getSnapshot]
|
|
118
118
|
);
|
|
119
|
-
|
|
119
|
+
useEffect3(
|
|
120
120
|
function() {
|
|
121
121
|
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
122
122
|
return subscribe(function() {
|
|
@@ -142,7 +142,7 @@ var require_use_sync_external_store_shim_development = __commonJS({
|
|
|
142
142
|
return getSnapshot();
|
|
143
143
|
}
|
|
144
144
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
145
|
-
var React3 = __require("react"), objectIs = "function" === typeof Object.is ? Object.is : is,
|
|
145
|
+
var React3 = __require("react"), objectIs = "function" === typeof Object.is ? Object.is : is, useState5 = React3.useState, useEffect3 = React3.useEffect, useLayoutEffect = React3.useLayoutEffect, useDebugValue2 = React3.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
146
146
|
exports.useSyncExternalStore = void 0 !== React3.useSyncExternalStore ? React3.useSyncExternalStore : shim;
|
|
147
147
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
148
148
|
}();
|
|
@@ -173,7 +173,7 @@ var require_with_selector_production = __commonJS({
|
|
|
173
173
|
var objectIs = "function" === typeof Object.is ? Object.is : is;
|
|
174
174
|
var useSyncExternalStore = shim.useSyncExternalStore;
|
|
175
175
|
var useRef = React3.useRef;
|
|
176
|
-
var
|
|
176
|
+
var useEffect3 = React3.useEffect;
|
|
177
177
|
var useMemo2 = React3.useMemo;
|
|
178
178
|
var useDebugValue2 = React3.useDebugValue;
|
|
179
179
|
exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
@@ -217,7 +217,7 @@ var require_with_selector_production = __commonJS({
|
|
|
217
217
|
[getSnapshot, getServerSnapshot, selector, isEqual]
|
|
218
218
|
);
|
|
219
219
|
var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
|
|
220
|
-
|
|
220
|
+
useEffect3(
|
|
221
221
|
function() {
|
|
222
222
|
inst.hasValue = true;
|
|
223
223
|
inst.value = value;
|
|
@@ -239,7 +239,7 @@ var require_with_selector_development = __commonJS({
|
|
|
239
239
|
return x2 === y3 && (0 !== x2 || 1 / x2 === 1 / y3) || x2 !== x2 && y3 !== y3;
|
|
240
240
|
}
|
|
241
241
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
242
|
-
var React3 = __require("react"), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = shim.useSyncExternalStore, useRef = React3.useRef,
|
|
242
|
+
var React3 = __require("react"), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = shim.useSyncExternalStore, useRef = React3.useRef, useEffect3 = React3.useEffect, useMemo2 = React3.useMemo, useDebugValue2 = React3.useDebugValue;
|
|
243
243
|
exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
244
244
|
var instRef = useRef(null);
|
|
245
245
|
if (null === instRef.current) {
|
|
@@ -282,7 +282,7 @@ var require_with_selector_development = __commonJS({
|
|
|
282
282
|
[getSnapshot, getServerSnapshot, selector, isEqual]
|
|
283
283
|
);
|
|
284
284
|
var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
|
|
285
|
-
|
|
285
|
+
useEffect3(
|
|
286
286
|
function() {
|
|
287
287
|
inst.hasValue = true;
|
|
288
288
|
inst.value = value;
|
|
@@ -2931,7 +2931,7 @@ function SubTitle({ children, title, className = "" }) {
|
|
|
2931
2931
|
}
|
|
2932
2932
|
|
|
2933
2933
|
// src/layout/Header/index.tsx
|
|
2934
|
-
import { useState as
|
|
2934
|
+
import { useState as useState3 } from "react";
|
|
2935
2935
|
import Link from "next/link";
|
|
2936
2936
|
import { motion as motion2, AnimatePresence } from "framer-motion";
|
|
2937
2937
|
|
|
@@ -2951,6 +2951,9 @@ function BreadIcon({ isMenuOpen }) {
|
|
|
2951
2951
|
// src/layout/Header/index.tsx
|
|
2952
2952
|
import { usePathname } from "next/navigation";
|
|
2953
2953
|
|
|
2954
|
+
// src/theme/providers/theme-toggle.tsx
|
|
2955
|
+
import { useState as useState2, useEffect as useEffect2 } from "react";
|
|
2956
|
+
|
|
2954
2957
|
// ../node_modules/next-themes/dist/index.mjs
|
|
2955
2958
|
import * as t from "react";
|
|
2956
2959
|
var M = (e3, i2, s2, u2, m2, a3, l2, h) => {
|
|
@@ -3051,17 +3054,24 @@ var E = (e3) => (e3 || (e3 = window.matchMedia(I)), e3.matches ? "dark" : "light
|
|
|
3051
3054
|
import { Moon, Sun } from "lucide-react";
|
|
3052
3055
|
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
3053
3056
|
function ThemeToggle() {
|
|
3057
|
+
const [mounted, setMounted] = useState2(false);
|
|
3054
3058
|
const { theme, setTheme } = z();
|
|
3059
|
+
useEffect2(() => {
|
|
3060
|
+
setMounted(true);
|
|
3061
|
+
}, []);
|
|
3062
|
+
if (!mounted) {
|
|
3063
|
+
return null;
|
|
3064
|
+
}
|
|
3065
|
+
const isDark = theme === "dark";
|
|
3055
3066
|
return /* @__PURE__ */ jsxs2(
|
|
3056
3067
|
Button,
|
|
3057
3068
|
{
|
|
3058
3069
|
variant: "borderNone",
|
|
3059
3070
|
size: "icon",
|
|
3060
|
-
onClick: () => setTheme(
|
|
3071
|
+
onClick: () => setTheme(isDark ? "light" : "dark"),
|
|
3061
3072
|
children: [
|
|
3062
3073
|
/* @__PURE__ */ jsx4(Sun, { className: "h-5 w-5 rotate-0 scale-100 transition-all dark:rotate-90 dark:scale-0" }),
|
|
3063
|
-
/* @__PURE__ */ jsx4(Moon, { className: "absolute h-5 w-5 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" })
|
|
3064
|
-
/* @__PURE__ */ jsx4("span", { className: "sr-only", children: "Toggle theme" })
|
|
3074
|
+
/* @__PURE__ */ jsx4(Moon, { className: "absolute h-5 w-5 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" })
|
|
3065
3075
|
]
|
|
3066
3076
|
}
|
|
3067
3077
|
);
|
|
@@ -3083,7 +3093,7 @@ var Header = ({
|
|
|
3083
3093
|
enableAnimation = true,
|
|
3084
3094
|
theme = {}
|
|
3085
3095
|
}) => {
|
|
3086
|
-
const [isMenuOpen, setIsMenuOpen] =
|
|
3096
|
+
const [isMenuOpen, setIsMenuOpen] = useState3(false);
|
|
3087
3097
|
const selectedKey = usePathname().split("/")[2] || "home";
|
|
3088
3098
|
const baseNavClassName = `fixed top-0 left-0 right-0 z-50 backdrop-blur-lg ${className}`;
|
|
3089
3099
|
const navVariants = {
|
|
@@ -3320,9 +3330,9 @@ function BasicLayout({ children }) {
|
|
|
3320
3330
|
}
|
|
3321
3331
|
|
|
3322
3332
|
// src/hooks/useForceRerender.ts
|
|
3323
|
-
import { useState as
|
|
3333
|
+
import { useState as useState4, useCallback as useCallback2 } from "react";
|
|
3324
3334
|
var useForceRerender = () => {
|
|
3325
|
-
const [key, setKey] =
|
|
3335
|
+
const [key, setKey] = useState4(0);
|
|
3326
3336
|
const forceRerender = useCallback2(() => {
|
|
3327
3337
|
setKey((prevKey) => prevKey + 1);
|
|
3328
3338
|
}, []);
|