@juit/librebarcode 1.0.16 → 2.0.1
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/README.md +32 -17
- package/assets/LibreBarcode128-Regular.otf +0 -0
- package/assets/LibreBarcode128-Regular.woff +0 -0
- package/assets/LibreBarcode128-Regular.woff2 +0 -0
- package/assets/LibreBarcode128Text-Regular.otf +0 -0
- package/assets/LibreBarcode128Text-Regular.woff +0 -0
- package/assets/LibreBarcode128Text-Regular.woff2 +0 -0
- package/assets/LibreBarcodeEAN13Text-Regular.otf +0 -0
- package/assets/LibreBarcodeEAN13Text-Regular.woff +0 -0
- package/assets/LibreBarcodeEAN13Text-Regular.woff2 +0 -0
- package/assets/fonts-otf.css +20 -0
- package/assets/fonts-ttf.css +20 -0
- package/assets/fonts-woff.css +20 -0
- package/assets/fonts-woff2.css +20 -0
- package/assets/fonts.css +29 -0
- package/dist/index.cjs +2 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.mjs +1 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +30 -4
- package/src/index.ts +0 -8
package/README.md
CHANGED
|
@@ -8,10 +8,12 @@ project.
|
|
|
8
8
|
* [Code128](#code128)
|
|
9
9
|
* [EAN-13, UPC/A and EAN-8](#ean-13-upca-ean-8)
|
|
10
10
|
* [EAN/GS-1 Checksums](#eangs-1-checksums)
|
|
11
|
-
* [Font Assets](#font-assets)
|
|
11
|
+
* [Font Assets and CSS](#font-assets-and-css)
|
|
12
12
|
* [License (encoders)](LICENSE-ASL.md)
|
|
13
13
|
* [License (fonts)](LICENSE-OFL.md)
|
|
14
14
|
|
|
15
|
+
Look here for a simple [demo](https://juitnow.github.io/juit-librebarcode/).
|
|
16
|
+
|
|
15
17
|
Code128
|
|
16
18
|
-------
|
|
17
19
|
|
|
@@ -108,36 +110,49 @@ A separate function `checksum()` can be used to calculate the checksum for
|
|
|
108
110
|
an *arbitrary* sequence of digits according to the EAN/GS-1 calculation rules:
|
|
109
111
|
|
|
110
112
|
```typescript
|
|
111
|
-
import {
|
|
113
|
+
import { checksum } from '@juit/librebarcode'
|
|
112
114
|
|
|
113
|
-
const
|
|
115
|
+
const check = checksum('541136108357')
|
|
114
116
|
// here checksum will be the number 4
|
|
115
117
|
```
|
|
116
118
|
|
|
117
119
|
|
|
118
120
|
|
|
119
|
-
Font Assets
|
|
120
|
-
|
|
121
|
+
Font Assets and CSS
|
|
122
|
+
-------------------
|
|
121
123
|
|
|
122
124
|
Embedded with this library, you can find three fonts for your encoding needs:
|
|
123
125
|
|
|
124
|
-
* `./assets/LibreBarcode128-Regular
|
|
126
|
+
* `./assets/LibreBarcode128-Regular....`: the regular **Code128** font without
|
|
125
127
|
any underlying text. Use this one for GS1 barcodes, as encoding of the `FNC1`
|
|
126
128
|
character messes up the text, and anyhow the text should be represented as
|
|
127
129
|
`(xx)yyyyyyyyyy(zz)wwwwwwww...` (application identifiers with parentheses).
|
|
128
|
-
* `./assets/LibreBarcode128Text-Regular
|
|
130
|
+
* `./assets/LibreBarcode128Text-Regular....`: the **Code128** font with
|
|
129
131
|
underlying text. Use this one for standard Code128 barcodes.
|
|
130
|
-
* `./assets/LibreBarcodeEAN13Text-Regular
|
|
132
|
+
* `./assets/LibreBarcodeEAN13Text-Regular....`: the **EAN** font.
|
|
131
133
|
|
|
132
|
-
|
|
134
|
+
All fonts are available in TrueType (`.ttf`), OpenType (`.otf`), WOFF (`.woff`)
|
|
135
|
+
and WOFF2 (`.woff2`) formats and are declared as exports of this package.
|
|
136
|
+
|
|
137
|
+
To know the path of those assets at runtime, you can use `require.resolve(...)`
|
|
138
|
+
on CommonJS or `import.meta.resolve(...)` for EcmaScript modules.
|
|
133
139
|
|
|
134
140
|
```typescript
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
//
|
|
139
|
-
|
|
140
|
-
// 'LibreBarcode128Text-Regular.ttf': '... path on your disk .../LibreBarcode128Text-Regular.ttf',
|
|
141
|
-
// 'LibreBarcodeEAN13Text-Regular.ttf': '... path on your disk .../LibreBarcodeEAN13Text-Regular.ttf'
|
|
142
|
-
// }
|
|
141
|
+
// in CommonJS
|
|
142
|
+
const path = require.resolve('@juit/librebarcode/assets/LibreBarcode128-Regular.ttf')
|
|
143
|
+
|
|
144
|
+
// in EcmaScript modules
|
|
145
|
+
const url = import.meta.resolve('@juit/librebarcode/assets/LibreBarcodeEAN13Text-Regular.woff2')
|
|
143
146
|
```
|
|
147
|
+
|
|
148
|
+
Similarly, a number of CSS stylesheets are included in the package to easily
|
|
149
|
+
embed these fonts onto web pages and similar. These stylesheets define the
|
|
150
|
+
families `LibreBarcode128`, `LibreBarcode128Text`, and `LibreBarcodeEAN13Text`
|
|
151
|
+
(all with _normal_ font style and _400_ as weight).
|
|
152
|
+
|
|
153
|
+
* `./assets/fonts-otf.css`: Only import OpenType fonts.
|
|
154
|
+
* `./assets/fonts-ttf.css`: Only import TrueType fonts.
|
|
155
|
+
* `./assets/fonts-woff.css`: Only import WOFF fonts.
|
|
156
|
+
* `./assets/fonts-woff2.css`: Only import WOFF2 fonts.
|
|
157
|
+
* `./assets/fonts.css`: Import all font types, in the following preference
|
|
158
|
+
order: WOFF2, WOFF, OpenType, TrueType.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: 'LibreBarcode128';
|
|
3
|
+
font-style: normal;
|
|
4
|
+
font-weight: 400;
|
|
5
|
+
src: url('LibreBarcode128-Regular.otf') format('opentype');
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@font-face {
|
|
9
|
+
font-family: 'LibreBarcode128Text';
|
|
10
|
+
font-style: normal;
|
|
11
|
+
font-weight: 400;
|
|
12
|
+
src: url('LibreBarcode128Text-Regular.otf') format('opentype');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@font-face {
|
|
16
|
+
font-family: 'LibreBarcodeEAN13Text';
|
|
17
|
+
font-style: normal;
|
|
18
|
+
font-weight: 400;
|
|
19
|
+
src: url('LibreBarcodeEAN13Text-Regular.otf') format('opentype');
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: 'LibreBarcode128';
|
|
3
|
+
font-style: normal;
|
|
4
|
+
font-weight: 400;
|
|
5
|
+
src: url('LibreBarcode128-Regular.ttf') format('truetype');
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@font-face {
|
|
9
|
+
font-family: 'LibreBarcode128Text';
|
|
10
|
+
font-style: normal;
|
|
11
|
+
font-weight: 400;
|
|
12
|
+
src: url('LibreBarcode128Text-Regular.ttf') format('truetype');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@font-face {
|
|
16
|
+
font-family: 'LibreBarcodeEAN13Text';
|
|
17
|
+
font-style: normal;
|
|
18
|
+
font-weight: 400;
|
|
19
|
+
src: url('LibreBarcodeEAN13Text-Regular.ttf') format('truetype');
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: 'LibreBarcode128';
|
|
3
|
+
font-style: normal;
|
|
4
|
+
font-weight: 400;
|
|
5
|
+
src: url('LibreBarcode128-Regular.woff') format('woff');
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@font-face {
|
|
9
|
+
font-family: 'LibreBarcode128Text';
|
|
10
|
+
font-style: normal;
|
|
11
|
+
font-weight: 400;
|
|
12
|
+
src: url('LibreBarcode128Text-Regular.woff') format('woff');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@font-face {
|
|
16
|
+
font-family: 'LibreBarcodeEAN13Text';
|
|
17
|
+
font-style: normal;
|
|
18
|
+
font-weight: 400;
|
|
19
|
+
src: url('LibreBarcodeEAN13Text-Regular.woff') format('woff');
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: 'LibreBarcode128';
|
|
3
|
+
font-style: normal;
|
|
4
|
+
font-weight: 400;
|
|
5
|
+
src: url('LibreBarcode128-Regular.woff2') format('woff2');
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
@font-face {
|
|
9
|
+
font-family: 'LibreBarcode128Text';
|
|
10
|
+
font-style: normal;
|
|
11
|
+
font-weight: 400;
|
|
12
|
+
src: url('LibreBarcode128Text-Regular.woff2') format('woff2');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@font-face {
|
|
16
|
+
font-family: 'LibreBarcodeEAN13Text';
|
|
17
|
+
font-style: normal;
|
|
18
|
+
font-weight: 400;
|
|
19
|
+
src: url('LibreBarcodeEAN13Text-Regular.woff2') format('woff2');
|
|
20
|
+
}
|
package/assets/fonts.css
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: 'LibreBarcode128';
|
|
3
|
+
font-style: normal;
|
|
4
|
+
font-weight: 400;
|
|
5
|
+
src: url('LibreBarcode128-Regular.woff2') format('woff2'),
|
|
6
|
+
url('LibreBarcode128-Regular.woff') format('woff'),
|
|
7
|
+
url('LibreBarcode128-Regular.otf') format('opentype'),
|
|
8
|
+
url('LibreBarcode128-Regular.ttf') format('truetype');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@font-face {
|
|
12
|
+
font-family: 'LibreBarcode128Text';
|
|
13
|
+
font-style: normal;
|
|
14
|
+
font-weight: 400;
|
|
15
|
+
src: url('LibreBarcode128Text-Regular.woff2') format('woff2'),
|
|
16
|
+
url('LibreBarcode128Text-Regular.woff') format('woff'),
|
|
17
|
+
url('LibreBarcode128Text-Regular.otf') format('opentype'),
|
|
18
|
+
url('LibreBarcode128Text-Regular.ttf') format('truetype');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@font-face {
|
|
22
|
+
font-family: 'LibreBarcodeEAN13Text';
|
|
23
|
+
font-style: normal;
|
|
24
|
+
font-weight: 400;
|
|
25
|
+
src: url('LibreBarcodeEAN13Text-Regular.woff2') format('woff2'),
|
|
26
|
+
url('LibreBarcodeEAN13Text-Regular.woff') format('woff'),
|
|
27
|
+
url('LibreBarcodeEAN13Text-Regular.otf') format('opentype'),
|
|
28
|
+
url('LibreBarcodeEAN13Text-Regular.ttf') format('truetype');
|
|
29
|
+
}
|
package/dist/index.cjs
CHANGED
|
@@ -26,18 +26,11 @@ __export(src_exports, {
|
|
|
26
26
|
FNC4: () => import_code128.FNC4,
|
|
27
27
|
checksum: () => import_ean.checksum,
|
|
28
28
|
code128: () => import_code128.code128,
|
|
29
|
-
ean: () => import_ean.ean
|
|
30
|
-
fonts: () => fonts
|
|
29
|
+
ean: () => import_ean.ean
|
|
31
30
|
});
|
|
32
31
|
module.exports = __toCommonJS(src_exports);
|
|
33
32
|
var import_code128 = require("./code128.cjs");
|
|
34
33
|
var import_ean = require("./ean.cjs");
|
|
35
|
-
var here = new URL(__filename, "file:///");
|
|
36
|
-
var fonts = {
|
|
37
|
-
"LibreBarcode128-Regular.ttf": new URL("../assets/LibreBarcode128-Regular.ttf", here).pathname,
|
|
38
|
-
"LibreBarcode128Text-Regular.ttf": new URL("../assets/LibreBarcode128Text-Regular.ttf", here).pathname,
|
|
39
|
-
"LibreBarcodeEAN13Text-Regular.ttf": new URL("../assets/LibreBarcodeEAN13Text-Regular.ttf", here).pathname
|
|
40
|
-
};
|
|
41
34
|
// Annotate the CommonJS export names for ESM import in node:
|
|
42
35
|
0 && (module.exports = {
|
|
43
36
|
FNC1,
|
|
@@ -46,7 +39,6 @@ var fonts = {
|
|
|
46
39
|
FNC4,
|
|
47
40
|
checksum,
|
|
48
41
|
code128,
|
|
49
|
-
ean
|
|
50
|
-
fonts
|
|
42
|
+
ean
|
|
51
43
|
});
|
|
52
44
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAgD;AAChD,iBAA8B;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
export { FNC1, FNC2, FNC3, FNC4, code128 } from './code128';
|
|
2
2
|
export { checksum, ean } from './ean';
|
|
3
3
|
export type { CodeSet } from './code128';
|
|
4
|
-
export declare const fonts: {
|
|
5
|
-
'LibreBarcode128-Regular.ttf': string;
|
|
6
|
-
'LibreBarcode128Text-Regular.ttf': string;
|
|
7
|
-
'LibreBarcodeEAN13Text-Regular.ttf': string;
|
|
8
|
-
};
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
// index.ts
|
|
2
2
|
import { FNC1, FNC2, FNC3, FNC4, code128 } from "./code128.mjs";
|
|
3
3
|
import { checksum, ean } from "./ean.mjs";
|
|
4
|
-
var here = new URL(import.meta.url, "file:///");
|
|
5
|
-
var fonts = {
|
|
6
|
-
"LibreBarcode128-Regular.ttf": new URL("../assets/LibreBarcode128-Regular.ttf", here).pathname,
|
|
7
|
-
"LibreBarcode128Text-Regular.ttf": new URL("../assets/LibreBarcode128Text-Regular.ttf", here).pathname,
|
|
8
|
-
"LibreBarcodeEAN13Text-Regular.ttf": new URL("../assets/LibreBarcodeEAN13Text-Regular.ttf", here).pathname
|
|
9
|
-
};
|
|
10
4
|
export {
|
|
11
5
|
FNC1,
|
|
12
6
|
FNC2,
|
|
@@ -14,7 +8,6 @@ export {
|
|
|
14
8
|
FNC4,
|
|
15
9
|
checksum,
|
|
16
10
|
code128,
|
|
17
|
-
ean
|
|
18
|
-
fonts
|
|
11
|
+
ean
|
|
19
12
|
};
|
|
20
13
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
|
-
"mappings": ";AAAA,SAAS,MAAM,MAAM,MAAM,MAAM,eAAe;AAChD,SAAS,UAAU,WAAW;
|
|
4
|
+
"mappings": ";AAAA,SAAS,MAAM,MAAM,MAAM,MAAM,eAAe;AAChD,SAAS,UAAU,WAAW;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juit/librebarcode",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Encoders and fonts for EAN13 and Code128",
|
|
5
5
|
"author": "Team Juit <developers@juit.com>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "./dist/index.cjs",
|
|
8
8
|
"module": "./dist/index.mjs",
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
|
+
"type": "module",
|
|
10
11
|
"exports": {
|
|
11
12
|
".": {
|
|
12
13
|
"require": {
|
|
@@ -17,18 +18,43 @@
|
|
|
17
18
|
"types": "./dist/index.d.ts",
|
|
18
19
|
"default": "./dist/index.mjs"
|
|
19
20
|
}
|
|
20
|
-
}
|
|
21
|
+
},
|
|
22
|
+
"./assets/LibreBarcode128-Regular.otf": "./assets/LibreBarcode128-Regular.otf",
|
|
23
|
+
"./assets/LibreBarcode128-Regular.ttf": "./assets/LibreBarcode128-Regular.ttf",
|
|
24
|
+
"./assets/LibreBarcode128-Regular.woff": "./assets/LibreBarcode128-Regular.woff",
|
|
25
|
+
"./assets/LibreBarcode128-Regular.woff2": "./assets/LibreBarcode128-Regular.woff2",
|
|
26
|
+
"./assets/LibreBarcode128Text-Regular.otf": "./assets/LibreBarcode128Text-Regular.otf",
|
|
27
|
+
"./assets/LibreBarcode128Text-Regular.ttf": "./assets/LibreBarcode128Text-Regular.ttf",
|
|
28
|
+
"./assets/LibreBarcode128Text-Regular.woff": "./assets/LibreBarcode128Text-Regular.woff",
|
|
29
|
+
"./assets/LibreBarcode128Text-Regular.woff2": "./assets/LibreBarcode128Text-Regular.woff2",
|
|
30
|
+
"./assets/LibreBarcodeEAN13Text-Regular.otf": "./assets/LibreBarcodeEAN13Text-Regular.otf",
|
|
31
|
+
"./assets/LibreBarcodeEAN13Text-Regular.ttf": "./assets/LibreBarcodeEAN13Text-Regular.ttf",
|
|
32
|
+
"./assets/LibreBarcodeEAN13Text-Regular.woff": "./assets/LibreBarcodeEAN13Text-Regular.woff",
|
|
33
|
+
"./assets/LibreBarcodeEAN13Text-Regular.woff2": "./assets/LibreBarcodeEAN13Text-Regular.woff2",
|
|
34
|
+
"./assets/fonts-otf.css": "./assets/fonts-otf.css",
|
|
35
|
+
"./assets/fonts-ttf.css": "./assets/fonts-ttf.css",
|
|
36
|
+
"./assets/fonts-woff.css": "./assets/fonts-woff.css",
|
|
37
|
+
"./assets/fonts-woff2.css": "./assets/fonts-woff2.css",
|
|
38
|
+
"./assets/fonts.css": "./assets/fonts.css"
|
|
21
39
|
},
|
|
22
40
|
"scripts": {
|
|
23
|
-
"build": "plug",
|
|
41
|
+
"build": "plug && vite build",
|
|
24
42
|
"coverage": "plug coverage",
|
|
25
43
|
"dev": "plug coverage -w src -w test",
|
|
44
|
+
"demo": "vite",
|
|
26
45
|
"lint": "plug lint",
|
|
27
46
|
"test": "plug test",
|
|
28
47
|
"transpile": "plug transpile"
|
|
29
48
|
},
|
|
30
49
|
"devDependencies": {
|
|
31
|
-
"@plugjs/build": "^0.6.
|
|
50
|
+
"@plugjs/build": "^0.6.15",
|
|
51
|
+
"@plugjs/eslint-plugin": "^0.2.25",
|
|
52
|
+
"@quasar/vite-plugin": "^1.8.1",
|
|
53
|
+
"@vitejs/plugin-vue": "^5.2.0",
|
|
54
|
+
"eslint-plugin-vue": "^9.31.0",
|
|
55
|
+
"quasar": "^2.17.2",
|
|
56
|
+
"sass-embedded": "^1.80.7",
|
|
57
|
+
"vite": "^5.4.11"
|
|
32
58
|
},
|
|
33
59
|
"directories": {
|
|
34
60
|
"test": "test"
|
package/src/index.ts
CHANGED
|
@@ -2,11 +2,3 @@ export { FNC1, FNC2, FNC3, FNC4, code128 } from './code128'
|
|
|
2
2
|
export { checksum, ean } from './ean'
|
|
3
3
|
|
|
4
4
|
export type { CodeSet } from './code128'
|
|
5
|
-
|
|
6
|
-
const here = new URL(__fileurl, 'file:///')
|
|
7
|
-
|
|
8
|
-
export const fonts = {
|
|
9
|
-
'LibreBarcode128-Regular.ttf': new URL('../assets/LibreBarcode128-Regular.ttf', here).pathname,
|
|
10
|
-
'LibreBarcode128Text-Regular.ttf': new URL('../assets/LibreBarcode128Text-Regular.ttf', here).pathname,
|
|
11
|
-
'LibreBarcodeEAN13Text-Regular.ttf': new URL('../assets/LibreBarcodeEAN13Text-Regular.ttf', here).pathname,
|
|
12
|
-
}
|