abstract-image 8.1.2 → 8.2.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/CHANGELOG.md +6 -0
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-dashed-line.d.ts +3 -0
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-dashed-line.d.ts.map +1 -0
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-dashed-line.js +38 -0
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-dashed-line.js.map +1 -0
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-ellipse.js +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-ellipse.js.map +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-group.js +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-group.js.map +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-line.js +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-line.js.map +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-polygon.js +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-polygon.js.map +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-polyline.js +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-polyline.js.map +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-rectangle.js +1 -1
- package/lib/exporters/__tests__/react-svg-export-image/test-defs/react-svg-rectangle.js.map +1 -1
- package/lib/exporters/__tests__/svg-export-image/test-defs/svg-dashed-line.d.ts +3 -0
- package/lib/exporters/__tests__/svg-export-image/test-defs/svg-dashed-line.d.ts.map +1 -0
- package/lib/exporters/__tests__/svg-export-image/test-defs/svg-dashed-line.js +38 -0
- package/lib/exporters/__tests__/svg-export-image/test-defs/svg-dashed-line.js.map +1 -0
- package/lib/exporters/react-svg-export-image.js +25 -10
- package/lib/exporters/react-svg-export-image.js.map +1 -1
- package/lib/exporters/svg-export-image.js +45 -51
- package/lib/exporters/svg-export-image.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/model/component.d.ts +11 -5
- package/lib/model/component.d.ts.map +1 -1
- package/lib/model/component.js +11 -5
- package/lib/model/component.js.map +1 -1
- package/lib/model/dash-style.d.ts +7 -0
- package/lib/model/dash-style.d.ts.map +1 -0
- package/lib/model/dash-style.js +12 -0
- package/lib/model/dash-style.js.map +1 -0
- package/lib/model/index.d.ts +1 -0
- package/lib/model/index.d.ts.map +1 -1
- package/lib/model/index.js +1 -0
- package/lib/model/index.js.map +1 -1
- package/package.json +2 -2
- package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-dashed-line.tsx +28 -0
- package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-ellipse.tsx +1 -1
- package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-group.tsx +1 -1
- package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-line.tsx +1 -1
- package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-polygon.tsx +1 -1
- package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-polyline.tsx +1 -1
- package/src/exporters/__tests__/react-svg-export-image/test-defs/react-svg-rectangle.tsx +1 -1
- package/src/exporters/__tests__/svg-export-image/test-defs/svg-dashed-line.ts +28 -0
- package/src/exporters/react-svg-export-image.tsx +40 -6
- package/src/exporters/svg-export-image.ts +50 -5
- package/src/index.ts +1 -0
- package/src/model/component.ts +21 -5
- package/src/model/dash-style.ts +13 -0
- package/src/model/index.ts +1 -0
package/src/model/component.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as Point from "./point";
|
|
2
2
|
import * as Color from "./color";
|
|
3
|
+
import * as DashStyle from "./dash-style";
|
|
3
4
|
import * as AbstractImage from "./abstract-image";
|
|
4
5
|
|
|
5
6
|
export type Component = BinaryImage | Ellipse | Line | PolyLine | Polygon | Rectangle | Text | SubImage | Group;
|
|
@@ -68,6 +69,7 @@ export interface Ellipse {
|
|
|
68
69
|
readonly bottomRight: Point.Point;
|
|
69
70
|
readonly strokeColor: Color.Color;
|
|
70
71
|
readonly strokeThickness: number;
|
|
72
|
+
readonly strokeDashStyle: DashStyle.DashStyle;
|
|
71
73
|
readonly fillColor: Color.Color;
|
|
72
74
|
readonly id: string | undefined;
|
|
73
75
|
}
|
|
@@ -78,7 +80,8 @@ export function createEllipse(
|
|
|
78
80
|
strokeColor: Color.Color,
|
|
79
81
|
strokeThickness: number,
|
|
80
82
|
fillColor: Color.Color,
|
|
81
|
-
id?: string
|
|
83
|
+
id?: string,
|
|
84
|
+
strokeDashStyle: DashStyle.DashStyle = DashStyle.solidLine
|
|
82
85
|
): Ellipse {
|
|
83
86
|
return {
|
|
84
87
|
type: "ellipse",
|
|
@@ -86,6 +89,7 @@ export function createEllipse(
|
|
|
86
89
|
bottomRight: bottomRight,
|
|
87
90
|
strokeColor: strokeColor,
|
|
88
91
|
strokeThickness: strokeThickness,
|
|
92
|
+
strokeDashStyle: strokeDashStyle,
|
|
89
93
|
fillColor: fillColor,
|
|
90
94
|
id: id,
|
|
91
95
|
};
|
|
@@ -97,6 +101,7 @@ export interface Line {
|
|
|
97
101
|
readonly end: Point.Point;
|
|
98
102
|
readonly strokeColor: Color.Color;
|
|
99
103
|
readonly strokeThickness: number;
|
|
104
|
+
readonly strokeDashStyle: DashStyle.DashStyle;
|
|
100
105
|
readonly id: string | undefined;
|
|
101
106
|
}
|
|
102
107
|
|
|
@@ -105,7 +110,8 @@ export function createLine(
|
|
|
105
110
|
end: Point.Point,
|
|
106
111
|
strokeColor: Color.Color,
|
|
107
112
|
strokeThickness: number,
|
|
108
|
-
id?: string
|
|
113
|
+
id?: string,
|
|
114
|
+
strokeDashStyle: DashStyle.DashStyle = DashStyle.solidLine
|
|
109
115
|
): Line {
|
|
110
116
|
return {
|
|
111
117
|
type: "line",
|
|
@@ -113,6 +119,7 @@ export function createLine(
|
|
|
113
119
|
end: end,
|
|
114
120
|
strokeColor: strokeColor,
|
|
115
121
|
strokeThickness: strokeThickness,
|
|
122
|
+
strokeDashStyle: strokeDashStyle,
|
|
116
123
|
id: id,
|
|
117
124
|
};
|
|
118
125
|
}
|
|
@@ -122,6 +129,7 @@ export interface PolyLine {
|
|
|
122
129
|
readonly points: Array<Point.Point>;
|
|
123
130
|
readonly strokeColor: Color.Color;
|
|
124
131
|
readonly strokeThickness: number;
|
|
132
|
+
readonly strokeDashStyle: DashStyle.DashStyle;
|
|
125
133
|
readonly id: string | undefined;
|
|
126
134
|
}
|
|
127
135
|
|
|
@@ -129,13 +137,15 @@ export function createPolyLine(
|
|
|
129
137
|
points: Array<Point.Point>,
|
|
130
138
|
strokeColor: Color.Color,
|
|
131
139
|
strokeThickness: number,
|
|
132
|
-
id?: string
|
|
140
|
+
id?: string,
|
|
141
|
+
strokeDashStyle: DashStyle.DashStyle = DashStyle.solidLine
|
|
133
142
|
): PolyLine {
|
|
134
143
|
return {
|
|
135
144
|
type: "polyline",
|
|
136
145
|
points: points,
|
|
137
146
|
strokeColor: strokeColor,
|
|
138
147
|
strokeThickness: strokeThickness,
|
|
148
|
+
strokeDashStyle: strokeDashStyle,
|
|
139
149
|
id: id,
|
|
140
150
|
};
|
|
141
151
|
}
|
|
@@ -145,6 +155,7 @@ export interface Polygon {
|
|
|
145
155
|
readonly points: Array<Point.Point>;
|
|
146
156
|
readonly strokeColor: Color.Color;
|
|
147
157
|
readonly strokeThickness: number;
|
|
158
|
+
readonly strokeDashStyle: DashStyle.DashStyle;
|
|
148
159
|
readonly fillColor: Color.Color;
|
|
149
160
|
readonly id: string | undefined;
|
|
150
161
|
}
|
|
@@ -154,13 +165,15 @@ export function createPolygon(
|
|
|
154
165
|
strokeColor: Color.Color,
|
|
155
166
|
strokeThickness: number,
|
|
156
167
|
fillColor: Color.Color,
|
|
157
|
-
id?: string
|
|
168
|
+
id?: string,
|
|
169
|
+
strokeDashStyle: DashStyle.DashStyle = DashStyle.solidLine
|
|
158
170
|
): Polygon {
|
|
159
171
|
return {
|
|
160
172
|
type: "polygon",
|
|
161
173
|
points: points,
|
|
162
174
|
strokeColor: strokeColor,
|
|
163
175
|
strokeThickness: strokeThickness,
|
|
176
|
+
strokeDashStyle: strokeDashStyle,
|
|
164
177
|
fillColor: fillColor,
|
|
165
178
|
id: id,
|
|
166
179
|
};
|
|
@@ -172,6 +185,7 @@ export interface Rectangle {
|
|
|
172
185
|
readonly bottomRight: Point.Point;
|
|
173
186
|
readonly strokeColor: Color.Color;
|
|
174
187
|
readonly strokeThickness: number;
|
|
188
|
+
readonly strokeDashStyle: DashStyle.DashStyle;
|
|
175
189
|
readonly fillColor: Color.Color;
|
|
176
190
|
readonly id: string | undefined;
|
|
177
191
|
}
|
|
@@ -182,7 +196,8 @@ export function createRectangle(
|
|
|
182
196
|
strokeColor: Color.Color,
|
|
183
197
|
strokeThickness: number,
|
|
184
198
|
fillColor: Color.Color,
|
|
185
|
-
id?: string
|
|
199
|
+
id?: string,
|
|
200
|
+
strokeDashStyle: DashStyle.DashStyle = DashStyle.solidLine
|
|
186
201
|
): Rectangle {
|
|
187
202
|
return {
|
|
188
203
|
type: "rectangle",
|
|
@@ -190,6 +205,7 @@ export function createRectangle(
|
|
|
190
205
|
bottomRight: bottomRight,
|
|
191
206
|
strokeColor: strokeColor,
|
|
192
207
|
strokeThickness: strokeThickness,
|
|
208
|
+
strokeDashStyle: strokeDashStyle,
|
|
193
209
|
fillColor: fillColor,
|
|
194
210
|
id: id,
|
|
195
211
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface DashStyle {
|
|
2
|
+
readonly dashes: ReadonlyArray<number>;
|
|
3
|
+
readonly offset: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function createDashStyle(dashes: ReadonlyArray<number>, offset: number = 0): DashStyle {
|
|
7
|
+
return {
|
|
8
|
+
dashes: dashes,
|
|
9
|
+
offset: offset,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const solidLine = createDashStyle([]);
|
package/src/model/index.ts
CHANGED