@silurus/ooxml 0.28.0 → 0.29.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.
@@ -1,519 +0,0 @@
1
- //#region packages/core/src/shape/custGeom.ts
2
- function e(e, t, n, r, i, a) {
3
- for (let o of t) {
4
- let t = 0, s = 0;
5
- for (let c of o) switch (c.cmd) {
6
- case "moveTo":
7
- e.moveTo(n + c.x * i, r + c.y * a), t = c.x, s = c.y;
8
- break;
9
- case "lineTo":
10
- e.lineTo(n + c.x * i, r + c.y * a), t = c.x, s = c.y;
11
- break;
12
- case "cubicBezTo":
13
- e.bezierCurveTo(n + c.x1 * i, r + c.y1 * a, n + c.x2 * i, r + c.y2 * a, n + c.x * i, r + c.y * a), t = c.x, s = c.y;
14
- break;
15
- case "arcTo": {
16
- let o = c.wr * i, l = c.hr * a;
17
- if (o <= 0 || l <= 0) break;
18
- let u = c.stAng * Math.PI / 180, d = c.swAng * Math.PI / 180, f = n + t * i, p = r + s * a, m = f - o * Math.cos(u), h = p - l * Math.sin(u), g = u + d;
19
- e.ellipse(m, h, o, l, 0, u, g, d < 0), t = (m + o * Math.cos(g) - n) / i, s = (h + l * Math.sin(g) - r) / a;
20
- break;
21
- }
22
- case "close":
23
- e.closePath();
24
- break;
25
- }
26
- }
27
- }
28
- //#endregion
29
- //#region packages/core/src/shape/pattern-bitmaps.ts
30
- var t = {
31
- pct5: [
32
- 0,
33
- 16,
34
- 0,
35
- 0,
36
- 0,
37
- 1,
38
- 0,
39
- 0
40
- ],
41
- pct10: [
42
- 136,
43
- 0,
44
- 34,
45
- 0,
46
- 136,
47
- 0,
48
- 34,
49
- 0
50
- ],
51
- pct20: [
52
- 136,
53
- 34,
54
- 136,
55
- 34,
56
- 136,
57
- 34,
58
- 136,
59
- 34
60
- ],
61
- pct25: [
62
- 136,
63
- 85,
64
- 34,
65
- 85,
66
- 136,
67
- 85,
68
- 34,
69
- 85
70
- ],
71
- pct30: [
72
- 170,
73
- 85,
74
- 170,
75
- 85,
76
- 170,
77
- 85,
78
- 170,
79
- 85
80
- ],
81
- pct40: [
82
- 170,
83
- 119,
84
- 170,
85
- 221,
86
- 170,
87
- 119,
88
- 170,
89
- 221
90
- ],
91
- pct50: [
92
- 170,
93
- 85,
94
- 170,
95
- 85,
96
- 170,
97
- 85,
98
- 170,
99
- 85
100
- ],
101
- pct60: [
102
- 221,
103
- 85,
104
- 119,
105
- 85,
106
- 221,
107
- 85,
108
- 119,
109
- 85
110
- ],
111
- pct70: [
112
- 238,
113
- 85,
114
- 187,
115
- 85,
116
- 238,
117
- 85,
118
- 187,
119
- 85
120
- ],
121
- pct75: [
122
- 238,
123
- 170,
124
- 187,
125
- 170,
126
- 238,
127
- 170,
128
- 187,
129
- 170
130
- ],
131
- pct80: [
132
- 254,
133
- 239,
134
- 251,
135
- 191,
136
- 254,
137
- 239,
138
- 251,
139
- 191
140
- ],
141
- pct90: [
142
- 255,
143
- 239,
144
- 255,
145
- 251,
146
- 255,
147
- 239,
148
- 255,
149
- 251
150
- ],
151
- horz: [
152
- 255,
153
- 0,
154
- 0,
155
- 0,
156
- 255,
157
- 0,
158
- 0,
159
- 0
160
- ],
161
- vert: [
162
- 136,
163
- 136,
164
- 136,
165
- 136,
166
- 136,
167
- 136,
168
- 136,
169
- 136
170
- ],
171
- ltHorz: [
172
- 0,
173
- 255,
174
- 0,
175
- 0,
176
- 0,
177
- 0,
178
- 0,
179
- 0
180
- ],
181
- ltVert: [
182
- 32,
183
- 32,
184
- 32,
185
- 32,
186
- 32,
187
- 32,
188
- 32,
189
- 32
190
- ],
191
- dkHorz: [
192
- 255,
193
- 255,
194
- 0,
195
- 0,
196
- 255,
197
- 255,
198
- 0,
199
- 0
200
- ],
201
- dkVert: [
202
- 204,
203
- 204,
204
- 204,
205
- 204,
206
- 204,
207
- 204,
208
- 204,
209
- 204
210
- ],
211
- narHorz: [
212
- 255,
213
- 0,
214
- 255,
215
- 0,
216
- 255,
217
- 0,
218
- 255,
219
- 0
220
- ],
221
- narVert: [
222
- 170,
223
- 170,
224
- 170,
225
- 170,
226
- 170,
227
- 170,
228
- 170,
229
- 170
230
- ],
231
- cross: [
232
- 255,
233
- 136,
234
- 136,
235
- 136,
236
- 255,
237
- 136,
238
- 136,
239
- 136
240
- ],
241
- lgGrid: [
242
- 255,
243
- 128,
244
- 128,
245
- 128,
246
- 128,
247
- 128,
248
- 128,
249
- 128
250
- ],
251
- smGrid: [
252
- 255,
253
- 136,
254
- 136,
255
- 136,
256
- 255,
257
- 136,
258
- 136,
259
- 136
260
- ],
261
- dotGrid: [
262
- 136,
263
- 0,
264
- 0,
265
- 0,
266
- 136,
267
- 0,
268
- 0,
269
- 0
270
- ],
271
- dnDiag: [
272
- 128,
273
- 64,
274
- 32,
275
- 16,
276
- 8,
277
- 4,
278
- 2,
279
- 1
280
- ],
281
- upDiag: [
282
- 1,
283
- 2,
284
- 4,
285
- 8,
286
- 16,
287
- 32,
288
- 64,
289
- 128
290
- ],
291
- ltDnDiag: [
292
- 136,
293
- 68,
294
- 34,
295
- 17,
296
- 136,
297
- 68,
298
- 34,
299
- 17
300
- ],
301
- ltUpDiag: [
302
- 17,
303
- 34,
304
- 68,
305
- 136,
306
- 17,
307
- 34,
308
- 68,
309
- 136
310
- ],
311
- dkDnDiag: [
312
- 195,
313
- 129,
314
- 0,
315
- 129,
316
- 195,
317
- 129,
318
- 0,
319
- 129
320
- ],
321
- dkUpDiag: [
322
- 195,
323
- 129,
324
- 0,
325
- 129,
326
- 195,
327
- 129,
328
- 0,
329
- 129
330
- ],
331
- wdDnDiag: [
332
- 128,
333
- 64,
334
- 32,
335
- 16,
336
- 8,
337
- 4,
338
- 2,
339
- 129
340
- ],
341
- wdUpDiag: [
342
- 1,
343
- 2,
344
- 4,
345
- 8,
346
- 16,
347
- 32,
348
- 64,
349
- 129
350
- ],
351
- diagCross: [
352
- 129,
353
- 66,
354
- 36,
355
- 24,
356
- 24,
357
- 36,
358
- 66,
359
- 129
360
- ],
361
- horzBrick: [
362
- 255,
363
- 16,
364
- 16,
365
- 16,
366
- 255,
367
- 1,
368
- 1,
369
- 1
370
- ],
371
- diagBrick: [
372
- 129,
373
- 66,
374
- 36,
375
- 24,
376
- 36,
377
- 66,
378
- 129,
379
- 0
380
- ],
381
- lgCheck: [
382
- 240,
383
- 240,
384
- 240,
385
- 240,
386
- 15,
387
- 15,
388
- 15,
389
- 15
390
- ],
391
- smCheck: [
392
- 204,
393
- 204,
394
- 51,
395
- 51,
396
- 204,
397
- 204,
398
- 51,
399
- 51
400
- ],
401
- trellis: [
402
- 165,
403
- 90,
404
- 165,
405
- 90,
406
- 165,
407
- 90,
408
- 165,
409
- 90
410
- ]
411
- };
412
- function n(e, n, a) {
413
- let o = t[e];
414
- if (!o) return null;
415
- let s = r(8, 8);
416
- if (!s) return null;
417
- let c = s.getContext("2d");
418
- if (!c) return null;
419
- c.fillStyle = i(a), c.fillRect(0, 0, 8, 8), c.fillStyle = i(n);
420
- for (let e = 0; e < 8; e++) {
421
- let t = o[e];
422
- for (let n = 0; n < 8; n++) t & 1 << 7 - n && c.fillRect(n, e, 1, 1);
423
- }
424
- return s;
425
- }
426
- function r(e, t) {
427
- if (typeof OffscreenCanvas < "u") return new OffscreenCanvas(e, t);
428
- if (typeof document < "u") {
429
- let n = document.createElement("canvas");
430
- return n.width = e, n.height = t, n;
431
- }
432
- return null;
433
- }
434
- function i(e) {
435
- return `rgba(${parseInt(e.slice(0, 2), 16)},${parseInt(e.slice(2, 4), 16)},${parseInt(e.slice(4, 6), 16)},${e.length >= 8 ? parseInt(e.slice(6, 8), 16) / 255 : 1})`;
436
- }
437
- //#endregion
438
- //#region packages/core/src/shape/paint.ts
439
- function a(e, t = 1) {
440
- return `rgba(${parseInt(e.slice(0, 2), 16)},${parseInt(e.slice(2, 4), 16)},${parseInt(e.slice(4, 6), 16)},${e.length >= 8 ? parseInt(e.slice(6, 8), 16) / 255 : t})`;
441
- }
442
- function o(e, t, n, r, i, o) {
443
- if (!e || e.fillType === "none") return null;
444
- if (e.fillType === "solid") return a(e.color);
445
- if (e.fillType === "pattern") return c(e, t);
446
- if (e.fillType === "gradient") {
447
- let s = e.stops;
448
- if (s.length === 0) return null;
449
- if (s.length === 1) return a(s[0].color);
450
- let c;
451
- if (e.gradType === "radial") {
452
- let e = n + i / 2, a = r + o / 2, s = Math.sqrt(i * i + o * o) / 2;
453
- c = t.createRadialGradient(e, a, 0, e, a, s);
454
- } else {
455
- let a = e.angle * Math.PI / 180, s = n + i / 2, l = r + o / 2, u = (Math.abs(Math.cos(a)) * i + Math.abs(Math.sin(a)) * o) / 2;
456
- c = t.createLinearGradient(s - Math.cos(a) * u, l - Math.sin(a) * u, s + Math.cos(a) * u, l + Math.sin(a) * u);
457
- }
458
- for (let e of s) c.addColorStop(Math.min(1, Math.max(0, e.position)), a(e.color));
459
- return c;
460
- }
461
- return null;
462
- }
463
- var s = /* @__PURE__ */ new WeakMap();
464
- function c(e, t) {
465
- let r = `${e.preset}|${e.fg}|${e.bg}`, i = s.get(t);
466
- i || (i = /* @__PURE__ */ new Map(), s.set(t, i));
467
- let o = i.get(r);
468
- if (o) return o;
469
- let c = n(e.preset, e.fg, e.bg);
470
- if (!c) return a(e.fg);
471
- let l = t.createPattern(c, "repeat");
472
- return l ? (i.set(r, l), l) : a(e.fg);
473
- }
474
- var l = {
475
- dash: [6, 3],
476
- dot: [1.5, 3],
477
- dashDot: [
478
- 6,
479
- 3,
480
- 1.5,
481
- 3
482
- ],
483
- lgDash: [10, 4],
484
- lgDashDot: [
485
- 10,
486
- 4,
487
- 1.5,
488
- 4
489
- ],
490
- lgDashDotDot: [
491
- 10,
492
- 4,
493
- 1.5,
494
- 4,
495
- 1.5,
496
- 4
497
- ],
498
- sysDash: [4, 2],
499
- sysDot: [1, 2],
500
- sysDashDot: [
501
- 4,
502
- 2,
503
- 1,
504
- 2
505
- ]
506
- };
507
- function u(e, t, n) {
508
- if (!t) {
509
- e.strokeStyle = "transparent", e.lineWidth = 0, e.setLineDash([]);
510
- return;
511
- }
512
- e.strokeStyle = a(t.color);
513
- let r = Math.max(.5, t.width * n);
514
- e.lineWidth = r;
515
- let i = t.dashStyle ? l[t.dashStyle] : null;
516
- e.setLineDash(i ? i.map((e) => e * r) : []);
517
- }
518
- //#endregion
519
- export { e as i, a as n, o as r, u as t };
@@ -1 +0,0 @@
1
- function e(e,t,n,r,i,a){for(let o of t){let t=0,s=0;for(let c of o)switch(c.cmd){case`moveTo`:e.moveTo(n+c.x*i,r+c.y*a),t=c.x,s=c.y;break;case`lineTo`:e.lineTo(n+c.x*i,r+c.y*a),t=c.x,s=c.y;break;case`cubicBezTo`:e.bezierCurveTo(n+c.x1*i,r+c.y1*a,n+c.x2*i,r+c.y2*a,n+c.x*i,r+c.y*a),t=c.x,s=c.y;break;case`arcTo`:{let o=c.wr*i,l=c.hr*a;if(o<=0||l<=0)break;let u=c.stAng*Math.PI/180,d=c.swAng*Math.PI/180,f=n+t*i,p=r+s*a,m=f-o*Math.cos(u),h=p-l*Math.sin(u),g=u+d;e.ellipse(m,h,o,l,0,u,g,d<0),t=(m+o*Math.cos(g)-n)/i,s=(h+l*Math.sin(g)-r)/a;break}case`close`:e.closePath();break}}}var t={pct5:[0,16,0,0,0,1,0,0],pct10:[136,0,34,0,136,0,34,0],pct20:[136,34,136,34,136,34,136,34],pct25:[136,85,34,85,136,85,34,85],pct30:[170,85,170,85,170,85,170,85],pct40:[170,119,170,221,170,119,170,221],pct50:[170,85,170,85,170,85,170,85],pct60:[221,85,119,85,221,85,119,85],pct70:[238,85,187,85,238,85,187,85],pct75:[238,170,187,170,238,170,187,170],pct80:[254,239,251,191,254,239,251,191],pct90:[255,239,255,251,255,239,255,251],horz:[255,0,0,0,255,0,0,0],vert:[136,136,136,136,136,136,136,136],ltHorz:[0,255,0,0,0,0,0,0],ltVert:[32,32,32,32,32,32,32,32],dkHorz:[255,255,0,0,255,255,0,0],dkVert:[204,204,204,204,204,204,204,204],narHorz:[255,0,255,0,255,0,255,0],narVert:[170,170,170,170,170,170,170,170],cross:[255,136,136,136,255,136,136,136],lgGrid:[255,128,128,128,128,128,128,128],smGrid:[255,136,136,136,255,136,136,136],dotGrid:[136,0,0,0,136,0,0,0],dnDiag:[128,64,32,16,8,4,2,1],upDiag:[1,2,4,8,16,32,64,128],ltDnDiag:[136,68,34,17,136,68,34,17],ltUpDiag:[17,34,68,136,17,34,68,136],dkDnDiag:[195,129,0,129,195,129,0,129],dkUpDiag:[195,129,0,129,195,129,0,129],wdDnDiag:[128,64,32,16,8,4,2,129],wdUpDiag:[1,2,4,8,16,32,64,129],diagCross:[129,66,36,24,24,36,66,129],horzBrick:[255,16,16,16,255,1,1,1],diagBrick:[129,66,36,24,36,66,129,0],lgCheck:[240,240,240,240,15,15,15,15],smCheck:[204,204,51,51,204,204,51,51],trellis:[165,90,165,90,165,90,165,90]};function n(e,n,a){let o=t[e];if(!o)return null;let s=r(8,8);if(!s)return null;let c=s.getContext(`2d`);if(!c)return null;c.fillStyle=i(a),c.fillRect(0,0,8,8),c.fillStyle=i(n);for(let e=0;e<8;e++){let t=o[e];for(let n=0;n<8;n++)t&1<<7-n&&c.fillRect(n,e,1,1)}return s}function r(e,t){if(typeof OffscreenCanvas<`u`)return new OffscreenCanvas(e,t);if(typeof document<`u`){let n=document.createElement(`canvas`);return n.width=e,n.height=t,n}return null}function i(e){return`rgba(${parseInt(e.slice(0,2),16)},${parseInt(e.slice(2,4),16)},${parseInt(e.slice(4,6),16)},${e.length>=8?parseInt(e.slice(6,8),16)/255:1})`}function a(e,t=1){return`rgba(${parseInt(e.slice(0,2),16)},${parseInt(e.slice(2,4),16)},${parseInt(e.slice(4,6),16)},${e.length>=8?parseInt(e.slice(6,8),16)/255:t})`}function o(e,t,n,r,i,o){if(!e||e.fillType===`none`)return null;if(e.fillType===`solid`)return a(e.color);if(e.fillType===`pattern`)return c(e,t);if(e.fillType===`gradient`){let s=e.stops;if(s.length===0)return null;if(s.length===1)return a(s[0].color);let c;if(e.gradType===`radial`){let e=n+i/2,a=r+o/2,s=Math.sqrt(i*i+o*o)/2;c=t.createRadialGradient(e,a,0,e,a,s)}else{let a=e.angle*Math.PI/180,s=n+i/2,l=r+o/2,u=(Math.abs(Math.cos(a))*i+Math.abs(Math.sin(a))*o)/2;c=t.createLinearGradient(s-Math.cos(a)*u,l-Math.sin(a)*u,s+Math.cos(a)*u,l+Math.sin(a)*u)}for(let e of s)c.addColorStop(Math.min(1,Math.max(0,e.position)),a(e.color));return c}return null}var s=new WeakMap;function c(e,t){let r=`${e.preset}|${e.fg}|${e.bg}`,i=s.get(t);i||(i=new Map,s.set(t,i));let o=i.get(r);if(o)return o;let c=n(e.preset,e.fg,e.bg);if(!c)return a(e.fg);let l=t.createPattern(c,`repeat`);return l?(i.set(r,l),l):a(e.fg)}var l={dash:[6,3],dot:[1.5,3],dashDot:[6,3,1.5,3],lgDash:[10,4],lgDashDot:[10,4,1.5,4],lgDashDotDot:[10,4,1.5,4,1.5,4],sysDash:[4,2],sysDot:[1,2],sysDashDot:[4,2,1,2]};function u(e,t,n){if(!t){e.strokeStyle=`transparent`,e.lineWidth=0,e.setLineDash([]);return}e.strokeStyle=a(t.color);let r=Math.max(.5,t.width*n);e.lineWidth=r;let i=t.dashStyle?l[t.dashStyle]:null;e.setLineDash(i?i.map(e=>e*r):[])}Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return u}});