@betteroffice/docx 0.4.0 → 0.4.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.
Files changed (74) hide show
  1. package/README.md +2 -1
  2. package/dist/chunk-4PRCO6EC.mjs +1 -0
  3. package/dist/chunk-5Z22FORG.mjs +1 -0
  4. package/dist/chunk-7SUVUKWT.mjs +1 -0
  5. package/dist/chunk-7ZV6P6NZ.mjs +57 -0
  6. package/dist/{chunk-2QHGQA3V.mjs → chunk-AXFMDV66.mjs} +1 -1
  7. package/dist/{chunk-YLFKV2NT.mjs → chunk-EBYC3CX7.mjs} +1 -1
  8. package/dist/{chunk-3CYO46ML.mjs → chunk-GKWXOZZH.mjs} +1 -1
  9. package/dist/chunk-HGKSOBXK.mjs +1 -0
  10. package/dist/chunk-LIOWZSE7.mjs +1 -0
  11. package/dist/chunk-ML6E23W2.mjs +1 -0
  12. package/dist/{chunk-NVN26RHH.mjs → chunk-MLEMGJP7.mjs} +1 -1
  13. package/dist/chunk-QBMNRD5V.mjs +2 -0
  14. package/dist/chunk-RNNTXPXC.mjs +1 -0
  15. package/dist/chunk-UBUTIWXN.mjs +1 -0
  16. package/dist/chunk-VH7P4734.mjs +16 -0
  17. package/dist/collaboration/index.d.mts +6 -5
  18. package/dist/compareDocx-CWOYEBCE.mjs +1 -0
  19. package/dist/{computeLayout-4MNWHE2T.mjs → computeLayout-ZTO6TBWX.mjs} +1 -1
  20. package/dist/{content-BzoC6bSz.d.mts → content-DSb-6a9T.d.mts} +5 -5
  21. package/dist/core.d.mts +5 -5
  22. package/dist/core.mjs +1 -1
  23. package/dist/{displayListQueries-H5YnU_hX.d.mts → displayListQueries-BVBDVXoP.d.mts} +2 -2
  24. package/dist/docx/index.d.mts +3 -3
  25. package/dist/docx/index.mjs +2 -2
  26. package/dist/editor/index.d.mts +11 -6
  27. package/dist/editor/index.mjs +1 -1
  28. package/dist/{frameDelta-ByU7HBuB.d.mts → frameDelta-CLeO7K5z.d.mts} +5 -2
  29. package/dist/generated/edit/docx_edit_bg.wasm +0 -0
  30. package/dist/generated/layout/docx_layout_bg.wasm +0 -0
  31. package/dist/generated/opc/ooxml_opc_bg.wasm +0 -0
  32. package/dist/generated/parse/docx_parse_bg.wasm +0 -0
  33. package/dist/{index-CHy6_Yuo.d.mts → index-DzZVJC8-.d.mts} +453 -12
  34. package/dist/layout/index.d.mts +2 -2
  35. package/dist/layout/index.mjs +1 -1
  36. package/dist/layout/pagination/index.d.mts +3 -3
  37. package/dist/layout/render/index.d.mts +32 -11
  38. package/dist/layout/render/index.mjs +1 -1
  39. package/dist/{pagedExport---0Dlmzo.d.mts → pagedExport-BmSlEhoP.d.mts} +1 -1
  40. package/dist/{parseWasm-NLAG22EU.mjs → parseWasm-BESKFFA3.mjs} +1 -1
  41. package/dist/plugin-api/RenderedDomContext.d.mts +5 -5
  42. package/dist/plugin-api/index.d.mts +1 -1
  43. package/dist/plugin-api/resolveItemPositions.d.mts +1 -1
  44. package/dist/{rustDisplayList-LcRZHCSL.d.mts → rustDisplayList-B7uPoItK.d.mts} +2 -2
  45. package/dist/types/content.d.mts +1 -1
  46. package/dist/types/document.d.mts +2 -2
  47. package/dist/{types-D6Pra38E.d.mts → types-Cz7S77Ut.d.mts} +23 -1
  48. package/dist/utils/comments.d.mts +1 -1
  49. package/dist/utils/index.d.mts +1 -1
  50. package/dist/utils/index.mjs +1 -1
  51. package/dist/{wasm-K6DRABAA.mjs → wasm-GFT55YT6.mjs} +1 -1
  52. package/dist/wasm-QI7MWC5D.mjs +1 -0
  53. package/dist/wasm-QXYYV7LU.mjs +1 -0
  54. package/dist/wasm-edit.d.mts +41 -2
  55. package/dist/wasm-edit.mjs +1 -1
  56. package/dist/wasm-layout.mjs +1 -1
  57. package/dist/wasm-opc.mjs +1 -1
  58. package/dist/wasm-parse.mjs +1 -1
  59. package/dist/yrs/index.d.mts +5 -4
  60. package/dist/yrs/index.mjs +1 -1
  61. package/dist/yrs/residentEngineWorker.mjs +1 -1
  62. package/package.json +1 -1
  63. package/dist/chunk-24Z6ZVFZ.mjs +0 -1
  64. package/dist/chunk-6CHGYCFU.mjs +0 -1
  65. package/dist/chunk-F2VBW6RB.mjs +0 -1
  66. package/dist/chunk-L2ML3DDI.mjs +0 -1
  67. package/dist/chunk-LIGZ75FP.mjs +0 -1
  68. package/dist/chunk-ND3FBCB3.mjs +0 -16
  69. package/dist/chunk-NMDQHUQB.mjs +0 -57
  70. package/dist/chunk-OK5UFGX3.mjs +0 -1
  71. package/dist/chunk-RZQ3OXZY.mjs +0 -2
  72. package/dist/compareDocx-IHFPGIGV.mjs +0 -1
  73. package/dist/wasm-GSI2XMOH.mjs +0 -1
  74. package/dist/wasm-NF6B3AH7.mjs +0 -1
