ooxml-ui 1.18.1 → 1.18.2

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.
@@ -1078,6 +1078,7 @@ chunkMF3JURQN_cjs.__export(pptx_exports, {
1078
1078
  buildCropOverlay: () => buildCropOverlay,
1079
1079
  buildCssGradientFromShapeStyle: () => chunkG3UVZ5FO_cjs.buildCssGradientFromShapeStyle,
1080
1080
  buildCustomGeometryClipPath: () => buildCustomGeometryClipPath,
1081
+ buildCustomPathMarkers: () => buildCustomPathMarkers,
1081
1082
  buildDashArray: () => chunkG3UVZ5FO_cjs.buildDashArray,
1082
1083
  buildDataLabelText: () => chunkG3UVZ5FO_cjs.buildDataLabelText,
1083
1084
  buildDeckJson: () => buildDeckJson,
@@ -2261,6 +2262,7 @@ chunkMF3JURQN_cjs.__export(pptx_exports, {
2261
2262
  isActionHidden: () => isActionHidden,
2262
2263
  isAdditiveSelectionPress: () => isAdditiveSelectionPress,
2263
2264
  isAnimationCatalogPresetId: () => chunkUSBRSEJK_cjs.isAnimationCatalogPresetId,
2265
+ isArrowedCustomPath: () => isArrowedCustomPath,
2264
2266
  isArtisticEffectRendered: () => isArtisticEffectRendered,
2265
2267
  isAssetRefKey: () => collaborationSync.isAssetRefKey,
2266
2268
  isAssetVersionKey: () => collaborationSync.isAssetVersionKey,
@@ -4663,6 +4665,7 @@ chunkMF3JURQN_cjs.__export(render_exports, {
4663
4665
  buildCropOverlay: () => buildCropOverlay,
4664
4666
  buildCssGradientFromShapeStyle: () => chunkG3UVZ5FO_cjs.buildCssGradientFromShapeStyle,
4665
4667
  buildCustomGeometryClipPath: () => buildCustomGeometryClipPath,
4668
+ buildCustomPathMarkers: () => buildCustomPathMarkers,
4666
4669
  buildDashArray: () => chunkG3UVZ5FO_cjs.buildDashArray,
4667
4670
  buildDataLabelText: () => chunkG3UVZ5FO_cjs.buildDataLabelText,
4668
4671
  buildDeckSaveOptions: () => buildDeckSaveOptions,
@@ -5759,6 +5762,7 @@ chunkMF3JURQN_cjs.__export(render_exports, {
5759
5762
  isActionHidden: () => isActionHidden,
5760
5763
  isAdditiveSelectionPress: () => isAdditiveSelectionPress,
5761
5764
  isAnimationCatalogPresetId: () => chunkUSBRSEJK_cjs.isAnimationCatalogPresetId,
5765
+ isArrowedCustomPath: () => isArrowedCustomPath,
5762
5766
  isArtisticEffectRendered: () => isArtisticEffectRendered,
5763
5767
  isAssetRefKey: () => collaborationSync.isAssetRefKey,
5764
5768
  isAssetVersionKey: () => collaborationSync.isAssetVersionKey,
@@ -7156,50 +7160,29 @@ function connectorKind(shapeType) {
7156
7160
  function connectorNeedsPath(shapeType) {
7157
7161
  return connectorKind(shapeType) !== "straight";
7158
7162
  }
7159
- function getStrokeOnlyPresetPaths(element) {
7160
- if (element.type !== "shape" || !pptx.hasShapeProperties(element)) {
7161
- return void 0;
7162
- }
7163
- const shapeType = element.shapeType;
7164
- if (!shapeType || shapeType === "custom") {
7165
- return void 0;
7166
- }
7167
- if (element.pathData) {
7168
- return void 0;
7169
- }
7170
- const result = pptx.evaluatePresetShape(
7171
- shapeType,
7172
- Math.max(element.width, 0),
7173
- Math.max(element.height, 0),
7174
- element.shapeAdjustments
7175
- );
7176
- if (!result || !result.fillNone) {
7177
- return void 0;
7178
- }
7179
- const drawable = result.paths.filter((path) => path.d !== "");
7180
- return drawable.length > 0 ? drawable : void 0;
7181
- }
7182
- function isStrokeOnlyPresetElement(element) {
7183
- return getStrokeOnlyPresetPaths(element) !== void 0;
7184
- }
7185
- function strokeOnlyPresetPathData(element) {
7186
- const paths = getStrokeOnlyPresetPaths(element);
7187
- if (!paths) {
7188
- return void 0;
7189
- }
7190
- const stroked = paths.filter((path) => path.stroke !== false).map((path) => path.d);
7191
- return stroked.length > 0 ? stroked.join(" ") : void 0;
7192
- }
7193
7163
 
7194
- // src/pptx/render/stroke-paint.ts
7195
- function hasStrokePaint(style) {
7196
- if (!style || Math.max(0, style.strokeWidth ?? 0) <= 0) {
7197
- return false;
7164
+ // src/pptx/render/connector-markers.ts
7165
+ var ARROW_MARKER_SIZE = { sm: 2, med: 3, lg: 5 };
7166
+ function markerPath(type, arrowWidth, arrowLength) {
7167
+ const markerWidth = ARROW_MARKER_SIZE[arrowLength ?? "med"] ?? 3;
7168
+ const markerHeight = ARROW_MARKER_SIZE[arrowWidth ?? "med"] ?? 3;
7169
+ const box = { markerWidth, markerHeight, refX: 10 };
7170
+ switch (type) {
7171
+ case "diamond":
7172
+ return { shape: "path", d: "M5 0 L10 5 L5 10 L0 5 Z", ...box, refX: 5 };
7173
+ case "oval":
7174
+ return { shape: "circle", ...box, refX: 5 };
7175
+ case "stealth":
7176
+ return { shape: "path", d: "M0 0 L10 5 L0 10 L3 5 Z", ...box };
7177
+ case "arrow":
7178
+ return { shape: "path", d: "M1 1 L9 5 L1 9", strokeOnly: true, ...box, refX: 9 };
7179
+ // triangle / fallback
7180
+ default:
7181
+ return { shape: "path", d: "M0 0 L10 5 L0 10 Z", ...box };
7198
7182
  }
7199
- return style.strokeColor !== void 0 || style.strokeFillMode !== void 0;
7200
7183
  }
7201
- function paintedStrokeWidth(style) {
7202
- return hasStrokePaint(style) ? Math.max(0, style?.strokeWidth ?? 0) : 0;
7184
+ function normalizeArrow(a) {
7185
+ return a && a !== "none" ? a : void 0;
7203
7186
  }
7204
7187
 
7205
7188
  // src/pptx/render/chart-format/chart-area-outer-effects.ts
@@ -7863,6 +7846,86 @@ function hasImageEffects(element) {
7863
7846
  return pptx.isImageLikeElement(element) && Boolean(element.imageEffects);
7864
7847
  }
7865
7848
 
7849
+ // src/pptx/render/stroke-paint.ts
7850
+ function hasStrokePaint(style) {
7851
+ if (!style || Math.max(0, style.strokeWidth ?? 0) <= 0) {
7852
+ return false;
7853
+ }
7854
+ return style.strokeColor !== void 0 || style.strokeFillMode !== void 0;
7855
+ }
7856
+ function paintedStrokeWidth(style) {
7857
+ return hasStrokePaint(style) ? Math.max(0, style?.strokeWidth ?? 0) : 0;
7858
+ }
7859
+
7860
+ // src/pptx/render/custom-path-markers.ts
7861
+ function isArrowedCustomPath(element) {
7862
+ if (element.type !== "shape" || !element.pathData || !element.pathWidth || !element.pathHeight) {
7863
+ return false;
7864
+ }
7865
+ const style = element.shapeStyle;
7866
+ if (!hasStrokePaint(style) || (style?.strokeWidth ?? 0) <= 0) return false;
7867
+ return !/[zZ]/u.test(element.pathData) && (style?.fillMode === "none" || style?.fillColor === "transparent") && Boolean(normalizeArrow(style?.connectorStartArrow) || normalizeArrow(style?.connectorEndArrow));
7868
+ }
7869
+ function buildCustomPathMarkers(element, stroke) {
7870
+ if (!isArrowedCustomPath(element) || !pptx.hasShapeProperties(element)) return void 0;
7871
+ const style = element.shapeStyle ?? {};
7872
+ const seed = [...element.id].map((char) => char.codePointAt(0).toString(16)).join("-");
7873
+ const markup = [];
7874
+ const add2 = (end2) => {
7875
+ const arrow = normalizeArrow(style[`connector${end2}Arrow`]);
7876
+ if (!arrow) return void 0;
7877
+ const shape = markerPath(
7878
+ arrow,
7879
+ style[`connector${end2}ArrowWidth`],
7880
+ style[`connector${end2}ArrowLength`]
7881
+ );
7882
+ const id = `freeform-${seed}-${end2}`;
7883
+ const color = escapeSvgAttr(stroke);
7884
+ const body = shape.shape === "circle" ? `<circle cx="5" cy="5" r="4" fill="${color}"/>` : `<path d="${escapeSvgAttr(shape.d ?? "")}" fill="${shape.strokeOnly ? "none" : color}"${shape.strokeOnly ? ` stroke="${color}"` : ""}/>`;
7885
+ markup.push(
7886
+ `<marker id="${id}" viewBox="0 0 10 10" refX="${shape.refX}" refY="5" markerWidth="${shape.markerWidth}" markerHeight="${shape.markerHeight}" markerUnits="strokeWidth" orient="auto-start-reverse" preserveAspectRatio="none">${body}</marker>`
7887
+ );
7888
+ return `url(#${id})`;
7889
+ };
7890
+ const start = add2("Start");
7891
+ const end = add2("End");
7892
+ return { markup: markup.join(""), start, end };
7893
+ }
7894
+ function getStrokeOnlyPresetPaths(element) {
7895
+ if (element.type !== "shape" || !pptx.hasShapeProperties(element)) {
7896
+ return void 0;
7897
+ }
7898
+ const shapeType = element.shapeType;
7899
+ if (!shapeType || shapeType === "custom") {
7900
+ return void 0;
7901
+ }
7902
+ if (element.pathData) {
7903
+ return void 0;
7904
+ }
7905
+ const result = pptx.evaluatePresetShape(
7906
+ shapeType,
7907
+ Math.max(element.width, 0),
7908
+ Math.max(element.height, 0),
7909
+ element.shapeAdjustments
7910
+ );
7911
+ if (!result || !result.fillNone) {
7912
+ return void 0;
7913
+ }
7914
+ const drawable = result.paths.filter((path) => path.d !== "");
7915
+ return drawable.length > 0 ? drawable : void 0;
7916
+ }
7917
+ function isStrokeOnlyPresetElement(element) {
7918
+ return getStrokeOnlyPresetPaths(element) !== void 0;
7919
+ }
7920
+ function strokeOnlyPresetPathData(element) {
7921
+ const paths = getStrokeOnlyPresetPaths(element);
7922
+ if (!paths) {
7923
+ return void 0;
7924
+ }
7925
+ const stroked = paths.filter((path) => path.stroke !== false).map((path) => path.d);
7926
+ return stroked.length > 0 ? stroked.join(" ") : void 0;
7927
+ }
7928
+
7866
7929
  // src/pptx/render/svg-gradient-rect-path.ts
7867
7930
  function buildRectPathGradientDef(stops, id, focalPoint, fillToRect) {
7868
7931
  const rectStops = stops.map((stop) => ({
@@ -8107,7 +8170,7 @@ function buildStrokeOutline(element) {
8107
8170
  return void 0;
8108
8171
  }
8109
8172
  const paint = style && declaredWidth > 0 ? buildSvgStrokeGradientDef(style, element.id) ?? buildSvgStrokePatternDef(style, element.id) : void 0;
8110
- const centeredFlatStroke = !paint && !openPresetD && needsCenteredStrokeOverlay(element, style, declaredWidth);
8173
+ const centeredFlatStroke = !paint && !openPresetD && (isArrowedCustomPath(element) || needsCenteredStrokeOverlay(element, style, declaredWidth));
8111
8174
  if (!paint && !openPresetD && !centeredFlatStroke) {
8112
8175
  return void 0;
8113
8176
  }
@@ -8116,10 +8179,12 @@ function buildStrokeOutline(element) {
8116
8179
  return void 0;
8117
8180
  }
8118
8181
  const strokeWidth = declaredWidth > 0 ? declaredWidth : DEFAULT_OPEN_PRESET_STROKE_WIDTH;
8182
+ const stroke = paint ? svgGradientFillRef(paint) : chunkG3UVZ5FO_cjs.colorWithOpacity(style?.strokeColor ?? chunkG3UVZ5FO_cjs.DEFAULT_STROKE_COLOR, style?.strokeOpacity);
8119
8183
  return {
8184
+ markers: buildCustomPathMarkers(element, stroke),
8120
8185
  d,
8121
8186
  paint,
8122
- stroke: paint ? svgGradientFillRef(paint) : chunkG3UVZ5FO_cjs.colorWithOpacity(style?.strokeColor ?? chunkG3UVZ5FO_cjs.DEFAULT_STROKE_COLOR, style?.strokeOpacity),
8187
+ stroke,
8123
8188
  strokeWidth,
8124
8189
  strands: outlineStrands(style?.compoundLine, strokeWidth),
8125
8190
  dashArray: chunkG3UVZ5FO_cjs.getSvgStrokeDasharray(
@@ -8222,7 +8287,7 @@ function resolveShapeGeometry(element) {
8222
8287
  if (element.type === "connector" || shapeType === "connector") {
8223
8288
  return { kind: "bare" };
8224
8289
  }
8225
- if (isStrokeOnlyPresetElement(element)) {
8290
+ if (isStrokeOnlyPresetElement(element) || isArrowedCustomPath(element)) {
8226
8291
  return { kind: "strokeOnly" };
8227
8292
  }
8228
8293
  if (shapeType === "roundRect" && pptx.hasShapeProperties(element)) {
@@ -39400,31 +39465,6 @@ function connectorHitStrokeWidth(strokeWidth) {
39400
39465
  return Math.max(strokeWidth * 3, CONNECTOR_HIT_MIN_WIDTH);
39401
39466
  }
39402
39467
 
39403
- // src/pptx/render/connector-markers.ts
39404
- var ARROW_BASE_MARKER_SIZE = 4;
39405
- var ARROW_SIZE_SCALE = { sm: 0.6, med: 1, lg: 1.5 };
39406
- function markerPath(type, arrowWidth, arrowLength) {
39407
- const markerWidth = ARROW_BASE_MARKER_SIZE * (ARROW_SIZE_SCALE[arrowLength ?? "med"] ?? 1);
39408
- const markerHeight = ARROW_BASE_MARKER_SIZE * (ARROW_SIZE_SCALE[arrowWidth ?? "med"] ?? 1);
39409
- const box = { markerWidth, markerHeight };
39410
- switch (type) {
39411
- case "diamond":
39412
- return { shape: "path", d: "M5 0 L10 5 L5 10 L0 5 Z", ...box };
39413
- case "oval":
39414
- return { shape: "circle", ...box };
39415
- case "stealth":
39416
- return { shape: "path", d: "M0 0 L10 5 L0 10 L3 5 Z", ...box };
39417
- case "arrow":
39418
- return { shape: "path", d: "M1 1 L9 5 L1 9", strokeOnly: true, ...box };
39419
- // triangle / fallback
39420
- default:
39421
- return { shape: "path", d: "M0 0 L10 5 L0 10 Z", ...box };
39422
- }
39423
- }
39424
- function normalizeArrow(a) {
39425
- return a && a !== "none" ? a : void 0;
39426
- }
39427
-
39428
39468
  // src/pptx/render/connector-path.ts
39429
39469
  function buildConnectorGeometry(element, zIndex, routing) {
39430
39470
  const ss = pptx.hasShapeProperties(element) ? element.shapeStyle : void 0;
@@ -49395,6 +49435,10 @@ function buildTextBuildSpec(elementId, paraIndex, runs, states) {
49395
49435
  }
49396
49436
  function textBuildSpanStyle(span) {
49397
49437
  const style = { display: "inline" };
49438
+ if ("style" in span) {
49439
+ const runStyle = span.style;
49440
+ if (runStyle?.unicodeBidi === "embed") style.unicodeBidi = "normal";
49441
+ }
49398
49442
  if (span.hidden) {
49399
49443
  style.visibility = "hidden";
49400
49444
  }
@@ -92376,6 +92420,7 @@ exports.buildContextMenuEntries = buildContextMenuEntries;
92376
92420
  exports.buildCreateCollaborationConfig = buildCreateCollaborationConfig;
92377
92421
  exports.buildCropOverlay = buildCropOverlay;
92378
92422
  exports.buildCustomGeometryClipPath = buildCustomGeometryClipPath;
92423
+ exports.buildCustomPathMarkers = buildCustomPathMarkers;
92379
92424
  exports.buildDeckJson = buildDeckJson;
92380
92425
  exports.buildDeckSaveOptions = buildDeckSaveOptions;
92381
92426
  exports.buildDirectionGrid = buildDirectionGrid;
@@ -93214,6 +93259,7 @@ exports.interpolateSmartArtPalette = interpolateSmartArtPalette;
93214
93259
  exports.isActionButton = isActionButton;
93215
93260
  exports.isActionHidden = isActionHidden;
93216
93261
  exports.isAdditiveSelectionPress = isAdditiveSelectionPress;
93262
+ exports.isArrowedCustomPath = isArrowedCustomPath;
93217
93263
  exports.isArtisticEffectRendered = isArtisticEffectRendered;
93218
93264
  exports.isAudienceDisplayHash = isAudienceDisplayHash;
93219
93265
  exports.isAudienceDisplayTab = isAudienceDisplayTab;
@@ -1 +1 @@
1
- {"version":3,"file":"shape-filter-defs.d.ts","sourceRoot":"","sources":["../../../../src/pptx/dom/elements/shape-filter-defs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAsBnD;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,GAAG,aAAa,GAAG,IAAI,CAmC/F;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAiB9F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACtC,GAAG,EAAE,QAAQ,EACb,OAAO,EAAE,WAAW,EACpB,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACxC,WAAW,GAAG,IAAI,CAcpB;AAED;;;;;;;;;;;;GAYG;AACH;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,GAAG,aAAa,GAAG,IAAI,CAoBhG;AAED;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAC5C,GAAG,EAAE,QAAQ,EACb,OAAO,EAAE,WAAW,GAClB,aAAa,GAAG,IAAI,CAiBtB;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,GAAG,aAAa,GAAG,IAAI,CAuD7F"}
1
+ {"version":3,"file":"shape-filter-defs.d.ts","sourceRoot":"","sources":["../../../../src/pptx/dom/elements/shape-filter-defs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAsBnD;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,GAAG,aAAa,GAAG,IAAI,CAmC/F;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,GAAG,WAAW,GAAG,IAAI,CAiB9F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACtC,GAAG,EAAE,QAAQ,EACb,OAAO,EAAE,WAAW,EACpB,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACxC,WAAW,GAAG,IAAI,CAcpB;AAED;;;;;;;;;;;;GAYG;AACH;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,GAAG,aAAa,GAAG,IAAI,CAoBhG;AAED;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAC5C,GAAG,EAAE,QAAQ,EACb,OAAO,EAAE,WAAW,GAClB,aAAa,GAAG,IAAI,CAiBtB;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,GAAG,aAAa,GAAG,IAAI,CA+D7F"}