@aivex/ui 1.2.0-dev.1 → 1.2.0-dev.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.
- package/dist/Switch-DX-FkCbT.cjs +42 -0
- package/dist/Switch-DX-FkCbT.cjs.map +1 -0
- package/dist/Switch-c8rHebeK.js +11243 -0
- package/dist/Switch-c8rHebeK.js.map +1 -0
- package/dist/components/Icon/index.d.ts +5 -4
- package/dist/components/Messagebox/Messagebox.d.ts +3 -1
- package/dist/components/ShapeEditor/ShapeEditor.d.ts +9 -0
- package/dist/components/ShapeEditor/_components/AssistantOverlay.d.ts +17 -0
- package/dist/components/ShapeEditor/_components/ContextMenu.d.ts +13 -0
- package/dist/components/ShapeEditor/_components/CursorGuide.d.ts +8 -0
- package/dist/components/ShapeEditor/_components/ImageStateOverlay.d.ts +11 -0
- package/dist/components/ShapeEditor/_components/Minimap.d.ts +45 -0
- package/dist/components/ShapeEditor/_components/MinimapShape.d.ts +6 -0
- package/dist/components/ShapeEditor/_components/RoiOverlay.d.ts +21 -0
- package/dist/components/ShapeEditor/_components/SelectionInfo.d.ts +12 -0
- package/dist/components/ShapeEditor/_components/SettingsPanel.d.ts +15 -0
- package/dist/components/ShapeEditor/_constants.d.ts +33 -0
- package/dist/components/ShapeEditor/_model/brush.d.ts +3 -0
- package/dist/components/ShapeEditor/_model/cursors.d.ts +18 -0
- package/dist/components/ShapeEditor/_model/geometry.d.ts +128 -0
- package/dist/components/ShapeEditor/_model/imageTiles.d.ts +11 -0
- package/dist/components/ShapeEditor/_model/keymap.d.ts +15 -0
- package/dist/components/ShapeEditor/_model/konva.d.ts +4 -0
- package/dist/components/ShapeEditor/_model/overlays.d.ts +55 -0
- package/dist/components/ShapeEditor/_model/pinIcon.d.ts +13 -0
- package/dist/components/ShapeEditor/_model/props.d.ts +398 -0
- package/dist/components/ShapeEditor/_model/scalarMask.d.ts +21 -0
- package/dist/components/ShapeEditor/_model/shapeRenderStyle.d.ts +16 -0
- package/dist/components/ShapeEditor/_model/strings.d.ts +55 -0
- package/dist/components/ShapeEditor/_model/tools.d.ts +27 -0
- package/dist/components/ShapeEditor/_model/viewSettings.d.ts +15 -0
- package/dist/components/ShapeEditor/_model/viewport.d.ts +28 -0
- package/dist/components/ShapeEditor/_renderers/KonvaRenderer.d.ts +114 -0
- package/dist/components/ShapeEditor/_renderers/PixiRenderer.d.ts +159 -0
- package/dist/components/ShapeEditor/_renderers/transformSession.d.ts +63 -0
- package/dist/components/ShapeEditor/_renderers/types.d.ts +94 -0
- package/dist/components/ShapeEditor/_state/createInteractionController.d.ts +52 -0
- package/dist/components/ShapeEditor/_state/drawSessionState.d.ts +6 -0
- package/dist/components/ShapeEditor/_state/useAssistant.d.ts +48 -0
- package/dist/components/ShapeEditor/_state/useDrawSession.d.ts +60 -0
- package/dist/components/ShapeEditor/_state/useEditorDocument.d.ts +23 -0
- package/dist/components/ShapeEditor/_state/useEditorHotkeys.d.ts +23 -0
- package/dist/components/ShapeEditor/_state/useEngineLifecycle.d.ts +48 -0
- package/dist/components/ShapeEditor/_state/useMinimapNavigation.d.ts +27 -0
- package/dist/components/ShapeEditor/_state/useMinimapSync.d.ts +24 -0
- package/dist/components/ShapeEditor/_state/useSelectionActions.d.ts +29 -0
- package/dist/components/ShapeEditor/_state/useViewportControls.d.ts +23 -0
- package/dist/components/ShapeEditor/index.d.ts +6 -0
- package/dist/index.cjs +6 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3427 -14617
- package/dist/index.js.map +1 -1
- package/dist/shape-editor.cjs +2 -0
- package/dist/shape-editor.cjs.map +1 -0
- package/dist/shape-editor.js +5271 -0
- package/dist/shape-editor.js.map +1 -0
- package/dist/styles.css +1 -1
- package/package.json +8 -1
|
@@ -206,11 +206,11 @@ export declare const Zoom100Icon: ({ size, color, className, ...props }: IconPro
|
|
|
206
206
|
export declare const ZoomInIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
207
207
|
export declare const ZoomOutIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
208
208
|
export declare const PackageIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
209
|
-
export declare const
|
|
209
|
+
export declare const ArrowControlIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
210
210
|
export declare const TagIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
211
211
|
export declare const TagFilledIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
212
212
|
export declare const AtIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
213
|
-
export declare const
|
|
213
|
+
export declare const OpenedMailIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
214
214
|
export declare const TestIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
215
215
|
export declare const MinimizeIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
216
216
|
export declare const StorageIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -274,8 +274,6 @@ export declare const HourglassIcon: ({ size, color, className, ...props }: IconP
|
|
|
274
274
|
export declare const ThumbsUpIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
275
275
|
export declare const ThumbsDownIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
276
276
|
export declare const ThumbsDownFilledIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
277
|
-
export declare const PageMinimizeIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
278
|
-
export declare const PageMaximizeIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
279
277
|
export declare const PageIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
280
278
|
export declare const MinimizeWindowIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
281
279
|
export declare const TaskQueueIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -283,4 +281,7 @@ export declare const ShrinkIcon: ({ size, color, className, ...props }: IconProp
|
|
|
283
281
|
export declare const ExpandIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
284
282
|
export declare const AiVotIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
285
283
|
export declare const AiViewIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
284
|
+
export declare const HeadphonesIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
285
|
+
export declare const LinkedInIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
286
|
+
export declare const PhoneIcon: ({ size, color, className, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
286
287
|
export {};
|
|
@@ -5,8 +5,10 @@ declare const messageboxVariants: (props?: ({
|
|
|
5
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
6
|
export interface MessageboxProps extends HTMLAttributes<HTMLDivElement>, VariantProps<typeof messageboxVariants> {
|
|
7
7
|
message: string;
|
|
8
|
+
subText?: ReactNode;
|
|
8
9
|
children?: ReactNode;
|
|
10
|
+
onClose?: () => void;
|
|
9
11
|
ref?: Ref<HTMLDivElement>;
|
|
10
12
|
}
|
|
11
|
-
declare function Messagebox({ className, type, message, children, ref, ...props }: MessageboxProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function Messagebox({ className, type, message, subText, children, onClose, ref, ...props }: MessageboxProps): import("react/jsx-runtime").JSX.Element;
|
|
12
14
|
export { Messagebox, messageboxVariants };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ShapeEditorProps } from "./_model/props";
|
|
2
|
+
/**
|
|
3
|
+
* ShapeEditor — renderer backend 기반 도형 에디터. 상호작용/문서/키보드/메뉴는 여기서 소유하고,
|
|
4
|
+
* 그리기·히트테스트·뷰포트는 `EditorRenderer`(Konva/Pixi)에 위임한다. `backend`로 교체.
|
|
5
|
+
* 갭(회전/꼭짓점추가 등)은 여기서 한 번 구현하면 양쪽 렌더러에 적용된다.
|
|
6
|
+
*/
|
|
7
|
+
export default function ShapeEditor<TMeta, TMarkerMeta = unknown>({ imageUrl, displayImageUrl, renderImageState, dimmed, initialShapes, selectedIds: controlledSelectedIds, activeTool, draftStyle, draftMeta, readOnly, locked, onLockedInteraction, onIdleEscape, overrideShapeInteraction, defaultViewSettings, viewSettings, onViewSettingsChange, showMinimap, showViewSettings, getContextMenuItems, strings, canMergeSelection, brushSize, zoomBound, zoomAnimationDuration, rois, excludedZones, guideMask, maskPalette, overlayMarkers, renderOverlayMarker, onOverlayMarkerClick, renderImageOverlay, getSelectionLabel, formatSelectionInfo, externalTools, assistant, keymap, handleRef, backend, onActiveToolChange, onSelectionChange, onEditingChange, onShapesCreated, onShapesUpdated, onShapesDeleted, onDrawSessionChange, onViewportChange, }: ShapeEditorProps<TMeta, TMarkerMeta> & {
|
|
8
|
+
backend?: "konva" | "pixi";
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AssistantPromptPoint } from "../_model/props";
|
|
2
|
+
import type { AssistantStatus } from "../_state/useAssistant";
|
|
3
|
+
export declare function AssistantOverlay({ image, points, boxes, status, }: {
|
|
4
|
+
image: {
|
|
5
|
+
w: number;
|
|
6
|
+
h: number;
|
|
7
|
+
};
|
|
8
|
+
points: AssistantPromptPoint[];
|
|
9
|
+
/** 진행 중인 박스 프롬프트들(병렬 요청 — 각각 shimmer 표시). */
|
|
10
|
+
boxes: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
}[];
|
|
16
|
+
status: AssistantStatus;
|
|
17
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ContextMenuItem } from "../_model/props";
|
|
2
|
+
export type { ContextMenuItem };
|
|
3
|
+
/**
|
|
4
|
+
* 캔버스 우클릭 컨텍스트 메뉴(도메인 무관). 항목/위치는 호출부가 결정한다.
|
|
5
|
+
* @aivex/ui Menu(Radix Dropdown)를 커서 위치의 0크기 트리거에 앵커해 띄운다.
|
|
6
|
+
* 바깥 클릭·Escape·스크롤 닫힘은 Radix가 onOpenChange로 처리한다(비모달).
|
|
7
|
+
*/
|
|
8
|
+
export declare function ContextMenu({ x, y, items, onClose, }: {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
items: ContextMenuItem[];
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 마우스 위치에 십자 가이드라인을 그리는 오버레이(도메인 무관).
|
|
3
|
+
* 부모(컨테이너)를 채우고 pointer-events 없음 → 캔버스 상호작용 방해 안 함.
|
|
4
|
+
* 고빈도(mousemove)라 React state 없이 line ref를 명령형 갱신.
|
|
5
|
+
*/
|
|
6
|
+
export declare function CursorGuide({ color }: {
|
|
7
|
+
color?: string;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* 이미지 로딩/에러 상태 오버레이. 에디터 영역 전체를 덮는다.
|
|
4
|
+
* 호스트가 renderImageState로 커스텀하지 않으면 기본 스피너/에러 메시지를 그린다.
|
|
5
|
+
*/
|
|
6
|
+
export declare function ImageStateOverlay({ status, render, loadingLabel, errorLabel, }: {
|
|
7
|
+
status: "loading" | "error";
|
|
8
|
+
render?: (status: "loading" | "error") => ReactNode;
|
|
9
|
+
loadingLabel?: string;
|
|
10
|
+
errorLabel?: string;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { RefObject } from "react";
|
|
2
|
+
import { type EditorShape } from "../_model/geometry";
|
|
3
|
+
import type { ExcludedZone, RoiRect } from "../_model/overlays";
|
|
4
|
+
import { type EditorStrings } from "../_model/strings";
|
|
5
|
+
import type { ViewSettings } from "../_model/viewSettings";
|
|
6
|
+
import type { MinimapNavigation } from "../_state/useMinimapNavigation";
|
|
7
|
+
/**
|
|
8
|
+
* 미니맵 패널(좌하단) — 축소 이미지 + 가이드마스크/ROI 오버레이 + 도형 미리보기 +
|
|
9
|
+
* 현재 뷰포트 사각형 + 줌 컨트롤 바 + 보기설정 팝오버.
|
|
10
|
+
*
|
|
11
|
+
* 내비게이션 로직(패닝/줌)은 useMinimapNavigation(nav)에, 뷰포트 사각형/줌라벨의 실시간
|
|
12
|
+
* 갱신은 호스트의 syncMinimap이 rectRef/zoomLabelRef로 담당한다. 여긴 순수 표시.
|
|
13
|
+
*/
|
|
14
|
+
export declare function Minimap<TMeta>({ image, imageUrl, imageVisible, maskDataUrl, rois, excludedZones, roiMaskId, shapes, view, onChangeView, nav, registerShape, rectRef, zoomLabelRef, onZoom100, open, onToggleOpen, showSettings, settingsOpen, onToggleSettings, onCloseSettings, labels, settingsLabels, }: {
|
|
15
|
+
image: {
|
|
16
|
+
w: number;
|
|
17
|
+
h: number;
|
|
18
|
+
};
|
|
19
|
+
imageUrl: string;
|
|
20
|
+
/** 메인 캔버스와 동기화된 표시 여부 — 전환 시 즉시 숨기고 로드 후 페이드인. */
|
|
21
|
+
imageVisible?: boolean;
|
|
22
|
+
maskDataUrl: string | null;
|
|
23
|
+
rois?: RoiRect[];
|
|
24
|
+
excludedZones?: ExcludedZone[];
|
|
25
|
+
roiMaskId: string;
|
|
26
|
+
shapes: EditorShape<TMeta>[];
|
|
27
|
+
view: ViewSettings;
|
|
28
|
+
onChangeView: (patch: Partial<ViewSettings>) => void;
|
|
29
|
+
nav: MinimapNavigation;
|
|
30
|
+
registerShape: (id: string, el: SVGElement | null) => void;
|
|
31
|
+
rectRef: RefObject<HTMLDivElement | null>;
|
|
32
|
+
zoomLabelRef: RefObject<HTMLSpanElement | null>;
|
|
33
|
+
onZoom100: () => void;
|
|
34
|
+
open: boolean;
|
|
35
|
+
onToggleOpen: () => void;
|
|
36
|
+
/** 보기설정(기어) 버튼 표시 여부(기본 true). */
|
|
37
|
+
showSettings?: boolean;
|
|
38
|
+
settingsOpen: boolean;
|
|
39
|
+
onToggleSettings: () => void;
|
|
40
|
+
onCloseSettings: () => void;
|
|
41
|
+
/** UI 문자열(aria/버튼). 기본 한국어. */
|
|
42
|
+
labels?: EditorStrings["minimap"];
|
|
43
|
+
/** 설정 팝오버 문자열. 기본 한국어. */
|
|
44
|
+
settingsLabels?: EditorStrings["viewSettings"];
|
|
45
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { EditorShape } from "../_model/geometry";
|
|
2
|
+
export declare function MinimapShape<TMeta>({ shape, strokeSize, register, }: {
|
|
3
|
+
shape: EditorShape<TMeta>;
|
|
4
|
+
strokeSize?: number;
|
|
5
|
+
register?: (id: string, el: SVGElement | null) => void;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
import type { ExcludedZone, RoiRect } from "../_model/overlays";
|
|
3
|
+
/**
|
|
4
|
+
* ROI(어둡게 처리)/제외영역 오버레이 SVG. 캔버스 오버레이와 미니맵이 공유한다.
|
|
5
|
+
* ROI 밖을 반투명 검정으로 덮고, 제외영역은 다시 뚫으며, 경계선을 점선으로 그린다.
|
|
6
|
+
* 좌표계는 이미지 좌표(viewBox=image), 화면 크기/선 두께는 호출부가 정한다.
|
|
7
|
+
*/
|
|
8
|
+
export declare function RoiOverlay({ image, rois, excludedZones, maskId, width, height, strokeWidth, strokeDasharray, style, }: {
|
|
9
|
+
image: {
|
|
10
|
+
w: number;
|
|
11
|
+
h: number;
|
|
12
|
+
};
|
|
13
|
+
rois: RoiRect[];
|
|
14
|
+
excludedZones?: ExcludedZone[];
|
|
15
|
+
maskId: string;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
strokeWidth: number | string;
|
|
19
|
+
strokeDasharray: string;
|
|
20
|
+
style?: CSSProperties;
|
|
21
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type EditorShape, type Point } from "../_model/geometry";
|
|
2
|
+
import type { EditorSelectionInfo } from "../_model/props";
|
|
3
|
+
/** shape + 실제 좌표(points)로 selection info 데이터를 만든다(에디터 계산분). */
|
|
4
|
+
export declare function buildSelectionInfo<TMeta>(shape: EditorShape<TMeta>, points: Point[]): EditorSelectionInfo<TMeta>;
|
|
5
|
+
/** formatSelectionInfo 미지정 시 기본 텍스트. */
|
|
6
|
+
export declare function defaultSelectionInfoText<TMeta>(info: EditorSelectionInfo<TMeta>): string;
|
|
7
|
+
export declare function SelectionInfo<TMeta>({ shapes, getLabel, formatInfo, register, }: {
|
|
8
|
+
shapes: EditorShape<TMeta>[];
|
|
9
|
+
getLabel?: (shape: EditorShape<TMeta>) => string | undefined;
|
|
10
|
+
formatInfo?: (info: EditorSelectionInfo<TMeta>) => string;
|
|
11
|
+
register: (id: string, el: HTMLDivElement | null) => void;
|
|
12
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type EditorStrings } from "../_model/strings";
|
|
2
|
+
import { type ViewSettings } from "../_model/viewSettings";
|
|
3
|
+
export { DEFAULT_VIEW_SETTINGS, type ViewSettings, } from "../_model/viewSettings";
|
|
4
|
+
/**
|
|
5
|
+
* 미니맵 기어 버튼에서 열리는 보기 설정 팝오버(도메인 무관).
|
|
6
|
+
* 바깥 클릭/Esc로 닫힘. 값은 호출부가 소유하고 onChange로 부분 갱신.
|
|
7
|
+
* 컨트롤은 @aivex/ui(Button/Slider/Switch/Divider)로 렌더한다.
|
|
8
|
+
*/
|
|
9
|
+
export declare function SettingsPanel({ value, onChange, onClose, labels, }: {
|
|
10
|
+
value: ViewSettings;
|
|
11
|
+
onChange: (patch: Partial<ViewSettings>) => void;
|
|
12
|
+
onClose: () => void;
|
|
13
|
+
/** UI 문자열. 기본 한국어. */
|
|
14
|
+
labels?: EditorStrings["viewSettings"];
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const MIN_SCALE = 0.1;
|
|
2
|
+
export declare const MAX_SCALE = 10;
|
|
3
|
+
export declare const ZOOM_FACTOR = 1.1;
|
|
4
|
+
export declare const POINT_RADIUS = 5;
|
|
5
|
+
export declare const HANDLE_RADIUS = 5;
|
|
6
|
+
export declare const HANDLE_SQUARE = 8;
|
|
7
|
+
export declare const HANDLE_NAME = "v2-handle";
|
|
8
|
+
export declare const FIXED_NAME = "v2-fixed";
|
|
9
|
+
export declare const HANDLE_COLOR = "#1e88e5";
|
|
10
|
+
export declare const POLY_CLOSE_PX = 12;
|
|
11
|
+
export declare const ROTATE_GAP_PX = 28;
|
|
12
|
+
export declare const NUDGE_PX = 1;
|
|
13
|
+
export declare const NUDGE_BIG_PX = 10;
|
|
14
|
+
export declare const DUPLICATE_OFFSET_PX = 12;
|
|
15
|
+
export declare const ROTATE_SNAP_RAD: number;
|
|
16
|
+
export declare const MINIMAP_SIZE = 180;
|
|
17
|
+
export declare const MINIMAP_VP_STROKE = "#00ff00";
|
|
18
|
+
export declare const MINIMAP_VP_FILL = "rgba(0, 255, 0, 0.1)";
|
|
19
|
+
export declare const DEFAULT_COLOR = "#00e5ff";
|
|
20
|
+
export declare const SELECTED_COLOR = "#ffffff";
|
|
21
|
+
export declare const STROKE_SIZE = 2;
|
|
22
|
+
export declare const SELECTION_BORDER_COLOR = "#669DEF";
|
|
23
|
+
export declare const SELECTION_BORDER_PAD = 3;
|
|
24
|
+
export declare const SELECTION_AREA_COLOR = "#669DEF";
|
|
25
|
+
export declare const SELECTION_AREA_FILL_ALPHA = 0.1;
|
|
26
|
+
export declare const FILL_ALPHA_HEX = "20";
|
|
27
|
+
export declare const FILL_ALPHA: number;
|
|
28
|
+
export declare const ROI_BORDER_COLOR = "#ffffff";
|
|
29
|
+
export declare const ROI_BORDER_WIDTH = 2;
|
|
30
|
+
export declare const ROI_BORDER_DASH: [number, number];
|
|
31
|
+
export declare const STRIPED_OPACITY = 0.7;
|
|
32
|
+
export declare const STRIPED_STROKE_SCALE = 2.5;
|
|
33
|
+
export declare const STRIPED_DASH_GAP_SCALE = 2;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Anchor } from "./geometry";
|
|
2
|
+
import { type Tool } from "./tools";
|
|
3
|
+
export declare function resizeCursorForAnchor(anchor: Anchor, angleRad?: number): string;
|
|
4
|
+
export declare function cursorForTool({ tool, externalToolCursor, isSpacePressed, isPolygonDrawing, }: {
|
|
5
|
+
tool: Tool;
|
|
6
|
+
externalToolCursor?: string;
|
|
7
|
+
isSpacePressed: boolean;
|
|
8
|
+
isPolygonDrawing: boolean;
|
|
9
|
+
}): string;
|
|
10
|
+
export type EditorInteractionMode = "idle" | "drawing" | "marquee" | "moving" | "panning" | "resizing" | "rotating" | "vertexDragging";
|
|
11
|
+
export declare function resolveEditorCursor({ tool, externalToolCursor, isSpacePressed, interactionMode, rendererCursorHint, isPolygonDrawing, }: {
|
|
12
|
+
tool: Tool;
|
|
13
|
+
externalToolCursor?: string;
|
|
14
|
+
isSpacePressed: boolean;
|
|
15
|
+
interactionMode: EditorInteractionMode;
|
|
16
|
+
rendererCursorHint?: string | null;
|
|
17
|
+
isPolygonDrawing: boolean;
|
|
18
|
+
}): string;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Editor의 도메인 무관 기하/도형 모델.
|
|
3
|
+
*
|
|
4
|
+
* 이 에디터는 "색 입힌 도형을 그리고 편집"할 뿐, 클래스/라벨/태스크 같은 라벨링 도메인
|
|
5
|
+
* 개념을 모른다. 분류 정보(classId 등)는 호스트가 `meta`에 담아 넘기면 에디터는 건드리지
|
|
6
|
+
* 않고 그대로 되돌려준다. 렌더에 필요한 색/채움은 `style`로 받는다.
|
|
7
|
+
*/
|
|
8
|
+
export interface Point {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
}
|
|
12
|
+
export declare const SHAPE_TYPE: {
|
|
13
|
+
readonly POINT: "POINT";
|
|
14
|
+
readonly RECTANGLE: "RECTANGLE";
|
|
15
|
+
readonly ROTATED_RECTANGLE: "ROTATED_RECTANGLE";
|
|
16
|
+
readonly POLYGON: "POLYGON";
|
|
17
|
+
readonly ELLIPSE: "ELLIPSE";
|
|
18
|
+
readonly LINE: "LINE";
|
|
19
|
+
};
|
|
20
|
+
export type ShapeType = (typeof SHAPE_TYPE)[keyof typeof SHAPE_TYPE];
|
|
21
|
+
/** 도형 렌더 힌트. 호스트가 (예: 클래스→색) 계산해 주입한다. */
|
|
22
|
+
export interface ShapeStyle {
|
|
23
|
+
color?: string;
|
|
24
|
+
filled?: boolean;
|
|
25
|
+
opacity?: number;
|
|
26
|
+
/** 도형별 선 두께(화면 px). 없으면 에디터 기본값을 사용한다. */
|
|
27
|
+
strokeWidth?: number;
|
|
28
|
+
/** 채움 투명도(0~1). 없으면 렌더러 기본값을 사용한다. */
|
|
29
|
+
fillOpacity?: number;
|
|
30
|
+
/** 점선 패턴(화면 px). */
|
|
31
|
+
dash?: number[];
|
|
32
|
+
/** POINT 도형 반경(화면 px). */
|
|
33
|
+
pointRadius?: number;
|
|
34
|
+
/** 렌더 순서. 없으면 문서 배열 순서를 따른다. */
|
|
35
|
+
zIndex?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface ShapeInteraction {
|
|
38
|
+
/** false면 렌더하지 않고 hit-test/선택/편집에서도 제외한다. */
|
|
39
|
+
visible?: boolean;
|
|
40
|
+
/** false면 도형 클릭·마퀴·선택 API에서 선택 대상이 되지 않는다. */
|
|
41
|
+
selectable?: boolean;
|
|
42
|
+
/** false면 본체 드래그 이동을 막는다. */
|
|
43
|
+
draggable?: boolean;
|
|
44
|
+
/** false면 트랜스포머/꼭짓점 편집/삭제 같은 문서 변경 편집을 막는다. */
|
|
45
|
+
editable?: boolean;
|
|
46
|
+
/** true면 렌더는 하되 포인터 hit-test 대상에서 제외한다. */
|
|
47
|
+
hitTestDisabled?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* 에디터가 그리고 편집하는 단위.
|
|
51
|
+
* - POINT: points 1개, RECTANGLE·ELLIPSE: 2개(대각 bbox), ROTATED_RECTANGLE: 4개,
|
|
52
|
+
* POLYGON: N개(닫힘), LINE: N개(열린 폴리라인/자유곡선).
|
|
53
|
+
* - id: **클라이언트 생성**(에디터가 도형 생성 시 부여). 서버 id는 에디터가 모른다 —
|
|
54
|
+
* 호스트가 clientId↔serverId 매핑을 들거나 meta에 보관한다.
|
|
55
|
+
* - meta: 호스트 전용 불투명 데이터(classId, serverId 등). 에디터는 읽지 않고 보존만 한다.
|
|
56
|
+
* - style: 렌더 힌트(색/채움). 호스트가 클래스→색을 계산해 주입/시드한다.
|
|
57
|
+
*/
|
|
58
|
+
export interface EditorShape<TMeta = unknown> {
|
|
59
|
+
id: string;
|
|
60
|
+
type: ShapeType;
|
|
61
|
+
points: Point[];
|
|
62
|
+
rotation?: number;
|
|
63
|
+
/**
|
|
64
|
+
* 편집 불가(예: 모델 예측/평가 도형). 하위 호환 shorthand이며 selectable은 유지하고
|
|
65
|
+
* draggable/editable만 false처럼 취급한다.
|
|
66
|
+
*/
|
|
67
|
+
readOnly?: boolean;
|
|
68
|
+
interaction?: ShapeInteraction;
|
|
69
|
+
style?: ShapeStyle;
|
|
70
|
+
meta?: TMeta;
|
|
71
|
+
}
|
|
72
|
+
export interface Viewport {
|
|
73
|
+
scale: number;
|
|
74
|
+
position: Point;
|
|
75
|
+
}
|
|
76
|
+
export declare function isShapeVisible(shape: EditorShape): boolean;
|
|
77
|
+
export declare function isShapeHitTestable(shape: EditorShape): boolean;
|
|
78
|
+
export declare function isShapeSelectable(shape: EditorShape): boolean;
|
|
79
|
+
export declare function isShapeEditable(shape: EditorShape): boolean;
|
|
80
|
+
export declare function isShapeDraggable(shape: EditorShape): boolean;
|
|
81
|
+
export declare function sortShapesForRender<TMeta>(shapes: EditorShape<TMeta>[]): EditorShape<TMeta>[];
|
|
82
|
+
export declare function clamp(value: number, min: number, max: number): number;
|
|
83
|
+
export declare function generateId(): string;
|
|
84
|
+
export interface BBox {
|
|
85
|
+
minX: number;
|
|
86
|
+
minY: number;
|
|
87
|
+
maxX: number;
|
|
88
|
+
maxY: number;
|
|
89
|
+
}
|
|
90
|
+
export type Anchor = "tl" | "t" | "tr" | "r" | "br" | "b" | "bl" | "l";
|
|
91
|
+
export declare const ANCHORS: Anchor[];
|
|
92
|
+
export declare function getBBox(points: Point[]): BBox;
|
|
93
|
+
export declare function anchorPoint(anchor: Anchor, b: BBox): Point;
|
|
94
|
+
export declare function boxFromAnchor(anchor: Anchor, b: BBox, hx: number, hy: number): BBox;
|
|
95
|
+
export declare function squareEnd(start: Point, p: Point): Point;
|
|
96
|
+
export declare function rotatePoint(p: Point, pivot: Point, angle: number): Point;
|
|
97
|
+
export declare function rectTo4(points: Point[]): Point[];
|
|
98
|
+
/**
|
|
99
|
+
* 두 점(a,b)이 이루는 바운딩 박스에 **내접하는 타원**을 폴리곤으로 샘플링한다.
|
|
100
|
+
* 그리기 미리보기(previewBox "ellipse": rx=w/2, ry=h/2)와 동일한 도형이어야 커밋 결과가
|
|
101
|
+
* 드래그 중 보이던 것과 일치한다(정사각형 드래그면 원). 예전엔 대각선을 지름으로 한 원을
|
|
102
|
+
* 만들어 미리보기(내접 타원)와 크기·모양이 달랐다.
|
|
103
|
+
*/
|
|
104
|
+
export declare function circleToPolygon(a: Point, b: Point, count?: number): Point[];
|
|
105
|
+
/**
|
|
106
|
+
* 볼록 껍질(Andrew monotone chain). 입력 점들의 볼록 다각형 코너를 반시계로 반환.
|
|
107
|
+
* 3점 미만이면 입력을 그대로 돌려준다(최소사각형 계산의 전처리용).
|
|
108
|
+
*/
|
|
109
|
+
export declare function convexHull(points: Point[]): Point[];
|
|
110
|
+
/**
|
|
111
|
+
* 최소 넓이 회전 사각형(rotating calipers). 점들을 감싸는 넓이 최소의 (기울 수 있는)
|
|
112
|
+
* 사각형 4개 코너를 둘레 순서로 반환한다. OBB(회전 바운딩박스) 어시스트 결과 변환용.
|
|
113
|
+
* 최소사각형의 한 변은 반드시 볼록껍질의 한 변과 평행하다는 성질을 이용한다.
|
|
114
|
+
*/
|
|
115
|
+
export declare function minAreaRect(points: Point[]): Point[];
|
|
116
|
+
export declare const vsub: (a: Point, b: Point) => Point;
|
|
117
|
+
export declare const vdot: (a: Point, b: Point) => number;
|
|
118
|
+
export declare const vlen: (a: Point) => number;
|
|
119
|
+
export declare const vnorm: (a: Point) => Point;
|
|
120
|
+
export declare const mid: (a: Point, b: Point) => Point;
|
|
121
|
+
export declare const centerOf: (pts: Point[]) => Point;
|
|
122
|
+
export declare function orientedHandles(c: Point[]): Point[];
|
|
123
|
+
export declare function rotateHandlePos(c: Point[], gap: number): Point;
|
|
124
|
+
/** 회전 사각형 위변(tl→tr) 각도(라디안). */
|
|
125
|
+
export declare function rotatedRectAngle(points: Point[]): number;
|
|
126
|
+
export declare function localBoxToCorners(box: BBox, R: Point, u: Point, v: Point): Point[];
|
|
127
|
+
export declare function resizeRotatedRectFromAnchor(points: Point[], anchor: Anchor, target: Point): Point[];
|
|
128
|
+
export declare function rescalePoints(points: Point[], from: BBox, to: BBox): Point[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const IMAGE_TILE_SIZE = 4000;
|
|
2
|
+
export interface ImageTile {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
srcX: number;
|
|
8
|
+
srcY: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function getImageTiles(width: number, height: number, tileSize?: number): ImageTile[];
|
|
11
|
+
export declare function createImageTileCanvas(image: HTMLImageElement, tile: ImageTile): HTMLCanvasElement;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 에디터 단축키 매핑. 조합키 문자열(예: "mod+shift+z")을 액션으로 잇는다.
|
|
3
|
+
* 호스트는 keymap prop으로 재정의(문자열/배열)하거나 비활성(null)할 수 있다.
|
|
4
|
+
*
|
|
5
|
+
* 조합키 규칙: 수식어는 `mod`(⌘/Ctrl)·`shift`·`alt` 순, 그 뒤에 키 토큰.
|
|
6
|
+
* 키 토큰은 e.code 기반(레이아웃/IME 무관): 글자 a–z, 숫자 0–9,
|
|
7
|
+
* 기호(= - [ ] ; . , / `), 이름키(escape/enter/backspace/delete/arrow*).
|
|
8
|
+
*/
|
|
9
|
+
export type EditorAction = "undo" | "redo" | "selectAll" | "copy" | "cut" | "paste" | "duplicate" | "delete" | "cancel" | "commitDraft" | "bringToFront" | "sendToBack" | "flipHorizontal" | "flipVertical" | "zoomIn" | "zoomOut" | "zoom100" | "zoomFit" | "toggleMinimap" | "toggleCursorGuide" | "togglePixelation" | "selectTool" | "rectangleTool" | "rotatedRectangleTool" | "circleTool" | "polygonTool" | "pathTool" | "brushTool" | "pointTool";
|
|
10
|
+
export declare const DEFAULT_KEYMAP: Record<EditorAction, string[]>;
|
|
11
|
+
/** KeyboardEvent → 조합키 문자열(예: "mod+shift+z"). 매핑 불가 시 null. */
|
|
12
|
+
export declare function eventToCombo(e: KeyboardEvent): string | null;
|
|
13
|
+
export type KeymapOverrides = Partial<Record<EditorAction, string | string[] | null>>;
|
|
14
|
+
/** 기본 keymap에 호스트 재정의를 병합해 조합키→액션 조회 맵을 만든다. */
|
|
15
|
+
export declare function resolveKeymap(overrides?: KeymapOverrides): Map<string, EditorAction>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type Konva from "konva";
|
|
2
|
+
import type { EditorShape, Point, ShapeType } from "./geometry";
|
|
3
|
+
export declare function movedPoints<TMeta>(shape: EditorShape<TMeta>, node: Konva.Node): Point[];
|
|
4
|
+
export declare function applyPointsToNode(node: Konva.Node, type: ShapeType, points: Point[]): void;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Point } from "./geometry";
|
|
2
|
+
/**
|
|
3
|
+
* 미니맵/캔버스에 그리는 **도메인 무관 보조 표시물**.
|
|
4
|
+
*
|
|
5
|
+
* 에디터는 이게 "ROI"인지 "제외영역"인지 의미를 모른다 — 순수 기하(사각형/다각형)와
|
|
6
|
+
* 색(팔레트)만 안다. 호스트가 자기 도메인 데이터(클래스색·인덱스맵 등)에서 계산해
|
|
7
|
+
* 주입하고, 에디터는 그대로 그리기만 한다. 비즈니스 로직 비종속.
|
|
8
|
+
*/
|
|
9
|
+
/** 관심영역(ROI) — 이미지 좌표 사각형. 이 영역 밖은 어둡게 처리된다. */
|
|
10
|
+
export interface RoiRect {
|
|
11
|
+
id?: string;
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
w: number;
|
|
15
|
+
h: number;
|
|
16
|
+
}
|
|
17
|
+
/** 제외영역 — ROI 안에서 다시 빼내는 다각형(이미지 좌표). */
|
|
18
|
+
export interface ExcludedZone {
|
|
19
|
+
points: Point[];
|
|
20
|
+
}
|
|
21
|
+
/** 마스크 팔레트 — 픽셀 인덱스값 → 색(hex). 호스트가 클래스색에서 계산해 주입. */
|
|
22
|
+
export type MaskPalette = Record<number, string>;
|
|
23
|
+
/**
|
|
24
|
+
* 디코딩된 가이드 마스크 래스터. `indices`는 width*height 픽셀 인덱스이고
|
|
25
|
+
* 인덱스→색은 palette로 결정한다. transparent 인덱스는 그리지 않는다.
|
|
26
|
+
* 서버/도메인별 와이어 포맷(바이너리 헤더 등) 디코딩은 호스트 책임 —
|
|
27
|
+
* 에디터는 순수 래스터만 받는다(LabelEditor/guideMask.ts 참고).
|
|
28
|
+
*/
|
|
29
|
+
export interface GuideMaskRaster {
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
32
|
+
indices: Uint8Array;
|
|
33
|
+
transparent?: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 가이드 마스크 래스터 + 팔레트(인덱스→색)를 컬러 캔버스로 그린다.
|
|
37
|
+
* 실패하면 null. 결과 캔버스는 이미지 원본 해상도(width×height).
|
|
38
|
+
*/
|
|
39
|
+
export declare const buildMaskCanvas: (raster: GuideMaskRaster, palette: MaskPalette) => HTMLCanvasElement | null;
|
|
40
|
+
/**
|
|
41
|
+
* 렌더러 오버레이용 ROI 데이터. 딤(면)은 이미지 좌표 래스터로 굽고,
|
|
42
|
+
* 점선 테두리는 벡터 윤곽을 넘겨 각 렌더러가 화면고정(줌 무관) 스트로크로 그린다.
|
|
43
|
+
*/
|
|
44
|
+
export interface RoiOverlayData {
|
|
45
|
+
dimCanvas: HTMLCanvasElement;
|
|
46
|
+
rects: RoiRect[];
|
|
47
|
+
zones: ExcludedZone[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* ROI(관심영역) 딤 오버레이를 이미지 좌표 캔버스로 그린다.
|
|
51
|
+
* 전체를 반투명 검정으로 덮고 ROI 안을 뚫는다(제외영역은 다시 덮음). 테두리는 안 그림 —
|
|
52
|
+
* 줌해도 두께·점선이 고정되도록 렌더러가 벡터로 그린다(RoiOverlayData.rects/zones).
|
|
53
|
+
* 렌더러 오버레이 레이어(이미지↔도형 사이)에 스프라이트로 올려 레이블이 그 위에 보이게 한다.
|
|
54
|
+
*/
|
|
55
|
+
export declare const buildRoiOverlayData: (rois: RoiRect[], excludedZones: ExcludedZone[] | undefined, width: number, height: number) => RoiOverlayData | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 지도 핀(물방울) 마커 — 기존 옵스 에디터의 pin.svg를 그대로 가져온 것.
|
|
3
|
+
* POINT 도형을 점(dot) 대신 핀 아이콘으로 렌더할 때 쓴다. 팁은 하단중앙 (8,22).
|
|
4
|
+
* 렌더러는 이 경로를 그리고 하단중앙을 도형 좌표에 맞춘 뒤, 뷰포트 반비례 스케일로
|
|
5
|
+
* 화면 크기를 일정하게 유지한다.
|
|
6
|
+
*/
|
|
7
|
+
export declare const PIN_PATH = "M8 0C12.4183 0 16 3.58172 16 8C16 11.5323 13.71 14.5277 10.5342 15.5879L10.166 20.0068C10.0721 21.1334 9.13046 22 8 22C6.86954 22 5.92786 21.1334 5.83398 20.0068L5.46484 15.5879C2.28949 14.5275 0 11.532 0 8C0 3.58172 3.58172 0 8 0Z";
|
|
8
|
+
export declare const PIN_WIDTH = 16;
|
|
9
|
+
export declare const PIN_HEIGHT = 22;
|
|
10
|
+
export declare const PIN_STROKE = "#ffffff";
|
|
11
|
+
export declare const PIN_STROKE_WIDTH = 1.5;
|
|
12
|
+
/** pixi Graphics.svg()용 최소 SVG 문자열(색 입힘). */
|
|
13
|
+
export declare function pinSvg(fill: string): string;
|