@reviseio/engine 3.0.0 → 3.0.1

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 (37) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/chunks/{AgentHtmlConverter-BnK7NaYA.js → AgentHtmlConverter-CnnB8-WI.js} +3 -3
  3. package/chunks/{AgentPageRenderer-DLwq6nAa.js → AgentPageRenderer-DLgUGrGy.js} +4 -4
  4. package/chunks/{BlockDiff-BdlcKY-t.js → BlockDiff-B6-aJxHo.js} +1 -1
  5. package/chunks/{CanvasRenderer-Bqsj1S0p.js → CanvasRenderer-C1Vegx9Y.js} +2 -2
  6. package/chunks/{DocumentCompare-BqyiP87r.js → DocumentCompare-C8295s35.js} +1 -1
  7. package/chunks/{DocumentLayoutEngine-7iOYvyVb.js → DocumentLayoutEngine-C62pyGVf.js} +3 -3
  8. package/chunks/{DocumentMutator-DIrZBuLr.js → DocumentMutator-Bat_oLBQ.js} +2 -2
  9. package/chunks/{DocumentScrubber-Cz8Q05hF.js → DocumentScrubber-BZQn_z92.js} +1 -1
  10. package/chunks/{DocumentSession-lXSXqua5.js → DocumentSession-BDcazSEv.js} +1 -1
  11. package/chunks/{DocxConverter-BfDw7777.js → DocxConverter-BC31uYIL.js} +3 -3
  12. package/chunks/{DocxGraft-D0uCnGCo.js → DocxGraft-L10HXM3U.js} +2 -2
  13. package/chunks/{HtmlConverter-7Xj_g9Jr.js → HtmlConverter-C5ihhZ6G.js} +3 -3
  14. package/chunks/{MarkdownConverter-cnW_oePY.js → MarkdownConverter-DofaSeC4.js} +1 -1
  15. package/chunks/{OdtConverter-GwRDMnwS.js → OdtConverter-c1fTWoAt.js} +1 -1
  16. package/chunks/{OfficeImportShared-nlMtIUni.js → OfficeImportShared-CrOpHpJ-.js} +1 -1
  17. package/chunks/{PdfConverter-yOlWiVIj.js → PdfConverter-DX7fsRH5.js} +5 -5
  18. package/chunks/{RtfConverter--wLd0qrw.js → RtfConverter-hbJ2529G.js} +66 -66
  19. package/chunks/{TableBorders-C5pNsuxP.js → TableBorders-DVhdvo6f.js} +1 -1
  20. package/chunks/TextDecoding-IPbuUqcC.js +2 -0
  21. package/chunks/TextFileDecoder-BZBBejlR.js +10 -0
  22. package/chunks/{TxtConverter-BoRVCDZw.js → TxtConverter-YHv5FXWb.js} +1 -1
  23. package/chunks/{Typography-DAGM5kfI.js → Typography-B4gndEdB.js} +1 -1
  24. package/chunks/XmlConverter-BRRluy9k.js +55 -0
  25. package/chunks/{capture-Dtinb4bY.js → capture-i_dPkQIS.js} +1 -1
  26. package/chunks/{carrier-RNy67HN4.js → carrier-pYM9xf6x.js} +1 -1
  27. package/chunks/{chromeImageLayout-bgHYmqTp.js → chromeImageLayout-BiQ3Iz1-.js} +1 -1
  28. package/chunks/{engine-TnK8N-gT.js → engine-LMUnxdm2.js} +18 -18
  29. package/chunks/{footnoteFlatten-BcKaWzVs.js → footnoteFlatten-EE85Hjre.js} +1 -1
  30. package/chunks/{graftExport-DxAALMHp.js → graftExport-G-dG7Vcc.js} +1 -1
  31. package/chunks/{index-CTti7wRd.js → index-BLb10wQt.js} +3 -3
  32. package/chunks/{serverDocumentSession-BmYdjC6e.js → serverDocumentSession-DGDU5Lh3.js} +5 -5
  33. package/chunks/{signatures-CU2LMLBp.js → signatures-DTNDS2PH.js} +1 -1
  34. package/engine.js +1 -1
  35. package/package.json +2 -2
  36. package/chunks/TextFileDecoder--rsVs3NR.js +0 -9
  37. package/chunks/XmlConverter-CO8Z28dX.js +0 -55
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.0.1
4
+
5
+ ### Fixed
6
+
7
+ - **Windows-1252 text on Node 20.** RTF, plain text, HTML, and XML in
8
+ Windows-1252 (or labeled latin1, iso-8859-1, or ascii) read € “ ” ‘ ’ – —
9
+ and the other characters in bytes 0x80–0x9F as invisible control
10
+ characters. Node 22 and later were not affected. Pairs with `revise` 3.0.1.
11
+
3
12
  ## 3.0.0
