@glodon-aiot/dataset-annotation 3.14.0-alpha.33 → 3.15.0-alpha.2

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.
Files changed (119) hide show
  1. package/dist/es/DatasetContext/index.mjs +3 -6
  2. package/dist/es/components/DetectionAnnotation/components/ImageDetail/index.mjs +91 -94
  3. package/dist/es/components/DetectionAnnotation/components/LabelMaker/Drawable.mjs +28 -37
  4. package/dist/es/components/DetectionAnnotation/components/LabelMaker/RectLabel.mjs +101 -145
  5. package/dist/es/components/DetectionAnnotation/components/LabelMaker/index.mjs +195 -256
  6. package/dist/es/components/DetectionAnnotation/index.mjs +424 -456
  7. package/dist/es/components/Iconfont/index.mjs +2 -2
  8. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/index.mjs +1 -1
  9. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/index.mjs +1 -1
  10. package/dist/es/components/OcrAnnotation/OcrModal/index.mjs +45 -43
  11. package/dist/es/components/PicZipImportModal/index.mjs +293 -308
  12. package/dist/es/components/PreLabelOCR/index.mjs +1 -1
  13. package/dist/es/constant.mjs +3 -3
  14. package/dist/es/featuresConfig.mjs +9 -13
  15. package/dist/es/index.mjs +7 -11
  16. package/dist/lib/index.js +3 -4
  17. package/dist/src/DatasetContext/index.d.ts +0 -2
  18. package/dist/src/components/DetectionAnnotation/components/ImageDetail/index.d.ts +0 -1
  19. package/dist/src/constant.d.ts +1 -1
  20. package/dist/src/featuresConfig.d.ts +0 -4
  21. package/dist/src/index.d.ts +0 -3
  22. package/package.json +2 -2
  23. package/dist/es/components/DetectionAnnotation/components/ImageModal/index.mjs +0 -129
  24. package/dist/es/components/DetectionAnnotation/components/ImageModal/style.less.mjs +0 -4
  25. package/dist/es/components/PicZipImportModal/config.mjs +0 -47
  26. package/dist/es/components/PicZipImportModal/pic_vlm_json_zip.svg.mjs +0 -4
  27. package/dist/es/components/PicZipImportModal/pic_vlm_zip.svg.mjs +0 -4
  28. package/dist/es/components/VLMAnnotation/RegionItem.mjs +0 -170
  29. package/dist/es/components/VLMAnnotation/TextAnnotationPanel.mjs +0 -94
  30. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useAIButtonHover.mjs +0 -193
  31. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasDrag.mjs +0 -116
  32. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasSetup.mjs +0 -115
  33. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasZoom.mjs +0 -42
  34. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCropRegionImage.mjs +0 -55
  35. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteControl.mjs +0 -51
  36. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteRegion.mjs +0 -62
  37. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.mjs +0 -484
  38. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRControl.mjs +0 -100
  39. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRLoadingIcon.mjs +0 -106
  40. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRRecognition.mjs +0 -101
  41. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionBoundaryCheck.mjs +0 -103
  42. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionHover.mjs +0 -38
  43. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionLoader.mjs +0 -173
  44. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionNameText.mjs +0 -72
  45. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.mjs +0 -218
  46. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionUpdate.mjs +0 -98
  47. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useTextLayouts.mjs +0 -156
  48. package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/ai.svg.mjs +0 -4
  49. package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/del.png.mjs +0 -4
  50. package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/error.svg.mjs +0 -4
  51. package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/loading.svg.mjs +0 -4
  52. package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/star.svg.mjs +0 -4
  53. package/dist/es/components/VLMAnnotation/VLMLabelMaker/index.mjs +0 -678
  54. package/dist/es/components/VLMAnnotation/VLMLabelMaker/style.less.mjs +0 -4
  55. package/dist/es/components/VLMAnnotation/VLMLabelMaker/utils/coordinateUtils.mjs +0 -33
  56. package/dist/es/components/VLMAnnotation/components/AIErrorTooltip/AIErrorTooltip.less.mjs +0 -4
  57. package/dist/es/components/VLMAnnotation/components/AIErrorTooltip/index.mjs +0 -24
  58. package/dist/es/components/VLMAnnotation/components/DragButton.mjs +0 -18
  59. package/dist/es/components/VLMAnnotation/components/FitToScreenButton.mjs +0 -16
  60. package/dist/es/components/VLMAnnotation/components/RectangleButton.mjs +0 -30
  61. package/dist/es/components/VLMAnnotation/components/Toolbar.mjs +0 -40
  62. package/dist/es/components/VLMAnnotation/components/ZoomControls.mjs +0 -44
  63. package/dist/es/components/VLMAnnotation/constants.mjs +0 -57
  64. package/dist/es/components/VLMAnnotation/index.mjs +0 -279
  65. package/dist/es/components/VLMAnnotation/style.less.mjs +0 -4
  66. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/index.mjs +0 -343
  67. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/style.less.mjs +0 -4
  68. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.mjs +0 -240
  69. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/index.mjs +0 -201
  70. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/style.less.mjs +0 -4
  71. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/index.mjs +0 -455
  72. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/style.less.mjs +0 -4
  73. package/dist/es/components/VLMAnnotationDetail/VlmModal/index.mjs +0 -149
  74. package/dist/es/components/VLMAnnotationDetail/VlmModal/style.less.mjs +0 -4
  75. package/dist/es/components/VLMAnnotationDetail/index.mjs +0 -449
  76. package/dist/es/components/VLMAnnotationDetail/style.less.mjs +0 -4
  77. package/dist/es/createVlmtasetAnnotation/index.mjs +0 -131
  78. package/dist/src/components/DetectionAnnotation/components/ImageModal/index.d.ts +0 -34
  79. package/dist/src/components/Iconfont/font_4439177_tgvowh6bmlb.d.ts +0 -0
  80. package/dist/src/components/PicZipImportModal/config.d.ts +0 -23
  81. package/dist/src/components/VLMAnnotation/ImageAnnotationDebugger.d.ts +0 -4
  82. package/dist/src/components/VLMAnnotation/RegionItem.d.ts +0 -4
  83. package/dist/src/components/VLMAnnotation/TextAnnotationPanel.d.ts +0 -4
  84. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useAIButtonHover.d.ts +0 -16
  85. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasDrag.d.ts +0 -13
  86. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasSetup.d.ts +0 -38
  87. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasZoom.d.ts +0 -18
  88. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCropRegionImage.d.ts +0 -7
  89. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteControl.d.ts +0 -13
  90. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteRegion.d.ts +0 -22
  91. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.d.ts +0 -35
  92. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRControl.d.ts +0 -16
  93. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRLoadingIcon.d.ts +0 -11
  94. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRRecognition.d.ts +0 -29
  95. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionBoundaryCheck.d.ts +0 -31
  96. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionHover.d.ts +0 -13
  97. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionLoader.d.ts +0 -41
  98. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionNameText.d.ts +0 -12
  99. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.d.ts +0 -16
  100. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionUpdate.d.ts +0 -32
  101. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useTextLayouts.d.ts +0 -25
  102. package/dist/src/components/VLMAnnotation/VLMLabelMaker/index.d.ts +0 -4
  103. package/dist/src/components/VLMAnnotation/VLMLabelMaker/utils/coordinateUtils.d.ts +0 -32
  104. package/dist/src/components/VLMAnnotation/components/AIErrorTooltip/index.d.ts +0 -8
  105. package/dist/src/components/VLMAnnotation/components/DragButton.d.ts +0 -7
  106. package/dist/src/components/VLMAnnotation/components/FitToScreenButton.d.ts +0 -6
  107. package/dist/src/components/VLMAnnotation/components/RectangleButton.d.ts +0 -7
  108. package/dist/src/components/VLMAnnotation/components/Toolbar.d.ts +0 -4
  109. package/dist/src/components/VLMAnnotation/components/ZoomControls.d.ts +0 -4
  110. package/dist/src/components/VLMAnnotation/constants.d.ts +0 -113
  111. package/dist/src/components/VLMAnnotation/index.d.ts +0 -6
  112. package/dist/src/components/VLMAnnotation/types.d.ts +0 -187
  113. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/index.d.ts +0 -14
  114. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.d.ts +0 -12
  115. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/index.d.ts +0 -12
  116. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/index.d.ts +0 -12
  117. package/dist/src/components/VLMAnnotationDetail/VlmModal/index.d.ts +0 -17
  118. package/dist/src/components/VLMAnnotationDetail/index.d.ts +0 -6
  119. package/dist/src/createVlmtasetAnnotation/index.d.ts +0 -16
