qrdx 0.0.52 → 0.0.54

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.
Files changed (63) hide show
  1. package/dist/core.js +7 -7
  2. package/dist/core.js.map +1 -1
  3. package/dist/core.mjs +7 -7
  4. package/dist/core.mjs.map +1 -1
  5. package/dist/element.browser.mjs +17 -17
  6. package/dist/element.browser.mjs.map +1 -1
  7. package/dist/index.js +7 -7
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +7 -7
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/qr-code-canvas.js +1 -1
  12. package/dist/qr-code-canvas.js.map +1 -1
  13. package/dist/qr-code-canvas.mjs +1 -1
  14. package/dist/qr-code-canvas.mjs.map +1 -1
  15. package/dist/src/frame-spec.d.ts.map +1 -1
  16. package/dist/src/frame.d.ts +13 -3
  17. package/dist/src/frame.d.ts.map +1 -1
  18. package/dist/src/template/arrow.d.ts +0 -1
  19. package/dist/src/template/arrow.d.ts.map +1 -1
  20. package/dist/src/template/frame-template.d.ts +19 -0
  21. package/dist/src/template/frame-template.d.ts.map +1 -0
  22. package/dist/src/template/halloween.d.ts +0 -1
  23. package/dist/src/template/halloween.d.ts.map +1 -1
  24. package/dist/src/template/square-border.d.ts +0 -1
  25. package/dist/src/template/square-border.d.ts.map +1 -1
  26. package/dist/src/template/standard-box.d.ts +0 -1
  27. package/dist/src/template/standard-box.d.ts.map +1 -1
  28. package/dist/src/template/striked-box.d.ts +0 -1
  29. package/dist/src/template/striked-box.d.ts.map +1 -1
  30. package/dist/types/frame-spec.d.ts +554 -0
  31. package/dist/types/frame-spec.d.ts.map +1 -1
  32. package/dist/types/index.js +2 -2
  33. package/dist/types/index.js.map +1 -1
  34. package/dist/types/index.mjs +2 -2
  35. package/dist/types/index.mjs.map +1 -1
  36. package/dist/types/qr.d.ts +111 -0
  37. package/dist/types/qr.d.ts.map +1 -1
  38. package/dist/types/template.d.ts +7 -0
  39. package/dist/types/template.d.ts.map +1 -1
  40. package/dist/vanilla.browser.mjs +15 -15
  41. package/dist/vanilla.browser.mjs.map +1 -1
  42. package/package.json +3 -3
  43. package/src/frame-spec.ts +17 -2
  44. package/src/frame.tsx +57 -7
  45. package/src/rasterize.ts +1 -1
  46. package/src/template/arrow.ts +14 -0
  47. package/src/template/frame-template.tsx +70 -0
  48. package/src/template/halloween.ts +14 -0
  49. package/src/template/specs/arrow.json +26 -0
  50. package/src/template/specs/halloween.json +144 -0
  51. package/src/template/specs/square-border.json +27 -0
  52. package/src/template/specs/standard-box.json +31 -0
  53. package/src/template/specs/striked-box.json +56 -0
  54. package/src/template/square-border.ts +14 -0
  55. package/src/template/standard-box.ts +14 -0
  56. package/src/template/striked-box.ts +14 -0
  57. package/types/frame-spec.ts +67 -4
  58. package/types/template.ts +7 -0
  59. package/src/template/arrow.tsx +0 -40
  60. package/src/template/halloween.tsx +0 -147
  61. package/src/template/square-border.tsx +0 -43
  62. package/src/template/standard-box.tsx +0 -43
  63. package/src/template/striked-box.tsx +0 -42
@@ -222,6 +222,18 @@ const boxFields = {
222
222
  height: positive,
223
223
  };
224
224
 
225
+ /**
226
+ * An outline drawn along a shape's edge, centered on it (half inside, half
227
+ * outside), in one solid color. Corners are mitered, as SVG draws them.
228
+ */
229
+ const strokeSchema = z
230
+ .object({
231
+ color: frameSpecColorSchema,
232
+ /** Thickness, at most 10% of the artboard's shorter side */
233
+ width: positive,
234
+ })
235
+ .strict();
236
+
225
237
  const rectShapeSchema = z