4
13
 
5
14
  The first release of `@reviseio/engine`: the headless document engine that
@@ -1,7 +1,7 @@
1
- import{f as K,h as Kt,u as Vt}from"./CanvasRenderer-Bqsj1S0p.js";import{b as X,e as Jt}from"./TableGrid-DbroRucl.js";import{r as et,aO as z,aP as gt,e as Gt,aQ as Xt,z as ft,aR as Zt,aS as Qt,aT as nt,
2
- aU as Yt,W as bt,aV as yt,Q as xt,O as te,aW as $t,N as ee,a as J,C as kt,aX as ne,aY as ie,aZ as oe,a_ as re,a$ as se}from"./engine-TnK8N-gT.js";import{e as ae,r as vt,s as ce,p as le,i as de}from"./ListNumbering-Qlu6AuRZ.js";
1
+ import{f as K,h as Kt,u as Vt}from"./CanvasRenderer-C1Vegx9Y.js";import{b as X,e as Jt}from"./TableGrid-DbroRucl.js";import{r as et,aO as z,aP as gt,e as Gt,aQ as Xt,z as ft,aR as Zt,aS as Qt,aT as nt,
2
+ aU as Yt,W as bt,aV as yt,Q as xt,O as te,aW as $t,N as ee,a as J,C as kt,aX as ne,aY as ie,aZ as oe,a_ as re,a$ as se}from"./engine-LMUnxdm2.js";import{e as ae,r as vt,s as ce,p as le,i as de}from"./ListNumbering-Qlu6AuRZ.js";
3
3
  import{i as At}from"./HorizontalRuleOrnaments-gmUZ3R7Q.js";import{d as he}from"./DocumentStylesheet-CEEt18sr.js";import{a as St,c as It,d as wt,b as Ct,e as pe,f as ue,s as Tt,g as Ft,h as Nt,i as me,
4
- j as ge}from"./TableBorders-C5pNsuxP.js";import{h as V,H as fe,D as be}from"./Typography-DAGM5kfI.js";const Bt=/<!--[^]*?-->|<\/?[a-zA-Z][\w:-]*(?:\s+(?:[^"'<>]|"[^"]*"|'[^']*')*)?\s*\/?>/g,Ht={amp:"&",
4
+ j as ge}from"./TableBorders-DVhdvo6f.js";import{h as V,H as fe,D as be}from"./Typography-B4gndEdB.js";const Bt=/<!--[^]*?-->|<\/?[a-zA-Z][\w:-]*(?:\s+(?:[^"'<>]|"[^"]*"|'[^']*')*)?\s*\/?>/g,Ht={amp:"&",
5
5
  lt:"<",gt:">",quot:'"',AMP:"&",LT:"<",GT:">",QUOT:'"',apos:"'",nbsp:" ",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",laquo:"«",raquo:"»",lsaquo:"‹",rsaquo:"›",ensp:" ",
6
6
  emsp:" ",thinsp:" ",ndash:"–",mdash:"—",hellip:"…",copy:"©",reg:"®",trade:"™"},ye=/[\u0085\u2028\u2029]/g;function Lt(u){return u.replace(ye," ")}function xe(u){return u.replace(/\\+(["'])/g,
7
7
  "$1")}function it(u){return xe(u.replace(/&(#(?:\d+|x[0-9a-f]+)|[a-z]+);/gi,(t,e)=>{if(!e.startsWith("#"))return Object.prototype.hasOwnProperty.call(Ht,e)?Ht[e]:t;const n=e[1].toLowerCase()==="x",i=Number.
@@ -1,7 +1,7 @@
1
- import*as E from"yjs";import{S as G}from"./AgentHtmlConverter-BnK7NaYA.js";import{r as ct,f as Jt,D as Xt}from"./DocumentMutator-DIrZBuLr.js";import{p as lt,f as Q,h as Vt,y as dt}from"./engine-TnK8N-gT.js";
2
- import{D as Z,i as Qt}from"./AgentPageRenderViews-BTLjPZJQ.js";import{g as gt,c as Zt,d as ft,a as tt,w as ht,b as te,e as ee}from"./CanvasRenderer-Bqsj1S0p.js";import{g as et}from"./Typography-DAGM5kfI.js";
3
- import{g as oe,a as B,c as ut,b as ne}from"./index-CTti7wRd.js";import{c as ae,f as j,b as _,g as q,a as ie,d as ot,e as se}from"./DocumentLayoutEngine-7iOYvyVb.js";import{getLayoutMarginTop as mt,getLayoutMarginRight as re,
4
- getLayoutMarginBottom as pt,getLayoutMarginLeft as z,layoutForBlockBounds as yt}from"./DocumentLayout-CsU5MR-3.js";import{r as ce,g as le,e as de}from"./MathRenderer-Bz9WEVvF.js";import{p as ge}from"./TableBorders-C5pNsuxP.js";
1
+ import*as E from"yjs";import{S as G}from"./AgentHtmlConverter-CnnB8-WI.js";import{r as ct,f as Jt,D as Xt}from"./DocumentMutator-Bat_oLBQ.js";import{p as lt,f as Q,h as Vt,y as dt}from"./engine-LMUnxdm2.js";
2
+ import{D as Z,i as Qt}from"./AgentPageRenderViews-BTLjPZJQ.js";import{g as gt,c as Zt,d as ft,a as tt,w as ht,b as te,e as ee}from"./CanvasRenderer-C1Vegx9Y.js";import{g as et}from"./Typography-B4gndEdB.js";
3
+ import{g as oe,a as B,c as ut,b as ne}from"./index-BLb10wQt.js";import{c as ae,f as j,b as _,g as q,a as ie,d as ot,e as se}from"./DocumentLayoutEngine-C62pyGVf.js";import{getLayoutMarginTop as mt,getLayoutMarginRight as re,
4
+ getLayoutMarginBottom as pt,getLayoutMarginLeft as z,layoutForBlockBounds as yt}from"./DocumentLayout-CsU5MR-3.js";import{r as ce,g as le,e as de}from"./MathRenderer-Bz9WEVvF.js";import{p as ge}from"./TableBorders-DVhdvo6f.js";
5
5
  import{r as fe}from"./BidiText-Bkp4Y90s.js";import{g as he}from"./PageNumeralFonts-BWzI061X.js";function bt(t,e){const n=e?.saturation,o=e?.lightness,i=e?.hueRange??[0,360];let a=5381;for(let d=0;d<t.
6
6
  length;d++)a=(a<<5)+a+t.charCodeAt(d),a|=0;const s=Math.abs(a)%1e3,[l,r]=i,c=Math.max(0,r-l);return`hsl(${l+s%(c||360)} ${n}% ${o}%)`}const xt=class U{constructor(){this.cache=new Map,this.loadingImages=
7
7
  new Set,this.failedImages=new Set}static getInstance(){return U.instance||(U.instance=new U),U.instance}getImage(e){return this.cache.get(e)||(this.failedImages.has(e)||this.loadingImages.has(e)||this.
@@ -1,4 +1,4 @@
1
- import{M as ke}from"./engine-TnK8N-gT.js";import{a as le}from"./ParagraphDiffAnalysis-DrmStvmz.js";const ce=new WeakMap,E=r=>{let s=ce.get(r);return s===void 0&&(s=r.children.map(d=>d.text).join(""),ce.
1
+ import{M as ke}from"./engine-LMUnxdm2.js";import{a as le}from"./ParagraphDiffAnalysis-DrmStvmz.js";const ce=new WeakMap,E=r=>{let s=ce.get(r);return s===void 0&&(s=r.children.map(d=>d.text).join(""),ce.
2
2
  set(r,s)),s},z=r=>r.trim()?r.trim().split(/\s+/).length:0,ae=new WeakMap,h=r=>{let s=ae.get(r);if(s===void 0){const{id:d,children:m,...J}=r;s=JSON.stringify(J),ae.set(r,s)}return s},U=(r={})=>Object.fromEntries(
3
3
  ke.filter(s=>r[s]!==void 0).map(s=>[s,r[s]])),be=["comment","footnoteRef","footnotePendingBody","footnotePendingKind","oxmlRange","bookmark"],de=r=>{const s={...r};for(const d of be)delete s[d];return s};
4
4
  function xe(r){return{...r,children:r.children.map(s=>({...s,marks:U(s.marks)}))}}function he(r){return r.type==="paragraph"?`p${h(r)}${E(r)}`:r.type==="list"?`l${h(r)}${r.children.map(s=>h(s)+E(s)).join(
@@ -1,6 +1,6 @@
1
- import{bK as y,l as A,bN as C,x as We,C as Re,a as Ee,bO as Ye,bP as Ue,bp as ze,br as De,bQ as He,bq as _e,bG as je,bM as Ge}from"./engine-TnK8N-gT.js";import{getLayoutBlockSpacingPx as qe,getLayoutMarginTop as Y,
1
+ import{bK as y,l as A,bN as C,x as We,C as Re,a as Ee,bO as Ye,bP as Ue,bp as ze,br as De,bQ as He,bq as _e,bG as je,bM as Ge}from"./engine-LMUnxdm2.js";import{getLayoutBlockSpacingPx as qe,getLayoutMarginTop as Y,
2
2
  getLayoutMarginRight as oe,getLayoutMarginBottom as K,getLayoutMarginLeft as U,getLayoutPageStep as Ke,getLayoutFootnoteInset as ae,getLayoutPageContentTop as Xe}from"./DocumentLayout-CsU5MR-3.js";import{
3
- g as se,f as Ve}from"./Typography-DAGM5kfI.js";import{v as Qe}from"./TableBorders-C5pNsuxP.js";function le(r){if(!r||typeof r!="object")return!1;const e=r;return e.diffState==="insert"&&!!e.suggestionId}
3
+ g as se,f as Ve}from"./Typography-B4gndEdB.js";import{v as Qe}from"./TableBorders-DVhdvo6f.js";function le(r){if(!r||typeof r!="object")return!1;const e=r;return e.diffState==="insert"&&!!e.suggestionId}
4
4
  function Je(r,e){return{centerX:r.x-y.blockInsertMarkerMarginXPx,centerY:e+y.blockInsertMarkerOffsetYPx,armLength:y.blockInsertMarkerArmPx}}function ce(r,e,t,n){const{centerX:i,centerY:o,armLength:a}=Je(
5
5
  e,t);r.save(),r.strokeStyle=n.diffInsert,r.lineWidth=y.blockInsertMarkerLineWidthPx,r.lineCap="round",r.beginPath(),r.moveTo(i-a,o),r.lineTo(i+a,o),r.moveTo(i,o-a),r.lineTo(i,o+a),r.stroke(),r.restore()}
6
6
  function Ze(r,e,t,n,i,o,a){const l=a==="insert"?i.diffInsert:i.diffDelete,s=t+Math.max(n/2,8),c=e.left+y.pendingBreakRuleStartPx,f=e.right;r.save(),r.font=`${y.pendingBreakLabelFontSizePx}px Arial, sa\
@@ -1,4 +1,4 @@
1
- import{DocumentSession as m}from"./DocumentSession-lXSXqua5.js";import{g as i,a as g}from"./engine-TnK8N-gT.js";import{d}from"./BlockDiff-BdlcKY-t.js";const p=[{label:"headers and footers",keys:["chro\
1
+ import{DocumentSession as m}from"./DocumentSession-BDcazSEv.js";import{g as i,a as g}from"./engine-LMUnxdm2.js";import{d}from"./BlockDiff-B6-aJxHo.js";const p=[{label:"headers and footers",keys:["chro\
2
2
  me","headers","footers"]},{label:"footnotes and endnotes",keys:["notes"]},{label:"page layout",keys:["pageLayout","pageless"]}];function l(s,t){return JSON.stringify(t.map(e=>s[e]??null),(e,o)=>e==="i\
3
3
  d"||e.startsWith("suggestion")?void 0:o)}function c(s){const t=new m(`compare-accept-${i()}`,s);try{const e=t.getDocumentMutator(),o=e.getLiveSuggestionIds();return o.length>0&&e.acceptLiveSuggestions(
4
4
  o),t.getWorkingDocument()}finally{t.dispose()}}function f(s,t,e={}){const o=c(s),a=c(t),r=d(o.children,a.children,{nextId:()=>`compare-${i()}`,nextBlockId:g,label:e.label??"Compare",authorName:e.authorName,
@@ -1,8 +1,8 @@
1
1
  import{getLayoutMarginLeft as mt,getLayoutMarginRight as ne,getLayoutMarginBottom as kt,getLayoutMarginTop as Wt,getLayoutBlockSpacingPx as Ve,PAGINATION_EPSILON as rt,createFlowWindowTable as Je,getLayoutPageStep as xe,
2
2
  getLayoutFootnoteInset as ke,declaresOwnSpaceBefore as qe,getLayoutPageContentTop as Qe}from"./DocumentLayout-CsU5MR-3.js";import{ap as ye,ae as Me,bt as Yt,bC as Ke,R as we,h as tn,e as en,t as nn,r as on,
3
- bp as rn,br as an,a4 as sn,bw as ln,bx as oe}from"./engine-TnK8N-gT.js";import{L as cn,i as gn,j as un}from"./Typography-DAGM5kfI.js";import{a as dn}from"./chromeImageLayout-bgHYmqTp.js";import{t as hn,
4
- u as pn,a as fn,l as mn,m as bn,d as Ie,s as xn,v as kn,x as _t,f as yn,i as Se,h as Mn}from"./index-CTti7wRd.js";import{v as Ye}from"./CanvasRenderer-Bqsj1S0p.js";import{b as wn,c as In}from"./TableGrid-DbroRucl.js";
5
- import{r as Sn,t as Yn}from"./TableBorders-C5pNsuxP.js";const Be=48,Bn=10;function Ne(e,t,n,r,s){const i=(n.columnCount??1)>1?Math.max(1,n.pageWidth-mt(n)-ne(n)):n.availableWidth,a=i/3,u=s??e.children,
3
+ bp as rn,br as an,a4 as sn,bw as ln,bx as oe}from"./engine-LMUnxdm2.js";import{L as cn,i as gn,j as un}from"./Typography-B4gndEdB.js";import{a as dn}from"./chromeImageLayout-BiQ3Iz1-.js";import{t as hn,
4
+ u as pn,a as fn,l as mn,m as bn,d as Ie,s as xn,v as kn,x as _t,f as yn,i as Se,h as Mn}from"./index-BLb10wQt.js";import{v as Ye}from"./CanvasRenderer-C1Vegx9Y.js";import{b as wn,c as In}from"./TableGrid-DbroRucl.js";
5
+ import{r as Sn,t as Yn}from"./TableBorders-DVhdvo6f.js";const Be=48,Bn=10;function Ne(e,t,n,r,s){const i=(n.columnCount??1)>1?Math.max(1,n.pageWidth-mt(n)-ne(n)):n.availableWidth,a=i/3,u=s??e.children,
6
6
  d=[0,1,2].map(S=>{const b=u[S];if(!b)return Be;if(b.borders)return i;const k=hn(b,t,n,r)+Bn;return Math.max(Be,Math.min(k,i))}),p=[a,a,a],B=d.map((S,b)=>Math.max(0,S-p[b])),x=d.map((S,b)=>Math.max(0,p[b]-
7
7
  S)),y=B.reduce((S,b)=>S+b,0),v=x.reduce((S,b)=>S+b,0);if(y>0&&v>0){const S=Math.min(y,v);for(let b=0;b<3;b++)B[b]>0?p[b]+=B[b]/y*S:x[b]>0&&(p[b]-=x[b]/v*S)}const F=[0,1,2].map(S=>{const b=u[S];return!b||
8
8
  !b.children.some(k=>k.type==="text"&&k.text!=="")});for(let S=0;S<3;S++){let b=d[S]-p[S];if(!(b<=0||F[S]))for(let k=0;k<3&&b>0;k++){if(k===S||!F[k])continue;const E=Math.min(p[k],b);p[k]-=E,p[S]+=E,b-=