@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 +21 -21
- package/lib/figures/cornerDot/QRCornerDot.d.ts +0 -1
- package/lib/figures/cornerSquare/QRCornerSquare.d.ts +1 -2
- package/lib/qr-code-styling-node.js +90 -155
- package/lib/qr-code-styling-node.js.map +1 -1
- package/lib/qr-code-styling.js +1 -1
- package/lib/qr-code-styling.js.map +1 -1
- package/package.json +1 -1
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.
|
|
273
|
+
0.3538125,
|
|
274
274
|
"c",
|
|
275
275
|
0,
|
|
276
|
-
0.
|
|
277
|
-
-0.
|
|
278
|
-
0.
|
|
279
|
-
-0.
|
|
280
|
-
0.
|
|
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.
|
|
283
|
-
0.
|
|
284
|
-
0.
|
|
285
|
-
0.
|
|
286
|
-
0.
|
|
287
|
-
0.
|
|
288
|
-
"
|
|
289
|
-
0.
|
|
290
|
-
0.
|
|
291
|
-
0.
|
|
292
|
-
0.
|
|
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.
|
|
305
|
-
"
|
|
306
|
-
0.
|
|
307
|
-
0.
|
|
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.
|
|
317
|
-
0.
|
|
318
|
-
0.
|
|
319
|
-
0.
|
|
320
|
-
0.
|
|
321
|
-
0.
|
|
322
|
-
"
|
|
323
|
-
0.
|
|
324
|
-
0.
|
|
325
|
-
0.
|
|
326
|
-
0.
|
|
327
|
-
|
|
328
|
-
0.
|
|
329
|
-
|
|
330
|
-
0.
|
|
331
|
-
0.
|
|
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.
|
|
323
|
+
0.3863994,
|
|
334
324
|
0.075,
|
|
335
|
-
0.
|
|
336
|
-
"
|
|
337
|
-
0,
|
|
338
|
-
|
|
339
|
-
0.
|
|
340
|
-
|
|
341
|
-
0.
|
|
342
|
-
|
|
343
|
-
"
|
|
344
|
-
0.
|
|
345
|
-
|
|
346
|
-
0.
|
|
347
|
-
|
|
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.
|
|
339
|
+
0.0368369,
|
|
352
340
|
0,
|
|
353
|
-
0.
|
|
354
|
-
0.
|
|
355
|
-
0.
|
|
356
|
-
0.
|
|
357
|
-
"
|
|
358
|
-
0.
|
|
359
|
-
0.
|
|
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.
|
|
349
|
+
0.2093125,
|
|
364
350
|
"c",
|
|
365
|
-
0.
|
|
366
|
-
-0.
|
|
367
|
-
0.
|
|
368
|
-
-0.
|
|
369
|
-
0.
|
|
370
|
-
-0.
|
|
351
|
+
0.0240868,
|
|
352
|
+
-0.0283369,
|
|
353
|
+
0.0527744,
|
|
354
|
+
-0.0502881,
|
|
355
|
+
0.0860625,
|
|
356
|
+
-0.065875,
|
|
371
357
|
"c",
|
|
372
|
-
0.
|
|
373
|
-
-0.
|
|
374
|
-
0.
|
|
375
|
-
-0.
|
|
376
|
-
0.
|
|
377
|
-
-0.
|
|
358
|
+
0.0332882,
|
|
359
|
+
-0.0155869,
|
|
360
|
+
0.0683507,
|
|
361
|
+
-0.023375,
|
|
362
|
+
0.1051875,
|
|
363
|
+
-0.023375,
|
|
378
364
|
"c",
|
|
379
|
-
0.
|
|
365
|
+
0.0665869,
|
|
380
366
|
0,
|
|
381
|
-
0.
|
|
382
|
-
0.
|
|
383
|
-
0.
|
|
384
|
-
0.
|
|
385
|
-
"
|
|
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.
|
|
373
|
+
0.2872256,
|
|
390
374
|
0.925,
|
|
391
|
-
0.
|
|
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.
|
|
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 {
|