soccer-jersey-fork 1.0.89 → 1.0.91

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.
@@ -6,7 +6,6 @@
6
6
  import { Svg } from "@svgdotjs/svg.js";
7
7
  import { StyleDirection } from "../types";
8
8
  export declare const drawStriped: (page: Svg, primaryColor: string, secondaryColor: string, direction: StyleDirection, thickness?: "thin" | "thick" | "normal") => import("@svgdotjs/svg.js").Pattern;
9
- export declare const drawBigCheckered: (page: Svg, primaryColor: string, secondaryColor: string, direction?: StyleDirection) => import("@svgdotjs/svg.js").Pattern;
10
9
  export declare const drawCheckered: (page: Svg, primaryColor: string, secondaryColor: string, size: "sm" | "lg", direction?: StyleDirection) => import("@svgdotjs/svg.js").Pattern;
11
10
  export declare const drawDiamonds: (page: Svg, primaryColor: string, secondaryColor: string) => import("@svgdotjs/svg.js").Pattern;
12
11
  export declare const drawTwoColors: (page: Svg, primaryColor: string, secondaryColor: string, bandStyle: StyleDirection) => import("@svgdotjs/svg.js").Pattern;
@@ -90,23 +90,6 @@ const drawStripedNormal = (page, primaryColor, secondaryColor, direction) => {
90
90
  }
91
91
  }
92
92
  };
93
- export const drawBigCheckered = (page, primaryColor, secondaryColor, direction) => {
94
- const draw = () => {
95
- return page.pattern(100, 100, function (add) {
96
- add.rect(100, 100).fill(primaryColor);
97
- add.rect(50, 50).fill(secondaryColor);
98
- add.rect(50, 50).fill(secondaryColor).move(50, 50);
99
- });
100
- };
101
- switch (direction) {
102
- case "diagonalLeft": {
103
- return draw().rotate(45);
104
- }
105
- default: {
106
- return draw();
107
- }
108
- }
109
- };
110
93
  export const drawCheckered = (page, primaryColor, secondaryColor, size, direction) => {
111
94
  const tileSize = size === "sm" ? 20 : 100;
112
95
  const patternSize = tileSize / 2;
@@ -209,14 +192,20 @@ export const drawSingleBandThin = (page, primaryColor, secondaryColor, bandStyle
209
192
  const drawVertical = (x) => {
210
193
  return page.pattern(90, 100, function (add) {
211
194
  add.rect(90, 100).fill(primaryColor);
212
- add.rect(5, 100).fill(secondaryColor).move(x, 0);
195
+ add.rect(10, 100).fill(secondaryColor).move(x, 0);
213
196
  });
214
197
  };
215
198
  switch (bandStyle) {
199
+ case "diagonalLeft": {
200
+ return drawVertical(10).rotate(325);
201
+ }
202
+ case "diagonalRight": {
203
+ return drawVertical(15).rotate(215);
204
+ }
216
205
  case "horizontal":
217
206
  return page.pattern(100, 90, function (add) {
218
207
  add.rect(100, 90).fill(primaryColor);
219
- add.rect(100, 5).fill(secondaryColor).move(0, 35);
208
+ add.rect(100, 10).fill(secondaryColor).move(0, 35);
220
209
  });
221
210
  case "vertical":
222
211
  return drawVertical(48);
@@ -9,25 +9,29 @@ const meta = {
9
9
  export default meta;
10
10
  export const Default = {
11
11
  args: {
12
- shirtStyle: "plain",
13
- sleeveColor: "#FFCD00",
14
- sleeveCuffColor: "#FFCD00",
15
- collarColor: "#FFCD00",
16
- shirtColor: "#418FDE",
17
- shortsColor: "#418FDE",
12
+ shirtStyle: "singleBand",
13
+ sleeveColor: "#ffffff",
14
+ sleeveCuffColor: "#E1001A",
15
+ collarColor: "#E1001A",
16
+ shirtColor: "#ffffff",
17
+ shortsColor: "#ffffff",
18
18
  withBadge: false,
19
- texts: [{ text: "Tuvalu", x: 51, y: 43, size: 10, color: "#FFCD00" }],
19
+ texts: [
20
+ { text: "10", x: 69, y: 130, size: 12, color: "#000000" },
21
+ { text: "VfB", x: 52, y: 47, size: 16, color: "#ffffff" },
22
+ ],
20
23
  images: [
21
24
  {
22
- src: "https://resources.simcups.com/flags/w80/226.png",
25
+ src: "https://resources.simcups.com/flags/w80/1254.svg",
23
26
  x: 60,
24
27
  y: 20,
25
28
  width: 12,
26
29
  height: 12,
27
30
  },
28
31
  ],
29
- shortsCuffColor: "#FFCD00",
30
- shoulderSideColor: "#FFCD00",
31
- sleeveStyleColor: "",
32
+ shirtStyleDirection: "horizontal",
33
+ shirtStyleColor: "#E1001A",
34
+ shoulderSideColor: "",
35
+ shortsSideColor: "#E1001A",
32
36
  },
33
37
  };
@@ -27,6 +27,7 @@ export interface DrawSoccerJerseyProps {
27
27
  color: string;
28
28
  outlineColor?: string;
29
29
  backgroundColor?: string;
30
+ backgroundShape?: "ellipse" | "square";
30
31
  }[];
31
32
  images: {
32
33
  src: string;
@@ -157,7 +157,7 @@ export default function drawSoccerJersey({ shirtColor = "plain", shirtStyle, shi
157
157
  */
158
158
  if (texts && texts.length > 0) {
159
159
  for (const textItem of texts) {
160
- const { text, color, size, outlineColor, backgroundColor, x, y } = textItem;
160
+ const { text, color, size, outlineColor, backgroundColor, backgroundShape, x, y, } = textItem;
161
161
  const drawText = (elem) => {
162
162
  return elem
163
163
  .text(text)
@@ -177,10 +177,17 @@ export default function drawSoccerJersey({ shirtColor = "plain", shirtStyle, shi
177
177
  // eslint-disable-next-line new-cap
178
178
  const draftShirtTextElem = drawText(SVG());
179
179
  const dimens = draftShirtTextElem.bbox();
180
- page
181
- .rect(dimens.width + 4, dimens.height + 4)
182
- .fill(backgroundColor)
183
- .center(x, y);
180
+ let backgroundShapeElement;
181
+ switch (backgroundShape) {
182
+ case "ellipse": {
183
+ backgroundShapeElement = page.ellipse(dimens.width + 8, dimens.height + 8);
184
+ break;
185
+ }
186
+ default: {
187
+ backgroundShapeElement = page.rect(dimens.width + 4, dimens.height + 4);
188
+ }
189
+ }
190
+ backgroundShapeElement.fill(backgroundColor).center(x, y);
184
191
  }
185
192
  drawText(page);
186
193
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soccer-jersey-fork",
3
- "version": "1.0.89",
3
+ "version": "1.0.91",
4
4
  "description": "Generate soccer jerseys in SVG format",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -47,6 +47,6 @@
47
47
  "vite": "^7.1.6"
48
48
  },
49
49
  "dependencies": {
50
- "@svgdotjs/svg.js": "github:svgdotjs/svg.js"
50
+ "@svgdotjs/svg.js": "^3.2.5"
51
51
  }
52
52
  }