ooxml-core 0.8.0 → 0.9.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/README.md +7 -0
- package/dist/chart/blank-display.d.ts +37 -0
- package/dist/chart/blank-display.d.ts.map +1 -0
- package/dist/chart/box-stats.d.ts +28 -0
- package/dist/chart/box-stats.d.ts.map +1 -0
- package/dist/chart/index.cjs +229 -0
- package/dist/chart/index.d.ts +6 -0
- package/dist/chart/index.d.ts.map +1 -0
- package/dist/chart/index.mjs +220 -0
- package/dist/chart/regression.d.ts +40 -0
- package/dist/chart/regression.d.ts.map +1 -0
- package/dist/chart/stacked-series.d.ts +39 -0
- package/dist/chart/stacked-series.d.ts.map +1 -0
- package/dist/geometry/index.cjs +192 -0
- package/dist/geometry/index.d.ts +1 -0
- package/dist/geometry/index.d.ts.map +1 -1
- package/dist/geometry/index.mjs +192 -1
- package/dist/geometry/svg-path-curves.d.ts +11 -0
- package/dist/geometry/svg-path-curves.d.ts.map +1 -0
- package/dist/geometry/svg-path-flatten.d.ts +26 -0
- package/dist/geometry/svg-path-flatten.d.ts.map +1 -0
- package/dist/geometry/svg-path-types.d.ts +6 -0
- package/dist/geometry/svg-path-types.d.ts.map +1 -0
- package/dist/index.cjs +554 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +553 -4
- package/dist/text/index.cjs +122 -0
- package/dist/text/index.d.ts +3 -0
- package/dist/text/index.d.ts.map +1 -0
- package/dist/text/index.mjs +117 -0
- package/dist/text/unicode-script-detection.d.ts +54 -0
- package/dist/text/unicode-script-detection.d.ts.map +1 -0
- package/package.json +11 -1
package/dist/geometry/index.cjs
CHANGED
|
@@ -14896,6 +14896,197 @@ function subtractSvgPaths(path1, path2) {
|
|
|
14896
14896
|
return subtractShapes(path1, path2);
|
|
14897
14897
|
}
|
|
14898
14898
|
|
|
14899
|
+
// src/geometry/svg-path-curves.ts
|
|
14900
|
+
function sampleCubic(p0, p1, p2, p3, segments, out) {
|
|
14901
|
+
for (let i = 1; i <= segments; i++) {
|
|
14902
|
+
const t = i / segments;
|
|
14903
|
+
const mt = 1 - t;
|
|
14904
|
+
const x = mt * mt * mt * p0.x + 3 * mt * mt * t * p1.x + 3 * mt * t * t * p2.x + t * t * t * p3.x;
|
|
14905
|
+
const y = mt * mt * mt * p0.y + 3 * mt * mt * t * p1.y + 3 * mt * t * t * p2.y + t * t * t * p3.y;
|
|
14906
|
+
out.push({ x, y });
|
|
14907
|
+
}
|
|
14908
|
+
}
|
|
14909
|
+
function sampleQuadratic(p0, p1, p2, segments, out) {
|
|
14910
|
+
for (let i = 1; i <= segments; i++) {
|
|
14911
|
+
const t = i / segments;
|
|
14912
|
+
const mt = 1 - t;
|
|
14913
|
+
const x = mt * mt * p0.x + 2 * mt * t * p1.x + t * t * p2.x;
|
|
14914
|
+
const y = mt * mt * p0.y + 2 * mt * t * p1.y + t * t * p2.y;
|
|
14915
|
+
out.push({ x, y });
|
|
14916
|
+
}
|
|
14917
|
+
}
|
|
14918
|
+
function sampleArc(start, rxIn, ryIn, xAxisRotationDeg, largeArcFlag, sweepFlag, end, segments, out) {
|
|
14919
|
+
if (rxIn === 0 || ryIn === 0 || start.x === end.x && start.y === end.y) {
|
|
14920
|
+
out.push(end);
|
|
14921
|
+
return;
|
|
14922
|
+
}
|
|
14923
|
+
const phi = xAxisRotationDeg * Math.PI / 180;
|
|
14924
|
+
const cosPhi = Math.cos(phi);
|
|
14925
|
+
const sinPhi = Math.sin(phi);
|
|
14926
|
+
let rx = Math.abs(rxIn);
|
|
14927
|
+
let ry = Math.abs(ryIn);
|
|
14928
|
+
const dx2 = (start.x - end.x) / 2;
|
|
14929
|
+
const dy2 = (start.y - end.y) / 2;
|
|
14930
|
+
const x1p = cosPhi * dx2 + sinPhi * dy2;
|
|
14931
|
+
const y1p = -sinPhi * dx2 + cosPhi * dy2;
|
|
14932
|
+
const lambda = x1p * x1p / (rx * rx) + y1p * y1p / (ry * ry);
|
|
14933
|
+
if (lambda > 1) {
|
|
14934
|
+
const scale = Math.sqrt(lambda);
|
|
14935
|
+
rx *= scale;
|
|
14936
|
+
ry *= scale;
|
|
14937
|
+
}
|
|
14938
|
+
const sign = largeArcFlag !== sweepFlag ? 1 : -1;
|
|
14939
|
+
const num = rx * rx * ry * ry - rx * rx * y1p * y1p - ry * ry * x1p * x1p;
|
|
14940
|
+
const den = rx * rx * y1p * y1p + ry * ry * x1p * x1p;
|
|
14941
|
+
const coef = sign * Math.sqrt(Math.max(0, num / den));
|
|
14942
|
+
const cxp = coef * (rx * y1p) / ry;
|
|
14943
|
+
const cyp = coef * -(ry * x1p) / rx;
|
|
14944
|
+
const cx = cosPhi * cxp - sinPhi * cyp + (start.x + end.x) / 2;
|
|
14945
|
+
const cy = sinPhi * cxp + cosPhi * cyp + (start.y + end.y) / 2;
|
|
14946
|
+
const angle = (ux, uy, vx, vy) => {
|
|
14947
|
+
const sign2 = ux * vy - uy * vx < 0 ? -1 : 1;
|
|
14948
|
+
const dot = Math.max(
|
|
14949
|
+
-1,
|
|
14950
|
+
Math.min(1, (ux * vx + uy * vy) / (Math.hypot(ux, uy) * Math.hypot(vx, vy)))
|
|
14951
|
+
);
|
|
14952
|
+
return sign2 * Math.acos(dot);
|
|
14953
|
+
};
|
|
14954
|
+
const theta1 = angle(1, 0, (x1p - cxp) / rx, (y1p - cyp) / ry);
|
|
14955
|
+
let deltaTheta = angle((x1p - cxp) / rx, (y1p - cyp) / ry, (-x1p - cxp) / rx, (-y1p - cyp) / ry);
|
|
14956
|
+
if (!sweepFlag && deltaTheta > 0) {
|
|
14957
|
+
deltaTheta -= 2 * Math.PI;
|
|
14958
|
+
} else if (sweepFlag && deltaTheta < 0) {
|
|
14959
|
+
deltaTheta += 2 * Math.PI;
|
|
14960
|
+
}
|
|
14961
|
+
const steps = Math.max(2, Math.round(segments * (Math.abs(deltaTheta) / (Math.PI / 2))));
|
|
14962
|
+
for (let i = 1; i <= steps; i++) {
|
|
14963
|
+
const theta = theta1 + deltaTheta * i / steps;
|
|
14964
|
+
const x = cx + rx * Math.cos(theta) * cosPhi - ry * Math.sin(theta) * sinPhi;
|
|
14965
|
+
const y = cy + rx * Math.cos(theta) * sinPhi + ry * Math.sin(theta) * cosPhi;
|
|
14966
|
+
out.push({ x, y });
|
|
14967
|
+
}
|
|
14968
|
+
}
|
|
14969
|
+
|
|
14970
|
+
// src/geometry/svg-path-flatten.ts
|
|
14971
|
+
var COMMAND_RE = /[MLCQZAHVSmlcqzahvs][^MLCQZAHVSmlcqzahvs]*/gu;
|
|
14972
|
+
var NUMBER_RE = /-?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/gu;
|
|
14973
|
+
function tokenize(d) {
|
|
14974
|
+
const tokens = [];
|
|
14975
|
+
const matches = d.match(COMMAND_RE);
|
|
14976
|
+
if (!matches) {
|
|
14977
|
+
return tokens;
|
|
14978
|
+
}
|
|
14979
|
+
for (const raw of matches) {
|
|
14980
|
+
const type = raw.charAt(0);
|
|
14981
|
+
const nums = raw.slice(1).match(NUMBER_RE);
|
|
14982
|
+
tokens.push({ type, values: nums ? nums.map((n) => Number.parseFloat(n)) : [] });
|
|
14983
|
+
}
|
|
14984
|
+
return tokens;
|
|
14985
|
+
}
|
|
14986
|
+
function flattenSvgPath(d, curveSegments = 16) {
|
|
14987
|
+
if (!Number.isFinite(curveSegments) || curveSegments < 1) curveSegments = 16;
|
|
14988
|
+
curveSegments = Math.min(4096, Math.floor(curveSegments));
|
|
14989
|
+
const tokens = tokenize(d);
|
|
14990
|
+
const loops = [];
|
|
14991
|
+
let current = [];
|
|
14992
|
+
let cursor = { x: 0, y: 0 };
|
|
14993
|
+
let subpathStart = { x: 0, y: 0 };
|
|
14994
|
+
let lastControl;
|
|
14995
|
+
let lastCommand = "";
|
|
14996
|
+
const closeLoop = () => {
|
|
14997
|
+
if (current.length > 0) {
|
|
14998
|
+
loops.push(current);
|
|
14999
|
+
}
|
|
15000
|
+
current = [];
|
|
15001
|
+
};
|
|
15002
|
+
for (const token of tokens) {
|
|
15003
|
+
const type = token.type;
|
|
15004
|
+
const upper = type.toUpperCase();
|
|
15005
|
+
const relative = type !== upper;
|
|
15006
|
+
const v = token.values;
|
|
15007
|
+
if (v.some((value) => !Number.isFinite(value)) || upper === "M" && v.length < 2) continue;
|
|
15008
|
+
if (upper === "M") {
|
|
15009
|
+
closeLoop();
|
|
15010
|
+
const x = relative ? cursor.x + at(v, 0) : at(v, 0);
|
|
15011
|
+
const y = relative ? cursor.y + at(v, 1) : at(v, 1);
|
|
15012
|
+
cursor = { x, y };
|
|
15013
|
+
subpathStart = cursor;
|
|
15014
|
+
current.push(cursor);
|
|
15015
|
+
for (let i = 2; i + 1 < v.length; i += 2) {
|
|
15016
|
+
const lx = relative ? cursor.x + at(v, i) : at(v, i);
|
|
15017
|
+
const ly = relative ? cursor.y + at(v, i + 1) : at(v, i + 1);
|
|
15018
|
+
cursor = { x: lx, y: ly };
|
|
15019
|
+
current.push(cursor);
|
|
15020
|
+
}
|
|
15021
|
+
} else if (upper === "L") {
|
|
15022
|
+
for (let i = 0; i + 1 < v.length; i += 2) {
|
|
15023
|
+
const x = relative ? cursor.x + at(v, i) : at(v, i);
|
|
15024
|
+
const y = relative ? cursor.y + at(v, i + 1) : at(v, i + 1);
|
|
15025
|
+
cursor = { x, y };
|
|
15026
|
+
current.push(cursor);
|
|
15027
|
+
}
|
|
15028
|
+
} else if (upper === "H") {
|
|
15029
|
+
for (const value of v) {
|
|
15030
|
+
const x = relative ? cursor.x + value : value;
|
|
15031
|
+
cursor = { x, y: cursor.y };
|
|
15032
|
+
current.push(cursor);
|
|
15033
|
+
}
|
|
15034
|
+
} else if (upper === "V") {
|
|
15035
|
+
for (const value of v) {
|
|
15036
|
+
const y = relative ? cursor.y + value : value;
|
|
15037
|
+
cursor = { x: cursor.x, y };
|
|
15038
|
+
current.push(cursor);
|
|
15039
|
+
}
|
|
15040
|
+
} else if (upper === "C") {
|
|
15041
|
+
for (let i = 0; i + 5 < v.length; i += 6) {
|
|
15042
|
+
const p1 = relative ? { x: cursor.x + at(v, i), y: cursor.y + at(v, i + 1) } : { x: at(v, i), y: at(v, i + 1) };
|
|
15043
|
+
const p2 = relative ? { x: cursor.x + at(v, i + 2), y: cursor.y + at(v, i + 3) } : { x: at(v, i + 2), y: at(v, i + 3) };
|
|
15044
|
+
const p3 = relative ? { x: cursor.x + at(v, i + 4), y: cursor.y + at(v, i + 5) } : { x: at(v, i + 4), y: at(v, i + 5) };
|
|
15045
|
+
sampleCubic(cursor, p1, p2, p3, curveSegments, current);
|
|
15046
|
+
cursor = p3;
|
|
15047
|
+
lastControl = p2;
|
|
15048
|
+
}
|
|
15049
|
+
} else if (upper === "S") {
|
|
15050
|
+
for (let i = 0; i + 3 < v.length; i += 4) {
|
|
15051
|
+
const p1 = lastCommand === "C" || lastCommand === "S" ? {
|
|
15052
|
+
x: 2 * cursor.x - (lastControl?.x ?? cursor.x),
|
|
15053
|
+
y: 2 * cursor.y - (lastControl?.y ?? cursor.y)
|
|
15054
|
+
} : cursor;
|
|
15055
|
+
const p2 = relative ? { x: cursor.x + at(v, i), y: cursor.y + at(v, i + 1) } : { x: at(v, i), y: at(v, i + 1) };
|
|
15056
|
+
const p3 = relative ? { x: cursor.x + at(v, i + 2), y: cursor.y + at(v, i + 3) } : { x: at(v, i + 2), y: at(v, i + 3) };
|
|
15057
|
+
sampleCubic(cursor, p1, p2, p3, curveSegments, current);
|
|
15058
|
+
cursor = p3;
|
|
15059
|
+
lastControl = p2;
|
|
15060
|
+
}
|
|
15061
|
+
} else if (upper === "Q") {
|
|
15062
|
+
for (let i = 0; i + 3 < v.length; i += 4) {
|
|
15063
|
+
const p1 = relative ? { x: cursor.x + at(v, i), y: cursor.y + at(v, i + 1) } : { x: at(v, i), y: at(v, i + 1) };
|
|
15064
|
+
const p2 = relative ? { x: cursor.x + at(v, i + 2), y: cursor.y + at(v, i + 3) } : { x: at(v, i + 2), y: at(v, i + 3) };
|
|
15065
|
+
sampleQuadratic(cursor, p1, p2, curveSegments, current);
|
|
15066
|
+
cursor = p2;
|
|
15067
|
+
lastControl = p1;
|
|
15068
|
+
}
|
|
15069
|
+
} else if (upper === "A") {
|
|
15070
|
+
for (let i = 0; i + 6 < v.length; i += 7) {
|
|
15071
|
+
const rx = at(v, i);
|
|
15072
|
+
const ry = at(v, i + 1);
|
|
15073
|
+
const rot = at(v, i + 2);
|
|
15074
|
+
const largeArc = at(v, i + 3) !== 0;
|
|
15075
|
+
const sweep = at(v, i + 4) !== 0;
|
|
15076
|
+
const end = relative ? { x: cursor.x + at(v, i + 5), y: cursor.y + at(v, i + 6) } : { x: at(v, i + 5), y: at(v, i + 6) };
|
|
15077
|
+
sampleArc(cursor, rx, ry, rot, largeArc, sweep, end, curveSegments, current);
|
|
15078
|
+
cursor = end;
|
|
15079
|
+
}
|
|
15080
|
+
} else if (upper === "Z") {
|
|
15081
|
+
cursor = subpathStart;
|
|
15082
|
+
current.push(cursor);
|
|
15083
|
+
}
|
|
15084
|
+
lastCommand = upper;
|
|
15085
|
+
}
|
|
15086
|
+
closeLoop();
|
|
15087
|
+
return loops;
|
|
15088
|
+
}
|
|
15089
|
+
|
|
14899
15090
|
exports.ACTION_BUTTON_CONNECTION_SITES = ACTION_BUTTON_CONNECTION_SITES;
|
|
14900
15091
|
exports.ACTION_BUTTON_PRESET_DEFINITIONS = ACTION_BUTTON_PRESET_DEFINITIONS;
|
|
14901
15092
|
exports.ACTION_BUTTON_TEXT_RECTS = ACTION_BUTTON_TEXT_RECTS;
|
|
@@ -14980,6 +15171,7 @@ exports.ensureCW = ensureCW;
|
|
|
14980
15171
|
exports.evaluateFormula = evaluateFormula;
|
|
14981
15172
|
exports.evaluateGuides = evaluateGuides;
|
|
14982
15173
|
exports.findAllIntersections = findAllIntersections;
|
|
15174
|
+
exports.flattenSvgPath = flattenSvgPath;
|
|
14983
15175
|
exports.fmtNum = fmtNum;
|
|
14984
15176
|
exports.fragmentShapes = fragmentShapes;
|
|
14985
15177
|
exports.gd = gd;
|
package/dist/geometry/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/geometry/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AACpD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,wCAAwC,CAAC;AACvD,cAAc,oCAAoC,CAAC;AACnD,cAAc,kDAAkD,CAAC;AACjE,cAAc,wDAAwD,CAAC;AACvE,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,uCAAuC,CAAC;AACtD,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8CAA8C,CAAC;AAC7D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,sCAAsC,CAAC;AACrD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,mDAAmD,CAAC;AAClE,cAAc,wDAAwD,CAAC;AACvE,cAAc,mDAAmD,CAAC;AAClE,cAAc,yCAAyC,CAAC;AACxD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,oCAAoC,CAAC;AACnD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,uDAAuD,CAAC;AACtE,cAAc,qCAAqC,CAAC;AACpD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sCAAsC,CAAC;AACrD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/geometry/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC;AAChD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AACpD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,wCAAwC,CAAC;AACvD,cAAc,oCAAoC,CAAC;AACnD,cAAc,kDAAkD,CAAC;AACjE,cAAc,wDAAwD,CAAC;AACvE,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,uCAAuC,CAAC;AACtD,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8CAA8C,CAAC;AAC7D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,sCAAsC,CAAC;AACrD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,mDAAmD,CAAC;AAClE,cAAc,wDAAwD,CAAC;AACvE,cAAc,mDAAmD,CAAC;AAClE,cAAc,yCAAyC,CAAC;AACxD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,oCAAoC,CAAC;AACnD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,uDAAuD,CAAC;AACtE,cAAc,qCAAqC,CAAC;AACpD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sCAAsC,CAAC;AACrD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,cAAc,uBAAuB,CAAC"}
|
package/dist/geometry/index.mjs
CHANGED
|
@@ -14894,4 +14894,195 @@ function subtractSvgPaths(path1, path2) {
|
|
|
14894
14894
|
return subtractShapes(path1, path2);
|
|
14895
14895
|
}
|
|
14896
14896
|
|
|
14897
|
-
|
|
14897
|
+
// src/geometry/svg-path-curves.ts
|
|
14898
|
+
function sampleCubic(p0, p1, p2, p3, segments, out) {
|
|
14899
|
+
for (let i = 1; i <= segments; i++) {
|
|
14900
|
+
const t = i / segments;
|
|
14901
|
+
const mt = 1 - t;
|
|
14902
|
+
const x = mt * mt * mt * p0.x + 3 * mt * mt * t * p1.x + 3 * mt * t * t * p2.x + t * t * t * p3.x;
|
|
14903
|
+
const y = mt * mt * mt * p0.y + 3 * mt * mt * t * p1.y + 3 * mt * t * t * p2.y + t * t * t * p3.y;
|
|
14904
|
+
out.push({ x, y });
|
|
14905
|
+
}
|
|
14906
|
+
}
|
|
14907
|
+
function sampleQuadratic(p0, p1, p2, segments, out) {
|
|
14908
|
+
for (let i = 1; i <= segments; i++) {
|
|
14909
|
+
const t = i / segments;
|
|
14910
|
+
const mt = 1 - t;
|
|
14911
|
+
const x = mt * mt * p0.x + 2 * mt * t * p1.x + t * t * p2.x;
|
|
14912
|
+
const y = mt * mt * p0.y + 2 * mt * t * p1.y + t * t * p2.y;
|
|
14913
|
+
out.push({ x, y });
|
|
14914
|
+
}
|
|
14915
|
+
}
|
|
14916
|
+
function sampleArc(start, rxIn, ryIn, xAxisRotationDeg, largeArcFlag, sweepFlag, end, segments, out) {
|
|
14917
|
+
if (rxIn === 0 || ryIn === 0 || start.x === end.x && start.y === end.y) {
|
|
14918
|
+
out.push(end);
|
|
14919
|
+
return;
|
|
14920
|
+
}
|
|
14921
|
+
const phi = xAxisRotationDeg * Math.PI / 180;
|
|
14922
|
+
const cosPhi = Math.cos(phi);
|
|
14923
|
+
const sinPhi = Math.sin(phi);
|
|
14924
|
+
let rx = Math.abs(rxIn);
|
|
14925
|
+
let ry = Math.abs(ryIn);
|
|
14926
|
+
const dx2 = (start.x - end.x) / 2;
|
|
14927
|
+
const dy2 = (start.y - end.y) / 2;
|
|
14928
|
+
const x1p = cosPhi * dx2 + sinPhi * dy2;
|
|
14929
|
+
const y1p = -sinPhi * dx2 + cosPhi * dy2;
|
|
14930
|
+
const lambda = x1p * x1p / (rx * rx) + y1p * y1p / (ry * ry);
|
|
14931
|
+
if (lambda > 1) {
|
|
14932
|
+
const scale = Math.sqrt(lambda);
|
|
14933
|
+
rx *= scale;
|
|
14934
|
+
ry *= scale;
|
|
14935
|
+
}
|
|
14936
|
+
const sign = largeArcFlag !== sweepFlag ? 1 : -1;
|
|
14937
|
+
const num = rx * rx * ry * ry - rx * rx * y1p * y1p - ry * ry * x1p * x1p;
|
|
14938
|
+
const den = rx * rx * y1p * y1p + ry * ry * x1p * x1p;
|
|
14939
|
+
const coef = sign * Math.sqrt(Math.max(0, num / den));
|
|
14940
|
+
const cxp = coef * (rx * y1p) / ry;
|
|
14941
|
+
const cyp = coef * -(ry * x1p) / rx;
|
|
14942
|
+
const cx = cosPhi * cxp - sinPhi * cyp + (start.x + end.x) / 2;
|
|
14943
|
+
const cy = sinPhi * cxp + cosPhi * cyp + (start.y + end.y) / 2;
|
|
14944
|
+
const angle = (ux, uy, vx, vy) => {
|
|
14945
|
+
const sign2 = ux * vy - uy * vx < 0 ? -1 : 1;
|
|
14946
|
+
const dot = Math.max(
|
|
14947
|
+
-1,
|
|
14948
|
+
Math.min(1, (ux * vx + uy * vy) / (Math.hypot(ux, uy) * Math.hypot(vx, vy)))
|
|
14949
|
+
);
|
|
14950
|
+
return sign2 * Math.acos(dot);
|
|
14951
|
+
};
|
|
14952
|
+
const theta1 = angle(1, 0, (x1p - cxp) / rx, (y1p - cyp) / ry);
|
|
14953
|
+
let deltaTheta = angle((x1p - cxp) / rx, (y1p - cyp) / ry, (-x1p - cxp) / rx, (-y1p - cyp) / ry);
|
|
14954
|
+
if (!sweepFlag && deltaTheta > 0) {
|
|
14955
|
+
deltaTheta -= 2 * Math.PI;
|
|
14956
|
+
} else if (sweepFlag && deltaTheta < 0) {
|
|
14957
|
+
deltaTheta += 2 * Math.PI;
|
|
14958
|
+
}
|
|
14959
|
+
const steps = Math.max(2, Math.round(segments * (Math.abs(deltaTheta) / (Math.PI / 2))));
|
|
14960
|
+
for (let i = 1; i <= steps; i++) {
|
|
14961
|
+
const theta = theta1 + deltaTheta * i / steps;
|
|
14962
|
+
const x = cx + rx * Math.cos(theta) * cosPhi - ry * Math.sin(theta) * sinPhi;
|
|
14963
|
+
const y = cy + rx * Math.cos(theta) * sinPhi + ry * Math.sin(theta) * cosPhi;
|
|
14964
|
+
out.push({ x, y });
|
|
14965
|
+
}
|
|
14966
|
+
}
|
|
14967
|
+
|
|
14968
|
+
// src/geometry/svg-path-flatten.ts
|
|
14969
|
+
var COMMAND_RE = /[MLCQZAHVSmlcqzahvs][^MLCQZAHVSmlcqzahvs]*/gu;
|
|
14970
|
+
var NUMBER_RE = /-?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/gu;
|
|
14971
|
+
function tokenize(d) {
|
|
14972
|
+
const tokens = [];
|
|
14973
|
+
const matches = d.match(COMMAND_RE);
|
|
14974
|
+
if (!matches) {
|
|
14975
|
+
return tokens;
|
|
14976
|
+
}
|
|
14977
|
+
for (const raw of matches) {
|
|
14978
|
+
const type = raw.charAt(0);
|
|
14979
|
+
const nums = raw.slice(1).match(NUMBER_RE);
|
|
14980
|
+
tokens.push({ type, values: nums ? nums.map((n) => Number.parseFloat(n)) : [] });
|
|
14981
|
+
}
|
|
14982
|
+
return tokens;
|
|
14983
|
+
}
|
|
14984
|
+
function flattenSvgPath(d, curveSegments = 16) {
|
|
14985
|
+
if (!Number.isFinite(curveSegments) || curveSegments < 1) curveSegments = 16;
|
|
14986
|
+
curveSegments = Math.min(4096, Math.floor(curveSegments));
|
|
14987
|
+
const tokens = tokenize(d);
|
|
14988
|
+
const loops = [];
|
|
14989
|
+
let current = [];
|
|
14990
|
+
let cursor = { x: 0, y: 0 };
|
|
14991
|
+
let subpathStart = { x: 0, y: 0 };
|
|
14992
|
+
let lastControl;
|
|
14993
|
+
let lastCommand = "";
|
|
14994
|
+
const closeLoop = () => {
|
|
14995
|
+
if (current.length > 0) {
|
|
14996
|
+
loops.push(current);
|
|
14997
|
+
}
|
|
14998
|
+
current = [];
|
|
14999
|
+
};
|
|
15000
|
+
for (const token of tokens) {
|
|
15001
|
+
const type = token.type;
|
|
15002
|
+
const upper = type.toUpperCase();
|
|
15003
|
+
const relative = type !== upper;
|
|
15004
|
+
const v = token.values;
|
|
15005
|
+
if (v.some((value) => !Number.isFinite(value)) || upper === "M" && v.length < 2) continue;
|
|
15006
|
+
if (upper === "M") {
|
|
15007
|
+
closeLoop();
|
|
15008
|
+
const x = relative ? cursor.x + at(v, 0) : at(v, 0);
|
|
15009
|
+
const y = relative ? cursor.y + at(v, 1) : at(v, 1);
|
|
15010
|
+
cursor = { x, y };
|
|
15011
|
+
subpathStart = cursor;
|
|
15012
|
+
current.push(cursor);
|
|
15013
|
+
for (let i = 2; i + 1 < v.length; i += 2) {
|
|
15014
|
+
const lx = relative ? cursor.x + at(v, i) : at(v, i);
|
|
15015
|
+
const ly = relative ? cursor.y + at(v, i + 1) : at(v, i + 1);
|
|
15016
|
+
cursor = { x: lx, y: ly };
|
|
15017
|
+
current.push(cursor);
|
|
15018
|
+
}
|
|
15019
|
+
} else if (upper === "L") {
|
|
15020
|
+
for (let i = 0; i + 1 < v.length; i += 2) {
|
|
15021
|
+
const x = relative ? cursor.x + at(v, i) : at(v, i);
|
|
15022
|
+
const y = relative ? cursor.y + at(v, i + 1) : at(v, i + 1);
|
|
15023
|
+
cursor = { x, y };
|
|
15024
|
+
current.push(cursor);
|
|
15025
|
+
}
|
|
15026
|
+
} else if (upper === "H") {
|
|
15027
|
+
for (const value of v) {
|
|
15028
|
+
const x = relative ? cursor.x + value : value;
|
|
15029
|
+
cursor = { x, y: cursor.y };
|
|
15030
|
+
current.push(cursor);
|
|
15031
|
+
}
|
|
15032
|
+
} else if (upper === "V") {
|
|
15033
|
+
for (const value of v) {
|
|
15034
|
+
const y = relative ? cursor.y + value : value;
|
|
15035
|
+
cursor = { x: cursor.x, y };
|
|
15036
|
+
current.push(cursor);
|
|
15037
|
+
}
|
|
15038
|
+
} else if (upper === "C") {
|
|
15039
|
+
for (let i = 0; i + 5 < v.length; i += 6) {
|
|
15040
|
+
const p1 = relative ? { x: cursor.x + at(v, i), y: cursor.y + at(v, i + 1) } : { x: at(v, i), y: at(v, i + 1) };
|
|
15041
|
+
const p2 = relative ? { x: cursor.x + at(v, i + 2), y: cursor.y + at(v, i + 3) } : { x: at(v, i + 2), y: at(v, i + 3) };
|
|
15042
|
+
const p3 = relative ? { x: cursor.x + at(v, i + 4), y: cursor.y + at(v, i + 5) } : { x: at(v, i + 4), y: at(v, i + 5) };
|
|
15043
|
+
sampleCubic(cursor, p1, p2, p3, curveSegments, current);
|
|
15044
|
+
cursor = p3;
|
|
15045
|
+
lastControl = p2;
|
|
15046
|
+
}
|
|
15047
|
+
} else if (upper === "S") {
|
|
15048
|
+
for (let i = 0; i + 3 < v.length; i += 4) {
|
|
15049
|
+
const p1 = lastCommand === "C" || lastCommand === "S" ? {
|
|
15050
|
+
x: 2 * cursor.x - (lastControl?.x ?? cursor.x),
|
|
15051
|
+
y: 2 * cursor.y - (lastControl?.y ?? cursor.y)
|
|
15052
|
+
} : cursor;
|
|
15053
|
+
const p2 = relative ? { x: cursor.x + at(v, i), y: cursor.y + at(v, i + 1) } : { x: at(v, i), y: at(v, i + 1) };
|
|
15054
|
+
const p3 = relative ? { x: cursor.x + at(v, i + 2), y: cursor.y + at(v, i + 3) } : { x: at(v, i + 2), y: at(v, i + 3) };
|
|
15055
|
+
sampleCubic(cursor, p1, p2, p3, curveSegments, current);
|
|
15056
|
+
cursor = p3;
|
|
15057
|
+
lastControl = p2;
|
|
15058
|
+
}
|
|
15059
|
+
} else if (upper === "Q") {
|
|
15060
|
+
for (let i = 0; i + 3 < v.length; i += 4) {
|
|
15061
|
+
const p1 = relative ? { x: cursor.x + at(v, i), y: cursor.y + at(v, i + 1) } : { x: at(v, i), y: at(v, i + 1) };
|
|
15062
|
+
const p2 = relative ? { x: cursor.x + at(v, i + 2), y: cursor.y + at(v, i + 3) } : { x: at(v, i + 2), y: at(v, i + 3) };
|
|
15063
|
+
sampleQuadratic(cursor, p1, p2, curveSegments, current);
|
|
15064
|
+
cursor = p2;
|
|
15065
|
+
lastControl = p1;
|
|
15066
|
+
}
|
|
15067
|
+
} else if (upper === "A") {
|
|
15068
|
+
for (let i = 0; i + 6 < v.length; i += 7) {
|
|
15069
|
+
const rx = at(v, i);
|
|
15070
|
+
const ry = at(v, i + 1);
|
|
15071
|
+
const rot = at(v, i + 2);
|
|
15072
|
+
const largeArc = at(v, i + 3) !== 0;
|
|
15073
|
+
const sweep = at(v, i + 4) !== 0;
|
|
15074
|
+
const end = relative ? { x: cursor.x + at(v, i + 5), y: cursor.y + at(v, i + 6) } : { x: at(v, i + 5), y: at(v, i + 6) };
|
|
15075
|
+
sampleArc(cursor, rx, ry, rot, largeArc, sweep, end, curveSegments, current);
|
|
15076
|
+
cursor = end;
|
|
15077
|
+
}
|
|
15078
|
+
} else if (upper === "Z") {
|
|
15079
|
+
cursor = subpathStart;
|
|
15080
|
+
current.push(cursor);
|
|
15081
|
+
}
|
|
15082
|
+
lastCommand = upper;
|
|
15083
|
+
}
|
|
15084
|
+
closeLoop();
|
|
15085
|
+
return loops;
|
|
15086
|
+
}
|
|
15087
|
+
|
|
15088
|
+
export { ACTION_BUTTON_CONNECTION_SITES, ACTION_BUTTON_PRESET_DEFINITIONS, ACTION_BUTTON_TEXT_RECTS, ANGLE_SCALE, ARROW_CALLOUT_CONNECTION_SITES, ARROW_CALLOUT_PRESET_DEFINITIONS, ARROW_CONNECTION_SITES, ARROW_PRESET_DEFINITIONS, ARROW_TEXT_RECTS, BASIC_SHAPE_CONNECTION_SITES_A, BASIC_SHAPE_CONNECTION_SITES_B, BRACE_CONNECTION_SITES, BRACE_TEXT_RECTS, CALLOUT_CONNECTION_SITES, CALLOUT_TEXT_RECTS, CARDINAL_SITES, CHART_MARK_PRESET_DEFINITIONS, CIRCULAR_ARROW_CONNECTION_SITES, CIRCULAR_ARROW_TEXT_RECTS, CLIP_PATHS_CORE, CLIP_PATHS_EXTENDED, CLOUD_CALLOUT_PRESET_DEFINITIONS, CLOUD_CALLOUT_TAIL_COUNT, CLOUD_LOBE_COUNT, COM_AVLST_GROUND_TRUTH, CONNECTORS_BRACKETS_PRESET_DEFINITIONS, CURVED_ARROWS_CONNECTORS_PRESET_DEFINITIONS, CURVED_ARROW_CONNECTION_SITES, EPSILON, EXACT_CURVED_ARROW_PRESET_DEFINITIONS, EXTENDED_SHAPE_DEFINITIONS, FLOWCHART_CONNECTION_SITES, FLOWCHART_PRESET_DEFINITIONS, FLOWCHART_TEXT_RECTS, GEAR9_CONNECTION_SITES, LEFT_CIRCULAR_ARROW_CONNECTION_SITES, LEFT_RIGHT_CIRCULAR_ARROW_CONNECTION_SITES, MATH_SYMBOL_CONNECTION_SITES, MISC_ARROW_CONNECTION_SITES, MISC_PRESET_DEFINITIONS, MISC_SHAPE_CONNECTION_SITES, MISC_TEXT_RECTS_A, MISC_TEXT_RECTS_B, POLYGON_CONNECTION_SITES, POLYGON_TEXT_RECTS, PRESET_GEOMETRY_ALIASES, PRESET_SHAPE_CATEGORY_LABELS, PRESET_SHAPE_CLIP_PATHS, PRESET_SHAPE_DEFINITIONS, PRESET_SHAPE_GEOMETRY_TABLE, PRIMARY_SHAPE_DEFINITIONS, QUAD_CONNECTION_SITES, QUAD_TEXT_RECTS, RECTS_SNIPS_PRESET_DEFINITIONS, RECT_VARIANT_CONNECTION_SITES, REFINED_ARROW_PRESET_DEFINITIONS, RIBBON_CONNECTION_SITES, RIBBON_TEXT_RECTS, SCROLLS_ACCENT_CALLOUTS_PRESET_DEFINITIONS, STAR_CONNECTION_SITES, STAR_TEXT_RECTS, ST_SHAPE_TYPE_VALUES, TABS_DECORATIONS_PRESET_DEFINITIONS, TAB_CONNECTION_SITES, TAB_TEXT_RECTS, _internalForTests, angleToRadians, at, buildCalloutLeaderLineSvgPath, clipPolygons, combineShapes, computeUnionWalk, convexHull, createBuiltinVariables, cross2, cxn, dedupPoly, elbowCurveSegments, elbowWaypoints, ensureCCW, ensureCW, evaluateFormula, evaluateGuides, findAllIntersections, flattenSvgPath, fmtNum, fragmentShapes, gd, gear6, gear9, getAdjustmentAwareClipPath, getCalloutLeaderLineGeometry, getCalloutTier, getCalloutViewBoxBounds, getCloudCalloutClipPath, getCloudClipPath, getPresetConnectionSites, getPresetShapeClipPath, getPresetTextRect, insertIntersections, intersectPolygons, intersectShapes, intersectSvgPaths, isCalloutShape, isConvex, isHorizontalPrimaryAxis, isStShapeType, lineIntersection, lookupPresetConnectionSites, lookupPresetTextRectOverride, mergeOverlappingPolygons, mergeShapes, normalizeStShapeType, parseAdjustmentValues, parseFormula, parseGuideDefinitions, pointInPolygon, pointInTriangle, polygonArea, polygonsToSvgPath, resolveCoordinate, resolveOperand, segmentIntersection, signedArea, subtractPolygons, subtractShapes, subtractSvgPaths, sutherlandHodgman, svgPathToPolygons, triangulate, unionPolygons, unionShapes, unionSvgPaths, vec2Eq };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Point2 } from './svg-path-types.js';
|
|
2
|
+
/** Sample a cubic Bezier at `segments` steps (excluding the start point). */
|
|
3
|
+
export declare function sampleCubic(p0: Point2, p1: Point2, p2: Point2, p3: Point2, segments: number, out: Point2[]): void;
|
|
4
|
+
/** Sample a quadratic Bezier at `segments` steps (excluding the start point). */
|
|
5
|
+
export declare function sampleQuadratic(p0: Point2, p1: Point2, p2: Point2, segments: number, out: Point2[]): void;
|
|
6
|
+
/**
|
|
7
|
+
* Sample an SVG elliptical arc (endpoint parameterization, SVG spec F.6) into
|
|
8
|
+
* points, appended to `out`. Excludes the start point.
|
|
9
|
+
*/
|
|
10
|
+
export declare function sampleArc(start: Point2, rxIn: number, ryIn: number, xAxisRotationDeg: number, largeArcFlag: boolean, sweepFlag: boolean, end: Point2, segments: number, out: Point2[]): void;
|
|
11
|
+
//# sourceMappingURL=svg-path-curves.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svg-path-curves.d.ts","sourceRoot":"","sources":["../../src/geometry/svg-path-curves.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,6EAA6E;AAC7E,wBAAgB,WAAW,CAC1B,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EAAE,GACX,IAAI,CAUN;AAED,iFAAiF;AACjF,wBAAgB,eAAe,CAC9B,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EAAE,GACX,IAAI,CAQN;AAED;;;GAGG;AACH,wBAAgB,SAAS,CACxB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,MAAM,EACxB,YAAY,EAAE,OAAO,EACrB,SAAS,EAAE,OAAO,EAClB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,EAAE,GACX,IAAI,CAyDN"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flatten an SVG path `d` string into closed polygon loops (2D points), for
|
|
3
|
+
* consumers that need a concrete outline rather than curve primitives (the
|
|
4
|
+
* three.js SmartArt renderer extrudes/fills a shape's outline as a flat
|
|
5
|
+
* polygon; sampling curves here keeps that consumer three.js-agnostic and
|
|
6
|
+
* pure/testable).
|
|
7
|
+
*
|
|
8
|
+
* Supports M/L/H/V/C/Q/S/A/Z, both absolute and relative variants, and
|
|
9
|
+
* multiple subpaths (each additional `M` starts a new loop; the first loop is
|
|
10
|
+
* the outer boundary, subsequent loops are holes - the same convention as
|
|
11
|
+
* `THREE.Shape`/`THREE.Path`.holes).
|
|
12
|
+
*
|
|
13
|
+
* @module render/svg-path-flatten
|
|
14
|
+
*/
|
|
15
|
+
import type { Point2 } from './svg-path-types.js';
|
|
16
|
+
export type { Point2 } from './svg-path-types.js';
|
|
17
|
+
/**
|
|
18
|
+
* Flatten an SVG path `d` string into one or more closed polygon loops.
|
|
19
|
+
*
|
|
20
|
+
* @param d - The path `d` attribute string (absolute or relative commands).
|
|
21
|
+
* @param curveSegments - Sample count per full curve (arcs scale down for
|
|
22
|
+
* short sweeps). Default 16, generous enough for shapes rendered at
|
|
23
|
+
* on-screen SmartArt sizes.
|
|
24
|
+
*/
|
|
25
|
+
export declare function flattenSvgPath(d: string, curveSegments?: number): Point2[][];
|
|
26
|
+
//# sourceMappingURL=svg-path-flatten.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svg-path-flatten.d.ts","sourceRoot":"","sources":["../../src/geometry/svg-path-flatten.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,YAAY,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AA0BlD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,SAAK,GAAG,MAAM,EAAE,EAAE,CA8HxE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svg-path-types.d.ts","sourceRoot":"","sources":["../../src/geometry/svg-path-types.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,MAAM,WAAW,MAAM;IACtB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACV"}
|