@linkurious/ogma-annotations-react 1.1.15 → 1.1.18
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 +23 -20
- package/dist/index.mjs +1194 -1184
- package/dist/types/index.d.ts +69 -0
- package/package.json +10 -8
- package/dist/AnnotationsContext.d.ts +0 -31
- package/dist/constants.d.ts +0 -9
- package/dist/index.d.ts +0 -3
- package/dist/utils.d.ts +0 -3
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Annotation } from '@linkurious/ogma-annotations';
|
|
2
|
+
import { AnnotationCollection } from '@linkurious/ogma-annotations';
|
|
3
|
+
import { AnnotationFeature } from '@linkurious/ogma-annotations';
|
|
4
|
+
import { ArrowStyles } from '@linkurious/ogma-annotations';
|
|
5
|
+
import { Context } from 'react';
|
|
6
|
+
import { Control } from '@linkurious/ogma-annotations';
|
|
7
|
+
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
8
|
+
import { ReactElement } from 'react';
|
|
9
|
+
import { TextStyle } from '@linkurious/ogma-annotations';
|
|
10
|
+
|
|
11
|
+
declare type AnnotationAction = {
|
|
12
|
+
type: AnnotationActionType;
|
|
13
|
+
payload: Annotation;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
declare type AnnotationActionType = "add" | "remove" | "update";
|
|
17
|
+
|
|
18
|
+
export declare const AnnotationsContext: Context<IAnnotationsContext>;
|
|
19
|
+
|
|
20
|
+
export declare const AnnotationsContextProvider: ({ children }: Props) => JSX_2.Element;
|
|
21
|
+
|
|
22
|
+
export declare const BLACK = "#333333";
|
|
23
|
+
|
|
24
|
+
export declare function createAnnotationsContext(): Context<IAnnotationsContext | null>;
|
|
25
|
+
|
|
26
|
+
export declare const defaultArrowStyle: ArrowStyles;
|
|
27
|
+
|
|
28
|
+
export declare const defaultColors: string[];
|
|
29
|
+
|
|
30
|
+
export declare const defaultTextStyle: TextStyle;
|
|
31
|
+
|
|
32
|
+
export declare const fonts: string[];
|
|
33
|
+
|
|
34
|
+
export declare const fontSizes: number[];
|
|
35
|
+
|
|
36
|
+
declare interface IAnnotationsContext {
|
|
37
|
+
annotations: AnnotationCollection;
|
|
38
|
+
updateAnnotations: React.Dispatch<AnnotationAction>;
|
|
39
|
+
currentAnnotation: AnnotationFeature | null;
|
|
40
|
+
setCurrentAnnotation: (annotation: AnnotationFeature | null) => void;
|
|
41
|
+
arrowStyle: ArrowStyles;
|
|
42
|
+
arrowWidthFactor: number;
|
|
43
|
+
setArrowWidthFactor: (arrowWidthFactor: number) => void;
|
|
44
|
+
setArrowStyle: (arrowStyle: ArrowStyles) => void;
|
|
45
|
+
textStyle: TextStyle;
|
|
46
|
+
textSizeFactor: number;
|
|
47
|
+
setTextSizeFactor: (textSizeFactor: number) => void;
|
|
48
|
+
setTextStyle: (textStyle: TextStyle) => void;
|
|
49
|
+
editor: Control;
|
|
50
|
+
setEditor: (editor: Control) => void;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export declare function interpolate(t: number, min?: number, max?: number): number;
|
|
54
|
+
|
|
55
|
+
export declare function mean(array: number[]): number;
|
|
56
|
+
|
|
57
|
+
export declare function normalize(t: number, min?: number, max?: number): number;
|
|
58
|
+
|
|
59
|
+
declare interface Props {
|
|
60
|
+
children: ReactElement;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export declare const RELATIVE_PADDING = 0.25;
|
|
64
|
+
|
|
65
|
+
export declare const TRANSPARENT = "none";
|
|
66
|
+
|
|
67
|
+
export declare const useAnnotationsContext: () => IAnnotationsContext;
|
|
68
|
+
|
|
69
|
+
export { }
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linkurious/ogma-annotations-react",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.18",
|
|
4
4
|
"description": "A react component to add ogma annotations with react",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"main": "dist/index.mjs",
|
|
6
7
|
"module": "dist/index.mjs",
|
|
7
8
|
"browser": "dist/index.js",
|
|
8
|
-
"types": "dist/index.d.ts",
|
|
9
|
+
"types": "dist/types/index.d.ts",
|
|
9
10
|
"files": [
|
|
10
11
|
"dist"
|
|
11
12
|
],
|
|
@@ -17,13 +18,13 @@
|
|
|
17
18
|
"import": "./dist/index.mjs",
|
|
18
19
|
"require": "./dist/index.js",
|
|
19
20
|
"default": "./dist/index.mjs",
|
|
20
|
-
"types": "./dist/index.d.ts"
|
|
21
|
+
"types": "./dist/types/index.d.ts"
|
|
21
22
|
},
|
|
22
23
|
"./umd": "./dist/index.js",
|
|
23
24
|
"./esm": "./dist/index.mjs"
|
|
24
25
|
},
|
|
25
26
|
"scripts": {
|
|
26
|
-
"dev": "vite -c web/vite.config.
|
|
27
|
+
"dev": "vite -c web/vite.config.mts",
|
|
27
28
|
"build": "tsc --p ./tsconfig-build.json && vite build",
|
|
28
29
|
"postversion": "npm i --save-peer @linkurious/ogma-annotations@${npm_new_version}",
|
|
29
30
|
"bump:patch": "bump2version patch && npm version --no-git-tag-version patch",
|
|
@@ -32,7 +33,8 @@
|
|
|
32
33
|
"docs:build": "vite build -c web/vite.config.mts",
|
|
33
34
|
"postdocs:build": "bash scripts/postdocs.sh",
|
|
34
35
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
35
|
-
"lint:ci": "eslint -f checkstyle -o reports/checkstyle.xml --ext ts,tsx src"
|
|
36
|
+
"lint:ci": "eslint -f checkstyle -o reports/checkstyle.xml --ext ts,tsx src",
|
|
37
|
+
"test:unit": ""
|
|
36
38
|
},
|
|
37
39
|
"publishConfig": {
|
|
38
40
|
"access": "public"
|
|
@@ -49,9 +51,9 @@
|
|
|
49
51
|
"license": "Apache-2.0",
|
|
50
52
|
"peerDependencies": {
|
|
51
53
|
"@linkurious/ogma": ">=4.5.6 || ^5.0.0",
|
|
52
|
-
"@linkurious/ogma-annotations": "^1.1.
|
|
53
|
-
"@linkurious/ogma-react": ">=
|
|
54
|
-
"react": "
|
|
54
|
+
"@linkurious/ogma-annotations": "^1.1.18",
|
|
55
|
+
"@linkurious/ogma-react": ">=5",
|
|
56
|
+
"react": ">=17"
|
|
55
57
|
},
|
|
56
58
|
"devDependencies": {
|
|
57
59
|
"@geist-ui/react": "2.2.5",
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Context, ReactElement } from "react";
|
|
2
|
-
import { AnnotationCollection, AnnotationFeature, ArrowStyles, TextStyle, Control as AnnotationsEditor, Annotation } from "@linkurious/ogma-annotations";
|
|
3
|
-
interface IAnnotationsContext {
|
|
4
|
-
annotations: AnnotationCollection;
|
|
5
|
-
updateAnnotations: React.Dispatch<AnnotationAction>;
|
|
6
|
-
currentAnnotation: AnnotationFeature | null;
|
|
7
|
-
setCurrentAnnotation: (annotation: AnnotationFeature | null) => void;
|
|
8
|
-
arrowStyle: ArrowStyles;
|
|
9
|
-
arrowWidthFactor: number;
|
|
10
|
-
setArrowWidthFactor: (arrowWidthFactor: number) => void;
|
|
11
|
-
setArrowStyle: (arrowStyle: ArrowStyles) => void;
|
|
12
|
-
textStyle: TextStyle;
|
|
13
|
-
textSizeFactor: number;
|
|
14
|
-
setTextSizeFactor: (textSizeFactor: number) => void;
|
|
15
|
-
setTextStyle: (textStyle: TextStyle) => void;
|
|
16
|
-
editor: AnnotationsEditor;
|
|
17
|
-
setEditor: (editor: AnnotationsEditor) => void;
|
|
18
|
-
}
|
|
19
|
-
export declare function createAnnotationsContext(): Context<IAnnotationsContext | null>;
|
|
20
|
-
export declare const AnnotationsContext: Context<IAnnotationsContext>;
|
|
21
|
-
export declare const useAnnotationsContext: () => IAnnotationsContext;
|
|
22
|
-
interface Props {
|
|
23
|
-
children: ReactElement;
|
|
24
|
-
}
|
|
25
|
-
type AnnotationActionType = "add" | "remove" | "update";
|
|
26
|
-
type AnnotationAction = {
|
|
27
|
-
type: AnnotationActionType;
|
|
28
|
-
payload: Annotation;
|
|
29
|
-
};
|
|
30
|
-
export declare const AnnotationsContextProvider: ({ children }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
-
export {};
|
package/dist/constants.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ArrowStyles, TextStyle } from "@linkurious/ogma-annotations";
|
|
2
|
-
export declare const fontSizes: number[];
|
|
3
|
-
export declare const TRANSPARENT = "none";
|
|
4
|
-
export declare const BLACK = "#333333";
|
|
5
|
-
export declare const defaultColors: string[];
|
|
6
|
-
export declare const fonts: string[];
|
|
7
|
-
export declare const defaultArrowStyle: ArrowStyles;
|
|
8
|
-
export declare const RELATIVE_PADDING = 0.25;
|
|
9
|
-
export declare const defaultTextStyle: TextStyle;
|
package/dist/index.d.ts
DELETED
package/dist/utils.d.ts
DELETED