@sobree/core 0.1.42 → 0.1.43

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.
@@ -41,6 +41,14 @@ export interface DocumentImport {
41
41
  */
42
42
  export interface ConvertOptions {
43
43
  replaceParagraphs?: Map<Element, Block>;
44
+ /** Whether the document carries inline-frame groups (section textbox
45
+ * pills, `<wp:inline>` drawing groups). These are the layouts whose
46
+ * frame heights our paginator estimates imperfectly, so for them we
47
+ * fall back to honouring Word's `<w:lastRenderedPageBreak/>` hints.
48
+ * A plain text-flow document paginates accurately on its own and must
49
+ * IGNORE the hints (ECMA-376's guidance), or stale hints fragment its
50
+ * pages. Set by the importer from the parsed inline-frame count. */
51
+ hasComplexFrames?: boolean;
44
52
  }
45
53
  export declare function convertDocumentXml(xmlDoc: Document, ctx: ConvertContext, opts?: ConvertOptions): DocumentImport;
46
54
  /**
package/dist/index.js CHANGED
@@ -3625,7 +3625,7 @@ function vu(e, t, n) {
3625
3625
  "lastRenderedPageBreak"
3626
3626
  ).length, i = {
3627
3627
  ...t,
3628
- honorLastRenderedPageBreaks: o >= 10,
3628
+ honorLastRenderedPageBreaks: o >= 10 && (n == null ? void 0 : n.hasComplexFrames) === !0,
3629
3629
  // Fold the replacement map into the CONTEXT (not just the body
3630
3630
  // walker's opts) — host paragraphs can live inside table cells,
3631
3631
  // whose walker only sees ctx. Without this, a drawing claimed from
@@ -4499,7 +4499,12 @@ async function uf(e) {
4499
4499
  r,
4500
4500
  { rels: i },
4501
4501
  {
4502
- replaceParagraphs: S
4502
+ replaceParagraphs: S,
4503
+ // Only honour Word's `<w:lastRenderedPageBreak/>` hints when the doc
4504
+ // has inline-frame groups (whose heights our paginator estimates
4505
+ // imperfectly). A plain text-flow doc re-paginates accurately, so
4506
+ // honouring stale hints would fragment it — see convertDocumentXml.
4507
+ hasComplexFrames: x.length > 0
4503
4508
  }
4504
4509
  ), P = I.map((j) => ai(j, i)), { body: F, frames: $ } = Fu(
4505
4510
  A,
@@ -12417,7 +12422,7 @@ function ob(e) {
12417
12422
  const o = e.getDocument(), i = o.sections.slice(), s = i.length - 1, a = i[s];
12418
12423
  a && (i.push(structuredClone(a)), e.setDocument({ ...o, sections: i }));
12419
12424
  }
12420
- const ib = "0.1.42", sb = ib;
12425
+ const ib = "0.1.43", sb = ib;
12421
12426
  function ab(e = document) {
12422
12427
  const t = e.createElement("div");
12423
12428
  return t.className = "sobree-version-badge", t.textContent = `@sobree/core v${sb}`, t.setAttribute("aria-hidden", "true"), Object.assign(t.style, {