reamkit 1.33.1 → 1.33.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.
@@ -1,2 +1 @@
1
- import { buildPkcs7Detached } from "./cms.js";
2
- export { buildPkcs7Detached };
1
+ export { buildPkcs7Detached } from "./cms.js";
@@ -40,7 +40,7 @@ function parseSlideShapes(container, ctx = {}, transform = IDENTITY_TRANSFORM, s
40
40
  const out = [];
41
41
  for (const child of poChildren(container)) {
42
42
  if (skipPlaceholders && isPlaceholder(child)) continue;
43
- if (poIs(child, "p:sp")) {
43
+ if (poIs(child, "p:sp") || poIs(child, "p:cxnSp")) {
44
44
  const shape = parseSp(child, ctx, transform);
45
45
  if (shape) out.push({
46
46
  kind: "shape",
@@ -89,6 +89,15 @@ function pictureAsShape(pic) {
89
89
  const nv = poChildren(pic).find((c) => poIs(c, "p:nvPicPr"));
90
90
  return { "p:sp": [...nv ? [{ "p:nvSpPr": poChildren(nv) }] : [], { "p:spPr": [{ "a:blipFill": poChildren(blipFill) }, ...poChildren(spPr)] }] };
91
91
  }
92
+ /** Whether a shape properties node has an `a:ln` that states its own fill. */
93
+ function statesLineFill(spPr) {
94
+ const ln = poChildren(spPr).find((c) => poIs(c, "a:ln"));
95
+ return ln !== void 0 && poChildren(ln).some((c) => poIs(c, "a:noFill") || poIs(c, "a:solidFill") || poIs(c, "a:gradFill") || poIs(c, "a:pattFill"));
96
+ }
97
+ /** A line's stated properties, ready to spread over the ones it inherits. */
98
+ function definedProps(line) {
99
+ return Object.fromEntries(Object.entries(line).filter(([, v]) => v !== void 0));
100
+ }
92
101
  /**
93
102
  * Whether a shape is a placeholder — `p:ph` in its OWN non-visual properties.
94
103
  * Read as "anywhere below", a group holding one would take the whole group
@@ -169,12 +178,18 @@ function parseSp(sp, ctx, transform) {
169
178
  const styled = withStatedDirection(resolved, spPr);
170
179
  const lineFrom = from((n) => poChildren(n).some((c) => poIs(c, "a:ln")));
171
180
  let line = lineFrom ? parseLine(lineFrom, colors) : void 0;
172
- if (style) {
173
- const fromStyle = styleRefLine(style, colors, ctx.themeLineWidths);
174
- if (fromStyle) line = line ? {
175
- ...fromStyle,
176
- ...Object.fromEntries(Object.entries(line).filter(([, v]) => v !== void 0))
177
- } : fromStyle;
181
+ const fromStyle = style ? styleRefLine(style, colors, ctx.themeLineWidths) : void 0;
182
+ if (fromStyle) line = line ? {
183
+ ...fromStyle,
184
+ ...definedProps(line)
185
+ } : fromStyle;
186
+ else if (line && lineFrom && !statesLineFill(lineFrom)) {
187
+ const lentLine = protos.find(statesLineFill);
188
+ const lentProps = lentLine ? parseLine(lentLine, colors) : void 0;
189
+ line = lentProps ? {
190
+ ...lentProps,
191
+ ...definedProps(line)
192
+ } : void 0;
178
193
  }
179
194
  const shadowFrom = from((n) => poChildren(n).some((c) => poIs(c, "a:effectLst")));
180
195
  const shadow = shadowFrom ? parseShadow(shadowFrom, colors) : void 0;
@@ -31,8 +31,9 @@ export declare function parsePh(sp: PoNode): PlaceholderRef | undefined;
31
31
  /**
32
32
  * An xfrm node (`a:off` + `a:ext` children) → the EMU box. Works for both
33
33
  * `a:xfrm` (in `p:spPr`) and `p:xfrm` (on a `p:graphicFrame`), whose children are
34
- * identical. Returns `undefined` for a missing or degenerate (non-positive)
35
- * extent.
34
+ * identical. Returns `undefined` for a missing or negative extent, or one that is
35
+ * empty both ways. A single zero is a real box: a horizontal line has `cy="0"` and
36
+ * a vertical one `cx="0"`.
36
37
  */
37
38
  export declare function boxFromXfrm(xfrm: PoNode | undefined): ShapeBoxEmu | undefined;
38
39
  /**
@@ -34,8 +34,9 @@ function parsePh(sp) {
34
34
  /**
35
35
  * An xfrm node (`a:off` + `a:ext` children) → the EMU box. Works for both
36
36
  * `a:xfrm` (in `p:spPr`) and `p:xfrm` (on a `p:graphicFrame`), whose children are
37
- * identical. Returns `undefined` for a missing or degenerate (non-positive)
38
- * extent.
37
+ * identical. Returns `undefined` for a missing or negative extent, or one that is
38
+ * empty both ways. A single zero is a real box: a horizontal line has `cy="0"` and
39
+ * a vertical one `cx="0"`.
39
40
  */
40
41
  function boxFromXfrm(xfrm) {
41
42
  if (!xfrm) return void 0;
@@ -43,7 +44,8 @@ function boxFromXfrm(xfrm) {
43
44
  const ext = poChildren(xfrm).find((c) => poIs(c, "a:ext"));
44
45
  const cx = ext ? poIntAttr(ext, "cx") : void 0;
45
46
  const cy = ext ? poIntAttr(ext, "cy") : void 0;
46
- if (cx === void 0 || cy === void 0 || cx <= 0 || cy <= 0) return void 0;
47
+ if (cx === void 0 || cy === void 0 || cx < 0 || cy < 0) return void 0;
48
+ if (cx === 0 && cy === 0) return void 0;
47
49
  return {
48
50
  x: (off ? poIntAttr(off, "x") : void 0) ?? 0,
49
51
  y: (off ? poIntAttr(off, "y") : void 0) ?? 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reamkit",
3
- "version": "1.33.1",
3
+ "version": "1.33.2",
4
4
  "description": "Ream — convert DOCX, XLSX, PPTX, PDF and legacy DOC, XLS and PPT to PDF, SVG, HTML, Markdown, DOCX and XLSX, built from scratch on the ECMA-376 and ISO 32000 specifications. Parse once, convert anywhere.",
5
5
  "license": "MIT",
6
6
  "author": "Alexandr Krassavin <info@reamkit.dev>",
@@ -102,7 +102,7 @@
102
102
  "publint": "^0.3.21",
103
103
  "tsx": "^4.19.0",
104
104
  "typescript": "^5.7.0",
105
- "vite": "8.3.2",
105
+ "vite": "8.3.5",
106
106
  "vitest": "^5.0.3"
107
107
  },
108
108
  "overrides": {