@pooder/kit 3.0.1 → 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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # @pooder/kit
2
2
 
3
+ ## 3.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ruler and size
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @pooder/core@1.2.0
13
+
14
+ ## 3.1.0
15
+
16
+ ### Minor Changes
17
+
18
+ - feat: anchor position
19
+
3
20
  ## 3.0.1
4
21
 
5
22
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -23,15 +23,22 @@ declare class BackgroundTool implements Extension {
23
23
  private updateBackground;
24
24
  }
25
25
 
26
+ type Unit = "px" | "mm" | "cm" | "in";
27
+
28
+ type PositionAnchor = "top-left" | "top-center" | "top-right" | "center-left" | "center" | "center-right" | "bottom-left" | "bottom-center" | "bottom-right";
26
29
  interface HoleData {
27
- x: number;
28
- y: number;
30
+ x?: number;
31
+ y?: number;
32
+ anchor?: PositionAnchor;
33
+ offsetX?: number;
34
+ offsetY?: number;
29
35
  innerRadius: number;
30
36
  outerRadius: number;
31
37
  }
32
38
 
33
39
  interface DielineGeometry {
34
40
  shape: "rect" | "circle" | "ellipse" | "custom";
41
+ unit: Unit;
35
42
  x: number;
36
43
  y: number;
37
44
  width: number;
@@ -39,6 +46,7 @@ interface DielineGeometry {
39
46
  radius: number;
40
47
  offset: number;
41
48
  borderLength?: number;
49
+ scale?: number;
42
50
  pathData?: string;
43
51
  }
44
52
  declare class DielineTool implements Extension {
@@ -46,6 +54,7 @@ declare class DielineTool implements Extension {
46
54
  metadata: {
47
55
  name: string;
48
56
  };
57
+ private unit;
49
58
  private shape;
50
59
  private width;
51
60
  private height;
@@ -57,11 +66,12 @@ declare class DielineTool implements Extension {
57
66
  private showBleedLines;
58
67
  private holes;
59
68
  private position?;
60
- private borderLength?;
69
+ private padding;
61
70
  private pathData?;
62
71
  private canvasService?;
63
72
  private context?;
64
73
  constructor(options?: Partial<{
74
+ unit: Unit;
65
75
  shape: "rect" | "circle" | "ellipse" | "custom";
66
76
  width: number;
67
77
  height: number;
@@ -70,7 +80,7 @@ declare class DielineTool implements Extension {
70
80
  x: number;
71
81
  y: number;
72
82
  };
73
- borderLength: number;
83
+ padding: number | string;
74
84
  offset: number;
75
85
  style: "solid" | "dashed";
76
86
  insideColor: string;
@@ -89,9 +99,10 @@ declare class DielineTool implements Extension {
89
99
  private createLayer;
90
100
  private destroyLayer;
91
101
  private createHatchPattern;
102
+ private resolvePadding;
92
103
  updateDieline(emitEvent?: boolean): void;
93
104
  getGeometry(): DielineGeometry | null;
94
- exportCutImage(): string | null;
105
+ exportCutImage(): Promise<string | null>;
95
106
  }
96
107
 
97
108
  declare class FilmTool implements Extension {
@@ -121,9 +132,6 @@ declare class HoleTool implements Extension {
121
132
  metadata: {
122
133
  name: string;
123
134
  };
124
- private innerRadius;
125
- private outerRadius;
126
- private style;
127
135
  private holes;
128
136
  private constraintTarget;
129
137
  private canvasService?;
@@ -134,13 +142,7 @@ declare class HoleTool implements Extension {
134
142
  private handleDielineChange;
135
143
  private currentGeometry;
136
144
  constructor(options?: Partial<{
137
- innerRadius: number;
138
- outerRadius: number;
139
- style: "solid" | "dashed";
140
- holes: Array<{
141
- x: number;
142
- y: number;
143
- }>;
145
+ holes: HoleData[];
144
146
  constraintTarget: "original" | "bleed";
145
147
  }>);
146
148
  activate(context: ExtensionContext): void;
@@ -159,39 +161,41 @@ declare class HoleTool implements Extension {
159
161
  private calculateConstrainedPosition;
160
162
  }
161
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
+ }
162
174
  declare class ImageTool implements Extension {
163
175
  id: string;
164
176
  metadata: {
165
177
  name: string;
166
178
  };
167
- private _loadingUrl;
168
- private url;
169
- private opacity;
170
- private width?;
171
- private height?;
172
- private angle?;
173
- private left?;
174
- private top?;
179
+ private items;
180
+ private objectMap;
175
181
  private canvasService?;
176
182
  private context?;
177
- constructor(options?: Partial<{
178
- url: string;
179
- opacity: number;
180
- width: number;
181
- height: number;
182
- angle: number;
183
- left: number;
184
- top: number;
185
- }>);
183
+ private isUpdatingConfig;
186
184
  activate(context: ExtensionContext): void;
187
185
  deactivate(context: ExtensionContext): void;
188
186
  contribute(): {
189
187
  [ContributionPointIds.CONFIGURATIONS]: ConfigurationContribution[];
190
188
  [ContributionPointIds.COMMANDS]: CommandContribution[];
191
189
  };
190
+ private generateId;
191
+ private updateConfig;
192
192
  private ensureLayer;
193
- private updateImage;
193
+ private getLayoutInfo;
194
+ private updateImages;
195
+ private updateObjectProperties;
194
196
  private loadImage;
197
+ private handleObjectModified;
198
+ private updateImageInConfig;
195
199
  }
196
200
 
197
201
  declare class WhiteInkTool implements Extension {
@@ -229,15 +233,19 @@ declare class RulerTool implements Extension {
229
233
  metadata: {
230
234
  name: string;
231
235
  };
232
- private unit;
233
236
  private thickness;
237
+ private gap;
234
238
  private backgroundColor;
235
239
  private textColor;
236
240
  private lineColor;
237
241
  private fontSize;
242
+ private dielineWidth;
243
+ private dielineHeight;
244
+ private dielineUnit;
245
+ private dielinePadding;
246
+ private dielineOffset;
238
247
  private canvasService?;
239
248
  constructor(options?: Partial<{
240
- unit: "px" | "mm" | "cm" | "in";
241
249
  thickness: number;
242
250
  backgroundColor: string;
243
251
  textColor: string;
@@ -253,6 +261,8 @@ declare class RulerTool implements Extension {
253
261
  private getLayer;
254
262
  private createLayer;
255
263
  private destroyLayer;
264
+ private createArrowLine;
265
+ private resolvePadding;
256
266
  private updateRuler;
257
267
  }
258
268
 
@@ -299,4 +309,4 @@ declare class CanvasService implements Service {
299
309
  requestRenderAll(): void;
300
310
  }
301
311
 
302
- 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,15 +23,22 @@ declare class BackgroundTool implements Extension {
23
23
  private updateBackground;
24
24
  }
25
25
 
26
+ type Unit = "px" | "mm" | "cm" | "in";
27
+
28
+ type PositionAnchor = "top-left" | "top-center" | "top-right" | "center-left" | "center" | "center-right" | "bottom-left" | "bottom-center" | "bottom-right";
26
29
  interface HoleData {
27
- x: number;
28
- y: number;
30
+ x?: number;
31
+ y?: number;
32
+ anchor?: PositionAnchor;
33
+ offsetX?: number;
34
+ offsetY?: number;
29
35
  innerRadius: number;
30
36
  outerRadius: number;
31
37
  }
32
38
 
33
39
  interface DielineGeometry {
34
40
  shape: "rect" | "circle" | "ellipse" | "custom";
41
+ unit: Unit;
35
42
  x: number;
36
43
  y: number;
37
44
  width: number;
@@ -39,6 +46,7 @@ interface DielineGeometry {
39
46
  radius: number;
40
47
  offset: number;
41
48
  borderLength?: number;
49
+ scale?: number;
42
50
  pathData?: string;
43
51
  }
44
52
  declare class DielineTool implements Extension {
@@ -46,6 +54,7 @@ declare class DielineTool implements Extension {
46
54
  metadata: {
47
55
  name: string;
48
56
  };
57
+ private unit;
49
58
  private shape;
50
59
  private width;
51
60
  private height;
@@ -57,11 +66,12 @@ declare class DielineTool implements Extension {
57
66
  private showBleedLines;
58
67
  private holes;
59
68
  private position?;
60
- private borderLength?;
69
+ private padding;
61
70
  private pathData?;
62
71
  private canvasService?;
63
72
  private context?;
64
73
  constructor(options?: Partial<{
74
+ unit: Unit;
65
75
  shape: "rect" | "circle" | "ellipse" | "custom";
66
76
  width: number;
67
77
  height: number;
@@ -70,7 +80,7 @@ declare class DielineTool implements Extension {
70
80
  x: number;
71
81
  y: number;
72
82
  };
73
- borderLength: number;
83
+ padding: number | string;
74
84
  offset: number;
75
85
  style: "solid" | "dashed";
76
86
  insideColor: string;
@@ -89,9 +99,10 @@ declare class DielineTool implements Extension {
89
99
  private createLayer;
90
100
  private destroyLayer;
91
101
  private createHatchPattern;
102
+ private resolvePadding;
92
103
  updateDieline(emitEvent?: boolean): void;
93
104
  getGeometry(): DielineGeometry | null;
94
- exportCutImage(): string | null;
105
+ exportCutImage(): Promise<string | null>;
95
106
  }
96
107
 
97
108
  declare class FilmTool implements Extension {
@@ -121,9 +132,6 @@ declare class HoleTool implements Extension {
121
132
  metadata: {
122
133
  name: string;
123
134
  };
124
- private innerRadius;
125
- private outerRadius;
126
- private style;
127
135
  private holes;
128
136
  private constraintTarget;
129
137
  private canvasService?;
@@ -134,13 +142,7 @@ declare class HoleTool implements Extension {
134
142
  private handleDielineChange;
135
143
  private currentGeometry;
136
144
  constructor(options?: Partial<{
137
- innerRadius: number;
138
- outerRadius: number;
139
- style: "solid" | "dashed";
140
- holes: Array<{
141
- x: number;
142
- y: number;
143
- }>;
145
+ holes: HoleData[];
144
146
  constraintTarget: "original" | "bleed";
145
147
  }>);
146
148
  activate(context: ExtensionContext): void;
@@ -159,39 +161,41 @@ declare class HoleTool implements Extension {
159
161
  private calculateConstrainedPosition;
160
162
  }
161
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
+ }
162
174
  declare class ImageTool implements Extension {
163
175
  id: string;
164
176
  metadata: {
165
177
  name: string;
166
178
  };
167
- private _loadingUrl;
168
- private url;
169
- private opacity;
170
- private width?;
171
- private height?;
172
- private angle?;
173
- private left?;
174
- private top?;
179
+ private items;
180
+ private objectMap;
175
181
  private canvasService?;
176
182
  private context?;
177
- constructor(options?: Partial<{
178
- url: string;
179
- opacity: number;
180
- width: number;
181
- height: number;
182
- angle: number;
183
- left: number;
184
- top: number;
185
- }>);
183
+ private isUpdatingConfig;
186
184
  activate(context: ExtensionContext): void;
187
185
  deactivate(context: ExtensionContext): void;
188
186
  contribute(): {
189
187
  [ContributionPointIds.CONFIGURATIONS]: ConfigurationContribution[];
190
188
  [ContributionPointIds.COMMANDS]: CommandContribution[];
191
189
  };
190
+ private generateId;
191
+ private updateConfig;
192
192
  private ensureLayer;
193
- private updateImage;
193
+ private getLayoutInfo;
194
+ private updateImages;
195
+ private updateObjectProperties;
194
196
  private loadImage;
197
+ private handleObjectModified;
198
+ private updateImageInConfig;
195
199
  }
196
200
 
197
201
  declare class WhiteInkTool implements Extension {
@@ -229,15 +233,19 @@ declare class RulerTool implements Extension {
229
233
  metadata: {
230
234
  name: string;
231
235
  };
232
- private unit;
233
236
  private thickness;
237
+ private gap;
234
238
  private backgroundColor;
235
239
  private textColor;
236
240
  private lineColor;
237
241
  private fontSize;
242
+ private dielineWidth;
243
+ private dielineHeight;
244
+ private dielineUnit;
245
+ private dielinePadding;
246
+ private dielineOffset;
238
247
  private canvasService?;
239
248
  constructor(options?: Partial<{
240
- unit: "px" | "mm" | "cm" | "in";
241
249
  thickness: number;
242
250
  backgroundColor: string;
243
251
  textColor: string;
@@ -253,6 +261,8 @@ declare class RulerTool implements Extension {
253
261
  private getLayer;
254
262
  private createLayer;
255
263
  private destroyLayer;
264
+ private createArrowLine;
265
+ private resolvePadding;
256
266
  private updateRuler;
257
267
  }
258
268
 
@@ -299,4 +309,4 @@ declare class CanvasService implements Service {
299
309
  requestRenderAll(): void;
300
310
  }
301
311
 
302
- 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 };