@servantcdh/ez-planet-labeling 0.1.1 → 0.3.1

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/index.d.ts CHANGED
@@ -64,6 +64,11 @@ export declare interface BrushGeometry {
64
64
  path: string;
65
65
  }
66
66
 
67
+ declare interface BrushOptions {
68
+ lineCap: string;
69
+ lineWidth: number;
70
+ }
71
+
67
72
  declare interface BrushState {
68
73
  brush: {
69
74
  id: number;
@@ -139,6 +144,18 @@ export { CanvasState_2 as CanvasState }
139
144
  */
140
145
  export declare const canvasToAnnotations: (objects: LabeledFabricObject[], imageWidth: number, imageHeight: number) => Promise<Annotation[]>;
141
146
 
147
+ declare interface ClassificationLabelEntry {
148
+ tempId: string;
149
+ labelId: string | null;
150
+ policyId: string;
151
+ classIndex: number;
152
+ className: string;
153
+ labelValue: unknown;
154
+ attributeValues?: Record<string, unknown>;
155
+ color?: string;
156
+ opacity?: number;
157
+ }
158
+
142
159
  /**
143
160
  * Create an HTMLImageElement from a URL.
144
161
  */
@@ -198,18 +215,98 @@ declare type FabricCanvas = Canvas & {
198
215
  */
199
216
  export declare const fabricObjectToAnnotation: (object: LabeledFabricObject, imageWidth: number, imageHeight: number) => Promise<Annotation | null>;
200
217
 
218
+ export declare interface FileContent {
219
+ endpointUrl?: string;
220
+ fileName?: string;
221
+ fileType?: string;
222
+ }
223
+
224
+ export declare interface FileUploadPayload {
225
+ file: File;
226
+ policyId: string;
227
+ contentSetId: string;
228
+ elementId?: string;
229
+ }
230
+
201
231
  export declare const filledRectTool: () => LabelingTool;
202
232
 
233
+ /**
234
+ * Format a tool name with its shortcut key for display.
235
+ * e.g. formatShortcutTitle("Selection", "v") → "Selection (V)"
236
+ */
237
+ export declare function formatShortcutTitle(title: string, shortcutKey: string): string;
238
+
203
239
  export declare const getActiveLabeledObjects: (targetCanvas?: FabricCanvas) => LabeledFabricObject[];
204
240
 
205
241
  export declare const getCanvasInstance: () => FabricCanvas;
206
242
 
207
243
  export declare const getCanvasJSON: (targetCanvas?: FabricCanvas) => CanvasJSON;
208
244
 
245
+ export declare const getImageToolStore: () => ImageToolState;
246
+
209
247
  export declare const getLabeledObjects: (targetCanvas?: FabricCanvas) => LabeledFabricObject[];
210
248
 
249
+ /**
250
+ * Normalize keyboard event to a shortcut key string.
251
+ * Handles special cases like backslash.
252
+ */
253
+ export declare function getLabelingShortcutKey(event: KeyboardEvent): string;
254
+
211
255
  export declare const getToolSelectionStore: () => ToolSelectionState;
212
256
 
257
+ export declare const getViewModeStore: () => ViewModeState;
258
+
259
+ declare type IconSize = 'xxs' | 'xs' | 'sm' | 'md' | 'lg';
260
+
261
+ declare interface ImageToolState {
262
+ tool: LabelingTool | null;
263
+ setTool: (tool: LabelingTool | null) => void;
264
+ overedUniques: string[];
265
+ setOveredUniques: (overedUniques: string[]) => void;
266
+ undoStack: string[];
267
+ redoStack: string[];
268
+ setUndoStack: (undoStack: string[]) => void;
269
+ setRedoStack: (redoStack: string[]) => void;
270
+ toolHistory: string[];
271
+ }
272
+
273
+ declare interface IssuePanelState {
274
+ isOpen: boolean;
275
+ open: () => void;
276
+ close: () => void;
277
+ toggle: () => void;
278
+ }
279
+
280
+ declare interface KeyboardShortcutsConfig {
281
+ viewMode: WorkspaceViewMode;
282
+ isValidationMode: boolean;
283
+ setTool: (toolType: ToolType) => void;
284
+ onUndo?: () => void;
285
+ onRedo?: () => void;
286
+ disabled?: boolean;
287
+ }
288
+
289
+ declare interface LabelBatchState {
290
+ classificationLabels: ClassificationLabelEntry[];
291
+ classificationDeletedIds: string[];
292
+ inserts: LabelInsertData[];
293
+ updates: LabelUpdateData[];
294
+ deletes: LabelDeleteData[];
295
+ labelDataRevision: number;
296
+ addClassificationLabel: (label: ClassificationLabelEntry) => void;
297
+ removeClassificationLabel: (tempId: string) => void;
298
+ removeClassificationLabelById: (labelId: string) => void;
299
+ clearTemporaryClassificationLabels: () => void;
300
+ clearPendingChanges: () => void;
301
+ hasPendingChanges: () => boolean;
302
+ bumpLabelDataRevision: () => void;
303
+ reset: () => void;
304
+ }
305
+
306
+ export declare interface LabelDeleteData {
307
+ id: string;
308
+ }
309
+
213
310
  declare interface LabeledFabricObject extends FabricObject {
214
311
  info?: string;
215
312
  unique?: string;
@@ -273,6 +370,36 @@ declare type LabelEventListener = (action: LabelEventType, data?: LabelEventData
273
370
 
274
371
  declare type LabelEventType = 'load' | 'selected' | 'deleted' | 'zoom' | 'copy' | 'paste' | 'deleteSelected' | 'selectAll' | 'reset' | 'combine' | 'seq' | 'addClass' | 'deleteObjectsOfTool' | 'addObjects' | 'deselectAll' | 'undo' | 'redo' | 'changed' | 'blur' | 'focus' | 'init';
275
372
 
373
+ /**
374
+ * Keyboard shortcut definitions matching portal-iris-web.
375
+ */
376
+ export declare const LABELING_SHORTCUTS: {
377
+ readonly common: {
378
+ readonly selection: "v";
379
+ readonly layerToggle: "\\";
380
+ readonly navigationToggle: "g";
381
+ };
382
+ readonly image: {
383
+ readonly boundingBox: "u";
384
+ readonly pen: "p";
385
+ readonly brush: "b";
386
+ readonly magicBrush: "w";
387
+ readonly superpixel: "x";
388
+ readonly eraser: "e";
389
+ };
390
+ readonly text: {
391
+ readonly highlighting: "h";
392
+ readonly autoHighlight: "a";
393
+ };
394
+ readonly number: {
395
+ readonly highlighting: "h";
396
+ };
397
+ readonly validation: {
398
+ readonly rangeSelection: "s";
399
+ readonly issue: "i";
400
+ };
401
+ };
402
+
276
403
  export declare function LabelingCanvas({ image, annotations, onChange, readOnly, width, height, }: LabelingCanvasProps): JSX_2.Element;
277
404
 
278
405
  declare interface LabelingCanvasProps {
@@ -296,7 +423,7 @@ export declare interface LabelingClass {
296
423
  group?: string;
297
424
  }
298
425
 
299
- declare interface LabelingContextValue {
426
+ export declare interface LabelingContextValue {
300
427
  image: string | {
301
428
  url: string;
302
429
  width: number;
@@ -304,17 +431,30 @@ declare interface LabelingContextValue {
304
431
  };
305
432
  annotations: Annotation[];
306
433
  onChange: (event: CanvasChangeEvent) => void;
434
+ viewMode: WorkspaceViewMode;
435
+ onViewModeChange: (mode: WorkspaceViewMode) => void;
436
+ availableViewModes: WorkspaceViewMode[];
437
+ textContent?: TextContent;
438
+ numberContent?: NumberContent;
439
+ fileContent?: FileContent;
307
440
  records: WorkspaceRecord[];
308
441
  activeRecordId: string;
309
442
  onRecordSelect: (record: WorkspaceRecord) => void;
310
443
  classes: LabelingClass[];
444
+ policies: LabelingPolicy[];
311
445
  onClassSelect?: (cls: LabelingClass) => void;
312
446
  selectedClassId: string | null;
313
447
  setSelectedClassId: (id: string | null) => void;
314
448
  selectedAnnotationId: string | null;
315
449
  setSelectedAnnotationId: (id: string | null) => void;
316
- onSave: (state: CanvasState_2) => void | Promise<void>;
450
+ onSave: (payload: SavePayload) => void | Promise<void>;
451
+ onSaveToRecord?: () => void;
452
+ onFileUpload?: (file: File) => void;
317
453
  isSaving: boolean;
454
+ onNavigateLeft?: () => void;
455
+ onNavigateRight?: () => void;
456
+ canNavigateLeft: boolean;
457
+ canNavigateRight: boolean;
318
458
  mode: WorkspaceMode;
319
459
  onModeChange?: (mode: WorkspaceMode) => void;
320
460
  validationResults: ValidationResult[];
@@ -335,6 +475,18 @@ export declare interface LabelingExtension {
335
475
  render: (context: ExtensionContext) => ReactNode;
336
476
  }
337
477
 
478
+ /**
479
+ * File labeling section.
480
+ * Shows file info when a file exists, or an upload area when empty.
481
+ */
482
+ export declare function LabelingFileSection({ content, readOnly, onFileUpload, }: LabelingFileSectionProps): JSX_2.Element;
483
+
484
+ declare interface LabelingFileSectionProps {
485
+ content?: FileContent;
486
+ readOnly?: boolean;
487
+ onFileUpload?: (file: File) => void;
488
+ }
489
+
338
490
  export declare function LabelingFloatingToolbar({ items, show, verticalNav, children, }: LabelingFloatingToolbarProps): JSX_2.Element | null;
339
491
 
340
492
  declare interface LabelingFloatingToolbarProps {
@@ -344,6 +496,17 @@ declare interface LabelingFloatingToolbarProps {
344
496
  children?: ReactNode;
345
497
  }
346
498
 
499
+ export declare function LabelingIcon({ iconType, size, className, style, }: LabelingIconProps): JSX_2.Element | null;
500
+
501
+ export declare type LabelingIconName = 'icon-selection' | 'icon-borderd-rect' | 'icon-pen' | 'icon-brush' | 'icon-eraser' | 'icon-magic-wand' | 'icon-superpixel' | 'icon-seg-anything' | 'icon-undo' | 'icon-redo' | 'icon-save' | 'icon-down' | 'icon-all-layer' | 'icon-bottom-layer' | 'icon-top-layer' | 'icon-plus' | 'icon-minus' | 'icon-left' | 'icon-right' | 'icon-issue' | 'icon-labeling' | 'icon-validated' | 'icon-cancel' | 'icon-highlight';
502
+
503
+ declare interface LabelingIconProps {
504
+ iconType: LabelingIconName;
505
+ size?: IconSize;
506
+ className?: string;
507
+ style?: React.CSSProperties;
508
+ }
509
+
347
510
  export declare function LabelingIndicator({ indicator }: LabelingIndicatorProps): JSX_2.Element | null;
348
511
 
349
512
  declare interface LabelingIndicatorProps {
@@ -385,7 +548,32 @@ declare interface LabelingNavigationProps {
385
548
  hidden?: boolean;
386
549
  }
387
550
 
388
- export declare function LabelingProvider({ image, annotations, onChange, records, activeRecordId, onRecordSelect, classes, onClassSelect, onSave, isSaving, mode, onModeChange, validationResults, indicator, extensions, tools, theme, layout, children, }: LabelingProviderProps): JSX_2.Element;
551
+ /**
552
+ * Number/chart labeling section.
553
+ * Renders a data table from source data. Chart rendering is delegated to the host
554
+ * app or a future extension (canvas-based chart is complex and library-dependent).
555
+ */
556
+ export declare function LabelingNumberSection({ content, readOnly, segments, }: LabelingNumberSectionProps): JSX_2.Element;
557
+
558
+ declare interface LabelingNumberSectionProps {
559
+ content?: NumberContent;
560
+ readOnly?: boolean;
561
+ segments?: Array<{
562
+ id: string;
563
+ start: number;
564
+ end: number;
565
+ color: string;
566
+ opacity?: number;
567
+ }>;
568
+ }
569
+
570
+ export declare interface LabelingPolicy {
571
+ id: string;
572
+ name: string;
573
+ classes: LabelingClass[];
574
+ }
575
+
576
+ export declare function LabelingProvider({ image, annotations, onChange, viewMode: viewModeProp, onViewModeChange: onViewModeChangeProp, availableViewModes, textContent, numberContent, fileContent, records, activeRecordId, onRecordSelect, classes, policies, onClassSelect, onSave, onSaveToRecord, onFileUpload, isSaving, onNavigateLeft, onNavigateRight, canNavigateLeft, canNavigateRight, mode, onModeChange, validationResults, indicator, extensions, tools, theme, layout, children, }: LabelingProviderProps): JSX_2.Element;
389
577
 
390
578
  declare interface LabelingProviderProps {
391
579
  image: string | {
@@ -395,13 +583,26 @@ declare interface LabelingProviderProps {
395
583
  };
396
584
  annotations: Annotation[];
397
585
  onChange: (event: CanvasChangeEvent) => void;
586
+ viewMode?: WorkspaceViewMode;
587
+ onViewModeChange?: (mode: WorkspaceViewMode) => void;
588
+ availableViewModes?: WorkspaceViewMode[];
589
+ textContent?: TextContent;
590
+ numberContent?: NumberContent;
591
+ fileContent?: FileContent;
398
592
  records: WorkspaceRecord[];
399
593
  activeRecordId: string;
400
594
  onRecordSelect: (record: WorkspaceRecord) => void;
401
595
  classes: LabelingClass[];
596
+ policies?: LabelingPolicy[];
402
597
  onClassSelect?: (cls: LabelingClass) => void;
403
- onSave: (state: CanvasState_2) => void | Promise<void>;
598
+ onSave: (payload: SavePayload) => void | Promise<void>;
599
+ onSaveToRecord?: () => void;
600
+ onFileUpload?: (file: File) => void;
404
601
  isSaving?: boolean;
602
+ onNavigateLeft?: () => void;
603
+ onNavigateRight?: () => void;
604
+ canNavigateLeft?: boolean;
605
+ canNavigateRight?: boolean;
405
606
  mode?: WorkspaceMode;
406
607
  onModeChange?: (mode: WorkspaceMode) => void;
407
608
  validationResults?: ValidationResult[];
@@ -413,6 +614,24 @@ declare interface LabelingProviderProps {
413
614
  children: ReactNode;
414
615
  }
415
616
 
617
+ /**
618
+ * Text labeling section — renders text content with highlighted segments.
619
+ * Users can select text to create new segments via mouseup events.
620
+ */
621
+ export declare function LabelingTextSection({ content, readOnly, segments, }: LabelingTextSectionProps): JSX_2.Element;
622
+
623
+ declare interface LabelingTextSectionProps {
624
+ content?: TextContent;
625
+ readOnly?: boolean;
626
+ segments?: Array<{
627
+ id: string;
628
+ start: number;
629
+ end: number;
630
+ color: string;
631
+ opacity?: number;
632
+ }>;
633
+ }
634
+
416
635
  export declare interface LabelingTheme {
417
636
  primary: string;
418
637
  background: string;
@@ -436,30 +655,43 @@ declare interface LabelingTool {
436
655
  init: (...args: any[]) => Promise<(() => void) | void | undefined> | (() => void) | void;
437
656
  }
438
657
 
439
- export declare function LabelingToolbar({ tools, sections: _sections, onSave, isSaving, onPrev, onNext, hasPrev, hasNext, children, }: LabelingToolbarInternalProps): JSX_2.Element;
658
+ /**
659
+ * Floating toolbar that renders view-mode-aware tools via useLabelingUIMeta.
660
+ * Tool set, icons, and behavior all come from the UIMeta hooks.
661
+ */
662
+ export declare function LabelingToolbar({ children }: LabelingToolbarInternalProps): JSX_2.Element;
440
663
 
441
- declare interface LabelingToolbarInternalProps extends LabelingToolbarProps {
442
- tools?: ToolType[];
664
+ declare interface LabelingToolbarInternalProps {
443
665
  children?: ReactNode;
444
666
  }
445
667
 
446
- export declare interface LabelingToolbarProps {
447
- orientation?: 'horizontal' | 'vertical';
448
- sections?: ToolbarSection[];
449
- onSave?: () => void;
450
- isSaving?: boolean;
451
- onPrev?: () => void;
452
- onNext?: () => void;
453
- hasPrev?: boolean;
454
- hasNext?: boolean;
668
+ declare interface LabelingUIMetaResult {
669
+ toolbar: ToolbarItemMeta[];
455
670
  }
456
671
 
457
672
  /**
458
673
  * Level 1: All-in-one labeling workspace.
459
- * Renders Navigation + Toolbar + Canvas + InfoPanel in a single component.
674
+ * Renders WorkspaceControl + Navigation + WorkspaceSection + FloatingToolbar + InfoPanel.
460
675
  */
461
676
  export declare function LabelingWorkspace(props: LabelingWorkspaceProps): JSX_2.Element;
462
677
 
678
+ export declare function LabelingWorkspaceControl({ viewMode, onViewModeChange, availableViewModes, mode, onModeChange, onSave, onSaveToRecord, isSaving, onNavigateLeft, onNavigateRight, canNavigateLeft, canNavigateRight, }: LabelingWorkspaceControlProps): JSX_2.Element;
679
+
680
+ declare interface LabelingWorkspaceControlProps {
681
+ viewMode: WorkspaceViewMode;
682
+ onViewModeChange?: (mode: WorkspaceViewMode) => void;
683
+ availableViewModes?: WorkspaceViewMode[];
684
+ mode?: WorkspaceMode;
685
+ onModeChange?: (mode: WorkspaceMode) => void;
686
+ onSave?: () => void;
687
+ onSaveToRecord?: () => void;
688
+ isSaving?: boolean;
689
+ onNavigateLeft?: () => void;
690
+ onNavigateRight?: () => void;
691
+ canNavigateLeft?: boolean;
692
+ canNavigateRight?: boolean;
693
+ }
694
+
463
695
  export declare interface LabelingWorkspaceProps {
464
696
  image: string | {
465
697
  url: string;
@@ -468,26 +700,90 @@ export declare interface LabelingWorkspaceProps {
468
700
  };
469
701
  annotations: Annotation[];
470
702
  onChange: (event: CanvasChangeEvent) => void;
703
+ viewMode?: WorkspaceViewMode;
704
+ onViewModeChange?: (mode: WorkspaceViewMode) => void;
705
+ availableViewModes?: WorkspaceViewMode[];
706
+ textContent?: TextContent;
707
+ numberContent?: NumberContent;
708
+ fileContent?: FileContent;
471
709
  records: WorkspaceRecord[];
472
710
  activeRecordId: string;
473
711
  onRecordSelect: (record: WorkspaceRecord) => void;
712
+ onDetailExpand?: (record: WorkspaceRecord, schemaLabel: string) => void;
474
713
  totalRecords?: number;
475
714
  onPageChange?: (page: number) => void;
476
715
  classes: LabelingClass[];
716
+ policies?: LabelingPolicy[];
477
717
  onClassSelect?: (cls: LabelingClass) => void;
478
- onSave: (state: CanvasState_2) => void | Promise<void>;
718
+ onSave: (payload: SavePayload) => void | Promise<void>;
719
+ onSaveToRecord?: (payload: SaveToRecordPayload) => void | Promise<void>;
720
+ onFileUpload?: (payload: FileUploadPayload) => void | Promise<void>;
479
721
  isSaving?: boolean;
722
+ onNavigateLeft?: () => void;
723
+ onNavigateRight?: () => void;
724
+ canNavigateLeft?: boolean;
725
+ canNavigateRight?: boolean;
480
726
  mode?: WorkspaceMode;
481
727
  onModeChange?: (mode: WorkspaceMode) => void;
482
728
  validationResults?: ValidationResult[];
483
729
  onValidate?: (event: ValidateEvent) => void | Promise<void>;
484
730
  onValidationUpdate?: (event: ValidationUpdateEvent) => void | Promise<void>;
485
731
  onValidationDelete?: (event: ValidationDeleteEvent) => void | Promise<void>;
732
+ onSaveValidation?: (payload: SaveValidationPayload) => void | Promise<void>;
486
733
  indicator?: WorkspaceIndicator;
487
734
  extensions?: LabelingExtension[];
488
735
  tools?: ToolType[];
489
736
  theme?: Partial<LabelingTheme>;
490
737
  layout?: WorkspaceLayout;
738
+ isDirty?: boolean;
739
+ dirtyConfirmMessage?: string;
740
+ }
741
+
742
+ /**
743
+ * View-mode switching container.
744
+ * Shows the appropriate content section based on the current view mode.
745
+ */
746
+ export declare function LabelingWorkspaceSection({ viewMode, image, annotations, onChange, readOnly, textContent, numberContent, fileContent, onFileUpload, children, }: LabelingWorkspaceSectionProps): JSX_2.Element;
747
+
748
+ declare interface LabelingWorkspaceSectionProps {
749
+ viewMode: WorkspaceViewMode;
750
+ image: string | {
751
+ url: string;
752
+ width: number;
753
+ height: number;
754
+ };
755
+ annotations: Annotation[];
756
+ onChange?: (event: CanvasChangeEvent) => void;
757
+ readOnly?: boolean;
758
+ textContent?: TextContent;
759
+ numberContent?: NumberContent;
760
+ fileContent?: FileContent;
761
+ onFileUpload?: (file: File) => void;
762
+ children?: ReactNode;
763
+ }
764
+
765
+ export declare interface LabelInsertData {
766
+ policyId: string;
767
+ classIndex: number;
768
+ className: string;
769
+ labelValue: unknown;
770
+ attributeValues?: Record<string, unknown>;
771
+ }
772
+
773
+ declare interface LabelSelectionState {
774
+ selectedClassificationId: string | null;
775
+ selectedClassificationInfo: SelectedClassificationInfo | null;
776
+ setSelectedClassificationId: (id: string | null, info?: SelectedClassificationInfo | null) => void;
777
+ }
778
+
779
+ export declare interface LabelUpdateData extends LabelInsertData {
780
+ id: string;
781
+ }
782
+
783
+ declare interface LabelVisibilityState {
784
+ hiddenClassificationIds: Record<string, boolean>;
785
+ setClassificationVisibility: (labelId: string, hidden: boolean) => void;
786
+ reset: () => void;
491
787
  }
492
788
 
493
789
  export declare const LAYER_MODE: Record<string, LayerMode>;
@@ -500,10 +796,79 @@ declare interface LayerModeState {
500
796
  cycleMode: () => void;
501
797
  }
502
798
 
799
+ declare type LayoutDirection = 'horizontal' | 'vertical';
800
+
503
801
  export declare const loadFabric: () => Promise<fabric>;
504
802
 
505
803
  export declare const magicbrushTool: () => LabelingTool;
506
804
 
805
+ export declare interface NavigationCellAccessories {
806
+ badges?: NavigationCellBadge[];
807
+ hasIssue?: boolean;
808
+ hasValidationCompleted?: boolean;
809
+ }
810
+
811
+ export declare interface NavigationCellBadge {
812
+ title: string;
813
+ style: 'primary-light' | 'secondary-light';
814
+ }
815
+
816
+ export declare interface NavigationDetailData {
817
+ rows: Record<string, unknown>[];
818
+ columns?: string[];
819
+ }
820
+
821
+ export declare interface NavigationSchema {
822
+ label: string;
823
+ contentType: string;
824
+ isRequired: boolean;
825
+ maxItems?: number | null;
826
+ }
827
+
828
+ export declare interface NumberContent {
829
+ mode: 'line' | 'bar';
830
+ xAxis: {
831
+ label: string;
832
+ ticks: unknown[];
833
+ };
834
+ yAxis: {
835
+ label: string;
836
+ series: unknown[];
837
+ };
838
+ source: {
839
+ rows: unknown[];
840
+ columns: unknown[];
841
+ };
842
+ canRender: boolean;
843
+ }
844
+
845
+ declare interface NumberLabelingTool {
846
+ id: 'selection' | 'drag-segment';
847
+ label: string;
848
+ }
849
+
850
+ declare interface NumberSegmentSelection {
851
+ key: string;
852
+ labelId: string | null;
853
+ tempId: string | null;
854
+ start: number;
855
+ end: number;
856
+ color?: string;
857
+ opacity?: number;
858
+ }
859
+
860
+ declare interface NumberSegmentSelectionState {
861
+ selectedSegment: NumberSegmentSelection | null;
862
+ setSelectedSegment: (segment: NumberSegmentSelection | null) => void;
863
+ }
864
+
865
+ declare interface NumberToolState {
866
+ tool: NumberLabelingTool | null;
867
+ setTool: (tool: NumberLabelingTool | null) => void;
868
+ }
869
+
870
+ export declare type NumberToolType = 'selection' | 'drag-segment';
871
+
507
872
  declare interface OpacityState {
508
873
  opacity: number;
509
874
  setOpacity: (opacity: number) => void;
@@ -536,6 +901,29 @@ export declare type RecordStatus = 'unlabeled' | 'labeled' | 'validated' | 'issu
536
901
 
537
902
  export declare const renderAllSafe: (targetCanvas?: FabricCanvas) => void;
538
903
 
904
+ export declare interface SavePayload {
905
+ viewMode: WorkspaceViewMode;
906
+ inserts: LabelInsertData[];
907
+ updates: LabelUpdateData[];
908
+ deletes: LabelDeleteData[];
909
+ canvasJSON?: object;
910
+ imageSize?: {
911
+ width: number;
912
+ height: number;
913
+ };
914
+ }
915
+
916
+ export declare interface SaveToRecordPayload {
917
+ contentSetId: string;
918
+ labels: LabelInsertData[];
919
+ }
920
+
921
+ export declare interface SaveValidationPayload {
922
+ result: boolean;
923
+ reason?: string;
924
+ labelIds: string[];
925
+ }
926
+
539
927
  export declare const segmentAnythingTool: () => LabelingTool;
540
928
 
541
929
  export declare interface SegmentationGeometry {
@@ -546,6 +934,20 @@ export declare interface SegmentationGeometry {
546
934
  vector?: string;
547
935
  }
548
936
 
937
+ declare interface SelectedClassificationInfo {
938
+ policyId?: string | null;
939
+ classIndex?: number | null;
940
+ className?: string | null;
941
+ labelId?: string | null;
942
+ tempId?: string | null;
943
+ isCanvasFocused?: boolean;
944
+ }
945
+
946
+ declare interface SelectedObjectsState {
947
+ objects: LabeledFabricObject[];
948
+ setObjects: (objects: LabeledFabricObject[]) => void;
949
+ }
950
+
549
951
  export declare const selectionTool: () => LabelingTool;
550
952
 
551
953
  export declare const setCanvasInstance: (instance: FabricCanvas | null) => void;
@@ -567,6 +969,49 @@ declare interface TemporalHistoryState<T> {
567
969
  reset: () => void;
568
970
  }
569
971
 
972
+ declare interface TextAutoHighlightState {
973
+ english: boolean;
974
+ number: boolean;
975
+ special: boolean;
976
+ setEnglish: (value: boolean) => void;
977
+ setNumber: (value: boolean) => void;
978
+ setSpecial: (value: boolean) => void;
979
+ reset: () => void;
980
+ }
981
+
982
+ export declare interface TextContent {
983
+ value: string;
984
+ elementId?: string;
985
+ }
986
+
987
+ declare interface TextLabelingTool {
988
+ id: 'selection' | 'drag-segment';
989
+ label: string;
990
+ }
991
+
992
+ declare interface TextSegmentSelection {
993
+ key: string;
994
+ labelId: string | null;
995
+ tempId: string | null;
996
+ start: number;
997
+ end: number;
998
+ text: string;
999
+ color?: string;
1000
+ opacity?: number;
1001
+ }
1002
+
1003
+ declare interface TextSegmentSelectionState {
1004
+ selectedSegment: TextSegmentSelection | null;
1005
+ setSelectedSegment: (segment: TextSegmentSelection | null) => void;
1006
+ }
1007
+
1008
+ declare interface TextToolState {
1009
+ tool: TextLabelingTool | null;
1010
+ setTool: (tool: TextLabelingTool | null) => void;
1011
+ }
1012
+
1013
+ export declare type TextToolType = 'selection' | 'drag-segment';
1014
+
570
1015
  export declare const toHex: (color: string) => {
571
1016
  hex: string;
572
1017
  alpha: string;
@@ -601,11 +1046,50 @@ export declare interface ToolbarButtonItem {
601
1046
  subItems?: ToolbarItem[];
602
1047
  }
603
1048
 
1049
+ declare interface ToolbarButtonItemMeta {
1050
+ variant: 'button';
1051
+ id?: string;
1052
+ icon: ReactNode;
1053
+ title: string;
1054
+ tooltip?: string;
1055
+ disabled?: boolean;
1056
+ active?: boolean;
1057
+ slim?: boolean;
1058
+ onClick: () => void;
1059
+ subItems?: ToolbarItemMeta[];
1060
+ }
1061
+
1062
+ export declare interface ToolbarCheckboxItem {
1063
+ variant: 'checkbox';
1064
+ id: string;
1065
+ icon?: ReactNode;
1066
+ title?: string;
1067
+ checked?: boolean;
1068
+ disabled?: boolean;
1069
+ onClick?: () => void;
1070
+ }
1071
+
1072
+ declare interface ToolbarCheckboxItemMeta {
1073
+ variant: 'checkbox';
1074
+ id: string;
1075
+ icon?: ReactNode;
1076
+ title: string;
1077
+ checked: boolean;
1078
+ disabled?: boolean;
1079
+ onClick: () => void;
1080
+ }
1081
+
604
1082
  export declare interface ToolbarDividerItem {
605
1083
  variant: 'divider';
606
1084
  }
607
1085
 
608
- export declare type ToolbarItem = ToolbarButtonItem | ToolbarRadioItem | ToolbarDividerItem;
1086
+ declare interface ToolbarDividerItemMeta {
1087
+ variant: 'divider';
1088
+ }
1089
+
1090
+ export declare type ToolbarItem = ToolbarButtonItem | ToolbarRadioItem | ToolbarCheckboxItem | ToolbarDividerItem;
1091
+
1092
+ declare type ToolbarItemMeta = ToolbarRadioItemMeta | ToolbarButtonItemMeta | ToolbarCheckboxItemMeta | ToolbarDividerItemMeta;
609
1093
 
610
1094
  export declare interface ToolbarRadioItem {
611
1095
  variant: 'radio';
@@ -618,6 +1102,19 @@ export declare interface ToolbarRadioItem {
618
1102
  onClick?: () => void;
619
1103
  }
620
1104
 
1105
+ declare interface ToolbarRadioItemMeta {
1106
+ variant: 'radio';
1107
+ id: string;
1108
+ name: string;
1109
+ icon: ReactNode;
1110
+ title: string;
1111
+ checked: boolean;
1112
+ disabled?: boolean;
1113
+ isSlim?: boolean;
1114
+ onClick: () => void;
1115
+ subButtonItems?: ToolbarItemMeta[];
1116
+ }
1117
+
621
1118
  export declare type ToolbarSection = 'tools' | 'brush' | 'palette' | 'zoom' | 'history' | 'layers' | 'viewMode' | 'validation' | 'navigation' | 'save';
622
1119
 
623
1120
  export declare interface ToolExtension extends LabelingExtension {
@@ -632,6 +1129,19 @@ export declare interface ToolExtension extends LabelingExtension {
632
1129
  };
633
1130
  }
634
1131
 
1132
+ declare interface ToolInitConfig {
1133
+ colorCode: string;
1134
+ brush: BrushOptions;
1135
+ imageUrl?: string;
1136
+ magicbrushConfig?: {
1137
+ threshold: number;
1138
+ radius: number;
1139
+ };
1140
+ superpixelConfig?: Record<string, number>;
1141
+ segAnythingCallback?: (payload: any) => void;
1142
+ previousTool?: LabelingTool | null;
1143
+ }
1144
+
635
1145
  declare interface ToolSelectionState {
636
1146
  tool: LabelingTool | null;
637
1147
  setTool: (tool: LabelingTool | null) => void;
@@ -643,7 +1153,7 @@ declare interface ToolSelectionState {
643
1153
  setRedoStack: (redoStack: string[]) => void;
644
1154
  }
645
1155
 
646
- export declare type ToolType = 'selection' | 'brush' | 'blankRect' | 'filledRect' | 'polygon' | 'eraser' | 'magicbrush' | 'superpixel';
1156
+ export declare type ToolType = 'selection' | 'brush' | 'blankRect' | 'filledRect' | 'polygon' | 'eraser' | 'magicbrush' | 'superpixel' | 'segAnything';
647
1157
 
648
1158
  export declare const toRgba: (hex: string, opacity: number) => string;
649
1159
 
@@ -688,6 +1198,19 @@ declare interface UseExtensionsOptions {
688
1198
  setTool: (tool: string) => void;
689
1199
  }
690
1200
 
1201
+ export declare const useImageToolStore: UseBoundStore<StoreApi<ImageToolState>>;
1202
+
1203
+ export declare const useIssuePanelStore: UseBoundStore<StoreApi<IssuePanelState>>;
1204
+
1205
+ /**
1206
+ * Registers keyboard shortcuts matching portal-iris-web.
1207
+ * Shortcuts are view-mode-aware: Image mode has brush/eraser keys,
1208
+ * Text mode has highlighting, etc.
1209
+ */
1210
+ export declare function useKeyboardShortcuts({ viewMode, isValidationMode, setTool, onUndo, onRedo, disabled, }: KeyboardShortcutsConfig): void;
1211
+
1212
+ export declare const useLabelBatchStore: UseBoundStore<StoreApi<LabelBatchState>>;
1213
+
691
1214
  /**
692
1215
  * Level 3 headless hook — Direct canvas access.
693
1216
  *
@@ -747,14 +1270,46 @@ export declare function useLabelingTools(): {
747
1270
  }) => void;
748
1271
  };
749
1272
 
1273
+ export declare function useLabelingUIMeta(viewMode: WorkspaceViewMode, isValidationMode: boolean): LabelingUIMetaResult;
1274
+
1275
+ export declare const useLabelSelectionStore: UseBoundStore<StoreApi<LabelSelectionState>>;
1276
+
1277
+ export declare const useLabelVisibilityStore: UseBoundStore<StoreApi<LabelVisibilityState>>;
1278
+
750
1279
  export declare const useLayerModeStore: UseBoundStore<StoreApi<LayerModeState>>;
751
1280
 
1281
+ export declare const useNumberSegmentSelectionStore: UseBoundStore<StoreApi<NumberSegmentSelectionState>>;
1282
+
1283
+ export declare const useNumberToolStore: UseBoundStore<StoreApi<NumberToolState>>;
1284
+
752
1285
  export declare const useOpacityStore: UseBoundStore<StoreApi<OpacityState>>;
753
1286
 
754
1287
  export declare const usePaletteStore: UseBoundStore<StoreApi<PaletteState>>;
755
1288
 
1289
+ export declare const useSelectedObjectsStore: UseBoundStore<StoreApi<SelectedObjectsState>>;
1290
+
1291
+ export declare const useTextAutoHighlightStore: UseBoundStore<StoreApi<TextAutoHighlightState>>;
1292
+
1293
+ export declare const useTextSegmentSelectionStore: UseBoundStore<StoreApi<TextSegmentSelectionState>>;
1294
+
1295
+ export declare const useTextToolStore: UseBoundStore<StoreApi<TextToolState>>;
1296
+
1297
+ /**
1298
+ * Manages tool lifecycle: calls tool.init(config) when the tool changes,
1299
+ * and runs the cleanup function returned by init when unmounting or switching.
1300
+ */
1301
+ export declare function useToolInit(currentTool: LabelingTool | null, config: ToolInitConfig): {
1302
+ activeToolId: string | null;
1303
+ };
1304
+
756
1305
  export declare const useToolSelectionStore: UseBoundStore<StoreApi<ToolSelectionState>>;
757
1306
 
1307
+ export declare const useValidationModeStore: UseBoundStore<StoreApi<ValidationModeState>>;
1308
+
1309
+ export declare const useViewModeStore: UseBoundStore<StoreApi<ViewModeState>>;
1310
+
1311
+ export declare const useWorkspaceLayoutStore: UseBoundStore<StoreApi<WorkspaceLayoutState>>;
1312
+
758
1313
  export declare const useZoomStore: UseBoundStore<StoreApi<ZoomState>>;
759
1314
 
760
1315
  export declare interface ValidateEvent {
@@ -767,6 +1322,12 @@ export declare interface ValidationDeleteEvent {
767
1322
  ids: string[];
768
1323
  }
769
1324
 
1325
+ declare interface ValidationModeState {
1326
+ isValidationMode: boolean;
1327
+ setValidationMode: (value: boolean) => void;
1328
+ toggleValidationMode: () => void;
1329
+ }
1330
+
770
1331
  export declare interface ValidationResult {
771
1332
  id: string;
772
1333
  annotationId?: string;
@@ -781,6 +1342,13 @@ export declare interface ValidationUpdateEvent {
781
1342
  reason?: string;
782
1343
  }
783
1344
 
1345
+ declare interface ViewModeState {
1346
+ mode: WorkspaceViewMode;
1347
+ setMode: (mode: WorkspaceViewMode) => void;
1348
+ }
1349
+
1350
+ export declare const WORKSPACE_VIEW_MODES: readonly ["Record", "Image", "Text", "Number", "File"];
1351
+
784
1352
  export declare interface WorkspaceIndicator {
785
1353
  title: string;
786
1354
  subtitle?: string;
@@ -796,6 +1364,14 @@ export declare interface WorkspaceLayout {
796
1364
  toolbar?: 'top' | 'bottom';
797
1365
  }
798
1366
 
1367
+ declare interface WorkspaceLayoutState {
1368
+ direction: LayoutDirection;
1369
+ active: boolean;
1370
+ setDirection: (direction: LayoutDirection) => void;
1371
+ setActive: (active: boolean) => void;
1372
+ toggleActive: () => void;
1373
+ }
1374
+
799
1375
  export declare type WorkspaceMode = 'labeling' | 'validation' | 'readonly';
800
1376
 
801
1377
  export declare interface WorkspaceRecord {
@@ -805,8 +1381,15 @@ export declare interface WorkspaceRecord {
805
1381
  status?: RecordStatus;
806
1382
  children?: WorkspaceRecord[];
807
1383
  meta?: Record<string, unknown>;
1384
+ /** Schema-based table mode */
1385
+ summary?: Record<string, string>;
1386
+ schemas?: NavigationSchema[];
1387
+ accessories?: Record<string, NavigationCellAccessories>;
1388
+ detail?: NavigationDetailData;
808
1389
  }
809
1390
 
1391
+ export declare type WorkspaceViewMode = 'Record' | 'Image' | 'Text' | 'Number' | 'File';
1392
+
810
1393
  declare interface ZoomPayload {
811
1394
  direction: 1 | 0 | -1;
812
1395
  level: number;