soccer-jersey-fork 1.0.89 → 1.0.90

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.
@@ -213,6 +213,12 @@ export const drawSingleBandThin = (page, primaryColor, secondaryColor, bandStyle
213
213
  });
214
214
  };
215
215
  switch (bandStyle) {
216
+ case "diagonalLeft": {
217
+ return drawVertical(10).rotate(325);
218
+ }
219
+ case "diagonalRight": {
220
+ return drawVertical(15).rotate(215);
221
+ }
216
222
  case "horizontal":
217
223
  return page.pattern(100, 90, function (add) {
218
224
  add.rect(100, 90).fill(primaryColor);
@@ -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?: "round" | "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 "round": {
183
+ backgroundShapeElement = page.circle(dimens.width + 4);
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.90",
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
  }