@annotorious/annotorious
Advanced tools
Comparing version 3.0.5 to 3.0.6
@@ -9,2 +9,5 @@ import { SvelteComponent } from 'svelte'; | ||
element: HTMLDivElement; | ||
cancelDrawing(): void; | ||
getDrawingTool(): string | undefined; | ||
isDrawingEnabled(): boolean; | ||
listDrawingTools(): string[]; | ||
@@ -11,0 +14,0 @@ registerDrawingTool(name: string, tool: typeof SvelteComponent, opts?: DrawingToolOpts): void; |
@@ -8,3 +8,3 @@ import { Annotation, DrawingStyleExpression, FormatAdapter, UserSelectActionExpression } from '@annotorious/core'; | ||
drawingMode?: DrawingMode; | ||
userSelectAction?: UserSelectActionExpression<I>; | ||
userSelectAction?: UserSelectActionExpression<E>; | ||
style?: DrawingStyleExpression<ImageAnnotation>; | ||
@@ -11,0 +11,0 @@ theme?: Theme; |
@@ -10,1 +10,2 @@ export * from './annotation'; | ||
export type { Annotation, AnnotationBody, AnnotationTarget, Annotator, AnnotatorState, Appearance, AppearanceProvider, Color, DrawingStyle, Filter, FormatAdapter, HoverState, LifecycleEvents, ParseResult, PresentUser, Selection, SelectionState, Store, StoreChangeEvent, StoreObserver, User, W3CAnnotation, W3CAnnotationBody, W3CAnnotationTarget } from '@annotorious/core'; | ||
export { createBody, defaultColorProvider, UserSelectAction } from '@annotorious/core'; |
@@ -8,4 +8,4 @@ import { Annotation, Store, SvelteAnnotatorState, SvelteStore } from '@annotorious/core'; | ||
export type SvelteImageAnnotationStore<I extends Annotation = Annotation> = SvelteStore<I> & ImageAnnotationStore<I>; | ||
export type SvelteImageAnnotatorState<I extends Annotation = Annotation> = SvelteAnnotatorState<I> & { | ||
export type SvelteImageAnnotatorState<I extends Annotation = Annotation, E extends unknown = Annotation> = SvelteAnnotatorState<I, E> & { | ||
store: SvelteImageAnnotationStore<I>; | ||
}; |
@@ -5,8 +5,8 @@ import { ImageAnnotation } from '../model'; | ||
import { ImageAnnotationStore, SvelteImageAnnotatorState } from './ImageAnnotationStore'; | ||
export type ImageAnnotatorState<I extends Annotation = ImageAnnotation> = AnnotatorState<I> & { | ||
export type ImageAnnotatorState<I extends Annotation = ImageAnnotation, E extends unknown = ImageAnnotation> = AnnotatorState<I, E> & { | ||
store: ImageAnnotationStore<I>; | ||
selection: SelectionState<ImageAnnotation>; | ||
hover: HoverState<ImageAnnotation>; | ||
selection: SelectionState<I, E>; | ||
hover: HoverState<I>; | ||
}; | ||
export declare const createImageAnnotatorState: <I extends Annotation, E extends unknown>(opts: AnnotoriousOpts<I, E>) => ImageAnnotatorState<I>; | ||
export declare const createSvelteImageAnnotatorState: <I extends Annotation, E extends unknown>(opts: AnnotoriousOpts<I, E>) => SvelteImageAnnotatorState<I>; | ||
export declare const createImageAnnotatorState: <I extends Annotation, E extends unknown>(opts: AnnotoriousOpts<I, E>) => ImageAnnotatorState<I, E>; | ||
export declare const createSvelteImageAnnotatorState: <I extends Annotation, E extends unknown>(opts: AnnotoriousOpts<I, E>) => SvelteImageAnnotatorState<I, E>; |
{ | ||
"name": "@annotorious/annotorious", | ||
"version": "3.0.5", | ||
"version": "3.0.6", | ||
"description": "Add image annotation functionality to any web page with a few lines of JavaScript", | ||
@@ -8,2 +8,3 @@ "author": "Rainer Simon", | ||
"homepage": "https://annotorious.dev", | ||
"funding": "https://steadyhq.com/rainer-simon", | ||
"type": "module", | ||
@@ -46,9 +47,9 @@ "repository": { | ||
"svelte-preprocess": "^6.0.2", | ||
"typescript": "5.5.4", | ||
"vite": "^5.4.3", | ||
"vite-plugin-dts": "^4.1.0", | ||
"vitest": "^2.0.5" | ||
"typescript": "5.6.2", | ||
"vite": "^5.4.6", | ||
"vite-plugin-dts": "^4.2.1", | ||
"vitest": "^2.1.1" | ||
}, | ||
"dependencies": { | ||
"@annotorious/core": "3.0.5", | ||
"@annotorious/core": "3.0.6", | ||
"rbush": "^4.0.1", | ||
@@ -55,0 +56,0 @@ "uuid": "^10.0.0" |
@@ -0,6 +1,17 @@ | ||
![Aerial view of Schönbrunn Palace in Vienna annotated with Annotorious](https://raw.githubusercontent.com/annotorious/annotorious/main/images/splash-image.jpg "Aerial view of Schönbrunn Palace in Vienna annotated with Annotorious") | ||
# @annotorious/annotorious | ||
JavaScript image annotation library. | ||
Add image annotation functionality to any web page with a few lines of JavaScript. Visit the | ||
[project website](https://annotorious.dev) for documentation and live demos. | ||
__This repository is work in progress on the next major release (v3) of Annotorious. Code in this repository is | ||
unfinished. Please keep using [Annotorious 2.x](https://annotorious.com) until the official release of v3.__ | ||
## Community | ||
Visit the [Discussion Forum](https://github.com/annotorious/annotorious/discussions) for community support, or file an | ||
issue on the [Issue Tracker](https://github.com/annotorious/annotorious/issues). | ||
## Become a Sponsor | ||
Using Annotorious at work? Become a sponsor! Your support helps me cover hosting costs, spend more | ||
time supporting the community, and make Annotorious better for everyone. [Make a one-time or monthly | ||
donation via my SteadyHQ account](https://steadyhq.com/rainer-simon). |
@@ -24,2 +24,8 @@ import type { SvelteComponent } from 'svelte'; | ||
cancelDrawing(): void; | ||
getDrawingTool(): string | undefined; | ||
isDrawingEnabled(): boolean; | ||
listDrawingTools(): string[]; | ||
@@ -112,2 +118,7 @@ | ||
const cancelDrawing = () => { | ||
annotationLayer.$set({ drawingEnabled: false }); | ||
setTimeout(() => annotationLayer.$set({ drawingEnabled: true }), 1); | ||
} | ||
const destroy = () => { | ||
@@ -126,4 +137,10 @@ // Destroy Svelte annotation layer | ||
const getDrawingTool = () => | ||
annotationLayer.getDrawingTool(); | ||
const getUser = () => currentUser; | ||
const isDrawingEnabled = () => | ||
annotationLayer.isDrawingEnabled(); | ||
const registerDrawingTool = (name: string, tool: typeof SvelteComponent, opts?: DrawingToolOpts) => | ||
@@ -168,4 +185,7 @@ registerTool(name, tool, opts); | ||
...base, | ||
cancelDrawing, | ||
destroy, | ||
getDrawingTool, | ||
getUser, | ||
isDrawingEnabled, | ||
listDrawingTools, | ||
@@ -172,0 +192,0 @@ on: lifecycle.on, |
@@ -16,3 +16,3 @@ import type { Annotation, DrawingStyleExpression, FormatAdapter, UserSelectActionExpression } from '@annotorious/core'; | ||
userSelectAction?: UserSelectActionExpression<I>; | ||
userSelectAction?: UserSelectActionExpression<E>; | ||
@@ -19,0 +19,0 @@ style?: DrawingStyleExpression<ImageAnnotation>; |
@@ -37,1 +37,7 @@ export * from './annotation'; | ||
} from '@annotorious/core'; | ||
export { | ||
createBody, | ||
defaultColorProvider, | ||
UserSelectAction | ||
} from '@annotorious/core'; |
@@ -14,3 +14,3 @@ import type { Annotation, Store, SvelteAnnotatorState, SvelteStore } from '@annotorious/core'; | ||
export type SvelteImageAnnotatorState<I extends Annotation = Annotation> = SvelteAnnotatorState<I> & { | ||
export type SvelteImageAnnotatorState<I extends Annotation = Annotation, E extends unknown = Annotation> = SvelteAnnotatorState<I, E> & { | ||
@@ -17,0 +17,0 @@ store: SvelteImageAnnotationStore<I>; |
@@ -23,9 +23,9 @@ import type { ImageAnnotation, ImageAnnotationTarget } from '../model'; | ||
export type ImageAnnotatorState<I extends Annotation = ImageAnnotation> = AnnotatorState<I> & { | ||
export type ImageAnnotatorState<I extends Annotation = ImageAnnotation, E extends unknown = ImageAnnotation> = AnnotatorState<I, E> & { | ||
store: ImageAnnotationStore<I>; | ||
selection: SelectionState<ImageAnnotation>; | ||
selection: SelectionState<I, E>; | ||
hover: HoverState<ImageAnnotation>; | ||
hover: HoverState<I>; | ||
@@ -36,3 +36,3 @@ } | ||
opts: AnnotoriousOpts<I, E> | ||
): ImageAnnotatorState<I> => { | ||
): ImageAnnotatorState<I, E> => { | ||
@@ -43,3 +43,3 @@ const store = createStore<I>(); | ||
const selection = createSelectionState<I>(store, opts.userSelectAction); | ||
const selection = createSelectionState<I, E>(store, opts.userSelectAction, opts.adapter); | ||
@@ -76,3 +76,3 @@ const hover = createHoverState(store); | ||
viewport | ||
} as ImageAnnotatorState<I>; | ||
} as ImageAnnotatorState<I, E>; | ||
@@ -83,5 +83,5 @@ } | ||
opts: AnnotoriousOpts<I, E> | ||
): SvelteImageAnnotatorState<I> => { | ||
): SvelteImageAnnotatorState<I, E> => { | ||
const state = createImageAnnotatorState(opts); | ||
const state = createImageAnnotatorState<I, E>(opts); | ||
@@ -88,0 +88,0 @@ return { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
903462
6309
18
+ Added@annotorious/core@3.0.6(transitive)
- Removed@annotorious/core@3.0.5(transitive)
Updated@annotorious/core@3.0.6