@linkurious/ogma-annotations-react 1.1.26 → 2.0.0
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/Readme.md +2 -0
- package/dist/index.js +1 -24
- package/dist/index.mjs +112 -2058
- package/dist/types/index.d.ts +78 -19
- package/package.json +24 -12
package/dist/types/index.d.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { Annotation } from '@linkurious/ogma-annotations';
|
|
2
2
|
import { AnnotationCollection } from '@linkurious/ogma-annotations';
|
|
3
3
|
import { AnnotationFeature } from '@linkurious/ogma-annotations';
|
|
4
|
+
import { ArrowProperties } from '@linkurious/ogma-annotations';
|
|
4
5
|
import { ArrowStyles } from '@linkurious/ogma-annotations';
|
|
6
|
+
import { Box } from '@linkurious/ogma-annotations';
|
|
7
|
+
import { BoxProperties } from '@linkurious/ogma-annotations';
|
|
8
|
+
import { Comment as Comment_2 } from '@linkurious/ogma-annotations';
|
|
9
|
+
import { CommentProps } from '@linkurious/ogma-annotations';
|
|
10
|
+
import { Context } from 'react';
|
|
5
11
|
import { Control } from '@linkurious/ogma-annotations';
|
|
12
|
+
import { createBox } from '@linkurious/ogma-annotations';
|
|
13
|
+
import { createComment } from '@linkurious/ogma-annotations';
|
|
14
|
+
import { createPolygon } from '@linkurious/ogma-annotations';
|
|
6
15
|
import { default as default_2 } from 'react';
|
|
16
|
+
import { getAnnotationsBounds } from '@linkurious/ogma-annotations';
|
|
17
|
+
import { isBox } from '@linkurious/ogma-annotations';
|
|
18
|
+
import { isComment } from '@linkurious/ogma-annotations';
|
|
19
|
+
import { isPolygon } from '@linkurious/ogma-annotations';
|
|
20
|
+
import { Polygon } from '@linkurious/ogma-annotations';
|
|
21
|
+
import { PolygonProperties } from '@linkurious/ogma-annotations';
|
|
7
22
|
import { ReactElement } from 'react';
|
|
8
23
|
import { TextStyle } from '@linkurious/ogma-annotations';
|
|
9
24
|
|
|
10
|
-
declare type AnnotationAction = {
|
|
11
|
-
type: AnnotationActionType;
|
|
12
|
-
payload: Annotation;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
declare type AnnotationActionType = "add" | "remove" | "update";
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Creates a React context for managing annotations with type safety.
|
|
19
|
-
*
|
|
20
|
-
* @type {Context<IAnnotationsContext>} A typed context for annotation-related
|
|
21
|
-
* state and operations
|
|
22
|
-
*/
|
|
23
|
-
export declare const AnnotationsContext: default_2.Context<IAnnotationsContext>;
|
|
24
|
-
|
|
25
25
|
/**
|
|
26
26
|
* Provides a context provider for managing annotations in a graph visualization.
|
|
27
27
|
*
|
|
@@ -33,14 +33,31 @@ export declare const AnnotationsContext: default_2.Context<IAnnotationsContext>;
|
|
|
33
33
|
*/
|
|
34
34
|
export declare const AnnotationsContextProvider: ({ children, annotations: initialAnnotations }: Props) => default_2.JSX.Element;
|
|
35
35
|
|
|
36
|
+
export { ArrowProperties }
|
|
37
|
+
|
|
38
|
+
/** @private */
|
|
36
39
|
export declare const BLACK = "#333333";
|
|
37
40
|
|
|
41
|
+
export { Box }
|
|
42
|
+
|
|
43
|
+
export { BoxProperties }
|
|
44
|
+
|
|
45
|
+
export { Comment_2 as Comment }
|
|
46
|
+
|
|
47
|
+
export { CommentProps }
|
|
48
|
+
|
|
38
49
|
/**
|
|
39
50
|
* Creates a React context for managing annotations with optional type safety.
|
|
40
51
|
*
|
|
41
52
|
* @returns {Context<IAnnotationsContext | null>} A context for annotation-related state and operations that can be null
|
|
42
53
|
*/
|
|
43
|
-
export declare function createAnnotationsContext():
|
|
54
|
+
export declare function createAnnotationsContext(): Context<IAnnotationsContext | null>;
|
|
55
|
+
|
|
56
|
+
export { createBox }
|
|
57
|
+
|
|
58
|
+
export { createComment }
|
|
59
|
+
|
|
60
|
+
export { createPolygon }
|
|
44
61
|
|
|
45
62
|
/**
|
|
46
63
|
* Default arrow style for annotations.
|
|
@@ -62,11 +79,15 @@ export declare const defaultTextStyle: TextStyle;
|
|
|
62
79
|
|
|
63
80
|
/**
|
|
64
81
|
* List of available fonts for annotations.
|
|
82
|
+
* @private
|
|
65
83
|
*/
|
|
66
84
|
export declare const fonts: string[];
|
|
67
85
|
|
|
86
|
+
/** @private */
|
|
68
87
|
export declare const fontSizes: number[];
|
|
69
88
|
|
|
89
|
+
export { getAnnotationsBounds }
|
|
90
|
+
|
|
70
91
|
/**
|
|
71
92
|
* Defines the context interface for managing annotations in a React application.
|
|
72
93
|
*
|
|
@@ -77,8 +98,6 @@ export declare const fontSizes: number[];
|
|
|
77
98
|
export declare interface IAnnotationsContext {
|
|
78
99
|
/** Current annotations in the application. */
|
|
79
100
|
annotations: AnnotationCollection;
|
|
80
|
-
/** Updates the annotations in the application. */
|
|
81
|
-
updateAnnotations: default_2.Dispatch<AnnotationAction>;
|
|
82
101
|
/** The currently selected annotation in the application. */
|
|
83
102
|
currentAnnotation: AnnotationFeature | null;
|
|
84
103
|
/** Sets the currently selected annotation in the application. */
|
|
@@ -103,16 +122,55 @@ export declare interface IAnnotationsContext {
|
|
|
103
122
|
editor: Control;
|
|
104
123
|
/** Sets the current annotations editor for managing annotations. */
|
|
105
124
|
setEditor: (editor: Control) => void;
|
|
125
|
+
/** Whether undo is available */
|
|
126
|
+
canUndo: boolean;
|
|
127
|
+
/** Whether redo is available */
|
|
128
|
+
canRedo: boolean;
|
|
129
|
+
/** Undo the last action */
|
|
130
|
+
undo: () => boolean;
|
|
131
|
+
/** Redo the last undone action */
|
|
132
|
+
redo: () => boolean;
|
|
133
|
+
/** Clear the history */
|
|
134
|
+
clearHistory: () => void;
|
|
135
|
+
/** Add annotations */
|
|
136
|
+
add: (annotation: Annotation | AnnotationCollection) => void;
|
|
137
|
+
/** Remove annotations */
|
|
138
|
+
remove: (annotation: Annotation | AnnotationCollection) => void;
|
|
139
|
+
/** Cancel the current drawing operation */
|
|
140
|
+
cancelDrawing: () => void;
|
|
141
|
+
/** Select annotations by ID */
|
|
142
|
+
select: (ids: string | string[]) => void;
|
|
143
|
+
/** Enable box drawing mode */
|
|
144
|
+
enableBoxDrawing: (style?: Partial<Box["properties"]["style"]>) => void;
|
|
145
|
+
/** Enable polygon drawing mode */
|
|
146
|
+
enablePolygonDrawing: (style?: Partial<Polygon["properties"]["style"]>) => void;
|
|
147
|
+
/** Enable comment drawing mode */
|
|
148
|
+
enableCommentDrawing: (options?: {
|
|
149
|
+
offsetX?: number;
|
|
150
|
+
offsetY?: number;
|
|
151
|
+
commentStyle?: Partial<Comment_2["properties"]>;
|
|
152
|
+
arrowStyle?: Partial<ArrowProperties>;
|
|
153
|
+
}) => void;
|
|
106
154
|
}
|
|
107
155
|
|
|
108
156
|
export declare function interpolate(t: number, min?: number, max?: number): number;
|
|
109
157
|
|
|
158
|
+
export { isBox }
|
|
159
|
+
|
|
160
|
+
export { isComment }
|
|
161
|
+
|
|
162
|
+
export { isPolygon }
|
|
163
|
+
|
|
110
164
|
export declare function mean(array: number[]): number;
|
|
111
165
|
|
|
112
166
|
export declare function normalize(t: number, min?: number, max?: number): number;
|
|
113
167
|
|
|
168
|
+
export { Polygon }
|
|
169
|
+
|
|
170
|
+
export { PolygonProperties }
|
|
171
|
+
|
|
114
172
|
declare interface Props {
|
|
115
|
-
children: ReactElement;
|
|
173
|
+
children: ReactElement | ReactElement[];
|
|
116
174
|
annotations?: AnnotationCollection;
|
|
117
175
|
}
|
|
118
176
|
|
|
@@ -121,6 +179,7 @@ declare interface Props {
|
|
|
121
179
|
*/
|
|
122
180
|
export declare const RELATIVE_PADDING = 0.25;
|
|
123
181
|
|
|
182
|
+
/** @private */
|
|
124
183
|
export declare const TRANSPARENT = "none";
|
|
125
184
|
|
|
126
185
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linkurious/ogma-annotations-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "A react component to add ogma annotations with react",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -15,12 +15,16 @@
|
|
|
15
15
|
],
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
+
"types": "./dist/types/index.d.ts",
|
|
18
19
|
"import": "./dist/index.mjs",
|
|
19
20
|
"require": "./dist/index.js",
|
|
20
|
-
"default": "./dist/index.mjs"
|
|
21
|
-
|
|
21
|
+
"default": "./dist/index.mjs"
|
|
22
|
+
},
|
|
23
|
+
"./umd": {
|
|
24
|
+
"types": "./dist/types/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js",
|
|
26
|
+
"require": "./dist/index.js"
|
|
22
27
|
},
|
|
23
|
-
"./umd": "./dist/index.js",
|
|
24
28
|
"./esm": "./dist/index.mjs"
|
|
25
29
|
},
|
|
26
30
|
"scripts": {
|
|
@@ -30,10 +34,10 @@
|
|
|
30
34
|
"bump:patch": "bump2version patch && npm version --no-git-tag-version patch",
|
|
31
35
|
"bump:minor": "bump2version minor && npm version --no-git-tag-version minor",
|
|
32
36
|
"bump:major": "bump2version major && npm version --no-git-tag-version major",
|
|
33
|
-
"docs:build": "vite build -c web/vite.config.mts",
|
|
37
|
+
"docs:build": "typedoc && vite build -c web/vite.config.mts",
|
|
34
38
|
"postdocs:build": "bash scripts/postdocs.sh",
|
|
35
|
-
"lint": "eslint
|
|
36
|
-
"lint:ci": "eslint -f checkstyle -o reports/checkstyle.xml --ext ts,tsx src",
|
|
39
|
+
"lint": "eslint src web --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
40
|
+
"lint:ci": "eslint -f checkstyle -o reports/checkstyle.xml --ext ts,tsx src web",
|
|
37
41
|
"test:unit": "vitest run",
|
|
38
42
|
"test": "npm run test:unit"
|
|
39
43
|
},
|
|
@@ -52,7 +56,7 @@
|
|
|
52
56
|
"license": "Apache-2.0",
|
|
53
57
|
"peerDependencies": {
|
|
54
58
|
"@linkurious/ogma": ">=4.5.6 || ^5.0.0",
|
|
55
|
-
"@linkurious/ogma-annotations": "
|
|
59
|
+
"@linkurious/ogma-annotations": "2.0.0",
|
|
56
60
|
"@linkurious/ogma-react": ">=5",
|
|
57
61
|
"react": ">=17"
|
|
58
62
|
},
|
|
@@ -65,14 +69,18 @@
|
|
|
65
69
|
"eslint": "8.56.0",
|
|
66
70
|
"eslint-plugin-react-hooks": "4.6.0",
|
|
67
71
|
"eslint-plugin-react-refresh": "0.4.5",
|
|
68
|
-
"
|
|
72
|
+
"lucide-react": "0.562.0",
|
|
69
73
|
"react": "18.3.1",
|
|
70
74
|
"react-dom": "18.3.1",
|
|
75
|
+
"typedoc": "0.28.15",
|
|
76
|
+
"typedoc-plugin-markdown": "4.9.0",
|
|
77
|
+
"typedoc-vitepress-theme": "1.1.2",
|
|
71
78
|
"typescript": "5.3.3",
|
|
72
|
-
"
|
|
79
|
+
"vanilla-colorful": "0.7.2",
|
|
80
|
+
"vite": "latest",
|
|
73
81
|
"vite-plugin-dts": "4.5.1",
|
|
74
82
|
"vite-plugin-lib-inject-css": "1.3.0",
|
|
75
|
-
"vitest": "
|
|
83
|
+
"vitest": "latest"
|
|
76
84
|
},
|
|
77
85
|
"eslintConfig": {
|
|
78
86
|
"extends": [
|
|
@@ -89,7 +97,11 @@
|
|
|
89
97
|
{
|
|
90
98
|
"allowConstantExport": true
|
|
91
99
|
}
|
|
92
|
-
]
|
|
100
|
+
],
|
|
101
|
+
"import/no-unresolved": "off"
|
|
93
102
|
}
|
|
103
|
+
},
|
|
104
|
+
"dependencies": {
|
|
105
|
+
"react-day-picker": "9.13.0"
|
|
94
106
|
}
|
|
95
107
|
}
|