Skip to content

Commit 28dec45

Browse files
fixed re-export types
1 parent 22124c7 commit 28dec45

25 files changed

+54
-62
lines changed

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@idapgroup/react-image-annotate",
3-
"version": "2.0.4",
3+
"version": "2.0.8",
44
"type": "module",
55
"main": "dist/react-image-annotate.js",
66
"types": "dist/lib.d.ts",
@@ -56,7 +56,6 @@
5656
"vite": "^5.2.7",
5757
"vite-plugin-dts": "^3.8.1",
5858
"vite-plugin-node-polyfills": "^0.21.0",
59-
"vite-raw-plugin": "^1.0.2",
6059
"vite-tsconfig-paths": "^4.3.2"
6160
},
6261
"peerDependencies": {

src/Annotator/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
import { ComponentType, FunctionComponent, useEffect, useReducer } from "react";
1010
import Immutable, { ImmutableObject } from "seamless-immutable";
1111

12-
import type { KeypointsDefinition } from "../ImageCanvas/region-tools";
12+
import type { KeypointsDefinition } from "../types/region-tools.ts";
1313
import MainLayout from "../MainLayout";
1414
import SettingsProvider from "../SettingsProvider";
1515
import combineReducers from "./reducers/combine-reducers";

src/Annotator/reducers/convert-expanding-line-to-polygon.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// @flow
22

33
import { clamp } from "../../utils/clamp";
4-
import { ExpandingLine } from "../../ImageCanvas/region-tools.tsx";
4+
import { ExpandingLine } from "../../types/region-tools.ts";
55
import Immutable from "seamless-immutable";
66

77
export default (expandingLine: ExpandingLine) => {

src/Annotator/reducers/fix-twisted.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @flow
22

3-
import { ExpandingLine } from "../../ImageCanvas/region-tools.tsx";
3+
import { ExpandingLine } from "../../types/region-tools.ts";
44

55
export default (pointsWithAngles: ExpandingLine["points"]) => {
66
// Adjacent angles should not have an angular distance of more than Math.PI

src/Annotator/reducers/general-reducer.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
// @flow
22
import { Action, Image, MainLayoutState } from "../../MainLayout/types";
3-
import {
4-
ExpandingLine,
5-
moveRegion,
6-
Region,
7-
} from "../../ImageCanvas/region-tools";
3+
import { ExpandingLine, moveRegion, Region } from "../../types/region-tools.ts";
84
import Immutable, { ImmutableObject } from "seamless-immutable";
95
import isEqual from "lodash/isEqual";
106
import getActiveImage from "./get-active-image";
@@ -986,7 +982,7 @@ export default <T extends ImmutableObject<MainLayoutState>>(
986982
case "help": {
987983
return state;
988984
}
989-
case "full-screen": {
985+
case "fullscreen": {
990986
return Immutable(state).setIn(["fullScreen"], true) as T;
991987
}
992988
case "exit fullscreen":

src/Annotator/reducers/get-implied-video-regions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @flow
22

3-
import type { Region } from "../../ImageCanvas/region-tools";
3+
import type { Region } from "../../types/region-tools.ts";
44
import { MainLayoutVideoAnnotationState } from "../../MainLayout/types.ts";
55

66
const emptyArr: Region[] = [];

src/HighlightBox/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import classnames from "classnames";
44
import { createTheme, ThemeProvider } from "@mui/material/styles";
5-
import type { Point, Region } from "../ImageCanvas/region-tools.tsx";
5+
import type { Point, Region } from "../types/region-tools.ts";
66
import { MouseEvents } from "../ImageCanvas/use-mouse.ts";
77
import { tss } from "tss-react/mui";
88

src/ImageCanvas/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import type {
1818
Point,
1919
Polygon,
2020
Region,
21-
} from "./region-tools";
21+
} from "../types/region-tools.ts";
2222
import { createTheme, ThemeProvider } from "@mui/material/styles";
2323
import PreventScrollToParents from "../PreventScrollToParents";
2424
import useWindowSize from "../hooks/use-window-size.tsx";

src/ImageCanvas/use-project-box.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @flow weak
22
import useEventCallback from "use-event-callback";
3-
import { getEnclosingBox, Region } from "./region-tools.tsx";
3+
import { getEnclosingBox, Region } from "../types/region-tools.ts";
44
import { CanvasLayoutParams } from "./index.tsx";
55
import { IMatrix } from "transformation-matrix-js";
66
import { MutableRefObject } from "react";

src/ImageMask/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { CSSProperties, useEffect, useMemo, useState } from "react";
44
import { useDebounce } from "react-use";
55
import loadImage from "./load-image";
66
import autoseg, { AutosegConfig } from "autoseg/webworker";
7-
import { Region } from "../ImageCanvas/region-tools.tsx";
7+
import { Region } from "../types/region-tools.ts";
88
import { ImagePosition } from "../types/common.ts";
99

1010
function convertToUDTRegions(regions: Region[]) {

src/MainLayout/icon-dictionary.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export const iconDictionary: Record<
7676
"create-keypoints": () => (
7777
<FontAwesomeIcon style={faStyle} size="xs" fixedWidth icon={faExpand} />
7878
),
79-
"full-screen": () => (
79+
fullscreen: () => (
8080
<FontAwesomeIcon style={faStyle} size="xs" fixedWidth icon={faExpand} />
8181
),
8282
window: () => (

src/MainLayout/index.tsx

+9-5
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,17 @@ export const MainLayout = ({
250250
dispatch({ type: "SELECT_TOOL", selectedTool: item.name });
251251
});
252252

253-
const onClickHeaderItem = useEventCallback((item) => {
254-
if (item.name === "full-screen") {
253+
const onClickHeaderItem = useEventCallback((item: { name: string }) => {
254+
const btnName = item.name.toLowerCase();
255+
if (btnName === "fullscreen") {
255256
fullScreenHandle.enter();
256-
} else if (item.name === "window") {
257+
} else if (btnName === "window") {
257258
fullScreenHandle.exit();
258259
}
259-
dispatch({ type: "HEADER_BUTTON_CLICKED", buttonName: item.name });
260+
dispatch({
261+
type: "HEADER_BUTTON_CLICKED",
262+
buttonName: btnName,
263+
});
260264
});
261265

262266
const debugModeOn = Boolean(
@@ -280,7 +284,7 @@ export const MainLayout = ({
280284
activeImage?.regions && { name: "Clone" },
281285
!hideSettings && { name: "Settings" },
282286
!hideFullScreen &&
283-
(state.fullScreen ? { name: "window" } : { name: "full-screen" }),
287+
(state.fullScreen ? { name: "Window" } : { name: "Fullscreen" }),
284288
!hideSave && { name: "Save" },
285289
].reduce((acc: { name: string }[], curr) => {
286290
if (curr) {

src/MainLayout/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type {
88
Point,
99
Polygon,
1010
Region,
11-
} from "../ImageCanvas/region-tools.tsx";
11+
} from "../types/region-tools.ts";
1212
import { AutosegOptions } from "autoseg/webworker";
1313

1414
export type AnnotatorToolEnum =

src/MainLayout/use-implied-video-regions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { useMemo } from "react";
44
import getImpliedVideoRegions from "../Annotator/reducers/get-implied-video-regions";
55
import { MainLayoutState } from "./types";
6-
import { Region } from "../ImageCanvas/region-tools.tsx";
6+
import { Region } from "../types/region-tools.ts";
77

88
const emptyArr: Region[] = [];
99

src/PointDistances/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { Fragment } from "react";
44
import { createTheme, styled, ThemeProvider } from "@mui/material/styles";
55
import { ProjectBoxFn } from "../ImageCanvas/use-project-box.ts";
6-
import { Point, Region } from "../ImageCanvas/region-tools.tsx";
6+
import { Point, Region } from "../types/region-tools.ts";
77

88
const theme = createTheme();
99
const Svg = styled("svg")(() => ({

src/RegionLabel/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { memo, useRef } from "react";
44
import Paper from "@mui/material/Paper";
55
import { createTheme, ThemeProvider } from "@mui/material/styles";
66
import classnames from "classnames";
7-
import type { Region } from "../ImageCanvas/region-tools";
7+
import type { Region } from "../types/region-tools.ts";
88
import IconButton from "@mui/material/IconButton";
99
import Button from "@mui/material/Button";
1010
import TrashIcon from "@mui/icons-material/Delete";

src/RegionSelectAndTransformBoxes/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
type Point,
1010
type Polygon,
1111
Region,
12-
} from "../ImageCanvas/region-tools.tsx";
12+
} from "../types/region-tools.ts";
1313
import { MouseEvents } from "../ImageCanvas/use-mouse.ts";
1414
import { ProjectBox, ProjectBoxFn } from "../ImageCanvas/use-project-box.ts";
1515
import { CanvasLayoutParams } from "../ImageCanvas";

src/RegionSelectorSidebarBox/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import VisibleIcon from "@mui/icons-material/Visibility";
1515
import VisibleOffIcon from "@mui/icons-material/VisibilityOff";
1616
import classnames from "classnames";
1717
import isEqual from "lodash/isEqual";
18-
import { Region } from "../ImageCanvas/region-tools.tsx";
18+
import { Region } from "../types/region-tools.ts";
1919
import { tss } from "tss-react/mui";
2020

2121
const theme = createTheme();

src/RegionShapes/index.tsx

+1-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@
33
import { memo } from "react";
44
import colorAlpha from "color-alpha";
55
import { clamp } from "../utils/clamp.ts";
6-
import {
7-
KeypointsDefinition,
8-
Line,
9-
Region,
10-
} from "../ImageCanvas/region-tools.tsx";
6+
import { KeypointsDefinition, Line, Region } from "../types/region-tools.ts";
117
import Immutable from "seamless-immutable";
128
import { ImagePosition } from "../types/common.ts";
139

src/RegionTags/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import Paper from "@mui/material/Paper";
44
import DefaultRegionLabel, { RegionLabelProps } from "../RegionLabel";
55
import LockIcon from "@mui/icons-material/Lock";
6-
import { Region } from "../ImageCanvas/region-tools.tsx";
6+
import { Region } from "../types/region-tools.ts";
77
import { ProjectBox, ProjectBoxFn } from "../ImageCanvas/use-project-box.ts";
88
import { MouseEvents } from "../ImageCanvas/use-mouse.ts";
99
import { ComponentType, FunctionComponent } from "react";

src/lib.tsx

+21-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,27 @@ import Annotator from "./Annotator";
44

55
// re-export types
66
export type { AnnotatorProps } from "./Annotator";
7-
export type { MainLayoutState, AnnotatorToolEnum } from "./MainLayout/types.ts";
7+
export type {
8+
MainLayoutState,
9+
MainLayoutImageAnnotationState,
10+
MainLayoutVideoAnnotationState,
11+
MainLayoutStateBase,
12+
AnnotatorToolEnum,
13+
} from "./MainLayout/types";
14+
15+
export type {
16+
Region,
17+
BaseRegion,
18+
Box,
19+
PixelRegion,
20+
ExpandingLine,
21+
KeypointDefinition,
22+
Keypoints,
23+
Line,
24+
Polygon,
25+
Point,
26+
KeypointsDefinition,
27+
} from "./types/region-tools";
828

929
export { Annotator };
1030

File renamed without changes.

src/utils/get-landmarks-with-transform.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// @flow
2-
import type { KeypointDefinition } from "../ImageCanvas/region-tools";
2+
import type { KeypointDefinition } from "../types/region-tools.ts";
33

44
type Parameters = {
55
center: { x: number; y: number };

vite.config.ts

-18
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,19 @@ import { defineConfig } from "vite";
22
import react from "@vitejs/plugin-react";
33
import viteTsconfigPaths from "vite-tsconfig-paths";
44
import { nodePolyfills } from "vite-plugin-node-polyfills";
5-
import markdownRawPlugin from "vite-raw-plugin";
65
import { resolve } from "path";
76
import dts from "vite-plugin-dts";
87
import peerDepsExternal from "rollup-plugin-peer-deps-external";
98

10-
const process = {
11-
env: {},
12-
versions: {
13-
node: "14.15.1", // replace with your Node.js version
14-
},
15-
};
16-
179
export default defineConfig(() => {
18-
// process.env = { ...process.env, ...loadEnv(mode, process.cwd()) }
1910
return {
20-
// depending on your application, base can also be "/"
2111
base: "./",
22-
// @ts-ignore
2312
plugins: [
2413
react(),
2514
dts(),
2615
viteTsconfigPaths(),
2716
nodePolyfills(),
2817
peerDepsExternal(),
29-
markdownRawPlugin({
30-
fileRegex: /\.md$/,
31-
}),
3218
],
3319
server: {
3420
// this ensures that the browser opens upon server start
@@ -38,17 +24,13 @@ export default defineConfig(() => {
3824
},
3925
define: {
4026
global: "globalThis",
41-
"process.env": process.env,
42-
NODE_ENV: '"development"',
43-
"process.versions.node": JSON.stringify(process.versions.node),
4427
},
4528
optimizeDeps: {
4629
esbuildOptions: {
4730
define: {
4831
global: "globalThis",
4932
},
5033
},
51-
exclude: ["react", "react-dom"],
5234
},
5335
build: {
5436
lib: {

yarn.lock

+3-8
Original file line numberDiff line numberDiff line change
@@ -1744,9 +1744,9 @@ domain-browser@^4.22.0:
17441744
integrity sha512-ArzcM/II1wCCujdCNyQjXrAFwS4mrLh4C7DZWlaI8mdh7h3BfKdNd3bKXITfl2PT9FtfQqaGvhi1vPRQPimjGA==
17451745

17461746
electron-to-chromium@^1.4.668:
1747-
version "1.4.737"
1748-
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.737.tgz#3a774a58e04980741f65d440f5fdf57af18b6dde"
1749-
integrity sha512-QvLTxaLHKdy5YxvixAw/FfHq2eWLUL9KvsPjp0aHK1gI5d3EDuDgITkvj0nFO2c6zUY3ZqVAJQiBYyQP9tQpfw==
1747+
version "1.4.738"
1748+
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.738.tgz#9a7fca98abaee61e20c9c25013d5ce60bb533436"
1749+
integrity sha512-lwKft2CLFztD+vEIpesrOtCrko/TFnEJlHFdRhazU7Y/jx5qc4cqsocfVrBg4So4gGe9lvxnbLIoev47WMpg+A==
17501750

17511751
elliptic@^6.5.3, elliptic@^6.5.5:
17521752
version "6.5.5"
@@ -4251,11 +4251,6 @@ vite-plugin-node-polyfills@^0.21.0:
42514251
"@rollup/plugin-inject" "^5.0.5"
42524252
node-stdlib-browser "^1.2.0"
42534253

4254-
vite-raw-plugin@^1.0.2:
4255-
version "1.0.2"
4256-
resolved "https://registry.yarnpkg.com/vite-raw-plugin/-/vite-raw-plugin-1.0.2.tgz#7be8a6e1275b7a0eb6753d066337957c15f438cd"
4257-
integrity sha512-gdp/OFVXBiVq1UwPujVb7+4mmgYHTGrzslMbQvxmgzTN4/HC+3j4GNrumsIKSWfA/y3hktII7XqY38muRaGjhw==
4258-
42594254
vite-tsconfig-paths@^4.3.2:
42604255
version "4.3.2"
42614256
resolved "https://registry.yarnpkg.com/vite-tsconfig-paths/-/vite-tsconfig-paths-4.3.2.tgz#321f02e4b736a90ff62f9086467faf4e2da857a9"

0 commit comments

Comments
 (0)