Skip to content

Commit 8ea25e4

Browse files
Merge pull request #240 from SenteraLLC/fix/type-expot
Fix/type export
2 parents 36e5029 + 04d4fe4 commit 8ea25e4

8 files changed

Lines changed: 49 additions & 21 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented here.
44

55
## [unreleased]
66

7+
## [0.23.1] - Mar 18th, 2026
8+
- Fix export of typescript types
9+
- Add `ULabel.get_resize_toolbox_item()` static method to get the `AnnotationResizeItem` class, which has static methods that allow for programmatic control of annotation size for subtasks.
10+
711
## [0.23.0] - Jan 16th, 2026
812
- Add vertex deletion keybind for polygon and polyline annotations
913
- New configurable `delete_vertex_keybind` (default: `x`)

api_spec.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,18 @@ You can access the AllowedToolboxItem enum by calling the static method:
353353
const AllowedToolboxItem = ULabel.get_allowed_toolbox_item_enum();
354354
```
355355
356+
### `AnnotationResizeItem`
357+
The `AnnotationResizeItem` can be used to programmatically control annotation size for subtasks. It can be accessed with the static method:
358+
```javascript
359+
const AnnotationResizeItem = ULabel.get_resize_toolbox_item();
360+
```
361+
Using the class, you can call any of its static methods by passing in your `ULabel` instance, the key of the subtask you want to modify, and any other required arguments. For example:
362+
363+
```javascript
364+
AnnotationResizeItem.toggle_subtask_vanished(ulabel, subtask_key);
365+
```
366+
Note that in order to work, the `AnnotationResize` toolbox item MUST be present in your `ULabel` instance.
367+
356368
### `distance_filter_toolbox_item`
357369
Configuration object for the `FilterDistance` toolbox item with the following custom definitions:
358370
```javascript

index.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ULabelAnnotation } from "./src/annotation";
22
import { AllowedToolboxItem, Configuration } from "./src/configuration";
33
import { FilterDistanceOverlay } from "./src/overlays";
44
import { ULabelSubtask } from "./src/subtask";
5-
import { Toolbox } from "./src/toolbox";
5+
import { Toolbox, AnnotationResizeItem } from "./src/toolbox";
66

77
export type DistanceFromPolyline = {
88
distance: number;
@@ -361,6 +361,7 @@ export class ULabel {
361361
// Static functions
362362
static get_time(): string;
363363
static get_allowed_toolbox_item_enum(): AllowedToolboxItem;
364+
static get_resize_toolbox_item(): AnnotationResizeItem;
364365
static process_classes(ulabel_obj: ULabel, arg1: string, subtask_obj: ULabelSubtask): void;
365366
static build_id_dialogs(ulabel_obj: ULabel): void;
366367

package-lock.json

Lines changed: 2 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
{
22
"name": "ulabel",
33
"description": "An image annotation tool.",
4-
"version": "0.23.0",
4+
"version": "0.23.1",
55
"main": "dist/ulabel.min.js",
66
"module": "dist/ulabel.min.js",
7+
"types": "index.d.ts",
78
"exports": {
8-
".": "./dist/ulabel.min.js",
9-
"./min": "./dist/ulabel.min.js",
10-
"./debug": "./dist/ulabel.js"
9+
".": {
10+
"types": "./index.d.ts",
11+
"default": "./dist/ulabel.min.js"
12+
},
13+
"./min": {
14+
"types": "./index.d.ts",
15+
"default": "./dist/ulabel.min.js"
16+
},
17+
"./debug": {
18+
"types": "./index.d.ts",
19+
"default": "./dist/ulabel.js"
20+
}
1121
},
1222
"scripts": {
1323
"test": "cross-env NODE_OPTIONS=\"--max-old-space-size=8192\" jest",

src/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {
2525
mark_deprecated,
2626
update_distance_from_line_to_each_point,
2727
} from "../build/annotation_operators";
28-
28+
import { AnnotationResizeItem, BrushToolboxItem } from "../build/toolbox";
2929
import { remove_ulabel_listeners } from "../build/listeners";
3030
import { log_message, LogLevel } from "../build/error_logging";
3131
import { initialize_annotation_canvases } from "../build/canvas_utils";
@@ -48,7 +48,6 @@ import {
4848
BACK_Z_INDEX,
4949
} from "./blobs";
5050
import { ULABEL_VERSION } from "./version";
51-
import { BrushToolboxItem } from "../build/toolbox";
5251
import { ulabel_init } from "../build/initializer";
5352

5453
jQuery.fn.outer_html = function () {
@@ -71,6 +70,10 @@ export class ULabel {
7170
return AllowedToolboxItem;
7271
}
7372

73+
static get_resize_toolbox_item() {
74+
return AnnotationResizeItem;
75+
}
76+
7477
/*
7578
Types of drags
7679
- annotation

src/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const ULABEL_VERSION = "0.23.0";
1+
export const ULABEL_VERSION = "0.23.1";

tests/ulabel.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,15 @@ describe("ULabel Core Functionality", () => {
9696
const enum_obj = ULabel.get_allowed_toolbox_item_enum();
9797
expect(typeof enum_obj).toBe("object");
9898
});
99+
100+
test("should return resize toolbox item class", () => {
101+
const resize_item_class = ULabel.get_resize_toolbox_item();
102+
expect(typeof resize_item_class).toBe("function");
103+
// Verify class methods
104+
expect(typeof resize_item_class.update_annotation_size).toBe("function");
105+
expect(typeof resize_item_class.update_subtask_line_size).toBe("function");
106+
expect(typeof resize_item_class.toggle_subtask_vanished).toBe("function");
107+
});
99108
});
100109

101110
describe("Class Processing", () => {

0 commit comments

Comments
 (0)