js.documents 14.4.56 → 14.4.57
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/codecs/read.cjs +2 -2
- package/dist/codecs/read.js +1 -1
- package/dist/composition-plan-CfvhXeOC.cjs +627 -0
- package/dist/composition-plan-DU9nPPN7.d.cts +102 -0
- package/dist/composition-plan-f0zaExUW.js +508 -0
- package/dist/composition-plan-l6QPO4FX.d.ts +102 -0
- package/dist/convert/composition-plan.cjs +7 -0
- package/dist/convert/composition-plan.d.cts +2 -0
- package/dist/convert/composition-plan.d.ts +2 -0
- package/dist/convert/composition-plan.js +2 -0
- package/dist/convert/composition-to-pdf.cjs +12 -12
- package/dist/convert/composition-to-pdf.d.cts +1 -1
- package/dist/convert/composition-to-pdf.d.ts +1 -1
- package/dist/convert/composition-to-pdf.js +2 -2
- package/dist/convert/composition.cjs +16 -511
- package/dist/convert/composition.d.cts +2 -85
- package/dist/convert/composition.d.ts +2 -85
- package/dist/convert/composition.js +2 -502
- package/dist/convert/convert.cjs +2 -2
- package/dist/convert/convert.js +1 -1
- package/dist/convert/from-package.cjs +3 -3
- package/dist/convert/from-package.js +2 -2
- package/dist/convert/from-pdf.cjs +18 -18
- package/dist/convert/from-pdf.js +2 -2
- package/dist/convert/local.cjs +3 -3
- package/dist/convert/local.js +1 -1
- package/dist/edit/odp/slide.cjs +4 -4
- package/dist/edit/odp/slide.d.cts +1 -1
- package/dist/edit/odp/slide.d.ts +1 -1
- package/dist/edit/odp/slide.js +1 -1
- package/dist/edit/odt/content.d.cts +1 -1
- package/dist/edit/odt/content.d.ts +1 -1
- package/dist/edit/odt/editor.cjs +4 -4
- package/dist/edit/odt/editor.d.cts +1 -1
- package/dist/edit/odt/editor.d.ts +1 -1
- package/dist/edit/odt/editor.js +1 -1
- package/dist/edit/odt/table-grid.cjs +23 -0
- package/dist/edit/odt/table-grid.d.cts +54 -0
- package/dist/edit/odt/table-grid.d.ts +54 -0
- package/dist/edit/odt/table-grid.js +2 -0
- package/dist/edit/odt/table.cjs +12 -653
- package/dist/edit/odt/table.d.cts +2 -2
- package/dist/edit/odt/table.d.ts +2 -2
- package/dist/edit/odt/table.js +2 -647
- package/dist/{evaluate-BbOsgdmN.d.cts → evaluate-BSEUxiUK.d.cts} +3 -1
- package/dist/evaluate-CEzsBx3w.cjs +564 -0
- package/dist/{evaluate-C7fmk69X.d.ts → evaluate-D8fG2ZeB.d.ts} +3 -1
- package/dist/evaluate-IK-3aMv5.js +445 -0
- package/dist/evaluate-columns-CyqKHkIW.d.cts +41 -0
- package/dist/evaluate-columns-cOo8fOfT.d.ts +41 -0
- package/dist/index.cjs +24 -24
- package/dist/index.d.cts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +8 -8
- package/dist/latex/lint.cjs +2 -2
- package/dist/latex/lint.js +1 -1
- package/dist/latex/lower-fold.cjs +6 -0
- package/dist/latex/lower-fold.d.cts +17 -0
- package/dist/latex/lower-fold.d.ts +17 -0
- package/dist/latex/lower-fold.js +2 -0
- package/dist/latex/lower.cjs +11 -617
- package/dist/latex/lower.d.cts +18 -1
- package/dist/latex/lower.d.ts +18 -1
- package/dist/latex/lower.js +2 -616
- package/dist/latex/symbols.d.cts +1 -15
- package/dist/latex/symbols.d.ts +1 -15
- package/dist/latex/temml.d.cts +1 -24
- package/dist/latex/temml.d.ts +1 -24
- package/dist/layout/engine.cjs +2 -2
- package/dist/layout/engine.js +1 -1
- package/dist/layout/reconstruct-lines.cjs +315 -0
- package/dist/layout/reconstruct-lines.d.cts +2 -0
- package/dist/layout/reconstruct-lines.d.ts +2 -0
- package/dist/layout/reconstruct-lines.js +297 -0
- package/dist/layout/reconstruct-presentations-prod.cjs +9 -0
- package/dist/layout/reconstruct-presentations-prod.d.cts +26 -0
- package/dist/layout/reconstruct-presentations-prod.d.ts +26 -0
- package/dist/layout/reconstruct-presentations-prod.js +2 -0
- package/dist/layout/reconstruct-tables.cjs +5 -0
- package/dist/layout/reconstruct-tables.d.cts +22 -0
- package/dist/layout/reconstruct-tables.d.ts +22 -0
- package/dist/layout/reconstruct-tables.js +2 -0
- package/dist/layout/reconstruct.cjs +11 -1545
- package/dist/layout/reconstruct.d.cts +2 -14
- package/dist/layout/reconstruct.d.ts +2 -14
- package/dist/layout/reconstruct.js +2 -1542
- package/dist/layout/shared.cjs +2 -2
- package/dist/layout/shared.js +1 -1
- package/dist/layout/sheets-render.cjs +19 -0
- package/dist/layout/sheets-render.d.cts +41 -0
- package/dist/layout/sheets-render.d.ts +41 -0
- package/dist/layout/sheets-render.js +2 -0
- package/dist/layout/sheets.cjs +10 -544
- package/dist/layout/sheets.d.cts +13 -2
- package/dist/layout/sheets.d.ts +13 -2
- package/dist/layout/sheets.js +2 -543
- package/dist/layout/slides.cjs +2 -2
- package/dist/layout/slides.js +1 -1
- package/dist/layout-DIJzJk4x.js +526 -0
- package/dist/layout-iuiyl_Fk.cjs +621 -0
- package/dist/layout-types-oSbHvZid.d.cts +13 -0
- package/dist/layout-types-oSbHvZid.d.ts +13 -0
- package/dist/lower-DCs3rWI7.js +618 -0
- package/dist/lower-DzOb13w4.cjs +701 -0
- package/dist/markdown/math.cjs +2 -2
- package/dist/markdown/math.js +1 -1
- package/dist/mathml/layout-stretch.cjs +16 -0
- package/dist/mathml/layout-stretch.d.cts +24 -0
- package/dist/mathml/layout-stretch.d.ts +24 -0
- package/dist/mathml/layout-stretch.js +2 -0
- package/dist/mathml/layout-types.d.cts +1 -12
- package/dist/mathml/layout-types.d.ts +1 -12
- package/dist/mathml/layout.cjs +3 -525
- package/dist/mathml/layout.d.cts +2 -2
- package/dist/mathml/layout.d.ts +2 -2
- package/dist/mathml/layout.js +1 -523
- package/dist/odb/formula/evaluate.d.cts +1 -1
- package/dist/odb/formula/evaluate.d.ts +1 -1
- package/dist/odb/report/render.d.cts +1 -1
- package/dist/odb/report/render.d.ts +1 -1
- package/dist/odb/report/source.cjs +2 -2
- package/dist/odb/report/source.d.cts +1 -1
- package/dist/odb/report/source.d.ts +1 -1
- package/dist/odb/report/source.js +1 -1
- package/dist/odb/sql/evaluate-columns.cjs +122 -0
- package/dist/odb/sql/evaluate-columns.d.cts +2 -0
- package/dist/odb/sql/evaluate-columns.d.ts +2 -0
- package/dist/odb/sql/evaluate-columns.js +114 -0
- package/dist/odb/sql/evaluate-predicates.cjs +16 -0
- package/dist/odb/sql/evaluate-predicates.d.cts +23 -0
- package/dist/odb/sql/evaluate-predicates.d.ts +23 -0
- package/dist/odb/sql/evaluate-predicates.js +2 -0
- package/dist/odb/sql/evaluate.cjs +7 -556
- package/dist/odb/sql/evaluate.d.cts +2 -2
- package/dist/odb/sql/evaluate.d.ts +2 -2
- package/dist/odb/sql/evaluate.js +2 -552
- package/dist/read-BSH--XB4.js +682 -0
- package/dist/read-CahCZMwG.cjs +759 -0
- package/dist/reconstruct-BKOCAedo.d.ts +29 -0
- package/dist/reconstruct-D4TEteZ6.d.cts +29 -0
- package/dist/reconstruct-lines-B7t66ICm.d.cts +33 -0
- package/dist/reconstruct-lines-B7t66ICm.d.ts +33 -0
- package/dist/reconstruct-presentations-prod-B5fkPiRZ.js +1256 -0
- package/dist/reconstruct-presentations-prod-X315aBmI.cjs +1375 -0
- package/dist/sheets-BQCpNXsE.cjs +700 -0
- package/dist/sheets-DWDvGN-g.js +545 -0
- package/dist/svg/read-geometry.cjs +10 -0
- package/dist/svg/read-geometry.d.cts +24 -0
- package/dist/svg/read-geometry.d.ts +24 -0
- package/dist/svg/read-geometry.js +2 -0
- package/dist/svg/read.cjs +6 -680
- package/dist/svg/read.d.cts +17 -2
- package/dist/svg/read.d.ts +17 -2
- package/dist/svg/read.js +2 -679
- package/dist/symbols-BlzXfLEe.d.cts +16 -0
- package/dist/symbols-CKm2r4D0.d.ts +16 -0
- package/dist/table-B5gSMY7w.js +649 -0
- package/dist/{table-DrE6jEWv.d.cts → table-BK_Ao-Y6.d.cts} +9 -1
- package/dist/{table-B5htMG3g.d.ts → table-CxY85YUj.d.ts} +9 -1
- package/dist/table-DqUIOSPV.cjs +840 -0
- package/dist/temml-1-I9N9DD.d.cts +25 -0
- package/dist/temml-1-I9N9DD.d.ts +25 -0
- package/package.json +1 -1
package/dist/svg/read.cjs
CHANGED
|
@@ -1,681 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
//#region src/svg/read.ts
|
|
9
|
-
const ASPECT_DISPLAY_DECIMALS = 4;
|
|
10
|
-
const ASPECT_COMPARE_TOLERANCE = 1e-6;
|
|
11
|
-
var SvgMissingRootElementError = class extends Error {
|
|
12
|
-
constructor() {
|
|
13
|
-
super("svg text must contain an <svg> root element");
|
|
14
|
-
this.name = "SvgMissingRootElementError";
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
const DEFAULT_VIEWPORT_WIDTH_PX = 300;
|
|
18
|
-
const DEFAULT_VIEWPORT_HEIGHT_PX = 150;
|
|
19
|
-
const DEFAULT_WIDTH_PT = DEFAULT_VIEWPORT_WIDTH_PX * require_svg_units.PT_PER_PX;
|
|
20
|
-
const DEFAULT_HEIGHT_PT = DEFAULT_VIEWPORT_HEIGHT_PX * require_svg_units.PT_PER_PX;
|
|
21
|
-
const KAPPA = 4 / 3 * (Math.SQRT2 - 1);
|
|
22
|
-
function localName(tag) {
|
|
23
|
-
return tag.slice(tag.indexOf(":") + 1);
|
|
24
|
-
}
|
|
25
|
-
function findAttribute(element, name) {
|
|
26
|
-
for (const attribute of element.attributes) if (localName(attribute.name) === name) return (0, ooxml_js.decodeEntities)(attribute.value);
|
|
27
|
-
}
|
|
28
|
-
function elementChildren(node) {
|
|
29
|
-
return node.type === "element" ? node.children.filter((child) => child.type === "element") : [];
|
|
30
|
-
}
|
|
31
|
-
function textOf(element) {
|
|
32
|
-
let text = "";
|
|
33
|
-
for (const child of element.children) if (child.type === "text" || child.type === "cdata") text += (0, ooxml_js.decodeEntities)(child.value);
|
|
34
|
-
return text;
|
|
35
|
-
}
|
|
36
|
-
function childPaintState(element, parent) {
|
|
37
|
-
return {
|
|
38
|
-
fillSpec: findAttribute(element, "fill") ?? parent.fillSpec,
|
|
39
|
-
strokeSpec: findAttribute(element, "stroke") ?? parent.strokeSpec,
|
|
40
|
-
strokeWidthSpec: findAttribute(element, "stroke-width") ?? parent.strokeWidthSpec,
|
|
41
|
-
fillRuleSpec: findAttribute(element, "fill-rule") ?? parent.fillRuleSpec,
|
|
42
|
-
dashSpec: findAttribute(element, "stroke-dasharray") ?? parent.dashSpec
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
function report(state, code, detail) {
|
|
46
|
-
state.sink?.({
|
|
47
|
-
code,
|
|
48
|
-
detail
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
function resolveFillPaint(state, spec, isFill) {
|
|
52
|
-
if (spec === void 0) return isFill ? {
|
|
53
|
-
r: 0,
|
|
54
|
-
g: 0,
|
|
55
|
-
b: 0
|
|
56
|
-
} : void 0;
|
|
57
|
-
const paint = require_svg_paint.parseSvgPaint(spec);
|
|
58
|
-
if (paint === void 0) {
|
|
59
|
-
report(state, "svg/paint-unsupported", spec);
|
|
60
|
-
return isFill ? {
|
|
61
|
-
r: 0,
|
|
62
|
-
g: 0,
|
|
63
|
-
b: 0
|
|
64
|
-
} : void 0;
|
|
65
|
-
}
|
|
66
|
-
if (paint.kind === "none") return;
|
|
67
|
-
if (paint.kind === "url") {
|
|
68
|
-
report(state, "svg/gradient-unsupported", `#${paint.fragment}`);
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
if (paint.kind === "currentColor") {
|
|
72
|
-
report(state, "svg/paint-unsupported", "currentColor renders as black: the CSS color property is out of scope");
|
|
73
|
-
return {
|
|
74
|
-
r: 0,
|
|
75
|
-
g: 0,
|
|
76
|
-
b: 0
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
return paint.color;
|
|
80
|
-
}
|
|
81
|
-
function resolveStroke(state, paint, ctm) {
|
|
82
|
-
const color = resolveFillPaint(state, paint.strokeSpec, false);
|
|
83
|
-
if (color === void 0) return;
|
|
84
|
-
const widthPt = (require_svg_units.parseSvgUserUnits(paint.strokeWidthSpec) ?? 1) * require_svg_transform.meanScaleFactor(ctm);
|
|
85
|
-
if (!(widthPt > 0)) return;
|
|
86
|
-
const style = require_svg_paint.parseSvgDashStyle(paint.dashSpec);
|
|
87
|
-
return style === void 0 ? {
|
|
88
|
-
color,
|
|
89
|
-
widthPt
|
|
90
|
-
} : {
|
|
91
|
-
color,
|
|
92
|
-
widthPt,
|
|
93
|
-
style
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
function resolvePaint(state, paint, ctm) {
|
|
97
|
-
return {
|
|
98
|
-
fill: resolveFillPaint(state, paint.fillSpec, true),
|
|
99
|
-
stroke: resolveStroke(state, paint, ctm)
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
function boxOfPoints(points) {
|
|
103
|
-
let minX = Number.POSITIVE_INFINITY;
|
|
104
|
-
let minY = Number.POSITIVE_INFINITY;
|
|
105
|
-
let maxX = Number.NEGATIVE_INFINITY;
|
|
106
|
-
let maxY = Number.NEGATIVE_INFINITY;
|
|
107
|
-
for (const point of points) {
|
|
108
|
-
minX = Math.min(minX, point.x);
|
|
109
|
-
minY = Math.min(minY, point.y);
|
|
110
|
-
maxX = Math.max(maxX, point.x);
|
|
111
|
-
maxY = Math.max(maxY, point.y);
|
|
112
|
-
}
|
|
113
|
-
return {
|
|
114
|
-
xPt: minX,
|
|
115
|
-
yPt: minY,
|
|
116
|
-
widthPt: maxX - minX,
|
|
117
|
-
heightPt: maxY - minY
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
function axisAlignedFrame(ctm, x, y, width, height) {
|
|
121
|
-
return boxOfPoints([
|
|
122
|
-
require_svg_transform.applyMatrix(ctm, x, y),
|
|
123
|
-
require_svg_transform.applyMatrix(ctm, x + width, y),
|
|
124
|
-
require_svg_transform.applyMatrix(ctm, x + width, y + height),
|
|
125
|
-
require_svg_transform.applyMatrix(ctm, x, y + height)
|
|
126
|
-
]);
|
|
127
|
-
}
|
|
128
|
-
function similarityFrame(ctm, x, y, width, height) {
|
|
129
|
-
const centre = require_svg_transform.applyMatrix(ctm, x + width / 2, y + height / 2);
|
|
130
|
-
const scale = Math.hypot(ctm.a, ctm.b);
|
|
131
|
-
return {
|
|
132
|
-
xPt: centre.x - scale * width / 2,
|
|
133
|
-
yPt: centre.y - scale * height / 2,
|
|
134
|
-
widthPt: scale * width,
|
|
135
|
-
heightPt: scale * height
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
function buildPathVector(state, subpaths, ctm, paint, fillRule) {
|
|
139
|
-
const placed = subpaths.map((subpath) => ({
|
|
140
|
-
start: require_svg_transform.applyMatrix(ctm, subpath.start.x, subpath.start.y),
|
|
141
|
-
closed: subpath.closed,
|
|
142
|
-
segments: subpath.segments.map((segment) => segment.kind === "line" ? {
|
|
143
|
-
kind: "line",
|
|
144
|
-
to: require_svg_transform.applyMatrix(ctm, segment.to.x, segment.to.y)
|
|
145
|
-
} : {
|
|
146
|
-
kind: "cubic",
|
|
147
|
-
control1: require_svg_transform.applyMatrix(ctm, segment.control1.x, segment.control1.y),
|
|
148
|
-
control2: require_svg_transform.applyMatrix(ctm, segment.control2.x, segment.control2.y),
|
|
149
|
-
to: require_svg_transform.applyMatrix(ctm, segment.to.x, segment.to.y)
|
|
150
|
-
})
|
|
151
|
-
}));
|
|
152
|
-
const frame = boxOfPoints(placed.flatMap((subpath) => [subpath.start, ...subpath.segments.flatMap((segment) => segment.kind === "line" ? [segment.to] : [
|
|
153
|
-
segment.control1,
|
|
154
|
-
segment.control2,
|
|
155
|
-
segment.to
|
|
156
|
-
])]));
|
|
157
|
-
if (frame.widthPt === 0 && frame.heightPt === 0) return;
|
|
158
|
-
const localSubpaths = placed.map((subpath) => ({
|
|
159
|
-
start: {
|
|
160
|
-
xPt: subpath.start.x - frame.xPt,
|
|
161
|
-
yPt: subpath.start.y - frame.yPt
|
|
162
|
-
},
|
|
163
|
-
closed: subpath.closed,
|
|
164
|
-
segments: subpath.segments.map((segment) => segment.kind === "line" ? {
|
|
165
|
-
kind: "line",
|
|
166
|
-
to: {
|
|
167
|
-
xPt: segment.to.x - frame.xPt,
|
|
168
|
-
yPt: segment.to.y - frame.yPt
|
|
169
|
-
}
|
|
170
|
-
} : {
|
|
171
|
-
kind: "cubic",
|
|
172
|
-
control1: {
|
|
173
|
-
xPt: segment.control1.x - frame.xPt,
|
|
174
|
-
yPt: segment.control1.y - frame.yPt
|
|
175
|
-
},
|
|
176
|
-
control2: {
|
|
177
|
-
xPt: segment.control2.x - frame.xPt,
|
|
178
|
-
yPt: segment.control2.y - frame.yPt
|
|
179
|
-
},
|
|
180
|
-
to: {
|
|
181
|
-
xPt: segment.to.x - frame.xPt,
|
|
182
|
-
yPt: segment.to.y - frame.yPt
|
|
183
|
-
}
|
|
184
|
-
})
|
|
185
|
-
}));
|
|
186
|
-
const sourceIndex = state.vectors.length;
|
|
187
|
-
return {
|
|
188
|
-
kind: "path",
|
|
189
|
-
frame,
|
|
190
|
-
subpaths: localSubpaths,
|
|
191
|
-
...paint.fill !== void 0 ? { fill: paint.fill } : {},
|
|
192
|
-
...fillRule !== void 0 ? { fillRule } : {},
|
|
193
|
-
...paint.stroke !== void 0 ? { stroke: paint.stroke } : {},
|
|
194
|
-
paintOrder: state.paintOrder++,
|
|
195
|
-
sourcePath: `svg/vector[${sourceIndex}]`
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
function roundedRectSubpaths(x, y, width, height, rx, ry) {
|
|
199
|
-
const radiusX = Math.min(rx, width / 2);
|
|
200
|
-
const radiusY = Math.min(ry, height / 2);
|
|
201
|
-
const kx = radiusX * KAPPA;
|
|
202
|
-
const ky = radiusY * KAPPA;
|
|
203
|
-
return [{
|
|
204
|
-
start: {
|
|
205
|
-
x: x + radiusX,
|
|
206
|
-
y
|
|
207
|
-
},
|
|
208
|
-
closed: true,
|
|
209
|
-
segments: [
|
|
210
|
-
{
|
|
211
|
-
kind: "line",
|
|
212
|
-
to: {
|
|
213
|
-
x: x + width - radiusX,
|
|
214
|
-
y
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
kind: "cubic",
|
|
219
|
-
control1: {
|
|
220
|
-
x: x + width - radiusX + kx,
|
|
221
|
-
y
|
|
222
|
-
},
|
|
223
|
-
control2: {
|
|
224
|
-
x: x + width,
|
|
225
|
-
y: y + radiusY - ky
|
|
226
|
-
},
|
|
227
|
-
to: {
|
|
228
|
-
x: x + width,
|
|
229
|
-
y: y + radiusY
|
|
230
|
-
}
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
kind: "line",
|
|
234
|
-
to: {
|
|
235
|
-
x: x + width,
|
|
236
|
-
y: y + height - radiusY
|
|
237
|
-
}
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
kind: "cubic",
|
|
241
|
-
control1: {
|
|
242
|
-
x: x + width,
|
|
243
|
-
y: y + height - radiusY + ky
|
|
244
|
-
},
|
|
245
|
-
control2: {
|
|
246
|
-
x: x + width - radiusX + kx,
|
|
247
|
-
y: y + height
|
|
248
|
-
},
|
|
249
|
-
to: {
|
|
250
|
-
x: x + width - radiusX,
|
|
251
|
-
y: y + height
|
|
252
|
-
}
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
kind: "line",
|
|
256
|
-
to: {
|
|
257
|
-
x: x + radiusX,
|
|
258
|
-
y: y + height
|
|
259
|
-
}
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
kind: "cubic",
|
|
263
|
-
control1: {
|
|
264
|
-
x: x + radiusX - kx,
|
|
265
|
-
y: y + height
|
|
266
|
-
},
|
|
267
|
-
control2: {
|
|
268
|
-
x,
|
|
269
|
-
y: y + height - radiusY + ky
|
|
270
|
-
},
|
|
271
|
-
to: {
|
|
272
|
-
x,
|
|
273
|
-
y: y + height - radiusY
|
|
274
|
-
}
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
kind: "line",
|
|
278
|
-
to: {
|
|
279
|
-
x,
|
|
280
|
-
y: y + radiusY
|
|
281
|
-
}
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
kind: "cubic",
|
|
285
|
-
control1: {
|
|
286
|
-
x,
|
|
287
|
-
y: y + radiusY - ky
|
|
288
|
-
},
|
|
289
|
-
control2: {
|
|
290
|
-
x: x + radiusX - kx,
|
|
291
|
-
y
|
|
292
|
-
},
|
|
293
|
-
to: {
|
|
294
|
-
x: x + radiusX,
|
|
295
|
-
y
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
]
|
|
299
|
-
}];
|
|
300
|
-
}
|
|
301
|
-
function ellipseSubpaths(cx, cy, rx, ry) {
|
|
302
|
-
const kx = rx * KAPPA;
|
|
303
|
-
const ky = ry * KAPPA;
|
|
304
|
-
return [{
|
|
305
|
-
start: {
|
|
306
|
-
x: cx + rx,
|
|
307
|
-
y: cy
|
|
308
|
-
},
|
|
309
|
-
closed: true,
|
|
310
|
-
segments: [
|
|
311
|
-
{
|
|
312
|
-
kind: "cubic",
|
|
313
|
-
control1: {
|
|
314
|
-
x: cx + rx,
|
|
315
|
-
y: cy + ky
|
|
316
|
-
},
|
|
317
|
-
control2: {
|
|
318
|
-
x: cx + kx,
|
|
319
|
-
y: cy + ry
|
|
320
|
-
},
|
|
321
|
-
to: {
|
|
322
|
-
x: cx,
|
|
323
|
-
y: cy + ry
|
|
324
|
-
}
|
|
325
|
-
},
|
|
326
|
-
{
|
|
327
|
-
kind: "cubic",
|
|
328
|
-
control1: {
|
|
329
|
-
x: cx - kx,
|
|
330
|
-
y: cy + ry
|
|
331
|
-
},
|
|
332
|
-
control2: {
|
|
333
|
-
x: cx - rx,
|
|
334
|
-
y: cy + ky
|
|
335
|
-
},
|
|
336
|
-
to: {
|
|
337
|
-
x: cx - rx,
|
|
338
|
-
y: cy
|
|
339
|
-
}
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
kind: "cubic",
|
|
343
|
-
control1: {
|
|
344
|
-
x: cx - rx,
|
|
345
|
-
y: cy - ky
|
|
346
|
-
},
|
|
347
|
-
control2: {
|
|
348
|
-
x: cx - kx,
|
|
349
|
-
y: cy - ry
|
|
350
|
-
},
|
|
351
|
-
to: {
|
|
352
|
-
x: cx,
|
|
353
|
-
y: cy - ry
|
|
354
|
-
}
|
|
355
|
-
},
|
|
356
|
-
{
|
|
357
|
-
kind: "cubic",
|
|
358
|
-
control1: {
|
|
359
|
-
x: cx + kx,
|
|
360
|
-
y: cy - ry
|
|
361
|
-
},
|
|
362
|
-
control2: {
|
|
363
|
-
x: cx + rx,
|
|
364
|
-
y: cy - ky
|
|
365
|
-
},
|
|
366
|
-
to: {
|
|
367
|
-
x: cx + rx,
|
|
368
|
-
y: cy
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
]
|
|
372
|
-
}];
|
|
373
|
-
}
|
|
374
|
-
function userUnits(element, attr) {
|
|
375
|
-
return require_svg_units.parseSvgUserUnits(findAttribute(element, attr)) ?? 0;
|
|
376
|
-
}
|
|
377
|
-
function readShape(state, element, ctm, paint) {
|
|
378
|
-
const name = localName(element.tag);
|
|
379
|
-
const id = findAttribute(element, "id");
|
|
380
|
-
const detail = id === void 0 ? name : `${name}#${id}`;
|
|
381
|
-
let fillRule;
|
|
382
|
-
const fillRuleSpec = paint.fillRuleSpec;
|
|
383
|
-
if (fillRuleSpec !== void 0 && fillRuleSpec !== "nonzero") {
|
|
384
|
-
if (fillRuleSpec === "evenodd") fillRule = "evenodd";
|
|
385
|
-
else report(state, "svg/paint-unsupported", fillRuleSpec);
|
|
386
|
-
}
|
|
387
|
-
const resolved = resolvePaint(state, paint, ctm);
|
|
388
|
-
if (resolved.fill === void 0 && resolved.stroke === void 0) {
|
|
389
|
-
report(state, "svg/element-skipped", `${detail}: nothing painted (fill and stroke both absent or none)`);
|
|
390
|
-
return;
|
|
391
|
-
}
|
|
392
|
-
if (name === "rect") {
|
|
393
|
-
const x = userUnits(element, "x");
|
|
394
|
-
const y = userUnits(element, "y");
|
|
395
|
-
const width = userUnits(element, "width");
|
|
396
|
-
const height = userUnits(element, "height");
|
|
397
|
-
if (width <= 0 || height <= 0) {
|
|
398
|
-
report(state, "svg/element-skipped", `${detail}: zero or negative size`);
|
|
399
|
-
return;
|
|
400
|
-
}
|
|
401
|
-
const rxAttr = require_svg_units.parseSvgUserUnits(findAttribute(element, "rx"));
|
|
402
|
-
const ryAttr = require_svg_units.parseSvgUserUnits(findAttribute(element, "ry"));
|
|
403
|
-
const rx = rxAttr ?? ryAttr ?? 0;
|
|
404
|
-
const ry = ryAttr ?? rxAttr ?? 0;
|
|
405
|
-
if (rx > 0 || ry > 0) {
|
|
406
|
-
const vector = buildPathVector(state, roundedRectSubpaths(x, y, width, height, rx, ry), ctm, resolved, fillRule);
|
|
407
|
-
if (vector !== void 0) state.vectors.push(vector);
|
|
408
|
-
return;
|
|
409
|
-
}
|
|
410
|
-
const rotated = !require_svg_transform.isAxisAligned(ctm) && require_svg_transform.isNonReflectingSimilarity(ctm);
|
|
411
|
-
const frame = rotated ? similarityFrame(ctm, x, y, width, height) : axisAlignedFrame(ctm, x, y, width, height);
|
|
412
|
-
if (frame.widthPt <= 0 || frame.heightPt <= 0) {
|
|
413
|
-
report(state, "svg/element-skipped", `${detail}: collapses to zero size under transform`);
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
state.vectors.push({
|
|
417
|
-
kind: "rect",
|
|
418
|
-
frame,
|
|
419
|
-
...rotated ? { rotationDeg: require_svg_transform.similarityRotationDeg(ctm) } : {},
|
|
420
|
-
...resolved.fill !== void 0 ? { fill: resolved.fill } : {},
|
|
421
|
-
...resolved.stroke !== void 0 ? { stroke: resolved.stroke } : {},
|
|
422
|
-
paintOrder: state.paintOrder++,
|
|
423
|
-
sourcePath: `svg/vector[${state.vectors.length}]`
|
|
424
|
-
});
|
|
425
|
-
return;
|
|
426
|
-
}
|
|
427
|
-
if (name === "circle" || name === "ellipse") {
|
|
428
|
-
const cx = userUnits(element, "cx");
|
|
429
|
-
const cy = userUnits(element, "cy");
|
|
430
|
-
const rx = name === "circle" ? userUnits(element, "r") : userUnits(element, "rx");
|
|
431
|
-
const ry = name === "circle" ? userUnits(element, "r") : userUnits(element, "ry");
|
|
432
|
-
if (rx <= 0 || ry <= 0) {
|
|
433
|
-
report(state, "svg/element-skipped", `${detail}: zero or negative radius`);
|
|
434
|
-
return;
|
|
435
|
-
}
|
|
436
|
-
if (!require_svg_transform.isAxisAligned(ctm) && !require_svg_transform.isNonReflectingSimilarity(ctm)) {
|
|
437
|
-
const vector = buildPathVector(state, ellipseSubpaths(cx, cy, rx, ry), ctm, resolved, fillRule);
|
|
438
|
-
if (vector !== void 0) state.vectors.push(vector);
|
|
439
|
-
return;
|
|
440
|
-
}
|
|
441
|
-
const rotated = !require_svg_transform.isAxisAligned(ctm);
|
|
442
|
-
const frame = rotated ? similarityFrame(ctm, cx - rx, cy - ry, rx * 2, ry * 2) : axisAlignedFrame(ctm, cx - rx, cy - ry, rx * 2, ry * 2);
|
|
443
|
-
if (frame.widthPt <= 0 || frame.heightPt <= 0) {
|
|
444
|
-
report(state, "svg/element-skipped", `${detail}: collapses to zero size under transform`);
|
|
445
|
-
return;
|
|
446
|
-
}
|
|
447
|
-
state.vectors.push({
|
|
448
|
-
kind: "ellipse",
|
|
449
|
-
frame,
|
|
450
|
-
...rotated ? { rotationDeg: require_svg_transform.similarityRotationDeg(ctm) } : {},
|
|
451
|
-
...resolved.fill !== void 0 ? { fill: resolved.fill } : {},
|
|
452
|
-
...resolved.stroke !== void 0 ? { stroke: resolved.stroke } : {},
|
|
453
|
-
paintOrder: state.paintOrder++,
|
|
454
|
-
sourcePath: `svg/vector[${state.vectors.length}]`
|
|
455
|
-
});
|
|
456
|
-
return;
|
|
457
|
-
}
|
|
458
|
-
if (name === "line") {
|
|
459
|
-
if (resolved.stroke === void 0) {
|
|
460
|
-
report(state, "svg/element-skipped", `${detail}: a line paints only through its stroke, which is absent or none`);
|
|
461
|
-
return;
|
|
462
|
-
}
|
|
463
|
-
const from = require_svg_transform.applyMatrix(ctm, userUnits(element, "x1"), userUnits(element, "y1"));
|
|
464
|
-
const to = require_svg_transform.applyMatrix(ctm, userUnits(element, "x2"), userUnits(element, "y2"));
|
|
465
|
-
if (from.x === to.x && from.y === to.y) {
|
|
466
|
-
report(state, "svg/element-skipped", `${detail}: zero-length line`);
|
|
467
|
-
return;
|
|
468
|
-
}
|
|
469
|
-
state.vectors.push({
|
|
470
|
-
kind: "line",
|
|
471
|
-
from: {
|
|
472
|
-
xPt: from.x,
|
|
473
|
-
yPt: from.y
|
|
474
|
-
},
|
|
475
|
-
to: {
|
|
476
|
-
xPt: to.x,
|
|
477
|
-
yPt: to.y
|
|
478
|
-
},
|
|
479
|
-
stroke: resolved.stroke,
|
|
480
|
-
paintOrder: state.paintOrder++,
|
|
481
|
-
sourcePath: `svg/vector[${state.vectors.length}]`
|
|
482
|
-
});
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
|
-
if (name === "polyline" || name === "polygon") {
|
|
486
|
-
const pointsRaw = findAttribute(element, "points");
|
|
487
|
-
if (pointsRaw === void 0) {
|
|
488
|
-
report(state, "svg/element-skipped", `${detail}: no points attribute`);
|
|
489
|
-
return;
|
|
490
|
-
}
|
|
491
|
-
const numbers = pointsRaw.trim().split(/[\s,]+/).filter((part) => part !== "").map(Number);
|
|
492
|
-
if (numbers.length === 0 || numbers.length % 2 !== 0 || !numbers.every((value) => Number.isFinite(value))) {
|
|
493
|
-
report(state, "svg/element-unsupported", `${detail}: malformed points attribute`);
|
|
494
|
-
return;
|
|
495
|
-
}
|
|
496
|
-
if (numbers.length < 4) {
|
|
497
|
-
report(state, "svg/element-skipped", `${detail}: fewer than two points`);
|
|
498
|
-
return;
|
|
499
|
-
}
|
|
500
|
-
const segments = [];
|
|
501
|
-
for (let i = 2; i < numbers.length; i += 2) segments.push({
|
|
502
|
-
kind: "line",
|
|
503
|
-
to: {
|
|
504
|
-
x: numbers[i],
|
|
505
|
-
y: numbers[i + 1]
|
|
506
|
-
}
|
|
507
|
-
});
|
|
508
|
-
const vector = buildPathVector(state, [{
|
|
509
|
-
start: {
|
|
510
|
-
x: numbers[0],
|
|
511
|
-
y: numbers[1]
|
|
512
|
-
},
|
|
513
|
-
closed: name === "polygon",
|
|
514
|
-
segments
|
|
515
|
-
}], ctm, resolved, fillRule);
|
|
516
|
-
if (vector === void 0) report(state, "svg/element-skipped", `${detail}: all points coincide`);
|
|
517
|
-
else state.vectors.push(vector);
|
|
518
|
-
return;
|
|
519
|
-
}
|
|
520
|
-
if (name === "path") {
|
|
521
|
-
const d = findAttribute(element, "d");
|
|
522
|
-
if (d === void 0 || d.trim() === "") {
|
|
523
|
-
report(state, "svg/element-skipped", `${detail}: no d attribute`);
|
|
524
|
-
return;
|
|
525
|
-
}
|
|
526
|
-
const parsed = require_svg_path.parseSvgPathData(d);
|
|
527
|
-
if (parsed === void 0 || parsed.length === 0) {
|
|
528
|
-
report(state, "svg/element-unsupported", `${detail}: malformed or empty path data`);
|
|
529
|
-
return;
|
|
530
|
-
}
|
|
531
|
-
const vector = buildPathVector(state, parsed, ctm, resolved, fillRule);
|
|
532
|
-
if (vector === void 0) report(state, "svg/element-skipped", `${detail}: path collapses to a single point`);
|
|
533
|
-
else state.vectors.push(vector);
|
|
534
|
-
return;
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
const NON_RENDERING_ELEMENTS = /* @__PURE__ */ new Set([
|
|
538
|
-
"defs",
|
|
539
|
-
"title",
|
|
540
|
-
"desc",
|
|
541
|
-
"metadata",
|
|
542
|
-
"linearGradient",
|
|
543
|
-
"radialGradient",
|
|
544
|
-
"pattern",
|
|
545
|
-
"clipPath",
|
|
546
|
-
"mask",
|
|
547
|
-
"marker",
|
|
548
|
-
"symbol",
|
|
549
|
-
"script"
|
|
550
|
-
]);
|
|
551
|
-
function walkElement(state, element, ctm, paint) {
|
|
552
|
-
const name = localName(element.tag);
|
|
553
|
-
const id = findAttribute(element, "id");
|
|
554
|
-
const detail = id === void 0 ? name : `${name}#${id}`;
|
|
555
|
-
if (findAttribute(element, "style") !== void 0) report(state, "svg/css-style-ignored", detail);
|
|
556
|
-
for (const opacityAttr of [
|
|
557
|
-
"opacity",
|
|
558
|
-
"fill-opacity",
|
|
559
|
-
"stroke-opacity"
|
|
560
|
-
]) {
|
|
561
|
-
const raw = findAttribute(element, opacityAttr);
|
|
562
|
-
if (raw !== void 0) {
|
|
563
|
-
const value = Number(raw);
|
|
564
|
-
if (Number.isFinite(value) && value < 1) report(state, "svg/opacity-ignored", `${detail}: ${opacityAttr}=${raw}`);
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
if (name === "g" || name === "a") {
|
|
568
|
-
const own = require_svg_transform.parseSvgTransform(findAttribute(element, "transform"));
|
|
569
|
-
walkChildren(state, element, own === void 0 ? ctm : require_svg_transform.composeMatrices(ctm, own), childPaintState(element, paint));
|
|
570
|
-
return;
|
|
571
|
-
}
|
|
572
|
-
if (NON_RENDERING_ELEMENTS.has(name)) return;
|
|
573
|
-
if (name === "style") {
|
|
574
|
-
report(state, "svg/css-style-ignored", detail);
|
|
575
|
-
return;
|
|
576
|
-
}
|
|
577
|
-
if (name === "text" || name === "tspan" || name === "textPath" || name === "tref") {
|
|
578
|
-
report(state, "svg/text-unsupported", detail);
|
|
579
|
-
return;
|
|
580
|
-
}
|
|
581
|
-
if (name === "image") {
|
|
582
|
-
report(state, "svg/image-unsupported", detail);
|
|
583
|
-
return;
|
|
584
|
-
}
|
|
585
|
-
if (name === "use") {
|
|
586
|
-
report(state, "svg/use-unsupported", detail);
|
|
587
|
-
return;
|
|
588
|
-
}
|
|
589
|
-
if (name === "rect" || name === "circle" || name === "ellipse" || name === "line" || name === "polyline" || name === "polygon" || name === "path") {
|
|
590
|
-
const own = require_svg_transform.parseSvgTransform(findAttribute(element, "transform"));
|
|
591
|
-
readShape(state, element, own === void 0 ? ctm : require_svg_transform.composeMatrices(ctm, own), childPaintState(element, paint));
|
|
592
|
-
return;
|
|
593
|
-
}
|
|
594
|
-
report(state, "svg/element-unsupported", detail);
|
|
595
|
-
}
|
|
596
|
-
function walkChildren(state, element, ctm, paint) {
|
|
597
|
-
for (const child of elementChildren(element)) walkElement(state, child, ctm, paint);
|
|
598
|
-
}
|
|
599
|
-
function resolveRootGeometry(root, state) {
|
|
600
|
-
const attrWidth = require_svg_units.parseSvgLengthPt(findAttribute(root, "width"));
|
|
601
|
-
const attrHeight = require_svg_units.parseSvgLengthPt(findAttribute(root, "height"));
|
|
602
|
-
const parsedViewBox = require_svg_units.parseSvgViewBox(findAttribute(root, "viewBox"));
|
|
603
|
-
const viewBox = parsedViewBox !== void 0 && parsedViewBox.width > 0 && parsedViewBox.height > 0 ? parsedViewBox : void 0;
|
|
604
|
-
let widthPt = attrWidth !== void 0 && attrWidth > 0 ? attrWidth : void 0;
|
|
605
|
-
let heightPt = attrHeight !== void 0 && attrHeight > 0 ? attrHeight : void 0;
|
|
606
|
-
if (widthPt === void 0 !== (heightPt === void 0)) {
|
|
607
|
-
widthPt = void 0;
|
|
608
|
-
heightPt = void 0;
|
|
609
|
-
}
|
|
610
|
-
if (widthPt === void 0 || heightPt === void 0) {
|
|
611
|
-
if (viewBox !== void 0) {
|
|
612
|
-
widthPt = viewBox.width;
|
|
613
|
-
heightPt = viewBox.height;
|
|
614
|
-
} else {
|
|
615
|
-
widthPt = DEFAULT_WIDTH_PT;
|
|
616
|
-
heightPt = DEFAULT_HEIGHT_PT;
|
|
617
|
-
report(state, "svg/default-size-assumed", "neither width/height nor a usable viewBox was present; assuming the CSS default replaced-element size of 300x150 px");
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
if (viewBox === void 0) return {
|
|
621
|
-
widthPt,
|
|
622
|
-
heightPt,
|
|
623
|
-
map: {
|
|
624
|
-
a: .75,
|
|
625
|
-
b: 0,
|
|
626
|
-
c: 0,
|
|
627
|
-
d: .75,
|
|
628
|
-
e: 0,
|
|
629
|
-
f: 0
|
|
630
|
-
}
|
|
631
|
-
};
|
|
632
|
-
const preserveAspectRatio = findAttribute(root, "preserveAspectRatio") ?? "xMidYMid meet";
|
|
633
|
-
if (preserveAspectRatio.trim() !== "none") {
|
|
634
|
-
const viewBoxAspect = viewBox.width / viewBox.height;
|
|
635
|
-
const pageAspect = widthPt / heightPt;
|
|
636
|
-
if (Math.abs(viewBoxAspect - pageAspect) > ASPECT_COMPARE_TOLERANCE * Math.max(viewBoxAspect, pageAspect)) report(state, "svg/preserve-aspect-ratio-stretched", `viewBox aspect ${viewBoxAspect.toFixed(ASPECT_DISPLAY_DECIMALS)} stretched onto page aspect ${pageAspect.toFixed(ASPECT_DISPLAY_DECIMALS)} under preserveAspectRatio="${preserveAspectRatio.trim()}" (letterboxing is out of scope)`);
|
|
637
|
-
}
|
|
638
|
-
const sx = widthPt / viewBox.width;
|
|
639
|
-
const sy = heightPt / viewBox.height;
|
|
640
|
-
return {
|
|
641
|
-
widthPt,
|
|
642
|
-
heightPt,
|
|
643
|
-
map: {
|
|
644
|
-
a: sx,
|
|
645
|
-
b: 0,
|
|
646
|
-
c: 0,
|
|
647
|
-
d: sy,
|
|
648
|
-
e: -viewBox.minX * sx,
|
|
649
|
-
f: -viewBox.minY * sy
|
|
650
|
-
}
|
|
651
|
-
};
|
|
652
|
-
}
|
|
653
|
-
function readSvgContent(text, options) {
|
|
654
|
-
const root = (0, odf_js.parseXml)(text).find((node) => node.type === "element" && localName(node.tag) === "svg");
|
|
655
|
-
if (root === void 0) throw new SvgMissingRootElementError();
|
|
656
|
-
const state = {
|
|
657
|
-
sink: options?.onSvgDiagnostic,
|
|
658
|
-
vectors: [],
|
|
659
|
-
paintOrder: 0
|
|
660
|
-
};
|
|
661
|
-
const rootGeometry = resolveRootGeometry(root, state);
|
|
662
|
-
const titleElement = elementChildren(root).find((child) => localName(child.tag) === "title");
|
|
663
|
-
const title = titleElement === void 0 ? void 0 : textOf(titleElement).trim();
|
|
664
|
-
const metadata = title === void 0 || title === "" ? {} : { title };
|
|
665
|
-
walkChildren(state, root, rootGeometry.map, childPaintState(root, {}));
|
|
666
|
-
return {
|
|
667
|
-
kind: "drawing",
|
|
668
|
-
metadata,
|
|
669
|
-
pages: [{
|
|
670
|
-
size: {
|
|
671
|
-
widthPt: rootGeometry.widthPt,
|
|
672
|
-
heightPt: rootGeometry.heightPt
|
|
673
|
-
},
|
|
674
|
-
shapes: [],
|
|
675
|
-
vectors: state.vectors
|
|
676
|
-
}]
|
|
677
|
-
};
|
|
678
|
-
}
|
|
679
|
-
//#endregion
|
|
680
|
-
exports.SvgMissingRootElementError = SvgMissingRootElementError;
|
|
681
|
-
exports.readSvgContent = readSvgContent;
|
|
2
|
+
const require_read = require("../read-CahCZMwG.cjs");
|
|
3
|
+
exports.KAPPA = require_read.KAPPA;
|
|
4
|
+
exports.KAPPA_NUMERATOR = require_read.KAPPA_NUMERATOR;
|
|
5
|
+
exports.SvgMissingRootElementError = require_read.SvgMissingRootElementError;
|
|
6
|
+
exports.readSvgContent = require_read.readSvgContent;
|
|
7
|
+
exports.resolveFillPaint = require_read.resolveFillPaint;
|
package/dist/svg/read.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as SvgDiagnosticSink } from "../diagnostics-DVAXKgcf.cjs";
|
|
2
|
-
import { ContentDocument } from "document-schema.js";
|
|
2
|
+
import { Color, ContentDocument, ContentVector } from "document-schema.js";
|
|
3
3
|
//#region src/svg/read.d.ts
|
|
4
4
|
interface ReadSvgContentOptions {
|
|
5
5
|
readonly onSvgDiagnostic?: SvgDiagnosticSink;
|
|
@@ -7,6 +7,21 @@ interface ReadSvgContentOptions {
|
|
|
7
7
|
declare class SvgMissingRootElementError extends Error {
|
|
8
8
|
constructor();
|
|
9
9
|
}
|
|
10
|
+
declare const KAPPA_NUMERATOR = 4;
|
|
11
|
+
declare const KAPPA: number;
|
|
12
|
+
interface PaintState {
|
|
13
|
+
readonly fillSpec?: string;
|
|
14
|
+
readonly strokeSpec?: string;
|
|
15
|
+
readonly strokeWidthSpec?: string;
|
|
16
|
+
readonly fillRuleSpec?: string;
|
|
17
|
+
readonly dashSpec?: string;
|
|
18
|
+
}
|
|
19
|
+
interface ReaderState {
|
|
20
|
+
readonly sink?: SvgDiagnosticSink;
|
|
21
|
+
vectors: ContentVector[];
|
|
22
|
+
paintOrder: number;
|
|
23
|
+
}
|
|
24
|
+
declare function resolveFillPaint(state: ReaderState, spec: string | undefined, isFill: boolean): Color | undefined;
|
|
10
25
|
declare function readSvgContent(text: string, options?: ReadSvgContentOptions): ContentDocument;
|
|
11
26
|
//#endregion
|
|
12
|
-
export { ReadSvgContentOptions, SvgMissingRootElementError, readSvgContent };
|
|
27
|
+
export { KAPPA, KAPPA_NUMERATOR, PaintState, ReadSvgContentOptions, ReaderState, SvgMissingRootElementError, readSvgContent, resolveFillPaint };
|