@linkurious/ogma-annotations-react 1.1.23 → 1.1.24
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/index.js +14 -14
- package/dist/index.mjs +343 -343
- package/dist/types/index.d.ts +66 -1
- package/package.json +6 -4
package/dist/types/index.d.ts
CHANGED
|
@@ -15,38 +15,94 @@ declare type AnnotationAction = {
|
|
|
15
15
|
|
|
16
16
|
declare type AnnotationActionType = "add" | "remove" | "update";
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Creates a React context for managing annotations with type safety.
|
|
20
|
+
*
|
|
21
|
+
* @type {Context<IAnnotationsContext>} A typed context for annotation-related
|
|
22
|
+
* state and operations
|
|
23
|
+
*/
|
|
18
24
|
export declare const AnnotationsContext: Context<IAnnotationsContext>;
|
|
19
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Provides a context provider for managing annotations in a graph visualization.
|
|
28
|
+
*
|
|
29
|
+
* This component handles the state and interactions for creating, selecting,
|
|
30
|
+
* and styling annotations, including arrow and text annotations.
|
|
31
|
+
*
|
|
32
|
+
* @param {Props} props - The component props containing child elements
|
|
33
|
+
* @returns {ReactElement} A context provider with annotation management capabilities
|
|
34
|
+
*/
|
|
20
35
|
export declare const AnnotationsContextProvider: ({ children }: Props) => JSX_2.Element;
|
|
21
36
|
|
|
22
37
|
export declare const BLACK = "#333333";
|
|
23
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Creates a React context for managing annotations with optional type safety.
|
|
41
|
+
*
|
|
42
|
+
* @returns {Context<IAnnotationsContext | null>} A context for annotation-related state and operations that can be null
|
|
43
|
+
*/
|
|
24
44
|
export declare function createAnnotationsContext(): Context<IAnnotationsContext | null>;
|
|
25
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Default arrow style for annotations.
|
|
48
|
+
* @type {ArrowStyles}
|
|
49
|
+
*/
|
|
26
50
|
export declare const defaultArrowStyle: ArrowStyles;
|
|
27
51
|
|
|
52
|
+
/**
|
|
53
|
+
* List of default colors for annotations.
|
|
54
|
+
* @type {string[]}
|
|
55
|
+
*/
|
|
28
56
|
export declare const defaultColors: string[];
|
|
29
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Default text style for annotations.
|
|
60
|
+
* @type {TextStyle}
|
|
61
|
+
*/
|
|
30
62
|
export declare const defaultTextStyle: TextStyle;
|
|
31
63
|
|
|
64
|
+
/**
|
|
65
|
+
* List of available fonts for annotations.
|
|
66
|
+
*/
|
|
32
67
|
export declare const fonts: string[];
|
|
33
68
|
|
|
34
69
|
export declare const fontSizes: number[];
|
|
35
70
|
|
|
36
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Defines the context interface for managing annotations in a React application.
|
|
73
|
+
*
|
|
74
|
+
* @interface
|
|
75
|
+
* @description Provides state and methods for handling annotation collections,
|
|
76
|
+
* current annotation selection, styling, and editor control.
|
|
77
|
+
*/
|
|
78
|
+
export declare interface IAnnotationsContext {
|
|
79
|
+
/** Current annotations in the application. */
|
|
37
80
|
annotations: AnnotationCollection;
|
|
81
|
+
/** Updates the annotations in the application. */
|
|
38
82
|
updateAnnotations: React.Dispatch<AnnotationAction>;
|
|
83
|
+
/** The currently selected annotation in the application. */
|
|
39
84
|
currentAnnotation: AnnotationFeature | null;
|
|
85
|
+
/** Sets the currently selected annotation in the application. */
|
|
40
86
|
setCurrentAnnotation: (annotation: AnnotationFeature | null) => void;
|
|
87
|
+
/** The current arrow style for annotations. */
|
|
41
88
|
arrowStyle: ArrowStyles;
|
|
89
|
+
/** The current width factor for arrow annotations. */
|
|
42
90
|
arrowWidthFactor: number;
|
|
91
|
+
/** Sets the width factor for arrow annotations. */
|
|
43
92
|
setArrowWidthFactor: (arrowWidthFactor: number) => void;
|
|
93
|
+
/** Sets the current arrow style for annotations. */
|
|
44
94
|
setArrowStyle: (arrowStyle: ArrowStyles) => void;
|
|
95
|
+
/** The current text style for annotations. */
|
|
45
96
|
textStyle: TextStyle;
|
|
97
|
+
/** The current size factor for text annotations in regards to node sizes. */
|
|
46
98
|
textSizeFactor: number;
|
|
99
|
+
/** Sets the size factor for text annotations. */
|
|
47
100
|
setTextSizeFactor: (textSizeFactor: number) => void;
|
|
101
|
+
/** Sets the current text style for annotations. */
|
|
48
102
|
setTextStyle: (textStyle: TextStyle) => void;
|
|
103
|
+
/** The annotations editor for managing annotations. See {@link AnnotationsEditor} */
|
|
49
104
|
editor: Control;
|
|
105
|
+
/** Sets the current annotations editor for managing annotations. */
|
|
50
106
|
setEditor: (editor: Control) => void;
|
|
51
107
|
}
|
|
52
108
|
|
|
@@ -60,10 +116,19 @@ declare interface Props {
|
|
|
60
116
|
children: ReactElement;
|
|
61
117
|
}
|
|
62
118
|
|
|
119
|
+
/**
|
|
120
|
+
* Default relative padding for text annotations.
|
|
121
|
+
*/
|
|
63
122
|
export declare const RELATIVE_PADDING = 0.25;
|
|
64
123
|
|
|
65
124
|
export declare const TRANSPARENT = "none";
|
|
66
125
|
|
|
126
|
+
/**
|
|
127
|
+
* Retrieves the current annotations context for accessing and managing annotations.
|
|
128
|
+
*
|
|
129
|
+
* @returns {IAnnotationsContext} The current annotations context with methods and
|
|
130
|
+
* state for annotation management
|
|
131
|
+
*/
|
|
67
132
|
export declare const useAnnotationsContext: () => IAnnotationsContext;
|
|
68
133
|
|
|
69
134
|
export { }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linkurious/ogma-annotations-react",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.24",
|
|
4
4
|
"description": "A react component to add ogma annotations with react",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
"postdocs:build": "bash scripts/postdocs.sh",
|
|
35
35
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
36
36
|
"lint:ci": "eslint -f checkstyle -o reports/checkstyle.xml --ext ts,tsx src",
|
|
37
|
-
"test:unit": ""
|
|
37
|
+
"test:unit": "vitest run",
|
|
38
|
+
"test": "npm run test:unit"
|
|
38
39
|
},
|
|
39
40
|
"publishConfig": {
|
|
40
41
|
"access": "public"
|
|
@@ -51,12 +52,13 @@
|
|
|
51
52
|
"license": "Apache-2.0",
|
|
52
53
|
"peerDependencies": {
|
|
53
54
|
"@linkurious/ogma": ">=4.5.6 || ^5.0.0",
|
|
54
|
-
"@linkurious/ogma-annotations": "^1.1.
|
|
55
|
+
"@linkurious/ogma-annotations": "^1.1.24",
|
|
55
56
|
"@linkurious/ogma-react": ">=5",
|
|
56
57
|
"react": ">=17"
|
|
57
58
|
},
|
|
58
59
|
"devDependencies": {
|
|
59
60
|
"@linkurious/eslint-config-ogma": "^1.0.14",
|
|
61
|
+
"@testing-library/react": "16.2.0",
|
|
60
62
|
"@types/react": "18.3.1",
|
|
61
63
|
"@types/react-dom": "18.3.1",
|
|
62
64
|
"@vitejs/plugin-react": "4.3.4",
|
|
@@ -67,7 +69,7 @@
|
|
|
67
69
|
"react": "18.3.1",
|
|
68
70
|
"react-dom": "18.3.1",
|
|
69
71
|
"typescript": "5.3.3",
|
|
70
|
-
"vite": "6.2.
|
|
72
|
+
"vite": "6.2.2",
|
|
71
73
|
"vite-plugin-dts": "4.5.1",
|
|
72
74
|
"vite-plugin-lib-inject-css": "1.3.0",
|
|
73
75
|
"vitest": "3.0.7"
|