226
238
  .object({
227
239
  type: z.literal("rect"),
@@ -233,6 +245,7 @@ const rectShapeSchema = z
233
245
  .object({ ...boxFields, radius: nonNegative.optional() })
234
246
  .strict()
235
247
  .optional(),
248
+ stroke: strokeSchema.optional(),
236
249
  })
237
250
  .strict();
238
251
 
@@ -245,6 +258,7 @@ const circleShapeSchema = z
245
258
  /** Radius of a hole in the middle (a ring) */
246
259
  hole: positive.optional(),
247
260
  fill: frameSpecPaintSchema,
261
+ stroke: strokeSchema.optional(),
248
262
  })
249
263
  .strict();
250
264
 
@@ -256,6 +270,7 @@ const ellipseShapeSchema = z
256
270
  rx: positive,
257
271
  ry: positive,
258
272
  fill: frameSpecPaintSchema,
273
+ stroke: strokeSchema.optional(),
259
274
  })
260
275
  .strict();
261
276
 
@@ -267,6 +282,7 @@ const polygonShapeSchema = z
267
282
  .min(3)
268
283
  .max(FRAME_SPEC_LIMITS.maxPolygonPoints),
269
284
  fill: frameSpecPaintSchema,
285
+ stroke: strokeSchema.optional(),
270
286
  })
271
287
  .strict();
272
288
 
@@ -277,6 +293,7 @@ const pathShapeSchema = z
277
293
  d: z.string().min(2).max(FRAME_SPEC_LIMITS.maxPathLength),
278
294
  fill: frameSpecPaintSchema,
279
295
  fillRule: z.enum(["nonzero", "evenodd"]).optional(),
296
+ stroke: strokeSchema.optional(),
280
297
  })
281
298
  .strict();
282
299
 
@@ -415,9 +432,13 @@ const frameSpecObjectSchema = z
415
432
  * them white, so artwork never shows through the quiet zone.
416
433
  * "background" keeps them see-through too (and leaves the plate
417
434
  * out); it's allowed only when nothing but `background` fills, or a
418
- * ring whose hole clears the plate, lies under the plate.
435
+ * ring whose hole clears the plate, lies under the plate. "none"
436
+ * paints no plate at all: the code's own background and margin are
437
+ * its light space, so `padding` may be under 4% (down to 0), and
438
+ * whatever lies under the code shows through a see-through
439
+ * background.
419
440
  */
420
- plate: z.enum(["opaque", "background"]).optional(),
441
+ plate: z.enum(["opaque", "background", "none"]).optional(),
421
442
  })
422
443
  .strict(),
423
444
  /** Default colors, used when the theme sets none */
