@liquid-js/qr-code-styling 2.2.0 → 2.2.2

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2019 Denys Kozak
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Denys Kozak
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -16,7 +16,6 @@ export declare class QRCornerDot {
16
16
  _basicHeart(args: BasicFigureDrawArgs): void;
17
17
  _basicRounded(args: BasicFigureDrawArgs): void;
18
18
  _basicClassy(args: BasicFigureDrawArgs): void;
19
- _basicOutpoint(args: BasicFigureDrawArgs): void;
20
19
  _basicInpoint(args: BasicFigureDrawArgs): void;
21
20
  _drawDot({ x, y, size, rotation }: DrawArgs): void;
22
21
  _drawSquare({ x, y, size, rotation }: DrawArgs): void;
@@ -15,12 +15,11 @@ export declare class QRCornerSquare {
15
15
  _basicSquare(args: BasicFigureDrawArgs): void;
16
16
  _basicExtraRounded(args: BasicFigureDrawArgs): void;
17
17
  _basicClassy(args: BasicFigureDrawArgs): void;
18
- _basicOutpoint(args: BasicFigureDrawArgs): void;
19
18
  _basicInpoint(args: BasicFigureDrawArgs): void;
20
19
  _drawDot({ x, y, size, rotation }: DrawArgs): void;
21
20
  _drawSquare({ x, y, size, rotation }: DrawArgs): void;
22
21
  _drawExtraRounded({ x, y, size, rotation }: DrawArgs): void;
23
22
  _drawClassy({ x, y, size, rotation }: DrawArgs): void;
24
- _drawOutpoint({ x, y, size, rotation }: DrawArgs): void;
25
23
  _drawInpoint({ x, y, size, rotation }: DrawArgs): void;
24
+ _drawOutpoint({ x, y, size, rotation }: DrawArgs): void;
26
25
  }
@@ -270,125 +270,109 @@ class QRCornerDot {
270
270
  const path = [
271
271
  "M",
272
272
  0.925,
273
- 0.3569803,
273
+ 0.3538125,
274
274
  "c",
275
275
  0,
276
- 0.0339813,
277
- -0.0085083,
278
- 0.0595062,
279
- -0.0170166,
280
- 0.0934875,
276
+ 0.0325869,
277
+ -0.0054931,
278
+ 0.0644619,
279
+ -0.0164688,
280
+ 0.095625,
281
+ "S",
282
+ 0.87825,
283
+ 0.5147812,
284
+ 0.850625,
285
+ 0.5519688,
281
286
  "C",
282
- 0.8994751,
283
- 0.484501,
284
- 0.8740021,
285
- 0.5184824,
286
- 0.8484772,
287
- 0.5524637,
288
- "C",
289
- 0.8230041,
290
- 0.5950052,
291
- 0.7890228,
292
- 0.6374948,
293
- 0.7380249,
294
- 0.6799845,
295
- "C",
296
- 0.6954834,
297
- 0.7309824,
298
- 0.6359771,
299
- 0.7819803,
300
- 0.5595062,
301
- 0.8499948,
287
+ 0.823,
288
+ 0.5891563,
289
+ 0.7858125,
290
+ 0.631125,
291
+ 0.7390625,
292
+ 0.677875,
293
+ "S",
294
+ 0.6331632,
295
+ 0.7802256,
296
+ 0.561625,
297
+ 0.8446875,
302
298
  "L",
303
299
  0.5,
304
- 0.9009928,
305
- "L",
306
- 0.4404938,
307
- 0.8499948,
308
- "C",
309
- 0.3640228,
310
- 0.7819803,
311
- 0.3045166,
312
- 0.7309824,
313
- 0.2619751,
314
- 0.6799845,
300
+ 0.8999375,
301
+ "l",
302
+ -0.061625,
303
+ -0.05525,
315
304
  "C",
316
- 0.2109772,
317
- 0.6374948,
318
- 0.1769958,
319
- 0.5950052,
320
- 0.1515228,
321
- 0.5524637,
322
- "C",
323
- 0.1174896,
324
- 0.5184824,
325
- 0.1005249,
326
- 0.484501,
327
- 0.0920166,
328
- 0.4504678,
329
- "C",
330
- 0.0835083,
331
- 0.4164865,
305
+ 0.3668368,
306
+ 0.7802256,
307
+ 0.3076875,
308
+ 0.724625,
309
+ 0.2609375,
310
+ 0.677875,
311
+ "S",
312
+ 0.177,
313
+ 0.5891563,
314
+ 0.149375,
315
+ 0.5519688,
316
+ "S",
317
+ 0.1024444,
318
+ 0.4806007,
319
+ 0.0914688,
320
+ 0.4494375,
321
+ "S",
332
322
  0.075,
333
- 0.3909616,
323
+ 0.3863994,
334
324
  0.075,
335
- 0.3569803,
336
- "c",
337
- 0,
338
- -0.0680145,
339
- 0.0255249,
340
- -0.1190125,
341
- 0.0680145,
342
- -0.1700104,
343
- "c",
344
- 0.0424896,
345
- -0.0424896,
346
- 0.1019959,
347
- -0.0679626,
348
- 0.1700104,
349
- -0.0679626,
325
+ 0.3538125,
326
+ "C",
327
+ 0.075,
328
+ 0.2872256,
329
+ 0.0973125,
330
+ 0.231625,
331
+ 0.1419375,
332
+ 0.187,
333
+ "S",
334
+ 0.2421631,
335
+ 0.1200625,
336
+ 0.30875,
337
+ 0.1200625,
350
338
  "c",
351
- 0.0339813,
339
+ 0.0368369,
352
340
  0,
353
- 0.0679626,
354
- 0.0084564,
355
- 0.1019959,
356
- 0.025473,
357
- "C",
358
- 0.4490021,
359
- 0.1614969,
360
- 0.4744751,
361
- 0.1869699,
341
+ 0.0718994,
342
+ 0.0077881,
343
+ 0.1051875,
344
+ 0.023375,
345
+ "S",
346
+ 0.4759131,
347
+ 0.1809756,
362
348
  0.5,
363
- 0.2124948,
349
+ 0.2093125,
364
350
  "c",
365
- 0.0255249,
366
- -0.0255249,
367
- 0.0509979,
368
- -0.0509979,
369
- 0.0849792,
370
- -0.0680145,
351
+ 0.0240868,
352
+ -0.0283369,
353
+ 0.0527744,
354
+ -0.0502881,
355
+ 0.0860625,
356
+ -0.065875,
371
357
  "c",
372
- 0.0340332,
373
- -0.0170166,
374
- 0.0680146,
375
- -0.025473,
376
- 0.1105042,
377
- -0.025473,
358
+ 0.0332882,
359
+ -0.0155869,
360
+ 0.0683507,
361
+ -0.023375,
362
+ 0.1051875,
363
+ -0.023375,
378
364
  "c",
379
- 0.0595062,
365
+ 0.0665869,
380
366
  0,
381
- 0.1190125,
382
- 0.025473,
383
- 0.1615021,
384
- 0.0679626,
385
- "C",
386
- 0.8994751,
387
- 0.2379678,
367
+ 0.1221875,
368
+ 0.0223125,
369
+ 0.1668125,
370
+ 0.0669375,
371
+ "S",
388
372
  0.925,
389
- 0.2889658,
373
+ 0.2872256,
390
374
  0.925,
391
- 0.3569803,
375
+ 0.3538125,
392
376
  "z"
393
377
  ];
394
378
  let move = false;
@@ -444,26 +428,6 @@ class QRCornerDot {
444
428
  }
445
429
  });
