@pooder/kit 3.1.0 → 3.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 +11 -0
- package/dist/index.d.mts +39 -24
- package/dist/index.d.ts +39 -24
- package/dist/index.js +740 -534
- package/dist/index.mjs +744 -538
- package/package.json +2 -2
- package/src/coordinate.ts +57 -0
- package/src/dieline.ts +186 -129
- package/src/geometry.ts +19 -10
- package/src/hole.ts +88 -31
- package/src/image.ts +334 -365
- package/src/ruler.ts +295 -120
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -23,6 +23,8 @@ declare class BackgroundTool implements Extension {
|
|
|
23
23
|
private updateBackground;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
type Unit = "px" | "mm" | "cm" | "in";
|
|
27
|
+
|
|
26
28
|
type PositionAnchor = "top-left" | "top-center" | "top-right" | "center-left" | "center" | "center-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
27
29
|
interface HoleData {
|
|
28
30
|
x?: number;
|
|
@@ -36,6 +38,7 @@ interface HoleData {
|
|
|
36
38
|
|
|
37
39
|
interface DielineGeometry {
|
|
38
40
|
shape: "rect" | "circle" | "ellipse" | "custom";
|
|
41
|
+
unit: Unit;
|
|
39
42
|
x: number;
|
|
40
43
|
y: number;
|
|
41
44
|
width: number;
|
|
@@ -43,6 +46,7 @@ interface DielineGeometry {
|
|
|
43
46
|
radius: number;
|
|
44
47
|
offset: number;
|
|
45
48
|
borderLength?: number;
|
|
49
|
+
scale?: number;
|
|
46
50
|
pathData?: string;
|
|
47
51
|
}
|
|
48
52
|
declare class DielineTool implements Extension {
|
|
@@ -50,6 +54,7 @@ declare class DielineTool implements Extension {
|
|
|
50
54
|
metadata: {
|
|
51
55
|
name: string;
|
|
52
56
|
};
|
|
57
|
+
private unit;
|
|
53
58
|
private shape;
|
|
54
59
|
private width;
|
|
55
60
|
private height;
|
|
@@ -61,11 +66,12 @@ declare class DielineTool implements Extension {
|
|
|
61
66
|
private showBleedLines;
|
|
62
67
|
private holes;
|
|
63
68
|
private position?;
|
|
64
|
-
private
|
|
69
|
+
private padding;
|
|
65
70
|
private pathData?;
|
|
66
71
|
private canvasService?;
|
|
67
72
|
private context?;
|
|
68
73
|
constructor(options?: Partial<{
|
|
74
|
+
unit: Unit;
|
|
69
75
|
shape: "rect" | "circle" | "ellipse" | "custom";
|
|
70
76
|
width: number;
|
|
71
77
|
height: number;
|
|
@@ -74,7 +80,7 @@ declare class DielineTool implements Extension {
|
|
|
74
80
|
x: number;
|
|
75
81
|
y: number;
|
|
76
82
|
};
|
|
77
|
-
|
|
83
|
+
padding: number | string;
|
|
78
84
|
offset: number;
|
|
79
85
|
style: "solid" | "dashed";
|
|
80
86
|
insideColor: string;
|
|
@@ -93,9 +99,10 @@ declare class DielineTool implements Extension {
|
|
|
93
99
|
private createLayer;
|
|
94
100
|
private destroyLayer;
|
|
95
101
|
private createHatchPattern;
|
|
102
|
+
private resolvePadding;
|
|
96
103
|
updateDieline(emitEvent?: boolean): void;
|
|
97
104
|
getGeometry(): DielineGeometry | null;
|
|
98
|
-
exportCutImage(): string | null
|
|
105
|
+
exportCutImage(): Promise<string | null>;
|
|
99
106
|
}
|
|
100
107
|
|
|
101
108
|
declare class FilmTool implements Extension {
|
|
@@ -154,39 +161,41 @@ declare class HoleTool implements Extension {
|
|
|
154
161
|
private calculateConstrainedPosition;
|
|
155
162
|
}
|
|
156
163
|
|
|
164
|
+
interface ImageItem {
|
|
165
|
+
id: string;
|
|
166
|
+
url: string;
|
|
167
|
+
opacity: number;
|
|
168
|
+
width?: number;
|
|
169
|
+
height?: number;
|
|
170
|
+
angle?: number;
|
|
171
|
+
left?: number;
|
|
172
|
+
top?: number;
|
|
173
|
+
}
|
|
157
174
|
declare class ImageTool implements Extension {
|
|
158
175
|
id: string;
|
|
159
176
|
metadata: {
|
|
160
177
|
name: string;
|
|
161
178
|
};
|
|
162
|
-
private
|
|
163
|
-
private
|
|
164
|
-
private opacity;
|
|
165
|
-
private width?;
|
|
166
|
-
private height?;
|
|
167
|
-
private angle?;
|
|
168
|
-
private left?;
|
|
169
|
-
private top?;
|
|
179
|
+
private items;
|
|
180
|
+
private objectMap;
|
|
170
181
|
private canvasService?;
|
|
171
182
|
private context?;
|
|
172
|
-
|
|
173
|
-
url: string;
|
|
174
|
-
opacity: number;
|
|
175
|
-
width: number;
|
|
176
|
-
height: number;
|
|
177
|
-
angle: number;
|
|
178
|
-
left: number;
|
|
179
|
-
top: number;
|
|
180
|
-
}>);
|
|
183
|
+
private isUpdatingConfig;
|
|
181
184
|
activate(context: ExtensionContext): void;
|
|
182
185
|
deactivate(context: ExtensionContext): void;
|
|
183
186
|
contribute(): {
|
|
184
187
|
[ContributionPointIds.CONFIGURATIONS]: ConfigurationContribution[];
|
|
185
188
|
[ContributionPointIds.COMMANDS]: CommandContribution[];
|
|
186
189
|
};
|
|
190
|
+
private generateId;
|
|
191
|
+
private updateConfig;
|
|
187
192
|
private ensureLayer;
|
|
188
|
-
private
|
|
193
|
+
private getLayoutInfo;
|
|
194
|
+
private updateImages;
|
|
195
|
+
private updateObjectProperties;
|
|
189
196
|
private loadImage;
|
|
197
|
+
private handleObjectModified;
|
|
198
|
+
private updateImageInConfig;
|
|
190
199
|
}
|
|
191
200
|
|
|
192
201
|
declare class WhiteInkTool implements Extension {
|
|
@@ -224,15 +233,19 @@ declare class RulerTool implements Extension {
|
|
|
224
233
|
metadata: {
|
|
225
234
|
name: string;
|
|
226
235
|
};
|
|
227
|
-
private unit;
|
|
228
236
|
private thickness;
|
|
237
|
+
private gap;
|
|
229
238
|
private backgroundColor;
|
|
230
239
|
private textColor;
|
|
231
240
|
private lineColor;
|
|
232
241
|
private fontSize;
|
|
242
|
+
private dielineWidth;
|
|
243
|
+
private dielineHeight;
|
|
244
|
+
private dielineUnit;
|
|
245
|
+
private dielinePadding;
|
|
246
|
+
private dielineOffset;
|
|
233
247
|
private canvasService?;
|
|
234
248
|
constructor(options?: Partial<{
|
|
235
|
-
unit: "px" | "mm" | "cm" | "in";
|
|
236
249
|
thickness: number;
|
|
237
250
|
backgroundColor: string;
|
|
238
251
|
textColor: string;
|
|
@@ -248,6 +261,8 @@ declare class RulerTool implements Extension {
|
|
|
248
261
|
private getLayer;
|
|
249
262
|
private createLayer;
|
|
250
263
|
private destroyLayer;
|
|
264
|
+
private createArrowLine;
|
|
265
|
+
private resolvePadding;
|
|
251
266
|
private updateRuler;
|
|
252
267
|
}
|
|
253
268
|
|
|
@@ -294,4 +309,4 @@ declare class CanvasService implements Service {
|
|
|
294
309
|
requestRenderAll(): void;
|
|
295
310
|
}
|
|
296
311
|
|
|
297
|
-
export { BackgroundTool, CanvasService, type DielineGeometry, DielineTool, FilmTool, HoleTool, ImageTool, MirrorTool, RulerTool, WhiteInkTool };
|
|
312
|
+
export { BackgroundTool, CanvasService, type DielineGeometry, DielineTool, FilmTool, HoleTool, type ImageItem, ImageTool, MirrorTool, RulerTool, WhiteInkTool };
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ declare class BackgroundTool implements Extension {
|
|
|
23
23
|
private updateBackground;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
type Unit = "px" | "mm" | "cm" | "in";
|
|
27
|
+
|
|
26
28
|
type PositionAnchor = "top-left" | "top-center" | "top-right" | "center-left" | "center" | "center-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
27
29
|
interface HoleData {
|
|
28
30
|
x?: number;
|
|
@@ -36,6 +38,7 @@ interface HoleData {
|
|
|
36
38
|
|
|
37
39
|
interface DielineGeometry {
|
|
38
40
|
shape: "rect" | "circle" | "ellipse" | "custom";
|
|
41
|
+
unit: Unit;
|
|
39
42
|
x: number;
|
|
40
43
|
y: number;
|
|
41
44
|
width: number;
|
|
@@ -43,6 +46,7 @@ interface DielineGeometry {
|
|
|
43
46
|
radius: number;
|
|
44
47
|
offset: number;
|
|
45
48
|
borderLength?: number;
|
|
49
|
+
scale?: number;
|
|
46
50
|
pathData?: string;
|
|
47
51
|
}
|
|
48
52
|
declare class DielineTool implements Extension {
|
|
@@ -50,6 +54,7 @@ declare class DielineTool implements Extension {
|
|
|
50
54
|
metadata: {
|
|
51
55
|
name: string;
|
|
52
56
|
};
|
|
57
|
+
private unit;
|
|
53
58
|
private shape;
|
|
54
59
|
private width;
|
|
55
60
|
private height;
|
|
@@ -61,11 +66,12 @@ declare class DielineTool implements Extension {
|
|
|
61
66
|
private showBleedLines;
|
|
62
67
|
private holes;
|
|
63
68
|
private position?;
|
|
64
|
-
private
|
|
69
|
+
private padding;
|
|
65
70
|
private pathData?;
|
|
66
71
|
private canvasService?;
|
|
67
72
|
private context?;
|
|
68
73
|
constructor(options?: Partial<{
|
|
74
|
+
unit: Unit;
|
|
69
75
|
shape: "rect" | "circle" | "ellipse" | "custom";
|
|
70
76
|
width: number;
|
|
71
77
|
height: number;
|
|
@@ -74,7 +80,7 @@ declare class DielineTool implements Extension {
|
|
|
74
80
|
x: number;
|
|
75
81
|
y: number;
|
|
76
82
|
};
|
|
77
|
-
|
|
83
|
+
padding: number | string;
|
|
78
84
|
offset: number;
|
|
79
85
|
style: "solid" | "dashed";
|
|
80
86
|
insideColor: string;
|
|
@@ -93,9 +99,10 @@ declare class DielineTool implements Extension {
|
|
|
93
99
|
private createLayer;
|
|
94
100
|
private destroyLayer;
|
|
95
101
|
private createHatchPattern;
|
|
102
|
+
private resolvePadding;
|
|
96
103
|
updateDieline(emitEvent?: boolean): void;
|
|
97
104
|
getGeometry(): DielineGeometry | null;
|
|
98
|
-
exportCutImage(): string | null
|
|
105
|
+
exportCutImage(): Promise<string | null>;
|
|
99
106
|
}
|
|
100
107
|
|
|
101
108
|
declare class FilmTool implements Extension {
|
|
@@ -154,39 +161,41 @@ declare class HoleTool implements Extension {
|
|
|
154
161
|
private calculateConstrainedPosition;
|
|
155
162
|
}
|
|
156
163
|
|
|
164
|
+
interface ImageItem {
|
|
165
|
+
id: string;
|
|
166
|
+
url: string;
|
|
167
|
+
opacity: number;
|
|
168
|
+
width?: number;
|
|
169
|
+
height?: number;
|
|
170
|
+
angle?: number;
|
|
171
|
+
left?: number;
|
|
172
|
+
top?: number;
|
|
173
|
+
}
|
|
157
174
|
declare class ImageTool implements Extension {
|
|
158
175
|
id: string;
|
|
159
176
|
metadata: {
|
|
160
177
|
name: string;
|
|
161
178
|
};
|
|
162
|
-
private
|
|
163
|
-
private
|
|
164
|
-
private opacity;
|
|
165
|
-
private width?;
|
|
166
|
-
private height?;
|
|
167
|
-
private angle?;
|
|
168
|
-
private left?;
|
|
169
|
-
private top?;
|
|
179
|
+
private items;
|
|
180
|
+
private objectMap;
|
|
170
181
|
private canvasService?;
|
|
171
182
|
private context?;
|
|
172
|
-
|
|
173
|
-
url: string;
|
|
174
|
-
opacity: number;
|
|
175
|
-
width: number;
|
|
176
|
-
height: number;
|
|
177
|
-
angle: number;
|
|
178
|
-
left: number;
|
|
179
|
-
top: number;
|
|
180
|
-
}>);
|
|
183
|
+
private isUpdatingConfig;
|
|
181
184
|
activate(context: ExtensionContext): void;
|
|
182
185
|
deactivate(context: ExtensionContext): void;
|
|
183
186
|
contribute(): {
|
|
184
187
|
[ContributionPointIds.CONFIGURATIONS]: ConfigurationContribution[];
|
|
185
188
|
[ContributionPointIds.COMMANDS]: CommandContribution[];
|
|
186
189
|
};
|
|
190
|
+
private generateId;
|
|
191
|
+
private updateConfig;
|
|
187
192
|
private ensureLayer;
|
|
188
|
-
private
|
|
193
|
+
private getLayoutInfo;
|
|
194
|
+
private updateImages;
|
|
195
|
+
private updateObjectProperties;
|
|
189
196
|
private loadImage;
|
|
197
|
+
private handleObjectModified;
|
|
198
|
+
private updateImageInConfig;
|
|
190
199
|
}
|
|
191
200
|
|
|
192
201
|
declare class WhiteInkTool implements Extension {
|
|
@@ -224,15 +233,19 @@ declare class RulerTool implements Extension {
|
|
|
224
233
|
metadata: {
|
|
225
234
|
name: string;
|
|
226
235
|
};
|
|
227
|
-
private unit;
|
|
228
236
|
private thickness;
|
|
237
|
+
private gap;
|
|
229
238
|
private backgroundColor;
|
|
230
239
|
private textColor;
|
|
231
240
|
private lineColor;
|
|
232
241
|
private fontSize;
|
|
242
|
+
private dielineWidth;
|
|
243
|
+
private dielineHeight;
|
|
244
|
+
private dielineUnit;
|
|
245
|
+
private dielinePadding;
|
|
246
|
+
private dielineOffset;
|
|
233
247
|
private canvasService?;
|
|
234
248
|
constructor(options?: Partial<{
|
|
235
|
-
unit: "px" | "mm" | "cm" | "in";
|
|
236
249
|
thickness: number;
|
|
237
250
|
backgroundColor: string;
|
|
238
251
|
textColor: string;
|
|
@@ -248,6 +261,8 @@ declare class RulerTool implements Extension {
|
|
|
248
261
|
private getLayer;
|
|
249
262
|
private createLayer;
|
|
250
263
|
private destroyLayer;
|
|
264
|
+
private createArrowLine;
|
|
265
|
+
private resolvePadding;
|
|
251
266
|
private updateRuler;
|
|
252
267
|
}
|
|
253
268
|
|
|
@@ -294,4 +309,4 @@ declare class CanvasService implements Service {
|
|
|
294
309
|
requestRenderAll(): void;
|
|
295
310
|
}
|
|
296
311
|
|
|
297
|
-
export { BackgroundTool, CanvasService, type DielineGeometry, DielineTool, FilmTool, HoleTool, ImageTool, MirrorTool, RulerTool, WhiteInkTool };
|
|
312
|
+
export { BackgroundTool, CanvasService, type DielineGeometry, DielineTool, FilmTool, HoleTool, type ImageItem, ImageTool, MirrorTool, RulerTool, WhiteInkTool };
|