mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-07-14 06:47:00 +10:00
remove dead code
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "https://unpkg.com/knip@5/schema.json",
|
||||
"entry": ["src/router.tsx"],
|
||||
"entry": ["src/server.ts", "src/router.tsx"],
|
||||
"tailwind": { "entry": ["src/styles.css"] },
|
||||
"project": ["src/**/*.{js,jsx,ts,tsx,mdx,css}"],
|
||||
"ignoreBinaries": ["mint"],
|
||||
|
||||
@@ -90,7 +90,6 @@
|
||||
"input-otp": "^1.4.2",
|
||||
"js-cookie": "^3.0.5",
|
||||
"jsonrepair": "^3.13.3",
|
||||
"lucide-react": "^0.577.0",
|
||||
"monaco-editor": "^0.55.1",
|
||||
"motion": "^12.38.0",
|
||||
"nodemailer": "^8.0.2",
|
||||
|
||||
Generated
-12
@@ -198,9 +198,6 @@ importers:
|
||||
jsonrepair:
|
||||
specifier: ^3.13.3
|
||||
version: 3.13.3
|
||||
lucide-react:
|
||||
specifier: ^0.577.0
|
||||
version: 0.577.0(react@19.2.4)
|
||||
monaco-editor:
|
||||
specifier: ^0.55.1
|
||||
version: 0.55.1
|
||||
@@ -5660,11 +5657,6 @@ packages:
|
||||
resolution: {integrity: sha512-DqC6n3QQ77zdFpCMASA1a3Jlb64Hv2N2DciFGkO/4L9+q/IpIAuRlKOvCXabtRW6cQf8usbmM6BE/TOPysCdIA==}
|
||||
engines: {bun: '>=1.0.0', deno: '>=1.30.0', node: '>=8.0.0'}
|
||||
|
||||
lucide-react@0.577.0:
|
||||
resolution: {integrity: sha512-4LjoFv2eEPwYDPg/CUdBJQSDfPyzXCRrVW1X7jrx/trgxnxkHFjnVZINbzvzxjN70dxychOfg+FTYwBiS3pQ5A==}
|
||||
peerDependencies:
|
||||
react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0
|
||||
|
||||
magic-string@0.25.9:
|
||||
resolution: {integrity: sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==}
|
||||
|
||||
@@ -13391,10 +13383,6 @@ snapshots:
|
||||
lru.min@1.1.4:
|
||||
optional: true
|
||||
|
||||
lucide-react@0.577.0(react@19.2.4):
|
||||
dependencies:
|
||||
react: 19.2.4
|
||||
|
||||
magic-string@0.25.9:
|
||||
dependencies:
|
||||
sourcemap-codec: 1.4.8
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
import * as React from "react";
|
||||
|
||||
type DataStateValue = string | boolean | null;
|
||||
|
||||
function parseDatasetValue(value: string | null): DataStateValue {
|
||||
if (value === null) return null;
|
||||
if (value === "" || value === "true") return true;
|
||||
if (value === "false") return false;
|
||||
return value;
|
||||
}
|
||||
|
||||
function useDataState<T extends HTMLElement = HTMLElement>(
|
||||
key: string,
|
||||
forwardedRef?: React.Ref<T | null>,
|
||||
onChange?: (value: DataStateValue) => void,
|
||||
): [DataStateValue, React.RefObject<T | null>] {
|
||||
const localRef = React.useRef<T | null>(null);
|
||||
React.useImperativeHandle(forwardedRef, () => localRef.current as T);
|
||||
|
||||
const getSnapshot = (): DataStateValue => {
|
||||
const el = localRef.current;
|
||||
return el ? parseDatasetValue(el.getAttribute(`data-${key}`)) : null;
|
||||
};
|
||||
|
||||
const subscribe = (callback: () => void) => {
|
||||
const el = localRef.current;
|
||||
if (!el) return () => {};
|
||||
const observer = new MutationObserver((records) => {
|
||||
for (const record of records) {
|
||||
if (record.attributeName === `data-${key}`) {
|
||||
callback();
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
observer.observe(el, {
|
||||
attributes: true,
|
||||
attributeFilter: [`data-${key}`],
|
||||
});
|
||||
return () => observer.disconnect();
|
||||
};
|
||||
|
||||
const value = React.useSyncExternalStore(subscribe, getSnapshot);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (onChange) onChange(value);
|
||||
}, [value, onChange]);
|
||||
|
||||
return [value, localRef];
|
||||
}
|
||||
|
||||
export { useDataState };
|
||||
@@ -1,23 +0,0 @@
|
||||
import * as React from "react";
|
||||
|
||||
function getStrictContext<T>(
|
||||
name?: string,
|
||||
): readonly [({ value, children }: { value: T; children?: React.ReactNode }) => React.JSX.Element, () => T] {
|
||||
const Context = React.createContext<T | undefined>(undefined);
|
||||
|
||||
const Provider = ({ value, children }: { value: T; children?: React.ReactNode }) => (
|
||||
<Context.Provider value={value}>{children}</Context.Provider>
|
||||
);
|
||||
|
||||
const useSafeContext = () => {
|
||||
const ctx = React.useContext(Context);
|
||||
if (ctx === undefined) {
|
||||
throw new Error(`useContext must be used within ${name ?? "a Provider"}`);
|
||||
}
|
||||
return ctx;
|
||||
};
|
||||
|
||||
return [Provider, useSafeContext] as const;
|
||||
}
|
||||
|
||||
export { getStrictContext };
|
||||
Reference in New Issue
Block a user