446
430
  }
447
- _basicOutpoint(args) {
448
- const { size, x, y } = args;
449
- const dotSize = size;
450
- this._rotateFigure({
451
- ...args,
452
- draw: () => {
453
- this._element = document.createElementNS("http://www.w3.org/2000/svg", "path");
454
- this._element.setAttribute("clip-rule", "evenodd");
455
- this._element.setAttribute("d", `M ${x} ${y + dotSize / 2}` +
456
- `v ${dotSize / 4}` +
457
- `a ${dotSize / 4}, ${dotSize / 4} 0 0 0 ${dotSize / 4}, ${dotSize / 4}` +
458
- `h ${dotSize / 2}` +
459
- `a ${dotSize / 4}, ${dotSize / 4} 0 0 0 ${dotSize / 4}, ${-dotSize / 4}` +
460
- `v ${-dotSize / 2}` +
461
- `a ${dotSize / 4}, ${dotSize / 4} 0 0 0 ${-dotSize / 4}, ${-dotSize / 4}` +
462
- `h ${(-dotSize / 4) * 3}` +
463
- `z`);
464
- }
465
- });
466
- }
467
431
  _basicInpoint(args) {
468
432
  const { size, x, y } = args;
469
433
  const dotSize = size;
@@ -509,7 +473,7 @@ class QRCornerDot {
509
473
  this._basicInpoint({ x, y, size, rotation });
510
474
  }
511
475
  _drawOutpoint({ x, y, size, rotation }) {
512
- this._basicOutpoint({ x, y, size, rotation });
476
+ this._basicInpoint({ x, y, size, rotation: (rotation || 0) + Math.PI });
513
477
  }
514
478
  }
