@itwin/saved-views-react 0.5.0 → 0.7.0
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/README.md +38 -4
- package/lib/SavedView.d.ts +41 -11
- package/lib/SavedViewTile/SavedViewOptions.js +10 -10
- package/lib/SavedViewTile/SavedViewTile.css +8 -1
- package/lib/SavedViewTile/SavedViewTile.d.ts +4 -3
- package/lib/SavedViewTile/SavedViewTile.js +5 -9
- package/lib/SavedViewTile/SavedViewTileContext.d.ts +0 -1
- package/lib/SavedViewTile/SavedViewTileContext.js +1 -1
- package/lib/SavedViewsClient/ITwinSavedViewsClient.d.ts +21 -23
- package/lib/SavedViewsClient/ITwinSavedViewsClient.js +120 -57
- package/lib/SavedViewsClient/SavedViewsClient.d.ts +68 -45
- package/lib/SavedViewsWidget/SavedViewGroupTile/SavedViewGroupTile.js +2 -3
- package/lib/SavedViewsWidget/SavedViewGroupTile/SavedViewGroupTileContext.d.ts +0 -1
- package/lib/SavedViewsWidget/SavedViewGroupTile/SavedViewGroupTileContext.js +1 -1
- package/lib/SavedViewsWidget/SavedViewsExpandableBlockWidget.d.ts +5 -3
- package/lib/SavedViewsWidget/SavedViewsExpandableBlockWidget.js +3 -3
- package/lib/SavedViewsWidget/SavedViewsFolderWidget.d.ts +5 -4
- package/lib/SavedViewsWidget/SavedViewsFolderWidget.js +7 -7
- package/lib/applySavedView.d.ts +36 -31
- package/lib/applySavedView.js +61 -26
- package/lib/captureSavedViewData.d.ts +31 -5
- package/lib/captureSavedViewData.js +103 -63
- package/lib/captureSavedViewThumbnail.d.ts +8 -1
- package/lib/captureSavedViewThumbnail.js +15 -7
- package/lib/createViewState.d.ts +22 -5
- package/lib/createViewState.js +28 -25
- package/lib/index.d.ts +10 -10
- package/lib/index.js +7 -7
- package/lib/translation/SavedViewTypes.d.ts +1 -1
- package/lib/translation/SavedViewsExtensionHandlers.d.ts +3 -0
- package/lib/translation/SavedViewsExtensionHandlers.js +14 -0
- package/lib/translation/clipVectorsLegacyExtractor.js +4 -0
- package/lib/translation/displayStyleExtractor.js +80 -3
- package/lib/translation/extractionUtilities.d.ts +9 -1
- package/lib/translation/extractionUtilities.js +16 -0
- package/lib/useSavedViews.d.ts +172 -34
- package/lib/useSavedViews.js +475 -503
- package/lib/utils.d.ts +8 -0
- package/lib/utils.js +13 -0
- package/package.json +9 -9
package/lib/utils.d.ts
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
+
import { type Dispatch, type SetStateAction } from "react";
|
|
2
|
+
export type AllOrNone<T> = {
|
|
3
|
+
[K in keyof T]-?: T[K];
|
|
4
|
+
} | {
|
|
5
|
+
[K in keyof T]?: never;
|
|
6
|
+
};
|
|
1
7
|
export declare function trimInputString(string: string): string;
|
|
8
|
+
export declare function isAbortError(error: unknown): boolean;
|
|
9
|
+
export declare function useControlledState<T>(initialValue: T, controlledState: T | undefined, setControlledState?: Dispatch<SetStateAction<T>>): [state: T, setState: Dispatch<SetStateAction<T>>];
|
package/lib/utils.js
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { useCallback, useMemo, useState } from "react";
|
|
5
6
|
export function trimInputString(string) {
|
|
6
7
|
return string.replace(/\s+/g, " ");
|
|
7
8
|
}
|
|
9
|
+
export function isAbortError(error) {
|
|
10
|
+
return error instanceof DOMException && error.name === "AbortError";
|
|
11
|
+
}
|
|
12
|
+
export function useControlledState(initialValue, controlledState, setControlledState) {
|
|
13
|
+
const [uncontrolledState, setUncontrolledState] = useState(initialValue);
|
|
14
|
+
const state = useMemo(() => (controlledState !== undefined ? controlledState : uncontrolledState), [controlledState, uncontrolledState]);
|
|
15
|
+
const setState = useCallback((value) => {
|
|
16
|
+
setUncontrolledState(value);
|
|
17
|
+
setControlledState?.(value);
|
|
18
|
+
}, [setControlledState, setUncontrolledState]);
|
|
19
|
+
return [state, setState];
|
|
20
|
+
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/saved-views-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/iTwin/saved-views.git",
|
|
8
8
|
"directory": "packages/saved-views-react"
|
|
9
9
|
},
|
|
10
|
-
"homepage": "https://github.com/iTwin/saved-views",
|
|
10
|
+
"homepage": "https://github.com/iTwin/saved-views/tree/master/packages/saved-views-react",
|
|
11
11
|
"author": {
|
|
12
12
|
"name": "Bentley Systems, Inc.",
|
|
13
13
|
"url": "https://www.bentley.com"
|
|
@@ -37,18 +37,18 @@
|
|
|
37
37
|
"@types/react": "^17.0.39",
|
|
38
38
|
"@types/recursive-readdir": "^2.2.2",
|
|
39
39
|
"@vitejs/plugin-react-swc": "^3.5.0",
|
|
40
|
-
"@vitest/coverage-v8": "^1.
|
|
40
|
+
"@vitest/coverage-v8": "^2.1.4",
|
|
41
41
|
"cpx2": "^5.0.0",
|
|
42
|
-
"happy-dom": "^
|
|
42
|
+
"happy-dom": "^15.11.4",
|
|
43
43
|
"npm-run-all": "^4.1.5",
|
|
44
44
|
"postcss-cli": "^10.1.0",
|
|
45
45
|
"postcss-modules": "^6.0.0",
|
|
46
46
|
"react": "^17.0.0",
|
|
47
47
|
"react-dom": "^17.0.0",
|
|
48
48
|
"recursive-readdir": "^2.2.3",
|
|
49
|
-
"typescript": "^5.
|
|
50
|
-
"vite": "^5.
|
|
51
|
-
"vitest": "^1.4
|
|
49
|
+
"typescript": "^5.5.4",
|
|
50
|
+
"vite": "^5.4.11",
|
|
51
|
+
"vitest": "^2.1.4"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@itwin/core-common": "^4.0.6",
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@itwin/itwinui-icons-react": "^2.
|
|
61
|
+
"@itwin/itwinui-icons-react": "^2.9.0",
|
|
62
62
|
"@itwin/itwinui-react": "^3.8.1",
|
|
63
63
|
"fuse.js": "^6.6.2",
|
|
64
|
-
"@itwin/saved-views-client": "^0.
|
|
64
|
+
"@itwin/saved-views-client": "^0.4.0"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "run-p build:*",
|