@pdfme/ui 3.1.0-dev.1 → 3.1.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfme/ui",
3
- "version": "3.1.0-dev.1",
3
+ "version": "3.1.0",
4
4
  "sideEffects": false,
5
5
  "author": "hand-dot",
6
6
  "license": "MIT",
@@ -32,7 +32,7 @@
32
32
  "develop": "npm-run-all --parallel devBuild:watch devBuildType:watch",
33
33
  "devBuild:watch": "esbuild src/index.ts --bundle --outfile=dist/index.js --format=esm --watch",
34
34
  "devBuildType:watch": "tsc --emitDeclarationOnly --watch",
35
- "build": "vite build && tsc --emitDeclarationOnly",
35
+ "build": "esbuild src/index.ts --bundle --outfile=dist/index.js --format=esm --minify --sourcemap && tsc --emitDeclarationOnly",
36
36
  "clean": "rimraf dist",
37
37
  "lint": "tsc --noEmit",
38
38
  "test": "jest",
@@ -62,7 +62,6 @@
62
62
  "@testing-library/react": "^12.1.2",
63
63
  "@types/react": "^17.0.52",
64
64
  "@types/react-dom": "^17.0.18",
65
- "@vitejs/plugin-react": "^4.2.0",
66
65
  "css-loader": "^6.8.1",
67
66
  "csstype": "^3.1.2",
68
67
  "esbuild": "^0.19.5",
@@ -70,9 +69,7 @@
70
69
  "eslint-plugin-react-hooks": "^4.3.0",
71
70
  "jest-canvas-mock": "^2.3.1",
72
71
  "process": "^0.11.10",
73
- "vite": "^5.0.0",
74
- "vite-plugin-top-level-await": "^1.3.1",
75
- "vite-tsconfig-paths": "^4.2.1"
72
+ "style-loader": "^3.3.3"
76
73
  },
