@pooder/kit 3.4.0 → 3.5.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,11 @@
1
1
  # @pooder/kit
2
2
 
3
+ ## 3.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - edge features
8
+
3
9
  ## 3.4.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.d.mts CHANGED
@@ -25,16 +25,22 @@ declare class BackgroundTool implements Extension {
25
25
 
26
26
  type Unit = "px" | "mm" | "cm" | "in";
27
27
 
28
- type PositionAnchor = "top-left" | "top-center" | "top-right" | "center-left" | "center" | "center-right" | "bottom-left" | "bottom-center" | "bottom-right";
29
- interface HoleData {
30
- x?: number;
31
- y?: number;
32
- shape?: "circle" | "square";
33
- anchor?: PositionAnchor;
34
- offsetX?: number;
35
- offsetY?: number;
36
- innerRadius: number;
37
- outerRadius: number;
28
+ type FeatureOperation = "add" | "subtract";
29
+ type FeatureShape = "rect" | "circle";
30
+ interface EdgeFeature {
31
+ id: string;
32
+ groupId?: string;
33
+ operation: FeatureOperation;
34
+ shape: FeatureShape;
35
+ x: number;
36
+ y: number;
37
+ width?: number;
38
+ height?: number;
39
+ radius?: number;
40
+ rotation?: number;
41
+ target?: "original" | "offset" | "both";
42
+ color?: string;
43
+ strokeDash?: number[];
38
44
  }
39
45
 
40
46
  interface DielineGeometry {
@@ -48,6 +54,29 @@ interface DielineGeometry {
48
54
  offset: number;
49
55
  borderLength?: number;
50
56
  scale?: number;
57
+ strokeWidth?: number;
58
+ pathData?: string;
59
+ }
60
+ interface LineStyle {
61
+ width: number;
62
+ color: string;
63
+ dashLength: number;
64
+ style: "solid" | "dashed" | "hidden";
65
+ }
66
+ interface DielineState {
67
+ unit: Unit;
68
+ shape: "rect" | "circle" | "ellipse" | "custom";
69
+ width: number;
70
+ height: number;
71
+ radius: number;
72
+ offset: number;
73
+ padding: number | string;
74
+ mainLine: LineStyle;
75
+ offsetLine: LineStyle;
76
+ insideColor: string;
77
+ outsideColor: string;
78
+ showBleedLines: boolean;
79
+ features: EdgeFeature[];
51
80
  pathData?: string;
52
81
  }
53
82
  declare class DielineTool implements Extension {
@@ -55,41 +84,10 @@ declare class DielineTool implements Extension {
55
84
  metadata: {
56
85
  name: string;
57
86
  };
58
- private unit;
59
- private shape;
60
- private width;
61
- private height;
62
- private radius;
63
- private offset;
64
- private style;
65
- private insideColor;
66
- private outsideColor;
67
- private showBleedLines;
68
- private holes;
69
- private position?;
70
- private padding;
71
- private pathData?;
87
+ private state;
72
88
  private canvasService?;
73
89
  private context?;
74
- constructor(options?: Partial<{
75
- unit: Unit;
76
- shape: "rect" | "circle" | "ellipse" | "custom";
77
- width: number;
78
- height: number;
79
- radius: number;
80
- position: {
81
- x: number;
82
- y: number;
83
- };
84
- padding: number | string;
85
- offset: number;
86
- style: "solid" | "dashed";
87
- insideColor: string;
88
- outsideColor: string;
89
- showBleedLines: boolean;
90
- holes: HoleData[];
91
- pathData: string;
92
- }>);
90
+ constructor(options?: Partial<DielineState>);
93
91
  activate(context: ExtensionContext): void;
94
92
  deactivate(context: ExtensionContext): void;
95
93
  contribute(): {
@@ -128,13 +126,12 @@ declare class FilmTool implements Extension {
128
126
  private updateFilm;
129
127
  }
130
128
 
131
- declare class HoleTool implements Extension {
129
+ declare class FeatureTool implements Extension {
132
130
  id: string;
133
131
  metadata: {
134
132
  name: string;
135
133
  };
136
- private holes;
137
- private constraintTarget;
134
+ private features;
138
135
  private canvasService?;
139
136
  private context?;
140
137
  private isUpdatingConfig;
@@ -143,23 +140,22 @@ declare class HoleTool implements Extension {
143
140
  private handleDielineChange;
144
141
  private currentGeometry;
145
142
  constructor(options?: Partial<{
146
- holes: HoleData[];
147
- constraintTarget: "original" | "bleed";
143
+ features: EdgeFeature[];
148
144
  }>);
149
145
  activate(context: ExtensionContext): void;
150
146
  deactivate(context: ExtensionContext): void;
151
147
  contribute(): {
152
- [ContributionPointIds.CONFIGURATIONS]: ConfigurationContribution[];
153
148
  [ContributionPointIds.COMMANDS]: CommandContribution[];
154
149
  };
150
+ private addFeature;
151
+ private addDoubleLayerHole;
152
+ private getGeometryForFeature;
155
153
  private setup;
156
- private initializeHoles;
157
154
  private teardown;
158
- private syncHolesFromCanvas;
159
- private syncHolesToDieline;
155
+ private constrainPosition;
156
+ private syncFeatureFromCanvas;
160
157
  private redraw;
161
- enforceConstraints(): boolean;
162
- private calculateConstrainedPosition;
158
+ private enforceConstraints;
163
159
  }
164
160
 
165
161
  interface ImageItem {
@@ -310,4 +306,4 @@ declare class CanvasService implements Service {
310
306
  requestRenderAll(): void;
311
307
  }
312
308
 
313
- export { BackgroundTool, CanvasService, type DielineGeometry, DielineTool, FilmTool, HoleTool, type ImageItem, ImageTool, MirrorTool, RulerTool, WhiteInkTool };
309
+ export { BackgroundTool, CanvasService, type DielineGeometry, type DielineState, DielineTool, FeatureTool, FilmTool, type ImageItem, ImageTool, type LineStyle, MirrorTool, RulerTool, WhiteInkTool };
package/dist/index.d.ts CHANGED
@@ -25,16 +25,22 @@ declare class BackgroundTool implements Extension {
25
25
 
26
26
  type Unit = "px" | "mm" | "cm" | "in";
27
27
 
28
- type PositionAnchor = "top-left" | "top-center" | "top-right" | "center-left" | "center" | "center-right" | "bottom-left" | "bottom-center" | "bottom-right";
29
- interface HoleData {
30
- x?: number;
31
- y?: number;
32
- shape?: "circle" | "square";
33
- anchor?: PositionAnchor;
34
- offsetX?: number;
35
- offsetY?: number;
36
- innerRadius: number;
37
- outerRadius: number;
28
+ type FeatureOperation = "add" | "subtract";
29
+ type FeatureShape = "rect" | "circle";
30
+ interface EdgeFeature {
31
+ id: string;
32
+ groupId?: string;
33
+ operation: FeatureOperation;
34
+ shape: FeatureShape;
35
+ x: number;
36
+ y: number;
37
+ width?: number;
38
+ height?: number;
39
+ radius?: number;
40
+ rotation?: number;
41
+ target?: "original" | "offset" | "both";
42
+ color?: string;
43
+ strokeDash?: number[];
38
44
  }
39
45
 
40
46
  interface DielineGeometry {
@@ -48,6 +54,29 @@ interface DielineGeometry {
48
54
  offset: number;
49
55
  borderLength?: number;
50
56
  scale?: number;
57
+ strokeWidth?: number;
58
+ pathData?: string;
59
+ }
60
+ interface LineStyle {
61
+ width: number;
62
+ color: string;
63
+ dashLength: number;
64
+ style: "solid" | "dashed" | "hidden";
65
+ }
66
+ interface DielineState {
67
+ unit: Unit;
68
+ shape: "rect" | "circle" | "ellipse" | "custom";
69
+ width: number;
70
+ height: number;
71
+ radius: number;
72
+ offset: number;
73
+ padding: number | string;
74
+ mainLine: LineStyle;
75
+ offsetLine: LineStyle;
76
+ insideColor: string;
77
+ outsideColor: string;
78
+ showBleedLines: boolean;
79
+ features: EdgeFeature[];
51
80
  pathData?: string;
52
81
  }
53
82
  declare class DielineTool implements Extension {
@@ -55,41 +84,10 @@ declare class DielineTool implements Extension {
55
84
  metadata: {
56
85
  name: string;
57
86
  };
58
- private unit;
59
- private shape;
60
- private width;
61
- private height;
62
- private radius;
63
- private offset;
64
- private style;
65
- private insideColor;
66
- private outsideColor;
67
- private showBleedLines;
68
- private holes;
69
- private position?;
70
- private padding;
71
- private pathData?;
87
+ private state;
72
88
  private canvasService?;
73
89
  private context?;
74
- constructor(options?: Partial<{
75
- unit: Unit;
76
- shape: "rect" | "circle" | "ellipse" | "custom";
77
- width: number;
78
- height: number;
79
- radius: number;
80
- position: {
81
- x: number;
82
- y: number;
83
- };
84
- padding: number | string;
85
- offset: number;
86
- style: "solid" | "dashed";
87
- insideColor: string;
88
- outsideColor: string;
89
- showBleedLines: boolean;
90
- holes: HoleData[];
91
- pathData: string;
92
- }>);
90
+ constructor(options?: Partial<DielineState>);
93
91
  activate(context: ExtensionContext): void;
94
92
  deactivate(context: ExtensionContext): void;
95
93
  contribute(): {
@@ -128,13 +126,12 @@ declare class FilmTool implements Extension {
128
126
  private updateFilm;
129
127
  }
130
128
 
131
- declare class HoleTool implements Extension {
129
+ declare class FeatureTool implements Extension {
132
130
  id: string;
133
131
  metadata: {
134
132
  name: string;
135
133
  };
136
- private holes;
137
- private constraintTarget;
134
+ private features;
138
135
  private canvasService?;
139
136
  private context?;
140
137
  private isUpdatingConfig;
@@ -143,23 +140,22 @@ declare class HoleTool implements Extension {
143
140
  private handleDielineChange;
144
141
  private currentGeometry;
145
142
  constructor(options?: Partial<{
146
- holes: HoleData[];
147
- constraintTarget: "original" | "bleed";
143
+ features: EdgeFeature[];
148
144
  }>);
149
145
  activate(context: ExtensionContext): void;
150
146
  deactivate(context: ExtensionContext): void;
151
147
  contribute(): {
152
- [ContributionPointIds.CONFIGURATIONS]: ConfigurationContribution[];
153
148
  [ContributionPointIds.COMMANDS]: CommandContribution[];
154
149
  };
150
+ private addFeature;
151
+ private addDoubleLayerHole;
152
+ private getGeometryForFeature;
155
153
  private setup;
156
- private initializeHoles;
157
154
  private teardown;
158
- private syncHolesFromCanvas;
159
- private syncHolesToDieline;
155
+ private constrainPosition;
156
+ private syncFeatureFromCanvas;
160
157
  private redraw;
161
- enforceConstraints(): boolean;
162
- private calculateConstrainedPosition;
158
+ private enforceConstraints;
163
159
  }
164
160
 
165
161
  interface ImageItem {
@@ -310,4 +306,4 @@ declare class CanvasService implements Service {
310
306
  requestRenderAll(): void;
311
307
  }
312
308
 
313
- export { BackgroundTool, CanvasService, type DielineGeometry, DielineTool, FilmTool, HoleTool, type ImageItem, ImageTool, MirrorTool, RulerTool, WhiteInkTool };
309
+ export { BackgroundTool, CanvasService, type DielineGeometry, type DielineState, DielineTool, FeatureTool, FilmTool, type ImageItem, ImageTool, type LineStyle, MirrorTool, RulerTool, WhiteInkTool };