soccer-jersey-fork 1.0.45 → 1.0.48

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.
@@ -9,10 +9,11 @@ export declare const drawStripedThick: (page: Svg, primaryColor: string, seconda
9
9
  export declare const drawStripedThin: (page: Svg, primaryColor: string, secondaryColor: string, direction: ShirtStyleDirection) => import("@svgdotjs/svg.js").Pattern;
10
10
  export declare const drawStripedNormal: (page: Svg, primaryColor: string, secondaryColor: string, direction: ShirtStyleDirection) => import("@svgdotjs/svg.js").Pattern;
11
11
  export declare const drawStriped: (page: Svg, primaryColor: string, secondaryColor: string, direction: ShirtStyleDirection, thickness?: "thin" | "thick" | "normal") => import("@svgdotjs/svg.js").Pattern;
12
+ export declare const drawShirtSideStriped: (page: Svg, primaryColor: string, secondaryColor: string) => import("@svgdotjs/svg.js").Pattern;
12
13
  export declare const drawCheckered: (page: Svg, primaryColor: string, secondaryColor: string) => import("@svgdotjs/svg.js").Pattern;
13
14
  export declare const drawHoops: (page: Svg, primaryColor: string, secondaryColor: string) => import("@svgdotjs/svg.js").Pattern;
14
15
  export declare const drawTwoColors: (page: Svg, primaryColor: string, secondaryColor: string, bandStyle: ShirtStyleDirection) => import("@svgdotjs/svg.js").Pattern;
15
16
  export declare const drawSingleBand: (page: Svg, primaryColor: string, secondaryColor: string, bandStyle: ShirtStyleDirection) => import("@svgdotjs/svg.js").Pattern;
16
17
  export declare const drawWaves: (page: Svg, primaryColor: string, secondaryColor: string, waveStyle: ShirtStyleDirection) => import("@svgdotjs/svg.js").Pattern;
17
18
  export declare const drawDashes: (page: Svg, primaryColor: string, secondaryColor: string, dashDirection: ShirtStyleDirection) => import("@svgdotjs/svg.js").Pattern;
18
- export declare const drawShortsSideStriped: (page: Svg, color: string) => Svg;
19
+ export declare const drawShortsSideStriped: (page: Svg, primaryColor: string, secondaryColor: string) => import("@svgdotjs/svg.js").Pattern;
@@ -69,6 +69,13 @@ export const drawStriped = (page, primaryColor, secondaryColor, direction, thick
69
69
  return drawStripedNormal(page, primaryColor, secondaryColor, direction);
70
70
  }
71
71
  };
72
+ export const drawShirtSideStriped = (page, primaryColor, secondaryColor) => {
73
+ return page.pattern(51.3, 100, function (add) {
74
+ add.rect(51.3, 100).fill(primaryColor);
75
+ // The move 24.2 is the space between the lines
76
+ add.rect(2, 55).fill(secondaryColor).move(24, 42);
77
+ });
78
+ };
72
79
  export const drawCheckered = (page, primaryColor, secondaryColor) => page.pattern(20, 20, function (add) {
73
80
  add.rect(20, 20).fill(primaryColor);
74
81
  add.rect(10, 10).fill(secondaryColor ? secondaryColor : "#eee");
@@ -239,10 +246,17 @@ export const drawDashes = (page, primaryColor, secondaryColor, dashDirection) =>
239
246
  });
240
247
  }
241
248
  };