77
74
  "peerDependencies": {
78
75
  "@pdfme/common": "latest",
@@ -1,4 +0,0 @@
1
- const e = {};
2
- export {
3
- e as default
4
- };
@@ -1,214 +0,0 @@
1
- function F(n, a, r) {
2
- if (r || arguments.length === 2)
3
- for (var t = 0, o = a.length, l; t < o; t++)
4
- (l || !(t in a)) && (l || (l = Array.prototype.slice.call(a, 0, t)), l[t] = a[t]);
5
- return n.concat(l || Array.prototype.slice.call(a));
6
- }
7
- var q = {
8
- a: 7,
9
- c: 6,
10
- h: 1,
11
- l: 2,
12
- m: 2,
13
- q: 4,
14
- s: 4,
15
- t: 2,
16
- v: 1,
17
- z: 0
18
- }, Z = /([astvzqmhlc])([^astvzqmhlc]*)/gi, _ = /-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;
19
- function U(n) {
20
- var a = n.match(_);
21
- return a ? a.map(Number) : [];
22
- }
23
- function j(n) {
24
- var a = [], r = String(n).trim();
25
- return r[0] !== "M" && r[0] !== "m" || r.replace(Z, function(t, o, l) {
26
- var s = U(l), u = o.toLowerCase(), h = o;
27
- if (u === "m" && s.length > 2 && (a.push(F([h], s.splice(0, 2), !0)), u = "l", h = h === "m" ? "l" : "L"), s.length < q[u])
28
- return "";
29
- for (a.push(F([h], s.splice(0, q[u]), !0)); s.length >= q[u] && s.length && q[u]; )
30
- a.push(F([h], s.splice(0, q[u]), !0));
31
- return "";
32
- }), a;
33
- }
34
- function B(n, a) {
35
- var r = n.x * Math.cos(a) - n.y * Math.sin(a), t = n.y * Math.cos(a) + n.x * Math.sin(a);
36
- n.x = r, n.y = t;
37
- }
38
- function J(n, a, r) {
39
- n.x += a, n.y += r;
40
- }
41
- function H(n, a) {
42
- n.x *= a, n.y *= a;
43
- }
44
- var L = (
45
- /** @class */
46
- function() {
47
- function n(a) {
48
- var r;
49
- this.commands = [], a && a instanceof n ? (r = this.commands).push.apply(r, a.commands) : a && (this.commands = j(a));
50
- }
51
- return n.prototype.addPath = function(a) {
52
- var r;
53
- a && a instanceof n && (r = this.commands).push.apply(r, a.commands);
54
- }, n.prototype.moveTo = function(a, r) {
55
- this.commands.push(["M", a, r]);
56
- }, n.prototype.lineTo = function(a, r) {
57
- this.commands.push(["L", a, r]);
58
- }, n.prototype.arc = function(a, r, t, o, l, s) {
59
- this.commands.push(["AC", a, r, t, o, l, !!s]);
60
- }, n.prototype.arcTo = function(a, r, t, o, l) {
61
- this.commands.push(["AT", a, r, t, o, l]);
62
- }, n.prototype.ellipse = function(a, r, t, o, l, s, u, h) {
63
- this.commands.push(["E", a, r, t, o, l, s, u, !!h]);
64
- }, n.prototype.closePath = function() {
65
- this.commands.push(["Z"]);
66
- }, n.prototype.bezierCurveTo = function(a, r, t, o, l, s) {
67
- this.commands.push(["C", a, r, t, o, l, s]);
68
- }, n.prototype.quadraticCurveTo = function(a, r, t, o) {
69
- this.commands.push(["Q", a, r, t, o]);
70
- }, n.prototype.rect = function(a, r, t, o) {
71
- this.commands.push(["R", a, r, t, o]);
72
- }, n.prototype.roundRect = function(a, r, t, o, l) {
73
- typeof l > "u" ? this.commands.push(["RR", a, r, t, o, 0]) : this.commands.push(["RR", a, r, t, o, l]);
74
- }, n;
75
- }()
76
- );
77
- function N(n, a) {
78
- var r = 0, t = 0, o, l, s, u, h, v, P, C, I, A, S, G, D, p, f, z, d, b, m, E, Q, g = null, R = null, y = null, T = null, M = null, k = null;
79
- n.beginPath();
80
- for (var i = 0; i < a.length; ++i) {
81
- b = a[i][0], b !== "S" && b !== "s" && b !== "C" && b !== "c" && (g = null, R = null), b !== "T" && b !== "t" && b !== "Q" && b !== "q" && (y = null, T = null);
82
- var e = void 0;
83
- switch (b) {
84
- case "m":
85
- case "M":
86
- e = a[i], b === "m" ? (r += e[1], t += e[2]) : (r = e[1], t = e[2]), (b === "M" || !M) && (M = { x: r, y: t }), n.moveTo(r, t);
87
- break;
88
- case "l":
89
- e = a[i], r += e[1], t += e[2], n.lineTo(r, t);
90
- break;
91
- case "L":
92
- e = a[i], r = e[1], t = e[2], n.lineTo(r, t);
93
- break;
94
- case "H":
95
- e = a[i], r = e[1], n.lineTo(r, t);
96
- break;
97
- case "h":
98
- e = a[i], r += e[1], n.lineTo(r, t);
99
- break;
100
- case "V":
101
- e = a[i], t = e[1], n.lineTo(r, t);
102
- break;
103
- case "v":
104
- e = a[i], t += e[1], n.lineTo(r, t);
105
- break;
106
- case "a":
107
- case "A":
108
- if (e = a[i], k === null)
109
- throw new Error("This should never happen");
110
- b === "a" ? (r += e[6], t += e[7]) : (r = e[6], t = e[7]), p = e[1], f = e[2], P = e[3] * Math.PI / 180, s = !!e[4], u = !!e[5], h = { x: r, y: t }, v = {
111
- x: (k.x - h.x) / 2,
112
- y: (k.y - h.y) / 2
113
- }, B(v, -P), C = v.x * v.x / (p * p) + v.y * v.y / (f * f), C > 1 && (C = Math.sqrt(C), p *= C, f *= C), m = {
114
- x: p * v.y / f,
115
- y: -(f * v.x) / p
116
- }, I = p * p * f * f, A = p * p * v.y * v.y + f * f * v.x * v.x, u !== s ? H(m, Math.sqrt((I - A) / A) || 0) : H(m, -Math.sqrt((I - A) / A) || 0), l = Math.atan2((v.y - m.y) / f, (v.x - m.x) / p), o = Math.atan2(-(v.y + m.y) / f, -(v.x + m.x) / p), B(m, P), J(m, (h.x + k.x) / 2, (h.y + k.y) / 2), n.save(), n.translate(m.x, m.y), n.rotate(P), n.scale(p, f), n.arc(0, 0, 1, l, o, !u), n.restore();
117
- break;
118
- case "C":
119
- e = a[i], g = e[3], R = e[4], r = e[5], t = e[6], n.bezierCurveTo(e[1], e[2], g, R, r, t);
120
- break;
121
- case "c":
122
- e = a[i], n.bezierCurveTo(e[1] + r, e[2] + t, e[3] + r, e[4] + t, e[5] + r, e[6] + t), g = e[3] + r, R = e[4] + t, r += e[5], t += e[6];
123
- break;
124
- case "S":
125
- e = a[i], (g === null || R === null) && (g = r, R = t), n.bezierCurveTo(2 * r - g, 2 * t - R, e[1], e[2], e[3], e[4]), g = e[1], R = e[2], r = e[3], t = e[4];
126
- break;
127
- case "s":
128
- e = a[i], (g === null || R === null) && (g = r, R = t), n.bezierCurveTo(2 * r - g, 2 * t - R, e[1] + r, e[2] + t, e[3] + r, e[4] + t), g = e[1] + r, R = e[2] + t, r += e[3], t += e[4];
129
- break;
130
- case "Q":
131
- e = a[i], y = e[1], T = e[2], r = e[3], t = e[4], n.quadraticCurveTo(y, T, r, t);
132
- break;
133
- case "q":
134
- e = a[i], y = e[1] + r, T = e[2] + t, r += e[3], t += e[4], n.quadraticCurveTo(y, T, r, t);
135
- break;
136
- case "T":
137
- e = a[i], (y === null || T === null) && (y = r, T = t), y = 2 * r - y, T = 2 * t - T, r = e[1], t = e[2], n.quadraticCurveTo(y, T, r, t);
138
- break;
139
- case "t":
140
- e = a[i], (y === null || T === null) && (y = r, T = t), y = 2 * r - y, T = 2 * t - T, r += e[1], t += e[2], n.quadraticCurveTo(y, T, r, t);
141
- break;
142
- case "z":
143
- case "Z":
144
- M && (r = M.x, t = M.y), M = null, n.closePath();
145
- break;
146
- case "AC":
147
- e = a[i], r = e[1], t = e[2], D = e[3], l = e[4], o = e[5], E = e[6], n.arc(r, t, D, l, o, E);
148
- break;
149
- case "AT":
150
- e = a[i], S = e[1], G = e[2], r = e[3], t = e[4], D = e[5], n.arcTo(S, G, r, t, D);
151
- break;
152
- case "E":
153
- e = a[i], r = e[1], t = e[2], p = e[3], f = e[4], P = e[5], l = e[6], o = e[7], E = e[8], n.save(), n.translate(r, t), n.rotate(P), n.scale(p, f), n.arc(0, 0, 1, l, o, E), n.restore();
154
- break;
155
- case "R":
156
- e = a[i], r = e[1], t = e[2], z = e[3], d = e[4], M = { x: r, y: t }, n.rect(r, t, z, d);
157
- break;
158
- case "RR":
159
- e = a[i], r = e[1], t = e[2], z = e[3], d = e[4], Q = e[5], M = { x: r, y: t }, n.roundRect(r, t, z, d, Q);
160
- break;
161
- }
162
- k ? (k.x = r, k.y = t) : k = { x: r, y: t };
163
- }
164
- }
165
- function K(n) {
166
- if (!(!n || !n.CanvasRenderingContext2D || n.Path2D)) {
167
- var a = n.CanvasRenderingContext2D, r = a.prototype.fill, t = a.prototype.stroke, o = a.prototype.isPointInPath;
168
- a.prototype.fill = function() {
169
- for (var s = [], u = 0; u < arguments.length; u++)
170
- s[u] = arguments[u];
171
- if (s[0] instanceof L) {
172
- var h = s[0], v = s[1] || "nonzero";
173
- N(this, h.commands), r.apply(this, [v]);
174
- } else {
175
- var v = s[0] || "nonzero";
176
- return r.apply(this, [v]);
177
- }
178
- }, a.prototype.stroke = function(s) {
179
- s && N(this, s.commands), t.apply(this);
180
- }, a.prototype.isPointInPath = function() {
181
- for (var s = [], u = 0; u < arguments.length; u++)
182
- s[u] = arguments[u];
183
- if (s[0] instanceof L) {
184
- var h = s[0], v = s[1], P = s[2], C = s[3] || "nonzero";
185
- return N(this, h.commands), o.apply(this, [v, P, C]);
186
- } else
187
- return o.apply(this, s);
188
- }, n.Path2D = L;
189
- }
190
- }
191
- function V(n, a, r, t, o) {
192
- var l = this;
193
- if (o === void 0 && (o = 0), typeof o == "number" && (o = [o]), Array.isArray(o)) {
194
- if (o.length === 0 || o.length > 4)
195
- throw new RangeError("Failed to execute 'roundRect' on '".concat(this.constructor.name, "': ").concat(o.length, " radii provided. Between one and four radii are necessary."));
196
- o.forEach(function(C) {
197
- if (C < 0)
198
- throw new RangeError("Failed to execute 'roundRect' on '".concat(l.constructor.name, "': Radius value ").concat(C, " is negative."));
199
- });
200
- } else
201
- return;
202
- if (o.length === 1 && o[0] === 0)
203
- return this.rect(n, a, r, t);
204
- var s = Math.min(r, t) / 2, u, h, v, P = u = h = v = Math.min(s, o[0]);
205
- o.length === 2 && (u = v = Math.min(s, o[1])), o.length === 3 && (u = v = Math.min(s, o[1]), h = Math.min(s, o[2])), o.length === 4 && (u = Math.min(s, o[1]), h = Math.min(s, o[2]), v = Math.min(s, o[3])), this.moveTo(n, a + t - v), this.arcTo(n, a, n + P, a, P), this.arcTo(n + r, a, n + r, a + u, u), this.arcTo(n + r, a + t, n + r - h, a + t, h), this.arcTo(n, a + t, n, a + t - v, v), this.moveTo(n, a);
206
- }
207
- function O(n) {
208
- if (!(!n || !n.CanvasRenderingContext2D)) {
209
- var a = n.CanvasRenderingContext2D, r = n.Path2D;
210
- a && !a.prototype.roundRect && (a.prototype.roundRect = V), r && !r.prototype.roundRect && (r.prototype.roundRect = V);
211
- }
212
- }
213
- K(window);
214
- O(window);
package/vite.config.ts DELETED
@@ -1,27 +0,0 @@
1
- import { defineConfig } from 'vite';
2
- import react from '@vitejs/plugin-react';
3
- import tsconfigPaths from 'vite-tsconfig-paths';
4
- import topLevelAwait from 'vite-plugin-top-level-await';
5
-
6
- export default defineConfig({
7
- plugins: [
8
- react(),
9
- tsconfigPaths(),
10
- topLevelAwait({
11
- promiseExportName: '__tla',
12
- promiseImportName: (i) => `__tla_${i}`,
13
- }),
14
- ],
15
- build: {
16
- lib: {
17
- entry: 'src/index.ts',
18
- name: '@pdfme/ui',
19
- fileName: () => `index.js`,
20
- formats: ['es'],
21
- },
22
- },
23
- optimizeDeps: {
24
- include: ['react', 'react-dom', 'pdfjs-dist', 'antd'],
25
- exclude: ['@pdfme/common', '@pdfme/schemas'],
26
- },
27
- });