@betteroffice/docx 0.0.4 → 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.
Files changed (70) hide show
  1. package/README.md +4 -7
  2. package/dist/chunk-47Q2FMFF.mjs +1 -0
  3. package/dist/chunk-5F6DLQZP.mjs +1 -0
  4. package/dist/chunk-6LQJAKOC.mjs +1 -0
  5. package/dist/chunk-ACGKK7IB.mjs +1 -0
  6. package/dist/{chunk-NTSSE5QK.mjs → chunk-AFMVSI4Z.mjs} +2 -2
  7. package/dist/chunk-GD4VNJ64.mjs +1 -0
  8. package/dist/{chunk-NJHOPXZW.mjs → chunk-HLDJMU3R.mjs} +1 -1
  9. package/dist/{chunk-YTILOUAA.mjs → chunk-JHJLG4I6.mjs} +1 -1
  10. package/dist/chunk-PGMXWI5X.mjs +1 -0
  11. package/dist/{chunk-NBSLB77E.mjs → chunk-WTFRNX5K.mjs} +1 -1
  12. package/dist/collaboration/index.d.mts +6 -6
  13. package/dist/{content-C3sTRz-u.d.mts → content-CvEtPl0c.d.mts} +124 -22
  14. package/dist/core.d.mts +8 -8
  15. package/dist/core.mjs +1 -1
  16. package/dist/{displayListQueries-DLzpvJV6.d.mts → displayListQueries-DF8F6fMl.d.mts} +87 -50
  17. package/dist/docx/index.d.mts +5 -5
  18. package/dist/docx/index.mjs +1 -1
  19. package/dist/editor/index.d.mts +21 -12
  20. package/dist/editor/index.mjs +1 -1
  21. package/dist/{fontLoader-CMH3bZ2Z.d.mts → fontLoader-b8eicJKV.d.mts} +1 -1
  22. package/dist/{formatting-BEkIBePP.d.mts → formatting-7zKCTu5a.d.mts} +11 -2
  23. package/dist/{frameDelta-B2kC6XiP.d.mts → frameDelta-pA4jrQ1G.d.mts} +16 -10
  24. package/dist/generated/edit/docx_edit_bg.wasm +0 -0
  25. package/dist/generated/layout/docx_layout_bg.wasm +0 -0
  26. package/dist/generated/opc/ooxml_opc_bg.wasm +0 -0
  27. package/dist/generated/parse/docx_parse_bg.wasm +0 -0
  28. package/dist/{index-2piKi4gO.d.mts → index-CHl2zLJ7.d.mts} +146 -77
  29. package/dist/layout/index.d.mts +40 -13
  30. package/dist/layout/index.mjs +1 -1
  31. package/dist/layout/pagination/index.d.mts +4 -4
  32. package/dist/layout/pagination/index.mjs +1 -1
  33. package/dist/layout/render/index.d.mts +33 -77
  34. package/dist/layout/render/index.mjs +1 -1
  35. package/dist/plugin-api/RenderedDomContext.d.mts +7 -7
  36. package/dist/plugin-api/index.d.mts +3 -3
  37. package/dist/plugin-api/resolveItemPositions.d.mts +3 -3
  38. package/dist/{rustDisplayList-B0M2eBkU.d.mts → rustDisplayList-BJqaN9tt.d.mts} +74 -50
  39. package/dist/{rustMeasureSource-D1KsQvVC.d.mts → rustMeasureSource-C0EZB055.d.mts} +5 -2
  40. package/dist/{selectiveSave-CVoajSKE.d.mts → selectiveSave-CRh-_Y_C.d.mts} +3 -3
  41. package/dist/styles/index.d.mts +6 -10
  42. package/dist/styles/index.mjs +1 -1
  43. package/dist/{styles-BK3Jecxs.d.mts → styles-7e-mq3c-.d.mts} +1 -1
  44. package/dist/types/content.d.mts +2 -2
  45. package/dist/types/document.d.mts +8 -7
  46. package/dist/{types-C1rv3KM-.d.mts → types-C4A8mWjU.d.mts} +44 -24
  47. package/dist/utils/comments.d.mts +2 -2
  48. package/dist/utils/index.d.mts +11 -13
  49. package/dist/utils/index.mjs +1 -1
  50. package/dist/utils/stylePreview.d.mts +2 -2
  51. package/dist/wasm-7SOSHNGP.mjs +1 -0
  52. package/dist/{wasm-JE7B3ROD.mjs → wasm-ZQAVP7P2.mjs} +1 -1
  53. package/dist/wasm-edit.d.mts +525 -185
  54. package/dist/wasm-edit.mjs +1 -1
  55. package/dist/wasm-layout.d.mts +31 -28
  56. package/dist/wasm-layout.mjs +1 -1
  57. package/dist/wasm-opc.mjs +1 -1
  58. package/dist/wasm-parse.d.mts +2 -1
  59. package/dist/wasm-parse.mjs +1 -1
  60. package/dist/yrs/index.d.mts +5 -5
  61. package/dist/yrs/index.mjs +1 -1
  62. package/dist/yrs/residentEngineWorker.mjs +1 -1
  63. package/package.json +19 -2
  64. package/dist/chunk-4V6MDZIK.mjs +0 -1
  65. package/dist/chunk-6KDV6AIL.mjs +0 -1
  66. package/dist/chunk-B4IR6YP4.mjs +0 -1
  67. package/dist/chunk-GGEGIQRK.mjs +0 -1
  68. package/dist/chunk-T4EZMUXM.mjs +0 -1
  69. package/dist/chunk-WBH3SXI6.mjs +0 -1
  70. package/dist/wasm-F2ETFAYL.mjs +0 -1
