@superdoc-dev/cli 0.2.0-next.20 → 0.2.0-next.21
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/index.js +300 -62
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -26618,7 +26618,7 @@ var init_remark_gfm_z_sDF4ss_es = __esm(() => {
|
|
|
26618
26618
|
emptyOptions2 = {};
|
|
26619
26619
|
});
|
|
26620
26620
|
|
|
26621
|
-
// ../../packages/superdoc/dist/chunks/SuperConverter-
|
|
26621
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-BJBbuXuZ.es.js
|
|
26622
26622
|
function getExtensionConfigField(extension$1, field, context = { name: "" }) {
|
|
26623
26623
|
const fieldValue = extension$1.config[field];
|
|
26624
26624
|
if (typeof fieldValue === "function")
|
|
@@ -30840,6 +30840,64 @@ function extractFillColor(spPr, style) {
|
|
|
30840
30840
|
}
|
|
30841
30841
|
return null;
|
|
30842
30842
|
}
|
|
30843
|
+
function extractCustomGeometry(spPr) {
|
|
30844
|
+
const custGeom = spPr?.elements?.find((el) => el.name === "a:custGeom");
|
|
30845
|
+
if (!custGeom)
|
|
30846
|
+
return null;
|
|
30847
|
+
const pathLst = custGeom.elements?.find((el) => el.name === "a:pathLst");
|
|
30848
|
+
if (!pathLst?.elements)
|
|
30849
|
+
return null;
|
|
30850
|
+
const paths = pathLst.elements.filter((el) => el.name === "a:path").map((pathEl) => {
|
|
30851
|
+
const w = parseInt(pathEl.attributes?.["w"] || "0", 10);
|
|
30852
|
+
const h = parseInt(pathEl.attributes?.["h"] || "0", 10);
|
|
30853
|
+
return {
|
|
30854
|
+
d: convertDrawingMLPathToSvg(pathEl),
|
|
30855
|
+
w,
|
|
30856
|
+
h
|
|
30857
|
+
};
|
|
30858
|
+
}).filter((p) => p.d);
|
|
30859
|
+
if (paths.length === 0)
|
|
30860
|
+
return null;
|
|
30861
|
+
return { paths };
|
|
30862
|
+
}
|
|
30863
|
+
function convertDrawingMLPathToSvg(pathEl) {
|
|
30864
|
+
if (!pathEl?.elements)
|
|
30865
|
+
return "";
|
|
30866
|
+
const parts = [];
|
|
30867
|
+
for (const cmd of pathEl.elements)
|
|
30868
|
+
switch (cmd.name) {
|
|
30869
|
+
case "a:moveTo": {
|
|
30870
|
+
const pt = cmd.elements?.find((el) => el.name === "a:pt");
|
|
30871
|
+
if (pt)
|
|
30872
|
+
parts.push(`M ${pt.attributes?.["x"] || 0} ${pt.attributes?.["y"] || 0}`);
|
|
30873
|
+
break;
|
|
30874
|
+
}
|
|
30875
|
+
case "a:lnTo": {
|
|
30876
|
+
const pt = cmd.elements?.find((el) => el.name === "a:pt");
|
|
30877
|
+
if (pt)
|
|
30878
|
+
parts.push(`L ${pt.attributes?.["x"] || 0} ${pt.attributes?.["y"] || 0}`);
|
|
30879
|
+
break;
|
|
30880
|
+
}
|
|
30881
|
+
case "a:cubicBezTo": {
|
|
30882
|
+
const pts = cmd.elements?.filter((el) => el.name === "a:pt") || [];
|
|
30883
|
+
if (pts.length === 3)
|
|
30884
|
+
parts.push(`C ${pts[0].attributes?.["x"] || 0} ${pts[0].attributes?.["y"] || 0} ${pts[1].attributes?.["x"] || 0} ${pts[1].attributes?.["y"] || 0} ${pts[2].attributes?.["x"] || 0} ${pts[2].attributes?.["y"] || 0}`);
|
|
30885
|
+
break;
|
|
30886
|
+
}
|
|
30887
|
+
case "a:quadBezTo": {
|
|
30888
|
+
const pts = cmd.elements?.filter((el) => el.name === "a:pt") || [];
|
|
30889
|
+
if (pts.length === 2)
|
|
30890
|
+
parts.push(`Q ${pts[0].attributes?.["x"] || 0} ${pts[0].attributes?.["y"] || 0} ${pts[1].attributes?.["x"] || 0} ${pts[1].attributes?.["y"] || 0}`);
|
|
30891
|
+
break;
|
|
30892
|
+
}
|
|
30893
|
+
case "a:close":
|
|
30894
|
+
parts.push("Z");
|
|
30895
|
+
break;
|
|
30896
|
+
default:
|
|
30897
|
+
break;
|
|
30898
|
+
}
|
|
30899
|
+
return parts.join(" ");
|
|
30900
|
+
}
|
|
30843
30901
|
function extractGradientFill(gradFill) {
|
|
30844
30902
|
const gradient = {
|
|
30845
30903
|
type: "gradient",
|
|
@@ -31867,7 +31925,7 @@ function extractTextFromTextBox(textBoxContent, bodyPr, params = {}) {
|
|
|
31867
31925
|
wrap: wrap$1
|
|
31868
31926
|
};
|
|
31869
31927
|
}
|
|
31870
|
-
function getVectorShape({ params, node: node3, graphicData, size, marginOffset, anchorData, wrap: wrap$1, isAnchor }) {
|
|
31928
|
+
function getVectorShape({ params, node: node3, graphicData, size, marginOffset, anchorData, wrap: wrap$1, isAnchor, customGeometry }) {
|
|
31871
31929
|
const schemaAttrs = {};
|
|
31872
31930
|
const drawingNode = params.nodes?.[0];
|
|
31873
31931
|
if (drawingNode?.name === "w:drawing")
|
|
@@ -31879,9 +31937,14 @@ function getVectorShape({ params, node: node3, graphicData, size, marginOffset,
|
|
|
31879
31937
|
if (!spPr)
|
|
31880
31938
|
return null;
|
|
31881
31939
|
const shapeKind = spPr.elements?.find((el) => el.name === "a:prstGeom")?.attributes?.["prst"];
|
|
31882
|
-
if (!shapeKind)
|
|
31883
|
-
console.warn("Shape kind not found");
|
|
31884
31940
|
schemaAttrs.kind = shapeKind;
|
|
31941
|
+
if (customGeometry)
|
|
31942
|
+
schemaAttrs.customGeometry = customGeometry;
|
|
31943
|
+
else if (!shapeKind) {
|
|
31944
|
+
const extracted = extractCustomGeometry(spPr);
|
|
31945
|
+
if (extracted)
|
|
31946
|
+
schemaAttrs.customGeometry = extracted;
|
|
31947
|
+
}
|
|
31885
31948
|
const width = size?.width ?? DEFAULT_SHAPE_WIDTH;
|
|
31886
31949
|
const height = size?.height ?? DEFAULT_SHAPE_HEIGHT;
|
|
31887
31950
|
const xfrm = spPr.elements?.find((el) => el.name === "a:xfrm");
|
|
@@ -48433,7 +48496,10 @@ var isRegExp = (value) => {
|
|
|
48433
48496
|
}, handleShapeDrawing = (params, node3, graphicData, size, padding, marginOffset, anchorData, wrap$1, isAnchor, isHidden) => {
|
|
48434
48497
|
const wsp = graphicData.elements.find((el) => el.name === "wps:wsp");
|
|
48435
48498
|
const textBoxContent = wsp.elements.find((el) => el.name === "wps:txbx")?.elements?.find((el) => el.name === "w:txbxContent");
|
|
48436
|
-
|
|
48499
|
+
const spPr = wsp.elements.find((el) => el.name === "wps:spPr");
|
|
48500
|
+
const shapeType = spPr?.elements.find((el) => el.name === "a:prstGeom")?.attributes["prst"];
|
|
48501
|
+
const custGeom = !shapeType ? extractCustomGeometry(spPr) : null;
|
|
48502
|
+
if (shapeType || custGeom) {
|
|
48437
48503
|
const result = getVectorShape({
|
|
48438
48504
|
params,
|
|
48439
48505
|
node: node3,
|
|
@@ -48442,7 +48508,8 @@ var isRegExp = (value) => {
|
|
|
48442
48508
|
marginOffset,
|
|
48443
48509
|
anchorData,
|
|
48444
48510
|
wrap: wrap$1,
|
|
48445
|
-
isAnchor
|
|
48511
|
+
isAnchor,
|
|
48512
|
+
customGeometry: custGeom
|
|
48446
48513
|
});
|
|
48447
48514
|
if (result?.attrs && isHidden)
|
|
48448
48515
|
result.attrs.hidden = true;
|
|
@@ -48494,6 +48561,7 @@ var isRegExp = (value) => {
|
|
|
48494
48561
|
if (!spPr)
|
|
48495
48562
|
return null;
|
|
48496
48563
|
const shapeKind = spPr.elements?.find((el) => el.name === "a:prstGeom")?.attributes?.["prst"];
|
|
48564
|
+
const customGeom = !shapeKind ? extractCustomGeometry(spPr) : null;
|
|
48497
48565
|
const shapeXfrm = spPr.elements?.find((el) => el.name === "a:xfrm");
|
|
48498
48566
|
const shapeOff = shapeXfrm?.elements?.find((el) => el.name === "a:off");
|
|
48499
48567
|
const shapeExt = shapeXfrm?.elements?.find((el) => el.name === "a:ext");
|
|
@@ -48538,6 +48606,7 @@ var isRegExp = (value) => {
|
|
|
48538
48606
|
shapeType: "vectorShape",
|
|
48539
48607
|
attrs: {
|
|
48540
48608
|
kind: shapeKind,
|
|
48609
|
+
customGeometry: customGeom || undefined,
|
|
48541
48610
|
x,
|
|
48542
48611
|
y,
|
|
48543
48612
|
width,
|
|
@@ -53731,7 +53800,7 @@ var isRegExp = (value) => {
|
|
|
53731
53800
|
state.kern = kernNode.attributes["w:val"];
|
|
53732
53801
|
}
|
|
53733
53802
|
}, SuperConverter;
|
|
53734
|
-
var
|
|
53803
|
+
var init_SuperConverter_BJBbuXuZ_es = __esm(() => {
|
|
53735
53804
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
53736
53805
|
init_jszip_ChlR43oI_es();
|
|
53737
53806
|
init_xml_js_DLE8mr0n_es();
|
|
@@ -93008,9 +93077,9 @@ var init_remark_gfm_CQ3Jg4PR_es = __esm(() => {
|
|
|
93008
93077
|
init_remark_gfm_z_sDF4ss_es();
|
|
93009
93078
|
});
|
|
93010
93079
|
|
|
93011
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
93012
|
-
var
|
|
93013
|
-
__export(
|
|
93080
|
+
// ../../packages/superdoc/dist/chunks/src-DEQEar7E.es.js
|
|
93081
|
+
var exports_src_DEQEar7E_es = {};
|
|
93082
|
+
__export(exports_src_DEQEar7E_es, {
|
|
93014
93083
|
zt: () => defineMark,
|
|
93015
93084
|
z: () => cM,
|
|
93016
93085
|
yt: () => removeAwarenessStates,
|
|
@@ -113465,7 +113534,8 @@ async function measureDrawingBlock(block, constraints) {
|
|
|
113465
113534
|
const rotatedBounds = calculateRotatedBounds(geometry);
|
|
113466
113535
|
const naturalWidth = Math.max(1, rotatedBounds.width);
|
|
113467
113536
|
const naturalHeight = Math.max(1, rotatedBounds.height);
|
|
113468
|
-
const
|
|
113537
|
+
const isFloating = block.wrap?.type === "None";
|
|
113538
|
+
const maxWidth = fullWidthMax ?? (constraints.maxWidth > 0 && !isFloating ? constraints.maxWidth : naturalWidth);
|
|
113469
113539
|
const maxHeight = block.anchor?.isAnchored && (typeof block.anchor?.offsetV === "number" && block.anchor.offsetV < 0 || typeof block.margin?.top === "number" && block.margin.top < 0) || !constraints.maxHeight || constraints.maxHeight <= 0 ? Infinity : constraints.maxHeight;
|
|
113470
113540
|
const widthScale = maxWidth / naturalWidth;
|
|
113471
113541
|
const heightScale = maxHeight / naturalHeight;
|
|
@@ -150348,6 +150418,7 @@ var Node$13 = class Node$14 {
|
|
|
150348
150418
|
attrs: attrsWithPm,
|
|
150349
150419
|
geometry,
|
|
150350
150420
|
shapeKind: typeof rawAttrs.kind === "string" ? rawAttrs.kind : undefined,
|
|
150421
|
+
customGeometry: rawAttrs.customGeometry != null ? rawAttrs.customGeometry : undefined,
|
|
150351
150422
|
fillColor: normalizeFillColor(rawAttrs.fillColor),
|
|
150352
150423
|
strokeColor: normalizeStrokeColor(rawAttrs.strokeColor),
|
|
150353
150424
|
strokeWidth: coerceNumber(rawAttrs.strokeWidth),
|
|
@@ -159843,7 +159914,8 @@ var Node$13 = class Node$14 {
|
|
|
159843
159914
|
transforms.push(`scale(1, -1) translate(0, ${-height})`);
|
|
159844
159915
|
if (transforms.length > 0)
|
|
159845
159916
|
g$1.setAttribute("transform", transforms.join(" "));
|
|
159846
|
-
const shapeKind = attrs.kind
|
|
159917
|
+
const shapeKind = attrs.kind;
|
|
159918
|
+
const customGeometry = attrs.customGeometry;
|
|
159847
159919
|
const fillColor = attrs.fillColor === null ? null : attrs.fillColor ?? "#5b9bd5";
|
|
159848
159920
|
const strokeColor = attrs.strokeColor === null ? null : attrs.strokeColor ?? "#000000";
|
|
159849
159921
|
const strokeWidth = attrs.strokeWidth ?? 1;
|
|
@@ -159885,9 +159957,66 @@ var Node$13 = class Node$14 {
|
|
|
159885
159957
|
}
|
|
159886
159958
|
return g$1;
|
|
159887
159959
|
}
|
|
159960
|
+
if (customGeometry?.paths?.length) {
|
|
159961
|
+
const fillStr = fillValue === null ? "none" : typeof fillValue === "string" ? fillValue : "none";
|
|
159962
|
+
const strokeStr = strokeColor === null ? "none" : strokeColor;
|
|
159963
|
+
const strokeW = strokeColor === null ? 0 : strokeWidth;
|
|
159964
|
+
const firstPath = customGeometry.paths[0];
|
|
159965
|
+
const viewW = firstPath.w || width;
|
|
159966
|
+
const viewH = firstPath.h || height;
|
|
159967
|
+
if (viewW > 0 && viewH > 0) {
|
|
159968
|
+
const needsEdgeStroke = fillStr !== "none" && strokeStr === "none";
|
|
159969
|
+
const innerSvg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
159970
|
+
innerSvg.setAttribute("x", "0");
|
|
159971
|
+
innerSvg.setAttribute("y", "0");
|
|
159972
|
+
innerSvg.setAttribute("width", width.toString());
|
|
159973
|
+
innerSvg.setAttribute("height", height.toString());
|
|
159974
|
+
innerSvg.setAttribute("viewBox", `0 0 ${viewW} ${viewH}`);
|
|
159975
|
+
innerSvg.setAttribute("preserveAspectRatio", "none");
|
|
159976
|
+
for (const pathData of customGeometry.paths) {
|
|
159977
|
+
const pathEl = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
159978
|
+
pathEl.setAttribute("d", pathData.d);
|
|
159979
|
+
pathEl.setAttribute("fill", fillStr);
|
|
159980
|
+
pathEl.setAttribute("fill-rule", "evenodd");
|
|
159981
|
+
if (strokeStr !== "none") {
|
|
159982
|
+
pathEl.setAttribute("stroke", strokeStr);
|
|
159983
|
+
pathEl.setAttribute("stroke-width", strokeW.toString());
|
|
159984
|
+
} else if (needsEdgeStroke) {
|
|
159985
|
+
pathEl.setAttribute("stroke", fillStr);
|
|
159986
|
+
pathEl.setAttribute("stroke-width", "0.5");
|
|
159987
|
+
pathEl.setAttribute("vector-effect", "non-scaling-stroke");
|
|
159988
|
+
} else {
|
|
159989
|
+
pathEl.setAttribute("stroke", "none");
|
|
159990
|
+
pathEl.setAttribute("stroke-width", "0");
|
|
159991
|
+
}
|
|
159992
|
+
const pathW = pathData.w || viewW;
|
|
159993
|
+
const pathH = pathData.h || viewH;
|
|
159994
|
+
if (pathW !== viewW || pathH !== viewH) {
|
|
159995
|
+
const scaleX = viewW / pathW;
|
|
159996
|
+
const scaleY = viewH / pathH;
|
|
159997
|
+
pathEl.setAttribute("transform", `scale(${scaleX}, ${scaleY})`);
|
|
159998
|
+
}
|
|
159999
|
+
innerSvg.appendChild(pathEl);
|
|
160000
|
+
}
|
|
160001
|
+
g$1.appendChild(innerSvg);
|
|
160002
|
+
}
|
|
160003
|
+
if (attrs.textContent && attrs.textContent.parts) {
|
|
160004
|
+
const pageNumber = this.editor?.options?.currentPageNumber;
|
|
160005
|
+
const totalPages = this.editor?.options?.totalPageCount;
|
|
160006
|
+
const textGroup = this.createTextElement(attrs.textContent, attrs.textAlign, width, height, {
|
|
160007
|
+
textVerticalAlign: attrs.textVerticalAlign,
|
|
160008
|
+
textInsets: attrs.textInsets,
|
|
160009
|
+
pageNumber,
|
|
160010
|
+
totalPages
|
|
160011
|
+
});
|
|
160012
|
+
if (textGroup)
|
|
160013
|
+
g$1.appendChild(textGroup);
|
|
160014
|
+
}
|
|
160015
|
+
return g$1;
|
|
160016
|
+
}
|
|
159888
160017
|
try {
|
|
159889
160018
|
const svgContent = k0({
|
|
159890
|
-
preset: shapeKind,
|
|
160019
|
+
preset: shapeKind || "rect",
|
|
159891
160020
|
styleOverrides: {
|
|
159892
160021
|
fill: fillValue || "none",
|
|
159893
160022
|
stroke: strokeColor === null ? "none" : strokeColor,
|
|
@@ -162390,9 +162519,9 @@ var Node$13 = class Node$14 {
|
|
|
162390
162519
|
trackedChanges: context.trackedChanges ?? []
|
|
162391
162520
|
});
|
|
162392
162521
|
}, _hoisted_1$6, _hoisted_2$1, _hoisted_3, _hoisted_4, ContextMenu_default, _hoisted_1$5, BasicUpload_default, _hoisted_1$4, MIN_WIDTH = 200, PPI = 96, alignment = "flex-end", Ruler_default, GenericPopover_default, _hoisted_1$3, RESIZE_HANDLE_WIDTH_PX = 9, RESIZE_HANDLE_OFFSET_PX = 4, DRAG_OVERLAY_EXTENSION_PX = 1000, MIN_DRAG_OVERLAY_WIDTH_PX = 2000, THROTTLE_INTERVAL_MS = 16, MIN_RESIZE_DELTA_PX = 1, TableResizeOverlay_default, _hoisted_1$2, OVERLAY_EXPANSION_PX = 2000, RESIZE_HANDLE_SIZE_PX = 12, MOUSE_MOVE_THROTTLE_MS = 16, DIMENSION_CHANGE_THRESHOLD_PX = 1, Z_INDEX_OVERLAY = 10, Z_INDEX_HANDLE = 15, Z_INDEX_GUIDELINE = 20, ImageResizeOverlay_default, LINK_CLICK_DEBOUNCE_MS = 300, CURSOR_UPDATE_TIMEOUT_MS = 10, LinkClickHandler_default, _hoisted_1$1, _hoisted_2, DOCX2 = "application/vnd.openxmlformats-officedocument.wordprocessingml.document", TABLE_RESIZE_HOVER_THRESHOLD = 8, TABLE_RESIZE_THROTTLE_MS = 16, SuperEditor_default, _hoisted_1, SuperInput_default, SlashMenu, Extensions;
|
|
162393
|
-
var
|
|
162522
|
+
var init_src_DEQEar7E_es = __esm(() => {
|
|
162394
162523
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
162395
|
-
|
|
162524
|
+
init_SuperConverter_BJBbuXuZ_es();
|
|
162396
162525
|
init_jszip_ChlR43oI_es();
|
|
162397
162526
|
init_uuid_2IzDu5nl_es();
|
|
162398
162527
|
init_constants_Dw0kAsLd_es();
|
|
@@ -180644,9 +180773,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
180644
180773
|
contentContainer.style.top = `${offsetY}px`;
|
|
180645
180774
|
contentContainer.style.width = `${innerWidth}px`;
|
|
180646
180775
|
contentContainer.style.height = `${innerHeight$1}px`;
|
|
180647
|
-
const
|
|
180648
|
-
|
|
180649
|
-
|
|
180776
|
+
const customGeomSvg = block.customGeometry ? this.tryCreateCustomGeometrySvg(block, innerWidth, innerHeight$1) : null;
|
|
180777
|
+
const svgMarkup = !customGeomSvg && block.shapeKind ? this.tryCreatePresetSvg(block, innerWidth, innerHeight$1) : null;
|
|
180778
|
+
const resolvedSvgMarkup = customGeomSvg || svgMarkup;
|
|
180779
|
+
if (resolvedSvgMarkup) {
|
|
180780
|
+
const svgElement = this.parseSafeSvg(resolvedSvgMarkup);
|
|
180650
180781
|
if (svgElement) {
|
|
180651
180782
|
svgElement.setAttribute("width", "100%");
|
|
180652
180783
|
svgElement.setAttribute("height", "100%");
|
|
@@ -180729,14 +180860,6 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
180729
180860
|
textDiv.style.minWidth = "0";
|
|
180730
180861
|
textDiv.style.fontSize = "12px";
|
|
180731
180862
|
textDiv.style.lineHeight = "1.2";
|
|
180732
|
-
if (groupScaleX !== 1 || groupScaleY !== 1) {
|
|
180733
|
-
const counterScaleX = 1 / groupScaleX;
|
|
180734
|
-
const counterScaleY = 1 / groupScaleY;
|
|
180735
|
-
textDiv.style.transform = `scale(${counterScaleX}, ${counterScaleY})`;
|
|
180736
|
-
textDiv.style.transformOrigin = "top left";
|
|
180737
|
-
textDiv.style.width = `${100 * groupScaleX}%`;
|
|
180738
|
-
textDiv.style.height = `${100 * groupScaleY}%`;
|
|
180739
|
-
}
|
|
180740
180863
|
if (textAlign === "center")
|
|
180741
180864
|
textDiv.style.textAlign = "center";
|
|
180742
180865
|
else if (textAlign === "right" || textAlign === "r")
|
|
@@ -180819,6 +180942,39 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
180819
180942
|
return null;
|
|
180820
180943
|
}
|
|
180821
180944
|
}
|
|
180945
|
+
tryCreateCustomGeometrySvg(block, width, height) {
|
|
180946
|
+
const custGeom = block.customGeometry;
|
|
180947
|
+
if (!custGeom?.paths?.length)
|
|
180948
|
+
return null;
|
|
180949
|
+
let fillColor;
|
|
180950
|
+
if (block.fillColor === null)
|
|
180951
|
+
fillColor = "none";
|
|
180952
|
+
else if (typeof block.fillColor === "string")
|
|
180953
|
+
fillColor = block.fillColor;
|
|
180954
|
+
else
|
|
180955
|
+
fillColor = "#000000";
|
|
180956
|
+
const strokeColor = block.strokeColor === null ? "none" : typeof block.strokeColor === "string" ? block.strokeColor : "none";
|
|
180957
|
+
const strokeWidth = block.strokeColor === null ? 0 : block.strokeWidth ?? 0;
|
|
180958
|
+
const firstPath = custGeom.paths[0];
|
|
180959
|
+
const viewW = firstPath.w || width;
|
|
180960
|
+
const viewH = firstPath.h || height;
|
|
180961
|
+
if (viewW === 0 || viewH === 0)
|
|
180962
|
+
return null;
|
|
180963
|
+
const edgeStroke = fillColor !== "none" && strokeColor === "none" ? ` stroke="${fillColor}" stroke-width="0.5" vector-effect="non-scaling-stroke"` : "";
|
|
180964
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${viewW} ${viewH}" preserveAspectRatio="none">
|
|
180965
|
+
${custGeom.paths.map((p$12) => {
|
|
180966
|
+
const pathW = p$12.w || viewW;
|
|
180967
|
+
const pathH = p$12.h || viewH;
|
|
180968
|
+
const needsTransform = pathW !== viewW || pathH !== viewH;
|
|
180969
|
+
const scaleX = viewW / pathW;
|
|
180970
|
+
const scaleY = viewH / pathH;
|
|
180971
|
+
const transform = needsTransform ? ` transform="scale(${scaleX}, ${scaleY})"` : "";
|
|
180972
|
+
const strokeAttr = strokeColor !== "none" ? ` stroke="${strokeColor}" stroke-width="${strokeWidth}"` : edgeStroke;
|
|
180973
|
+
return `<path d="${p$12.d}" fill="${fillColor}" fill-rule="evenodd"${strokeAttr}${transform} />`;
|
|
180974
|
+
}).join(`
|
|
180975
|
+
`)}
|
|
180976
|
+
</svg>`;
|
|
180977
|
+
}
|
|
180822
180978
|
parseSafeSvg(markup) {
|
|
180823
180979
|
const DOMParserCtor = this.doc?.defaultView?.DOMParser ?? (typeof DOMParser !== "undefined" ? DOMParser : null);
|
|
180824
180980
|
if (!DOMParserCtor)
|
|
@@ -180983,43 +181139,32 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
180983
181139
|
groupEl.style.height = "100%";
|
|
180984
181140
|
const groupTransform = block.groupTransform;
|
|
180985
181141
|
let contentContainer = groupEl;
|
|
180986
|
-
const
|
|
180987
|
-
const
|
|
181142
|
+
const visibleWidth = groupTransform?.width ?? block.geometry.width ?? 0;
|
|
181143
|
+
const visibleHeight = groupTransform?.height ?? block.geometry.height ?? 0;
|
|
180988
181144
|
if (groupTransform) {
|
|
180989
181145
|
const inner = this.doc.createElement("div");
|
|
180990
181146
|
inner.style.position = "absolute";
|
|
180991
181147
|
inner.style.left = "0";
|
|
180992
181148
|
inner.style.top = "0";
|
|
180993
|
-
|
|
180994
|
-
|
|
180995
|
-
inner.style.width = `${Math.max(1, childWidth)}px`;
|
|
180996
|
-
inner.style.height = `${Math.max(1, childHeight)}px`;
|
|
180997
|
-
const transforms = [];
|
|
180998
|
-
const offsetX = groupTransform.childX ?? 0;
|
|
180999
|
-
const offsetY = groupTransform.childY ?? 0;
|
|
181000
|
-
if (offsetX || offsetY)
|
|
181001
|
-
transforms.push(`translate(${-offsetX}px, ${-offsetY}px)`);
|
|
181002
|
-
if (transforms.length > 0) {
|
|
181003
|
-
inner.style.transformOrigin = "top left";
|
|
181004
|
-
inner.style.transform = transforms.join(" ");
|
|
181005
|
-
}
|
|
181149
|
+
inner.style.width = `${Math.max(1, visibleWidth)}px`;
|
|
181150
|
+
inner.style.height = `${Math.max(1, visibleHeight)}px`;
|
|
181006
181151
|
groupEl.appendChild(inner);
|
|
181007
181152
|
contentContainer = inner;
|
|
181008
181153
|
}
|
|
181009
181154
|
block.shapes.forEach((child) => {
|
|
181010
|
-
const childContent = this.createGroupChildContent(child,
|
|
181155
|
+
const childContent = this.createGroupChildContent(child, 1, 1, context);
|
|
181011
181156
|
if (!childContent)
|
|
181012
181157
|
return;
|
|
181013
181158
|
const attrs = child.attrs ?? {};
|
|
181014
181159
|
const wrapper = this.doc.createElement("div");
|
|
181015
181160
|
wrapper.classList.add("superdoc-shape-group__child");
|
|
181016
181161
|
wrapper.style.position = "absolute";
|
|
181017
|
-
wrapper.style.left = `${attrs.x ?? 0}px`;
|
|
181018
|
-
wrapper.style.top = `${attrs.y ?? 0}px`;
|
|
181019
|
-
const
|
|
181020
|
-
const
|
|
181021
|
-
wrapper.style.width = `${Math.max(1,
|
|
181022
|
-
wrapper.style.height = `${Math.max(1,
|
|
181162
|
+
wrapper.style.left = `${Number(attrs.x ?? 0)}px`;
|
|
181163
|
+
wrapper.style.top = `${Number(attrs.y ?? 0)}px`;
|
|
181164
|
+
const childW = typeof attrs.width === "number" ? attrs.width : block.geometry.width;
|
|
181165
|
+
const childH = typeof attrs.height === "number" ? attrs.height : block.geometry.height;
|
|
181166
|
+
wrapper.style.width = `${Math.max(1, childW)}px`;
|
|
181167
|
+
wrapper.style.height = `${Math.max(1, childH)}px`;
|
|
181023
181168
|
wrapper.style.transformOrigin = "center";
|
|
181024
181169
|
const transforms = [];
|
|
181025
181170
|
if (attrs.rotation)
|
|
@@ -181060,6 +181205,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
181060
181205
|
drawingContentId: undefined,
|
|
181061
181206
|
drawingContent: undefined,
|
|
181062
181207
|
shapeKind: attrs.kind,
|
|
181208
|
+
customGeometry: attrs.customGeometry,
|
|
181063
181209
|
fillColor: attrs.fillColor,
|
|
181064
181210
|
strokeColor: attrs.strokeColor,
|
|
181065
181211
|
strokeWidth: attrs.strokeWidth,
|
|
@@ -191171,6 +191317,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
191171
191317
|
return { "data-stroke-width": attrs.strokeWidth };
|
|
191172
191318
|
}
|
|
191173
191319
|
},
|
|
191320
|
+
customGeometry: {
|
|
191321
|
+
default: null,
|
|
191322
|
+
rendered: false
|
|
191323
|
+
},
|
|
191174
191324
|
lineEnds: {
|
|
191175
191325
|
default: null,
|
|
191176
191326
|
rendered: false
|
|
@@ -195905,8 +196055,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
195905
196055
|
return isObjectLike_default(value) && hasOwnProperty$8.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
|
|
195906
196056
|
};
|
|
195907
196057
|
stubFalse_default = stubFalse;
|
|
195908
|
-
freeExports$2 = typeof
|
|
195909
|
-
freeModule$2 = freeExports$2 && typeof
|
|
196058
|
+
freeExports$2 = typeof exports_src_DEQEar7E_es == "object" && exports_src_DEQEar7E_es && !exports_src_DEQEar7E_es.nodeType && exports_src_DEQEar7E_es;
|
|
196059
|
+
freeModule$2 = freeExports$2 && typeof module_src_DEQEar7E_es == "object" && module_src_DEQEar7E_es && !module_src_DEQEar7E_es.nodeType && module_src_DEQEar7E_es;
|
|
195910
196060
|
Buffer$1 = freeModule$2 && freeModule$2.exports === freeExports$2 ? _root_default.Buffer : undefined;
|
|
195911
196061
|
isBuffer_default = (Buffer$1 ? Buffer$1.isBuffer : undefined) || stubFalse_default;
|
|
195912
196062
|
typedArrayTags = {};
|
|
@@ -195914,8 +196064,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
195914
196064
|
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
|
|
195915
196065
|
_baseIsTypedArray_default = baseIsTypedArray;
|
|
195916
196066
|
_baseUnary_default = baseUnary;
|
|
195917
|
-
freeExports$1 = typeof
|
|
195918
|
-
freeModule$1 = freeExports$1 && typeof
|
|
196067
|
+
freeExports$1 = typeof exports_src_DEQEar7E_es == "object" && exports_src_DEQEar7E_es && !exports_src_DEQEar7E_es.nodeType && exports_src_DEQEar7E_es;
|
|
196068
|
+
freeModule$1 = freeExports$1 && typeof module_src_DEQEar7E_es == "object" && module_src_DEQEar7E_es && !module_src_DEQEar7E_es.nodeType && module_src_DEQEar7E_es;
|
|
195919
196069
|
freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && _freeGlobal_default.process;
|
|
195920
196070
|
_nodeUtil_default = function() {
|
|
195921
196071
|
try {
|
|
@@ -196020,8 +196170,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
196020
196170
|
Stack.prototype.has = _stackHas_default;
|
|
196021
196171
|
Stack.prototype.set = _stackSet_default;
|
|
196022
196172
|
_Stack_default = Stack;
|
|
196023
|
-
freeExports = typeof
|
|
196024
|
-
freeModule = freeExports && typeof
|
|
196173
|
+
freeExports = typeof exports_src_DEQEar7E_es == "object" && exports_src_DEQEar7E_es && !exports_src_DEQEar7E_es.nodeType && exports_src_DEQEar7E_es;
|
|
196174
|
+
freeModule = freeExports && typeof module_src_DEQEar7E_es == "object" && module_src_DEQEar7E_es && !module_src_DEQEar7E_es.nodeType && module_src_DEQEar7E_es;
|
|
196025
196175
|
Buffer4 = freeModule && freeModule.exports === freeExports ? _root_default.Buffer : undefined;
|
|
196026
196176
|
allocUnsafe = Buffer4 ? Buffer4.allocUnsafe : undefined;
|
|
196027
196177
|
_cloneBuffer_default = cloneBuffer;
|
|
@@ -203673,8 +203823,8 @@ var init_zipper_Cnk_HjM2_es = __esm(() => {
|
|
|
203673
203823
|
|
|
203674
203824
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
203675
203825
|
var init_super_editor_es = __esm(() => {
|
|
203676
|
-
|
|
203677
|
-
|
|
203826
|
+
init_src_DEQEar7E_es();
|
|
203827
|
+
init_SuperConverter_BJBbuXuZ_es();
|
|
203678
203828
|
init_jszip_ChlR43oI_es();
|
|
203679
203829
|
init_xml_js_DLE8mr0n_es();
|
|
203680
203830
|
init_constants_Dw0kAsLd_es();
|
|
@@ -236829,6 +236979,66 @@ function extractFillColor2(spPr, style3) {
|
|
|
236829
236979
|
}
|
|
236830
236980
|
return null;
|
|
236831
236981
|
}
|
|
236982
|
+
function extractCustomGeometry2(spPr) {
|
|
236983
|
+
const custGeom = spPr?.elements?.find((el) => el.name === "a:custGeom");
|
|
236984
|
+
if (!custGeom)
|
|
236985
|
+
return null;
|
|
236986
|
+
const pathLst = custGeom.elements?.find((el) => el.name === "a:pathLst");
|
|
236987
|
+
if (!pathLst?.elements)
|
|
236988
|
+
return null;
|
|
236989
|
+
const paths = pathLst.elements.filter((el) => el.name === "a:path").map((pathEl) => {
|
|
236990
|
+
const w = parseInt(pathEl.attributes?.["w"] || "0", 10);
|
|
236991
|
+
const h3 = parseInt(pathEl.attributes?.["h"] || "0", 10);
|
|
236992
|
+
const d = convertDrawingMLPathToSvg2(pathEl);
|
|
236993
|
+
return { d, w, h: h3 };
|
|
236994
|
+
}).filter((p4) => p4.d);
|
|
236995
|
+
if (paths.length === 0)
|
|
236996
|
+
return null;
|
|
236997
|
+
return { paths };
|
|
236998
|
+
}
|
|
236999
|
+
function convertDrawingMLPathToSvg2(pathEl) {
|
|
237000
|
+
if (!pathEl?.elements)
|
|
237001
|
+
return "";
|
|
237002
|
+
const parts = [];
|
|
237003
|
+
for (const cmd of pathEl.elements) {
|
|
237004
|
+
switch (cmd.name) {
|
|
237005
|
+
case "a:moveTo": {
|
|
237006
|
+
const pt = cmd.elements?.find((el) => el.name === "a:pt");
|
|
237007
|
+
if (pt) {
|
|
237008
|
+
parts.push(`M ${pt.attributes?.["x"] || 0} ${pt.attributes?.["y"] || 0}`);
|
|
237009
|
+
}
|
|
237010
|
+
break;
|
|
237011
|
+
}
|
|
237012
|
+
case "a:lnTo": {
|
|
237013
|
+
const pt = cmd.elements?.find((el) => el.name === "a:pt");
|
|
237014
|
+
if (pt) {
|
|
237015
|
+
parts.push(`L ${pt.attributes?.["x"] || 0} ${pt.attributes?.["y"] || 0}`);
|
|
237016
|
+
}
|
|
237017
|
+
break;
|
|
237018
|
+
}
|
|
237019
|
+
case "a:cubicBezTo": {
|
|
237020
|
+
const pts = cmd.elements?.filter((el) => el.name === "a:pt") || [];
|
|
237021
|
+
if (pts.length === 3) {
|
|
237022
|
+
parts.push(`C ${pts[0].attributes?.["x"] || 0} ${pts[0].attributes?.["y"] || 0} ` + `${pts[1].attributes?.["x"] || 0} ${pts[1].attributes?.["y"] || 0} ` + `${pts[2].attributes?.["x"] || 0} ${pts[2].attributes?.["y"] || 0}`);
|
|
237023
|
+
}
|
|
237024
|
+
break;
|
|
237025
|
+
}
|
|
237026
|
+
case "a:quadBezTo": {
|
|
237027
|
+
const pts = cmd.elements?.filter((el) => el.name === "a:pt") || [];
|
|
237028
|
+
if (pts.length === 2) {
|
|
237029
|
+
parts.push(`Q ${pts[0].attributes?.["x"] || 0} ${pts[0].attributes?.["y"] || 0} ` + `${pts[1].attributes?.["x"] || 0} ${pts[1].attributes?.["y"] || 0}`);
|
|
237030
|
+
}
|
|
237031
|
+
break;
|
|
237032
|
+
}
|
|
237033
|
+
case "a:close":
|
|
237034
|
+
parts.push("Z");
|
|
237035
|
+
break;
|
|
237036
|
+
default:
|
|
237037
|
+
break;
|
|
237038
|
+
}
|
|
237039
|
+
}
|
|
237040
|
+
return parts.join(" ");
|
|
237041
|
+
}
|
|
236832
237042
|
function extractGradientFill2(gradFill) {
|
|
236833
237043
|
const gradient = {
|
|
236834
237044
|
type: "gradient",
|
|
@@ -244096,7 +244306,17 @@ function extractTextFromTextBox2(textBoxContent, bodyPr, params3 = {}) {
|
|
|
244096
244306
|
wrap: wrap6
|
|
244097
244307
|
};
|
|
244098
244308
|
}
|
|
244099
|
-
function getVectorShape2({
|
|
244309
|
+
function getVectorShape2({
|
|
244310
|
+
params: params3,
|
|
244311
|
+
node: node4,
|
|
244312
|
+
graphicData,
|
|
244313
|
+
size: size3,
|
|
244314
|
+
marginOffset,
|
|
244315
|
+
anchorData,
|
|
244316
|
+
wrap: wrap6,
|
|
244317
|
+
isAnchor,
|
|
244318
|
+
customGeometry
|
|
244319
|
+
}) {
|
|
244100
244320
|
const schemaAttrs = {};
|
|
244101
244321
|
const drawingNode = params3.nodes?.[0];
|
|
244102
244322
|
if (drawingNode?.name === "w:drawing") {
|
|
@@ -244112,10 +244332,15 @@ function getVectorShape2({ params: params3, node: node4, graphicData, size: size
|
|
|
244112
244332
|
}
|
|
244113
244333
|
const prstGeom = spPr.elements?.find((el) => el.name === "a:prstGeom");
|
|
244114
244334
|
const shapeKind = prstGeom?.attributes?.["prst"];
|
|
244115
|
-
if (!shapeKind) {
|
|
244116
|
-
console.warn("Shape kind not found");
|
|
244117
|
-
}
|
|
244118
244335
|
schemaAttrs.kind = shapeKind;
|
|
244336
|
+
if (customGeometry) {
|
|
244337
|
+
schemaAttrs.customGeometry = customGeometry;
|
|
244338
|
+
} else if (!shapeKind) {
|
|
244339
|
+
const extracted = extractCustomGeometry2(spPr);
|
|
244340
|
+
if (extracted) {
|
|
244341
|
+
schemaAttrs.customGeometry = extracted;
|
|
244342
|
+
}
|
|
244343
|
+
}
|
|
244119
244344
|
const width = size3?.width ?? DEFAULT_SHAPE_WIDTH2;
|
|
244120
244345
|
const height = size3?.height ?? DEFAULT_SHAPE_HEIGHT2;
|
|
244121
244346
|
const xfrm = spPr.elements?.find((el) => el.name === "a:xfrm");
|
|
@@ -244236,8 +244461,19 @@ var DRAWING_XML_TAG2 = "w:drawing", SHAPE_URI2 = "http://schemas.microsoft.com/o
|
|
|
244236
244461
|
const spPr = wsp.elements.find((el) => el.name === "wps:spPr");
|
|
244237
244462
|
const prstGeom = spPr?.elements.find((el) => el.name === "a:prstGeom");
|
|
244238
244463
|
const shapeType = prstGeom?.attributes["prst"];
|
|
244239
|
-
|
|
244240
|
-
|
|
244464
|
+
const custGeom = !shapeType ? extractCustomGeometry2(spPr) : null;
|
|
244465
|
+
if (shapeType || custGeom) {
|
|
244466
|
+
const result = getVectorShape2({
|
|
244467
|
+
params: params3,
|
|
244468
|
+
node: node4,
|
|
244469
|
+
graphicData,
|
|
244470
|
+
size: size3,
|
|
244471
|
+
marginOffset,
|
|
244472
|
+
anchorData,
|
|
244473
|
+
wrap: wrap6,
|
|
244474
|
+
isAnchor,
|
|
244475
|
+
customGeometry: custGeom
|
|
244476
|
+
});
|
|
244241
244477
|
if (result?.attrs && isHidden2) {
|
|
244242
244478
|
result.attrs.hidden = true;
|
|
244243
244479
|
}
|
|
@@ -244294,6 +244530,7 @@ var DRAWING_XML_TAG2 = "w:drawing", SHAPE_URI2 = "http://schemas.microsoft.com/o
|
|
|
244294
244530
|
return null;
|
|
244295
244531
|
const prstGeom = spPr.elements?.find((el) => el.name === "a:prstGeom");
|
|
244296
244532
|
const shapeKind = prstGeom?.attributes?.["prst"];
|
|
244533
|
+
const customGeom = !shapeKind ? extractCustomGeometry2(spPr) : null;
|
|
244297
244534
|
const shapeXfrm = spPr.elements?.find((el) => el.name === "a:xfrm");
|
|
244298
244535
|
const shapeOff = shapeXfrm?.elements?.find((el) => el.name === "a:off");
|
|
244299
244536
|
const shapeExt = shapeXfrm?.elements?.find((el) => el.name === "a:ext");
|
|
@@ -244340,6 +244577,7 @@ var DRAWING_XML_TAG2 = "w:drawing", SHAPE_URI2 = "http://schemas.microsoft.com/o
|
|
|
244340
244577
|
shapeType: "vectorShape",
|
|
244341
244578
|
attrs: {
|
|
244342
244579
|
kind: shapeKind,
|
|
244580
|
+
customGeometry: customGeom || undefined,
|
|
244343
244581
|
x,
|
|
244344
244582
|
y: y2,
|
|
244345
244583
|
width,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/cli",
|
|
3
|
-
"version": "0.2.0-next.
|
|
3
|
+
"version": "0.2.0-next.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superdoc": "./dist/index.js"
|
|
@@ -20,19 +20,19 @@
|
|
|
20
20
|
"@types/node": "22.19.2",
|
|
21
21
|
"typescript": "^5.9.2",
|
|
22
22
|
"@superdoc/document-api": "0.0.1",
|
|
23
|
-
"
|
|
24
|
-
"superdoc": "
|
|
23
|
+
"superdoc": "1.16.0",
|
|
24
|
+
"@superdoc/super-editor": "0.0.1"
|
|
25
25
|
},
|
|
26
26
|
"module": "src/index.ts",
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"optionalDependencies": {
|
|
31
|
-
"@superdoc-dev/cli-darwin-arm64": "0.2.0-next.
|
|
32
|
-
"@superdoc-dev/cli-darwin-x64": "0.2.0-next.
|
|
33
|
-
"@superdoc-dev/cli-linux-x64": "0.2.0-next.
|
|
34
|
-
"@superdoc-dev/cli-
|
|
35
|
-
"@superdoc-dev/cli-
|
|
31
|
+
"@superdoc-dev/cli-darwin-arm64": "0.2.0-next.21",
|
|
32
|
+
"@superdoc-dev/cli-darwin-x64": "0.2.0-next.21",
|
|
33
|
+
"@superdoc-dev/cli-linux-x64": "0.2.0-next.21",
|
|
34
|
+
"@superdoc-dev/cli-linux-arm64": "0.2.0-next.21",
|
|
35
|
+
"@superdoc-dev/cli-windows-x64": "0.2.0-next.21"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"dev": "bun run src/index.ts",
|