@@ -582,7 +603,13 @@ function paintsUnderPlate(
582
603
  bounds: Box
583
604
  ): boolean {
584
605
  const zone = frameSpecQrZone(spec);
585
- if (shape.fill === "background" || !overlaps(bounds, zone)) {
606
+ if (!overlaps(bounds, zone)) {
607
+ return false;
608
+ }
609
+ if ("stroke" in shape && shape.stroke) {
610
+ return true;
611
+ }
612
+ if (shape.fill === "background") {
586
613
  return false;
587
614
  }
588
615
  if (shape.type === "rect" && shape.hole) {
@@ -611,6 +638,31 @@ function paintsUnderPlate(
611
638
  export function frameSpecShapeBounds(shape: FrameSpecShape): {
612
639
  bounds: Box | null;
613
640
  segments: number;
641
+ } {
642
+ const outline = outlineBounds(shape);
643
+ const stroke = "stroke" in shape ? shape.stroke : undefined;
644
+ if (!(stroke && outline.bounds)) {
645
+ return outline;
646
+ }
647
+ // Half the width outside a curve; a mitered corner reaches further (up to
648
+ // SVG's default miter limit of 4 half widths)
649
+ const reach =
650
+ shape.type === "circle" || shape.type === "ellipse"
651
+ ? stroke.width / 2
652
+ : shape.type === "rect"
653
+ ? (stroke.width * Math.SQRT2) / 2
654
+ : stroke.width * 2;
655
+ const { x0, y0, x1, y1 } = outline.bounds;
656
+ return {
657
+ bounds: { x0: x0 - reach, y0: y0 - reach, x1: x1 + reach, y1: y1 + reach },
658
+ // The outline is drawn a second time, as the stroke
659
+ segments: outline.segments * 2,
660
+ };
661
+ }
662
+
663
+ function outlineBounds(shape: FrameSpecShape): {
664
+ bounds: Box | null;
665
+ segments: number;
614
666
  } {
615
667
  switch (shape.type) {
616
668
  case "rect":
@@ -722,7 +774,7 @@ function checkFrameSpec(spec: FrameSpec, ctx: z.RefinementCtx) {
722
774
  // The code: big enough, inside the artboard with its padding
723
775
  const { qr } = spec;
724
776
  const padding = frameSpecPadding(spec);
725
- if (padding < qr.size * limits.minPadding - 1e-9) {
777
+ if (qr.plate !== "none" && padding < qr.size * limits.minPadding - 1e-9) {
726
778
  issue(
727
779
  `qr.padding must be at least ${limits.minPadding * 100}% of qr.size`,
728
780
  ["qr", "padding"]
@@ -777,6 +829,17 @@ function checkFrameSpec(spec: FrameSpec, ctx: z.RefinementCtx) {
777
829
  if (shape.type === "circle" && shape.hole && shape.hole >= shape.r) {
778
830
  issue("The hole must be smaller than the circle", [...path, "hole"]);
779
831
  }
832
+ if (
833
+ "stroke" in shape &&
834
+ shape.stroke &&
835
+ shape.stroke.width > Math.min(width, height) * 0.1 + 1e-9
836
+ ) {
837
+ issue("A stroke may be at most 10% of the artboard's shorter side", [
838
+ ...path,
839
+ "stroke",
840
+ "width",
841
+ ]);
842
+ }
780
843
  if (qr.plate === "background" && paintsUnderPlate(shape, spec, bounds)) {
781
844
  issue(
782
845
  'With qr.plate "background", only background fills (or a ring whose hole holds the plate) may lie under the plate',
package/types/template.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import type { FrameSpec } from "./frame-spec";
2
3
 
3
4
  // Zod schemas
4
5
  export const baseTemplatePropsSchema = z.object({
@@ -54,6 +55,12 @@ export interface TemplateDefinition<TCustomProps = Record<string, never>> {
54
55
  id: string;
55
56
  name: string;
56
57
  description?: string;
58
+ /**
59
+ * The frame spec a built-in template draws its artwork from (they're all
60
+ * frames: `{ style: "custom", spec }` draws the same artwork as a frame).
61
+ * Templates that draw in code, like custom ones, have none.
62
+ */
63
+ spec?: FrameSpec;
57
64
  wrapper: (
58
65
  children: TemplateNode,
59
66
  props?: BaseTemplateProps & TCustomProps,
@@ -1,40 +0,0 @@
1
- /** @jsxImportSource ../jsx */
2
- import type { TemplateDefinition } from "../../types";
3
-
4
- export const Arrow: TemplateDefinition = {
5
- id: "Arrow",
6
- name: "Arrow",
7
- description: "QR code with arrow",
8
- wrapper: (children, props) => (
9
- <svg
10
- height="300"
11
- id="svgQrWrapper"
12
- style={{
13
- width: "100%",
14
- height: "100%",
15
- // backgroundColor: props?.bgColor || "rgb(255, 255, 255)",
16
- }}
17
- viewBox="0 0 300 300"
18
- width="300"
19
- xmlns="http://www.w3.org/2000/svg"
20
- xmlnsXlink="http://www.w3.org/1999/xlink"
21
- >
22
- <svg
23
- fill="#000000"
24
- height="300"
25
- viewBox="0 0 300 300"
26
- width="300"
27
- xmlns="http://www.w3.org/2000/svg"
28
- >
29
- <path
30
- d="M73.57,175.23h0c.12-2.06.31-4.19.49-6.25s.48-4.13.85-6.13.79-4,1.27-5.95a30.21,30.21,0,0,1,1.94-5.28h0c.06-.18.13-.43.19-.67a3.55,3.55,0,0,0-2.8-4.19l-.18-.06a1.85,1.85,0,0,0-.54-.06c-.19,0-.31-.06-.49-.06s-.61-.06-.91-.06c-.61,0-1.21.06-1.82.06-1.21.12-2.37.25-3.52.43a62.08,62.08,0,0,0-6.8,1.45,58.45,58.45,0,0,0-6.43,2.31c-1,.42-2.07,1-3.1,1.4s-2,1.09-3,1.57a.76.76,0,0,0,.54,1.4h.07c1.09-.24,2.12-.55,3.15-.79s2.13-.48,3.16-.61A46,46,0,0,1,62,153c1.34-.06,2.73-.06,4.07-.06a62.58,62.58,0,0,0-7.23,10.43,85.58,85.58,0,0,0-6.55,15.36,107.86,107.86,0,0,0-5,32.53,104.06,104.06,0,0,0,5,32.29,90.47,90.47,0,0,0,15.54,28.52.94.94,0,0,0,1.27.19.89.89,0,0,0,.18-1.28h0a87.24,87.24,0,0,1-13.89-28.28A102.85,102.85,0,0,1,58,180.87a82.15,82.15,0,0,1,6.68-14,51.58,51.58,0,0,1,5.71-7.76c0,1.21,0,2.36.06,3.58.12,2.18.24,4.31.48,6.43s.49,4.25.85,6.37a1,1,0,0,0,.91.85A1.37,1.37,0,0,0,73.57,175.23Z"
31
- fill={props?.fgColor || "black"}
32
- id="CallToActionArrow"
33
- />
34
- <g fill="none" transform="translate(82, 95)scale(0.5)">
35
- {children}
36
- </g>
37
- </svg>
38
- </svg>
39
- ),
40
- };
@@ -1,147 +0,0 @@
1
- /** @jsxImportSource ../jsx */
2
- import type { TemplateDefinition } from "../../types";
3
-
4
- export const Halloween: TemplateDefinition = {
5
- id: "Halloween",
6
- name: "Halloween",
7
- description: "QR code with Halloween theme",
8
- wrapper: (children) => (
9
- <svg
10
- height="300"
11
- id="svgQrWrapper"
12
- style={{
13
- width: "100%",
14
- height: "100%",
15
- }}
16
- viewBox="0 0 300 300"
17
- width="300"
18
- xmlns="http://www.w3.org/2000/svg"
19
- xmlnsXlink="http://www.w3.org/1999/xlink"
20
- >
21
- <svg
22
- fill="none"
23
- height="300"
24
- viewBox="0 0 300 300"
25
- width="300"
26
- xmlns="http://www.w3.org/2000/svg"
27
- >
28
- <g transform="translate(10, 10)">
29
- <circle
30
- cx="138"
31
- cy="167.682"
32
- fill="white"
33
- r="99.3177"
34
- stroke="#F89941"
35
- strokeWidth="20"
36
- />
37
- <rect
38
- fill="url(#pattern0)"
39
- height="110.806"
40
- width="113"
41
- x="81.0001"
42
- y="124.097"
43
- />
44
- <ellipse
45
- cx="167.989"
46
- cy="67.8947"
47
- fill="#F89941"
48
- rx="35.4453"
49
- ry="48.4419"
50
- />
51
- <path
52
- d="M187.937 69.0763C187.937 82.6574 184.092 94.8451 178.005 103.57C171.912 112.304 163.736 117.381 154.992 117.381C146.247 117.381 138.072 112.304 131.979 103.57C125.891 94.8451 122.047 82.6574 122.047 69.0763C122.047 55.4952 125.891 43.3075 131.979 34.5823C138.072 25.8486 146.247 20.7714 154.992 20.7714C163.736 20.7714 171.912 25.8486 178.005 34.5823C184.092 43.3075 187.937 55.4952 187.937 69.0763Z"
53
- fill="#F89941"
54
- stroke="#E78249"
55
- strokeWidth="5"
56
- />
57
- <ellipse
58
- cx="154.072"
59
- cy="69.4866"
60
- fill="#F89941"
61
- rx="34.0512"
62
- ry="50.6615"
63
- />
64
- <path
65
- d="M171.396 69.667C171.396 82.7394 167.562 94.4717 161.488 102.874C155.412 111.279 147.235 116.2 138.451 116.2C129.666 116.2 121.489 111.279 115.413 102.874C109.34 94.4717 105.506 82.7394 105.506 69.667C105.506 56.5946 109.34 44.8624 115.413 36.4603C121.489 28.0551 129.666 23.1344 138.451 23.1344C147.235 23.1344 155.412 28.0551 161.488 36.4603C167.562 44.8624 171.396 56.5946 171.396 69.667Z"
66
- fill="#F89941"
67
- stroke="#E78249"
68
- strokeWidth="5"
69
- />
70
- <ellipse
71
- cx="134.316"
72
- cy="70.8486"
73
- fill="#F89941"
74
- rx="33.673"
75
- ry="47.8511"
76
- />
77
- <ellipse
78
- fill="#F89941"
79
- rx="35.4453"
80
- ry="48.4419"
81
- transform="matrix(-1 0 0 1 106.743 68.4484)"
82
- />
83
- <path
84
- d="M86.7942 69.6299C86.7942 83.2111 90.6388 95.3988 96.7262 104.124C102.819 112.858 110.995 117.935 119.739 117.935C128.484 117.935 136.659 112.858 142.753 104.124C148.84 95.3988 152.685 83.2111 152.685 69.6299C152.685 56.0488 148.84 43.8611 142.753 35.1359C136.659 26.4023 128.484 21.3251 119.739 21.3251C110.995 21.3251 102.819 26.4023 96.7262 35.1359C90.6388 43.8611 86.7942 56.0488 86.7942 69.6299Z"
85
- fill="#F89941"
86
- stroke="#E78249"
87
- strokeWidth="5"
88
- />
89
- <ellipse
90
- fill="#F89941"
91
- rx="32.9438"
92
- ry="50.3847"
93
- transform="matrix(-1 0 0 1 119.744 69.7634)"
94
- />
95
- <path
96
- d="M103.335 70.2207C103.335 83.293 107.169 95.0253 113.243 103.427C119.319 111.833 127.496 116.753 136.281 116.753C145.065 116.753 153.242 111.833 159.318 103.427C165.392 95.0253 169.226 83.293 169.226 70.2207C169.226 57.1483 165.392 45.416 159.318 37.014C153.242 28.6088 145.065 23.688 136.281 23.688C127.496 23.688 119.319 28.6088 113.243 37.014C107.169 45.416 103.335 57.1483 103.335 70.2207Z"
97
- fill="#F89941"
98
- stroke="#E78249"
99
- strokeWidth="5"
100
- />
101
- <ellipse
102
- fill="#F89941"
103
- rx="32.3901"
104
- ry="47.6163"
105
- transform="matrix(-1 0 0 1 139.677 70.8708)"
106
- />
107
- <ellipse
108
- fill="#F89941"
109
- rx="33.2207"
110
- ry="47.6163"
111
- transform="matrix(-1 0 0 1 134.971 71.4245)"
112
- />
113
- <path
114
- d="M158.85 46.6783C165.21 42.2516 166.538 40.633 167.867 39.0144C167.867 39.0144 169.806 43.8236 169.88 46.3566C169.954 48.8897 169.712 50.1469 167.248 51.6467C164.783 53.1464 155.406 53.0446 150.083 52.9746C149.31 52.5001 150.72 52.3371 158.85 46.6783Z"
115
- fill="black"
116
- />
117
- <path
118
- d="M115.765 46.5118C109.392 42.1412 108.058 40.5475 106.724 38.9538C106.724 38.9538 104.783 45.8361 104.758 46.822C104.733 47.808 104.657 50.8051 108.247 51.9995C111.837 53.194 119.234 52.7723 124.551 52.7272C125.322 52.2652 123.912 52.0991 115.765 46.5118Z"
119
- fill="black"
120
- />
121
- <path
122
- d="M160 90.4999C167.156 83.1595 169.5 78.2827 171.351 72.9348C172.24 70.3672 162.909 72.0429 158 72.9348C157.276 73.0664 155.751 76.9145 155 77C154.182 77.0932 151.841 73.0759 151 73.086C149.725 73.1013 147.727 73.086 145.875 73.4285C145.345 74.3645 146.367 77.5746 145.875 78.2827C145.321 78.2827 141.796 77.2604 141.242 76.4298C140.689 74.492 140.949 73.3629 140.118 72.5323C137.555 72.9075 138.023 72.6567 135.412 73.086C134.768 73.1919 133.09 77.7212 132.441 77.8195C131.615 77.9448 128.644 74.0088 127.809 74.1138C126.747 74.2475 124.821 74.4683 123.64 74.577C123.126 74.6244 123.554 77.5019 123.177 78.2827C122.898 78.8616 119.426 77.8921 118.5 77.5C118.037 76.5024 117.844 74.5583 117 74.577C111 74.1138 109.4 73.843 103.575 70.8713C103.575 70.8713 102.5 80 111 89C119.5 98 147.127 103.706 160 90.4999Z"
123
- fill="black"
124
- />
125
- <path
126
- d="M135.238 7.25181C137.192 1.73111 142.678 0.363204 145.935 0L148.377 1.81602C149.158 2.39714 149.842 2.40909 150.331 3.25657C150.331 4.22511 146.337 5.41975 142.429 6.582C137.545 8.03482 139.482 17.0534 142.429 19.2811C143.401 20.0152 143.524 19.9639 145.966 19.9639C148.029 19.9639 150.387 18.2474 151.566 17.3526C151.566 17.3526 151.861 20.2573 149.798 21.4777C147.735 22.698 143.578 21.8578 143.608 21.9658C144.493 23.9183 146.89 22.4887 148.029 23.3362C147.346 23.3362 146.556 24.2889 144.198 24.5329C142.672 24.5798 142.135 24.5329 140.956 23.9183C139.777 23.3037 139.482 22.8696 138.893 22.1395C136.83 23.3598 138.893 25.4305 138.893 25.4305C138.893 25.4305 134.472 25.8512 133.587 23.9183C133.264 23.2115 133.882 22.1395 133.587 21.9658C131.819 22.4539 130.935 23.4807 127.373 22.8696C124.312 22.3443 125.102 18.3211 124.451 17.3526C127.381 18.079 125.131 20.0392 129.327 19.9639C140.838 19.7576 132.796 14.1527 135.238 7.25181Z"
127
- fill="#5D725F"
128
- />
129
- <defs>
130
- <pattern
131
- height="1"
132
- id="pattern0"
133
- patternContentUnits="objectBoundingBox"
134
- width="1"
135
- />
136
- <clipPath id="clip0_2087_156668">
137
- <rect fill="white" height="276" width="276" />
138
- </clipPath>
139
- </defs>
140
- <g fill="none" transform="translate(80, 122)scale(0.38)">
141
- {children}
142
- </g>
143
- </g>
144
- </svg>
145
- </svg>
146
- ),
147
- };
@@ -1,43 +0,0 @@
1
- /** @jsxImportSource ../jsx */
2
- import type { TemplateDefinition } from "../../types";
3
-
4
- export const SquareBorder: TemplateDefinition = {
5
- id: "SquareBorder",
6
- name: "Square Border",
7
- description: "QR code with square decorative border",
8
- wrapper: (children, props) => (
9
- <svg
10
- height="300"
11
- id="svgQrWrapper"
12
- style={{
13
- width: "100%",
14
- height: "100%",
15
- // backgroundColor: props?.bgColor || "rgb(255, 255, 255)",
16
- }}
17
- viewBox="0 0 300 300"
18
- width="300"
19
- xmlns="http://www.w3.org/2000/svg"
20
- xmlnsXlink="http://www.w3.org/1999/xlink"
21
- >
22
- <svg
23
- fill={"black"}
24
- height="300"
25
- viewBox="0 0 316 316"
26
- width="300"
27
- xmlns="http://www.w3.org/2000/svg"
28
- >
29
- <g>
30
- <path
31
- clipRule="evenodd"
32
- d="M308 8H8v300h300V8ZM0 0v316h316V0H0Z"
33
- fill={props?.fgColor || "black"}
34
- fillRule="evenodd"
35
- />
36
- <g fill="none" transform="translate(20, 20) scale(0.92)">
37
- {children}
38
- </g>
39
- </g>
40
- </svg>
41
- </svg>
42
- ),
43
- };
@@ -1,43 +0,0 @@
1
- /** @jsxImportSource ../jsx */
2
- import type { TemplateDefinition } from "../../types";
3
-
4
- export const StandardBox: TemplateDefinition = {
5
- id: "StandardBox",
6
- name: "Standard Box",
7
- description: "QR code with standard box",
8
- wrapper: (children, props) => (
9
- <svg
10
- height="300"
11
- id="svgQrWrapper"
12
- style={{
13
- width: "100%",
14
- height: "100%",
15
- // backgroundColor: props?.bgColor || "rgb(255, 255, 255)",
16
- }}
17
- viewBox="0 0 300 300"
18
- width="300"
19
- xmlns="http://www.w3.org/2000/svg"
20
- xmlnsXlink="http://www.w3.org/1999/xlink"
21
- >
22
- <svg
23
- fill="#000000"
24
- height="300"
25
- viewBox="0 0 300 300"
26
- width="300"
27
- xmlns="http://www.w3.org/2000/svg"
28
- >
29
- <path
30
- d="M243,1.7h-186a10.25,10.25,0,0,0-10.2,10.12v186A10.13,10.13,0,0,0,57,208H243a10.13,10.13,0,0,0,10.12-10.12v-186A10.13,10.13,0,0,0,243,1.7Zm2.36,193.05a5.46,5.46,0,0,1-5.47,5.47H60.16a5.46,5.46,0,0,1-5.47-5.47V14.93a5.46,5.46,0,0,1,5.47-5.47H239.91a5.46,5.46,0,0,1,5.47,5.47Z"
31
- fill={props?.fgColor || "black"}
32
- />
33
- <path
34
- d="M243.54,238.81H173.61a2.29,2.29,0,0,1-1.62-.67l-20.55-20.55a2.33,2.33,0,0,0-3.25,0l-20.55,20.55a2.29,2.29,0,0,1-1.62.67H56.09A9.15,9.15,0,0,0,46.93,248v41.17a9.16,9.16,0,0,0,9.16,9.16H243.61a9.09,9.09,0,0,0,9.09-9.16V248A9.16,9.16,0,0,0,243.54,238.81Z"
35
- fill={props?.fgColor || "black"}
36
- />
37
- <g fill="none" transform="translate(60, 15)scale(0.6)">
38
- {children}
39
- </g>
40
- </svg>
41
- </svg>
42
- ),
43
- };
@@ -1,42 +0,0 @@
1
- /** @jsxImportSource ../jsx */
2
- import type { TemplateDefinition } from "../../types";
3
-
4
- export const StrikedBox: TemplateDefinition = {
5
- id: "StrikedBox",
6
- name: "Striked Box",
7
- description: "QR code with striked box",
8
- wrapper: (children) => (
9
- <svg
10
- height="300"
11
- id="svgQrWrapper"
12
- style={{
13
- width: "100%",
14
- height: "100%",
15
- // backgroundColor: "rgb(255, 255, 255)",
16
- }}
17
- viewBox="0 0 300 300"
18
- width="300"
19
- xmlns="http://www.w3.org/2000/svg"
20
- xmlnsXlink="http://www.w3.org/1999/xlink"
21
- >
22
- <svg
23
- fill="#22071b"
24
- height="300"
25
- viewBox="0 0 300 300"
26
- width="300"
27
- xmlns="http://www.w3.org/2000/svg"
28
- >
29
- <path d="M195.11,290.77l-7.28,4.88a2.16,2.16,0,0,0-.57,3,2.21,2.21,0,0,0,1.77.92,2.4,2.4,0,0,0,1.2-.35l7.28-4.88a2.14,2.14,0,0,0-2.4-3.54Z" />
30
- <path d="M266.85,227.52l-7.28,4.87a2.16,2.16,0,0,0-.57,3,2.21,2.21,0,0,0,1.77.92,1.86,1.86,0,0,0,1.2-.35l7.28-4.88a2.13,2.13,0,1,0-2.4-3.53Z" />
31
- <path d="M41,176.34l-9.11,6.08a2.15,2.15,0,0,0-.57,3,2.19,2.19,0,0,0,1.77.92,2.14,2.14,0,0,0,1.2-.35l9.12-6.08A2.14,2.14,0,0,0,41,176.34Z" />
32
- <path d="M41,269.08l-9.11,6.07a2.15,2.15,0,0,0-.57,3,2.19,2.19,0,0,0,1.77.92,2.92,2.92,0,0,0,1.2-.35l9.12-6.08A2.14,2.14,0,0,0,41,269.08Z" />
33
- <path d="M147,10.1a2.4,2.4,0,0,0,1.14-.35l7.7-5.16a2.13,2.13,0,0,0-2.4-3.53l-7.64,5.15a2.15,2.15,0,0,0-.56,3A2.19,2.19,0,0,0,147,10.1Z" />
34
- <path d="M275.54,54.77a2.14,2.14,0,0,0-3-.56l-17.1,11.45V31.31a10.18,10.18,0,0,0-10.18-10.18H137.22l-10.39,7a2.4,2.4,0,0,1-1.2.35,2.21,2.21,0,0,1-1.77-.92,2.15,2.15,0,0,1,.57-3l1.41-.92,13.64-8.76a2.1,2.1,0,1,0-2.26-3.54L122,21.2h-8.13l-10.39,7a2.37,2.37,0,0,1-1.2.35,2.19,2.19,0,0,1-1.76-.92,2.15,2.15,0,0,1,.56-3L124,9.25a2.13,2.13,0,1,0-2.4-3.53l-23,15.48H58.2A10.18,10.18,0,0,0,48,31.38v28L31.34,70.46a2.09,2.09,0,0,0-.57,3,2,2,0,0,0,1.77.92,2.58,2.58,0,0,0,1.2-.35l14.35-9.54,3.18-2.12a2.14,2.14,0,1,1,2.41,3.53l-5.52,3.67V76.9l-7,4.66a2.15,2.15,0,0,0-.56,3,2,2,0,0,0,1.77.92,2.34,2.34,0,0,0,1.2-.36l7.35-4.94A2.13,2.13,0,0,1,52.69,84l-4.46,3v65.66L25.05,168.07a2.15,2.15,0,0,0-.57,3,2,2,0,0,0,1.77.92,2.37,2.37,0,0,0,1.2-.35l25-16.75a2,2,0,0,1,2.62.77,2.16,2.16,0,0,1-.57,3l-6.36,4.24V275a10.09,10.09,0,0,0,9.83,10.11l-5.87,4a2.15,2.15,0,0,0-.57,3,2.06,2.06,0,0,0,1.77.92,2.38,2.38,0,0,0,1.2-.36l23-15.41a2.14,2.14,0,0,1,2.41,3.54l-6.58,4.45h52l-5.58,3.75a2.14,2.14,0,0,0-.56,3,2,2,0,0,0,1.76.91,2.37,2.37,0,0,0,1.2-.35l30.54-20.28a2.15,2.15,0,0,1,3,.56,2.1,2.1,0,0,1-.57,3l-14.21,9.54H217l-4.6,3a2.16,2.16,0,0,0-.63,3,2.11,2.11,0,0,0,1.76,1,2,2,0,0,0,1.13-.36L237,277.35a2.14,2.14,0,1,1,2.33,3.6l-6.78,4.38h13a10.18,10.18,0,0,0,10.18-10.18v-91.1l-4.38,3a2.43,2.43,0,0,1-1.2.35,2.19,2.19,0,0,1-1.77-.92,2.15,2.15,0,0,1,.57-3l24.38-16.33a2.13,2.13,0,1,0-2.4-3.53l-15.48,10.25V91.53l-4.38,3a2.34,2.34,0,0,1-1.21.36,2.22,2.22,0,0,1-1.76-.92,2.15,2.15,0,0,1,.56-3l6.72-4.52,13.71-9.19a2.14,2.14,0,0,0-2.4-3.54l-11.24,7.57V75.84l-4.38,3a2.34,2.34,0,0,1-1.21.36,2.22,2.22,0,0,1-1.76-.92,2.15,2.15,0,0,1,.56-3l6.72-4.52,19.43-13.08A2.05,2.05,0,0,0,275.54,54.77ZM237,216.07h-172a5.23,5.23,0,0,1-5.23-5.24V38.94a5.22,5.22,0,0,1,5.23-5.23H237a5.22,5.22,0,0,1,5.23,5.23V210.83h.07A5.22,5.22,0,0,1,237,216.07Z" />
35
- <path d="M270.45,139.8l-7.28,4.88a2.15,2.15,0,0,0-.56,3,2.22,2.22,0,0,0,1.76.92,2.44,2.44,0,0,0,1.21-.36l7.28-4.87a2.14,2.14,0,0,0-2.41-3.54Z" />
36
- <g fill="none" transform="translate(64, 38)scale(0.58)">
37
- {children}
38
- </g>
39
- </svg>
40
- </svg>
41
- ),
42
- };