@@ -1,2 +0,0 @@
1
- import {c,a,b}from'./chunk-2QHGQA3V.mjs';import {a as a$1,g}from'./chunk-3CYO46ML.mjs';var S={image:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",hyperlink:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",header:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",footer:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",footnotes:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes",endnotes:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes",styles:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",numbering:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",fontTable:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable",theme:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",settings:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",webSettings:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings",oleObject:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject",chart:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",diagramData:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData",officeDocument:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",coreProperties:"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",extendedProperties:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",customProperties:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties",customXml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml",comments:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",commentsExtended:"http://schemas.microsoft.com/office/2011/relationships/commentsExtended",commentsIds:"http://schemas.microsoft.com/office/2016/09/relationships/commentsIds",commentsExtensible:"http://schemas.microsoft.com/office/2018/08/relationships/commentsExtensible"};var O=new TextEncoder,F=new TextDecoder("utf-8",{ignoreBOM:true});function J(e){return typeof e=="string"?O.encode(e):e instanceof Uint8Array?e:new Uint8Array(e)}function k(e){return e?F.decode(e):void 0}function K(e){let t=c(Object.fromEntries(e)),r=new ArrayBuffer(t.byteLength);return new Uint8Array(r).set(t),r}function P(e){return e.startsWith("/")?e.slice(1):`word/${e}`}function v(e){let t=[{relsPath:"word/_rels/document.xml.rels",blocks:e.package.document.content}],r=s=>(s??[]).flatMap(p=>p.content),n=[...r(e.package.footnoteSeparators),...r(e.package.footnotes)];n.length>0&&t.push({relsPath:"word/_rels/footnotes.xml.rels",blocks:n});let o=[...r(e.package.endnoteSeparators),...r(e.package.endnotes)];o.length>0&&t.push({relsPath:"word/_rels/endnotes.xml.rels",blocks:o});let a=e.package.relationships;if(!a)return t;let m=(s,p)=>{if(s)for(let[c,l]of s.entries()){let d=a.get(c);if(!d||d.type!==p||!d.target)continue;let g=P(d.target).replace(/^word\//,"");t.push({relsPath:`word/_rels/${g}.rels`,blocks:l.content});}};return m(e.package.headers,S.header),m(e.package.footers,S.footer),t}async function H(e){let t=await crypto.subtle.digest("SHA-256",Uint8Array.from(e).buffer);return Array.from(new Uint8Array(t),r=>r.toString(16).padStart(2,"0")).join("")}async function te(e,t,r={},n,o,a$2){await a(),await a$1();let m=o??{seed:await H(new Uint8Array(t)),now:new Date().toISOString()};j(m);let s=e.package,p={determinism:m,document:s.document,headerEntries:[...s.headers?.entries()??[]],footerEntries:[...s.footers?.entries()??[]],footnotes:s.footnotes??[],endnotes:s.endnotes??[],footnoteSeparators:s.footnoteSeparators??[],endnoteSeparators:s.endnoteSeparators??[],relationshipEntries:[...s.relationships?.entries()??[]],...s.numbering===void 0?{}:{numbering:s.numbering},options:{updateModifiedDate:r.updateModifiedDate??true,...r.modifiedBy===void 0?{}:{modifiedBy:r.modifiedBy}},...n===void 0?{}:{selective:{changedParaIds:[...n.changedParaIds],...n.sourceParagraphs===void 0?{}:{sourceParagraphs:n.sourceParagraphs}}},...a$2===void 0?{}:{paragraphIds:a$2}};I(p,"save");let c=g(JSON.stringify(p),new Uint8Array(t)),l=N(c);return n||C(e,t,l),{buffer:l,determinism:m}}function C(e,t,r){let n=b(new Uint8Array(t)),o=b(new Uint8Array(r));for(let s of v(e)){let p=k(n[s.relsPath])??"",c=k(o[s.relsPath])??"",l=new Set(x(p).map(i=>f(i,"Id"))),d=x(c).filter(i=>f(i,"Type")?.endsWith("/image")).map(i=>f(i,"Id")).filter(i=>!!i&&!l.has(i)),u=$(s.blocks);if(u.length>d.length)throw new Error(`Rust save image mutation mismatch in ${s.relsPath}: ${u.length} model images, ${d.length} relationships`);u.forEach((i,h)=>{i.rId=d[h];});let g=x(c).filter(i=>f(i,"Type")?.endsWith("/hyperlink")&&f(i,"TargetMode")==="External");for(let i of D(s.blocks)){if(!i.href){M(c,i.rId)||(i.rId=void 0);continue}let h=g.find(w=>W(f(w,"Target")??"")===i.href),y=h&&f(h,"Id");y&&(i.rId=y);}}let a=e.package.headers,m=e.package.relationships;if(!(!a||!m))for(let[s,p]of a){let c=p.watermark;if(!c||c.kind!=="picture")continue;let l=m.get(s);if(!l?.target)continue;let u=`word/_rels/${P(l.target).replace(/^word\//,"")}.rels`,g=k(o[u])??"";if(M(g,c.relId))continue;let i=c.mediaPath?.split("/").pop(),h=x(g).find(w=>{if(!f(w,"Type")?.endsWith("/image"))return false;let _=f(w,"Target")?.split("/").pop();return i?_===i:true}),y=h&&f(h,"Id");y&&(c.relId=y);}}function $(e){let t=[],r=n=>{for(let o of n.content)o.type==="drawing"&&o.image.src?.startsWith("data:")&&!o.image.rId&&t.push(o.image);};for(let n of e)if(n.type==="paragraph"){for(let o of n.content)if(o.type==="run")r(o);else if(o.type==="insertion"||o.type==="deletion"||o.type==="moveFrom"||o.type==="moveTo")for(let a of o.content)a.type==="run"&&r(a);}else if(n.type==="table")for(let o of n.rows)for(let a of o.cells)t.push(...$(a.content));return t}function D(e){let t=[];for(let r of e)if(r.type==="paragraph")for(let n of r.content)n.type==="hyperlink"&&(n.href||n.rId)&&!n.anchor&&t.push(n);else if(r.type==="table")for(let n of r.rows)for(let o of n.cells)t.push(...D(o.content));else r.type==="blockSdt"&&t.push(...D(r.content));return t}function x(e){return [...e.matchAll(/<Relationship\b[^>]*\/?>/g)].map(t=>t[0])}function f(e,t){return e.match(new RegExp(`\\b${t}="([^"]*)"`))?.[1]}function M(e,t){if(t)return x(e).find(r=>f(r,"Id")===t)}function W(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&#(\d+);/g,(t,r)=>String.fromCodePoint(Number(r))).replace(/&#x([0-9A-Fa-f]+);/g,(t,r)=>String.fromCodePoint(parseInt(r,16))).replace(/&amp;/g,"&")}function j(e){if(!/^[0-9a-f]{64}$/i.test(e.seed))throw new TypeError("Rust save determinism seed must be a SHA-256 hex digest");if(!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(e.now))throw new TypeError("Rust save clock must be a UTC ISO-8601 millisecond timestamp")}var L=new Set(["__proto__","constructor","prototype"]);function I(e,t,r=new WeakSet){if(!(e===null||typeof e!="object")){if(r.has(e))throw new TypeError(`${t} contains a cycle`);if(r.add(e),Array.isArray(e))e.forEach((n,o)=>I(n,`${t}[${o}]`,r));else for(let n of Object.keys(e)){if(L.has(n))throw new TypeError(`${t} contains forbidden key ${n}`);I(e[n],`${t}.${n}`,r);}r.delete(e);}}function N(e){let t=new ArrayBuffer(e.byteLength);return new Uint8Array(t).set(e),t}
2
- export{S as a,J as b,K as c,te as d};
@@ -1 +0,0 @@
1
- import {b,h}from'./chunk-LIGZ75FP.mjs';import {d}from'./chunk-RZQ3OXZY.mjs';import'./chunk-CTBUQRYQ.mjs';import'./chunk-LT2GCWZ3.mjs';import'./chunk-HPZFJGGM.mjs';import'./chunk-2QHGQA3V.mjs';import'./chunk-3CYO46ML.mjs';import'./chunk-6CHGYCFU.mjs';import'./chunk-TTRUPDAB.mjs';var l=1;function y(e){let s=new ArrayBuffer(e.byteLength);return new Uint8Array(s).set(e),s}async function S(e,s,g){let{createYrsSession:h$1}=await import('./yrs/index.mjs'),n=await h$1({clientId:l});try{let t=b(n),r=JSON.parse(t.compareDocx(e,s,JSON.stringify(g)));if(!r.ok)return {ok:!1,diagnostics:r.diagnostics};if(!r.save)return {ok:!0,docx:e.slice(),changes:r.changes,diagnostics:r.diagnostics};let o=r.save,d$1=n.materializeDocx();if(!d$1)throw new Error("the compared session holds no document");let i;try{let a=h(n,d$1,new Map(Object.entries(o.revisionIds))),p=await d(a,y(e),{updateModifiedDate:!1},{changedParaIds:[],sourceParagraphs:{partSha256:o.partSha256,paragraphs:o.paragraphs}},{seed:o.seed,now:o.now});i=new Uint8Array(p.buffer);}catch(a){let p=a instanceof Error?a.message:String(a);return JSON.parse(t.failComparedDocx(p))}let c=JSON.parse(t.finishComparedDocx(i));return c.ok?{...c,docx:i}:c}finally{n.destroy();}}export{S as compareDocxInSession};
@@ -1 +0,0 @@
1
- import'./chunk-HPZFJGGM.mjs';export{a as preloadOpcWasm,c as rezipContainer,b as unzipContainer}from'./chunk-2QHGQA3V.mjs';import'./chunk-6CHGYCFU.mjs';import'./chunk-TTRUPDAB.mjs';
@@ -1 +0,0 @@
1
- import'./chunk-EUUIJVM6.mjs';export{c as createEditSession,e as exportDocxMarkdownJson,d as exportDocxStructuredJson,h as findDocxContentControlsJson,g as listDocxContentControlsJson,a as preloadEditWasm,f as renderDocxMarkdownJson,i as renderDocxMarkdownWithPagesJson,b as setEditWasmHeapLimit}from'./chunk-L2ML3DDI.mjs';import'./chunk-6CHGYCFU.mjs';import'./chunk-TTRUPDAB.mjs';