242
- export const drawShortsSideStriped = (page, color) => {
243
- const shortsStripedLeft = `m 26 101 q 1 2 -1 38`;
244
- const shortsStripedRight = `m 77 101 q -1 2 1 38`;
245
- page.path(shortsStripedLeft).stroke({ width: 2, color, linecap: "square" });
246
- page.path(shortsStripedRight).stroke({ width: 2, color, linecap: "square" });
247
- return page;
249
+ // export const drawShortsSideStriped = (page: Svg, color: string) => {
250
+ // const shortsStripedLeft = `m 26 101 q 1 2 -1 38`;
251
+ // const shortsStripedRight = `m 77 101 q -1 2 1 38`;
252
+ // page.path(shortsStripedLeft).stroke({ width: 2, color, linecap: "square" });
253
+ // page.path(shortsStripedRight).stroke({ width: 2, color, linecap: "square" });
254
+ // return page;
255
+ // };
256
+ export const drawShortsSideStriped = (page, primaryColor, secondaryColor) => {
257
+ return page.pattern(53, 50, function (add) {
258
+ add.rect(53, 50).fill(primaryColor);
259
+ // The move 24.2 is the space between the lines
260
+ add.rect(1, 40).radius(1, 1).fill(secondaryColor).move(24.5, 0);
261
+ });
248
262
  };
@@ -11,6 +11,8 @@ export const Default = {
11
11
  args: {
12
12
  shirtText: "SJ JS",
13
13
  shirtColor: "#008800",
14
+ shirtStyle: "sideStriped",
15
+ shirtStyleColor: "red",
14
16
  sleeveColor: "#008800",
15
17
  textColor: "#fff",
16
18
  collarColor: "red",
@@ -18,7 +20,7 @@ export const Default = {
18
20
  shortsColor: "black",
19
21
  image: "https://resources.simcups.com/flags/w80/264.png",
20
22
  shortsStyle: "sideStriped",
21
- shortsCuffColor: "#6e6dd2",
23
+ // shortsCuffColor: "#6e6dd2",
22
24
  },
23
25
  };
24
26
  export const ARS = {
@@ -30,5 +30,5 @@ export interface DrawSoccerJerseyProps {
30
30
  withShorts?: boolean;
31
31
  }
32
32
  export type ShirtStyleDirection = "diagonalRight" | "diagonalLeft" | "horizontal" | "vertical";
33
- export type ShirtStyle = "plain" | "twoColors" | "striped" | "stripedThin" | "stripedThick" | "waves" | "checkered" | "hoops" | "singleBand" | "dashed";
33
+ export type ShirtStyle = "plain" | "twoColors" | "striped" | "stripedThin" | "stripedThick" | "sideStriped" | "waves" | "checkered" | "hoops" | "singleBand" | "dashed";
34
34
  export type ShortsStyle = "plain" | "sideStriped";
@@ -7,7 +7,7 @@
7
7
  /* eslint-disable max-len */
8
8
  import { SVG } from "@svgdotjs/svg.js";
9
9
  import lightenDarkenColor from "./lighten-darken-color";
10
- import { drawHoops, drawSingleBand, drawStriped, drawCheckered, drawTwoColors, drawWaves, drawDashes, drawShortsSideStriped, } from "../patterns/patterns";
10
+ import { drawHoops, drawSingleBand, drawStriped, drawCheckered, drawTwoColors, drawWaves, drawDashes, drawShortsSideStriped, drawShirtSideStriped, } from "../patterns/patterns";
11
11
  /**
12
12
  * @param {object} specs Specifications of the soccer jersey.
13
13
  * @param {string} specs.shirtText The text to be displayed on the shirt.
@@ -61,6 +61,9 @@ export default function drawSoccerJersey({ shirtText, textColor, textOutlineColo
61
61
  case "striped":
62
62
  shirtFill = drawStriped(page, optimizedShirtColor, shirtStyleColor ? shirtStyleColor : "#222", shirtStyleDirection || "vertical", "normal");
63
63
  break;
64
+ case "sideStriped":
65
+ shirtFill = drawShirtSideStriped(page, optimizedShirtColor, shirtStyleColor ? shirtStyleColor : "#222");
66
+ break;
64
67
  case "dashed":
65
68
  shirtFill = drawDashes(page, optimizedShirtColor, shirtStyleColor ? shirtStyleColor : "#222", shirtStyleDirection ? shirtStyleDirection : "vertical");
66
69
  break;
@@ -180,7 +183,17 @@ export default function drawSoccerJersey({ shirtText, textColor, textOutlineColo
180
183
  const shortsHeight = withShorts ? 40 : 0;
181
184
  if (withShorts) {
182
185
  const pathShorts = `m 23 98 c 5 6, 50 6, 56 0 l 2 ${shortsHeight} c 0 5, -27 5, -27.5 0 l -2 -10, -2 10, c 0 5, -27 5, -27.5 0 l 1 -${shortsHeight}`;
183
- page.path(pathShorts).fill(shortsColor);
186
+ let shortsFill;
187
+ switch (shortsStyle) {
188
+ case "sideStriped": {
189
+ shortsFill = drawShortsSideStriped(page, shortsColor, shortsStyleColor || "red");
190
+ break;
191
+ }
192
+ default: {
193
+ shortsFill = shortsColor;
194
+ }
195
+ }
196
+ page.path(pathShorts).fill(shortsFill);
184
197
  page.path(pathShorts).fill(page
185
198
  .gradient("linear", function (add) {
186
199
  add.stop(0, "#000", 0.2);
@@ -189,11 +202,6 @@ export default function drawSoccerJersey({ shirtText, textColor, textOutlineColo
189
202
  })
190
203
  .from(1, 1)
191
204
  .to(1, 0));
192
- switch (shortsStyle) {
193
- case "sideStriped": {
194
- drawShortsSideStriped(page, shortsStyleColor || "red");
195
- }
196
- }
197
205
  if (shortsCuffColor) {
198
206
  const pathShortsCuffLeft = `m 23 138 c 5 5, 22 5, 26.5 0`;
199
207
  const pathShortsCuffRight = `m 54 138 c 5 5, 22 5, 26.5 0`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soccer-jersey-fork",
3
- "version": "1.0.45",
3
+ "version": "1.0.48",
4
4
  "description": "Generate soccer jerseys in SVG format",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {