@aivex/ui 1.2.0-dev.1 → 1.2.0-dev.10

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 (96) hide show
  1. package/dist/Button-C_GP2mJ-.cjs +2 -0
  2. package/dist/Button-C_GP2mJ-.cjs.map +1 -0
  3. package/dist/Button-CzqDPqUT.js +8600 -0
  4. package/dist/Button-CzqDPqUT.js.map +1 -0
  5. package/dist/IconButton-B-MspnYP.cjs +2 -0
  6. package/dist/IconButton-B-MspnYP.cjs.map +1 -0
  7. package/dist/IconButton-DTGSfJme.js +560 -0
  8. package/dist/IconButton-DTGSfJme.js.map +1 -0
  9. package/dist/Switch-B2irM7Pp.js +2656 -0
  10. package/dist/Switch-B2irM7Pp.js.map +1 -0
  11. package/dist/Switch-CMKBdqkX.cjs +42 -0
  12. package/dist/Switch-CMKBdqkX.cjs.map +1 -0
  13. package/dist/comment.cjs +114 -0
  14. package/dist/comment.cjs.map +1 -0
  15. package/dist/comment.js +13624 -0
  16. package/dist/comment.js.map +1 -0
  17. package/dist/components/Coachmark/Coachmark.d.ts +54 -0
  18. package/dist/components/Coachmark/index.d.ts +2 -0
  19. package/dist/components/Comment/CommentInput.d.ts +30 -0
  20. package/dist/components/Comment/CommentPin.d.ts +17 -0
  21. package/dist/components/Comment/MentionInput.d.ts +30 -0
  22. package/dist/components/Comment/MentionList.d.ts +14 -0
  23. package/dist/components/Comment/index.d.ts +4 -0
  24. package/dist/components/Comment/types.d.ts +12 -0
  25. package/dist/components/Comment/useMentionSuggestion.d.ts +15 -0
  26. package/dist/components/DataGrid/DataGrid.d.ts +11 -1
  27. package/dist/components/DataGrid/DataGridColumnSettings.d.ts +18 -0
  28. package/dist/components/DataGrid/index.d.ts +2 -0
  29. package/dist/components/DatePicker/DatePicker.d.ts +5 -3
  30. package/dist/components/Icon/index.d.ts +5 -4
  31. package/dist/components/InputBase/InputBase.d.ts +5 -7
  32. package/dist/components/Logo/index.d.ts +2 -1
  33. package/dist/components/Messagebox/Messagebox.d.ts +3 -1
  34. package/dist/components/Modal/Modal.d.ts +9 -2
  35. package/dist/components/Modal/index.d.ts +1 -1
  36. package/dist/components/SelectBox/SelectBox.d.ts +7 -4
  37. package/dist/components/ShapeEditor/ShapeEditor.d.ts +9 -0
  38. package/dist/components/ShapeEditor/ShapeViewer.d.ts +42 -0
  39. package/dist/components/ShapeEditor/_components/AssistantOverlay.d.ts +17 -0
  40. package/dist/components/ShapeEditor/_components/ContextMenu.d.ts +13 -0
  41. package/dist/components/ShapeEditor/_components/CursorGuide.d.ts +8 -0
  42. package/dist/components/ShapeEditor/_components/ImageStateOverlay.d.ts +11 -0
  43. package/dist/components/ShapeEditor/_components/Minimap.d.ts +45 -0
  44. package/dist/components/ShapeEditor/_components/MinimapShape.d.ts +6 -0
  45. package/dist/components/ShapeEditor/_components/RegionOverlay.d.ts +21 -0
  46. package/dist/components/ShapeEditor/_components/SelectionInfo.d.ts +13 -0
  47. package/dist/components/ShapeEditor/_components/SettingsPanel.d.ts +15 -0
  48. package/dist/components/ShapeEditor/_constants.d.ts +33 -0
  49. package/dist/components/ShapeEditor/_model/brush.d.ts +3 -0
  50. package/dist/components/ShapeEditor/_model/cursors.d.ts +18 -0
  51. package/dist/components/ShapeEditor/_model/geometry.d.ts +130 -0
  52. package/dist/components/ShapeEditor/_model/imageFetch.d.ts +9 -0
  53. package/dist/components/ShapeEditor/_model/imageTiles.d.ts +11 -0
  54. package/dist/components/ShapeEditor/_model/keymap.d.ts +15 -0
  55. package/dist/components/ShapeEditor/_model/konva.d.ts +4 -0
  56. package/dist/components/ShapeEditor/_model/overlays.d.ts +122 -0
  57. package/dist/components/ShapeEditor/_model/overlays.test.d.ts +1 -0
  58. package/dist/components/ShapeEditor/_model/pinIcon.d.ts +13 -0
  59. package/dist/components/ShapeEditor/_model/props.d.ts +445 -0
  60. package/dist/components/ShapeEditor/_model/scalarMask.d.ts +21 -0
  61. package/dist/components/ShapeEditor/_model/shapeRenderStyle.d.ts +16 -0
  62. package/dist/components/ShapeEditor/_model/strings.d.ts +53 -0
  63. package/dist/components/ShapeEditor/_model/tools.d.ts +27 -0
  64. package/dist/components/ShapeEditor/_model/viewSettings.d.ts +15 -0
  65. package/dist/components/ShapeEditor/_model/viewport.d.ts +28 -0
  66. package/dist/components/ShapeEditor/_renderers/KonvaRenderer.d.ts +124 -0
  67. package/dist/components/ShapeEditor/_renderers/PixiRenderer.d.ts +169 -0
  68. package/dist/components/ShapeEditor/_renderers/transformSession.d.ts +68 -0
  69. package/dist/components/ShapeEditor/_renderers/types.d.ts +106 -0
  70. package/dist/components/ShapeEditor/_state/createInteractionController.d.ts +54 -0
  71. package/dist/components/ShapeEditor/_state/drawSessionState.d.ts +6 -0
  72. package/dist/components/ShapeEditor/_state/useAssistant.d.ts +48 -0
  73. package/dist/components/ShapeEditor/_state/useDrawSession.d.ts +61 -0
  74. package/dist/components/ShapeEditor/_state/useEditorDocument.d.ts +23 -0
  75. package/dist/components/ShapeEditor/_state/useEditorHotkeys.d.ts +25 -0
  76. package/dist/components/ShapeEditor/_state/useEngineLifecycle.d.ts +58 -0
  77. package/dist/components/ShapeEditor/_state/useMinimapNavigation.d.ts +27 -0
  78. package/dist/components/ShapeEditor/_state/useMinimapSync.d.ts +24 -0
  79. package/dist/components/ShapeEditor/_state/useSelectionActions.d.ts +28 -0
  80. package/dist/components/ShapeEditor/_state/useViewportControls.d.ts +23 -0
  81. package/dist/components/ShapeEditor/index.d.ts +8 -0
  82. package/dist/components/Slider/Slider.d.ts +3 -1
  83. package/dist/components/Tagbox/Tagbox.d.ts +1 -4
  84. package/dist/components/Textarea/Textarea.d.ts +7 -4
  85. package/dist/components/Textbox/Textbox.d.ts +1 -5
  86. package/dist/index.cjs +10 -46
  87. package/dist/index.cjs.map +1 -1
  88. package/dist/index.d.ts +1 -0
  89. package/dist/index.js +7919 -16785
  90. package/dist/index.js.map +1 -1
  91. package/dist/shape-editor.cjs +2 -0
  92. package/dist/shape-editor.cjs.map +1 -0
  93. package/dist/shape-editor.js +5735 -0
  94. package/dist/shape-editor.js.map +1 -0
  95. package/dist/styles.css +1 -1
  96. package/package.json +24 -2
