Skip to content

Commit

Permalink
Chore merge kilian b (#3)
Browse files Browse the repository at this point in the history
* update dependencies

* make examples runnable again

* proper fix for mirrored qr code and all styles fixes #105, fixes #49, fixes #110

* do not distribute packages via git anymore. prepare npm release

* target es2017

* added toDataUrl function and improved typescript types

* prepare and publish version 1.0.0

* security patch

---------

Co-authored-by: Kilian Brachtendorf <Kilian.Brachtendorf@t-online.de>
  • Loading branch information
ChielTimmermans and KilianB authored Jul 11, 2024
1 parent b90276e commit 1f3fded
Show file tree
Hide file tree
Showing 35 changed files with 8,248 additions and 16,368 deletions.
3 changes: 2 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[*.{js, ts}]
indent_style = space
indent_size = 2
indent_size = 2
end_of_line = lf
11 changes: 9 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,22 @@ module.exports = {
env: {
node: true
},
parser: '@typescript-eslint/parser',
parser: "@typescript-eslint/parser",
extends: [
"eslint:recommended",
"plugin:prettier/recommended",
"plugin:jest/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/eslint-recommended"
],
parserOptions: {
sourceType: "module"
},
rules: {
"prettier/prettier": [
"error",
{
endOfLine: "auto"
}
]
}
};
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
/node_modules

# Tests coverage results
/coverage
/coverage

.DS_Store
32 changes: 32 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Version 1.0.0 - 27.08.2022

This is the first release of the package with various bug fixes and dependencies updates from the original repo.
This package can be installed by running.

`npm install styled-qr-code` or `yarn add styled-qr-code`

## Breaking change

- removed the deprecated method signature `download(extension: string)`. Now only `download({name: 'qr', extension: 'png')` is supported
- The orientation of the generated qr code has been fixed to generate qr codes compatible with all known scanners see [#49](https://github.com/kozakdenys/qr-code-styling/issues/105) [#105 QR code is not valid by some scanners](https://github.com/kozakdenys/qr-code-styling/issues/105).
An configuration option `useLegacyDotRotation` has been added to restore the previous behavior.
- images options `crossOrigin` are now set to anonymous by default

## Feat

- added optional quality parameter to get getRawData to control the size and quality of the returned image
- added convenience method `toDataUrl` to return a base64 encoded string of the qr code instead of making a detour via a blob
- improved typescript types

- updated lockfile to v2 [1d91c08fabe430911f68e15cc108c5f015b5329c](1d91c08fabe430911f68e15cc108c5f015b5329c)
- fix svg: [1d91c08fabe430911f68e15cc108c5f015b5329c](1d91c08fabe430911f68e15cc108c5f015b5329c)
- svg now includes images as base64 link: [78070cf808e0b60bb2f6ac310083688f1c27cf99](78070cf808e0b60bb2f6ac310083688f1c27cf99)
- images are now correctly cropped [f400491fe13c5969b8a9d8c1e2e7c90b7067c5a59](f400491fe13c5969b8a9d8c1e2e7c90b7067c5a5)

## Dependencies

Updated multiple dependencies and resolved security vulnerabilities. For a full list see: [https://github.com/KilianB/styled-qr-code/commit/535017b1e8dba2eb66666e42eb61e15f8a9866b9#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519](package diff)

## Misc

- update example to include legacy and new qr code generation codes
171 changes: 93 additions & 78 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ module.exports = {
// snapshotSerializers: [],

// The test environment that will be used for testing
testEnvironment: "jest-environment-jsdom-fifteen",
// testEnvironment: "jest-environment-jsdom-fifteen",

// Options that will be passed to the testEnvironment
testEnvironmentOptions: {
Expand Down
1 change: 1 addition & 0 deletions lib/constants/dotTypes.test.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib/constants/errorCorrectionLevels.test.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib/constants/errorCorrectionPercents.test.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib/constants/modes.test.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib/constants/qrTypes.test.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib/core/QRCanvas.test.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
14 changes: 11 additions & 3 deletions lib/core/QRCodeStyling.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,17 @@ export default class QRCodeStyling {
_svgDrawingPromise?: Promise<void>;
constructor(options?: Partial<Options>);
static _clearContainer(container?: HTMLElement): void;
_getQRStylingElement(extension?: Extension): Promise<QRCanvas | QRSVG>;
_getQRStylingElement(extension: "svg"): Promise<QRSVG>;
_getQRStylingElement(extension: Omit<Extension, "svg">): Promise<QRCanvas>;
update(options?: Partial<Options>): void;
append(container?: HTMLElement): void;
getRawData(extension?: Extension): Promise<Blob | null>;
download(downloadOptions?: Partial<DownloadOptions> | string): Promise<void>;
getRawData(extension?: Extension, quality?: number): Promise<Blob | null>;
/**
*
* @param extension file format of the returned image
* @param quality [0-1] with 1 being the highest quality
* @returns
*/
toDataUrl(extension?: Omit<Extension, "svg">, quality?: number): Promise<string>;
download(downloadOptions?: Partial<DownloadOptions>): Promise<void>;
}
1 change: 1 addition & 0 deletions lib/core/QRCodeStyling.test.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib/core/QROptions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface RequiredOptions extends Options {
color: string;
gradient?: Gradient;
};
useLegacyDotRotation: boolean;
}
declare const defaultOptions: RequiredOptions;
export default defaultOptions;
1 change: 1 addition & 0 deletions lib/core/QROptions.test.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib/figures/dot/canvas/QRDot.test.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib/index.test.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
2 changes: 1 addition & 1 deletion lib/qr-code-styling.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/qr-code-styling.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions lib/tools/calculateImageSize.test.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib/tools/getMode.test.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions lib/tools/merge.test.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
Loading

0 comments on commit 1f3fded

Please sign in to comment.