@@ -1,10 +1,10 @@
1
- export { a as attemptSelectiveSave, c as createDocx, p as parseDocx, r as repackDocx, u as updateMultipleFiles } from '../selectiveSave-CVoajSKE.mjs';
1
+ export { a as attemptSelectiveSave, c as createDocx, p as parseDocx, r as repackDocx, u as updateMultipleFiles } from '../selectiveSave-CRh-_Y_C.mjs';
2
2
  import { WrapType } from './wrapTypes.mjs';
3
- import { B as BlockContent, f as Comment, W as Watermark } from '../content-C3sTRz-u.mjs';
3
+ import { B as BlockContent, e as Comment, W as Watermark } from '../content-CvEtPl0c.mjs';
4
4
  import { Document } from '../types/document.mjs';
5
5
  import '../docxInput-DTbCa48g.mjs';
6
- import '../formatting-BEkIBePP.mjs';
7
- import '../styles-BK3Jecxs.mjs';
6
+ import '../formatting-7zKCTu5a.mjs';
7
+ import '../styles-7e-mq3c-.mjs';
8
8
 
9
9
  type AnchorWrapType = Exclude<WrapType, 'inline'>;
10
10
  type ImageLayoutTarget = AnchorWrapType | 'squareLeft' | 'squareRight' | 'inline';
@@ -71,7 +71,7 @@ declare function toolbarValueToLayoutTarget(value: string): ImageLayoutTarget |
71
71
  * Word / Pages / LibreOffice expect every comment in `comments.xml`
72
72
  * (including REPLY threads) to have matching `commentRangeStart` /
73
73
  * `commentRangeEnd` / `commentReference` markers in `document.xml`.
74
- * The PM document only stamps marks for the parent comment because
74
+ * The document only stamps marks for the parent comment because
75
75
  * replies don't have their own visible range — they share the parent
76
76
  * thread's text. So before serialization we walk the body content and
77
77
  * synthesize parallel range markers for every reply.
