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