first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

21
node_modules/use-latest-callback/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Satyajit Sahoo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

39
node_modules/use-latest-callback/README.md generated vendored Normal file
View File

@@ -0,0 +1,39 @@
# use-latest-callback
React hook which returns the latest callback without changing the reference.
This is useful for scenarios such as event listeners where you may not want to resubscribe when the callback changes.
## Installation
Open a Terminal in the project root and run:
```sh
npm install use-latest-callback
```
## Usage
The `useLatestCallback` hook accepts a function as its argument and returns a function that preserves its reference across renders.
```js
import useLatestCallback from 'use-latest-callback';
// ...
function MyComponent() {
const callback = useLatestCallback((value) => {
console.log('Changed', value);
});
React.useEffect(() => {
someEvent.addListener(callback);
return () => someEvent.removeListener(callback);
}, [callback]);
return <>{/* whatever */}</>;
}
```
It's important to note that the callback is not intended to be called during the render phase. Only call the callback in response to an event.

4
node_modules/use-latest-callback/esm.mjs generated vendored Normal file
View File

@@ -0,0 +1,4 @@
// eslint-disable-next-line import/extensions
import useLatestCallback from './lib/src/index.js';
export default useLatestCallback;

5
node_modules/use-latest-callback/lib/src/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
/**
* React hook which returns the latest callback without changing the reference.
*/
declare function useLatestCallback<T extends Function>(callback: T): T;
export = useLatestCallback;

28
node_modules/use-latest-callback/lib/src/index.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
"use strict";
var React = require("react");
/**
* Use `useEffect` during SSR and `useLayoutEffect` in the Browser & React Native to avoid warnings.
*/
var useClientLayoutEffect = typeof document !== 'undefined' ||
(typeof navigator !== 'undefined' && navigator.product === 'ReactNative')
? React.useLayoutEffect
: React.useEffect;
/**
* React hook which returns the latest callback without changing the reference.
*/
// eslint-disable-next-line @typescript-eslint/ban-types
function useLatestCallback(callback) {
var ref = React.useRef(callback);
var latestCallback = React.useRef(function latestCallback() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return ref.current.apply(this, args);
}).current;
useClientLayoutEffect(function () {
ref.current = callback;
});
return latestCallback;
}
module.exports = useLatestCallback;

91
node_modules/use-latest-callback/package.json generated vendored Normal file
View File

@@ -0,0 +1,91 @@
{
"name": "use-latest-callback",
"version": "0.2.6",
"description": "React hook which returns the latest callback without changing the reference",
"repository": "https://github.com/satya164/use-latest-callback",
"author": "Satyajit Sahoo <satyajit.happy@gmail.com>",
"license": "MIT",
"keywords": [
"react",
"use-event",
"use-callback"
],
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"type": "commonjs",
"source": "./src/index.ts",
"main": "./lib/src/index.js",
"types": "./lib/src/index.d.ts",
"exports": {
".": {
"types": "./lib/src/index.d.ts",
"import": "./esm.mjs",
"default": "./lib/src/index.js"
}
},
"files": [
"src",
"lib",
"esm.mjs"
],
"scripts": {
"lint": "eslint \"**/*.{js,ts,tsx}\"",
"test": "node --test",
"typecheck": "tsc --noEmit",
"prebuild": "del lib",
"build": "tsc --declaration",
"prepare": "yarn build",
"release": "release-it"
},
"peerDependencies": {
"react": ">=16.8"
},
"devDependencies": {
"@commitlint/config-conventional": "^12.1.4",
"@release-it/conventional-changelog": "^7.0.2",
"@types/react": "^18.0.10",
"commitlint": "^12.1.4",
"del-cli": "^4.0.1",
"eslint": "^8.53.0",
"eslint-config-satya164": "^3.2.0",
"prettier": "^3.0.3",
"react": "^17.0.2",
"release-it": "^16.2.1",
"typescript": "^5.2.2"
},
"eslintConfig": {
"extends": "satya164",
"env": {
"node": true,
"browser": true
},
"rules": {
"import/no-commonjs": "off"
}
},
"eslintIgnore": [
"node_modules/",
"lib/"
],
"release-it": {
"git": {
"commitMessage": "chore: release ${version}",
"tagName": "v${version}"
},
"npm": {
"publish": true
},
"github": {
"release": true
},
"plugins": {
"@release-it/conventional-changelog": {
"preset": {
"name": "conventionalcommits"
},
"infile": "CHANGELOG.md"
}
}
}
}

34
node_modules/use-latest-callback/src/index.ts generated vendored Normal file
View File

@@ -0,0 +1,34 @@
import * as React from 'react';
/**
* Use `useEffect` during SSR and `useLayoutEffect` in the Browser & React Native to avoid warnings.
*/
const useClientLayoutEffect =
typeof document !== 'undefined' ||
(typeof navigator !== 'undefined' && navigator.product === 'ReactNative')
? React.useLayoutEffect
: React.useEffect;
/**
* React hook which returns the latest callback without changing the reference.
*/
// eslint-disable-next-line @typescript-eslint/ban-types
function useLatestCallback<T extends Function>(callback: T): T {
const ref = React.useRef<T>(callback);
const latestCallback = React.useRef(function latestCallback(
this: unknown,
...args: unknown[]
) {
return ref.current.apply(this, args);
} as unknown as T).current;
useClientLayoutEffect(() => {
ref.current = callback;
});
return latestCallback;
}
// Use export assignment to compile to module.exports =
export = useLatestCallback;