@office-open/core 0.11.0 → 0.12.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/chart/index.d.mts +2 -2
- package/dist/chart/index.mjs +1 -1
- package/dist/{chart-Kf_utasF.mjs → chart-DED4tXC9.mjs} +828 -283
- package/dist/chart-DED4tXC9.mjs.map +1 -0
- package/dist/data-type-CZMKVaaT.d.mts.map +1 -1
- package/dist/descriptor/index.d.mts +1 -1
- package/dist/descriptor/index.mjs +1 -1
- package/dist/{descriptor-BX8xW8na.mjs → descriptor-BqaNZrrZ.mjs} +38 -10
- package/dist/{descriptor-BX8xW8na.mjs.map → descriptor-BqaNZrrZ.mjs.map} +1 -1
- package/dist/drawing/index.d.mts +2 -2
- package/dist/drawing/index.mjs +2 -2
- package/dist/{drawing-FBzd2I0m.mjs → drawing-BCAyrCCw.mjs} +3056 -3130
- package/dist/drawing-BCAyrCCw.mjs.map +1 -0
- package/dist/{generators-CElPsAhd.mjs → ext-uri-BHBcIrW7.mjs} +599 -343
- package/dist/ext-uri-BHBcIrW7.mjs.map +1 -0
- package/dist/index-BAxlDUQ1.d.mts +590 -0
- package/dist/index-BAxlDUQ1.d.mts.map +1 -0
- package/dist/{index-DxwLMnBF.d.mts → index-BP541uS-.d.mts} +136 -31
- package/dist/index-BP541uS-.d.mts.map +1 -0
- package/dist/{index-CLX7gU9J.d.mts → index-BQLIofaF.d.mts} +3 -2
- package/dist/index-BQLIofaF.d.mts.map +1 -0
- package/dist/{index-k8WKLXnA.d.mts → index-CaNwM5_e.d.mts} +19 -20
- package/dist/index-CaNwM5_e.d.mts.map +1 -0
- package/dist/{index-CnjCK-lF.d.mts → index-DPkf_CtG.d.mts} +566 -597
- package/dist/index-DPkf_CtG.d.mts.map +1 -0
- package/dist/{index-BsTUn4K1.d.mts → index-DcukVskh.d.mts} +9 -6
- package/dist/index-DcukVskh.d.mts.map +1 -0
- package/dist/{index-Cgz88FU0.d.mts → index-Di6XPdGl.d.mts} +26 -12
- package/dist/index-Di6XPdGl.d.mts.map +1 -0
- package/dist/{index-C0ClOhmZ.d.mts → index-L6AXewfV.d.mts} +11 -8
- package/dist/index-L6AXewfV.d.mts.map +1 -0
- package/dist/index.d.mts +140 -29
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +849 -87
- package/dist/index.mjs.map +1 -1
- package/dist/{output-D_G_JR_8.d.mts → output-yyxdkG0C.d.mts} +2 -3
- package/dist/output-yyxdkG0C.d.mts.map +1 -0
- package/dist/patch/index.d.mts +2 -2
- package/dist/patch/index.mjs +2 -2
- package/dist/{patch-3KLx2yEP.mjs → patch-AkQY17CD.mjs} +71 -26
- package/dist/patch-AkQY17CD.mjs.map +1 -0
- package/dist/smartart/index.d.mts +2 -2
- package/dist/smartart/index.mjs +1 -1
- package/dist/{smartart-BxnkROOp.mjs → smartart-n1kYJ6Jg.mjs} +27 -26
- package/dist/smartart-n1kYJ6Jg.mjs.map +1 -0
- package/dist/{style-matrix-DAP6XrLv.mjs → style-matrix-B6jhPAT3.mjs} +4 -4
- package/dist/style-matrix-B6jhPAT3.mjs.map +1 -0
- package/dist/theme/index.d.mts +4 -4
- package/dist/theme/index.mjs +3 -2
- package/dist/{theme-OAuRcA9_.mjs → theme-BKnXRmvn.mjs} +37 -71
- package/dist/theme-BKnXRmvn.mjs.map +1 -0
- package/dist/{theme-options-BbWccl85.d.mts → theme-options-kO89NUEX.d.mts} +17 -17
- package/dist/theme-options-kO89NUEX.d.mts.map +1 -0
- package/dist/util/index.d.mts +3 -3
- package/dist/util/index.mjs +3 -3
- package/dist/{util-C94-JKtp.mjs → util-ptE16MEk.mjs} +69 -37
- package/dist/util-ptE16MEk.mjs.map +1 -0
- package/dist/{values-aVoirbWB.d.mts → values-BECDm4zr.d.mts} +15 -31
- package/dist/values-BECDm4zr.d.mts.map +1 -0
- package/dist/vector/index.d.mts +2 -2
- package/dist/vector/index.mjs +2 -2
- package/dist/{vector-TpjW6ZSc.mjs → vector-DhLGZjP5.mjs} +104 -147
- package/dist/vector-DhLGZjP5.mjs.map +1 -0
- package/package.json +3 -3
- package/dist/chart-Kf_utasF.mjs.map +0 -1
- package/dist/drawing-FBzd2I0m.mjs.map +0 -1
- package/dist/generators-CElPsAhd.mjs.map +0 -1
- package/dist/index-BsTUn4K1.d.mts.map +0 -1
- package/dist/index-C0ClOhmZ.d.mts.map +0 -1
- package/dist/index-CLX7gU9J.d.mts.map +0 -1
- package/dist/index-Cgz88FU0.d.mts.map +0 -1
- package/dist/index-CnjCK-lF.d.mts.map +0 -1
- package/dist/index-DpPeyf5f.d.mts +0 -316
- package/dist/index-DpPeyf5f.d.mts.map +0 -1
- package/dist/index-DxwLMnBF.d.mts.map +0 -1
- package/dist/index-k8WKLXnA.d.mts.map +0 -1
- package/dist/output-D_G_JR_8.d.mts.map +0 -1
- package/dist/patch-3KLx2yEP.mjs.map +0 -1
- package/dist/smartart-BxnkROOp.mjs.map +0 -1
- package/dist/style-matrix-DAP6XrLv.mjs.map +0 -1
- package/dist/theme-OAuRcA9_.mjs.map +0 -1
- package/dist/theme-options-BbWccl85.d.mts.map +0 -1
- package/dist/util-C94-JKtp.mjs.map +0 -1
- package/dist/values-aVoirbWB.d.mts.map +0 -1
- package/dist/vector-TpjW6ZSc.mjs.map +0 -1
|
@@ -1101,6 +1101,9 @@ const STRING_FIELDS = [
|
|
|
1101
1101
|
"FmlaTxbx",
|
|
1102
1102
|
"CF"
|
|
1103
1103
|
];
|
|
1104
|
+
const TRUE_FALSE_BLANK_FIELD_SET = new Set(TRUE_FALSE_BLANK_FIELDS);
|
|
1105
|
+
const INTEGER_FIELD_SET = new Set(INTEGER_FIELDS);
|
|
1106
|
+
const STRING_FIELD_SET = new Set(STRING_FIELDS);
|
|
1104
1107
|
/** Serialize x:ClientData. */
|
|
1105
1108
|
function stringifyVmlClientData(opts) {
|
|
1106
1109
|
const children = [];
|
|
@@ -1121,17 +1124,15 @@ function stringifyVmlClientData(opts) {
|
|
|
1121
1124
|
/** Parse an x:ClientData element. */
|
|
1122
1125
|
function parseVmlClientData(el) {
|
|
1123
1126
|
const out = { objectType: String(el.attributes?.ObjectType ?? "") };
|
|
1124
|
-
const tfbFields = new Set(TRUE_FALSE_BLANK_FIELDS);
|
|
1125
|
-
const intFields = new Set(INTEGER_FIELDS);
|
|
1126
1127
|
const extras = {};
|
|
1127
1128
|
for (const child of el.elements ?? []) {
|
|
1128
1129
|
if (child.type !== "element") continue;
|
|
1129
1130
|
const local = child.name?.startsWith("x:") ? child.name.slice(2) : null;
|
|
1130
1131
|
if (local === null) continue;
|
|
1131
1132
|
const text = (child.elements ?? []).map((c) => String(c.text ?? "")).join("");
|
|
1132
|
-
if (
|
|
1133
|
-
else if (
|
|
1134
|
-
else if (
|
|
1133
|
+
if (TRUE_FALSE_BLANK_FIELD_SET.has(local)) extras[local] = parseVmlTrueFalseBlank(text);
|
|
1134
|
+
else if (INTEGER_FIELD_SET.has(local)) extras[local] = Number(text);
|
|
1135
|
+
else if (STRING_FIELD_SET.has(local)) extras[local] = text;
|
|
1135
1136
|
}
|
|
1136
1137
|
return Object.assign(out, extras);
|
|
1137
1138
|
}
|
|
@@ -1991,9 +1992,7 @@ function parseVmlStroke(el) {
|
|
|
1991
1992
|
case "o:bottom":
|
|
1992
1993
|
out.bottomStroke = parseVmlStrokeChild(child);
|
|
1993
1994
|
break;
|
|
1994
|
-
case "o:column":
|
|
1995
|
-
out.columnStroke = parseVmlStrokeChild(child);
|
|
1996
|
-
break;
|
|
1995
|
+
case "o:column": out.columnStroke = parseVmlStrokeChild(child);
|
|
1997
1996
|
}
|
|
1998
1997
|
}
|
|
1999
1998
|
return out;
|
|
@@ -2054,18 +2053,18 @@ const TEXT_PATH_STYLE_MAP = {
|
|
|
2054
2053
|
vTextSpacing: "v-text-spacing",
|
|
2055
2054
|
vTextSpacingMode: "v-text-spacing-mode"
|
|
2056
2055
|
};
|
|
2056
|
+
const KEY_TO_TEXT_PATH_FIELD = Object.fromEntries(Object.entries(TEXT_PATH_STYLE_MAP).map(([field, key]) => [key, field]));
|
|
2057
2057
|
/** Serialize a VmlTextPathStyle to its CSS-stream form. */
|
|
2058
2058
|
function stringifyVmlTextPathStyle(style) {
|
|
2059
2059
|
return Object.entries(style).map(([key, value]) => `${TEXT_PATH_STYLE_MAP[key]}:${value}`).join(";");
|
|
2060
2060
|
}
|
|
2061
2061
|
/** Parse a CSS stream into a VmlTextPathStyle; unmapped keys drop. */
|
|
2062
2062
|
function parseVmlTextPathStyle(styleStr) {
|
|
2063
|
-
const reverse = Object.fromEntries(Object.entries(TEXT_PATH_STYLE_MAP).map(([field, key]) => [key, field]));
|
|
2064
2063
|
const style = {};
|
|
2065
2064
|
for (const part of styleStr.split(";")) {
|
|
2066
2065
|
const [key, val] = part.split(":").map((s) => s.trim());
|
|
2067
2066
|
if (!key || !val) continue;
|
|
2068
|
-
const field =
|
|
2067
|
+
const field = KEY_TO_TEXT_PATH_FIELD[key];
|
|
2069
2068
|
if (field) style[field] = val;
|
|
2070
2069
|
}
|
|
2071
2070
|
return style;
|
|
@@ -2326,9 +2325,19 @@ const ALL_SHAPE_ATTRS = [
|
|
|
2326
2325
|
...VML_SHAPE_ATTRS,
|
|
2327
2326
|
...VML_OFFICE_SHAPE_ATTRS
|
|
2328
2327
|
];
|
|
2328
|
+
/** The AG_Path attribute — always emitted after the shared vocabulary. */
|
|
2329
|
+
const PATH_ATTR = [{
|
|
2330
|
+
field: "path",
|
|
2331
|
+
attr: "path",
|
|
2332
|
+
kind: "string"
|
|
2333
|
+
}];
|
|
2329
2334
|
/** Serialize the shared attribute vocabulary (style special-cased) plus extras. */
|
|
2330
2335
|
function stringifyShapeAttrs(opts, extraSpecs = []) {
|
|
2331
|
-
let attrStr = stringifyVmlAttributes(opts, [
|
|
2336
|
+
let attrStr = stringifyVmlAttributes(opts, [
|
|
2337
|
+
...ALL_SHAPE_ATTRS,
|
|
2338
|
+
...extraSpecs,
|
|
2339
|
+
...PATH_ATTR
|
|
2340
|
+
]);
|
|
2332
2341
|
const style = opts.style;
|
|
2333
2342
|
if (style !== void 0) attrStr += ` style="${escapeXml(stringifyVmlStyle(style))}"`;
|
|
2334
2343
|
return attrStr;
|
|
@@ -2359,14 +2368,34 @@ function stringifyShapeElements(opts) {
|
|
|
2359
2368
|
if (opts.borderright !== void 0) parts.push(stringifyVmlBorder("w10:borderright", opts.borderright));
|
|
2360
2369
|
if (opts.clientData !== void 0) parts.push(stringifyVmlClientData(opts.clientData));
|
|
2361
2370
|
if (opts.textdata !== void 0) parts.push(stringifyVmlTextData(opts.textdata));
|
|
2371
|
+
if (opts.rawChildrenXml) parts.push(opts.rawChildrenXml);
|
|
2362
2372
|
return parts.join("");
|
|
2363
2373
|
}
|
|
2364
2374
|
/** Parse the shared attribute vocabulary plus extras onto `out`. */
|
|
2365
2375
|
function parseShapeAttrs(el, out, extraSpecs = []) {
|
|
2366
|
-
parseVmlAttributes(el, [
|
|
2376
|
+
parseVmlAttributes(el, [
|
|
2377
|
+
...ALL_SHAPE_ATTRS,
|
|
2378
|
+
...extraSpecs,
|
|
2379
|
+
...PATH_ATTR
|
|
2380
|
+
], out);
|
|
2367
2381
|
if (el.attributes?.style !== void 0) out.style = parseVmlShapeStyle(parseVmlStyle(String(el.attributes.style)));
|
|
2368
|
-
if (el.attributes?.path !== void 0) out.path = String(el.attributes.path);
|
|
2369
2382
|
}
|
|
2383
|
+
/** Child shape element names — collected by the group child loop, never by
|
|
2384
|
+
* the EG_ShapeElements switch (their slots are group members, not shared
|
|
2385
|
+
* shape-element children). */
|
|
2386
|
+
const NESTED_SHAPE_NAMES = /* @__PURE__ */ new Set([
|
|
2387
|
+
"v:shape",
|
|
2388
|
+
"v:shapetype",
|
|
2389
|
+
"v:group",
|
|
2390
|
+
"v:rect",
|
|
2391
|
+
"v:roundrect",
|
|
2392
|
+
"v:oval",
|
|
2393
|
+
"v:line",
|
|
2394
|
+
"v:image",
|
|
2395
|
+
"v:arc",
|
|
2396
|
+
"v:curve",
|
|
2397
|
+
"v:polyline"
|
|
2398
|
+
]);
|
|
2370
2399
|
/** Parse the EG_ShapeElements children from `el` onto `out`. */
|
|
2371
2400
|
function parseShapeElements(el, out) {
|
|
2372
2401
|
for (const child of el.elements ?? []) {
|
|
@@ -2444,12 +2473,15 @@ function parseShapeElements(el, out) {
|
|
|
2444
2473
|
case "pvml:iscomment":
|
|
2445
2474
|
out.iscomment = parseVmlIsComment(child);
|
|
2446
2475
|
break;
|
|
2476
|
+
default:
|
|
2477
|
+
if (child.name === "o:complex" || child.name === "o:ink" || child.name === "o:equationxml" || child.name !== void 0 && NESTED_SHAPE_NAMES.has(child.name)) break;
|
|
2478
|
+
out.rawChildrenXml = (typeof out.rawChildrenXml === "string" ? out.rawChildrenXml : "") + stringifyElement(child);
|
|
2447
2479
|
}
|
|
2448
2480
|
}
|
|
2449
2481
|
}
|
|
2450
|
-
/** Generic shape element serializer: tag + shared/extra attrs +
|
|
2451
|
-
function stringifyShapeElement(tag, opts, extraSpecs = [],
|
|
2452
|
-
const attrStr = stringifyShapeAttrs(opts, extraSpecs)
|
|
2482
|
+
/** Generic shape element serializer: tag + shared/extra attrs + children. */
|
|
2483
|
+
function stringifyShapeElement(tag, opts, extraSpecs = [], childrenXml = "") {
|
|
2484
|
+
const attrStr = stringifyShapeAttrs(opts, extraSpecs);
|
|
2453
2485
|
return childrenXml !== "" ? `<${tag}${attrStr}>${childrenXml}</${tag}>` : `<${tag}${attrStr}/>`;
|
|
2454
2486
|
}
|
|
2455
2487
|
const SHAPE_EXTRA_ATTRS = [
|
|
@@ -2476,12 +2508,11 @@ const SHAPE_EXTRA_ATTRS = [
|
|
|
2476
2508
|
];
|
|
2477
2509
|
/** Serialize v:shape. */
|
|
2478
2510
|
function stringifyVmlShape(opts) {
|
|
2479
|
-
const extra = opts.path !== void 0 ? [`path="${escapeXml(opts.path)}"`] : [];
|
|
2480
2511
|
let children = stringifyShapeElements(opts);
|
|
2481
2512
|
if (opts.ink !== void 0) children += stringifyVmlInk(opts.ink);
|
|
2482
2513
|
if (opts.equationxmlElement !== void 0) children += stringifyVmlEquationXml(opts.equationxmlElement);
|
|
2483
2514
|
if (opts.iscomment !== void 0) children += stringifyVmlIsComment(opts.iscomment);
|
|
2484
|
-
return stringifyShapeElement("v:shape", opts, SHAPE_EXTRA_ATTRS,
|
|
2515
|
+
return stringifyShapeElement("v:shape", opts, SHAPE_EXTRA_ATTRS, children);
|
|
2485
2516
|
}
|
|
2486
2517
|
/** Parse a v:shape element. */
|
|
2487
2518
|
function parseVmlShape(el) {
|
|
@@ -2506,10 +2537,9 @@ const SHAPETYPE_EXTRA_ATTRS = [{
|
|
|
2506
2537
|
}];
|
|
2507
2538
|
/** Serialize v:shapetype. */
|
|
2508
2539
|
function stringifyVmlShapetype(opts) {
|
|
2509
|
-
const extra = opts.path !== void 0 ? [`path="${escapeXml(opts.path)}"`] : [];
|
|
2510
2540
|
let children = stringifyShapeElements(opts);
|
|
2511
2541
|
if (opts.complex !== void 0) children += stringifyVmlComplex(opts.complex);
|
|
2512
|
-
return stringifyShapeElement("v:shapetype", opts, SHAPETYPE_EXTRA_ATTRS,
|
|
2542
|
+
return stringifyShapeElement("v:shapetype", opts, SHAPETYPE_EXTRA_ATTRS, children);
|
|
2513
2543
|
}
|
|
2514
2544
|
/** Parse a v:shapetype element. */
|
|
2515
2545
|
function parseVmlShapetype(el) {
|
|
@@ -2522,8 +2552,8 @@ function parseVmlShapetype(el) {
|
|
|
2522
2552
|
}
|
|
2523
2553
|
return out;
|
|
2524
2554
|
}
|
|
2525
|
-
/** Serialize one
|
|
2526
|
-
function
|
|
2555
|
+
/** Serialize one VmlShapeChild. */
|
|
2556
|
+
function stringifyVmlShapeChild(child) {
|
|
2527
2557
|
if ("shape" in child) return stringifyVmlShape(child.shape);
|
|
2528
2558
|
if ("shapetype" in child) return stringifyVmlShapetype(child.shapetype);
|
|
2529
2559
|
if ("group" in child) return stringifyVmlGroup(child.group);
|
|
@@ -2555,13 +2585,32 @@ const GROUP_ATTRS = [
|
|
|
2555
2585
|
field: "tablelimits",
|
|
2556
2586
|
attr: "o:tablelimits",
|
|
2557
2587
|
kind: "string"
|
|
2558
|
-
}
|
|
2588
|
+
},
|
|
2589
|
+
...PATH_ATTR
|
|
2559
2590
|
];
|
|
2591
|
+
/** Parse one shape element into its VmlShapeChild wrapper, or undefined when
|
|
2592
|
+
* the element is not part of the shape vocabulary. */
|
|
2593
|
+
function parseVmlShapeChild(el) {
|
|
2594
|
+
switch (el.name) {
|
|
2595
|
+
case "v:shape": return { shape: parseVmlShape(el) };
|
|
2596
|
+
case "v:shapetype": return { shapetype: parseVmlShapetype(el) };
|
|
2597
|
+
case "v:group": return { group: parseVmlGroup(el) };
|
|
2598
|
+
case "v:arc": return { arc: parseVmlArc(el) };
|
|
2599
|
+
case "v:curve": return { curve: parseVmlCurve(el) };
|
|
2600
|
+
case "v:image": return { image: parseVmlImage(el) };
|
|
2601
|
+
case "v:line": return { line: parseVmlLine(el) };
|
|
2602
|
+
case "v:oval": return { oval: parseVmlOval(el) };
|
|
2603
|
+
case "v:polyline": return { polyline: parseVmlPolyline(el) };
|
|
2604
|
+
case "v:rect": return { rect: parseVmlRect(el) };
|
|
2605
|
+
case "v:roundrect": return { roundrect: parseVmlRoundRect(el) };
|
|
2606
|
+
default: return;
|
|
2607
|
+
}
|
|
2608
|
+
}
|
|
2560
2609
|
/** Serialize v:group. */
|
|
2561
2610
|
function stringifyVmlGroup(opts) {
|
|
2562
|
-
let children = (opts.children ?? []).map(
|
|
2611
|
+
let children = (opts.children ?? []).map(stringifyVmlShapeChild).join("") + stringifyShapeElements(opts);
|
|
2563
2612
|
if (opts.diagram !== void 0) children += stringifyVmlDiagram(opts.diagram);
|
|
2564
|
-
const attrStr = stringifyVmlAttributes(opts, GROUP_ATTRS)
|
|
2613
|
+
const attrStr = stringifyVmlAttributes(opts, GROUP_ATTRS);
|
|
2565
2614
|
const style = opts.style;
|
|
2566
2615
|
const styleStr = style !== void 0 ? ` style="${escapeXml(stringifyVmlStyle(style))}"` : "";
|
|
2567
2616
|
return children !== "" ? `<v:group${attrStr}${styleStr}>${children}</v:group>` : `<v:group${attrStr}${styleStr}/>`;
|
|
@@ -2571,49 +2620,13 @@ function parseVmlGroup(el) {
|
|
|
2571
2620
|
const out = {};
|
|
2572
2621
|
parseVmlAttributes(el, GROUP_ATTRS, out);
|
|
2573
2622
|
if (el.attributes?.style !== void 0) out.style = parseVmlShapeStyle(parseVmlStyle(String(el.attributes.style)));
|
|
2574
|
-
if (el.attributes?.path !== void 0 && out.path === void 0) out.path = String(el.attributes.path);
|
|
2575
2623
|
parseShapeElements(el, out);
|
|
2576
2624
|
const children = [];
|
|
2577
2625
|
for (const child of el.elements ?? []) {
|
|
2578
2626
|
if (child.type !== "element") continue;
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
break;
|
|
2583
|
-
case "v:shapetype":
|
|
2584
|
-
children.push({ shapetype: parseVmlShapetype(child) });
|
|
2585
|
-
break;
|
|
2586
|
-
case "v:group":
|
|
2587
|
-
children.push({ group: parseVmlGroup(child) });
|
|
2588
|
-
break;
|
|
2589
|
-
case "v:arc":
|
|
2590
|
-
children.push({ arc: parseVmlArc(child) });
|
|
2591
|
-
break;
|
|
2592
|
-
case "v:curve":
|
|
2593
|
-
children.push({ curve: parseVmlCurve(child) });
|
|
2594
|
-
break;
|
|
2595
|
-
case "v:image":
|
|
2596
|
-
children.push({ image: parseVmlImage(child) });
|
|
2597
|
-
break;
|
|
2598
|
-
case "v:line":
|
|
2599
|
-
children.push({ line: parseVmlLine(child) });
|
|
2600
|
-
break;
|
|
2601
|
-
case "v:oval":
|
|
2602
|
-
children.push({ oval: parseVmlOval(child) });
|
|
2603
|
-
break;
|
|
2604
|
-
case "v:polyline":
|
|
2605
|
-
children.push({ polyline: parseVmlPolyline(child) });
|
|
2606
|
-
break;
|
|
2607
|
-
case "v:rect":
|
|
2608
|
-
children.push({ rect: parseVmlRect(child) });
|
|
2609
|
-
break;
|
|
2610
|
-
case "v:roundrect":
|
|
2611
|
-
children.push({ roundrect: parseVmlRoundRect(child) });
|
|
2612
|
-
break;
|
|
2613
|
-
case "o:diagram":
|
|
2614
|
-
out.diagram = parseVmlDiagram(child);
|
|
2615
|
-
break;
|
|
2616
|
-
}
|
|
2627
|
+
const shapeChild = parseVmlShapeChild(child);
|
|
2628
|
+
if (shapeChild !== void 0) children.push(shapeChild);
|
|
2629
|
+
else if (child.name === "o:diagram") out.diagram = parseVmlDiagram(child);
|
|
2617
2630
|
}
|
|
2618
2631
|
if (children.length > 0) out.children = children;
|
|
2619
2632
|
return out;
|
|
@@ -2673,7 +2686,7 @@ function parseVmlBackground(el) {
|
|
|
2673
2686
|
}
|
|
2674
2687
|
/** Serialize v:arc. */
|
|
2675
2688
|
function stringifyVmlArc(opts) {
|
|
2676
|
-
return stringifyShapeElement("v:arc", opts, ARC_ATTRS,
|
|
2689
|
+
return stringifyShapeElement("v:arc", opts, ARC_ATTRS, stringifyShapeElements(opts));
|
|
2677
2690
|
}
|
|
2678
2691
|
/** Parse a v:arc element. */
|
|
2679
2692
|
function parseVmlArc(el) {
|
|
@@ -2684,7 +2697,7 @@ function parseVmlArc(el) {
|
|
|
2684
2697
|
}
|
|
2685
2698
|
/** Serialize v:curve. */
|
|
2686
2699
|
function stringifyVmlCurve(opts) {
|
|
2687
|
-
return stringifyShapeElement("v:curve", opts, CURVE_ATTRS,
|
|
2700
|
+
return stringifyShapeElement("v:curve", opts, CURVE_ATTRS, stringifyShapeElements(opts));
|
|
2688
2701
|
}
|
|
2689
2702
|
/** Parse a v:curve element. */
|
|
2690
2703
|
function parseVmlCurve(el) {
|
|
@@ -2695,7 +2708,7 @@ function parseVmlCurve(el) {
|
|
|
2695
2708
|
}
|
|
2696
2709
|
/** Serialize v:image. */
|
|
2697
2710
|
function stringifyVmlImage(opts) {
|
|
2698
|
-
return stringifyShapeElement("v:image", opts, IMAGE_ATTRS,
|
|
2711
|
+
return stringifyShapeElement("v:image", opts, IMAGE_ATTRS, stringifyShapeElements(opts));
|
|
2699
2712
|
}
|
|
2700
2713
|
/** Parse a v:image element. */
|
|
2701
2714
|
function parseVmlImage(el) {
|
|
@@ -2706,7 +2719,7 @@ function parseVmlImage(el) {
|
|
|
2706
2719
|
}
|
|
2707
2720
|
/** Serialize v:line. */
|
|
2708
2721
|
function stringifyVmlLine(opts) {
|
|
2709
|
-
return stringifyShapeElement("v:line", opts, LINE_ATTRS,
|
|
2722
|
+
return stringifyShapeElement("v:line", opts, LINE_ATTRS, stringifyShapeElements(opts));
|
|
2710
2723
|
}
|
|
2711
2724
|
/** Parse a v:line element. */
|
|
2712
2725
|
function parseVmlLine(el) {
|
|
@@ -2717,7 +2730,7 @@ function parseVmlLine(el) {
|
|
|
2717
2730
|
}
|
|
2718
2731
|
/** Serialize v:oval. */
|
|
2719
2732
|
function stringifyVmlOval(opts) {
|
|
2720
|
-
return stringifyShapeElement("v:oval", opts, [],
|
|
2733
|
+
return stringifyShapeElement("v:oval", opts, [], stringifyShapeElements(opts));
|
|
2721
2734
|
}
|
|
2722
2735
|
/** Parse a v:oval element. */
|
|
2723
2736
|
function parseVmlOval(el) {
|
|
@@ -2729,7 +2742,7 @@ function parseVmlOval(el) {
|
|
|
2729
2742
|
/** Serialize v:polyline. */
|
|
2730
2743
|
function stringifyVmlPolyline(opts) {
|
|
2731
2744
|
const children = stringifyShapeElements(opts) + (opts.ink !== void 0 ? stringifyVmlInk(opts.ink) : "");
|
|
2732
|
-
return stringifyShapeElement("v:polyline", opts, POLYLINE_ATTRS,
|
|
2745
|
+
return stringifyShapeElement("v:polyline", opts, POLYLINE_ATTRS, children);
|
|
2733
2746
|
}
|
|
2734
2747
|
/** Parse a v:polyline element. */
|
|
2735
2748
|
function parseVmlPolyline(el) {
|
|
@@ -2744,7 +2757,7 @@ function parseVmlPolyline(el) {
|
|
|
2744
2757
|
}
|
|
2745
2758
|
/** Serialize v:rect. */
|
|
2746
2759
|
function stringifyVmlRect(opts) {
|
|
2747
|
-
return stringifyShapeElement("v:rect", opts, [],
|
|
2760
|
+
return stringifyShapeElement("v:rect", opts, [], stringifyShapeElements(opts));
|
|
2748
2761
|
}
|
|
2749
2762
|
/** Parse a v:rect element. */
|
|
2750
2763
|
function parseVmlRect(el) {
|
|
@@ -2755,7 +2768,7 @@ function parseVmlRect(el) {
|
|
|
2755
2768
|
}
|
|
2756
2769
|
/** Serialize v:roundrect. */
|
|
2757
2770
|
function stringifyVmlRoundRect(opts) {
|
|
2758
|
-
return stringifyShapeElement("v:roundrect", opts, ROUNDRECT_ATTRS,
|
|
2771
|
+
return stringifyShapeElement("v:roundrect", opts, ROUNDRECT_ATTRS, stringifyShapeElements(opts));
|
|
2759
2772
|
}
|
|
2760
2773
|
/** Parse a v:roundrect element. */
|
|
2761
2774
|
function parseVmlRoundRect(el) {
|
|
@@ -2767,11 +2780,7 @@ function parseVmlRoundRect(el) {
|
|
|
2767
2780
|
//#endregion
|
|
2768
2781
|
//#region src/vector/office-shape-defaults.ts
|
|
2769
2782
|
const SHAPEDEFAULTS_ATTRS = [
|
|
2770
|
-
|
|
2771
|
-
field: "ext",
|
|
2772
|
-
attr: "v:ext",
|
|
2773
|
-
kind: "string"
|
|
2774
|
-
},
|
|
2783
|
+
...EXT_ATTR,
|
|
2775
2784
|
{
|
|
2776
2785
|
field: "spidmax",
|
|
2777
2786
|
attr: "spidmax",
|
|
@@ -2858,20 +2867,14 @@ function parseVmlShapeDefaults(el) {
|
|
|
2858
2867
|
case "o:colormru":
|
|
2859
2868
|
out.colormru = parseVmlColorMru(child);
|
|
2860
2869
|
break;
|
|
2861
|
-
case "o:colormenu":
|
|
2862
|
-
out.colormenu = parseVmlColorMenu(child);
|
|
2863
|
-
break;
|
|
2870
|
+
case "o:colormenu": out.colormenu = parseVmlColorMenu(child);
|
|
2864
2871
|
}
|
|
2865
2872
|
}
|
|
2866
2873
|
return out;
|
|
2867
2874
|
}
|
|
2868
2875
|
/** Serialize o:colormru. */
|
|
2869
2876
|
function stringifyVmlColorMru(opts) {
|
|
2870
|
-
return `<o:colormru${stringifyVmlAttributes(opts, [{
|
|
2871
|
-
field: "ext",
|
|
2872
|
-
attr: "v:ext",
|
|
2873
|
-
kind: "string"
|
|
2874
|
-
}, {
|
|
2877
|
+
return `<o:colormru${stringifyVmlAttributes(opts, [...EXT_ATTR, {
|
|
2875
2878
|
field: "colors",
|
|
2876
2879
|
attr: "colors",
|
|
2877
2880
|
kind: "string"
|
|
@@ -2880,11 +2883,7 @@ function stringifyVmlColorMru(opts) {
|
|
|
2880
2883
|
/** Parse an o:colormru element. */
|
|
2881
2884
|
function parseVmlColorMru(el) {
|
|
2882
2885
|
const out = {};
|
|
2883
|
-
parseVmlAttributes(el, [{
|
|
2884
|
-
field: "ext",
|
|
2885
|
-
attr: "v:ext",
|
|
2886
|
-
kind: "string"
|
|
2887
|
-
}, {
|
|
2886
|
+
parseVmlAttributes(el, [...EXT_ATTR, {
|
|
2888
2887
|
field: "colors",
|
|
2889
2888
|
attr: "colors",
|
|
2890
2889
|
kind: "string"
|
|
@@ -2892,11 +2891,7 @@ function parseVmlColorMru(el) {
|
|
|
2892
2891
|
return out;
|
|
2893
2892
|
}
|
|
2894
2893
|
const COLORMENU_ATTRS = [
|
|
2895
|
-
|
|
2896
|
-
field: "ext",
|
|
2897
|
-
attr: "v:ext",
|
|
2898
|
-
kind: "string"
|
|
2899
|
-
},
|
|
2894
|
+
...EXT_ATTR,
|
|
2900
2895
|
{
|
|
2901
2896
|
field: "strokecolor",
|
|
2902
2897
|
attr: "strokecolor",
|
|
@@ -2939,11 +2934,7 @@ const ENTRY_ATTRS = [{
|
|
|
2939
2934
|
}];
|
|
2940
2935
|
/** Serialize an o:idmap. */
|
|
2941
2936
|
function stringifyVmlIdMap(opts) {
|
|
2942
|
-
return `<o:idmap${stringifyVmlAttributes(opts, [{
|
|
2943
|
-
field: "ext",
|
|
2944
|
-
attr: "v:ext",
|
|
2945
|
-
kind: "string"
|
|
2946
|
-
}, {
|
|
2937
|
+
return `<o:idmap${stringifyVmlAttributes(opts, [...EXT_ATTR, {
|
|
2947
2938
|
field: "data",
|
|
2948
2939
|
attr: "data",
|
|
2949
2940
|
kind: "string"
|
|
@@ -2952,11 +2943,7 @@ function stringifyVmlIdMap(opts) {
|
|
|
2952
2943
|
/** Parse an o:idmap element. */
|
|
2953
2944
|
function parseVmlIdMap(el) {
|
|
2954
2945
|
const out = {};
|
|
2955
|
-
parseVmlAttributes(el, [{
|
|
2956
|
-
field: "ext",
|
|
2957
|
-
attr: "v:ext",
|
|
2958
|
-
kind: "string"
|
|
2959
|
-
}, {
|
|
2946
|
+
parseVmlAttributes(el, [...EXT_ATTR, {
|
|
2960
2947
|
field: "data",
|
|
2961
2948
|
attr: "data",
|
|
2962
2949
|
kind: "string"
|
|
@@ -2966,20 +2953,12 @@ function parseVmlIdMap(el) {
|
|
|
2966
2953
|
/** Serialize an o:regrouptable. */
|
|
2967
2954
|
function stringifyVmlRegroupTable(opts) {
|
|
2968
2955
|
const entries = (opts.entries ?? []).map((entry) => `<o:entry${stringifyVmlAttributes(entry, ENTRY_ATTRS)}/>`).join("");
|
|
2969
|
-
return `<o:regrouptable${stringifyVmlAttributes(opts,
|
|
2970
|
-
field: "ext",
|
|
2971
|
-
attr: "v:ext",
|
|
2972
|
-
kind: "string"
|
|
2973
|
-
}])}>${entries}</o:regrouptable>`;
|
|
2956
|
+
return `<o:regrouptable${stringifyVmlAttributes(opts, EXT_ATTR)}>${entries}</o:regrouptable>`;
|
|
2974
2957
|
}
|
|
2975
2958
|
/** Parse an o:regrouptable element. */
|
|
2976
2959
|
function parseVmlRegroupTable(el) {
|
|
2977
2960
|
const out = {};
|
|
2978
|
-
parseVmlAttributes(el,
|
|
2979
|
-
field: "ext",
|
|
2980
|
-
attr: "v:ext",
|
|
2981
|
-
kind: "string"
|
|
2982
|
-
}], out);
|
|
2961
|
+
parseVmlAttributes(el, EXT_ATTR, out);
|
|
2983
2962
|
const entries = [];
|
|
2984
2963
|
for (const child of el.elements ?? []) if (child.type === "element" && child.name === "o:entry") {
|
|
2985
2964
|
const entry = {};
|
|
@@ -2992,8 +2971,8 @@ function parseVmlRegroupTable(el) {
|
|
|
2992
2971
|
/** Serialize a proxy child inside an o:r. */
|
|
2993
2972
|
function stringifyVmlRuleProxy(proxy) {
|
|
2994
2973
|
const attrs = [];
|
|
2995
|
-
if (proxy.start !== void 0) attrs.push(`start="${proxy.start
|
|
2996
|
-
if (proxy.end !== void 0) attrs.push(`end="${proxy.end
|
|
2974
|
+
if (proxy.start !== void 0) attrs.push(`start="${stringifyVmlTrueFalseBlank(proxy.start)}"`);
|
|
2975
|
+
if (proxy.end !== void 0) attrs.push(`end="${stringifyVmlTrueFalseBlank(proxy.end)}"`);
|
|
2997
2976
|
if (proxy.idref !== void 0) attrs.push(`idref="${proxy.idref}"`);
|
|
2998
2977
|
if (proxy.connectloc !== void 0) attrs.push(`connectloc="${proxy.connectloc}"`);
|
|
2999
2978
|
return `<o:proxy${attrs.length > 0 ? " " + attrs.join(" ") : ""}/>`;
|
|
@@ -3002,14 +2981,8 @@ function stringifyVmlRuleProxy(proxy) {
|
|
|
3002
2981
|
function parseVmlRuleProxy(el) {
|
|
3003
2982
|
const out = {};
|
|
3004
2983
|
const attrs = el.attributes ?? {};
|
|
3005
|
-
if (attrs.start !== void 0)
|
|
3006
|
-
|
|
3007
|
-
out.start = raw === "" ? "" : raw === "t" || raw === "true" || raw === "1";
|
|
3008
|
-
}
|
|
3009
|
-
if (attrs.end !== void 0) {
|
|
3010
|
-
const raw = String(attrs.end);
|
|
3011
|
-
out.end = raw === "" ? "" : raw === "t" || raw === "true" || raw === "1";
|
|
3012
|
-
}
|
|
2984
|
+
if (attrs.start !== void 0) out.start = parseVmlTrueFalseBlank(String(attrs.start));
|
|
2985
|
+
if (attrs.end !== void 0) out.end = parseVmlTrueFalseBlank(String(attrs.end));
|
|
3013
2986
|
if (attrs.idref !== void 0) out.idref = String(attrs.idref);
|
|
3014
2987
|
if (attrs.connectloc !== void 0) out.connectloc = Number(attrs.connectloc);
|
|
3015
2988
|
return out;
|
|
@@ -3038,20 +3011,12 @@ function parseVmlRule(el) {
|
|
|
3038
3011
|
/** Serialize an o:rules block. */
|
|
3039
3012
|
function stringifyVmlRulesBlock(opts) {
|
|
3040
3013
|
const rules = (opts.rules ?? []).map(stringifyVmlRule).join("");
|
|
3041
|
-
return `<o:rules${stringifyVmlAttributes(opts,
|
|
3042
|
-
field: "ext",
|
|
3043
|
-
attr: "v:ext",
|
|
3044
|
-
kind: "string"
|
|
3045
|
-
}])}>${rules}</o:rules>`;
|
|
3014
|
+
return `<o:rules${stringifyVmlAttributes(opts, EXT_ATTR)}>${rules}</o:rules>`;
|
|
3046
3015
|
}
|
|
3047
3016
|
/** Parse an o:rules element. */
|
|
3048
3017
|
function parseVmlRulesBlock(el) {
|
|
3049
3018
|
const out = {};
|
|
3050
|
-
parseVmlAttributes(el,
|
|
3051
|
-
field: "ext",
|
|
3052
|
-
attr: "v:ext",
|
|
3053
|
-
kind: "string"
|
|
3054
|
-
}], out);
|
|
3019
|
+
parseVmlAttributes(el, EXT_ATTR, out);
|
|
3055
3020
|
const rules = [];
|
|
3056
3021
|
for (const child of el.elements ?? []) if (child.type === "element" && child.name === "o:r") rules.push(parseVmlRule(child));
|
|
3057
3022
|
if (rules.length > 0) out.rules = rules;
|
|
@@ -3063,21 +3028,13 @@ function stringifyVmlShapeLayout(opts) {
|
|
|
3063
3028
|
if (opts.idmap !== void 0) children.push(stringifyVmlIdMap(opts.idmap));
|
|
3064
3029
|
if (opts.regrouptable !== void 0) children.push(stringifyVmlRegroupTable(opts.regrouptable));
|
|
3065
3030
|
if (opts.rules !== void 0) children.push(stringifyVmlRulesBlock(opts.rules));
|
|
3066
|
-
const attrStr = stringifyVmlAttributes(opts,
|
|
3067
|
-
field: "ext",
|
|
3068
|
-
attr: "v:ext",
|
|
3069
|
-
kind: "string"
|
|
3070
|
-
}]);
|
|
3031
|
+
const attrStr = stringifyVmlAttributes(opts, EXT_ATTR);
|
|
3071
3032
|
return children.length > 0 ? `<o:shapelayout${attrStr}>${children.join("")}</o:shapelayout>` : `<o:shapelayout${attrStr}/>`;
|
|
3072
3033
|
}
|
|
3073
3034
|
/** Parse an o:shapelayout element. */
|
|
3074
3035
|
function parseVmlShapeLayout(el) {
|
|
3075
3036
|
const out = {};
|
|
3076
|
-
parseVmlAttributes(el,
|
|
3077
|
-
field: "ext",
|
|
3078
|
-
attr: "v:ext",
|
|
3079
|
-
kind: "string"
|
|
3080
|
-
}], out);
|
|
3037
|
+
parseVmlAttributes(el, EXT_ATTR, out);
|
|
3081
3038
|
for (const child of el.elements ?? []) {
|
|
3082
3039
|
if (child.type !== "element") continue;
|
|
3083
3040
|
if (child.name === "o:idmap") out.idmap = parseVmlIdMap(child);
|
|
@@ -3087,6 +3044,6 @@ function parseVmlShapeLayout(el) {
|
|
|
3087
3044
|
return out;
|
|
3088
3045
|
}
|
|
3089
3046
|
//#endregion
|
|
3090
|
-
export {
|
|
3047
|
+
export { stringifyVmlIsComment as $, stringifyVmlPolyline as A, stringifyVmlEquationXml as At, stringifyVmlAnchorLock as B, VML_OFFICE_SHAPE_ATTRS as Bt, stringifyVmlArc as C, parseVmlOleObject as Ct, stringifyVmlImage as D, stringifyVmlClipPath as Dt, stringifyVmlGroup as E, stringifyVmlCallout as Et, stringifyVmlShapetype as F, stringifyVmlOleObject as Ft, parseVmlTextbox as G, stringifyVmlAttributes as Gt, stringifyVmlWrap as H, parseVmlAttributes as Ht, VML_BORDER_TAGS as I, stringifyVmlSignatureLine as It, stringifyVmlStroke as J, parseVmlShapeStyle as Jt, stringifyVmlTextbox as K, stringifyVmlTrueFalse as Kt, parseVmlAnchorLock as L, stringifyVmlSkew as Lt, stringifyVmlRoundRect as M, stringifyVmlInk as Mt, stringifyVmlShape as N, stringifyVmlLock as Nt, stringifyVmlLine as O, stringifyVmlComplex as Ot, stringifyVmlShapeChild as P, stringifyVmlOfficeFill as Pt, parseVmlTextData as Q, parseVmlBorder as R, VML_CORE_ATTRS as Rt, parseVmlShapetype as S, parseVmlOfficeFill as St, stringifyVmlCurve as T, parseVmlSkew as Tt, parseVmlTextPath as U, parseVmlTrueFalse as Ut, stringifyVmlBorder as V, VML_SHAPE_ATTRS as Vt, stringifyVmlTextPath as W, parseVmlTrueFalseBlank as Wt, stringifyVmlShadow as X, stringifyVmlStyle as Xt, parseVmlShadow as Y, parseVmlStyle as Yt, parseVmlIsComment as Z, styleToKeyMap as Zt, parseVmlPolyline as _, parseVmlDiagram as _t, stringifyVmlColorMenu as a, parseVmlHandles as at, parseVmlShape as b, parseVmlInk as bt, stringifyVmlShapeLayout as c, stringifyVmlFormulas as ct, parseVmlBackground as d, parseVmlClientData as dt, stringifyVmlTextData as et, parseVmlCurve as f, stringifyVmlClientData as ft, parseVmlOval as g, parseVmlComplex as gt, parseVmlLine as h, parseVmlClipPath as ht, parseVmlShapeLayout as i, stringifyVmlImageData as it, stringifyVmlRect as j, stringifyVmlExtrusion as jt, stringifyVmlOval as k, stringifyVmlDiagram as kt, nextVmlShapeId as l, parseVmlFill as lt, parseVmlImage as m, parseVmlCallout as mt, parseVmlColorMru as n, stringifyVmlPath as nt, stringifyVmlColorMru as o, stringifyVmlHandles as ot, parseVmlGroup as p, EXT_ATTR as pt, parseVmlStroke as q, stringifyVmlTrueFalseBlank as qt, parseVmlShapeDefaults as r, parseVmlImageData as rt, stringifyVmlShapeDefaults as s, parseVmlFormulas as st, parseVmlColorMenu as t, parseVmlPath as tt, parseVmlArc as u, stringifyVmlFill as ut, parseVmlRect as v, parseVmlEquationXml as vt, stringifyVmlBackground as w, parseVmlSignatureLine as wt, parseVmlShapeChild as x, parseVmlLock as xt, parseVmlRoundRect as y, parseVmlExtrusion as yt, parseVmlWrap as z, VML_OFFICE_CORE_ATTRS as zt };
|
|
3091
3048
|
|
|
3092
|
-
//# sourceMappingURL=vector-
|
|
3049
|
+
//# sourceMappingURL=vector-DhLGZjP5.mjs.map
|