@officedk/pptxdk 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/dist/build-zrZuX4fK.d.ts +3 -0
- package/dist/build.d.ts +35 -0
- package/dist/build.js +128 -0
- package/dist/capabilities/dist/all.js +34 -0
- package/dist/capabilities/dist/box/box-codegen.js +84 -0
- package/dist/capabilities/dist/box/box-declaration.js +32 -0
- package/dist/capabilities/dist/box/box-elements.js +17 -0
- package/dist/capabilities/dist/box/box.js +142 -0
- package/dist/capabilities/dist/chart/chart-codegen.js +79 -0
- package/dist/capabilities/dist/chart/chart-declaration.js +7 -0
- package/dist/capabilities/dist/chart/chart-elements.js +12 -0
- package/dist/capabilities/dist/chart/chart-import.js +2403 -0
- package/dist/capabilities/dist/chart/chart-labels.js +86 -0
- package/dist/capabilities/dist/chart/chart-model.js +9 -0
- package/dist/capabilities/dist/chart/chart-schemas.js +1088 -0
- package/dist/capabilities/dist/chart/chart-xml.js +788 -0
- package/dist/capabilities/dist/chart/chart.js +1119 -0
- package/dist/capabilities/dist/chart/preview/axes-and-grid.js +311 -0
- package/dist/capabilities/dist/chart/preview/bar-column.js +143 -0
- package/dist/capabilities/dist/chart/preview/data-labels.js +334 -0
- package/dist/capabilities/dist/chart/preview/error-bars.js +213 -0
- package/dist/capabilities/dist/chart/preview/index.js +192 -0
- package/dist/capabilities/dist/chart/preview/layout.js +592 -0
- package/dist/capabilities/dist/chart/preview/legend.js +273 -0
- package/dist/capabilities/dist/chart/preview/line-area.js +404 -0
- package/dist/capabilities/dist/chart/preview/markers.js +100 -0
- package/dist/capabilities/dist/chart/preview/number-format.js +247 -0
- package/dist/capabilities/dist/chart/preview/pie-doughnut.js +159 -0
- package/dist/capabilities/dist/chart/preview/scales.js +365 -0
- package/dist/capabilities/dist/chart/preview/scatter.js +131 -0
- package/dist/capabilities/dist/chart/preview/style.js +60 -0
- package/dist/capabilities/dist/chart/preview/text-render.js +116 -0
- package/dist/capabilities/dist/chart/preview/trendlines.js +537 -0
- package/dist/capabilities/dist/chart/preview/types.js +5 -0
- package/dist/capabilities/dist/document.js +168 -0
- package/dist/capabilities/dist/font/font-embedding.js +119 -0
- package/dist/capabilities/dist/font/font-engine.js +834 -0
- package/dist/capabilities/dist/font/font-import.js +766 -0
- package/dist/capabilities/dist/font/font-subset.js +55 -0
- package/dist/capabilities/dist/font/font.js +72 -0
- package/dist/capabilities/dist/group/group-codegen.js +74 -0
- package/dist/capabilities/dist/group/group-declaration.js +41 -0
- package/dist/capabilities/dist/group/group-elements.js +12 -0
- package/dist/capabilities/dist/group/group-import.js +649 -0
- package/dist/capabilities/dist/group/group-xml.js +8 -0
- package/dist/capabilities/dist/group/group.js +260 -0
- package/dist/capabilities/dist/image/gif-decoder.js +244 -0
- package/dist/capabilities/dist/image/image-codegen.js +164 -0
- package/dist/capabilities/dist/image/image-declaration.js +8 -0
- package/dist/capabilities/dist/image/image-decode.js +244 -0
- package/dist/capabilities/dist/image/image-elements.js +12 -0
- package/dist/capabilities/dist/image/image-import.js +984 -0
- package/dist/capabilities/dist/image/image-schemas.js +147 -0
- package/dist/capabilities/dist/image/image-xml.js +12 -0
- package/dist/capabilities/dist/image/image.js +552 -0
- package/dist/capabilities/dist/line/line-codegen.js +89 -0
- package/dist/capabilities/dist/line/line-declaration.js +72 -0
- package/dist/capabilities/dist/line/line-elements.js +12 -0
- package/dist/capabilities/dist/line/line-import.js +504 -0
- package/dist/capabilities/dist/line/line-xml.js +9 -0
- package/dist/capabilities/dist/line/line.js +331 -0
- package/dist/capabilities/dist/masters/footer-placeholder.js +683 -0
- package/dist/capabilities/dist/masters/masters-codegen.js +69 -0
- package/dist/capabilities/dist/masters/masters.js +250 -0
- package/dist/capabilities/dist/motion/motion-api.js +757 -0
- package/dist/capabilities/dist/motion/motion-codegen.js +406 -0
- package/dist/capabilities/dist/motion/motion-elements.js +43 -0
- package/dist/capabilities/dist/motion/motion-import.js +1568 -0
- package/dist/capabilities/dist/motion/motion-plan.js +2340 -0
- package/dist/capabilities/dist/motion/motion-query.js +423 -0
- package/dist/capabilities/dist/motion/motion-schemas.js +339 -0
- package/dist/capabilities/dist/motion/motion.js +1617 -0
- package/dist/capabilities/dist/notes/notes-codegen.js +19 -0
- package/dist/capabilities/dist/notes/notes-declaration.js +8 -0
- package/dist/capabilities/dist/notes/notes-elements.js +12 -0
- package/dist/capabilities/dist/notes/notes-import.js +292 -0
- package/dist/capabilities/dist/notes/notes-schemas.js +38 -0
- package/dist/capabilities/dist/notes/notes-xml.js +38 -0
- package/dist/capabilities/dist/notes/notes.js +194 -0
- package/dist/capabilities/dist/placeholder/placeholder-codegen.js +54 -0
- package/dist/capabilities/dist/placeholder/placeholder-elements.js +13 -0
- package/dist/capabilities/dist/placeholder/placeholder-schemas.js +33 -0
- package/dist/capabilities/dist/placeholder/placeholder.js +451 -0
- package/dist/capabilities/dist/shape/shape-codegen.js +236 -0
- package/dist/capabilities/dist/shape/shape-declaration.js +45 -0
- package/dist/capabilities/dist/shape/shape-elements.js +12 -0
- package/dist/capabilities/dist/shape/shape-import.js +628 -0
- package/dist/capabilities/dist/shape/shape-xml.js +6 -0
- package/dist/capabilities/dist/shape/shape.js +320 -0
- package/dist/capabilities/dist/shared/geometry.js +1681 -0
- package/dist/capabilities/dist/shared/identity.js +205 -0
- package/dist/capabilities/dist/shared/morph-api.js +11 -0
- package/dist/capabilities/dist/shared/placeholder-import.js +238 -0
- package/dist/capabilities/dist/shared/preset-definitions.js +22423 -0
- package/dist/capabilities/dist/shared/style-inheritance.js +161 -0
- package/dist/capabilities/dist/shared/text-schemas.js +241 -0
- package/dist/capabilities/dist/shared/text-service.js +2252 -0
- package/dist/capabilities/dist/shared/visual.js +1197 -0
- package/dist/capabilities/dist/slide-background/slide-background-codegen.js +44 -0
- package/dist/capabilities/dist/slide-background/slide-background-import.js +166 -0
- package/dist/capabilities/dist/slide-background/slide-background-xml.js +34 -0
- package/dist/capabilities/dist/slide-background/slide-background.js +238 -0
- package/dist/capabilities/dist/table/table-codegen.js +125 -0
- package/dist/capabilities/dist/table/table-declaration.js +15 -0
- package/dist/capabilities/dist/table/table-elements.js +27 -0
- package/dist/capabilities/dist/table/table-import.js +606 -0
- package/dist/capabilities/dist/table/table-schemas.js +334 -0
- package/dist/capabilities/dist/table/table-xml.js +30 -0
- package/dist/capabilities/dist/table/table.js +739 -0
- package/dist/capabilities/dist/text/text-codegen.js +198 -0
- package/dist/capabilities/dist/text/text-declaration.js +27 -0
- package/dist/capabilities/dist/text/text-elements.js +54 -0
- package/dist/capabilities/dist/text/text-import.js +1224 -0
- package/dist/capabilities/dist/text/text-xml.js +9 -0
- package/dist/capabilities/dist/text/text.js +320 -0
- package/dist/capabilities/dist/transition/transition-api.js +136 -0
- package/dist/capabilities/dist/transition/transition-codegen.js +45 -0
- package/dist/capabilities/dist/transition/transition-import.js +477 -0
- package/dist/capabilities/dist/transition/transition.js +260 -0
- package/dist/capability-BbKW9w4O.d.ts +2131 -0
- package/dist/cli.js +20 -0
- package/dist/codegen/dist/assets.js +79 -0
- package/dist/codegen/dist/codegen.js +691 -0
- package/dist/codegen/dist/identifiers.js +203 -0
- package/dist/codegen/dist/index.js +3 -0
- package/dist/codegen/dist/printer.js +143 -0
- package/dist/codegen/dist/types.js +77 -0
- package/dist/core/dist/author-ids.js +51 -0
- package/dist/core/dist/author-schemas.js +330 -0
- package/dist/core/dist/block-flex-layout.js +801 -0
- package/dist/core/dist/build.js +4 -0
- package/dist/core/dist/capability.js +15 -0
- package/dist/core/dist/declaration.js +16 -0
- package/dist/core/dist/diagnostics.js +353 -0
- package/dist/core/dist/document-internals.js +26 -0
- package/dist/core/dist/document.js +417 -0
- package/dist/core/dist/font-seal.js +204 -0
- package/dist/core/dist/geometry-schemas.js +256 -0
- package/dist/core/dist/grid-layout.js +449 -0
- package/dist/core/dist/host.js +40 -0
- package/dist/core/dist/index.js +15 -0
- package/dist/core/dist/input-values.js +61 -0
- package/dist/core/dist/layout-protocol.js +61 -0
- package/dist/core/dist/layout-schemas.js +201 -0
- package/dist/core/dist/layout.js +340 -0
- package/dist/core/dist/masters.js +194 -0
- package/dist/core/dist/morph.js +30 -0
- package/dist/core/dist/placeholders.js +275 -0
- package/dist/core/dist/query.js +190 -0
- package/dist/core/dist/resolution.js +12 -0
- package/dist/core/dist/resolve.js +2246 -0
- package/dist/core/dist/stage-options.js +300 -0
- package/dist/core/dist/theme.js +1023 -0
- package/dist/core/dist/transform-geometry.js +72 -0
- package/dist/document-41spD7bq.d.ts +1350 -0
- package/dist/emit/dist/emit.js +957 -0
- package/dist/emit/dist/index.js +5 -0
- package/dist/emit/dist/ooxml.js +661 -0
- package/dist/emit/dist/shape-tree.js +12 -0
- package/dist/import/dist/alternate-content.js +54 -0
- package/dist/import/dist/diagnostics.js +157 -0
- package/dist/import/dist/fonts.js +309 -0
- package/dist/import/dist/import.js +513 -0
- package/dist/import/dist/index.js +16 -0
- package/dist/import/dist/masters.js +1293 -0
- package/dist/import/dist/mechanism.js +10 -0
- package/dist/import/dist/namespaces.js +61 -0
- package/dist/import/dist/notes-masters.js +300 -0
- package/dist/import/dist/opc.js +233 -0
- package/dist/import/dist/resources.js +166 -0
- package/dist/import/dist/sections.js +139 -0
- package/dist/import/dist/themes.js +777 -0
- package/dist/import/dist/visual.js +821 -0
- package/dist/import/dist/xml-fragments.js +277 -0
- package/dist/import/dist/xml-reader.js +267 -0
- package/dist/index-1ag7U9Jt.d.ts +63 -0
- package/dist/index-BEwhk7c8.d.ts +72 -0
- package/dist/index-cK2KtukZ.d.ts +161 -0
- package/dist/index-v77CTJev.d.ts +55 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +82 -0
- package/dist/node.d.ts +53 -0
- package/dist/node.js +225 -0
- package/dist/pptxdk/src/cli-commands.js +907 -0
- package/dist/pptxdk/src/compose.js +53 -0
- package/dist/pptxdk/src/slide.js +9 -0
- package/dist/preview/dist/index.js +342 -0
- package/dist/preview/dist/options.js +40 -0
- package/dist/preview/dist/svg-guard.js +1089 -0
- package/dist/preview.d.ts +12 -0
- package/dist/preview.js +29 -0
- package/dist/react/dist/append.js +66 -0
- package/dist/react/dist/document-adapter.js +404 -0
- package/dist/react/dist/elements.js +82 -0
- package/dist/react/dist/from-vanilla.js +57 -0
- package/dist/react/dist/index.js +89 -0
- package/dist/react/dist/mount.js +34 -0
- package/dist/react/dist/reconciler.js +290 -0
- package/dist/react.d.ts +235 -0
- package/dist/react.js +31 -0
- package/dist/transition-6n8GZxSg.d.ts +9 -0
- package/dist/vanilla.d.ts +4 -0
- package/dist/vanilla.js +15 -0
- package/package.json +79 -3
- package/README.md +0 -3
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { authorIdSchema } from "../../../core/dist/author-ids.js";
|
|
2
|
+
import { layoutStyleShape } from "../../../core/dist/layout-schemas.js";
|
|
3
|
+
import { visualStyleShape } from "../../../core/dist/theme.js";
|
|
4
|
+
import { linkTargetSchema } from "../../../core/dist/author-schemas.js";
|
|
5
|
+
import "../../../core/dist/capability.js";
|
|
6
|
+
import { CommonNode } from "../../../core/dist/document.js";
|
|
7
|
+
import { motionPropsShape } from "../motion/motion-schemas.js";
|
|
8
|
+
import { optionalNameSchema } from "../shared/identity.js";
|
|
9
|
+
import { morphKeySchema } from "../shared/morph-api.js";
|
|
10
|
+
import { lineStrokeValueSchema } from "../shared/visual.js";
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
// ../capabilities/dist/line/line-declaration.js
|
|
13
|
+
const rawLineRoutingSchema = z.enum([
|
|
14
|
+
"straight",
|
|
15
|
+
"elbow",
|
|
16
|
+
"curved"
|
|
17
|
+
]);
|
|
18
|
+
const lineRoutingSchema = rawLineRoutingSchema;
|
|
19
|
+
const rawLinePortSchema = z.union([z.enum([
|
|
20
|
+
"top",
|
|
21
|
+
"right",
|
|
22
|
+
"bottom",
|
|
23
|
+
"left"
|
|
24
|
+
]), z.number().int().min(0)]);
|
|
25
|
+
const lineCoordinateSchema = z.number().finite().min(-1e6).max(1e6);
|
|
26
|
+
const rawLineEndpointSchema = z.union([z.strictObject({
|
|
27
|
+
id: authorIdSchema,
|
|
28
|
+
port: rawLinePortSchema
|
|
29
|
+
}).readonly(), z.strictObject({
|
|
30
|
+
x: lineCoordinateSchema,
|
|
31
|
+
y: lineCoordinateSchema
|
|
32
|
+
}).readonly()]);
|
|
33
|
+
const lineEndpointSchema = rawLineEndpointSchema;
|
|
34
|
+
const lineAdjustValueSchema = z.number().refine(Number.isSafeInteger, "Geometry adjust must be an integer DrawingML parameter");
|
|
35
|
+
const rawLineAdjustSchema = z.strictObject({
|
|
36
|
+
adj1: lineAdjustValueSchema.optional(),
|
|
37
|
+
adj2: lineAdjustValueSchema.optional(),
|
|
38
|
+
adj3: lineAdjustValueSchema.optional()
|
|
39
|
+
}).readonly();
|
|
40
|
+
const lineAdjustSchema = rawLineAdjustSchema;
|
|
41
|
+
const { padding: _padding, paddingTop: _paddingTop, paddingRight: _paddingRight, paddingBottom: _paddingBottom, paddingLeft: _paddingLeft, ...lineLayoutStyleShape } = layoutStyleShape;
|
|
42
|
+
const lineStyleObjectSchema = z.strictObject({
|
|
43
|
+
...lineLayoutStyleShape,
|
|
44
|
+
rotate: visualStyleShape.rotate,
|
|
45
|
+
flipH: visualStyleShape.flipH,
|
|
46
|
+
flipV: visualStyleShape.flipV,
|
|
47
|
+
opacity: visualStyleShape.opacity,
|
|
48
|
+
boxShadow: visualStyleShape.boxShadow
|
|
49
|
+
});
|
|
50
|
+
const lineStyleKeyList = Object.keys(lineStyleObjectSchema.shape);
|
|
51
|
+
const rawLineStyleSchema = lineStyleObjectSchema.readonly();
|
|
52
|
+
const lineStyleSchema = rawLineStyleSchema;
|
|
53
|
+
const lineDeclarationPropsObjectSchema = z.strictObject({
|
|
54
|
+
id: authorIdSchema.optional(),
|
|
55
|
+
name: optionalNameSchema.optional(),
|
|
56
|
+
morphKey: morphKeySchema.optional(),
|
|
57
|
+
link: linkTargetSchema.optional(),
|
|
58
|
+
routing: rawLineRoutingSchema.optional(),
|
|
59
|
+
adjust: rawLineAdjustSchema.optional(),
|
|
60
|
+
stroke: lineStrokeValueSchema.optional(),
|
|
61
|
+
from: rawLineEndpointSchema.optional(),
|
|
62
|
+
to: rawLineEndpointSchema.optional(),
|
|
63
|
+
style: rawLineStyleSchema.optional(),
|
|
64
|
+
...motionPropsShape
|
|
65
|
+
});
|
|
66
|
+
const lineAllowedPropKeyList = Object.keys(lineDeclarationPropsObjectSchema.shape);
|
|
67
|
+
lineDeclarationPropsObjectSchema.readonly();
|
|
68
|
+
/** Creates the editable native line/connector shared by the command factory and the Line JSX element. */
|
|
69
|
+
function createLineNode(props) {
|
|
70
|
+
return new CommonNode("line", "line", props);
|
|
71
|
+
}
|
|
72
|
+
export { createLineNode, lineAdjustSchema, lineAllowedPropKeyList, lineEndpointSchema, lineRoutingSchema, lineStrokeValueSchema, lineStyleKeyList, lineStyleSchema };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { hostNodeCreator } from "../../../core/dist/host.js";
|
|
2
|
+
import { motionElement } from "../motion/motion-elements.js";
|
|
3
|
+
import { createLineNode } from "./line-declaration.js";
|
|
4
|
+
// ../capabilities/dist/line/line-elements.js
|
|
5
|
+
/** Declares a native `<p:cxnSp>` line or connector within the React tree. */
|
|
6
|
+
function Line(props) {
|
|
7
|
+
return motionElement("line", {
|
|
8
|
+
...props,
|
|
9
|
+
[hostNodeCreator]: createLineNode
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export { Line };
|
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
import { pxToEmu } from "../../../emit/dist/ooxml.js";
|
|
2
|
+
import "../../../emit/dist/index.js";
|
|
3
|
+
import { A_NS, P_NS } from "../../../import/dist/namespaces.js";
|
|
4
|
+
import { ooxmlNonNegativeIntSchema, ooxmlPositiveIntSchema } from "../../../import/dist/xml-fragments.js";
|
|
5
|
+
import { readDrawingColor, readTransformXml } from "../../../import/dist/visual.js";
|
|
6
|
+
import { allocateScopedAuthorId } from "../../../import/dist/masters.js";
|
|
7
|
+
import "../../../import/dist/index.js";
|
|
8
|
+
import { readNonVisualCommonProperties } from "../shape/shape-import.js";
|
|
9
|
+
import { getGeometryConnectionSiteCount } from "../shared/geometry.js";
|
|
10
|
+
import { attachDeferredSlideLink, consumeNonPlaceholderNvPr } from "../shared/identity.js";
|
|
11
|
+
import { isPlaceholderSpElement } from "../shared/placeholder-import.js";
|
|
12
|
+
import { readSpPrAppearance } from "../shared/visual.js";
|
|
13
|
+
import { createLineNode } from "./line-declaration.js";
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
// ../capabilities/dist/line/line-import.js
|
|
16
|
+
const linePresetNames = /* @__PURE__ */ new Set([
|
|
17
|
+
"line",
|
|
18
|
+
"lineInv",
|
|
19
|
+
"straightConnector1",
|
|
20
|
+
"bentConnector2",
|
|
21
|
+
"bentConnector3",
|
|
22
|
+
"bentConnector4",
|
|
23
|
+
"bentConnector5",
|
|
24
|
+
"curvedConnector2",
|
|
25
|
+
"curvedConnector3",
|
|
26
|
+
"curvedConnector4",
|
|
27
|
+
"curvedConnector5"
|
|
28
|
+
]);
|
|
29
|
+
const fillElementNames = /* @__PURE__ */ new Set([
|
|
30
|
+
"solidFill",
|
|
31
|
+
"gradFill",
|
|
32
|
+
"blipFill",
|
|
33
|
+
"pattFill",
|
|
34
|
+
"grpFill"
|
|
35
|
+
]);
|
|
36
|
+
const connectionAttrSchema = z.object({
|
|
37
|
+
id: ooxmlPositiveIntSchema,
|
|
38
|
+
idx: ooxmlNonNegativeIntSchema
|
|
39
|
+
});
|
|
40
|
+
function directElementChild(parent, namespaceUri, localName) {
|
|
41
|
+
for (let child = parent.firstChild; child !== null; child = child.nextSibling) {
|
|
42
|
+
if (child.nodeType !== 1) continue;
|
|
43
|
+
const el = child;
|
|
44
|
+
if ((el.namespaceURI ?? "") === namespaceUri && (el.localName ?? el.tagName) === localName) return el;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function hasTextBoxFlag(spElement) {
|
|
48
|
+
const nvSpPr = directElementChild(spElement, P_NS, "nvSpPr");
|
|
49
|
+
if (nvSpPr === void 0) return false;
|
|
50
|
+
const cNvSpPr = directElementChild(nvSpPr, P_NS, "cNvSpPr");
|
|
51
|
+
if (cNvSpPr === void 0) return false;
|
|
52
|
+
const txBox = cNvSpPr.getAttribute("txBox");
|
|
53
|
+
return txBox === "1" || txBox === "true";
|
|
54
|
+
}
|
|
55
|
+
function hasEffectiveSpText(spElement) {
|
|
56
|
+
const txBody = directElementChild(spElement, P_NS, "txBody");
|
|
57
|
+
if (txBody === void 0) return false;
|
|
58
|
+
for (let child = txBody.firstChild; child !== null; child = child.nextSibling) {
|
|
59
|
+
if (child.nodeType !== 1) continue;
|
|
60
|
+
const pEl = child;
|
|
61
|
+
if ((pEl.namespaceURI ?? "") !== "http://schemas.openxmlformats.org/drawingml/2006/main" || (pEl.localName ?? pEl.tagName) !== "p") continue;
|
|
62
|
+
const pPr = directElementChild(pEl, A_NS, "pPr");
|
|
63
|
+
if (pPr !== void 0) {
|
|
64
|
+
if (directElementChild(pPr, "http://schemas.openxmlformats.org/drawingml/2006/main", "buChar") !== void 0 || directElementChild(pPr, "http://schemas.openxmlformats.org/drawingml/2006/main", "buAutoNum") !== void 0 || directElementChild(pPr, "http://schemas.openxmlformats.org/drawingml/2006/main", "defRPr") !== void 0) return true;
|
|
65
|
+
}
|
|
66
|
+
if (directElementChild(pEl, "http://schemas.openxmlformats.org/drawingml/2006/main", "r") !== void 0 || directElementChild(pEl, "http://schemas.openxmlformats.org/drawingml/2006/main", "fld") !== void 0 || directElementChild(pEl, "http://schemas.openxmlformats.org/drawingml/2006/main", "br") !== void 0) return true;
|
|
67
|
+
}
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Side-effect-free predicate matching `<p:sp>` elements that represent pure 1D lines or connectors
|
|
72
|
+
* (no fill, no effective text, and a `line` / `lineInv` / `*Connector*` preset geometry).
|
|
73
|
+
*/
|
|
74
|
+
function isLineNormalizedSpElement(cursor) {
|
|
75
|
+
if (isPlaceholderSpElement(cursor)) return false;
|
|
76
|
+
const spEl = cursor.element;
|
|
77
|
+
if (hasTextBoxFlag(spEl)) return false;
|
|
78
|
+
const spPr = directElementChild(spEl, P_NS, "spPr");
|
|
79
|
+
if (spPr === void 0) return false;
|
|
80
|
+
if (directElementChild(spPr, "http://schemas.openxmlformats.org/drawingml/2006/main", "custGeom") !== void 0) return false;
|
|
81
|
+
const prstGeom = directElementChild(spPr, A_NS, "prstGeom");
|
|
82
|
+
if (prstGeom === void 0) return false;
|
|
83
|
+
const prst = prstGeom.getAttribute("prst") ?? "";
|
|
84
|
+
if (!linePresetNames.has(prst)) return false;
|
|
85
|
+
for (let child = spPr.firstChild; child !== null; child = child.nextSibling) {
|
|
86
|
+
if (child.nodeType !== 1) continue;
|
|
87
|
+
const el = child;
|
|
88
|
+
if ((el.namespaceURI ?? "") === "http://schemas.openxmlformats.org/drawingml/2006/main" && fillElementNames.has(el.localName ?? el.tagName)) return false;
|
|
89
|
+
}
|
|
90
|
+
const pStyle = directElementChild(spEl, P_NS, "style");
|
|
91
|
+
if (pStyle !== void 0) {
|
|
92
|
+
const fillRef = directElementChild(pStyle, A_NS, "fillRef");
|
|
93
|
+
if (fillRef !== void 0) {
|
|
94
|
+
const idx = fillRef.getAttribute("idx");
|
|
95
|
+
if (idx !== null && idx !== "" && idx !== "0") return false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
if (hasEffectiveSpText(spEl)) return false;
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
function readStyleLnRefColor(parentCursor, location, diagnostics) {
|
|
102
|
+
const styleCursor = parentCursor.child(P_NS, "style");
|
|
103
|
+
if (styleCursor === void 0) return void 0;
|
|
104
|
+
const lnRef = styleCursor.child(A_NS, "lnRef");
|
|
105
|
+
let lnColor;
|
|
106
|
+
if (lnRef !== void 0) {
|
|
107
|
+
const idxStr = lnRef.attr("idx") ?? "0";
|
|
108
|
+
const parsedColor = readDrawingColor(lnRef, location, diagnostics);
|
|
109
|
+
if (idxStr !== "0") lnColor = parsedColor;
|
|
110
|
+
}
|
|
111
|
+
styleCursor.suppressUnconsumed();
|
|
112
|
+
return lnColor;
|
|
113
|
+
}
|
|
114
|
+
function mapLineGeometry(geometry, location, diagnostics) {
|
|
115
|
+
if (geometry === void 0) return {
|
|
116
|
+
routing: "straight",
|
|
117
|
+
invertFlipV: false
|
|
118
|
+
};
|
|
119
|
+
if (typeof geometry !== "string" && geometry.type === "custom") {
|
|
120
|
+
diagnostics.push({
|
|
121
|
+
code: "compatibility-fallback",
|
|
122
|
+
category: "unsupported",
|
|
123
|
+
disposition: "fallback",
|
|
124
|
+
location,
|
|
125
|
+
preferredMechanism: "custom-geometry-connector",
|
|
126
|
+
selectedFallback: "line",
|
|
127
|
+
loss: {
|
|
128
|
+
lost: "native-mechanism",
|
|
129
|
+
retainedAs: "line"
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
return {
|
|
133
|
+
routing: "straight",
|
|
134
|
+
invertFlipV: false
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
const name = typeof geometry === "string" ? geometry : geometry.name;
|
|
138
|
+
const rawAdjust = typeof geometry === "string" ? void 0 : geometry.adjust;
|
|
139
|
+
if (name === "line" || name === "straightConnector1") return {
|
|
140
|
+
routing: "straight",
|
|
141
|
+
invertFlipV: false
|
|
142
|
+
};
|
|
143
|
+
if (name === "lineInv") return {
|
|
144
|
+
routing: "straight",
|
|
145
|
+
invertFlipV: true
|
|
146
|
+
};
|
|
147
|
+
if (name.startsWith("bentConnector") || name.startsWith("curvedConnector")) {
|
|
148
|
+
const routing = name.startsWith("bentConnector") ? "elbow" : "curved";
|
|
149
|
+
if (name.endsWith("2")) return {
|
|
150
|
+
routing,
|
|
151
|
+
adjust: {},
|
|
152
|
+
invertFlipV: false
|
|
153
|
+
};
|
|
154
|
+
const adjust = {
|
|
155
|
+
...rawAdjust?.["adj1"] === void 0 ? {} : { adj1: rawAdjust["adj1"] },
|
|
156
|
+
...rawAdjust?.["adj2"] === void 0 || name.endsWith("3") ? {} : { adj2: rawAdjust["adj2"] },
|
|
157
|
+
...rawAdjust?.["adj3"] === void 0 || !name.endsWith("5") ? {} : { adj3: rawAdjust["adj3"] }
|
|
158
|
+
};
|
|
159
|
+
return {
|
|
160
|
+
routing,
|
|
161
|
+
...Object.keys(adjust).length === 0 ? {} : { adjust },
|
|
162
|
+
invertFlipV: false
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
diagnostics.push({
|
|
166
|
+
code: "compatibility-fallback",
|
|
167
|
+
category: "unsupported",
|
|
168
|
+
disposition: "fallback",
|
|
169
|
+
location,
|
|
170
|
+
preferredMechanism: `preset:${name}`,
|
|
171
|
+
selectedFallback: "line",
|
|
172
|
+
loss: {
|
|
173
|
+
lost: "native-mechanism",
|
|
174
|
+
retainedAs: "line"
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
return {
|
|
178
|
+
routing: "straight",
|
|
179
|
+
invertFlipV: false
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
function readEndpointRef(cNvCxnSpPr, tagName, location, diagnostics) {
|
|
183
|
+
const el = cNvCxnSpPr.child(A_NS, tagName);
|
|
184
|
+
if (el === void 0) return void 0;
|
|
185
|
+
const raw = el.attrsObject(["id", "idx"]);
|
|
186
|
+
const parsed = connectionAttrSchema.safeParse(raw);
|
|
187
|
+
if (!parsed.success) {
|
|
188
|
+
diagnostics.push({
|
|
189
|
+
code: "invalid-xml-value",
|
|
190
|
+
category: "corrupt-input",
|
|
191
|
+
disposition: "omitted",
|
|
192
|
+
location: {
|
|
193
|
+
...location,
|
|
194
|
+
xpath: el.xpath
|
|
195
|
+
},
|
|
196
|
+
attributeOrElement: `a:${tagName}`,
|
|
197
|
+
rawValue: JSON.stringify(raw)
|
|
198
|
+
});
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
return parsed.data;
|
|
202
|
+
}
|
|
203
|
+
function indexToPort(idx) {
|
|
204
|
+
switch (idx) {
|
|
205
|
+
case 0: return "top";
|
|
206
|
+
case 1: return "left";
|
|
207
|
+
case 2: return "bottom";
|
|
208
|
+
case 3: return "right";
|
|
209
|
+
default: return idx;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function buildLineNodeFromSpPr(args) {
|
|
213
|
+
const { context, spPr, lnRefColor, objectId, objectName, link, mapBox, diagnostics } = args;
|
|
214
|
+
const location = {
|
|
215
|
+
part: context.part,
|
|
216
|
+
slideIndex: context.slideIndex,
|
|
217
|
+
...objectId === void 0 ? {} : { objectId },
|
|
218
|
+
...objectName === void 0 ? {} : { objectName }
|
|
219
|
+
};
|
|
220
|
+
let transform;
|
|
221
|
+
const xfrmCursor = spPr.child(A_NS, "xfrm");
|
|
222
|
+
if (xfrmCursor !== void 0) transform = readTransformXml(xfrmCursor, location, diagnostics, { allowSingleZeroExtent: true });
|
|
223
|
+
else diagnostics.push({
|
|
224
|
+
code: "corrupt-part",
|
|
225
|
+
category: "corrupt-input",
|
|
226
|
+
disposition: "omitted",
|
|
227
|
+
location: {
|
|
228
|
+
...location,
|
|
229
|
+
xpath: spPr.xpath
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
if (transform === void 0) return void 0;
|
|
233
|
+
const appearance = readSpPrAppearance(spPr, context.package, {
|
|
234
|
+
w: transform.cxEmu,
|
|
235
|
+
h: transform.cyEmu
|
|
236
|
+
}, location, diagnostics);
|
|
237
|
+
const mappedBox = mapBox ? mapBox({
|
|
238
|
+
x: transform.x,
|
|
239
|
+
y: transform.y,
|
|
240
|
+
width: transform.width,
|
|
241
|
+
height: transform.height
|
|
242
|
+
}) : {
|
|
243
|
+
x: transform.x,
|
|
244
|
+
y: transform.y,
|
|
245
|
+
width: transform.width,
|
|
246
|
+
height: transform.height
|
|
247
|
+
};
|
|
248
|
+
const { routing, adjust, invertFlipV } = mapLineGeometry(appearance.geometry, {
|
|
249
|
+
...location,
|
|
250
|
+
xpath: spPr.xpath
|
|
251
|
+
}, diagnostics);
|
|
252
|
+
const effectiveFlipH = transform.flipH === true;
|
|
253
|
+
const effectiveFlipV = invertFlipV ? transform.flipV !== true : transform.flipV === true;
|
|
254
|
+
const rawBorder = appearance.style.border;
|
|
255
|
+
const borderArrows = appearance.borderArrows;
|
|
256
|
+
let stroke;
|
|
257
|
+
if (rawBorder === "none") stroke = "none";
|
|
258
|
+
else if (rawBorder !== void 0) stroke = {
|
|
259
|
+
color: rawBorder.color,
|
|
260
|
+
...rawBorder.width === void 0 ? {} : { width: rawBorder.width },
|
|
261
|
+
...rawBorder.style === void 0 ? {} : { style: rawBorder.style },
|
|
262
|
+
...borderArrows?.startArrow === void 0 ? {} : { startArrow: borderArrows.startArrow },
|
|
263
|
+
...borderArrows?.endArrow === void 0 ? {} : { endArrow: borderArrows.endArrow }
|
|
264
|
+
};
|
|
265
|
+
else if (lnRefColor !== void 0) stroke = {
|
|
266
|
+
color: lnRefColor,
|
|
267
|
+
width: 1,
|
|
268
|
+
style: "solid"
|
|
269
|
+
};
|
|
270
|
+
else stroke = "none";
|
|
271
|
+
const lineStyle = {
|
|
272
|
+
position: "absolute",
|
|
273
|
+
left: mappedBox.x,
|
|
274
|
+
top: mappedBox.y,
|
|
275
|
+
width: mappedBox.width,
|
|
276
|
+
height: mappedBox.height,
|
|
277
|
+
...transform.rotate === void 0 ? {} : { rotate: transform.rotate },
|
|
278
|
+
...effectiveFlipH ? { flipH: true } : {},
|
|
279
|
+
...effectiveFlipV ? { flipV: true } : {},
|
|
280
|
+
...appearance.style.boxShadow === void 0 ? {} : { boxShadow: appearance.style.boxShadow }
|
|
281
|
+
};
|
|
282
|
+
const props = {
|
|
283
|
+
...objectName === void 0 ? {} : { name: objectName },
|
|
284
|
+
...link === void 0 ? {} : { link },
|
|
285
|
+
...routing === "straight" ? {} : { routing },
|
|
286
|
+
...adjust === void 0 ? {} : { adjust },
|
|
287
|
+
stroke,
|
|
288
|
+
style: lineStyle
|
|
289
|
+
};
|
|
290
|
+
return {
|
|
291
|
+
node: createLineNode(props),
|
|
292
|
+
mappedBox,
|
|
293
|
+
flipH: effectiveFlipH,
|
|
294
|
+
flipV: effectiveFlipV,
|
|
295
|
+
rotate: transform.rotate
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
/** Imports `<p:cxnSp>` connectors and restores `from`/`to` endpoints when targets resolve in scope. */
|
|
299
|
+
function readLineCxnSp(context, mapBox) {
|
|
300
|
+
const { cursor, part, slideIndex } = context;
|
|
301
|
+
const diagnostics = [];
|
|
302
|
+
const nvCxnSpPr = cursor.child(P_NS, "nvCxnSpPr");
|
|
303
|
+
if (nvCxnSpPr === void 0) {
|
|
304
|
+
diagnostics.push({
|
|
305
|
+
code: "corrupt-part",
|
|
306
|
+
category: "corrupt-input",
|
|
307
|
+
disposition: "omitted",
|
|
308
|
+
location: {
|
|
309
|
+
part,
|
|
310
|
+
xpath: cursor.xpath,
|
|
311
|
+
slideIndex
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
return { diagnostics };
|
|
315
|
+
}
|
|
316
|
+
const cNvPr = nvCxnSpPr.child(P_NS, "cNvPr");
|
|
317
|
+
const { objectId, objectName, link, deferredSlideLink } = readNonVisualCommonProperties(cNvPr, context, diagnostics);
|
|
318
|
+
const location = {
|
|
319
|
+
part,
|
|
320
|
+
slideIndex,
|
|
321
|
+
...objectId === void 0 ? {} : { objectId },
|
|
322
|
+
...objectName === void 0 ? {} : { objectName }
|
|
323
|
+
};
|
|
324
|
+
const cNvCxnSpPr = nvCxnSpPr.child(P_NS, "cNvCxnSpPr");
|
|
325
|
+
const stCxn = cNvCxnSpPr === void 0 ? void 0 : readEndpointRef(cNvCxnSpPr, "stCxn", location, diagnostics);
|
|
326
|
+
const endCxn = cNvCxnSpPr === void 0 ? void 0 : readEndpointRef(cNvCxnSpPr, "endCxn", location, diagnostics);
|
|
327
|
+
cNvCxnSpPr?.suppressUnconsumed();
|
|
328
|
+
consumeNonPlaceholderNvPr(nvCxnSpPr);
|
|
329
|
+
const spPr = cursor.child(P_NS, "spPr");
|
|
330
|
+
if (spPr === void 0) {
|
|
331
|
+
diagnostics.push({
|
|
332
|
+
code: "corrupt-part",
|
|
333
|
+
category: "corrupt-input",
|
|
334
|
+
disposition: "omitted",
|
|
335
|
+
location: {
|
|
336
|
+
...location,
|
|
337
|
+
xpath: cursor.xpath
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
return { diagnostics };
|
|
341
|
+
}
|
|
342
|
+
const built = buildLineNodeFromSpPr({
|
|
343
|
+
context,
|
|
344
|
+
spPr,
|
|
345
|
+
lnRefColor: readStyleLnRefColor(cursor, location, diagnostics),
|
|
346
|
+
objectId,
|
|
347
|
+
objectName,
|
|
348
|
+
link,
|
|
349
|
+
...mapBox === void 0 ? {} : { mapBox },
|
|
350
|
+
diagnostics
|
|
351
|
+
});
|
|
352
|
+
if (built === void 0) return { diagnostics };
|
|
353
|
+
attachDeferredSlideLink(built.node, deferredSlideLink, context);
|
|
354
|
+
if ((stCxn !== void 0 || endCxn !== void 0) && context.registerDeferredConnector !== void 0) {
|
|
355
|
+
const { node, mappedBox, flipH, flipV, rotate } = built;
|
|
356
|
+
const startPt = {
|
|
357
|
+
x: flipH ? mappedBox.x + mappedBox.width : mappedBox.x,
|
|
358
|
+
y: flipV ? mappedBox.y + mappedBox.height : mappedBox.y
|
|
359
|
+
};
|
|
360
|
+
const endPt = {
|
|
361
|
+
x: flipH ? mappedBox.x : mappedBox.x + mappedBox.width,
|
|
362
|
+
y: flipV ? mappedBox.y : mappedBox.y + mappedBox.height
|
|
363
|
+
};
|
|
364
|
+
context.registerDeferredConnector((scopeCtx) => {
|
|
365
|
+
const emitFallbackDiagnostic = () => {
|
|
366
|
+
scopeCtx.diagnostics.push({
|
|
367
|
+
code: "compatibility-fallback",
|
|
368
|
+
category: "unsupported",
|
|
369
|
+
disposition: "fallback",
|
|
370
|
+
location: {
|
|
371
|
+
...location,
|
|
372
|
+
xpath: cursor.xpath
|
|
373
|
+
},
|
|
374
|
+
preferredMechanism: "connector-anchor",
|
|
375
|
+
selectedFallback: "line",
|
|
376
|
+
loss: {
|
|
377
|
+
lost: "native-mechanism",
|
|
378
|
+
retainedAs: "line"
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
};
|
|
382
|
+
if (rotate !== void 0 && rotate !== 0 || pxToEmu(mappedBox.width) === 0 && pxToEmu(mappedBox.height) === 0) {
|
|
383
|
+
emitFallbackDiagnostic();
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
const targetSiteCount = (target) => target.type === "shape" ? getGeometryConnectionSiteCount(target.props["geometry"]) : 4;
|
|
387
|
+
const resolveImportedSide = (cxn, fallbackPoint) => {
|
|
388
|
+
if (cxn === void 0) return {
|
|
389
|
+
x: fallbackPoint.x,
|
|
390
|
+
y: fallbackPoint.y
|
|
391
|
+
};
|
|
392
|
+
const target = scopeCtx.scopeObjectsBySpid.get(cxn.id);
|
|
393
|
+
if (target === void 0 || target === node) return void 0;
|
|
394
|
+
if (cxn.idx < 0 || cxn.idx >= targetSiteCount(target)) return;
|
|
395
|
+
let targetId = typeof target.props["id"] === "string" && target.props["id"].trim().length > 0 ? target.props["id"] : void 0;
|
|
396
|
+
if (targetId === void 0) {
|
|
397
|
+
const targetName = typeof target.props["name"] === "string" ? target.props["name"] : void 0;
|
|
398
|
+
targetId = allocateScopedAuthorId(targetName, scopeCtx.usedAuthorIds, `obj-${cxn.id}`);
|
|
399
|
+
target.set({ id: targetId });
|
|
400
|
+
}
|
|
401
|
+
return {
|
|
402
|
+
id: targetId,
|
|
403
|
+
port: indexToPort(cxn.idx)
|
|
404
|
+
};
|
|
405
|
+
};
|
|
406
|
+
const fromEndpoint = resolveImportedSide(stCxn, startPt);
|
|
407
|
+
const toEndpoint = resolveImportedSide(endCxn, endPt);
|
|
408
|
+
if (fromEndpoint === void 0 || toEndpoint === void 0) {
|
|
409
|
+
emitFallbackDiagnostic();
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
node.style({
|
|
413
|
+
position: void 0,
|
|
414
|
+
left: void 0,
|
|
415
|
+
top: void 0,
|
|
416
|
+
width: void 0,
|
|
417
|
+
height: void 0,
|
|
418
|
+
flipH: void 0,
|
|
419
|
+
flipV: void 0,
|
|
420
|
+
rotate: void 0
|
|
421
|
+
});
|
|
422
|
+
node.set({
|
|
423
|
+
from: fromEndpoint,
|
|
424
|
+
to: toEndpoint
|
|
425
|
+
});
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
return {
|
|
429
|
+
node: built.node,
|
|
430
|
+
diagnostics
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
/** Normalizes no-fill, no-text `line` / `lineInv` / `*Connector*` `<p:sp>` elements into `<Line>`. */
|
|
434
|
+
function readLineSp(context, mapBox) {
|
|
435
|
+
const { cursor, part, slideIndex } = context;
|
|
436
|
+
const diagnostics = [];
|
|
437
|
+
const nvSpPr = cursor.child(P_NS, "nvSpPr");
|
|
438
|
+
if (nvSpPr === void 0) {
|
|
439
|
+
diagnostics.push({
|
|
440
|
+
code: "corrupt-part",
|
|
441
|
+
category: "corrupt-input",
|
|
442
|
+
disposition: "omitted",
|
|
443
|
+
location: {
|
|
444
|
+
part,
|
|
445
|
+
xpath: cursor.xpath,
|
|
446
|
+
slideIndex
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
return { diagnostics };
|
|
450
|
+
}
|
|
451
|
+
const cNvPr = nvSpPr.child(P_NS, "cNvPr");
|
|
452
|
+
const { objectId, objectName, link, deferredSlideLink } = readNonVisualCommonProperties(cNvPr, context, diagnostics);
|
|
453
|
+
nvSpPr.child(P_NS, "cNvSpPr")?.consumeAttr("txBox");
|
|
454
|
+
consumeNonPlaceholderNvPr(nvSpPr);
|
|
455
|
+
const location = {
|
|
456
|
+
part,
|
|
457
|
+
slideIndex,
|
|
458
|
+
...objectId === void 0 ? {} : { objectId },
|
|
459
|
+
...objectName === void 0 ? {} : { objectName }
|
|
460
|
+
};
|
|
461
|
+
const spPr = cursor.child(P_NS, "spPr");
|
|
462
|
+
if (spPr === void 0) {
|
|
463
|
+
diagnostics.push({
|
|
464
|
+
code: "corrupt-part",
|
|
465
|
+
category: "corrupt-input",
|
|
466
|
+
disposition: "omitted",
|
|
467
|
+
location: {
|
|
468
|
+
...location,
|
|
469
|
+
xpath: cursor.xpath
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
return { diagnostics };
|
|
473
|
+
}
|
|
474
|
+
const lnRefColor = readStyleLnRefColor(cursor, location, diagnostics);
|
|
475
|
+
cursor.child(P_NS, "txBody")?.suppressUnconsumed();
|
|
476
|
+
const built = buildLineNodeFromSpPr({
|
|
477
|
+
context,
|
|
478
|
+
spPr,
|
|
479
|
+
lnRefColor,
|
|
480
|
+
objectId,
|
|
481
|
+
objectName,
|
|
482
|
+
link,
|
|
483
|
+
...mapBox === void 0 ? {} : { mapBox },
|
|
484
|
+
diagnostics
|
|
485
|
+
});
|
|
486
|
+
if (built === void 0) return { diagnostics };
|
|
487
|
+
attachDeferredSlideLink(built.node, deferredSlideLink, context);
|
|
488
|
+
return {
|
|
489
|
+
node: built.node,
|
|
490
|
+
diagnostics
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
const connectorLineImportHandler = {
|
|
494
|
+
target: "shape-tree",
|
|
495
|
+
localName: "cxnSp",
|
|
496
|
+
read: (context) => readLineCxnSp(context)
|
|
497
|
+
};
|
|
498
|
+
const presetLineShapeImportHandler = {
|
|
499
|
+
target: "shape-tree",
|
|
500
|
+
localName: "sp",
|
|
501
|
+
matches: isLineNormalizedSpElement,
|
|
502
|
+
read: (context) => readLineSp(context)
|
|
503
|
+
};
|
|
504
|
+
export { connectorLineImportHandler, isLineNormalizedSpElement, presetLineShapeImportHandler, readLineCxnSp, readLineSp };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// ../capabilities/dist/line/line-xml.js
|
|
2
|
+
/** Internal PresentationML wrapper for native `<p:cxnSp>` connector objects. */
|
|
3
|
+
function lineXml(id, escapedName, properties, linkXml, connection) {
|
|
4
|
+
const stCxn = connection?.start === void 0 ? "" : `<a:stCxn id="${connection.start.id}" idx="${connection.start.idx}"/>`;
|
|
5
|
+
const endCxn = connection?.end === void 0 ? "" : `<a:endCxn id="${connection.end.id}" idx="${connection.end.idx}"/>`;
|
|
6
|
+
const cxnBody = stCxn === "" && endCxn === "" ? "" : `${stCxn}${endCxn}`;
|
|
7
|
+
return `<p:cxnSp><p:nvCxnSpPr><p:cNvPr id="${id}" name="${escapedName}">${linkXml}</p:cNvPr>${cxnBody === "" ? "<p:cNvCxnSpPr/>" : `<p:cNvCxnSpPr>${cxnBody}</p:cNvCxnSpPr>`}<p:nvPr/></p:nvCxnSpPr>${properties}</p:cxnSp>`;
|
|
8
|
+
}
|
|
9
|
+
export { lineXml };
|