use-state-with-ref 0.2.0-main.530523c → 0.2.0-main.b01c9d7
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/use-state-with-ref.js.map +1 -1
- package/package.json +18 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/useStateWithRef.ts"],"sourcesContent":["import useStateWithRef from './useStateWithRef';\n\nexport { useStateWithRef };\n","import { type Dispatch, type SetStateAction, useState } from 'react';\nimport { useRefFrom } from 'use-ref-from';\n\ntype ReadonlyRefObject<S> = ReturnType<typeof useRefFrom<S>>;\n\nexport default function useStateWithRef<S>(\n initialState: S | (() => S)\n): [S, Dispatch<SetStateAction<S>>, ReadonlyRefObject<S>];\n\nexport default function useStateWithRef<S = undefined>(): [\n S | undefined,\n Dispatch<SetStateAction<S | undefined>>,\n ReadonlyRefObject<S | undefined>\n];\n\nexport default function useStateWithRef<S>(\n initialState?: S | (() => S)\n): readonly [S | undefined, Dispatch<SetStateAction<S | undefined>>, ReadonlyRefObject<S | undefined>] {\n const [value, setter] = useState<S | undefined>(initialState);\n\n return Object.freeze([value, setter, useRefFrom(value)]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA6D;AAC7D,0BAA2B;AAcZ,SAAR,gBACL,cACqG;AACrG,QAAM,CAAC,OAAO,MAAM,QAAI,uBAAwB,YAAY;AAE5D,SAAO,OAAO,OAAO,CAAC,OAAO,YAAQ,gCAAW,KAAK,CAAC,CAAC;AACzD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/useStateWithRef.ts"],"sourcesContent":["import useStateWithRef from './useStateWithRef.ts';\n\nexport { useStateWithRef };\n","import { type Dispatch, type SetStateAction, useState } from 'react';\nimport { useRefFrom } from 'use-ref-from';\n\ntype ReadonlyRefObject<S> = ReturnType<typeof useRefFrom<S>>;\n\nexport default function useStateWithRef<S>(\n initialState: S | (() => S)\n): [S, Dispatch<SetStateAction<S>>, ReadonlyRefObject<S>];\n\nexport default function useStateWithRef<S = undefined>(): [\n S | undefined,\n Dispatch<SetStateAction<S | undefined>>,\n ReadonlyRefObject<S | undefined>\n];\n\nexport default function useStateWithRef<S>(\n initialState?: S | (() => S)\n): readonly [S | undefined, Dispatch<SetStateAction<S | undefined>>, ReadonlyRefObject<S | undefined>] {\n const [value, setter] = useState<S | undefined>(initialState);\n\n return Object.freeze([value, setter, useRefFrom(value)]);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA6D;AAC7D,0BAA2B;AAcZ,SAAR,gBACL,cACqG;AACrG,QAAM,CAAC,OAAO,MAAM,QAAI,uBAAwB,YAAY;AAE5D,SAAO,OAAO,OAAO,CAAC,OAAO,YAAQ,gCAAW,KAAK,CAAC,CAAC;AACzD;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "use-state-with-ref",
|
|
3
|
-
"version": "0.2.0-main.
|
|
3
|
+
"version": "0.2.0-main.b01c9d7",
|
|
4
4
|
"description": "React `useState` with a readonly `RefObject`.",
|
|
5
5
|
"files": [
|
|
6
6
|
"./dist/"
|
|
@@ -25,8 +25,9 @@
|
|
|
25
25
|
"bump:auditfix": "npm audit fix || exit 0",
|
|
26
26
|
"bump:dev": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.devDependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true",
|
|
27
27
|
"bump:prod": "PACKAGES_TO_BUMP=$(cat package.json | jq -r '(.pinDependencies // {}) as $P | (.localPeerDependencies // {}) as $L | (.dependencies // {}) | to_entries | map(select(.key as $K | $L | has($K) | not)) | map(.key + \"@\" + ($P[.key] // [\"latest\"])[0]) | join(\" \")') && [ ! -z \"$PACKAGES_TO_BUMP\" ] && npm install $PACKAGES_TO_BUMP || true",
|
|
28
|
-
"precommit": "npm run precommit:eslint && npm run precommit:typescript:production && npm run precommit:typescript:test",
|
|
28
|
+
"precommit": "npm run precommit:eslint && npm run precommit:publint && npm run precommit:typescript:production && npm run precommit:typescript:test",
|
|
29
29
|
"precommit:eslint": "eslint ./src/",
|
|
30
|
+
"precommit:publint": "publint",
|
|
30
31
|
"precommit:typescript:production": "tsc --noEmit --project ./src/tsconfig.precommit.production.json",
|
|
31
32
|
"precommit:typescript:test": "tsc --noEmit --project ./src/tsconfig.precommit.test.json",
|
|
32
33
|
"prepack": "cp ../../CHANGELOG.md . && cp ../../LICENSE . && cp ../../README.md .",
|
|
@@ -77,24 +78,26 @@
|
|
|
77
78
|
"react": ">=16.8.0"
|
|
78
79
|
},
|
|
79
80
|
"devDependencies": {
|
|
80
|
-
"@babel/preset-env": "^7.
|
|
81
|
-
"@babel/preset-react": "^7.
|
|
82
|
-
"@babel/preset-typescript": "^7.
|
|
83
|
-
"@testing-library/
|
|
84
|
-
"@
|
|
85
|
-
"@tsconfig/
|
|
86
|
-
"@
|
|
87
|
-
"@types/
|
|
81
|
+
"@babel/preset-env": "^7.24.7",
|
|
82
|
+
"@babel/preset-react": "^7.24.7",
|
|
83
|
+
"@babel/preset-typescript": "^7.24.7",
|
|
84
|
+
"@testing-library/dom": "^10.2.0",
|
|
85
|
+
"@testing-library/react": "^16.0.0",
|
|
86
|
+
"@tsconfig/recommended": "^1.0.6",
|
|
87
|
+
"@tsconfig/strictest": "^2.0.5",
|
|
88
|
+
"@types/jest": "^29.5.12",
|
|
89
|
+
"@types/react": "^18.3.3",
|
|
88
90
|
"escape-string-regexp": "^5.0.0",
|
|
89
91
|
"jest": "^29.7.0",
|
|
90
92
|
"jest-environment-jsdom": "^29.7.0",
|
|
91
|
-
"
|
|
92
|
-
"react
|
|
93
|
-
"
|
|
94
|
-
"
|
|
93
|
+
"publint": "^0.2.11",
|
|
94
|
+
"react": "^18.3.1",
|
|
95
|
+
"react-test-renderer": "^18.3.1",
|
|
96
|
+
"tsup": "^8.1.0",
|
|
97
|
+
"typescript": "^5.5.2"
|
|
95
98
|
},
|
|
96
99
|
"dependencies": {
|
|
97
100
|
"use-ref-from": "^0.1.0",
|
|
98
|
-
"use-state-with-ref": "^0.2.0-main.
|
|
101
|
+
"use-state-with-ref": "^0.2.0-main.b01c9d7"
|
|
99
102
|
}
|
|
100
103
|
}
|