515
479
 
@@ -646,35 +610,6 @@ class QRCornerSquare {
646
610
  }
647
611
  });
648
612
  }
649
- _basicOutpoint(args) {
650
- const { size, x, y } = args;
651
- const dotSize = size / 7;
652
- this._rotateFigure({
653
- ...args,
654
- draw: () => {
655
- this._element = document.createElementNS("http://www.w3.org/2000/svg", "path");
656
- this._element.setAttribute("clip-rule", "evenodd");
657
- this._element.setAttribute("d", `M ${x} ${y + 2.5 * dotSize}` +
658
- `v ${2 * dotSize}` +
659
- `a ${2.5 * dotSize} ${2.5 * dotSize}, 0, 0, 0, ${dotSize * 2.5} ${dotSize * 2.5}` +
660
- `h ${2 * dotSize}` +
661
- `a ${2.5 * dotSize} ${2.5 * dotSize}, 0, 0, 0, ${dotSize * 2.5} ${-dotSize * 2.5}` +
662
- `v ${-2 * dotSize}` +
663
- `a ${2.5 * dotSize} ${2.5 * dotSize}, 0, 0, 0, ${-dotSize * 2.5} ${-dotSize * 2.5}` +
664
- `h ${-2 * dotSize}` +
665
- `a ${dotSize} ${2.5 * dotSize}, 0, 0, 0, ${-dotSize * 2.5} ${dotSize * 2.5}` +
666
- `M ${x + 2.5 * dotSize} ${y + dotSize}` +
667
- `h ${2 * dotSize}` +
668
- `a ${1.5 * dotSize} ${1.5 * dotSize}, 0, 0, 1, ${dotSize * 1.5} ${dotSize * 1.5}` +
669
- `v ${2 * dotSize}` +
670
- `a ${1.5 * dotSize} ${1.5 * dotSize}, 0, 0, 1, ${-dotSize * 1.5} ${dotSize * 1.5}` +
671
- `h ${-2 * dotSize}` +
672
- `a ${1.5 * dotSize} ${1.5 * dotSize}, 0, 0, 1, ${-dotSize * 1.5} ${-dotSize * 1.5}` +
673
- `v ${-2 * dotSize}` +
674
- `l 0 ${-dotSize * 1.5}`);
675
- }
676
- });
677
- }
678
613
  _basicInpoint(args) {
679
614
  const { size, x, y } = args;
680
615
  const dotSize = size / 7;
@@ -714,12 +649,12 @@ class QRCornerSquare {
714
649
  _drawClassy({ x, y, size, rotation }) {
715
650
  this._basicClassy({ x, y, size, rotation });
716
651
  }
717
- _drawOutpoint({ x, y, size, rotation }) {
718
- this._basicOutpoint({ x, y, size, rotation });
719
- }
720
652
  _drawInpoint({ x, y, size, rotation }) {
721
653
  this._basicInpoint({ x, y, size, rotation });
722
654
  }
655
+ _drawOutpoint({ x, y, size, rotation }) {
656
+ this._basicInpoint({ x, y, size, rotation: (rotation || 0) + Math.PI });
657
+ }
723
658
  }
724
659
 
725
660
  class QRDot {