@silurus/ooxml 0.2.0 → 0.3.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/dist/docx.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./docx-BigKt3jU.cjs`);exports.DocxDocument=e.r,exports.DocxViewer=e.n;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./autoResize-ggn4hzd8.cjs`),t=require(`./docx-CBTSExoH.cjs`);exports.DocxDocument=t.r,exports.DocxViewer=t.n,exports.autoResize=e.t;
package/dist/docx.mjs CHANGED
@@ -1,2 +1,3 @@
1
- import { n as e, r as t } from "./docx-Dl67DX0B.js";
2
- export { t as DocxDocument, e as DocxViewer };
1
+ import { t as e } from "./autoResize-U2-IRmNE.js";
2
+ import { n as t, r as n } from "./docx-DPRNEbrA.js";
3
+ export { n as DocxDocument, t as DocxViewer, e as autoResize };
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./pptx-E7x-tlbY.cjs`),t=require(`./xlsx-BJpXJcKz.cjs`),n=require(`./docx-BigKt3jU.cjs`);Object.defineProperty(exports,`docx`,{enumerable:!0,get:function(){return n.t}}),Object.defineProperty(exports,`pptx`,{enumerable:!0,get:function(){return e.t}}),Object.defineProperty(exports,`xlsx`,{enumerable:!0,get:function(){return t.t}});
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./pptx-D-l5vpjt.cjs`),t=require(`./xlsx-BbZiHoyu.cjs`),n=require(`./docx-CBTSExoH.cjs`);Object.defineProperty(exports,`docx`,{enumerable:!0,get:function(){return n.t}}),Object.defineProperty(exports,`pptx`,{enumerable:!0,get:function(){return e.t}}),Object.defineProperty(exports,`xlsx`,{enumerable:!0,get:function(){return t.t}});
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as e } from "./pptx-9gGaUMeA.js";
2
- import { t } from "./xlsx-7RZtVIqa.js";
3
- import { t as n } from "./docx-Dl67DX0B.js";
1
+ import { t as e } from "./pptx-BTI_RpCN.js";
2
+ import { t } from "./xlsx-DqnFMSVb.js";
3
+ import { t as n } from "./docx-DPRNEbrA.js";
4
4
  export { n as docx, e as pptx, t as xlsx };
@@ -0,0 +1 @@
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}}}function t(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 n(e,n,r,i,a,o){if(!e||e.fillType===`none`)return null;if(e.fillType===`solid`)return t(e.color);if(e.fillType===`gradient`){let s=e.stops;if(s.length===0)return null;if(s.length===1)return t(s[0].color);let c;if(e.gradType===`radial`){let e=r+a/2,t=i+o/2,s=Math.sqrt(a*a+o*o)/2;c=n.createRadialGradient(e,t,0,e,t,s)}else{let t=e.angle*Math.PI/180,s=r+a/2,l=i+o/2,u=(Math.abs(Math.cos(t))*a+Math.abs(Math.sin(t))*o)/2;c=n.createLinearGradient(s-Math.cos(t)*u,l-Math.sin(t)*u,s+Math.cos(t)*u,l+Math.sin(t)*u)}for(let e of s)c.addColorStop(Math.min(1,Math.max(0,e.position)),t(e.color));return c}return null}var r={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 i(e,n,i){if(!n){e.strokeStyle=`transparent`,e.lineWidth=0,e.setLineDash([]);return}e.strokeStyle=t(n.color);let a=Math.max(.5,n.width*i);e.lineWidth=a;let o=n.dashStyle?r[n.dashStyle]:null;e.setLineDash(o?o.map(e=>e*a):[])}Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return i}});
@@ -0,0 +1,98 @@
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/paint.ts
30
+ function t(e, t = 1) {
31
+ 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})`;
32
+ }
33
+ function n(e, n, r, i, a, o) {
34
+ if (!e || e.fillType === "none") return null;
35
+ if (e.fillType === "solid") return t(e.color);
36
+ if (e.fillType === "gradient") {
37
+ let s = e.stops;
38
+ if (s.length === 0) return null;
39
+ if (s.length === 1) return t(s[0].color);
40
+ let c;
41
+ if (e.gradType === "radial") {
42
+ let e = r + a / 2, t = i + o / 2, s = Math.sqrt(a * a + o * o) / 2;
43
+ c = n.createRadialGradient(e, t, 0, e, t, s);
44
+ } else {
45
+ let t = e.angle * Math.PI / 180, s = r + a / 2, l = i + o / 2, u = (Math.abs(Math.cos(t)) * a + Math.abs(Math.sin(t)) * o) / 2;
46
+ c = n.createLinearGradient(s - Math.cos(t) * u, l - Math.sin(t) * u, s + Math.cos(t) * u, l + Math.sin(t) * u);
47
+ }
48
+ for (let e of s) c.addColorStop(Math.min(1, Math.max(0, e.position)), t(e.color));
49
+ return c;
50
+ }
51
+ return null;
52
+ }
53
+ var r = {
54
+ dash: [6, 3],
55
+ dot: [1.5, 3],
56
+ dashDot: [
57
+ 6,
58
+ 3,
59
+ 1.5,
60
+ 3
61
+ ],
62
+ lgDash: [10, 4],
63
+ lgDashDot: [
64
+ 10,
65
+ 4,
66
+ 1.5,
67
+ 4
68
+ ],
69
+ lgDashDotDot: [
70
+ 10,
71
+ 4,
72
+ 1.5,
73
+ 4,
74
+ 1.5,
75
+ 4
76
+ ],
77
+ sysDash: [4, 2],
78
+ sysDot: [1, 2],
79
+ sysDashDot: [
80
+ 4,
81
+ 2,
82
+ 1,
83
+ 2
84
+ ]
85
+ };
86
+ function i(e, n, i) {
87
+ if (!n) {
88
+ e.strokeStyle = "transparent", e.lineWidth = 0, e.setLineDash([]);
89
+ return;
90
+ }
91
+ e.strokeStyle = t(n.color);
92
+ let a = Math.max(.5, n.width * i);
93
+ e.lineWidth = a;
94
+ let o = n.dashStyle ? r[n.dashStyle] : null;
95
+ e.setLineDash(o ? o.map((e) => e * a) : []);
96
+ }
97
+ //#endregion
98
+ export { e as i, t as n, n as r, i as t };