Skip to content

Commit

Permalink
Fixed breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rsimon committed Jul 30, 2024
1 parent 875c043 commit b77d47a
Show file tree
Hide file tree
Showing 10 changed files with 283 additions and 331 deletions.
564 changes: 257 additions & 307 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions packages/extension-tei/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
},
"devDependencies": {
"CETEIcean": "^1.9.3",
"typescript": "^5.5.3",
"vite": "^5.3.4",
"typescript": "5.5.3",
"vite": "^5.3.5",
"vite-plugin-dts": "^3.9.1"
},
"peerDependencies": {
"@annotorious/core": "^3.0.0-rc.30",
"@annotorious/core": "^3.0.0-rc.31",
"@recogito/text-annotator": "3.0.0-rc.36"
}
}
10 changes: 5 additions & 5 deletions packages/text-annotator-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"openseadragon": "4.1.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"typescript": "^5.5.3",
"vite": "^5.3.4",
"typescript": "5.5.3",
"vite": "^5.3.5",
"vite-plugin-dts": "^3.9.1",
"vite-tsconfig-paths": "^4.3.2"
},
Expand All @@ -45,9 +45,9 @@
}
},
"dependencies": {
"@annotorious/core": "^3.0.0-rc.30",
"@annotorious/react": "^3.0.0-rc.30",
"@floating-ui/react": "^0.26.19",
"@annotorious/core": "^3.0.0-rc.31",
"@annotorious/react": "^3.0.0-rc.31",
"@floating-ui/react": "^0.26.20",
"@recogito/text-annotator": "3.0.0-rc.36",
"@recogito/text-annotator-tei": "3.0.0-rc.36",
"CETEIcean": "^1.9.3"
Expand Down
3 changes: 2 additions & 1 deletion packages/text-annotator-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export type {
StoreObserver,
ParseResult,
User,
UserSelectActionExpression,
W3CAnnotation,
W3CAnnotationBody,
W3CAnnotationTarget
Expand All @@ -29,7 +30,7 @@ export type {
export {
createBody,
Origin,
PointerSelectAction
UserSelectAction,
} from '@annotorious/core';

// Essential re-exports from @annotorious/react
Expand Down
10 changes: 5 additions & 5 deletions packages/text-annotator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
"@types/jsdom": "^21.1.7",
"@types/rbush": "^3.0.3",
"@types/uuid": "^10.0.0",
"jsdom": "^24.1.0",
"jsdom": "^24.1.1",
"svelte": "^4.2.18",
"typescript": "^5.5.3",
"vite": "^5.3.4",
"typescript": "5.5.3",
"vite": "^5.3.5",
"vite-plugin-dts": "^3.9.1",
"vitest": "^2.0.3"
"vitest": "^2.0.4"
},
"dependencies": {
"@annotorious/core": "^3.0.0-rc.30",
"@annotorious/core": "^3.0.0-rc.31",
"colord": "^2.9.3",
"dequal": "^2.0.3",
"rbush": "^4.0.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/text-annotator/src/SelectionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const SelectionHandler = (

// ...then make the new annotation the current selection. (Reminder:
// select events don't have offsetX/offsetY - reuse last up/down)
selection.clickSelect(currentTarget.annotation, lastPointerDown);
selection.userSelect(currentTarget.annotation, lastPointerDown);
}
})

Expand Down Expand Up @@ -140,7 +140,7 @@ export const SelectionHandler = (
const { selected } = selection;

if (selected.length !== 1 || selected[0].id !== hovered.id)
selection.clickSelect(hovered.id, evt);
selection.userSelect(hovered.id, evt);
} else if (!selection.isEmpty()) {
selection.clear();
}
Expand All @@ -153,7 +153,7 @@ export const SelectionHandler = (
currentTarget = undefined;
clickSelect();
} else if (currentTarget) {
selection.clickSelect(currentTarget.annotation, evt);
selection.userSelect(currentTarget.annotation, evt);
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/text-annotator/src/TextAnnotator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const createTextAnnotator = <E extends unknown = TextAnnotation>(
annotatingEnabled: true
});

const state: TextAnnotatorState = createTextAnnotatorState(container, opts.pointerAction);
const state: TextAnnotatorState = createTextAnnotatorState(container, opts.userAction);

const { selection, viewport } = state;

Expand Down
4 changes: 2 additions & 2 deletions packages/text-annotator/src/TextAnnotatorOptions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { FormatAdapter, PointerSelectAction } from '@annotorious/core';
import type { FormatAdapter, UserSelectActionExpression } from '@annotorious/core';
import type { PresencePainterOptions } from './presence';
import type { TextAnnotation } from './model';
import type { HighlightStyleExpression } from './highlight';
Expand All @@ -13,7 +13,7 @@ export interface TextAnnotatorOptions<T extends unknown = TextAnnotation> {

offsetReferenceSelector?: string;

pointerAction?: PointerSelectAction | ((annotation: TextAnnotation) => PointerSelectAction);
userAction?: UserSelectActionExpression<TextAnnotation>,

presence?: PresencePainterOptions;

Expand Down
3 changes: 2 additions & 1 deletion packages/text-annotator/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export type {
StoreObserver,
ParseResult,
User,
UserSelectActionExpression,
W3CAnnotation,
W3CAnnotationBody,
W3CAnnotationTarget
Expand All @@ -32,5 +33,5 @@ export type {
export {
createBody,
Origin,
PointerSelectAction
UserSelectAction
} from '@annotorious/core';
6 changes: 3 additions & 3 deletions packages/text-annotator/src/state/TextAnnotatorState.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Filter, PointerSelectAction, Store, ViewportState } from '@annotorious/core';
import type { Filter, UserSelectAction, Store, ViewportState, UserSelectActionExpression } from '@annotorious/core';
import {
createHoverState,
createSelectionState,
Expand Down Expand Up @@ -28,14 +28,14 @@ export interface TextAnnotatorState extends AnnotatorState<TextAnnotation> {

export const createTextAnnotatorState = (
container: HTMLElement,
defaultPointerAction?: PointerSelectAction | ((annotation: TextAnnotation) => PointerSelectAction)
defaultUserAction?: UserSelectActionExpression<TextAnnotation>
): TextAnnotatorState => {

const store: Store<TextAnnotation> = createStore<TextAnnotation>();

const tree = createSpatialTree(store, container);

const selection = createSelectionState<TextAnnotation>(store, defaultPointerAction);
const selection = createSelectionState<TextAnnotation>(store, defaultUserAction);

const hover = createHoverState(store);

Expand Down

3 comments on commit b77d47a

@oleksandr-danylchenko
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*These changes were addressed in recogito#118

@rsimon
Copy link
Author

@rsimon rsimon commented on b77d47a Jul 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm aware. But this PR includes too many other things I don't have the bandwidth to review right now.

@oleksandr-danylchenko
Copy link
Owner

@oleksandr-danylchenko oleksandr-danylchenko commented on b77d47a Jul 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense!
Thanks for bringing in the A9S changes 🤝

Please sign in to comment.