@hpcc-js/react 3.4.7 → 3.4.9
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/LICENSE +43 -43
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +4 -4
- package/src/ImageChar.tsx +42 -42
- package/src/__package__.ts +3 -3
- package/src/edge.tsx +45 -45
- package/src/icon.tsx +95 -95
- package/src/image.tsx +25 -25
- package/src/index.ts +17 -17
- package/src/preact-shim.ts +4 -4
- package/src/render.ts +78 -78
- package/src/shape.tsx +138 -138
- package/src/span.tsx +9 -9
- package/src/subgraph.tsx +45 -45
- package/src/text.tsx +257 -257
- package/src/vertex.tsx +119 -119
- package/src/vertex2.tsx +100 -100
- package/src/vertex3.tsx +238 -238
- package/src/vertex4.tsx +308 -308
package/src/shape.tsx
CHANGED
|
@@ -1,138 +1,138 @@
|
|
|
1
|
-
import * as PReact from "./preact-shim.ts";
|
|
2
|
-
|
|
3
|
-
interface CircleProps {
|
|
4
|
-
radius?: number;
|
|
5
|
-
fill?: string;
|
|
6
|
-
stroke?: string;
|
|
7
|
-
strokeWidth?: number;
|
|
8
|
-
shapeRendering?: "auto" | "optimizeSpeed" | "crispEdges" | "geometricPrecision";
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const Circle: PReact.FunctionComponent<CircleProps> = ({
|
|
12
|
-
radius = 32,
|
|
13
|
-
fill = "navy",
|
|
14
|
-
stroke = fill,
|
|
15
|
-
strokeWidth = 1,
|
|
16
|
-
shapeRendering
|
|
17
|
-
}) => <circle
|
|
18
|
-
r={radius}
|
|
19
|
-
fill={fill}
|
|
20
|
-
stroke={stroke}
|
|
21
|
-
strokeWidth={strokeWidth}
|
|
22
|
-
shapeRendering={shapeRendering}
|
|
23
|
-
/>;
|
|
24
|
-
|
|
25
|
-
interface SquareProps {
|
|
26
|
-
radius?: number;
|
|
27
|
-
cornerRadius?: number;
|
|
28
|
-
fill?: string;
|
|
29
|
-
stroke?: string;
|
|
30
|
-
strokeWidth?: number;
|
|
31
|
-
shapeRendering?: "auto" | "optimizeSpeed" | "crispEdges" | "geometricPrecision";
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export const Square: PReact.FunctionComponent<SquareProps> = ({
|
|
35
|
-
radius = 30,
|
|
36
|
-
cornerRadius = 0,
|
|
37
|
-
fill = "white",
|
|
38
|
-
stroke,
|
|
39
|
-
strokeWidth = 1,
|
|
40
|
-
shapeRendering
|
|
41
|
-
}) => <rect
|
|
42
|
-
x={-radius}
|
|
43
|
-
y={-radius}
|
|
44
|
-
rx={cornerRadius}
|
|
45
|
-
ry={cornerRadius}
|
|
46
|
-
width={radius * 2}
|
|
47
|
-
height={radius * 2}
|
|
48
|
-
fill={fill}
|
|
49
|
-
stroke={stroke || fill}
|
|
50
|
-
strokeWidth={strokeWidth}
|
|
51
|
-
shapeRendering={shapeRendering}
|
|
52
|
-
/>;
|
|
53
|
-
|
|
54
|
-
interface RectangleProps {
|
|
55
|
-
width?: number;
|
|
56
|
-
height?: number;
|
|
57
|
-
cornerRadius?: number;
|
|
58
|
-
fill?: string;
|
|
59
|
-
stroke?: string;
|
|
60
|
-
strokeWidth?: number;
|
|
61
|
-
shapeRendering?: "auto" | "optimizeSpeed" | "crispEdges" | "geometricPrecision";
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export const Rectangle: PReact.FunctionComponent<RectangleProps> = ({
|
|
65
|
-
width = 30,
|
|
66
|
-
height = 30,
|
|
67
|
-
cornerRadius = 0,
|
|
68
|
-
fill = "white",
|
|
69
|
-
stroke = "black",
|
|
70
|
-
strokeWidth = 1,
|
|
71
|
-
shapeRendering
|
|
72
|
-
}) => {
|
|
73
|
-
return <rect
|
|
74
|
-
x={-width / 2}
|
|
75
|
-
y={-height / 2}
|
|
76
|
-
rx={cornerRadius}
|
|
77
|
-
ry={cornerRadius}
|
|
78
|
-
width={width}
|
|
79
|
-
height={height}
|
|
80
|
-
fill={fill}
|
|
81
|
-
stroke={stroke || fill}
|
|
82
|
-
strokeWidth={strokeWidth}
|
|
83
|
-
shapeRendering={shapeRendering}
|
|
84
|
-
/>;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
interface ShapeProps {
|
|
88
|
-
shape?: "circle" | "square" | "rectangle";
|
|
89
|
-
height?: number;
|
|
90
|
-
width?: number;
|
|
91
|
-
fill?: string;
|
|
92
|
-
stroke?: string;
|
|
93
|
-
strokeWidth?: number;
|
|
94
|
-
shapeRendering?: "auto" | "optimizeSpeed" | "crispEdges" | "geometricPrecision";
|
|
95
|
-
cornerRadius?: number;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export const Shape: PReact.FunctionComponent<ShapeProps> = ({
|
|
99
|
-
shape = "circle",
|
|
100
|
-
height = 128,
|
|
101
|
-
width,
|
|
102
|
-
fill,
|
|
103
|
-
stroke,
|
|
104
|
-
strokeWidth = 1,
|
|
105
|
-
shapeRendering,
|
|
106
|
-
cornerRadius
|
|
107
|
-
}) => {
|
|
108
|
-
switch (shape) {
|
|
109
|
-
case "square":
|
|
110
|
-
return <Square
|
|
111
|
-
radius={height / 2}
|
|
112
|
-
fill={fill}
|
|
113
|
-
stroke={stroke}
|
|
114
|
-
strokeWidth={strokeWidth}
|
|
115
|
-
shapeRendering={shapeRendering}
|
|
116
|
-
cornerRadius={cornerRadius}
|
|
117
|
-
/>;
|
|
118
|
-
case "rectangle":
|
|
119
|
-
return <Rectangle
|
|
120
|
-
width={width ?? height}
|
|
121
|
-
height={height}
|
|
122
|
-
fill={fill}
|
|
123
|
-
stroke={stroke}
|
|
124
|
-
strokeWidth={strokeWidth}
|
|
125
|
-
shapeRendering={shapeRendering}
|
|
126
|
-
cornerRadius={cornerRadius}
|
|
127
|
-
/>;
|
|
128
|
-
case "circle":
|
|
129
|
-
default:
|
|
130
|
-
return <Circle
|
|
131
|
-
radius={height / 2}
|
|
132
|
-
fill={fill}
|
|
133
|
-
stroke={stroke}
|
|
134
|
-
strokeWidth={strokeWidth}
|
|
135
|
-
shapeRendering={shapeRendering}
|
|
136
|
-
/>;
|
|
137
|
-
}
|
|
138
|
-
};
|
|
1
|
+
import * as PReact from "./preact-shim.ts";
|
|
2
|
+
|
|
3
|
+
interface CircleProps {
|
|
4
|
+
radius?: number;
|
|
5
|
+
fill?: string;
|
|
6
|
+
stroke?: string;
|
|
7
|
+
strokeWidth?: number;
|
|
8
|
+
shapeRendering?: "auto" | "optimizeSpeed" | "crispEdges" | "geometricPrecision";
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const Circle: PReact.FunctionComponent<CircleProps> = ({
|
|
12
|
+
radius = 32,
|
|
13
|
+
fill = "navy",
|
|
14
|
+
stroke = fill,
|
|
15
|
+
strokeWidth = 1,
|
|
16
|
+
shapeRendering
|
|
17
|
+
}) => <circle
|
|
18
|
+
r={radius}
|
|
19
|
+
fill={fill}
|
|
20
|
+
stroke={stroke}
|
|
21
|
+
strokeWidth={strokeWidth}
|
|
22
|
+
shapeRendering={shapeRendering}
|
|
23
|
+
/>;
|
|
24
|
+
|
|
25
|
+
interface SquareProps {
|
|
26
|
+
radius?: number;
|
|
27
|
+
cornerRadius?: number;
|
|
28
|
+
fill?: string;
|
|
29
|
+
stroke?: string;
|
|
30
|
+
strokeWidth?: number;
|
|
31
|
+
shapeRendering?: "auto" | "optimizeSpeed" | "crispEdges" | "geometricPrecision";
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const Square: PReact.FunctionComponent<SquareProps> = ({
|
|
35
|
+
radius = 30,
|
|
36
|
+
cornerRadius = 0,
|
|
37
|
+
fill = "white",
|
|
38
|
+
stroke,
|
|
39
|
+
strokeWidth = 1,
|
|
40
|
+
shapeRendering
|
|
41
|
+
}) => <rect
|
|
42
|
+
x={-radius}
|
|
43
|
+
y={-radius}
|
|
44
|
+
rx={cornerRadius}
|
|
45
|
+
ry={cornerRadius}
|
|
46
|
+
width={radius * 2}
|
|
47
|
+
height={radius * 2}
|
|
48
|
+
fill={fill}
|
|
49
|
+
stroke={stroke || fill}
|
|
50
|
+
strokeWidth={strokeWidth}
|
|
51
|
+
shapeRendering={shapeRendering}
|
|
52
|
+
/>;
|
|
53
|
+
|
|
54
|
+
interface RectangleProps {
|
|
55
|
+
width?: number;
|
|
56
|
+
height?: number;
|
|
57
|
+
cornerRadius?: number;
|
|
58
|
+
fill?: string;
|
|
59
|
+
stroke?: string;
|
|
60
|
+
strokeWidth?: number;
|
|
61
|
+
shapeRendering?: "auto" | "optimizeSpeed" | "crispEdges" | "geometricPrecision";
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const Rectangle: PReact.FunctionComponent<RectangleProps> = ({
|
|
65
|
+
width = 30,
|
|
66
|
+
height = 30,
|
|
67
|
+
cornerRadius = 0,
|
|
68
|
+
fill = "white",
|
|
69
|
+
stroke = "black",
|
|
70
|
+
strokeWidth = 1,
|
|
71
|
+
shapeRendering
|
|
72
|
+
}) => {
|
|
73
|
+
return <rect
|
|
74
|
+
x={-width / 2}
|
|
75
|
+
y={-height / 2}
|
|
76
|
+
rx={cornerRadius}
|
|
77
|
+
ry={cornerRadius}
|
|
78
|
+
width={width}
|
|
79
|
+
height={height}
|
|
80
|
+
fill={fill}
|
|
81
|
+
stroke={stroke || fill}
|
|
82
|
+
strokeWidth={strokeWidth}
|
|
83
|
+
shapeRendering={shapeRendering}
|
|
84
|
+
/>;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
interface ShapeProps {
|
|
88
|
+
shape?: "circle" | "square" | "rectangle";
|
|
89
|
+
height?: number;
|
|
90
|
+
width?: number;
|
|
91
|
+
fill?: string;
|
|
92
|
+
stroke?: string;
|
|
93
|
+
strokeWidth?: number;
|
|
94
|
+
shapeRendering?: "auto" | "optimizeSpeed" | "crispEdges" | "geometricPrecision";
|
|
95
|
+
cornerRadius?: number;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export const Shape: PReact.FunctionComponent<ShapeProps> = ({
|
|
99
|
+
shape = "circle",
|
|
100
|
+
height = 128,
|
|
101
|
+
width,
|
|
102
|
+
fill,
|
|
103
|
+
stroke,
|
|
104
|
+
strokeWidth = 1,
|
|
105
|
+
shapeRendering,
|
|
106
|
+
cornerRadius
|
|
107
|
+
}) => {
|
|
108
|
+
switch (shape) {
|
|
109
|
+
case "square":
|
|
110
|
+
return <Square
|
|
111
|
+
radius={height / 2}
|
|
112
|
+
fill={fill}
|
|
113
|
+
stroke={stroke}
|
|
114
|
+
strokeWidth={strokeWidth}
|
|
115
|
+
shapeRendering={shapeRendering}
|
|
116
|
+
cornerRadius={cornerRadius}
|
|
117
|
+
/>;
|
|
118
|
+
case "rectangle":
|
|
119
|
+
return <Rectangle
|
|
120
|
+
width={width ?? height}
|
|
121
|
+
height={height}
|
|
122
|
+
fill={fill}
|
|
123
|
+
stroke={stroke}
|
|
124
|
+
strokeWidth={strokeWidth}
|
|
125
|
+
shapeRendering={shapeRendering}
|
|
126
|
+
cornerRadius={cornerRadius}
|
|
127
|
+
/>;
|
|
128
|
+
case "circle":
|
|
129
|
+
default:
|
|
130
|
+
return <Circle
|
|
131
|
+
radius={height / 2}
|
|
132
|
+
fill={fill}
|
|
133
|
+
stroke={stroke}
|
|
134
|
+
strokeWidth={strokeWidth}
|
|
135
|
+
shapeRendering={shapeRendering}
|
|
136
|
+
/>;
|
|
137
|
+
}
|
|
138
|
+
};
|
package/src/span.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as PReact from "./preact-shim.ts";
|
|
2
|
-
|
|
3
|
-
export interface SpanProps {
|
|
4
|
-
text: string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export const Span: PReact.FunctionComponent<SpanProps> = ({
|
|
8
|
-
text
|
|
9
|
-
}) => <span>{text}</span>;
|
|
1
|
+
import * as PReact from "./preact-shim.ts";
|
|
2
|
+
|
|
3
|
+
export interface SpanProps {
|
|
4
|
+
text: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const Span: PReact.FunctionComponent<SpanProps> = ({
|
|
8
|
+
text
|
|
9
|
+
}) => <span>{text}</span>;
|
package/src/subgraph.tsx
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import * as PReact from "./preact-shim.ts";
|
|
2
|
-
import { Utility } from "@hpcc-js/common";
|
|
3
|
-
import { Rectangle } from "./shape.tsx";
|
|
4
|
-
import { Text } from "./text.tsx";
|
|
5
|
-
|
|
6
|
-
export interface SubgraphProps {
|
|
7
|
-
id: string;
|
|
8
|
-
origData?: any;
|
|
9
|
-
text: string;
|
|
10
|
-
width?: number;
|
|
11
|
-
height?: number;
|
|
12
|
-
fill?: string;
|
|
13
|
-
stroke?: string;
|
|
14
|
-
fontHeight?: number;
|
|
15
|
-
fontFamily?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const Subgraph: PReact.FunctionComponent<SubgraphProps> = ({
|
|
19
|
-
text,
|
|
20
|
-
width = 100,
|
|
21
|
-
height = 100,
|
|
22
|
-
fill = "transparent",
|
|
23
|
-
stroke = "black",
|
|
24
|
-
fontHeight = 12,
|
|
25
|
-
fontFamily
|
|
26
|
-
}) => {
|
|
27
|
-
const tSize = Utility.textSize(text, fontFamily, fontHeight, false);
|
|
28
|
-
return <>
|
|
29
|
-
<Rectangle
|
|
30
|
-
width={width}
|
|
31
|
-
height={height}
|
|
32
|
-
fill={fill}
|
|
33
|
-
stroke={stroke}
|
|
34
|
-
/>
|
|
35
|
-
<g
|
|
36
|
-
transform={`translate(${(-width + tSize.width) / 2 + 4} ${(-height + tSize.height) / 2 + 4})`}
|
|
37
|
-
>
|
|
38
|
-
<Text
|
|
39
|
-
height={fontHeight}
|
|
40
|
-
text={text}
|
|
41
|
-
fontFamily={fontFamily}
|
|
42
|
-
/>
|
|
43
|
-
</g>
|
|
44
|
-
</>;
|
|
45
|
-
};
|
|
1
|
+
import * as PReact from "./preact-shim.ts";
|
|
2
|
+
import { Utility } from "@hpcc-js/common";
|
|
3
|
+
import { Rectangle } from "./shape.tsx";
|
|
4
|
+
import { Text } from "./text.tsx";
|
|
5
|
+
|
|
6
|
+
export interface SubgraphProps {
|
|
7
|
+
id: string;
|
|
8
|
+
origData?: any;
|
|
9
|
+
text: string;
|
|
10
|
+
width?: number;
|
|
11
|
+
height?: number;
|
|
12
|
+
fill?: string;
|
|
13
|
+
stroke?: string;
|
|
14
|
+
fontHeight?: number;
|
|
15
|
+
fontFamily?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const Subgraph: PReact.FunctionComponent<SubgraphProps> = ({
|
|
19
|
+
text,
|
|
20
|
+
width = 100,
|
|
21
|
+
height = 100,
|
|
22
|
+
fill = "transparent",
|
|
23
|
+
stroke = "black",
|
|
24
|
+
fontHeight = 12,
|
|
25
|
+
fontFamily
|
|
26
|
+
}) => {
|
|
27
|
+
const tSize = Utility.textSize(text, fontFamily, fontHeight, false);
|
|
28
|
+
return <>
|
|
29
|
+
<Rectangle
|
|
30
|
+
width={width}
|
|
31
|
+
height={height}
|
|
32
|
+
fill={fill}
|
|
33
|
+
stroke={stroke}
|
|
34
|
+
/>
|
|
35
|
+
<g
|
|
36
|
+
transform={`translate(${(-width + tSize.width) / 2 + 4} ${(-height + tSize.height) / 2 + 4})`}
|
|
37
|
+
>
|
|
38
|
+
<Text
|
|
39
|
+
height={fontHeight}
|
|
40
|
+
text={text}
|
|
41
|
+
fontFamily={fontFamily}
|
|
42
|
+
/>
|
|
43
|
+
</g>
|
|
44
|
+
</>;
|
|
45
|
+
};
|