@annotorious/annotorious 3.0.0-rc.21 → 3.0.0-rc.22
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/Annotorious.d.ts +1 -1
- package/dist/Annotorious.d.ts.map +1 -1
- package/dist/annotation/utils/styling.d.ts +2 -2
- package/dist/annotation/utils/styling.d.ts.map +1 -1
- package/dist/annotorious.css +1 -1
- package/dist/annotorious.es.js +1081 -1072
- package/dist/annotorious.es.js.map +1 -1
- package/dist/annotorious.js +1 -1
- package/dist/annotorious.js.map +1 -1
- package/package.json +6 -6
- package/src/Annotorious.css +4 -0
- package/src/Annotorious.ts +8 -2
- package/src/annotation/SVGAnnotationLayer.svelte +4 -2
- package/src/annotation/editors/EditorMount.svelte +2 -2
- package/src/annotation/shapes/Ellipse.svelte +2 -2
- package/src/annotation/shapes/Polygon.svelte +2 -2
- package/src/annotation/shapes/Rectangle.svelte +2 -2
- package/src/annotation/utils/styling.ts +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@annotorious/annotorious",
|
|
3
|
-
"version": "3.0.0-rc.
|
|
3
|
+
"version": "3.0.0-rc.22",
|
|
4
4
|
"description": "Add image annotation functionality to any web page with a few lines of JavaScript",
|
|
5
5
|
"author": "Rainer Simon",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
@@ -37,19 +37,19 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@sveltejs/vite-plugin-svelte": "^3.0.2",
|
|
40
|
-
"@tsconfig/svelte": "^5.0.
|
|
40
|
+
"@tsconfig/svelte": "^5.0.4",
|
|
41
41
|
"@types/rbush": "^3.0.3",
|
|
42
42
|
"jsdom": "^24.0.0",
|
|
43
43
|
"svelte": "^4.2.12",
|
|
44
44
|
"svelte-preprocess": "^5.1.3",
|
|
45
|
-
"typescript": "^5.
|
|
46
|
-
"vite": "^5.2.
|
|
45
|
+
"typescript": "^5.4.3",
|
|
46
|
+
"vite": "^5.2.6",
|
|
47
47
|
"vite-plugin-dts": "^3.7.3",
|
|
48
48
|
"vitest": "^1.4.0"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@annotorious/core": "
|
|
51
|
+
"@annotorious/core": "3.0.0-rc.22",
|
|
52
52
|
"rbush": "^3.0.1",
|
|
53
53
|
"uuid": "^9.0.1"
|
|
54
54
|
}
|
|
55
|
-
}
|
|
55
|
+
}
|
package/src/Annotorious.css
CHANGED
package/src/Annotorious.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SvelteComponent } from 'svelte';
|
|
2
|
-
import { PointerSelectAction
|
|
2
|
+
import { PointerSelectAction } from '@annotorious/core';
|
|
3
|
+
import type { Annotator, DrawingStyleExpression, Filter, User } from '@annotorious/core';
|
|
3
4
|
import { createAnonymousGuest, createBaseAnnotator, createLifecyleObserver, createUndoStack } from '@annotorious/core';
|
|
4
5
|
import { registerEditor } from './annotation/editors';
|
|
5
6
|
import { getTool, registerTool, listDrawingTools, type DrawingTool } from './annotation/tools';
|
|
@@ -142,7 +143,7 @@ export const createImageAnnotator = <E extends unknown = ImageAnnotation>(
|
|
|
142
143
|
console.warn('Filter not implemented yet');
|
|
143
144
|
}
|
|
144
145
|
|
|
145
|
-
const setStyle = (style:
|
|
146
|
+
const setStyle = (style: DrawingStyleExpression<ImageAnnotation> | undefined) =>
|
|
146
147
|
annotationLayer.$set({ style });
|
|
147
148
|
|
|
148
149
|
const setTheme = (theme: Theme) => _setTheme(img, container, theme);
|
|
@@ -152,6 +153,10 @@ export const createImageAnnotator = <E extends unknown = ImageAnnotation>(
|
|
|
152
153
|
annotationLayer.$set({ user });
|
|
153
154
|
}
|
|
154
155
|
|
|
156
|
+
const setVisible = (visible: boolean) =>
|
|
157
|
+
// @ts-ignore
|
|
158
|
+
annotationLayer.$set({ visible });
|
|
159
|
+
|
|
155
160
|
return {
|
|
156
161
|
...base,
|
|
157
162
|
destroy,
|
|
@@ -167,6 +172,7 @@ export const createImageAnnotator = <E extends unknown = ImageAnnotation>(
|
|
|
167
172
|
setStyle,
|
|
168
173
|
setTheme,
|
|
169
174
|
setUser,
|
|
175
|
+
setVisible,
|
|
170
176
|
state
|
|
171
177
|
}
|
|
172
178
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { SvelteComponent, onMount } from 'svelte';
|
|
3
3
|
import { v4 as uuidv4 } from 'uuid';
|
|
4
|
-
import type {
|
|
4
|
+
import type { DrawingStyleExpression, StoreChangeEvent, User } from '@annotorious/core';
|
|
5
5
|
import { ShapeType } from '../model';
|
|
6
6
|
import type { ImageAnnotation, Shape} from '../model';
|
|
7
7
|
import { getEditor as _getEditor, EditorMount } from './editors';
|
|
@@ -18,9 +18,10 @@
|
|
|
18
18
|
export let image: HTMLImageElement | HTMLCanvasElement;
|
|
19
19
|
export let preferredDrawingMode: DrawingMode;
|
|
20
20
|
export let state: SvelteImageAnnotatorState;
|
|
21
|
-
export let style:
|
|
21
|
+
export let style: DrawingStyleExpression<ImageAnnotation> | undefined = undefined;
|
|
22
22
|
export let toolName: string = listDrawingTools()[0];
|
|
23
23
|
export let user: User;
|
|
24
|
+
export let visible = true;
|
|
24
25
|
|
|
25
26
|
$: ({ tool, opts } = getTool(toolName) || { tool: undefined, opts: undefined });
|
|
26
27
|
|
|
@@ -122,6 +123,7 @@
|
|
|
122
123
|
bind:this={svgEl}
|
|
123
124
|
class="a9s-annotationlayer"
|
|
124
125
|
class:drawing={tool}
|
|
126
|
+
class:hidden={!visible}
|
|
125
127
|
on:pointerup={onPointerUp}
|
|
126
128
|
on:pointerdown={onPointerDown}>
|
|
127
129
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { DrawingStyleExpression } from '@annotorious/core';
|
|
3
3
|
import { createEventDispatcher, onMount, type SvelteComponent } from 'svelte';
|
|
4
4
|
import type { ImageAnnotation, Shape } from '../../model';
|
|
5
5
|
import { computeStyle } from '../utils/styling';
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
/** Props */
|
|
11
11
|
export let annotation: ImageAnnotation;
|
|
12
12
|
export let editor: typeof SvelteComponent;
|
|
13
|
-
export let style:
|
|
13
|
+
export let style: DrawingStyleExpression<ImageAnnotation> | undefined;
|
|
14
14
|
export let target: SVGGElement;
|
|
15
15
|
export let transform: Transform;
|
|
16
16
|
export let viewportScale: number;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { DrawingStyleExpression } from '@annotorious/core';
|
|
3
3
|
import type { Geometry, EllipseGeometry, ImageAnnotation } from '../../model';
|
|
4
4
|
import { computeStyle } from '../utils/styling';
|
|
5
5
|
|
|
6
6
|
/** Props */
|
|
7
7
|
export let annotation: ImageAnnotation;
|
|
8
8
|
export let geom: Geometry;
|
|
9
|
-
export let style:
|
|
9
|
+
export let style: DrawingStyleExpression<ImageAnnotation> | undefined;
|
|
10
10
|
|
|
11
11
|
$: computedStyle = computeStyle(annotation, style);
|
|
12
12
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { DrawingStyleExpression } from '@annotorious/core';
|
|
3
3
|
import type { Geometry, ImageAnnotation, PolygonGeometry } from '../../model';
|
|
4
4
|
import { computeStyle } from '../utils/styling';
|
|
5
5
|
|
|
6
6
|
/** Props **/
|
|
7
7
|
export let annotation: ImageAnnotation;
|
|
8
8
|
export let geom: Geometry;
|
|
9
|
-
export let style:
|
|
9
|
+
export let style: DrawingStyleExpression<ImageAnnotation> | undefined;
|
|
10
10
|
|
|
11
11
|
$: computedStyle = computeStyle(annotation, style);
|
|
12
12
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { DrawingStyleExpression } from '@annotorious/core';
|
|
3
3
|
import type { Geometry, ImageAnnotation, RectangleGeometry } from '../../model';
|
|
4
4
|
import { computeStyle } from '../utils/styling';
|
|
5
5
|
|
|
6
6
|
/** Props **/
|
|
7
7
|
export let annotation: ImageAnnotation;
|
|
8
8
|
export let geom: Geometry;
|
|
9
|
-
export let style:
|
|
9
|
+
export let style: DrawingStyleExpression<ImageAnnotation> | undefined;
|
|
10
10
|
|
|
11
11
|
$: computedStyle = computeStyle(annotation, style);
|
|
12
12
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DrawingStyleExpression } from '@annotorious/core';
|
|
2
2
|
import type { ImageAnnotation } from '../../model';
|
|
3
3
|
|
|
4
|
-
export const computeStyle = (
|
|
4
|
+
export const computeStyle = (
|
|
5
|
+
annotation: ImageAnnotation,
|
|
6
|
+
style?: DrawingStyleExpression<ImageAnnotation>
|
|
7
|
+
) => {
|
|
5
8
|
const computed = typeof style === 'function' ? style(annotation) : style;
|
|
6
9
|
|
|
7
10
|
if (computed) {
|