cross-state 0.37.17 → 0.37.19
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/cjs/index.cjs +16 -16
- package/dist/cjs/propAccess.cjs.map +1 -1
- package/dist/cjs/react/index.cjs +1 -1
- package/dist/cjs/react/register.cjs +1 -1
- package/dist/cjs/store.cjs.map +1 -1
- package/dist/cjs/storeMethods.cjs.map +1 -1
- package/dist/es/index.mjs +4 -4
- package/dist/es/propAccess.mjs.map +1 -1
- package/dist/es/react/index.mjs +1 -1
- package/dist/es/react/register.mjs +1 -1
- package/dist/es/store.mjs.map +1 -1
- package/dist/es/storeMethods.mjs.map +1 -1
- package/dist/types/lib/path.d.ts +2 -1
- package/dist/types/lib/propAccess.d.ts +4 -4
- package/dist/types/lib/standardMethods.d.ts +2 -2
- package/dist/types/lib/typeHelpers.d.ts +2 -1
- package/package.json +19 -19
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { KeyType, Path, SettablePath, Value } from './path';
|
|
1
|
+
import type { KeyType, Path, SettablePath, SettableValue, Value } from './path';
|
|
2
2
|
export declare function castArrayPath(path: string | KeyType[]): KeyType[];
|
|
3
|
-
export declare function get<T, P extends Path<T>>(object: T, path: P): Value<T, P>;
|
|
4
|
-
export declare function set<T, P extends SettablePath<T>>(object: T, path: P, value:
|
|
5
|
-
export declare function remove<T, P extends Path<T, true>>(object: T, path: P): T;
|
|
3
|
+
export declare function get<T, const P extends Path<T>>(object: T, path: P): Value<T, P>;
|
|
4
|
+
export declare function set<T, const P extends SettablePath<T>>(object: T, path: P, value: SettableValue<T, P>, rootPath?: string | readonly KeyType[]): T;
|
|
5
|
+
export declare function remove<T, const P extends Path<T, true>>(object: T, path: P): T;
|
|
6
6
|
export declare function join(a: string, b: string): string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Store } from '../core/store';
|
|
2
|
-
import type { OptionalPropertyOf } from './typeHelpers';
|
|
2
|
+
import type { OptionalProperties, OptionalPropertyOf } from './typeHelpers';
|
|
3
3
|
type Function_ = (...args: any) => any;
|
|
4
4
|
export declare const arrayMethods: {
|
|
5
5
|
[P in 'splice' | 'push' | 'pop' | 'shift' | 'unshift' | 'reverse' | 'sort']: <T extends Array<any>>(this: Store<T>, ...args: T[P] extends Function_ ? Parameters<T[P]> : never) => T[P] extends Function_ ? ReturnType<T[P]> : never;
|
|
6
6
|
};
|
|
7
7
|
export declare const recordMethods: {
|
|
8
8
|
delete<T extends Record<any, any>, K extends OptionalPropertyOf<T>>(this: Store<T>, key: K): void;
|
|
9
|
-
clear<T extends Record<any, any>>(this: Store<
|
|
9
|
+
clear<T extends Record<any, any>>(this: OptionalProperties<T> extends T ? Store<T> : never): void;
|
|
10
10
|
};
|
|
11
11
|
export declare const mapMethods: {
|
|
12
12
|
delete<K, V>(this: Store<Map<K, V>>, key: K): boolean;
|
|
@@ -5,7 +5,8 @@ export type StringToNumber<T> = T extends `${infer K extends number}` ? K : neve
|
|
|
5
5
|
export type ArrayToStringPath<T> = T extends readonly [] ? '' : T extends readonly [infer First extends string | number, ...infer Rest] ? First extends `${string}.${string}` ? never : Rest extends readonly [] ? `${First}` : `${First}.${ArrayToStringPath<Rest>}` : T extends readonly KeyType[] ? string : never;
|
|
6
6
|
export type StringToArrayPath<T> = T extends '' ? readonly [] : T extends `${infer First}.${infer Rest}` ? readonly [First, ...StringToArrayPath<Rest>] : readonly [T];
|
|
7
7
|
export type OptionalPropertyOf<T> = Exclude<{
|
|
8
|
-
[K in keyof T]: T extends Record<K, T[K]> ? never : K;
|
|
8
|
+
[K in keyof T]: string extends K ? K : number extends K ? K : symbol extends K ? K : T extends Record<K, T[K]> ? never : K;
|
|
9
9
|
}[keyof T], undefined>;
|
|
10
|
+
export type OptionalProperties<T> = Pick<T, OptionalPropertyOf<T>>;
|
|
10
11
|
export type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
11
12
|
export type IsNever<T> = [T] extends [never] ? true : false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cross-state",
|
|
3
|
-
"version": "0.37.
|
|
3
|
+
"version": "0.37.19",
|
|
4
4
|
"description": "(React) state library",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "schummar/cross-state",
|
|
@@ -105,9 +105,9 @@
|
|
|
105
105
|
"lint:tsc:tests": "tsc --noEmit --emitDeclarationOnly false -p test/tsconfig.json",
|
|
106
106
|
"size": "size-limit",
|
|
107
107
|
"prepublishOnly": "runp -i lint test build :p size publint",
|
|
108
|
-
"test": "
|
|
109
|
-
"test:watch": "
|
|
110
|
-
"test:ui": "
|
|
108
|
+
"test": "vitest run --coverage",
|
|
109
|
+
"test:watch": "vitest",
|
|
110
|
+
"test:ui": "vitest --ui",
|
|
111
111
|
"test:export": "pnpm test:watch run --coverage --reporter=verbose --reporter=junit --outputFile=test/testResults.xml"
|
|
112
112
|
},
|
|
113
113
|
"peerDependencies": {
|
|
@@ -127,9 +127,9 @@
|
|
|
127
127
|
}
|
|
128
128
|
},
|
|
129
129
|
"devDependencies": {
|
|
130
|
-
"@emotion/styled": "11.
|
|
131
|
-
"@mantine/core": "7.
|
|
132
|
-
"@mui/material": "5.
|
|
130
|
+
"@emotion/styled": "11.13.0",
|
|
131
|
+
"@mantine/core": "7.12.0",
|
|
132
|
+
"@mui/material": "5.16.7",
|
|
133
133
|
"@schummar/eslint-config": "github:schummar/eslint-config",
|
|
134
134
|
"@schummar/prettier-config": "github:schummar/prettier-config",
|
|
135
135
|
"@schummar/runp": "2.0.3",
|
|
@@ -139,29 +139,29 @@
|
|
|
139
139
|
"@types/react-dom": "18.3.0",
|
|
140
140
|
"@types/seedrandom": "3.0.8",
|
|
141
141
|
"@types/use-sync-external-store": "0.0.6",
|
|
142
|
-
"@types/ws": "8.5.
|
|
142
|
+
"@types/ws": "8.5.12",
|
|
143
143
|
"@vitejs/plugin-react": "4.3.1",
|
|
144
|
-
"@vitest/coverage-v8": "
|
|
145
|
-
"@vitest/ui": "^
|
|
144
|
+
"@vitest/coverage-v8": "2.0.5",
|
|
145
|
+
"@vitest/ui": "^2.0.5",
|
|
146
146
|
"esbuild": "0.23.0",
|
|
147
147
|
"eslint": "8.57.0",
|
|
148
148
|
"happy-dom": "14.12.3",
|
|
149
|
-
"jsdom": "24.1.
|
|
150
|
-
"mutative": "1.0.
|
|
151
|
-
"prettier": "3.3.
|
|
152
|
-
"publint": "0.2.
|
|
149
|
+
"jsdom": "24.1.1",
|
|
150
|
+
"mutative": "1.0.8",
|
|
151
|
+
"prettier": "3.3.3",
|
|
152
|
+
"publint": "0.2.9",
|
|
153
153
|
"react": "18.3.1",
|
|
154
154
|
"react-dom": "18.3.1",
|
|
155
|
-
"rimraf": "
|
|
155
|
+
"rimraf": "6.0.1",
|
|
156
156
|
"seedrandom": "3.0.5",
|
|
157
157
|
"semantic-release": "24.0.0",
|
|
158
158
|
"size-limit": "11.1.4",
|
|
159
159
|
"tsc-alias": "1.8.10",
|
|
160
|
-
"typescript": "5.5.
|
|
160
|
+
"typescript": "5.5.4",
|
|
161
161
|
"use-sync-external-store": "1.2.2",
|
|
162
|
-
"vite": "5.
|
|
163
|
-
"vite-tsconfig-paths": "
|
|
164
|
-
"vitest": "
|
|
162
|
+
"vite": "5.4.0",
|
|
163
|
+
"vite-tsconfig-paths": "5.0.1",
|
|
164
|
+
"vitest": "2.0.5"
|
|
165
165
|
},
|
|
166
166
|
"volta": {
|
|
167
167
|
"node": "20.15.0",
|