@@ -1,131 +0,0 @@
1
- var H = Object.defineProperty, L = Object.defineProperties;
2
- var O = Object.getOwnPropertyDescriptors;
3
- var c = Object.getOwnPropertySymbols;
4
- var g = Object.prototype.hasOwnProperty, T = Object.prototype.propertyIsEnumerable;
5
- var v = (e, r, o) => r in e ? H(e, r, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[r] = o, s = (e, r) => {
6
- for (var o in r || (r = {}))
7
- g.call(r, o) && v(e, o, r[o]);
8
- if (c)
9
- for (var o of c(r))
10
- T.call(r, o) && v(e, o, r[o]);
11
- return e;
12
- }, A = (e, r) => L(e, O(r));
13
- var k = (e, r) => {
14
- var o = {};
15
- for (var t in e)
16
- g.call(e, t) && r.indexOf(t) < 0 && (o[t] = e[t]);
17
- if (e != null && c)
18
- for (var t of c(e))
19
- r.indexOf(t) < 0 && T.call(e, t) && (o[t] = e[t]);
20
- return o;
21
- };
22
- import { jsx as y } from "react/jsx-runtime";
23
- import B from "react-dom";
24
- import { defaultApiUrl as V } from "../constant.mjs";
25
- import $ from "../components/VLMAnnotationDetail/index.mjs";
26
- import { CVForceDatahubApi as j, ModelServiceApi as z } from "@glodon-aiot/apis";
27
- import { isExpired as G } from "../utils/index.mjs";
28
- import { notification as h } from "antd";
29
- import N from "axios";
30
- import W from "lodash/merge";
31
- import { VIEW_MODE_FEATURES as J, LABEL_MODE_FEATURES as K, MANAGE_MODE_FEATURES as P } from "../featuresConfig.mjs";
32
- function Q(e) {
33
- switch (e) {
34
- case "manage":
35
- return s({}, P);
36
- case "label":
37
- return s({}, K);
38
- case "view":
39
- return s({}, J);
40
- default:
41
- return null;
42
- }
43
- }
44
- const ce = (e) => {
45
- const l = e, {
46
- getContainer: r = () => document.createElement("div"),
47
- token: o,
48
- errorHandlers: t,
49
- apiUrl: f = V,
50
- datasetId: S,
51
- versionId: D,
52
- mode: M = "label"
53
- } = l, b = k(l, [
54
- "getContainer",
55
- "token",
56
- "errorHandlers",
57
- "apiUrl",
58
- "datasetId",
59
- "versionId",
60
- "mode"
61
- ]), u = s({}, Q(M));
62
- W(u, b);
63
- const I = r(), w = (() => {
64
- const x = f, U = (n) => {
65
- var a;
66
- if (!o)
67
- return n;
68
- if (G(o)) {
69
- const i = "aiotToken is timeout";
70
- t.aiotToken ? typeof t.aiotToken == "function" ? t.aiotToken(
71
- // @ts-ignore
72
- new Error(i, {
73
- cause: {
74
- status: 401,
75
- message: i
76
- }
77
- })
78
- ) : console.error("errorHandlers.aiotToken is not a function") : console.error(i);
79
- }
80
- return n.headers = (a = n.headers) != null ? a : {}, n.headers = A(s({}, n.headers), {
81
- Authorization: o ? `Bearer ${o}` : ""
82
- }), n;
83
- };
84
- function m(n, a = !0) {
85
- const i = `${x}${n}`, E = N.create({
86
- baseURL: i
87
- });
88
- return a && E.interceptors.request.use(U), E;
89
- }
90
- const d = (n, a) => {
91
- n !== 10001 && n !== 10215 && (h.config({
92
- getContainer: r
93
- }), h.error({
94
- message: a
95
- }));
96
- }, p = (n, a) => {
97
- if (n === 401) {
98
- const i = "aiotToken is invalid";
99
- t.aiotToken ? typeof t.aiotToken == "function" ? t.aiotToken(
100
- // @ts-ignore
101
- new Error(i, {
102
- cause: {
103
- status: 401,
104
- message: i
105
- }
106
- })
107
- ) : console.error("errorHandlers.aiotToken is not a function") : console.error(i);
108
- }
109
- }, _ = m("/datahub/v1"), C = new j(_, {
110
- onHttpStatusError: p,
111
- onAppStatusError: d
112
- }), R = m("/mlopsdeploy/v1"), F = new z(R, {
113
- onHttpStatusError: p,
114
- onAppStatusError: d
115
- });
116
- return {
117
- cvforceDatahub: C,
118
- cvforceModelService: F
119
- };
120
- })();
121
- B.render(/* @__PURE__ */ y($, s({
122
- services: w,
123
- datasetId: S,
124
- versionId: D,
125
- token: o,
126
- apiUrl: f
127
- }, u)), I);
128
- };
129
- export {
130
- ce as default
131
- };
@@ -1,34 +0,0 @@
1
- import { default as React, Dispatch, SetStateAction } from 'react';
2
- import { TabsProps } from 'antd';
3
- import { ILabel, ISample } from '@glodon-aiot/apis';
4
- import { LabelItem } from '../../../DetectionImageAnnotation';
5
- interface ImageDetailProps {
6
- datasetId: string;
7
- isImageDetailVisible: boolean;
8
- setIsImageDetailVisible: Dispatch<SetStateAction<boolean>>;
9
- currentSample?: ISample;
10
- onNextClick?: VoidFunction;
11
- onPrevClick?: VoidFunction;
12
- onSave?: VoidFunction;
13
- onDeleteSample?: VoidFunction;
14
- labels?: ILabel[];
15
- onRefresh?: VoidFunction;
16
- onChange?: (sample: ISample) => void;
17
- isPreLabel?: boolean;
18
- settingHide?: boolean;
19
- imgCount?: {
20
- total: number;
21
- index: number;
22
- };
23
- showLabelList?: boolean | ILabel[];
24
- renderLabelItem?: (label: LabelItem) => string;
25
- onEnterEdit?: VoidFunction;
26
- filterItems?: TabsProps['items'];
27
- filterMode?: string;
28
- onFilterChange?: (key: string) => void;
29
- previewMode?: boolean;
30
- canLabel?: boolean;
31
- canDelete?: boolean;
32
- }
33
- declare const ImageModal: React.FC<ImageDetailProps>;
34
- export default ImageModal;
@@ -1,23 +0,0 @@
1
- export interface ImportConfig {
2
- maxImageSize: number;
3
- imageMimeTypes: string[];
4
- imageAccept: string;
5
- imageFormatsText: string;
6
- labeledExampleKey: string;
7
- unlabeledExampleKey: string;
8
- labelFormat?: 'json' | 'jsonl';
9
- zipUploadTexts: {
10
- labeled: {
11
- description: string[];
12
- };
13
- unlabeled: {
14
- description: string[];
15
- };
16
- };
17
- }
18
- /**
19
- * 根据数据集类型获取导入配置
20
- * @param markType 标注类型
21
- * @returns 导入配置
22
- */
23
- export declare const getImportConfig: (markType?: string) => ImportConfig;
@@ -1,4 +0,0 @@
1
- import { default as React } from 'react';
2
- import { ImageAnnotationDebuggerProps } from './types';
3
- declare const ImageAnnotationDebugger: React.FC<ImageAnnotationDebuggerProps>;
4
- export default ImageAnnotationDebugger;
@@ -1,4 +0,0 @@
1
- import { default as React } from 'react';
2
- import { RegionItemProps } from './types';
3
- declare const RegionItem: React.FC<RegionItemProps>;
4
- export default RegionItem;
@@ -1,4 +0,0 @@
1
- import { default as React } from 'react';
2
- import { TextAnnotationPanelProps } from './types';
3
- declare const TextAnnotationPanel: React.FC<TextAnnotationPanelProps>;
4
- export default TextAnnotationPanel;
@@ -1,16 +0,0 @@
1
- import { fabric } from 'fabric';
2
- interface UseAIButtonHoverParams {
3
- canvas: fabric.Canvas | undefined;
4
- ocrErrorRef: React.MutableRefObject<Set<string>>;
5
- rectMapRef: React.MutableRefObject<Map<fabric.Rect, any>>;
6
- onAIButtonHover?: (regionId: string | null, position: {
7
- x: number;
8
- y: number;
9
- } | null) => void;
10
- }
11
- /**
12
- * Hook for detecting hover on AI button
13
- * @param params - AI button hover configuration parameters
14
- */
15
- export declare const useAIButtonHover: ({ canvas, ocrErrorRef, rectMapRef, onAIButtonHover, }: UseAIButtonHoverParams) => void;
16
- export {};
@@ -1,13 +0,0 @@
1
- import { fabric } from 'fabric';
2
- interface UseCanvasDragParams {
3
- canvas: fabric.Canvas | undefined;
4
- draggable: boolean;
5
- drawingMode: boolean;
6
- textLayersMapRef: React.MutableRefObject<Map<fabric.Rect, fabric.Rect[]>>;
7
- }
8
- /**
9
- * Hook for managing canvas drag functionality
10
- * @param params - Canvas drag configuration parameters
11
- */
12
- export declare const useCanvasDrag: ({ canvas, draggable, drawingMode, textLayersMapRef, }: UseCanvasDragParams) => void;
13
- export {};
@@ -1,38 +0,0 @@
1
- import { fabric } from 'fabric';
2
- import { VLMSample, Region } from '../../types';
3
- interface UseCanvasSetupParams {
4
- sample: VLMSample | undefined;
5
- image: fabric.Image | undefined;
6
- onImageLoad?: VoidFunction;
7
- canvasRef: React.MutableRefObject<HTMLCanvasElement | null>;
8
- containerRef: React.MutableRefObject<HTMLDivElement | null>;
9
- canvasInitializedRef: React.MutableRefObject<boolean>;
10
- bgImagePositionRef: React.MutableRefObject<{
11
- left: number;
12
- top: number;
13
- }>;
14
- bgImageSizeRef: React.MutableRefObject<{
15
- width: number;
16
- height: number;
17
- }>;
18
- rectMapRef: React.MutableRefObject<Map<fabric.Rect, Region>>;
19
- updateTextLayersRef: React.MutableRefObject<((rect: fabric.Rect, region: Region) => void) | null>;
20
- onRectPositionUpdated?: (scale: number) => void;
21
- setCanvas: React.Dispatch<React.SetStateAction<fabric.Canvas | undefined>>;
22
- setImage: React.Dispatch<React.SetStateAction<fabric.Image | undefined>>;
23
- setScale: React.Dispatch<React.SetStateAction<number>>;
24
- setBgImagePosition: React.Dispatch<React.SetStateAction<{
25
- left: number;
26
- top: number;
27
- }>>;
28
- setLoading: React.Dispatch<React.SetStateAction<boolean>>;
29
- }
30
- /**
31
- * Hook for canvas setup and image initialization
32
- * @param params - Canvas setup configuration parameters
33
- * @returns updateCanvas function to update canvas and image positioning
34
- */
35
- export declare const useCanvasSetup: ({ sample, image, onImageLoad, canvasRef, containerRef, canvasInitializedRef, bgImagePositionRef, bgImageSizeRef, rectMapRef, updateTextLayersRef, onRectPositionUpdated, setCanvas, setImage, setScale, setBgImagePosition, setLoading, }: UseCanvasSetupParams) => {
36
- updateCanvas: () => void;
37
- };
38
- export {};
@@ -1,18 +0,0 @@
1
- import { fabric } from 'fabric';
2
- interface UseCanvasZoomParams {
3
- canvas: fabric.Canvas | undefined;
4
- setScale: React.Dispatch<React.SetStateAction<number>>;
5
- isZoomingRef: React.MutableRefObject<boolean>;
6
- }
7
- /**
8
- * Hook for managing canvas zoom functionality
9
- * @param params - Canvas zoom configuration parameters
10
- * @returns zoom function
11
- */
12
- export declare const useCanvasZoom: ({ canvas, setScale, isZoomingRef, }: UseCanvasZoomParams) => {
13
- zoom: (delta: number, point?: {
14
- x: number;
15
- y: number;
16
- }) => void;
17
- };
18
- export {};
@@ -1,7 +0,0 @@
1
- import { Region } from '../../types';
2
- /**
3
- * Hook for cropping region image from the original image
4
- * @param imageUrl - URL of the original image
5
- * @returns Function to crop region image and return base64 string
6
- */
7
- export declare const useCropRegionImage: (imageUrl: string | undefined) => (region: Region) => Promise<string | undefined>;
@@ -1,13 +0,0 @@
1
- import { fabric } from 'fabric';
2
- interface UseDeleteControlParams {
3
- performDelete: (targetRect: fabric.Rect) => void;
4
- }
5
- /**
6
- * Hook for creating delete control
7
- * @param params - Delete control configuration parameters
8
- * @returns createDeleteControl function
9
- */
10
- export declare const useDeleteControl: ({ performDelete, }: UseDeleteControlParams) => {
11
- createDeleteControl: () => fabric.Control;
12
- };
13
- export {};
@@ -1,22 +0,0 @@
1
- import { fabric } from 'fabric';
2
- import { Region } from '../../types';
3
- interface UseDeleteRegionParams {
4
- canvas: fabric.Canvas | undefined;
5
- onRegionChange?: (region: Region | null, action: 'create' | 'update' | 'delete') => void;
6
- updateRegionNames: () => void;
7
- rectMapRef: React.MutableRefObject<Map<fabric.Rect, Region>>;
8
- textLayersMapRef: React.MutableRefObject<Map<fabric.Rect, fabric.Rect[]>>;
9
- textLayoutContentMapRef: React.MutableRefObject<Map<fabric.Rect, string>>;
10
- regionNameTextMapRef: React.MutableRefObject<Map<fabric.Rect, fabric.Text>>;
11
- ocrLoadingIconMapRef: React.MutableRefObject<Map<fabric.Rect, fabric.Group>>;
12
- }
13
- /**
14
- * Hook for managing region deletion functionality
15
- * @param params - Delete region configuration parameters
16
- * @returns performDelete function
17
- */
18
- export declare const useDeleteRegion: ({ canvas, onRegionChange, updateRegionNames, rectMapRef, textLayersMapRef, textLayoutContentMapRef, regionNameTextMapRef, ocrLoadingIconMapRef, }: UseDeleteRegionParams) => {
19
- performDelete: (targetRect: fabric.Rect) => void;
20
- deleteDirectly: (targetRect: fabric.Rect) => void;
21
- };
22
- export {};
@@ -1,35 +0,0 @@
1
- import { fabric } from 'fabric';
2
- import { Region, VLMLabel } from '../../types';
3
- interface UseDrawingModeParams {
4
- canvas: fabric.Canvas | undefined;
5
- drawingMode: boolean;
6
- draggable: boolean;
7
- setDrawingMode: (mode: boolean) => void;
8
- canvasToImageCoords: (canvasX: number, canvasY: number) => {
9
- x: number;
10
- y: number;
11
- };
12
- labelDefinitions?: VLMLabel[];
13
- onChange?: (labels: Region[]) => void;
14
- cropRegionImage: (region: Region) => Promise<string | undefined>;
15
- updateRegionShapeAndImage: (rect: fabric.Rect) => void;
16
- performOCRIfNeeded: (region: Region, action: 'create' | 'update') => Promise<void>;
17
- createDeleteControl: () => fabric.Control;
18
- createOCRControl: () => fabric.Control;
19
- updateRegionNameText: (rect: fabric.Rect, region: Region) => void;
20
- onRegionChange?: (region: Region | null, action: 'create' | 'update' | 'delete') => void;
21
- onRegionSelect?: (region: Region | null) => void;
22
- rectMapRef: React.MutableRefObject<Map<fabric.Rect, Region>>;
23
- textLayersMapRef: React.MutableRefObject<Map<fabric.Rect, fabric.Rect[]>>;
24
- regionNameTextMapRef: React.MutableRefObject<Map<fabric.Rect, fabric.Text>>;
25
- setupBoundaryCheck: (rect: fabric.Rect) => (() => void) | undefined;
26
- }
27
- /**
28
- * Hook for managing drawing mode (rectangle drawing functionality)
29
- * @param params - Drawing mode configuration parameters
30
- * @returns stopDraw function to stop drawing
31
- */
32
- export declare const useDrawingMode: ({ canvas, drawingMode, draggable, setDrawingMode, canvasToImageCoords, labelDefinitions, onChange, cropRegionImage, updateRegionShapeAndImage, performOCRIfNeeded, createDeleteControl, createOCRControl, updateRegionNameText, onRegionChange, onRegionSelect, rectMapRef, textLayersMapRef, regionNameTextMapRef, setupBoundaryCheck, }: UseDrawingModeParams) => {
33
- stopDraw: () => void;
34
- };
35
- export {};
@@ -1,16 +0,0 @@
1
- import { fabric } from 'fabric';
2
- interface UseOCRControlParams {
3
- performOCR: (targetRect: fabric.Rect) => void;
4
- ocrRecognizingRef: React.MutableRefObject<Set<string>>;
5
- ocrErrorRef: React.MutableRefObject<Set<string>>;
6
- rectMapRef: React.MutableRefObject<Map<fabric.Rect, any>>;
7
- }
8
- /**
9
- * Hook for creating OCR control
10
- * @param params - OCR control configuration parameters
11
- * @returns createOCRControl function
12
- */
13
- export declare const useOCRControl: ({ performOCR, ocrRecognizingRef, ocrErrorRef, rectMapRef, }: UseOCRControlParams) => {
14
- createOCRControl: () => fabric.Control;
15
- };
16
- export {};
@@ -1,11 +0,0 @@
1
- import { fabric } from 'fabric';
2
- import { Region } from '../../types';
3
- /**
4
- * Hook for managing OCR loading icon animation
5
- * @param canvas - Fabric.js canvas instance
6
- * @returns Object containing updateOCRLoadingIcon function and ocrLoadingIconMapRef
7
- */
8
- export declare const useOCRLoadingIcon: (canvas: fabric.Canvas | undefined) => {
9
- updateOCRLoadingIcon: (rect: fabric.Rect, region: Region, show: boolean) => void;
10
- ocrLoadingIconMapRef: import('react').RefObject<Map<fabric.Rect, fabric.Group>>;
11
- };
@@ -1,29 +0,0 @@
1
- import { fabric } from 'fabric';
2
- import { Region } from '../../types';
3
- interface UseOCRRecognitionParams {
4
- ocrRecognize?: (image: string) => Promise<Array<{
5
- bbox: [number, number][];
6
- content: string;
7
- no: number;
8
- score: number;
9
- type: string;
10
- }>>;
11
- onChange?: (labels: Region[]) => void;
12
- updateTextLayers: (rect: fabric.Rect, region: Region) => void;
13
- canvas: fabric.Canvas | undefined;
14
- rectMapRef: React.MutableRefObject<Map<fabric.Rect, Region>>;
15
- textLayersMapRef: React.MutableRefObject<Map<fabric.Rect, fabric.Rect[]>>;
16
- textLayoutContentMapRef: React.MutableRefObject<Map<fabric.Rect, string>>;
17
- }
18
- /**
19
- * Hook for managing OCR recognition logic
20
- * @param params - OCR recognition configuration parameters
21
- * @returns performOCRIfNeeded function and ocrRecognizingRef
22
- */
23
- export declare const useOCRRecognition: ({ ocrRecognize, onChange, updateTextLayers, canvas, rectMapRef, textLayersMapRef, textLayoutContentMapRef, }: UseOCRRecognitionParams) => {
24
- performOCRIfNeeded: (region: Region, action: "create" | "update") => Promise<void>;
25
- performOCR: (region: Region) => Promise<void>;
26
- ocrRecognizingRef: import('react').RefObject<Set<string>>;
27
- ocrErrorRef: import('react').RefObject<Set<string>>;
28
- };
29
- export {};
@@ -1,31 +0,0 @@
1
- import { fabric } from 'fabric';
2
- interface UseRegionBoundaryCheckParams {
3
- canvas: fabric.Canvas | undefined;
4
- image: fabric.Image | undefined;
5
- canvasToImageCoords: (canvasX: number, canvasY: number) => {
6
- x: number;
7
- y: number;
8
- };
9
- imageToCanvasCoords: (imageX: number, imageY: number) => {
10
- x: number;
11
- y: number;
12
- };
13
- bgImagePositionRef: React.MutableRefObject<{
14
- left: number;
15
- top: number;
16
- }>;
17
- bgImageSizeRef: React.MutableRefObject<{
18
- width: number;
19
- height: number;
20
- }>;
21
- regionNameTextMapRef: React.MutableRefObject<Map<fabric.Rect, fabric.Text>>;
22
- }
23
- /**
24
- * Hook for checking and enforcing region boundary constraints
25
- * @param params - Boundary check configuration parameters
26
- * @returns setupBoundaryCheck function to setup boundary checking for a rect
27
- */
28
- export declare const useRegionBoundaryCheck: ({ canvas, image, canvasToImageCoords, imageToCanvasCoords, bgImagePositionRef, bgImageSizeRef, regionNameTextMapRef, }: UseRegionBoundaryCheckParams) => {
29
- setupBoundaryCheck: (rect: fabric.Rect) => (() => void) | undefined;
30
- };
31
- export {};
@@ -1,13 +0,0 @@
1
- import { fabric } from 'fabric';
2
- interface UseRegionHoverParams {
3
- canvas: fabric.Canvas | undefined;
4
- drawingMode: boolean;
5
- draggable: boolean;
6
- textLayersMapRef: React.MutableRefObject<Map<fabric.Rect, fabric.Rect[]>>;
7
- }
8
- /**
9
- * Hook for managing region hover effects
10
- * @param params - Region hover configuration parameters
11
- */
12
- export declare const useRegionHover: ({ canvas, drawingMode, draggable, textLayersMapRef, }: UseRegionHoverParams) => void;
13
- export {};
@@ -1,41 +0,0 @@
1
- import { fabric } from 'fabric';
2
- import { VLMSample, Region } from '../../types';
3
- interface UseRegionLoaderParams {
4
- canvas: fabric.Canvas | undefined;
5
- sample: VLMSample | undefined;
6
- image: fabric.Image | undefined;
7
- bgImagePosition: {
8
- left: number;
9
- top: number;
10
- };
11
- canvasInitializedRef: React.MutableRefObject<boolean>;
12
- bgImagePositionRef: React.MutableRefObject<{
13
- left: number;
14
- top: number;
15
- }>;
16
- sampleRef: React.MutableRefObject<VLMSample | undefined>;
17
- labelsLoadedRef: React.MutableRefObject<boolean>;
18
- rectMapRef: React.MutableRefObject<Map<fabric.Rect, Region>>;
19
- textLayersMapRef: React.MutableRefObject<Map<fabric.Rect, fabric.Rect[]>>;
20
- textLayoutContentMapRef: React.MutableRefObject<Map<fabric.Rect, string>>;
21
- regionNameTextMapRef: React.MutableRefObject<Map<fabric.Rect, fabric.Text>>;
22
- ocrLoadingIconMapRef: React.MutableRefObject<Map<fabric.Rect, fabric.Group>>;
23
- imageToCanvasCoords: (imageX: number, imageY: number) => {
24
- x: number;
25
- y: number;
26
- };
27
- updateRegionShapeAndImage: (rect: fabric.Rect) => void;
28
- createDeleteControl: () => fabric.Control;
29
- createOCRControl: () => fabric.Control;
30
- updateRegionNameText: (rect: fabric.Rect, region: Region) => void;
31
- updateTextLayers: (rect: fabric.Rect, region: Region) => void;
32
- setupBoundaryCheck: (rect: fabric.Rect) => (() => void) | undefined;
33
- cropRegionImage: (region: Region) => Promise<string | undefined>;
34
- onChange?: (regions: Region[]) => void;
35
- }
36
- /**
37
- * Hook for loading labels from sample.labels
38
- * @param params - Region loader configuration parameters
39
- */
40
- export declare const useRegionLoader: ({ canvas, sample, image, bgImagePosition, canvasInitializedRef, bgImagePositionRef, sampleRef, labelsLoadedRef, rectMapRef, textLayersMapRef, textLayoutContentMapRef, regionNameTextMapRef, ocrLoadingIconMapRef, imageToCanvasCoords, updateRegionShapeAndImage, createDeleteControl, createOCRControl, updateRegionNameText, updateTextLayers, setupBoundaryCheck, cropRegionImage, onChange, }: UseRegionLoaderParams) => void;
41
- export {};
@@ -1,12 +0,0 @@
1
- import { fabric } from 'fabric';
2
- import { Region } from '../../types';
3
- /**
4
- * Hook for managing region name text labels
5
- * @param canvas - Fabric.js canvas instance
6
- * @param ocrLoadingIconMapRef - Reference to OCR loading icon map (for updating scan line position)
7
- * @returns Object containing updateRegionNameText function and regionNameTextMapRef
8
- */
9
- export declare const useRegionNameText: (canvas: fabric.Canvas | undefined) => {
10
- updateRegionNameText: (rect: fabric.Rect, region: Region) => void;
11
- regionNameTextMapRef: import('react').RefObject<Map<fabric.Rect, fabric.Text>>;
12
- };
@@ -1,16 +0,0 @@
1
- import { fabric } from 'fabric';
2
- import { Region } from '../../types';
3
- interface UseRegionSelectionParams {
4
- canvas: fabric.Canvas | undefined;
5
- onRegionSelect?: (region: Region | null) => void;
6
- createDeleteControl: () => fabric.Control;
7
- createOCRControl: () => fabric.Control;
8
- textLayersMapRef: React.MutableRefObject<Map<fabric.Rect, fabric.Rect[]>>;
9
- rectMapRef: React.MutableRefObject<Map<fabric.Rect, Region>>;
10
- }
11
- /**
12
- * Hook for managing region selection state
13
- * @param params - Region selection configuration parameters
14
- */
15
- export declare const useRegionSelection: ({ canvas, onRegionSelect, createDeleteControl, createOCRControl, textLayersMapRef, rectMapRef, }: UseRegionSelectionParams) => void;
16
- export {};
@@ -1,32 +0,0 @@
1
- import { fabric } from 'fabric';
2
- import { Region } from '../../types';
3
- interface UseRegionUpdateParams {
4
- canvas: fabric.Canvas | undefined;
5
- image: fabric.Image | undefined;
6
- draggable: boolean;
7
- canvasToImageCoords: (canvasX: number, canvasY: number) => {
8
- x: number;
9
- y: number;
10
- };
11
- imageToCanvasCoords: (imageX: number, imageY: number) => {
12
- x: number;
13
- y: number;
14
- };
15
- cropRegionImage: (region: Region) => Promise<string | undefined>;
16
- onChange?: (labels: Region[]) => void;
17
- onRegionChange?: (region: Region | null, action: 'create' | 'update' | 'delete') => void;
18
- performOCRIfNeeded: (region: Region, action: 'create' | 'update') => Promise<void>;
19
- updateTextLayers: (rect: fabric.Rect, region: Region) => void;
20
- rectMapRef: React.MutableRefObject<Map<fabric.Rect, Region>>;
21
- regionNameTextMapRef: React.MutableRefObject<Map<fabric.Rect, fabric.Text>>;
22
- ocrLoadingIconMapRef: React.MutableRefObject<Map<fabric.Rect, fabric.Group>>;
23
- }
24
- /**
25
- * Hook for updating region shape and image
26
- * @param params - Region update configuration parameters
27
- * @returns updateRegionShapeAndImage function to update region shape and crop image
28
- */
29
- export declare const useRegionUpdate: ({ canvas, image, draggable, canvasToImageCoords, imageToCanvasCoords, cropRegionImage, onChange, onRegionChange, performOCRIfNeeded, updateTextLayers, rectMapRef, regionNameTextMapRef, ocrLoadingIconMapRef, }: UseRegionUpdateParams) => {
30
- updateRegionShapeAndImage: (rect: fabric.Rect) => void;
31
- };
32
- export {};
@@ -1,25 +0,0 @@
1
- import { fabric } from 'fabric';
2
- import { Region, VLMLabel } from '../../types';
3
- interface UseTextLayoutsParams {
4
- canvas: fabric.Canvas | undefined;
5
- imageToCanvasCoords: (imageX: number, imageY: number) => {
6
- x: number;
7
- y: number;
8
- };
9
- activeLabelValue?: {
10
- label: VLMLabel;
11
- region: Region;
12
- } | null;
13
- onAppendTextToActive?: (text: string) => void;
14
- }
15
- /**
16
- * Hook for managing text layout rectangles (OCR recognition results)
17
- * @param params - Text layouts configuration parameters
18
- * @returns Object containing updateTextLayers function and refs
19
- */
20
- export declare const useTextLayouts: ({ canvas, imageToCanvasCoords, activeLabelValue, onAppendTextToActive, }: UseTextLayoutsParams) => {
21
- updateTextLayers: (rect: fabric.Rect, region: Region) => void;
22
- textLayersMapRef: import('react').RefObject<Map<fabric.Rect, fabric.Rect[]>>;
23
- textLayoutContentMapRef: import('react').RefObject<Map<fabric.Rect, string>>;
24
- };
25
- export {};
@@ -1,4 +0,0 @@
1
- import { default as React } from 'react';
2
- import { VLMLabelMakerProps, VLMLabelMakerRef } from '../types';
3
- declare const VLMLabelMaker: React.ForwardRefExoticComponent<VLMLabelMakerProps & React.RefAttributes<VLMLabelMakerRef>>;
4
- export default VLMLabelMaker;