@annotorious/annotorious 3.3.3 → 3.3.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@annotorious/annotorious",
3
- "version": "3.3.3",
3
+ "version": "3.3.4",
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",
@@ -40,16 +40,16 @@
40
40
  "@sveltejs/vite-plugin-svelte": "^3.1.2",
41
41
  "@tsconfig/svelte": "^5.0.4",
42
42
  "@types/rbush": "^4.0.0",
43
- "jsdom": "^26.0.0",
43
+ "jsdom": "^26.1.0",
44
44
  "svelte": "^4.2.19",
45
45
  "svelte-preprocess": "^6.0.3",
46
- "typescript": "5.8.2",
47
- "vite": "^5.4.15",
46
+ "typescript": "5.8.3",
47
+ "vite": "^5.4.18",
48
48
  "vite-plugin-dts": "^4.5.3",
49
- "vitest": "^3.0.9"
49
+ "vitest": "^3.1.1"
50
50
  },
51
51
  "dependencies": {
52
- "@annotorious/core": "3.3.3",
52
+ "@annotorious/core": "3.3.4",
53
53
  "rbush": "^4.0.1",
54
54
  "svg-pathdata": "^7.2.0",
55
55
  "uuid": "^11.1.0"
@@ -14,7 +14,7 @@ export type DrawingToolOpts = {
14
14
  }
15
15
 
16
16
  // @ts-ignore
17
- const REGISTERED = new Map<DrawingTool, { tool: typeof SvelteComponent, opts?: DrawingToolOpts }>([
17
+ const REGISTERED = new Map<DrawingTool, { tool: typeof SvelteComponent, opts: DrawingToolOpts }>([
18
18
  ['rectangle', { tool: RubberbandRectangle }],
19
19
  ['polygon', { tool: RubberbandPolygon }]
20
20
  ]);
@@ -23,5 +23,5 @@ export const listDrawingTools = () => [...REGISTERED.keys()];
23
23
 
24
24
  export const getTool = (name: string) => REGISTERED.get(name);
25
25
 
26
- export const registerTool = (name: string, tool: typeof SvelteComponent, opts?: DrawingToolOpts) =>
26
+ export const registerTool = (name: string, tool: typeof SvelteComponent, opts: DrawingToolOpts = {}) =>
27
27
  REGISTERED.set(name, { tool, opts });
@@ -63,6 +63,9 @@ export const parseW3CImageAnnotation = (
63
63
  w3cSelector?.type === 'SvgSelector' ?
64
64
  parseSVGSelector(w3cSelector as SVGSelector) : undefined;
65
65
 
66
+ const target =
67
+ Array.isArray(rest.target) ? rest.target[0] : rest.targret;
68
+
66
69
  return (selector || !opts.strict) ? {
67
70
  parsed: {
68
71
  ...rest,
@@ -72,7 +75,8 @@ export const parseW3CImageAnnotation = (
72
75
  created: created ? new Date(created) : undefined,
73
76
  creator: parseW3CUser(creator),
74
77
  updated: modified ? new Date(modified) : undefined,
75
- ...(Array.isArray(rest.target) ? rest.target[0] : rest.target),
78
+ // Note the target can be a string and we don't want to spread the characters...
79
+ ...(typeof target === 'string' ? {} : target),
76
80
  annotation: annotationId,
77
81
  selector: selector || w3cSelector
78
82
  }
@@ -121,6 +125,7 @@ export const serializeW3CImageAnnotation = (
121
125
  target: {
122
126
  ...rest,
123
127
  source,
128
+ type: 'SpecificResource',
124
129
  selector: w3cSelector
125
130
  }
126
131
  } as W3CImageAnnotation;