@zzalai/leafer-multi-roi 1.0.1 → 1.0.3
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/leafer-multi-roi.css +2 -0
- package/dist/leafer-multi-roi.es.js +1 -0
- package/dist/leafer-multi-roi.umd.js +1 -0
- package/dist/src/App.vue.d.ts +3 -0
- package/dist/src/components/RoiEditor.vue.d.ts +98 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/main.d.ts +1 -0
- package/dist/src/types/index.d.ts +33 -0
- package/dist/src/utils/coordinates.d.ts +5 -0
- package/dist/src/utils/icons.d.ts +1 -0
- package/dist/src/utils/uuid.d.ts +1 -0
- package/package.json +61 -60
- package/vite.config.ts +6 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Window {
|
|
3
|
+
__roiEditorHotkeysUnsubscribe?: () => void;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
export interface ImageSource {
|
|
7
|
+
id?: string;
|
|
8
|
+
url: string;
|
|
9
|
+
}
|
|
10
|
+
export interface OptionsSource {
|
|
11
|
+
regionStyle?: {
|
|
12
|
+
fill: string;
|
|
13
|
+
stroke: string;
|
|
14
|
+
strokeWidth: number;
|
|
15
|
+
};
|
|
16
|
+
selectedRegionStyle?: {
|
|
17
|
+
fill: string;
|
|
18
|
+
stroke: string;
|
|
19
|
+
strokeWidth?: number;
|
|
20
|
+
};
|
|
21
|
+
maxRegions?: number;
|
|
22
|
+
maxUndoSteps?: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 获取 ROI 坐标
|
|
26
|
+
*/
|
|
27
|
+
interface ROIAnnotation {
|
|
28
|
+
id: string;
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
points: {
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
}[];
|
|
37
|
+
normalized: {
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
width: number;
|
|
41
|
+
height: number;
|
|
42
|
+
points: {
|
|
43
|
+
x: number;
|
|
44
|
+
y: number;
|
|
45
|
+
}[];
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
interface ImportCanvasOptions {
|
|
49
|
+
resetZoom?: boolean;
|
|
50
|
+
}
|
|
51
|
+
declare const __VLS_export: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
52
|
+
imageSource: {
|
|
53
|
+
type: () => ImageSource;
|
|
54
|
+
required: true;
|
|
55
|
+
};
|
|
56
|
+
options: {
|
|
57
|
+
type: () => OptionsSource;
|
|
58
|
+
default: () => {};
|
|
59
|
+
};
|
|
60
|
+
}>, {
|
|
61
|
+
getROIAnnotations: () => ROIAnnotation[];
|
|
62
|
+
getImageInfo: () => {
|
|
63
|
+
id: string | undefined;
|
|
64
|
+
url: string;
|
|
65
|
+
width: number | null;
|
|
66
|
+
height: number | null;
|
|
67
|
+
};
|
|
68
|
+
exportCanvasJSON: () => string;
|
|
69
|
+
importCanvasJSON: (jsonString: string, options?: ImportCanvasOptions) => Promise<boolean>;
|
|
70
|
+
loadImage: (imageSrc?: string | undefined) => Promise<void>;
|
|
71
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
72
|
+
roiChange: (...args: any[]) => void;
|
|
73
|
+
loadStart: (...args: any[]) => void;
|
|
74
|
+
loadSuccess: (...args: any[]) => void;
|
|
75
|
+
loadError: (...args: any[]) => void;
|
|
76
|
+
undoStateChange: (...args: any[]) => void;
|
|
77
|
+
redoStateChange: (...args: any[]) => void;
|
|
78
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
79
|
+
imageSource: {
|
|
80
|
+
type: () => ImageSource;
|
|
81
|
+
required: true;
|
|
82
|
+
};
|
|
83
|
+
options: {
|
|
84
|
+
type: () => OptionsSource;
|
|
85
|
+
default: () => {};
|
|
86
|
+
};
|
|
87
|
+
}>> & Readonly<{
|
|
88
|
+
onRoiChange?: ((...args: any[]) => any) | undefined;
|
|
89
|
+
onLoadStart?: ((...args: any[]) => any) | undefined;
|
|
90
|
+
onLoadSuccess?: ((...args: any[]) => any) | undefined;
|
|
91
|
+
onLoadError?: ((...args: any[]) => any) | undefined;
|
|
92
|
+
onUndoStateChange?: ((...args: any[]) => any) | undefined;
|
|
93
|
+
onRedoStateChange?: ((...args: any[]) => any) | undefined;
|
|
94
|
+
}>, {
|
|
95
|
+
options: OptionsSource;
|
|
96
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
97
|
+
declare const _default: typeof __VLS_export;
|
|
98
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface ROI {
|
|
2
|
+
id: string;
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
export interface Point {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
}
|
|
12
|
+
export type RegionCoordinates = [Point, Point, Point, Point];
|
|
13
|
+
export type NormalizedPoint = [number, number];
|
|
14
|
+
export type NormalizedRegion = [NormalizedPoint, NormalizedPoint, NormalizedPoint, NormalizedPoint];
|
|
15
|
+
export interface ROIAnnotation {
|
|
16
|
+
id: string;
|
|
17
|
+
coordinates: RegionCoordinates;
|
|
18
|
+
normalizedCoordinates: NormalizedRegion;
|
|
19
|
+
}
|
|
20
|
+
export interface RoiEditorOptions {
|
|
21
|
+
regionStyle?: {
|
|
22
|
+
fillColor?: string;
|
|
23
|
+
strokeColor?: string;
|
|
24
|
+
strokeWidth?: number;
|
|
25
|
+
};
|
|
26
|
+
selectedRegionStyle?: {
|
|
27
|
+
fillColor?: string;
|
|
28
|
+
strokeColor?: string;
|
|
29
|
+
strokeWidth?: number;
|
|
30
|
+
};
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
}
|
|
33
|
+
export type ImageLoadStatus = 'idle' | 'loading' | 'success' | 'error';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Point, NormalizedPoint, RegionCoordinates, NormalizedRegion } from '../types';
|
|
2
|
+
export declare function getNormalizedCoordinates(point: Point, imageWidth: number, imageHeight: number): NormalizedPoint;
|
|
3
|
+
export declare function getNormalizedRegionCoordinates(region: RegionCoordinates, imageWidth: number, imageHeight: number): NormalizedRegion;
|
|
4
|
+
export declare function getOriginalCoordinates(normalizedPoint: NormalizedPoint, imageWidth: number, imageHeight: number): Point;
|
|
5
|
+
export declare function rectToRegionCoordinates(x: number, y: number, width: number, height: number): RegionCoordinates;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getSvgIcon(iconName: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function generateUUID(): string;
|
package/package.json
CHANGED
|
@@ -1,61 +1,62 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@zzalai/leafer-multi-roi",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Vue3 component for multi-region selection on images using LeaferJS",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"publishConfig": {
|
|
7
|
-
"access": "public"
|
|
8
|
-
},
|
|
9
|
-
"main": "./dist/leafer-multi-roi.umd.js",
|
|
10
|
-
"module": "./dist/leafer-multi-roi.es.js",
|
|
11
|
-
"types": "./dist/index.d.ts",
|
|
12
|
-
"exports": {
|
|
13
|
-
".": {
|
|
14
|
-
"import": "./dist/leafer-multi-roi.es.js",
|
|
15
|
-
"require": "./dist/leafer-multi-roi.umd.js",
|
|
16
|
-
"types": "./dist/index.d.ts"
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"scripts": {
|
|
20
|
-
"dev": "vite",
|
|
21
|
-
"build": "vite build",
|
|
22
|
-
"preview": "vite preview",
|
|
23
|
-
"type-check": "tsc --noEmit",
|
|
24
|
-
"docs:build": "vite build --config vite.docs.config.ts"
|
|
25
|
-
},
|
|
26
|
-
"keywords": [
|
|
27
|
-
"vue3",
|
|
28
|
-
"leaferjs",
|
|
29
|
-
"roi",
|
|
30
|
-
"annotation",
|
|
31
|
-
"image-processing"
|
|
32
|
-
],
|
|
33
|
-
"author": "zzalai",
|
|
34
|
-
"license": "MIT",
|
|
35
|
-
"repository": {
|
|
36
|
-
"type": "git",
|
|
37
|
-
"url": "https://github.com/otaku1951/leafer-multi-roi.git"
|
|
38
|
-
},
|
|
39
|
-
"homepage": "https://otaku1951.github.io/leafer-multi-roi/",
|
|
40
|
-
"packageManager": "pnpm@10.33.0",
|
|
41
|
-
"peerDependencies": {
|
|
42
|
-
"vue": "^3.3.0"
|
|
43
|
-
},
|
|
44
|
-
"dependencies": {
|
|
45
|
-
"@leafer-in/editor": "^2.0
|
|
46
|
-
"@leafer-in/resize": "^2.0
|
|
47
|
-
"@leafer-in/view": "^2.0
|
|
48
|
-
"@leafer-in/viewport": "^2.0
|
|
49
|
-
"@zzalai/leafer-undo-redo": "1.0.3",
|
|
50
|
-
"leafer-ui": "^2.0
|
|
51
|
-
"tinykeys": "^
|
|
52
|
-
},
|
|
53
|
-
"devDependencies": {
|
|
54
|
-
"@types/node": "^25.
|
|
55
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"vite
|
|
60
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@zzalai/leafer-multi-roi",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "Vue3 component for multi-region selection on images using LeaferJS",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/leafer-multi-roi.umd.js",
|
|
10
|
+
"module": "./dist/leafer-multi-roi.es.js",
|
|
11
|
+
"types": "./dist/src/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/leafer-multi-roi.es.js",
|
|
15
|
+
"require": "./dist/leafer-multi-roi.umd.js",
|
|
16
|
+
"types": "./dist/src/index.d.ts"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"dev": "vite",
|
|
21
|
+
"build": "vite build",
|
|
22
|
+
"preview": "vite preview",
|
|
23
|
+
"type-check": "tsc --noEmit",
|
|
24
|
+
"docs:build": "vite build --config vite.docs.config.ts"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"vue3",
|
|
28
|
+
"leaferjs",
|
|
29
|
+
"roi",
|
|
30
|
+
"annotation",
|
|
31
|
+
"image-processing"
|
|
32
|
+
],
|
|
33
|
+
"author": "zzalai",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/otaku1951/leafer-multi-roi.git"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://otaku1951.github.io/leafer-multi-roi/",
|
|
40
|
+
"packageManager": "pnpm@10.33.0",
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"vue": "^3.3.0"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@leafer-in/editor": "^2.1.0",
|
|
46
|
+
"@leafer-in/resize": "^2.1.0",
|
|
47
|
+
"@leafer-in/view": "^2.1.0",
|
|
48
|
+
"@leafer-in/viewport": "^2.1.0",
|
|
49
|
+
"@zzalai/leafer-undo-redo": "1.0.3",
|
|
50
|
+
"leafer-ui": "^2.1.0",
|
|
51
|
+
"tinykeys": "^4.0.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/node": "^25.9.1",
|
|
55
|
+
"@vitejs/plugin-vue": "^6.0.7",
|
|
56
|
+
"@vue/language-core": "^3.3.1",
|
|
57
|
+
"terser": "^5.48.0",
|
|
58
|
+
"typescript": "^6.0.3",
|
|
59
|
+
"vite": "^8.0.14",
|
|
60
|
+
"vite-plugin-dts": "^5.0.1"
|
|
61
|
+
}
|
|
61
62
|
}
|
package/vite.config.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { defineConfig } from 'vite'
|
|
2
2
|
import vue from '@vitejs/plugin-vue'
|
|
3
3
|
import dts from 'vite-plugin-dts'
|
|
4
|
+
import path from 'path'
|
|
4
5
|
|
|
5
6
|
// https://vite.dev/config/
|
|
6
7
|
export default defineConfig({
|
|
7
8
|
plugins: [
|
|
8
9
|
vue(),
|
|
9
10
|
// 只在生产构建时生成类型声明
|
|
10
|
-
process.env.NODE_ENV === 'production' ? dts(
|
|
11
|
+
process.env.NODE_ENV === 'production' ? dts({
|
|
12
|
+
outDirs: 'dist',
|
|
13
|
+
include: ['src/**/*.ts', 'src/**/*.vue'],
|
|
14
|
+
exclude: ['src/**/*.spec.ts', 'src/**/*.test.ts'],
|
|
15
|
+
}) : null
|
|
11
16
|
].filter(Boolean),
|
|
12
17
|
build: {
|
|
13
18
|
lib: {
|