@@ -1,2 +1,2 @@
1
- import {e}from'../chunk-NTSSE5QK.mjs';export{i as attemptSelectiveSave,h as createDocx,a as parseDocx,f as repackDocx,g as updateMultipleFiles}from'../chunk-NTSSE5QK.mjs';import'../chunk-YTILOUAA.mjs';import'../chunk-6KDV6AIL.mjs';import'../chunk-NJHOPXZW.mjs';import'../chunk-B4IR6YP4.mjs';import'../chunk-T4EZMUXM.mjs';import'../chunk-TTRUPDAB.mjs';function E(e,t,o,r,i,p){let a=e.includes("w")||e.includes("e"),s=e.includes("n")||e.includes("s"),u=e.includes("w")?-1:1,l=e.includes("n")?-1:1,m=a?r+t*u:r,f=s?i+o*l:i;if(a&&s&&p){let g=Math.max(m/r,f/i);m=r*g,f=i*g;}let d=g=>Math.max(20,Math.min(2e3,g));return {width:a?d(m):r,height:s?d(f):i}}function q(e,t,o){let r=()=>t.position?.horizontal&&t.position.vertical?t.position:o?.initialPositionEmu?{horizontal:{relativeTo:"column",posOffset:o.initialPositionEmu.horizontalEmu},vertical:{relativeTo:"paragraph",posOffset:o.initialPositionEmu.verticalEmu}}:{horizontal:{relativeTo:"column",posOffset:0},vertical:{relativeTo:"paragraph",posOffset:0}};switch(e){case "inline":return {wrapType:"inline",displayMode:"inline",cssFloat:"none",wrapText:void 0,position:void 0,distTop:void 0,distBottom:void 0,distLeft:void 0,distRight:void 0};case "squareLeft":case "squareRight":{let i=e==="squareLeft"?"left":"right";return {wrapType:t.wrapType==="tight"||t.wrapType==="through"?t.wrapType:"square",displayMode:"float",cssFloat:i,wrapText:i==="left"?"right":"left",position:r()}}case "square":case "tight":case "through":{let i=t.cssFloat==="left"||t.cssFloat==="right"?t.cssFloat:"left";return {wrapType:e,displayMode:"float",cssFloat:i,wrapText:i==="left"?"right":"left",position:r()}}case "topAndBottom":return {wrapType:"topAndBottom",displayMode:"block",cssFloat:"none",wrapText:"bothSides",position:r()};case "behind":case "inFront":return {wrapType:e,displayMode:"float",cssFloat:"none",wrapText:"bothSides",position:r()}}}function W(e,t){return e==="inline"?"inline":e==="behind"?"behind":e==="inFront"?"inFront":e==="square"||e==="tight"||e==="through"?t==="right"?"squareRight":"squareLeft":null}var _=[{choice:"inline",i18nLabelKey:"inLineWithText",i18nDescKey:"inLineWithText",iconHint:"inline"},{choice:"squareLeft",i18nLabelKey:"squareLeft",i18nDescKey:"squareLeft",iconHint:"squareLeft"},{choice:"squareRight",i18nLabelKey:"squareRight",i18nDescKey:"squareRight",iconHint:"squareRight"},{choice:"behind",i18nLabelKey:"behindText",i18nDescKey:"behindText",iconHint:"behind"},{choice:"inFront",i18nLabelKey:"inFrontOfText",i18nDescKey:"inFrontOfText",iconHint:"inFront"}];function B(e,t){return true}function z(e){switch(e){case "inline":return "inline";case "square":case "tight":case "through":return "squareLeft";case "topAndBottom":return "topAndBottom";case "behind":return "behind";case "inFront":return "inFront";case "wrapRight":return "squareLeft";case "wrapLeft":return "squareRight";default:return}}function K(e,t){let o=t.filter(p=>p.parentId!=null);if(o.length===0)return;let r=new Map;for(let p of o){let a=r.get(p.parentId);a?a.push(p.id):r.set(p.parentId,[p.id]);}function i(p){for(let a of p)if(a.type==="paragraph"){if(!a.content.some(u=>u.type==="commentRangeStart"||u.type==="commentRangeEnd"))continue;let s=[];for(let u of a.content)if(u.type==="commentRangeStart"){s.push(u);let l=r.get(u.id);if(l)for(let m of l)s.push({type:"commentRangeStart",id:m});}else if(u.type==="commentRangeEnd"){s.push(u);let l=r.get(u.id);if(l)for(let m of l)s.push({type:"commentRangeEnd",id:m});}else s.push(u);a.content=s;}else if(a.type==="table")for(let s of a.rows)for(let u of s.cells)i(u.content);}i(e);}function X(e,t){let o=new Set(t.map(a=>a.id)),r=t.filter(a=>a.parentId!=null&&!o.has(a.parentId));if(r.length===0)return;let i=new Map;for(let a of r){let s=i.get(a.parentId);s?s.push(a.id):i.set(a.parentId,[a.id]);}function p(a){for(let s of a)if(s.type==="paragraph"){if(!s.content.some(f=>(f.type==="insertion"||f.type==="deletion")&&i.has(f.info.id)))continue;let l=[],m=s.content;for(let f=0;f<m.length;f++){let d=m[f];if((d.type==="insertion"||d.type==="deletion")&&i.has(d.info.id)){let g=i.get(d.info.id);for(let y of g)l.push({type:"commentRangeStart",id:y});l.push(d);let h=m[f+1];h&&(h.type==="insertion"||h.type==="deletion")&&h.type!==d.type&&h.info.author===d.info.author&&h.info.date===d.info.date&&(l.push(h),f++);for(let y of g)l.push({type:"commentRangeEnd",id:y});}else l.push(d);}s.content=l;}else if(s.type==="table")for(let u of s.rows)for(let l of u.cells)p(l.content);}p(e);}function $(e){let t=e?.package.headers;if(t){for(let o of t.values())if(o.watermark)return o.watermark}}function G(e){let t=e.package.headers;if(!t||t.size===0)return e;let o=false,r=new Map;for(let[i,p]of t)if(p.watermark){let{watermark:a,...s}=p;r.set(i,s),o=true;}else r.set(i,p);return o?{...e,package:{...e.package,headers:r}}:e}function N(e,t){let o=e.package.headers;if(!o||o.size===0)return e;let r=new Map;for(let[i,p]of o)r.set(i,{...p,watermark:{...t}});return {...e,package:{...e.package,headers:r}}}function j(e){let t=e.package.document,o=[];if(t.sections)for(let r of t.sections)r.properties&&o.push(r.properties);return t.finalSectionProperties&&o.push(t.finalSectionProperties),o}function U(e$1,t){let o=e$1.package,r=o.document,i=o.headers,p=j(e$1),a=new Set;if(i)for(let n of i.values())a.add(n.hdrFtrType);let s=!i||i.size===0,u=p.some(n=>n.titlePg),l=p.some(n=>n.evenAndOddHeaders),m=s,f=u&&!a.has("first"),d=l&&!a.has("even");if(!m&&!f&&!d)return e$1;let g=o.relationships?new Map(o.relationships):new Map,h=new Map(i??[]),y=new Set;for(let n of g.values())n.target&&y.add(n.target.replace(/^\/?word\//,"").toLowerCase());function P(){let n=1;for(;y.has(`header${n}.xml`);)n++;let c=`header${n}.xml`;return y.add(c.toLowerCase()),c}function v(n){let c=`rIdWmHdr${n[0].toUpperCase()}${n.slice(1)}`,I=1;for(;g.has(c);)c=`rIdWmHdr${n[0].toUpperCase()}${n.slice(1)}${I++}`;return g.set(c,{id:c,type:e.header,target:P()}),h.set(c,{type:"header",hdrFtrType:n,content:[],watermark:{...t}}),c}let T={};function F(n){return T[n]??(T[n]=v(n))}function L(n,c){let I=n?.headerReferences?[...n.headerReferences]:[];return I.some(S=>S.type===c)?n??{}:(I.push({type:c,rId:F(c)}),{...n??{},headerReferences:I})}function w(n){let c=n;return m&&(c=L(c,"default")),f&&c?.titlePg&&(c=L(c,"first")),d&&c?.evenAndOddHeaders&&(c=L(c,"even")),c}let M=w(r.finalSectionProperties),k=r.sections?.map(n=>({...n,properties:w(n.properties)??n.properties}));return {...e$1,package:{...o,relationships:g,headers:h,document:{...r,finalSectionProperties:M,...k?{sections:k}:{}}}}}function Y(e,t){if(!t)return G(e);let o=N(e,t);return U(o,t)}
1
+ import {e}from'../chunk-AFMVSI4Z.mjs';export{i as attemptSelectiveSave,h as createDocx,a as parseDocx,f as repackDocx,g as updateMultipleFiles}from'../chunk-AFMVSI4Z.mjs';import'../chunk-JHJLG4I6.mjs';import'../chunk-6LQJAKOC.mjs';import'../chunk-HLDJMU3R.mjs';import'../chunk-ACGKK7IB.mjs';import'../chunk-5F6DLQZP.mjs';import'../chunk-TTRUPDAB.mjs';function E(e,t,o,r,i,p){let a=e.includes("w")||e.includes("e"),s=e.includes("n")||e.includes("s"),u=e.includes("w")?-1:1,l=e.includes("n")?-1:1,m=a?r+t*u:r,f=s?i+o*l:i;if(a&&s&&p){let g=Math.max(m/r,f/i);m=r*g,f=i*g;}let d=g=>Math.max(20,Math.min(2e3,g));return {width:a?d(m):r,height:s?d(f):i}}function q(e,t,o){let r=()=>t.position?.horizontal&&t.position.vertical?t.position:o?.initialPositionEmu?{horizontal:{relativeTo:"column",posOffset:o.initialPositionEmu.horizontalEmu},vertical:{relativeTo:"paragraph",posOffset:o.initialPositionEmu.verticalEmu}}:{horizontal:{relativeTo:"column",posOffset:0},vertical:{relativeTo:"paragraph",posOffset:0}};switch(e){case "inline":return {wrapType:"inline",displayMode:"inline",cssFloat:"none",wrapText:void 0,position:void 0,distTop:void 0,distBottom:void 0,distLeft:void 0,distRight:void 0};case "squareLeft":case "squareRight":{let i=e==="squareLeft"?"left":"right";return {wrapType:t.wrapType==="tight"||t.wrapType==="through"?t.wrapType:"square",displayMode:"float",cssFloat:i,wrapText:i==="left"?"right":"left",position:r()}}case "square":case "tight":case "through":{let i=t.cssFloat==="left"||t.cssFloat==="right"?t.cssFloat:"left";return {wrapType:e,displayMode:"float",cssFloat:i,wrapText:i==="left"?"right":"left",position:r()}}case "topAndBottom":return {wrapType:"topAndBottom",displayMode:"block",cssFloat:"none",wrapText:"bothSides",position:r()};case "behind":case "inFront":return {wrapType:e,displayMode:"float",cssFloat:"none",wrapText:"bothSides",position:r()}}}function W(e,t){return e==="inline"?"inline":e==="behind"?"behind":e==="inFront"?"inFront":e==="square"||e==="tight"||e==="through"?t==="right"?"squareRight":"squareLeft":null}var _=[{choice:"inline",i18nLabelKey:"inLineWithText",i18nDescKey:"inLineWithText",iconHint:"inline"},{choice:"squareLeft",i18nLabelKey:"squareLeft",i18nDescKey:"squareLeft",iconHint:"squareLeft"},{choice:"squareRight",i18nLabelKey:"squareRight",i18nDescKey:"squareRight",iconHint:"squareRight"},{choice:"behind",i18nLabelKey:"behindText",i18nDescKey:"behindText",iconHint:"behind"},{choice:"inFront",i18nLabelKey:"inFrontOfText",i18nDescKey:"inFrontOfText",iconHint:"inFront"}];function B(e,t){return true}function z(e){switch(e){case "inline":return "inline";case "square":case "tight":case "through":return "squareLeft";case "topAndBottom":return "topAndBottom";case "behind":return "behind";case "inFront":return "inFront";case "wrapRight":return "squareLeft";case "wrapLeft":return "squareRight";default:return}}function K(e,t){let o=t.filter(p=>p.parentId!=null);if(o.length===0)return;let r=new Map;for(let p of o){let a=r.get(p.parentId);a?a.push(p.id):r.set(p.parentId,[p.id]);}function i(p){for(let a of p)if(a.type==="paragraph"){if(!a.content.some(u=>u.type==="commentRangeStart"||u.type==="commentRangeEnd"))continue;let s=[];for(let u of a.content)if(u.type==="commentRangeStart"){s.push(u);let l=r.get(u.id);if(l)for(let m of l)s.push({type:"commentRangeStart",id:m});}else if(u.type==="commentRangeEnd"){s.push(u);let l=r.get(u.id);if(l)for(let m of l)s.push({type:"commentRangeEnd",id:m});}else s.push(u);a.content=s;}else if(a.type==="table")for(let s of a.rows)for(let u of s.cells)i(u.content);}i(e);}function X(e,t){let o=new Set(t.map(a=>a.id)),r=t.filter(a=>a.parentId!=null&&!o.has(a.parentId));if(r.length===0)return;let i=new Map;for(let a of r){let s=i.get(a.parentId);s?s.push(a.id):i.set(a.parentId,[a.id]);}function p(a){for(let s of a)if(s.type==="paragraph"){if(!s.content.some(f=>(f.type==="insertion"||f.type==="deletion")&&i.has(f.info.id)))continue;let l=[],m=s.content;for(let f=0;f<m.length;f++){let d=m[f];if((d.type==="insertion"||d.type==="deletion")&&i.has(d.info.id)){let g=i.get(d.info.id);for(let y of g)l.push({type:"commentRangeStart",id:y});l.push(d);let h=m[f+1];h&&(h.type==="insertion"||h.type==="deletion")&&h.type!==d.type&&h.info.author===d.info.author&&h.info.date===d.info.date&&(l.push(h),f++);for(let y of g)l.push({type:"commentRangeEnd",id:y});}else l.push(d);}s.content=l;}else if(s.type==="table")for(let u of s.rows)for(let l of u.cells)p(l.content);}p(e);}function $(e){let t=e?.package.headers;if(t){for(let o of t.values())if(o.watermark)return o.watermark}}function G(e){let t=e.package.headers;if(!t||t.size===0)return e;let o=false,r=new Map;for(let[i,p]of t)if(p.watermark){let{watermark:a,...s}=p;r.set(i,s),o=true;}else r.set(i,p);return o?{...e,package:{...e.package,headers:r}}:e}function N(e,t){let o=e.package.headers;if(!o||o.size===0)return e;let r=new Map;for(let[i,p]of o)r.set(i,{...p,watermark:{...t}});return {...e,package:{...e.package,headers:r}}}function j(e){let t=e.package.document,o=[];if(t.sections)for(let r of t.sections)r.properties&&o.push(r.properties);return t.finalSectionProperties&&o.push(t.finalSectionProperties),o}function U(e$1,t){let o=e$1.package,r=o.document,i=o.headers,p=j(e$1),a=new Set;if(i)for(let n of i.values())a.add(n.hdrFtrType);let s=!i||i.size===0,u=p.some(n=>n.titlePg),l=p.some(n=>n.evenAndOddHeaders),m=s,f=u&&!a.has("first"),d=l&&!a.has("even");if(!m&&!f&&!d)return e$1;let g=o.relationships?new Map(o.relationships):new Map,h=new Map(i??[]),y=new Set;for(let n of g.values())n.target&&y.add(n.target.replace(/^\/?word\//,"").toLowerCase());function P(){let n=1;for(;y.has(`header${n}.xml`);)n++;let c=`header${n}.xml`;return y.add(c.toLowerCase()),c}function v(n){let c=`rIdWmHdr${n[0].toUpperCase()}${n.slice(1)}`,I=1;for(;g.has(c);)c=`rIdWmHdr${n[0].toUpperCase()}${n.slice(1)}${I++}`;return g.set(c,{id:c,type:e.header,target:P()}),h.set(c,{type:"header",hdrFtrType:n,content:[],watermark:{...t}}),c}let T={};function F(n){return T[n]??(T[n]=v(n))}function L(n,c){let I=n?.headerReferences?[...n.headerReferences]:[];return I.some(S=>S.type===c)?n??{}:(I.push({type:c,rId:F(c)}),{...n??{},headerReferences:I})}function w(n){let c=n;return m&&(c=L(c,"default")),f&&c?.titlePg&&(c=L(c,"first")),d&&c?.evenAndOddHeaders&&(c=L(c,"even")),c}let M=w(r.finalSectionProperties),k=r.sections?.map(n=>({...n,properties:w(n.properties)??n.properties}));return {...e$1,package:{...o,relationships:g,headers:h,document:{...r,finalSectionProperties:M,...k?{sections:k}:{}}}}}function Y(e,t){if(!t)return G(e);let o=N(e,t);return U(o,t)}
2
2
  export{_ as IMAGE_LAYOUT_OPTIONS,E as calculateResizedImageDimensions,W as deriveLayoutChoice,$ as getDocumentWatermark,K as injectReplyRangeMarkers,X as injectTCReplyRangeMarkers,B as isImageLayoutOptionEnabled,q as resolveImageLayoutAttrs,Y as setDocumentWatermark,z as toolbarValueToLayoutTarget};
@@ -1,13 +1,13 @@
1
- import { R as ResidentMeasurementConfig } from '../rustMeasureSource-D1KsQvVC.mjs';
2
- import { L as LayoutBlock, B as BlockExtent, a as Layout, b as LayoutOptions } from '../types-C1rv3KM-.mjs';
1
+ import { R as ResidentMeasurementConfig } from '../rustMeasureSource-C0EZB055.mjs';
2
+ import { L as Layout, a as LayoutOptions } from '../types-C4A8mWjU.mjs';
3
3
  import { MeasuredBlock } from '../layout/pagination/index.mjs';
4
- import { D as DisplayListHeadersFooters } from '../rustDisplayList-B0M2eBkU.mjs';
4
+ import { D as DisplayListHeadersFooters } from '../rustDisplayList-BJqaN9tt.mjs';
5
5
  import { Document } from '../types/document.mjs';
6
- import { Y as YrsSession, a as YrsRenderEnv } from '../index-2piKi4gO.mjs';
7
- import { S as SectionProperties, N as NoteKind } from '../content-C3sTRz-u.mjs';
8
- import '../formatting-BEkIBePP.mjs';
9
- import '../frameDelta-B2kC6XiP.mjs';
10
- import '../styles-BK3Jecxs.mjs';
6
+ import { Y as YrsSession, a as YrsRenderEnv } from '../index-CHl2zLJ7.mjs';
7
+ import { f as SectionProperties, N as NoteKind, g as DocumentBody } from '../content-CvEtPl0c.mjs';
8
+ import '../formatting-7zKCTu5a.mjs';
9
+ import '../frameDelta-pA4jrQ1G.mjs';
10
+ import '../styles-7e-mq3c-.mjs';
11
11
  import '../docx/wrapTypes.mjs';
12
12
 
13
13
  interface ResidentRegionLayoutRequest {
@@ -34,13 +34,11 @@ interface ResidentRegionLayoutRequest {
34
34
  interface ComputeLayoutInputs {
35
35
  document: Document | null;
36
36
  pageGap: number;
37
- session: Pick<YrsSession, 'layoutDocumentWithRegionsJson'>;
37
+ session: Pick<YrsSession, 'layoutDocumentWithRegionsRetainedJson' | 'residentWorkerProbe' | 'retainedKernelInputsJson'>;
38
38
  renderEnv: YrsRenderEnv;
39
39
  measurement: ResidentMeasurementConfig;
40
40
  }
41
41
  interface LayoutComputation {
42
- blocks: LayoutBlock[];
43
- measures: BlockExtent[];
44
42
  layout: Layout;
45
43
  notesConverged: boolean;
46
44
  }
@@ -52,4 +50,15 @@ declare function getLayoutKernelInputs(layout: Layout): {
52
50
  } | undefined;
53
51
  declare function computeLayout(inputs: ComputeLayoutInputs): LayoutComputation;
54
52
 
55
- export { type ComputeLayoutInputs, type LayoutComputation, buildResidentRegionLayoutRequest, computeLayout, getLayoutKernelInputs };
53
+ /**
54
+ * The last section with inherited references; `finalSectionProperties`
55
+ * is the body sectPr as authored.
56
+ */
57
+ declare function resolvedFinalSectionProperties(body: DocumentBody | null | undefined): SectionProperties | undefined;
58
+ /**
59
+ * Applies an edit to the last section on both views: the resolved entry the
60
+ * engine lays out and the authored sectPr the serializer saves.
61
+ */
62
+ declare function updateFinalSectionProperties(body: DocumentBody, update: (properties: SectionProperties) => SectionProperties): DocumentBody;
63
+
64
+ export { type ComputeLayoutInputs, type LayoutComputation, buildResidentRegionLayoutRequest, computeLayout, getLayoutKernelInputs, resolvedFinalSectionProperties, updateFinalSectionProperties };
@@ -1 +1 @@
1
- import'../chunk-TTRUPDAB.mjs';var r=new WeakMap;function p(e){let n=e?.package.document;if(!n)return [{properties:{}}];let t=(n.sections??[]).map(o=>({sectionId:o.id??o.properties.sectionId,properties:o.properties}));return t.push({sectionId:n.finalSectionProperties?.sectionId,properties:n.finalSectionProperties??{}}),t}function a(e,n,t){let o=[];for(let s of e?.package.footnotes??[])s.noteType&&s.noteType!=="normal"||o.push({id:s.id,noteKind:"footnote",height:0});for(let s of e?.package.endnotes??[])s.noteType&&s.noteType!=="normal"||o.push({id:s.id,noteKind:"endnote",height:0});return {bodyStory:"body",options:{contractVersion:e?.package.contractVersion,pageGap:n},regions:{sections:p(e),settings:e?.package.settings,watermark:e?.package.document.finalSectionProperties?.watermark},notes:{contents:o},renderEnv:t}}function d(e){return r.get(e)}function c(e){let n=a(e.document,e.pageGap,e.renderEnv);n.measurement=e.measurement;let t=JSON.parse(e.session.layoutDocumentWithRegionsJson(JSON.stringify(n)));return r.set(t.layout,{measured:t.measured,options:t.options,...t.headersFooters?{headersFooters:t.headersFooters}:{}}),{blocks:t.measured.map(o=>o.block),measures:t.measured.map(o=>o.measure),layout:t.layout,notesConverged:t.notesConverged}}export{a as buildResidentRegionLayoutRequest,c as computeLayout,d as getLayoutKernelInputs};
1
+ import'../chunk-TTRUPDAB.mjs';function i(e){return e?.sections?.at(-1)?.properties??e?.finalSectionProperties}function l(e,r){let n=e.sections?.map((t,o,s)=>o===s.length-1?{...t,properties:r(t.properties)}:t);return {...e,...n?{sections:n}:{},finalSectionProperties:r(e.finalSectionProperties??{})}}var d=new WeakMap;function y(e){let r=e?.package.document;if(!r)return [{properties:{}}];let n=(r.sections??[]).map(t=>({sectionId:t.id??t.properties.sectionId,properties:t.properties}));return n.push({sectionId:n.at(-1)?.sectionId??r.finalSectionProperties?.sectionId,properties:i(r)??{}}),n}function c(e,r,n){let t=[];for(let o of e?.package.footnotes??[])o.noteType&&o.noteType!=="normal"||t.push({id:o.id,noteKind:"footnote",height:0});for(let o of e?.package.endnotes??[])o.noteType&&o.noteType!=="normal"||t.push({id:o.id,noteKind:"endnote",height:0});return {bodyStory:"body",options:{contractVersion:e?.package.contractVersion,pageGap:r},regions:{sections:y(e),settings:e?.package.settings,watermark:i(e?.package.document)?.watermark},notes:{contents:t},renderEnv:{...n,...m(e,n),tocStyleIds:[...new Set([...n.tocStyleIds??[],...(e?.package.styles?.styles??[]).filter(o=>o.type==="paragraph"&&typeof o.styleId=="string"&&o.styleId&&[o.styleId,o.name].some(s=>/^TOC\s*\d+$/i.test(s??""))).map(o=>o.styleId)])]}}}function m(e,r){if(r.defaultParagraphStyleId)return {};let n=e?.package.styles?.styles??[],t=n.find(s=>s.type==="paragraph"&&s.default&&s.styleId)?.styleId;return t?{defaultParagraphStyleId:t}:n.some(s=>s.type==="paragraph"&&s.styleId==="Normal")?{defaultParagraphStyleId:"Normal"}:{}}function g(e){return d.get(e)}function f(e){let r=c(e.document,e.pageGap,e.renderEnv);r.measurement=e.measurement;let n=e.session,t=JSON.parse(n.layoutDocumentWithRegionsRetainedJson(JSON.stringify(r))),o=n.residentWorkerProbe().layoutRevision,s=null,a=()=>s??(s=JSON.parse(n.retainedKernelInputsJson(o)));return d.set(t.layout,{get measured(){return a().measured},get options(){return a().options},...t.headersFooters?{headersFooters:t.headersFooters}:{}}),{layout:t.layout,notesConverged:t.notesConverged}}export{c as buildResidentRegionLayoutRequest,f as computeLayout,g as getLayoutKernelInputs,i as resolvedFinalSectionProperties,l as updateFinalSectionProperties};
@@ -1,4 +1,4 @@
1
- import { y as ThemeColorSlot, C as ColorValue, f as Theme, x as ThemeColorScheme } from './formatting-BEkIBePP.mjs';
1
+ import { y as ThemeColorSlot, C as ColorValue, f as Theme, x as ThemeColorScheme } from './formatting-7zKCTu5a.mjs';
2
2
 
3
3
  /**
4
4
  * Color primitives and math shared across OOXML formats.
@@ -389,6 +389,8 @@ interface ParagraphFormatting {
389
389
  spaceBefore?: number;
390
390
  /** Spacing after in twips (w:spacing/@w:after) */
391
391
  spaceAfter?: number;
392
+ spaceBeforeLines?: number;
393
+ spaceAfterLines?: number;
392
394
  /** Line spacing value (w:spacing/@w:line) */
393
395
  lineSpacing?: number;
394
396
  /** Line spacing rule (w:spacing/@w:lineRule) */
@@ -399,8 +401,7 @@ interface ParagraphFormatting {
399
401
  afterAutospacing?: boolean;
400
402
  /**
401
403
  * Per-side flags marking which `<w:spacing>` attrs came from this
402
- * paragraph's own pPr (vs inherited). Word collapses style-inherited
403
- * spacing on empty paragraphs but honors the explicit values.
404
+ * paragraph's own pPr (vs inherited).
404
405
  */
405
406
  spacingExplicit?: SpacingExplicit;
406
407
  /** Left indent in twips (w:ind/@w:left) */
@@ -411,6 +412,14 @@ interface ParagraphFormatting {
411
412
  indentFirstLine?: number;
412
413
  /** Whether first line is hanging indent */
413
414
  hangingIndent?: boolean;
415
+ /** Left indent in hundredths of a character (w:ind/@w:leftChars) */
416
+ indentLeftChars?: number;
417
+ /** Right indent in hundredths of a character (w:ind/@w:rightChars) */
418
+ indentRightChars?: number;
419
+ /** First line indent in hundredths of a character - negative for hanging (w:ind/@w:firstLineChars or @w:hangingChars) */
420
+ indentFirstLineChars?: number;
421
+ /** Whether the character first-line indent is hanging; the sign of a zero does not survive JSON */
422
+ hangingIndentChars?: boolean;
414
423
  /** Paragraph borders (w:pBdr) */
415
424
  borders?: {
416
425
  top?: BorderSpec;
@@ -1,5 +1,5 @@
1
- import { T as TextModernEffects } from './formatting-BEkIBePP.mjs';
2
- import { D as DrawingScene, d as ShapeTextBodyProperties } from './content-C3sTRz-u.mjs';
1
+ import { T as TextModernEffects } from './formatting-7zKCTu5a.mjs';
2
+ import { D as DrawingScene, c as ShapeTextBodyProperties } from './content-CvEtPl0c.mjs';
3
3
 
4
4
  interface DisplayList {
5
5
  /** Contract version. Undefined reads as legacy version 0. */
@@ -57,7 +57,7 @@ interface NoteRegion {
57
57
  primitives?: DisplayPrimitive[];
58
58
  noteIds?: number[];
59
59
  /**
60
- * Per-note backlink metadata (W17): the body-doc PM range of each note's
60
+ * Per-note backlink metadata (W17): the body-doc range of each note's
61
61
  * reference mark plus its formatted label, so the a11y mirror can wire
62
62
  * note ↔ reference associations (doc-noteref / doc-backlink). Parallel to
63
63
  * `noteIds`; undefined = legacy region without backlink data.
@@ -67,7 +67,7 @@ interface NoteRegion {
67
67
  /** Backlink metadata for one note in a NoteRegion. */
68
68
  interface NoteRegionNote {
69
69
  id?: number;
70
- /** Body-doc PM range of the reference mark anchoring this note. */
70
+ /** Body-doc range of the reference mark anchoring this note. */
71
71
  anchorDocStart?: number;
72
72
  anchorDocEnd?: number;
73
73
  /** Formatted reference label (display number / custom mark). File-derived. */
@@ -168,6 +168,11 @@ interface DisplayClipGroupMetadata {
168
168
  };
169
169
  opacity?: number;
170
170
  }
171
+ /** Horizontal paint slot for text laid out with guessed metrics. */
172
+ interface DisplayPaintClip {
173
+ x: number;
174
+ w: number;
175
+ }
171
176
  interface StructuralRevision {
172
177
  scope: 'pmark' | 'table' | 'row' | 'cell';
173
178
  author: string;
@@ -290,10 +295,7 @@ interface DocAttrs {
290
295
  groupId?: string;
291
296
  /** Review presentation for comment-associated primitives. */
292
297
  comment?: DisplayCommentMetadata;
293
- /**
294
- * Scoped clip/group membership. Undefined = ungrouped. Kept as metadata
295
- * until the canvas/mirror batch activates `ClipGroupPrimitive` in the union.
296
- */
298
+ /** Scoped clip/group membership. Undefined = ungrouped. */
297
299
  clipGroup?: DisplayClipGroupMetadata;
298
300
  /** Enclosing table-fragment identity and accessibility semantics. */
299
301
  table?: DisplayTableMetadata;
@@ -304,6 +306,7 @@ interface TextRunPrimitive extends DocAttrs {
304
306
  x: number;
305
307
  baselineY: number;
306
308
  width: number;
309
+ paintClip?: DisplayPaintClip;
307
310
  font: string;
308
311
  color: string;
309
312
  letterSpacing?: number;
@@ -321,7 +324,7 @@ interface TextRunPrimitive extends DocAttrs {
321
324
  smallCaps?: boolean;
322
325
  /** Hidden run shown in editing view as dimmed/dotted, matching the DOM painter. */
323
326
  hidden?: boolean;
324
- /** CSS-like shadow effect ported from run formatting. */
327
+ /** CSS-like shadow effect from run formatting. */
325
328
  textShadow?: 'shadow' | 'emboss' | 'imprint';
326
329
  /** Outlined / hollow text. */
327
330
  textOutline?: boolean;
@@ -345,6 +348,7 @@ interface PositionedGlyph {
345
348
  /** Bidi embedding level for this cluster. */
346
349
  bidiLevel?: number;
347
350
  }
351
+ /** Shaped glyph run with source text for accessibility. */
348
352
  interface GlyphRunPrimitive extends DocAttrs {
349
353
  kind: 'glyphRun';
350
354
  fontId: number;
@@ -352,6 +356,7 @@ interface GlyphRunPrimitive extends DocAttrs {
352
356
  color: string;
353
357
  text: string;
354
358
  glyphs: PositionedGlyph[];
359
+ paintClip?: DisplayPaintClip;
355
360
  fallbackFont?: string;
356
361
  wordSpacing?: number;
357
362
  rtl?: boolean;
@@ -367,7 +372,7 @@ interface GlyphRunPrimitive extends DocAttrs {
367
372
  smallCaps?: boolean;
368
373
  /** Hidden run shown in editing view as dimmed/dotted, matching the DOM painter. */
369
374
  hidden?: boolean;
370
- /** CSS-like shadow effect ported from run formatting. */
375
+ /** CSS-like shadow effect from run formatting. */
371
376
  textShadow?: 'shadow' | 'emboss' | 'imprint';
372
377
  /** Outlined / hollow text. */
373
378
  textOutline?: boolean;
@@ -430,6 +435,7 @@ interface PageBorderPrimitive {
430
435
  }
431
436
  interface ImagePrimitive extends DocAttrs {
432
437
  kind: 'image';
438
+ shapeType?: string;
433
439
  relId: string;
434
440
  x: number;
435
441
  y: number;