@@ -0,0 +1,13 @@
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, hideDot, formatInfo, register, }: {
8
+ shapes: EditorShape<TMeta>[];
9
+ getLabel?: (shape: EditorShape<TMeta>) => string | undefined;
10
+ hideDot?: boolean;
11
+ formatInfo?: (info: EditorSelectionInfo<TMeta>) => string;
12
+ register: (id: string, el: HTMLDivElement | null) => void;
13
+ }): 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,3 @@
1
+ import type { Point } from "./geometry";
2
+ /** RDP 경로 단순화(이미지 좌표). */
3
+ export declare function simplifyPath(points: Point[], epsilon?: number): Point[];
@@ -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,130 @@
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
+ /** 점선의 빈 구간에 표시할 보조색. 지정하면 보조색 실선 위에 주색 점선을 그린다. */
25
+ alternateColor?: string;
26
+ filled?: boolean;
27
+ opacity?: number;
28
+ /** 도형별 선 두께(화면 px). 없으면 에디터 기본값을 사용한다. */
29
+ strokeWidth?: number;
30
+ /** 채움 투명도(0~1). 없으면 렌더러 기본값을 사용한다. */
31
+ fillOpacity?: number;
32
+ /** 점선 패턴(화면 px). */
33
+ dash?: number[];
34
+ /** POINT 도형 반경(화면 px). */
35
+ pointRadius?: number;
36
+ /** 렌더 순서. 없으면 문서 배열 순서를 따른다. */
37
+ zIndex?: number;
38
+ }
39
+ export interface ShapeInteraction {
40
+ /** false면 렌더하지 않고 hit-test/선택/편집에서도 제외한다. */
41
+ visible?: boolean;
42
+ /** false면 도형 클릭·마퀴·선택 API에서 선택 대상이 되지 않는다. */
43
+ selectable?: boolean;
44
+ /** false면 본체 드래그 이동을 막는다. */
45
+ draggable?: boolean;
46
+ /** false면 트랜스포머/꼭짓점 편집/삭제 같은 문서 변경 편집을 막는다. */
47
+ editable?: boolean;
48
+ /** true면 렌더는 하되 포인터 hit-test 대상에서 제외한다. */
49
+ hitTestDisabled?: boolean;
50
+ }
51
+ /**
52
+ * 에디터가 그리고 편집하는 단위.
53
+ * - POINT: points 1개, RECTANGLE·ELLIPSE: 2개(대각 bbox), ROTATED_RECTANGLE: 4개,
54
+ * POLYGON: N개(닫힘), LINE: N개(열린 폴리라인/자유곡선).
55
+ * - id: **클라이언트 생성**(에디터가 도형 생성 시 부여). 서버 id는 에디터가 모른다 —
56
+ * 호스트가 clientId↔serverId 매핑을 들거나 meta에 보관한다.
57
+ * - meta: 호스트 전용 불투명 데이터(classId, serverId 등). 에디터는 읽지 않고 보존만 한다.
58
+ * - style: 렌더 힌트(색/채움). 호스트가 클래스→색을 계산해 주입/시드한다.
59
+ */
60
+ export interface EditorShape<TMeta = unknown> {
61
+ id: string;
62
+ type: ShapeType;
63
+ points: Point[];
64
+ rotation?: number;
65
+ /**
66
+ * 편집 불가(예: 모델 예측/평가 도형). 하위 호환 shorthand이며 selectable은 유지하고
67
+ * draggable/editable만 false처럼 취급한다.
68
+ */
69
+ readOnly?: boolean;
70
+ interaction?: ShapeInteraction;
71
+ style?: ShapeStyle;
72
+ meta?: TMeta;
73
+ }
74
+ export interface Viewport {
75
+ scale: number;
76
+ position: Point;
77
+ }
78
+ export declare function isShapeVisible(shape: EditorShape): boolean;
79
+ export declare function isShapeHitTestable(shape: EditorShape): boolean;
80
+ export declare function isShapeSelectable(shape: EditorShape): boolean;
81
+ export declare function isShapeEditable(shape: EditorShape): boolean;
82
+ export declare function isShapeDraggable(shape: EditorShape): boolean;
83
+ export declare function sortShapesForRender<TMeta>(shapes: EditorShape<TMeta>[]): EditorShape<TMeta>[];
84
+ export declare function clamp(value: number, min: number, max: number): number;
85
+ export declare function generateId(): string;
86
+ export interface BBox {
87
+ minX: number;
88
+ minY: number;
89
+ maxX: number;
90
+ maxY: number;
91
+ }
92
+ export type Anchor = "tl" | "t" | "tr" | "r" | "br" | "b" | "bl" | "l";
93
+ export declare const ANCHORS: Anchor[];
94
+ export declare function getBBox(points: Point[]): BBox;
95
+ export declare function anchorPoint(anchor: Anchor, b: BBox): Point;
96
+ export declare function boxFromAnchor(anchor: Anchor, b: BBox, hx: number, hy: number): BBox;
97
+ export declare function squareEnd(start: Point, p: Point): Point;
98
+ export declare function rotatePoint(p: Point, pivot: Point, angle: number): Point;
99
+ export declare function rectTo4(points: Point[]): Point[];
100
+ /**
101
+ * 두 점(a,b)이 이루는 바운딩 박스에 **내접하는 타원**을 폴리곤으로 샘플링한다.
102
+ * 그리기 미리보기(previewBox "ellipse": rx=w/2, ry=h/2)와 동일한 도형이어야 커밋 결과가
103
+ * 드래그 중 보이던 것과 일치한다(정사각형 드래그면 원). 예전엔 대각선을 지름으로 한 원을
104
+ * 만들어 미리보기(내접 타원)와 크기·모양이 달랐다.
105
+ */
106
+ export declare function circleToPolygon(a: Point, b: Point, count?: number): Point[];
107
+ /**
108
+ * 볼록 껍질(Andrew monotone chain). 입력 점들의 볼록 다각형 코너를 반시계로 반환.
109
+ * 3점 미만이면 입력을 그대로 돌려준다(최소사각형 계산의 전처리용).
110
+ */
111
+ export declare function convexHull(points: Point[]): Point[];
112
+ /**
113
+ * 최소 넓이 회전 사각형(rotating calipers). 점들을 감싸는 넓이 최소의 (기울 수 있는)
114
+ * 사각형 4개 코너를 둘레 순서로 반환한다. OBB(회전 바운딩박스) 어시스트 결과 변환용.
115
+ * 최소사각형의 한 변은 반드시 볼록껍질의 한 변과 평행하다는 성질을 이용한다.
116
+ */
117
+ export declare function minAreaRect(points: Point[]): Point[];
118
+ export declare const vsub: (a: Point, b: Point) => Point;
119
+ export declare const vdot: (a: Point, b: Point) => number;
120
+ export declare const vlen: (a: Point) => number;
121
+ export declare const vnorm: (a: Point) => Point;
122
+ export declare const mid: (a: Point, b: Point) => Point;
123
+ export declare const centerOf: (pts: Point[]) => Point;
124
+ export declare function orientedHandles(c: Point[]): Point[];
125
+ export declare function rotateHandlePos(c: Point[], gap: number): Point;
126
+ /** 회전 사각형 위변(tl→tr) 각도(라디안). */
127
+ export declare function rotatedRectAngle(points: Point[]): number;
128
+ export declare function localBoxToCorners(box: BBox, R: Point, u: Point, v: Point): Point[];
129
+ export declare function resizeRotatedRectFromAnchor(points: Point[], anchor: Anchor, target: Point): Point[];
130
+ export declare function rescalePoints(points: Point[], from: BBox, to: BBox): Point[];
@@ -0,0 +1,9 @@
1
+ /**
2
+ * CORS 안전 이미지 blob URL 로드 — HTTP 캐시를 우선 사용한다(재방문·페이지 전환·
3
+ * 화질 스왑 시 재다운로드 없음). 앱 다른 곳의 crossOrigin 없는 `<img>`가 캐시를
4
+ * CORS 헤더 없는 응답으로 채웠으면 cors fetch가 실패하므로, 그때만 cache:"reload"로
5
+ * 캐시 항목을 정상 CORS 응답으로 갈아끼우며 한 번 더 시도한다.
6
+ * 둘 다 실패하면 null — 호출부가 crossOrigin="anonymous" `<img>`로 폴백한다.
7
+ * Konva/Pixi 렌더러와 ShapeViewer가 공유한다.
8
+ */
9
+ export declare function fetchImageObjectUrl(url: string): Promise<string | null>;
@@ -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" | "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,122 @@
1
+ import type { Point } from "./geometry";
2
+ /**
3
+ * 미니맵/캔버스에 그리는 **도메인 무관 보조 표시물**.
4
+ *
5
+ * 에디터는 이게 "ROI"인지 "제외영역"인지 의미를 모른다 — 순수 기하(사각형/다각형)와
6
+ * 색(팔레트)만 안다. 호스트가 자기 도메인 데이터(클래스색·인덱스맵 등)에서 계산해
7
+ * 주입하고, 에디터는 그대로 그리기만 한다. 비즈니스 로직 비종속.
8
+ */
9
+ /** 이미지 좌표 사각형 영역 — 가림 효과에서 "보이는 창"(예: 호스트의 관심영역). */
10
+ export interface RectArea {
11
+ id?: string;
12
+ x: number;
13
+ y: number;
14
+ w: number;
15
+ h: number;
16
+ }
17
+ /** 이미지 좌표 다각형 영역 — 보이는 창 안에서 다시 가리는 부분(예: 호스트의 마스킹). */
18
+ export interface PolygonArea {
19
+ points: Point[];
20
+ }
21
+ /** @deprecated 도메인 중립화로 `RectArea`로 개명. 다음 릴리스에서 제거 예정. */
22
+ export type RoiRect = RectArea;
23
+ /** @deprecated 도메인 중립화로 `PolygonArea`로 개명. 다음 릴리스에서 제거 예정. */
24
+ export type ExcludedZone = PolygonArea;
25
+ /** 영역 윤곽 스트로크 — 화면 px 기준(줌과 무관하게 고정). */
26
+ export interface RegionOutlineStyle {
27
+ color?: string;
28
+ opacity?: number;
29
+ /** 두께(화면 px). */
30
+ width?: number;
31
+ /** 점선 패턴(화면 px). */
32
+ dash?: [number, number];
33
+ /** 점선 빈 구간의 밑선 색(대비용). null이면 밑선 없음. 기본 검정. */
34
+ underlayColor?: string | null;
35
+ }
36
+ /**
37
+ * 이미지 위 가림 효과를 위한 순수 시각 계약. 영역의 제품 의미(관심영역·마스킹 등)는
38
+ * 호스트가 해석하고, 에디터는 "보이는 영역과 가려지는 영역"만 안다.
39
+ * 표시 정책(딤 농도·윤곽 색)은 기본값일 뿐 호스트가 전부 재정의할 수 있다.
40
+ */
41
+ export interface RegionMask {
42
+ visibleAreas: RectArea[];
43
+ occludedAreas?: PolygonArea[];
44
+ /** 가림 면 스타일. 기본 검정 50%. */
45
+ dim?: {
46
+ color?: string;
47
+ opacity?: number;
48
+ };
49
+ /**
50
+ * 윤곽 표시. false면 면만 그리고 윤곽은 도형 레이어에 맡긴다. 미지정=기본 스타일.
51
+ * mode "merged"(기본)=유효 영역(합집합 − 가림) 경계 하나를 visibleStyle로(보기 맥락),
52
+ * "separate"=사각형·가림 윤곽을 각각 visibleStyle/occludedStyle로 통째 표시(편집 맥락).
53
+ */
54
+ outline?: false | {
55
+ mode?: "merged" | "separate";
56
+ visibleStyle?: RegionOutlineStyle;
57
+ occludedStyle?: RegionOutlineStyle;
58
+ };
59
+ }
60
+ /** 마스크 팔레트 — 픽셀 인덱스값 → 색(hex). 호스트가 클래스색에서 계산해 주입. */
61
+ export type MaskPalette = Record<number, string>;
62
+ /**
63
+ * 디코딩된 가이드 마스크 래스터. `indices`는 width*height 픽셀 인덱스이고
64
+ * 인덱스→색은 palette로 결정한다. transparent 인덱스는 그리지 않는다.
65
+ * 서버/도메인별 와이어 포맷(바이너리 헤더 등) 디코딩은 호스트 책임 —
66
+ * 에디터는 순수 래스터만 받는다(LabelEditor/guideMask.ts 참고).
67
+ */
68
+ export interface GuideMaskRaster {
69
+ width: number;
70
+ height: number;
71
+ indices: Uint8Array;
72
+ transparent?: number;
73
+ }
74
+ /**
75
+ * 가이드 마스크 래스터 + 팔레트(인덱스→색)를 컬러 캔버스로 그린다.
76
+ * 실패하면 null. 결과 캔버스는 이미지 원본 해상도(width×height).
77
+ */
78
+ export declare const buildMaskCanvas: (raster: GuideMaskRaster, palette: MaskPalette) => HTMLCanvasElement | null;
79
+ /** 이미지 좌표 선분. 렌더러가 화면고정(줌 무관) 점선 스트로크로 그린다. */
80
+ export type OutlineSegment = [Point, Point];
81
+ /**
82
+ * Canvas2D에 벡터 딤을 그린다 — 이미지 전체를 딤 색으로 덮되 보이는 영역 합집합을
83
+ * 구멍(dimHoles, 무겹침이라 nonzero에서 안전)으로 뚫고, 가림 영역은 합집합 안쪽만
84
+ * 다시 덮는다. Konva 렌더러와 ShapeViewer가 공유한다(전체 경로 커버리지 채움이라
85
+ * 인접 구멍 경계에 이음선이 생기지 않는다).
86
+ */
87
+ export declare function drawRegionDim(ctx: CanvasRenderingContext2D, region: Pick<RegionOverlayData, "rects" | "zones" | "dimHoles" | "dim">, width: number, height: number): void;
88
+ /** 기본값이 채워진 윤곽 스트로크 — 렌더러가 그대로 그린다. */
89
+ export type ResolvedRegionOutlineStyle = Required<RegionOutlineStyle>;
90
+ /**
91
+ * 렌더러 오버레이용 영역 데이터. 딤(면)·윤곽 모두 벡터로 넘긴다 —
92
+ * 래스터(캔버스 굽기 + 텍스처 업로드)가 없어 드래그 중 프레임마다 재계산해도 싸다.
93
+ * 딤은 rects/zones로 각 렌더러가 직접 그리고(이미지 전체 − 사각형 합집합, 가림은
94
+ * 합집합 안쪽만 다시 덮음), 윤곽은 선분 목록을 화면고정(줌 무관) 스트로크로 그린다.
95
+ */
96
+ export interface RegionOverlayData {
97
+ /** 딤 계산용 보이는 창들. visibleAreas가 비어 있으면 전체 이미지 사각형 1개. */
98
+ rects: RectArea[];
99
+ zones: PolygonArea[];
100
+ /** 사각형 합집합의 무겹침 분해 — 캔버스 딤 경로의 구멍용(겹치는 영역 안전). */
101
+ dimHoles: RectArea[];
102
+ dim: {
103
+ color: string;
104
+ opacity: number;
105
+ };
106
+ /** visibleStyle로 그릴 경계 조각. merged면 유효 영역 경계 전체가 여기 담긴다. */
107
+ visibleOutline: OutlineSegment[];
108
+ /** occludedStyle로 그릴 가림 윤곽 조각(separate 모드에서만 비어있지 않음). */
109
+ occludedOutline: OutlineSegment[];
110
+ /** null이면 윤곽 생략(outline: false). */
111
+ outlineStyles: {
112
+ visible: ResolvedRegionOutlineStyle;
113
+ occluded: ResolvedRegionOutlineStyle;
114
+ } | null;
115
+ }
116
+ /**
117
+ * RegionMask를 렌더러가 그릴 벡터 데이터로 리졸브한다(기본 표시 정책 주입 포함).
118
+ * outline.mode "merged"(기본)면 유효 영역(합집합 − 가림) 경계 하나를,
119
+ * "separate"면 사각형·가림 윤곽을 각각 통째로 넘긴다.
120
+ * 렌더러 오버레이 레이어(이미지↔도형 사이)에 그려 도형이 그 위에 보이게 한다.
121
+ */
122
+ export declare const buildRegionOverlayData: (mask: RegionMask, width: number, height: number) => RegionOverlayData | 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;