@betteroffice/xlsx 0.3.0 → 0.5.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.
- package/README.md +108 -192
- package/dist/asyncReplica-DuZEFXjI.d.ts +253 -0
- package/dist/chunk-DIDVDN7H.js +1 -0
- package/dist/chunk-HJJEOLPD.js +1 -0
- package/dist/chunk-JGTBRHCP.js +1 -0
- package/dist/chunk-K7TMSGNA.js +1 -0
- package/dist/chunk-SXM2HKJL.js +4 -0
- package/dist/collaboration.d.ts +19 -2
- package/dist/collaboration.js +1 -1
- package/dist/editPeer-DN6JDr8Z.d.ts +1906 -0
- package/dist/generated/xlsx_wasm_bg.wasm +0 -0
- package/dist/headless.d.ts +9 -290
- package/dist/headless.js +1 -1
- package/dist/index.d.ts +6 -908
- package/dist/index.js +4 -1
- package/dist/types-DdoEoFSX.d.ts +350 -0
- package/dist/worker.d.ts +25 -0
- package/dist/worker.js +1 -0
- package/dist/xlsxSessionWorker.d.ts +2 -0
- package/dist/xlsxSessionWorker.mjs +1 -0
- package/package.json +13 -3
- package/dist/chunk-E6PJOEEH.js +0 -4
- package/dist/types-C24EBcAP.d.ts +0 -91
package/dist/index.js
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
export{w as buildA11yGrid,o as cellAtPoint,j as cellCount,p as cellRect,n as chartRegionAtPoint,e as clampScroll,k as extendTo,v as fromTsv,r as hyperlinkAtCell,l as moveFocus,h as normalizeRange,t as parseHyperlinkLocation,i as rangeContains,q as rangeRect,s as safeExternalHyperlink,g as selectionAt,m as selectionKeyReducer,u as toTsv,b as totalExtent,a as trackCount,f as uniformOffsets,d as visibleCells,c as visibleRange}from'./chunk-E6PJOEEH.js';import {a}from'./chunk-O2XFH626.js';var Ce=1.3333333333333333,Re={left:"left",center:"center",right:"right"},Je={dashed:[4,2],dotted:[1,2]};function Ee(s,e,r,t={x:0,y:0}){s.save(),s.setTransform(r,0,0,r,t.x,t.y),s.beginPath(),s.rect(0,0,e.width,e.height),s.clip(),s.clearRect(0,0,e.width,e.height);for(let n of e.commands)Pe(s,n);s.restore();}function Pe(s,e){switch(e.op){case "fillRect":L(s,e.clip,()=>{s.fillStyle=e.color,s.fillRect(e.x,e.y,e.w,e.h);});return;case "line":L(s,e.clip,()=>ke(s,e));return;case "path":L(s,e.clip,()=>Xe(s,e));return;case "text":Ae(s,e);return}}function L(s,e,r){if(!e){r();return}s.save(),s.beginPath(),s.rect(e.x,e.y,e.w,e.h),s.clip(),r(),s.restore();}function Xe(s,e){s.beginPath();for(let r of e.commands)switch(r.type){case "move":s.moveTo(r.x,r.y);break;case "line":s.lineTo(r.x,r.y);break;case "quad":s.quadraticCurveTo(r.cpx,r.cpy,r.x,r.y);break;case "cubic":s.bezierCurveTo(r.cp1x,r.cp1y,r.cp2x,r.cp2y,r.x,r.y);break;case "close":s.closePath();break}s.fillStyle=e.fill,s.fill(),e.stroke&&(s.strokeStyle=e.stroke.color,s.lineWidth=e.stroke.width,s.setLineDash([]),s.stroke());}function ke(s,e){if(s.strokeStyle=e.color,e.style==="double"){let r=Math.max(e.width*.8,.8),t=Math.abs(e.y1-e.y2)<=Math.abs(e.x1-e.x2),[n,i]=t?[0,r]:[r,0];s.lineWidth=Math.max(e.width*.6,.5),M(s,e.x1-n,e.y1-i,e.x2-n,e.y2-i),M(s,e.x1+n,e.y1+i,e.x2+n,e.y2+i);return}s.lineWidth=e.width,s.save(),s.setLineDash(e.style?Je[e.style]:[]),M(s,e.x1,e.y1,e.x2,e.y2),s.restore();}function M(s,e,r,t,n){s.beginPath(),s.moveTo(e,r),s.lineTo(t,n),s.stroke();}function Ae(s,e){s.save(),e.clip&&(s.beginPath(),s.rect(e.clip.x,e.clip.y,e.clip.w,e.clip.h),s.clip()),s.fillStyle=e.color,s.font=Oe(e),s.textAlign=Re[e.align??"left"],s.textBaseline="alphabetic",e.highlight&&Fe(s,e),s.fillStyle=e.color,s.fillText(e.text,e.x,e.y),(e.underline||e.strike||e.dashedUnderline)&&Te(s,e),s.restore();}function Oe(s){let e=s.italic?"italic ":"",r=s.bold?"bold ":"",t=s.fontFamily?s.chart?s.fontFamily:`"${s.fontFamily.replace(/"/g,'\\"')}", sans-serif`:"sans-serif";return `${e}${r}${V(s)}px ${t}`}function V(s){return s.fontSize*Ce}function Te(s,e){let r=s.measureText(e.text).width,t=e.align??"left",n=t==="right"?e.x-r:t==="center"?e.x-r/2:e.x,i=V(e),d=Math.max(i*.05,.5);s.fillStyle=e.color,e.underline&&s.fillRect(n,e.y+i*.1,r,d),e.strike&&s.fillRect(n,e.y-i*.26,r,d),e.dashedUnderline&&(s.save(),s.strokeStyle=e.color,s.lineWidth=d,s.setLineDash([3,2]),M(s,n,e.y+i*.1,n+r,e.y+i*.1),s.restore());}function Fe(s,e){let r=s.measureText(e.text),t=r.width,n=e.align??"left",i=n==="right"?e.x-t:n==="center"?e.x-t/2:e.x,d=V(e),u=r.actualBoundingBoxAscent||d*.8,l=r.actualBoundingBoxDescent||d*.2;s.fillStyle=e.highlight,s.fillRect(i-2,e.y-u-1,t+4,u+l+2);}var v=class s{static __wrap(e){let r=Object.create(s.prototype);return r.__wbg_ptr=e,H.register(r,r.__wbg_ptr,r),r}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,H.unregister(this),e}free(){let e=this.__destroy_into_raw();o.__wbg_xlsxdocument_free(e,0);}acceptProposalJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_acceptProposalJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}applyEditsJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_applyEditsJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}applyFormatJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_applyFormatJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}applyOpsJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_applyOpsJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}applyOpsProfiledJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_applyOpsProfiledJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}applyUpdateJson(e){let r,t;try{let d=P(e,o.__wbindgen_malloc),u=p,l=o.xlsxdocument_applyUpdateJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}calculationStatusJson(){let e,r;try{let i=o.xlsxdocument_calculationStatusJson(this.__wbg_ptr);var t=i[0],n=i[1];if(i[3])throw t=0,n=0,f(i[2]);return e=t,r=n,g(t,n)}finally{o.__wbindgen_free(e,r,1);}}captureFormatJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_captureFormatJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}cellJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_cellJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}cellPositionJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_cellPositionJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}chartAtPointJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_chartAtPointJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}clearUpdateObservation(){o.xlsxdocument_clearUpdateObservation(this.__wbg_ptr);}get clientId(){return o.xlsxdocument_clientId(this.__wbg_ptr)}displayListJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_displayListJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}displayListProfiledJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_displayListProfiledJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}documentVersion(){let e,r;try{let t=o.xlsxdocument_documentVersion(this.__wbg_ptr);return e=t[0],r=t[1],g(t[0],t[1])}finally{o.__wbindgen_free(e,r,1);}}drainUpdateEvent(){let e=o.xlsxdocument_drainUpdateEvent(this.__wbg_ptr);if(e[3])throw f(e[2]);var r=R(e[0],e[1]).slice();return o.__wbindgen_free(e[0],e[1]*1,1),r}editCellJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_editCellJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}editCellProfiledJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_editCellProfiledJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}editCellsJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_editCellsJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}encodeDiff(e){let r=P(e,o.__wbindgen_malloc),t=p,n=o.xlsxdocument_encodeDiff(this.__wbg_ptr,r,t);if(n[3])throw f(n[2]);var i=R(n[0],n[1]).slice();return o.__wbindgen_free(n[0],n[1]*1,1),i}encodeStateAsUpdate(){let e=o.xlsxdocument_encodeStateAsUpdate(this.__wbg_ptr);var r=R(e[0],e[1]).slice();return o.__wbindgen_free(e[0],e[1]*1,1),r}encodeStateVector(){let e=o.xlsxdocument_encodeStateVector(this.__wbg_ptr);var r=R(e[0],e[1]).slice();return o.__wbindgen_free(e[0],e[1]*1,1),r}exportMarkdownJson(e,r){let t,n;try{let u=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),l=p,h=b(r,o.__wbindgen_malloc,o.__wbindgen_realloc),w=p,S=o.xlsxdocument_exportMarkdownJson(this.__wbg_ptr,u,l,h,w);var i=S[0],d=S[1];if(S[3])throw i=0,d=0,f(S[2]);return t=i,n=d,g(i,d)}finally{o.__wbindgen_free(t,n,1);}}exportStructuredJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_exportStructuredJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}findTextJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_findTextJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}historyStateJson(){let e,r;try{let i=o.xlsxdocument_historyStateJson(this.__wbg_ptr);var t=i[0],n=i[1];if(i[3])throw t=0,n=0,f(i[2]);return e=t,r=n,g(t,n)}finally{o.__wbindgen_free(e,r,1);}}listProposalsJson(){let e,r;try{let i=o.xlsxdocument_listProposalsJson(this.__wbg_ptr);var t=i[0],n=i[1];if(i[3])throw t=0,n=0,f(i[2]);return e=t,r=n,g(t,n)}finally{o.__wbindgen_free(e,r,1);}}mergedRangesJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_mergedRangesJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}moveChartJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_moveChartJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}static open(e){let r=P(e,o.__wbindgen_malloc),t=p,n=o.xlsxdocument_open(r,t);if(n[2])throw f(n[1]);return s.__wrap(n[0])}static openCollaborative(e,r){let t=P(e,o.__wbindgen_malloc),n=p,i=o.xlsxdocument_openCollaborative(t,n,r);if(i[2])throw f(i[1]);return s.__wrap(i[0])}patchRangeStyleJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_patchRangeStyleJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}printDisplayListJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_printDisplayListJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}proposeJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_proposeJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}rangeCellsJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_rangeCellsJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}readCellsJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_readCellsJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}redoJson(){let e,r;try{let i=o.xlsxdocument_redoJson(this.__wbg_ptr);var t=i[0],n=i[1];if(i[3])throw t=0,n=0,f(i[2]);return e=t,r=n,g(t,n)}finally{o.__wbindgen_free(e,r,1);}}rejectProposalJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_rejectProposalJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}renderPng(e){let r=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),t=p,n=o.xlsxdocument_renderPng(this.__wbg_ptr,r,t);if(n[3])throw f(n[2]);var i=R(n[0],n[1]).slice();return o.__wbindgen_free(n[0],n[1]*1,1),i}renderRangePng(e){let r=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),t=p,n=o.xlsxdocument_renderRangePng(this.__wbg_ptr,r,t);if(n[3])throw f(n[2]);var i=R(n[0],n[1]).slice();return o.__wbindgen_free(n[0],n[1]*1,1),i}saveBytes(){let e=o.xlsxdocument_saveBytes(this.__wbg_ptr);if(e[3])throw f(e[2]);var r=R(e[0],e[1]).slice();return o.__wbindgen_free(e[0],e[1]*1,1),r}searchTextJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_searchTextJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}selectionFormattingJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_selectionFormattingJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}setActiveSheet(e){let r=o.xlsxdocument_setActiveSheet(this.__wbg_ptr,e);if(r[1])throw f(r[0])}setRangeNumberFormatJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_setRangeNumberFormatJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}sheetInfoJson(){let e,r;try{let i=o.xlsxdocument_sheetInfoJson(this.__wbg_ptr);var t=i[0],n=i[1];if(i[3])throw t=0,n=0,f(i[2]);return e=t,r=n,g(t,n)}finally{o.__wbindgen_free(e,r,1);}}startUpdateObservation(){let e=o.xlsxdocument_startUpdateObservation(this.__wbg_ptr);if(e[1])throw f(e[0])}undoJson(){let e,r;try{let i=o.xlsxdocument_undoJson(this.__wbg_ptr);var t=i[0],n=i[1];if(i[3])throw t=0,n=0,f(i[2]);return e=t,r=n,g(t,n)}finally{o.__wbindgen_free(e,r,1);}}validateEditsJson(e){let r,t;try{let d=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=o.xlsxdocument_validateEditsJson(this.__wbg_ptr,d,u);var n=l[0],i=l[1];if(l[3])throw n=0,i=0,f(l[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}static version(){let e,r;try{let t=o.xlsxdocument_version();return e=t[0],r=t[1],g(t[0],t[1])}finally{o.__wbindgen_free(e,r,1);}}};Symbol.dispose&&(v.prototype[Symbol.dispose]=v.prototype.free);function j(s,e,r){let t,n;try{let u=P(s,o.__wbindgen_malloc),l=p,h=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),w=p,S=b(r,o.__wbindgen_malloc,o.__wbindgen_realloc),D=p,J=o.exportXlsxMarkdownJson(u,l,h,w,S,D);var i=J[0],d=J[1];if(J[3])throw i=0,d=0,f(J[2]);return t=i,n=d,g(i,d)}finally{o.__wbindgen_free(t,n,1);}}function G(s,e){let r,t;try{let d=P(s,o.__wbindgen_malloc),u=p,l=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),h=p,w=o.exportXlsxStructuredJson(d,u,l,h);var n=w[0],i=w[1];if(w[3])throw n=0,i=0,f(w[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}function $(s,e){let r,t;try{let d=b(s,o.__wbindgen_malloc,o.__wbindgen_realloc),u=p,l=b(e,o.__wbindgen_malloc,o.__wbindgen_realloc),h=p,w=o.renderXlsxMarkdownJson(d,u,l,h);var n=w[0],i=w[1];if(w[3])throw n=0,i=0,f(w[2]);return r=n,t=i,g(n,i)}finally{o.__wbindgen_free(r,t,1);}}function Me(){return {__proto__:null,"./xlsx_wasm_bg.js":{__proto__:null,__wbg___wbindgen_throw_344f42d3211c4765:function(e,r){throw new Error(g(e,r))},__wbg_getRandomValues_3f44b700395062e5:function(){return Ie(function(e,r){globalThis.crypto.getRandomValues(R(e,r));},arguments)},__wbg_now_10f06390f30d43ea:function(){return performance.now()},__wbg_now_86c0d4ba3fa605b8:function(){return Date.now()},__wbindgen_cast_0000000000000001:function(e,r){return g(e,r)},__wbindgen_init_externref_table:function(){let e=o.__wbindgen_externrefs,r=e.grow(4);e.set(0,void 0),e.set(r+0,void 0),e.set(r+1,null),e.set(r+2,true),e.set(r+3,false);}}}}var H=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>o.__wbg_xlsxdocument_free(s,1));function Ue(s){let e=o.__externref_table_alloc();return o.__wbindgen_externrefs.set(e,s),e}function R(s,e){return s=s>>>0,X().subarray(s/1,s/1+e)}function g(s,e){return De(s>>>0,e)}var A=null;function X(){return (A===null||A.byteLength===0)&&(A=new Uint8Array(o.memory.buffer)),A}function Ie(s,e){try{return s.apply(this,e)}catch(r){let t=Ue(r);o.__wbindgen_exn_store(t);}}function P(s,e){let r=e(s.length*1,1)>>>0;return X().set(s,r/1),p=s.length,r}function b(s,e,r){if(r===void 0){let u=O.encode(s),l=e(u.length,1)>>>0;return X().subarray(l,l+u.length).set(u),p=u.length,l}let t=s.length,n=e(t,1)>>>0,i=X(),d=0;for(;d<t;d++){let u=s.charCodeAt(d);if(u>127)break;i[n+d]=u;}if(d!==t){d!==0&&(s=s.slice(d)),n=r(n,t,t=d+s.length*3,1)>>>0;let u=X().subarray(n+d,n+t),l=O.encodeInto(s,u);d+=l.written,n=r(n,t,d,1)>>>0;}return p=d,n}function f(s){let e=o.__wbindgen_externrefs.get(s);return o.__externref_table_dealloc(s),e}var U=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true});U.decode();var Ne=2146435072,z=0;function De(s,e){return z+=e,z>=Ne&&(U=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}),U.decode(),z=e),U.decode(X().subarray(s,s+e))}var O=new TextEncoder;"encodeInto"in O||(O.encodeInto=function(s,e){let r=O.encode(s);return e.set(r),{read:s.length,written:r.length}});var p=0,o;function Ve(s,e){return o=s.exports,A=null,o.__wbindgen_start(),o}async function ze(s,e){if(typeof Response=="function"&&s instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(s,e)}catch(n){if(s.ok&&r(s.type)&&s.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",n);else throw n}let t=await s.arrayBuffer();return await WebAssembly.instantiate(t,e)}else {let t=await WebAssembly.instantiate(s,e);return t instanceof WebAssembly.Instance?{instance:t,module:s}:t}function r(t){switch(t){case "basic":case "cors":case "default":return true}return false}}async function K(s){if(o!==void 0)return o;if(s!==void 0&&(Object.getPrototypeOf(s)===Object.prototype?{module_or_path:s}=s:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),s===void 0)throw new Error("xlsx-wasm requires an explicit module or URL");let e=Me();(typeof s=="string"||typeof Request=="function"&&s instanceof Request||typeof URL=="function"&&s instanceof URL)&&(s=fetch(s));let{instance:r,module:t}=await ze(await s,e);return Ve(r)}var I=class extends Error{constructor(r,t=[]){super(`stale: ${r.join(", ")}`);a(this,"cells");a(this,"targets");this.name="StaleProposalError",this.cells=r,this.targets=t;}};function qe(s){if(!s.startsWith("{"))return null;try{let e=JSON.parse(s);return e.code!=="staleProposal"||!Array.isArray(e.cells)?null:new I(e.cells,Array.isArray(e.targets)?e.targets:[])}catch{return null}}var q=false,T;function N(s=new URL("./generated/xlsx_wasm_bg.wasm",import.meta.url)){return q?Promise.resolve():T||(T=K({module_or_path:s}).then(()=>{q=true;},e=>{throw T=void 0,k(e)}),T)}function Y(){if(!q)throw new Error("xlsx wasm is not initialized; call initWasm() first")}function k(s){return s instanceof Error?s:new Error(typeof s=="string"?s:String(s))}function Be(){return typeof WebAssembly=="object"}function He(){return typeof v.prototype.renderPng=="function"}function je(){return typeof v.prototype.proposeJson=="function"}function Ge(s,e={}){Y();let r=$e(e),t;try{t=r===void 0?v.open(s):v.openCollaborative(s,r);}catch(a){throw k(a)}let n=new Map,i=[],d=0,u=false,l=false,h=0,w=false;function S(){if(u)throw new Error("workbook handle is disposed")}function D(){if(!(u||w||h!==0)){w=true;try{for(;!u&&i.length>0;){let a=i.shift();if(!a)break;for(let[c,_]of [...n]){if(u)return;if(n.get(c)===_)try{_(a.update.slice(),a.origin);}catch{}}}}finally{w=false,u&&(i.length=0);}}}function J(){if(!(!l||u))for(;;){let a=t.drainUpdateEvent();if(a.byteLength===0)return;let c=a[0];if(c!==0&&c!==1)throw new Error(`xlsx wasm returned unknown update origin ${c}`);i.push({update:a.subarray(1),origin:c===0?"local":"remote"});}}function m(a,c=false){S(),h+=1;try{let _,x,E=!1;try{_=a();}catch(C){x=C,E=!0;}if(c)try{J();}catch(C){E||(x=C,E=!0);}if(E)throw k(x);return _}finally{h-=1,h===0&&D();}}function F(a){return m(a,true)}function y(a,c=false){return m(()=>JSON.parse(a()),c)}function Q(){l||(m(()=>t.startUpdateObservation()),l=true);}function Z(){!l||n.size>0||u||(i.length=0,m(()=>t.clearUpdateObservation()),l=false);}return {get clientId(){return m(()=>t.clientId)},encodeStateVector(){return m(()=>t.encodeStateVector())},encodeStateAsUpdate(a){return m(()=>a===void 0?t.encodeStateAsUpdate():t.encodeDiff(a))},applyUpdate(a){return y(()=>t.applyUpdateJson(a),true)},onUpdate(a){if(S(),typeof a!="function")throw new TypeError("update listener must be a function");let c=d++;n.set(c,a);try{Q();}catch(x){throw n.delete(c),x}let _=true;return ()=>{_&&(_=false,n.delete(c),Z());}},sheetInfo(){return y(()=>t.sheetInfoJson())},calculationStatus(){return m(()=>{let a=t.calculationStatusJson;return typeof a!="function"?{limitedCells:[]}:JSON.parse(a.call(t))})},displayList(a){return y(()=>t.displayListJson(JSON.stringify(a)))},displayListProfiled(a){return y(()=>t.displayListProfiledJson(JSON.stringify(a)))},printDisplayList(a,c,_,x){return y(()=>t.printDisplayListJson(JSON.stringify({sheet:a,range:c,metrics:_,gridlines:x})))},chartAtPoint(a,c,_){return y(()=>t.chartAtPointJson(JSON.stringify({viewport:a,x:c,y:_})))},moveChart(a,c,_,x){return y(()=>t.moveChartJson(JSON.stringify({sheet:a,chart:c,dx:_,dy:x})),true)},setActiveSheet(a){F(()=>t.setActiveSheet(a));},editCell(a,c,_,x){return y(()=>t.editCellJson(JSON.stringify({sheet:a,row:c,col:_,input:x})),true)},editCellProfiled(a,c,_,x){return y(()=>t.editCellProfiledJson(JSON.stringify({sheet:a,row:c,col:_,input:x})),true)},editCells(a,c){return y(()=>t.editCellsJson(JSON.stringify({sheet:a,edits:c})),true)},applyOps(a){return y(()=>t.applyOpsJson(JSON.stringify({ops:a})),true)},applyOpsProfiled(a){return y(()=>t.applyOpsProfiledJson(JSON.stringify({ops:a})),true)},undo(){return y(()=>t.undoJson(),true)},redo(){return y(()=>t.redoJson(),true)},cell(a,c,_){return y(()=>t.cellJson(JSON.stringify({sheet:a,row:c,col:_})))},searchText(a,c){if(!a)return [];let _=c?.limit;if(_!==void 0&&(!Number.isSafeInteger(_)||_<0||_>4294967295))throw new RangeError("search limit must be an unsigned 32-bit integer");return y(()=>t.searchTextJson(JSON.stringify({query:a,caseSensitive:c?.caseSensitive??false,..._===void 0?{}:{limit:_}})))},cellPosition(a,c,_){return y(()=>t.cellPositionJson(JSON.stringify({sheet:a,row:c,col:_})))},rangeCells(a,c){return y(()=>t.rangeCellsJson(JSON.stringify({sheet:a,range:c}))).cells},patchRangeStyle(a,c,_){return y(()=>t.patchRangeStyleJson(JSON.stringify({sheet:a,range:c,patch:_})),true)},setNumberFormat(a,c,_){let x=typeof _=="string"?{type:_}:_;return y(()=>t.setRangeNumberFormatJson(JSON.stringify({sheet:a,range:c,format:x})),true)},selectionFormatting(a,c){return y(()=>t.selectionFormattingJson(JSON.stringify({sheet:a,range:c})))},captureFormat(a,c){return y(()=>t.captureFormatJson(JSON.stringify({sheet:a,range:c})))},applyFormat(a,c,_){return y(()=>t.applyFormatJson(JSON.stringify({sheet:a,range:c,format:_})),true)},mergedRanges(a,c){return y(()=>t.mergedRangesJson(JSON.stringify({sheet:a,range:c}))).ranges},historyState(){return y(()=>t.historyStateJson())},renderPng(a){return m(()=>{let c=t.renderPng;if(typeof c!="function")throw new Error("png export not in this build");return c.call(t,JSON.stringify(a)).slice()})},renderRangePng(a){return m(()=>{let c=t.renderRangePng;if(typeof c!="function")throw new Error("png export not in this build");return c.call(t,JSON.stringify(a??{})).slice()})},save(){return m(()=>t.saveBytes())},propose(a,c,_){return F(()=>{let x=t.proposeJson;if(typeof x!="function")throw new Error("proposals not in this build");let E=_.map(({numberFormat:C,...ee})=>({...ee,...C===void 0?{}:{numberFormat:typeof C=="string"?{type:C}:C}}));return JSON.parse(x.call(t,JSON.stringify({agentId:a,note:c,edits:E})))})},listProposals(){return m(()=>{let a=t.listProposalsJson;return typeof a!="function"?[]:JSON.parse(a.call(t)).proposals})},acceptProposal(a,c){try{return F(()=>{let _=t.acceptProposalJson;if(typeof _!="function")throw new Error("proposals not in this build");return JSON.parse(_.call(t,JSON.stringify({id:a,force:c?.force??!1})))})}catch(_){let x=_ instanceof Error?_.message:typeof _=="string"?_:String(_);throw qe(x)??k(_)}},rejectProposal(a){return F(()=>{let c=t.rejectProposalJson;return typeof c!="function"?false:JSON.parse(c.call(t,JSON.stringify({id:a}))).removed})},isProposalsAvailable(){return m(()=>typeof t.proposeJson=="function")},version(){return m(()=>t.documentVersion())},readCells(a){return y(()=>t.readCellsJson(JSON.stringify(a)))},findText(a){return y(()=>t.findTextJson(JSON.stringify(a)))},validateEdits(a){return y(()=>t.validateEditsJson(JSON.stringify(a)))},applyEdits(a){return y(()=>t.applyEditsJson(JSON.stringify(a)),true)},exportStructured(a={}){return y(()=>t.exportStructuredJson(JSON.stringify(a)))},exportMarkdown(a={},c={}){return y(()=>t.exportMarkdownJson(JSON.stringify(a),JSON.stringify(c)))},dispose(){if(u)return;u=true,n.clear(),i.length=0;let a;if(l){try{t.clearUpdateObservation();}catch(c){a=c;}l=false;}try{t.free();}catch(c){a??(a=c);}if(a!==void 0)throw k(a)}}}function $e(s){if(!s.collaborative){if(s.clientId!==void 0)throw new TypeError("clientId requires collaborative mode");return}if(s.clientId!==void 0){if(!Number.isSafeInteger(s.clientId)||s.clientId<=0||s.clientId>Number.MAX_SAFE_INTEGER)throw new RangeError("clientId must be a nonzero safe integer");return s.clientId}let e=globalThis.crypto;if(!e||typeof e.getRandomValues!="function")throw new Error("crypto.getRandomValues is required to generate a collaboration client ID");let r=new Uint32Array(2),t;do e.getRandomValues(r),t=(r[0]&2097151)*4294967296+r[1];while(t===0);return t}function B(s){try{return JSON.parse(s())}catch(e){throw k(e)}}async function Ke(s,e={}){return await N(),B(()=>G(s,JSON.stringify(e)))}async function Ye(s,e={},r={}){return await N(),B(()=>j(s,JSON.stringify(e),JSON.stringify(r)))}async function Qe(s,e={}){return await N(),B(()=>$(JSON.stringify(s),JSON.stringify(e)))}function Ze(){return Y(),v.version()}export{I as StaleProposalError,Ye as exportXlsxMarkdown,Ke as exportXlsxStructured,N as initWasm,He as isPngExportAvailable,je as isProposalsAvailable,Be as isWasmAvailable,Ge as openWorkbook,Ee as paintDisplayList,Qe as renderXlsxMarkdown,Ze as wasmVersion};
|
|
1
|
+
export{w as buildA11yGrid,o as cellAtPoint,j as cellCount,p as cellRect,n as chartRegionAtPoint,e as clampScroll,k as extendTo,v as fromTsv,r as hyperlinkAtCell,l as moveFocus,h as normalizeRange,t as parseHyperlinkLocation,i as rangeContains,q as rangeRect,s as safeExternalHyperlink,g as selectionAt,m as selectionKeyReducer,u as toTsv,b as totalExtent,a as trackCount,f as uniformOffsets,d as visibleCells,c as visibleRange}from'./chunk-SXM2HKJL.js';export{j as WorkbookEditPeerFailedError,b as WorkbookRecoveryReplayError,a as createWorkbookEditSession,e as openWorkbookSession,c as workbookSessionRecovery}from'./chunk-HJJEOLPD.js';export{l as DisplayTooLargeError,k as StaleProposalError,P as WorkbookPeerHydrationError,F as WorkbookPngUnavailableError,C as exportXlsxMarkdown,B as exportXlsxStructured,p as getDisplayListCellLimit,n as initWasm,r as isPngExportAvailable,s as isProposalsAvailable,q as isWasmAvailable,t as openWorkbook,D as renderXlsxMarkdown,E as wasmVersion}from'./chunk-K7TMSGNA.js';import'./chunk-JGTBRHCP.js';import'./chunk-O2XFH626.js';var W={gray125:[17,0,68,0,17,0,68,0],gray0625:[1,0,16,0,1,0,16,0],mediumGray:[85,170,85,170,85,170,85,170],darkGray:[119,221,119,221,119,221,119,221],lightGray:[17,68,17,68,17,68,17,68],darkHorizontal:[255,255,0,0,255,255,0,0],darkVertical:[51,51,51,51,51,51,51,51],darkDown:[51,102,204,153,51,102,204,153],darkUp:[51,153,204,102,51,153,204,102],darkGrid:[255,255,51,51,255,255,51,51],darkTrellis:[51,255,204,255,51,255,204,255],lightHorizontal:[255,0,0,0,255,0,0,0],lightVertical:[17,17,17,17,17,17,17,17],lightDown:[17,34,68,136,17,34,68,136],lightUp:[17,136,68,34,17,136,68,34],lightGrid:[255,17,17,17,255,17,17,17],lightTrellis:[17,170,68,170,17,170,68,170]};function P(e,t,n,r){let i=t.text,s=t.align??"left",o=n.parts;if(o.length===0&&!n.overflow){e.textAlign=s,r(e,t,i,n.left+X(s,n.width,0),s);return}e.textAlign="left";let a=0,l=0,u=false;for(let d=0;d<o.length;d++){let x=o[d],h=O(i,x.offset);l+=H(e,i,a,h),x.kind==="padding"?(l+=e.measureText(x.character).width,a=h+1):(u=true,a=h);}if(l+=H(e,i,a,i.length),n.overflow&&l>n.width){let x=(n.general===void 0?void 0:Ie(n.general,n.width,e))??Fe(n.width,e);r(e,t,x,n.left+X(s,n.width,e.measureText(x).width),"left");return}let p=u?Math.max(0,n.width-l):0,f=n.left+X(s,n.width,l+p);a=0;for(let d=0;d<o.length;d++){let x=o[d],h=O(i,x.offset);if(h>a){let g=i.slice(a,h);r(e,t,g,f,"left"),f+=e.measureText(g).width;}if(x.kind==="padding")f+=e.measureText(x.character).width,a=h+1;else {let g=e.measureText(x.character).width;g>0&&p>=g&&r(e,t,x.character.repeat(Math.floor(p/g)),f,"left"),f+=p,a=h;}}a<i.length&&r(e,t,a===0?i:i.slice(a),f,"left");}function O(e,t){let n=0;for(let r=0;r<t&&n<e.length;){let i=e.codePointAt(n);r+=i<128?1:i<2048?2:i<65536?3:4,n+=i>65535?2:1;}return n}function H(e,t,n,r){return r<=n?0:e.measureText(n===0&&r===t.length?t:t.slice(n,r)).width}function X(e,t,n){return e==="right"?t-n:e==="center"?(t-n)/2:0}function Fe(e,t){let n=t.measureText("#").width;return n>0&&e>0?"#".repeat(Math.max(1,Math.floor(e/n))):""}function Ie(e,t,n){if(!Number.isFinite(e)||e===0)return;let r=Math.floor(Math.log10(Math.abs(e)));if(r>=-4&&r<11)for(let i=Math.min(15,Math.max(0,10-r));i>=0;i--){let s=10**i,o=Math.sign(e)*Math.round(Math.abs(e)*s)/s,a=$(o.toFixed(i));if(Number(a)!==0&&n.measureText(a).width<=t)return a}for(let i=5;i>=0;i--){let s=Ne(e,i);if(n.measureText(s).width<=t)return s}}function Ne(e,t){let[n,r]=Math.abs(e).toExponential(14).split("e"),i=n.replace(".",""),s=Number(r),o=i.slice(0,t+1);if(i.charCodeAt(t+1)>=53){let l=o.search(/[0-8]9*$/);l<0?(o=`1${"0".repeat(t)}`,s++):o=`${o.slice(0,l)}${Number(o[l])+1}${"0".repeat(o.length-l-1)}`;}let a=o.length>1?$(`${o[0]}.${o.slice(1)}`):o;return `${e<0?"-":""}${a}E${s<0?"-":"+"}${Math.abs(s).toString().padStart(2,"0")}`}function $(e){return e.includes(".")?e.replace(/0+$/,"").replace(/\.$/,""):e}var w;function Le(e){if(w===void 0){let r=Intl.Segmenter;try{w=typeof r=="function"?new r(void 0,{granularity:"grapheme"}):null;}catch{w=null;}}if(w)return [...w.segment(e)].map(r=>r.index+r.segment.length);let t=[],n=0;for(let r of e)t.push(n+=r.length);return t}function V(e,t,n){let r=Number.isNaN(t)?Number.POSITIVE_INFINITY:t,i=[],o=(e.endsWith(`
|
|
2
|
+
`)?e.slice(0,e.endsWith(`\r
|
|
3
|
+
`)?-2:-1):e).split(`
|
|
4
|
+
`);return o.forEach((a,l)=>{We(a.endsWith("\r")?a.slice(0,-1):a,r,n,i),l<o.length-1&&(i[i.length-1]=i[i.length-1].replace(/ +$/,""));}),i}function We(e,t,n,r){if(n(e)<=t){r.push(e);return}let i=0,s=null;for(let[o,a]of Oe(e)){if(s!==null){if(n(e.slice(i,a))<=t){s=a;continue}r.push(e.slice(i,s)),i=o;}if(s=a,n(e.slice(i,a))<=t)continue;let l=i,u=Le(e.slice(l,a)).map(f=>l+f),p=0;for(let f=B(e,i,u,p,t,n);f!==null;)r.push(e.slice(i,u[f])),i=u[f],p=f+1,f=B(e,i,u,p,t,n);}r.push(e.slice(i));}function B(e,t,n,r,i,s){let o=r,a;for(let l=1;;l*=2){let u=Math.min(o+l,n.length-1);if(u===o)return null;if(s(e.slice(t,n[u]))>i){a=u;break}o=u;}for(;a-o>1;){let l=o+Math.floor((a-o)/2);s(e.slice(t,n[l]))>i?a=l:o=l;}return o}function Oe(e){let t=[],n=0;for(let r of e.split(" "))r.length>0&&t.push([n,n+r.length]),n+=r.length+1;return t}function _(e,t,n,r){let i=Math.max(n-1,0),s=r.valign==="top"?t:r.valign==="center"?t-i/2:t-i;return e+r.lineHeight*s}var He=96/72,U=1.2,$e=.8,G={left:"left",center:"center",right:"right"},Be={dashed:[4,2],dotted:[1,2],mediumDashed:[8,4],dashDot:[4,2,1,2],mediumDashDot:[8,4,2,4],dashDotDot:[4,2,1,2,1,2],mediumDashDotDot:[8,4,2,4,2,4],slantDashDot:[4,2,1,2]},z=new WeakMap;function Ve(e,t,n,r={x:0,y:0}){e.save(),e.setTransform(n,0,0,n,r.x,r.y),e.beginPath(),e.rect(0,0,t.width,t.height),e.clip(),e.clearRect(0,0,t.width,t.height);for(let i of t.commands)_e(e,i,n,r);e.restore();}function _e(e,t,n,r){switch(t.op){case "fillRect":v(e,t.clip,()=>{e.fillStyle=t.color,e.fillRect(t.x,t.y,t.w,t.h);});return;case "patternFill":v(e,t.clip,()=>Ge(e,t,n,r));return;case "line":v(e,t.clip,()=>Ue(e,t,n,r));return;case "path":v(e,t.clip,()=>ze(e,t));return;case "text":Ke(e,t);return}}function Ge(e,t,n,r){let i=z.get(e);i||(i=new Map,z.set(e,i));let s=`${t.pattern}/${t.fg}/${t.bg}/${n}`,o=i.get(s);if(!o){let u=typeof OffscreenCanvas>"u"?document.createElement("canvas"):new OffscreenCanvas(8,8);u.width=8,u.height=8;let p=u.getContext("2d"),f=p.createImageData(8,8),d=Number.parseInt(t.fg.slice(1),16),x=Number.parseInt(t.bg.slice(1),16),h=W[t.pattern];for(let g=0;g<8;g+=1)for(let b=0;b<8;b+=1){let m=h[g]&1<<b?d:x,y=(g*8+b)*4;f.data[y]=m>>16&255,f.data[y+1]=m>>8&255,f.data[y+2]=m&255,f.data[y+3]=255;}if(p.putImageData(f,0,0),o=e.createPattern(u,"repeat")??void 0,!o)return;i.size>=256&&i.clear(),i.set(s,o);}o.setTransform({a:1/n,b:0,c:0,d:1/n,e:(Math.round(t.originX*n+r.x)-r.x)/n,f:(Math.round(t.originY*n+r.y)-r.y)/n}),e.save(),e.imageSmoothingEnabled=false,e.fillStyle=o;let a=(Math.round(t.x*n+r.x)-r.x)/n,l=(Math.round(t.y*n+r.y)-r.y)/n;e.fillRect(a,l,(Math.round((t.x+t.w)*n+r.x)-r.x)/n-a,(Math.round((t.y+t.h)*n+r.y)-r.y)/n-l),e.restore();}function v(e,t,n){if(!t){n();return}e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),n(),e.restore();}function ze(e,t){e.beginPath();for(let n of t.commands)switch(n.type){case "move":e.moveTo(n.x,n.y);break;case "line":e.lineTo(n.x,n.y);break;case "quad":e.quadraticCurveTo(n.cpx,n.cpy,n.x,n.y);break;case "cubic":e.bezierCurveTo(n.cp1x,n.cp1y,n.cp2x,n.cp2y,n.x,n.y);break;case "close":e.closePath();break}e.fillStyle=t.fill,e.fill(),t.stroke&&(e.strokeStyle=t.stroke.color,e.lineWidth=t.stroke.width,e.setLineDash([]),e.stroke());}function Ue(e,t,n,r){e.strokeStyle=t.color,e.save(),e.lineCap="butt";let{x1:i,y1:s,x2:o,y2:a}=t,l=Math.max(1,Math.round(t.width*n)),u=t.style==="double"&&t.rail===void 0;if(t.style&&!u&&(s===a?(s=a=(Math.floor(s*n+r.y)+l%2/2-r.y)/n,i=(Math.round(i*n+r.x)-r.x)/n,o=(Math.round(o*n+r.x)-r.x)/n):i===o&&(i=o=(Math.floor(i*n+r.x)+l%2/2-r.x)/n,s=(Math.round(s*n+r.y)-r.y)/n,a=(Math.round(a*n+r.y)-r.y)/n)),t.style==="double"){let f=t.rail===void 0?Math.max(t.width*.8,.8):(t.width-t.rail)/2,d=Math.abs(s-a)<=Math.abs(i-o),[x,h]=d?[0,f]:[f,0];e.lineWidth=t.rail??Math.max(t.width*.6,.5),e.setLineDash([]),R(e,i-x,s-h,o-x,a-h),R(e,i+x,s+h,o+x,a+h),e.restore();return}e.lineWidth=t.style?l/n:t.width;let p=t.style?.startsWith("medium")?t.width/2:t.width;e.setLineDash(t.style?Be[t.style].map(f=>f*p):[]),R(e,i,s,o,a),e.restore();}function R(e,t,n,r,i){e.beginPath(),e.moveTo(t,n),e.lineTo(r,i),e.stroke();}function Ke(e,t){if(e.save(),t.clip&&(e.beginPath(),e.rect(t.clip.x,t.clip.y,t.clip.w,t.clip.h),e.clip()),e.fillStyle=t.color,e.font=Je(t),e.textBaseline="alphabetic",t.stacked)Ze(e,t);else if(t.rotationDeg!==void 0&&t.rotationDeg!==null)je(e,t,t.rotationDeg);else if(t.numberFormat)P(e,t,t.numberFormat,A);else if(t.wrap){let n=t.wrap,r=t.align??"left";e.textAlign=G[r];let i=V(t.text,n.width,s=>e.measureText(s).width);i.forEach((s,o)=>{A(e,{...t,y:_(t.y,o,i.length,n)},s,t.x,r);});}else {let n=t.align??"left";e.textAlign=G[n],A(e,t,t.text,t.x,n);}e.restore();}function qe(e,t,n){let r=n*U,i=Math.abs(t)*Math.PI/180,s=Math.abs(Math.cos(i)),o=Math.abs(Math.sin(i)),a=Number.POSITIVE_INFINITY;return s>1e-6&&(a=Math.min(a,(e.w-r*o)/s)),o>1e-6&&(a=Math.min(a,(e.h-r*s)/o)),Number.isFinite(a)||(a=Math.max(e.w,e.h)),Math.max(0,a)}function Ye(e){let t=Intl.Segmenter;if(typeof t=="function")try{return [...new t(void 0,{granularity:"grapheme"}).segment(e)].map(n=>n.segment)}catch{return [...e]}return [...e]}function je(e,t,n){let r=t.rotationBox??t.clip??{x:t.x,y:t.y,w:0,h:0},i=S(t),s=[{text:t.text,offset:0}],o=e.measureText(t.text).width;if(t.numberFormat){let k=qe(r,n,i),T=[];if(P(e,{...t,numberFormat:void 0},{...t.numberFormat,left:0,width:k},(D,I,c,E,N)=>{let L=e.measureText(c).width,Y=N==="right"?E-L:N==="center"?E-L/2:E;T.push({text:c,x:Y});}),T.length>0){let D=Math.min(...T.map(c=>c.x)),I=Math.max(...T.map(c=>c.x+e.measureText(c.text).width));s=T.map(c=>({text:c.text,offset:c.x-D})),o=Math.max(0,I-D);}}let a=e.measureText(t.text),l=(n===90?a.fontBoundingBoxAscent:void 0)??(a.actualBoundingBoxAscent||i*.8),u=(n===90?a.fontBoundingBoxDescent:void 0)??(a.actualBoundingBoxDescent||i*.2),p=l+u,f=-n*Math.PI/180,d=Math.cos(f),x=Math.sin(f),h=Math.abs(o*d)+Math.abs(p*x),g=Math.abs(o*x)+Math.abs(p*d),b=t.align??"left",m=b==="center"?r.x+(r.w-h)/2:b==="right"?r.x+r.w-h:r.x,y=t.rotationValign??"bottom",C=y==="top"?r.y:y==="center"?r.y+(r.h-g)/2:r.y+r.h-g,K=m+h/2,q=C+g/2;e.save(),e.translate(K,q),e.rotate(f),t.highlight&&(e.fillStyle=t.highlight,e.fillRect(-o/2-2,-p/2-1,o+4,p+2),e.fillStyle=t.color),e.textBaseline="alphabetic";let M=(l-u)/2;if(t.numberFormat){e.textAlign="left";for(let k of s)e.fillText(k.text,-o/2+k.offset,M);}else e.textAlign="center",e.fillText(t.text,0,M);let F=Math.max(i*.05,.5);e.fillStyle=t.color,(t.underline||t.dashedUnderline)&&e.fillRect(-o/2,M+i*.1,o,F),t.strike&&e.fillRect(-o/2,M-i*.26,o,F),e.restore();}function Ze(e,t){let n=t.rotationBox??t.clip??{x:t.x,y:t.y,w:0,h:0},r=S(t),i=r*U,s=r*$e,o=Ye(t.text),a=o.length*i,l=t.rotationValign??"bottom",u=l==="top"?n.y:l==="center"?n.y+(n.h-a)/2:n.y+n.h-a,p=t.align??"left",f=t.clip??n,d=Math.max(0,Math.floor((f.y-u)/i)),x=Math.min(o.length-1,Math.ceil((f.y+f.h-u)/i)-1);e.textAlign="left",e.textBaseline="alphabetic";for(let h=d;h<=x;h+=1){let g=o[h],b=e.measureText(g).width,m=p==="center"?n.x+(n.w-b)/2:p==="right"?n.x+n.w-b:n.x;if(m+b<=f.x||m>=f.x+f.w)continue;let y=u+h*i+s;t.highlight&&(e.fillStyle=t.highlight,e.fillRect(m-2,y-s-1,b+4,i+2),e.fillStyle=t.color),e.fillText(g,m,y);let C=Math.max(r*.05,.5);e.fillStyle=t.color,t.underline&&e.fillRect(m,y+r*.1,b,C),t.strike&&e.fillRect(m,y-r*.26,b,C),t.dashedUnderline&&(e.save(),e.strokeStyle=t.color,e.lineWidth=C,e.setLineDash([3,2]),R(e,m,y+r*.1,m+b,y+r*.1),e.restore());}}function A(e,t,n,r,i){t.highlight&&et(e,t,n,r,i),e.fillStyle=t.color,e.fillText(n,r,t.y),(t.underline||t.strike||t.dashedUnderline)&&Qe(e,t,n,r,i);}function Je(e){let t=e.italic?"italic ":"",n=e.bold?"bold ":"",r=e.fontFamily?e.chart?e.fontFamily:`"${e.fontFamily.replace(/"/g,'\\"')}", sans-serif`:"sans-serif";return `${t}${n}${S(e)}px ${r}`}function S(e){return e.fontSize*He}function Qe(e,t,n,r,i){let s=e.measureText(n).width,o=i==="right"?r-s:i==="center"?r-s/2:r,a=S(t),l=Math.max(a*.05,.5);e.fillStyle=t.color,t.underline&&e.fillRect(o,t.y+a*.1,s,l),t.strike&&e.fillRect(o,t.y-a*.26,s,l),t.dashedUnderline&&(e.save(),e.strokeStyle=t.color,e.lineWidth=l,e.setLineDash([3,2]),R(e,o,t.y+a*.1,o+s,t.y+a*.1),e.restore());}function et(e,t,n,r,i){let s=e.measureText(n),o=s.width,a=i==="right"?r-o:i==="center"?r-o/2:r,l=S(t),u=s.actualBoundingBoxAscent||l*.8,p=s.actualBoundingBoxDescent||l*.2;e.fillStyle=t.highlight,e.fillRect(a-2,t.y-u-1,o+4,u+p+2);}export{Ve as paintDisplayList};
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TS mirror of the Rust display list.
|
|
3
|
+
*
|
|
4
|
+
* Hand-mirrored from crates/xlsx-render/src/display_list.rs — keep in sync.
|
|
5
|
+
* The renderer front-half (Rust) emits a target-agnostic list of draw commands;
|
|
6
|
+
* a backend (Canvas2D in the browser, tiny-skia on servers) executes them. These
|
|
7
|
+
* types are plain data with no DOM or framework dependency so the same list
|
|
8
|
+
* flows across the wasm boundary as JSON and into either backend unchanged.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Axis-aligned rectangle in device-independent pixels.
|
|
12
|
+
*/
|
|
13
|
+
interface Rect {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
w: number;
|
|
17
|
+
h: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Horizontal alignment for a text command, matching the spreadsheet cell
|
|
21
|
+
* alignment values the renderer resolves before emitting.
|
|
22
|
+
*/
|
|
23
|
+
type TextAlign = 'left' | 'center' | 'right';
|
|
24
|
+
/**
|
|
25
|
+
* Fill a solid rectangle — cell backgrounds, selection bands, header fills.
|
|
26
|
+
*/
|
|
27
|
+
interface FillRectCmd {
|
|
28
|
+
op: 'fillRect';
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
w: number;
|
|
32
|
+
h: number;
|
|
33
|
+
/** css color string (`#rrggbb`, `rgba(...)`), resolved from theme + tint in Rust. */
|
|
34
|
+
color: string;
|
|
35
|
+
clip?: Rect;
|
|
36
|
+
}
|
|
37
|
+
type PatternType = 'gray125' | 'gray0625' | 'mediumGray' | 'darkGray' | 'lightGray' | 'darkHorizontal' | 'darkVertical' | 'darkDown' | 'darkUp' | 'darkGrid' | 'darkTrellis' | 'lightHorizontal' | 'lightVertical' | 'lightDown' | 'lightUp' | 'lightGrid' | 'lightTrellis';
|
|
38
|
+
interface PatternFillCmd {
|
|
39
|
+
op: 'patternFill';
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
w: number;
|
|
43
|
+
h: number;
|
|
44
|
+
pattern: PatternType;
|
|
45
|
+
fg: string;
|
|
46
|
+
bg: string;
|
|
47
|
+
originX: number;
|
|
48
|
+
originY: number;
|
|
49
|
+
clip?: Rect;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Stroke a straight line — gridlines, cell borders, frozen-pane dividers.
|
|
53
|
+
*/
|
|
54
|
+
interface LineCmd {
|
|
55
|
+
op: 'line';
|
|
56
|
+
x1: number;
|
|
57
|
+
y1: number;
|
|
58
|
+
x2: number;
|
|
59
|
+
y2: number;
|
|
60
|
+
width: number;
|
|
61
|
+
color: string;
|
|
62
|
+
/**
|
|
63
|
+
* Stroke pattern. Absent/`undefined` is solid; `'dashed'`/`'dotted'` apply a
|
|
64
|
+
* dash pattern; `'double'` draws two thin parallel passes offset by ±. Skip-
|
|
65
|
+
* serialized at its default in Rust, so a solid line omits the field.
|
|
66
|
+
*/
|
|
67
|
+
style?: 'dashed' | 'dotted' | 'double' | 'mediumDashed' | 'dashDot' | 'mediumDashDot' | 'dashDotDot' | 'mediumDashDotDot' | 'slantDashDot';
|
|
68
|
+
/**
|
|
69
|
+
* Rail width of a `'double'` line: two rails this wide on the outer edges of
|
|
70
|
+
* `width`. Absent, painters keep the legacy rails derived from `width`.
|
|
71
|
+
*/
|
|
72
|
+
rail?: number;
|
|
73
|
+
clip?: Rect;
|
|
74
|
+
}
|
|
75
|
+
type GeometryPathCommand = {
|
|
76
|
+
type: 'move';
|
|
77
|
+
x: number;
|
|
78
|
+
y: number;
|
|
79
|
+
} | {
|
|
80
|
+
type: 'line';
|
|
81
|
+
x: number;
|
|
82
|
+
y: number;
|
|
83
|
+
} | {
|
|
84
|
+
type: 'quad';
|
|
85
|
+
cpx: number;
|
|
86
|
+
cpy: number;
|
|
87
|
+
x: number;
|
|
88
|
+
y: number;
|
|
89
|
+
} | {
|
|
90
|
+
type: 'cubic';
|
|
91
|
+
cp1x: number;
|
|
92
|
+
cp1y: number;
|
|
93
|
+
cp2x: number;
|
|
94
|
+
cp2y: number;
|
|
95
|
+
x: number;
|
|
96
|
+
y: number;
|
|
97
|
+
} | {
|
|
98
|
+
type: 'close';
|
|
99
|
+
};
|
|
100
|
+
interface PathStroke {
|
|
101
|
+
color: string;
|
|
102
|
+
width: number;
|
|
103
|
+
}
|
|
104
|
+
interface PathCmd {
|
|
105
|
+
op: 'path';
|
|
106
|
+
commands: GeometryPathCommand[];
|
|
107
|
+
fill: string;
|
|
108
|
+
stroke?: PathStroke;
|
|
109
|
+
clip?: Rect;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Wrapped cell text: the painter breaks the run into lines no wider than
|
|
113
|
+
* `width` and steps their baselines by `lineHeight`, the block anchored by
|
|
114
|
+
* `valign` on the single-line baseline `y`.
|
|
115
|
+
*/
|
|
116
|
+
interface TextWrap {
|
|
117
|
+
width: number;
|
|
118
|
+
lineHeight: number;
|
|
119
|
+
valign: 'top' | 'center' | 'bottom';
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Paint a text run clipped to the cell box: `clip` is the cell rect and
|
|
123
|
+
* `align` places the run within it. A run without `wrap` is one line.
|
|
124
|
+
*/
|
|
125
|
+
interface TextCmd {
|
|
126
|
+
op: 'text';
|
|
127
|
+
x: number;
|
|
128
|
+
y: number;
|
|
129
|
+
text: string;
|
|
130
|
+
/** Font size in points. */
|
|
131
|
+
fontSize: number;
|
|
132
|
+
/** resolved font color (`#rrggbb`); a number-format color prefix wins upstream. */
|
|
133
|
+
color: string;
|
|
134
|
+
/** clip rectangle; the backend saves/clips/restores around the fill. */
|
|
135
|
+
clip?: Rect;
|
|
136
|
+
align?: TextAlign;
|
|
137
|
+
/**
|
|
138
|
+
* Font style facets resolved from the cell's style. All skip-serialized at
|
|
139
|
+
* `false` in Rust, so an unstyled run omits them; treat absent as `false`.
|
|
140
|
+
*/
|
|
141
|
+
bold?: boolean;
|
|
142
|
+
italic?: boolean;
|
|
143
|
+
underline?: boolean;
|
|
144
|
+
strike?: boolean;
|
|
145
|
+
highlight?: string;
|
|
146
|
+
dashedUnderline?: boolean;
|
|
147
|
+
/** css/font family from the style font; the backend falls back to its default. */
|
|
148
|
+
fontFamily?: string;
|
|
149
|
+
numberFormat?: NumberFormatLayout;
|
|
150
|
+
/**
|
|
151
|
+
* Preview text that is not the cell's committed value (a proposal ghost's
|
|
152
|
+
* `new` text). Painted normally, but excluded from a11y text recovery.
|
|
153
|
+
*/
|
|
154
|
+
ghost?: boolean;
|
|
155
|
+
chart?: boolean;
|
|
156
|
+
rotationDeg?: number;
|
|
157
|
+
rotationBox?: Rect;
|
|
158
|
+
rotationValign?: 'top' | 'center' | 'bottom';
|
|
159
|
+
stacked?: boolean;
|
|
160
|
+
wrap?: TextWrap;
|
|
161
|
+
}
|
|
162
|
+
interface NumberFormatLayout {
|
|
163
|
+
left: number;
|
|
164
|
+
width: number;
|
|
165
|
+
parts: {
|
|
166
|
+
offset: number;
|
|
167
|
+
kind: 'padding' | 'fill';
|
|
168
|
+
character: string;
|
|
169
|
+
}[];
|
|
170
|
+
general?: number;
|
|
171
|
+
overflow?: boolean;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* One draw command; discriminated on `op`.
|
|
175
|
+
*/
|
|
176
|
+
type DrawCmd = FillRectCmd | PatternFillCmd | LineCmd | PathCmd | TextCmd;
|
|
177
|
+
/**
|
|
178
|
+
* Grid metadata for the frame: which sheet cells the visible tracks map to and
|
|
179
|
+
* their viewport-local pixel boundaries. `rowOffsets[i]`/`colOffsets[i]` is the
|
|
180
|
+
* leading edge of the i-th visible row/col in device-independent px from the
|
|
181
|
+
* frame origin; both arrays have length `visible count + 1`, the last entry
|
|
182
|
+
* being one-past-end (the trailing edge of the last visible track). The pure
|
|
183
|
+
* hit-test and a11y seams read this to place clicks and mirror the grid without
|
|
184
|
+
* re-deriving geometry.
|
|
185
|
+
*
|
|
186
|
+
* Hand-mirrored from crates/xlsx-render/src/display_list.rs — keep in sync.
|
|
187
|
+
*/
|
|
188
|
+
interface GridMeta {
|
|
189
|
+
startRow: number;
|
|
190
|
+
startCol: number;
|
|
191
|
+
hiddenRowSpans?: [number, number][];
|
|
192
|
+
hiddenColSpans?: [number, number][];
|
|
193
|
+
rowIndices?: number[];
|
|
194
|
+
colIndices?: number[];
|
|
195
|
+
rowOffsets: number[];
|
|
196
|
+
colOffsets: number[];
|
|
197
|
+
}
|
|
198
|
+
interface HyperlinkRegion {
|
|
199
|
+
top: number;
|
|
200
|
+
left: number;
|
|
201
|
+
bottom: number;
|
|
202
|
+
right: number;
|
|
203
|
+
externalTarget?: string;
|
|
204
|
+
location?: string;
|
|
205
|
+
tooltip?: string;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* A chart's placement in the frame: the id that addresses it across the wasm
|
|
209
|
+
* boundary, what a screen reader reads, whether the renderer managed to draw
|
|
210
|
+
* it, its full viewport-local rect and the visible part after pane clipping. A
|
|
211
|
+
* chart that degraded to a placeholder still gets a region, so it stays an
|
|
212
|
+
* addressable object on the sheet.
|
|
213
|
+
*
|
|
214
|
+
* Hand-mirrored from crates/xlsx-render/src/display_list.rs — keep in sync.
|
|
215
|
+
*/
|
|
216
|
+
interface ChartRegion {
|
|
217
|
+
/**
|
|
218
|
+
* the drawing part and the anchor in it, unique within a sheet. Opaque —
|
|
219
|
+
* never the chart part's path, which two anchors may share.
|
|
220
|
+
*/
|
|
221
|
+
id: string;
|
|
222
|
+
label: string;
|
|
223
|
+
/**
|
|
224
|
+
* the chart could not be drawn; a neutral box occupies its rect instead.
|
|
225
|
+
* skip-serialized at `false` in Rust, so treat absent as `false`.
|
|
226
|
+
*/
|
|
227
|
+
placeholder?: boolean;
|
|
228
|
+
rect: Rect;
|
|
229
|
+
/** `rect` intersected with the pane band it paints in — the hit area. */
|
|
230
|
+
clip: Rect;
|
|
231
|
+
/** whether the anchor can be repinned; an absolute one cannot. */
|
|
232
|
+
movable: boolean;
|
|
233
|
+
}
|
|
234
|
+
/** Former name of {@link ChartRegion}, when it carried the label alone. */
|
|
235
|
+
type ChartA11yAttrs = ChartRegion;
|
|
236
|
+
/**
|
|
237
|
+
* A full frame to paint: logical size plus the ordered command stream. `grid`
|
|
238
|
+
* is optional so a synthetic or pre-grid-metadata frame still type-checks; the
|
|
239
|
+
* hit-test and a11y builders treat its absence as "no addressable cells".
|
|
240
|
+
*/
|
|
241
|
+
interface DisplayList {
|
|
242
|
+
width: number;
|
|
243
|
+
height: number;
|
|
244
|
+
commands: DrawCmd[];
|
|
245
|
+
grid?: GridMeta;
|
|
246
|
+
hyperlinks?: HyperlinkRegion[];
|
|
247
|
+
charts?: ChartRegion[];
|
|
248
|
+
/** The cell budget omitted the bottom of this viewport. */
|
|
249
|
+
truncated?: boolean;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Pure selection types. Plain data only — no DOM, no framework — so the model
|
|
254
|
+
* is golden-testable. The chrome layer interprets the
|
|
255
|
+
* declarative {@link SelectionAction}s the reducer emits.
|
|
256
|
+
*/
|
|
257
|
+
/**
|
|
258
|
+
* A single cell coordinate. `row`/`col` are zero-based sheet indices, not px.
|
|
259
|
+
*/
|
|
260
|
+
interface CellAddr {
|
|
261
|
+
row: number;
|
|
262
|
+
col: number;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* `anchor` is the fixed starting cell; `focus` is the active cell.
|
|
266
|
+
* `range` overrides their bounds for region selection.
|
|
267
|
+
*/
|
|
268
|
+
interface Selection {
|
|
269
|
+
anchor: CellAddr;
|
|
270
|
+
focus: CellAddr;
|
|
271
|
+
/** Explicit bounds when the active cell is inside a selected region. */
|
|
272
|
+
range?: CellRange;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* A normalized, inclusive rectangle of cells. `top <= bottom`, `left <= right`.
|
|
276
|
+
* Derived from a {@link Selection} by {@link normalizeRange}; the natural shape
|
|
277
|
+
* for hit-testing, overlay rects, and range reads.
|
|
278
|
+
*/
|
|
279
|
+
interface CellRange {
|
|
280
|
+
top: number;
|
|
281
|
+
left: number;
|
|
282
|
+
bottom: number;
|
|
283
|
+
right: number;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* A cardinal move direction for {@link moveFocus} and arrow-key handling.
|
|
287
|
+
*/
|
|
288
|
+
type Direction = 'up' | 'down' | 'left' | 'right';
|
|
289
|
+
/** Sheet bounds and the viewport height in whole rows. */
|
|
290
|
+
interface SelectionLimits {
|
|
291
|
+
rows: number;
|
|
292
|
+
cols: number;
|
|
293
|
+
rowsPerPage: number;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Options for {@link moveFocus}: whether to extend (keep the anchor) or collapse
|
|
297
|
+
* to a single cell, how many cells to step, and the grid bounds to clamp into.
|
|
298
|
+
*/
|
|
299
|
+
interface MoveOpts {
|
|
300
|
+
extend?: boolean;
|
|
301
|
+
step?: number;
|
|
302
|
+
limits: SelectionLimits;
|
|
303
|
+
hidden?: SelectionHidden;
|
|
304
|
+
merges?: SelectionMerges;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* A keyboard event reduced to the fields the reducer reads. `metaKey`/`ctrlKey`
|
|
308
|
+
* are both accepted so a caller need not normalize mac cmd vs win/linux ctrl.
|
|
309
|
+
*/
|
|
310
|
+
interface KeyInput {
|
|
311
|
+
key: string;
|
|
312
|
+
shiftKey?: boolean;
|
|
313
|
+
metaKey?: boolean;
|
|
314
|
+
ctrlKey?: boolean;
|
|
315
|
+
altKey?: boolean;
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* The declarative outcome of a keystroke. The chrome interprets it: `move`
|
|
319
|
+
* replaces the selection, `startEdit` opens the in-cell editor (seeding it with
|
|
320
|
+
* `initialInput` when a printable key triggered it), `clear` deletes the
|
|
321
|
+
* selected cells' contents, and `none` means the key was not handled here.
|
|
322
|
+
*/
|
|
323
|
+
type SelectionAction = {
|
|
324
|
+
type: 'move';
|
|
325
|
+
selection: Selection;
|
|
326
|
+
} | {
|
|
327
|
+
type: 'startEdit';
|
|
328
|
+
initialInput?: string;
|
|
329
|
+
} | {
|
|
330
|
+
type: 'clear';
|
|
331
|
+
} | {
|
|
332
|
+
type: 'none';
|
|
333
|
+
};
|
|
334
|
+
/** Precomputed model answers for one keyboard navigation request. */
|
|
335
|
+
interface SelectionData {
|
|
336
|
+
merge?: CellRange | null;
|
|
337
|
+
edge?: CellAddr | null;
|
|
338
|
+
region?: CellRange | null;
|
|
339
|
+
usedRange?: CellRange | null;
|
|
340
|
+
}
|
|
341
|
+
interface SelectionHidden {
|
|
342
|
+
isRowHidden(row: number): boolean;
|
|
343
|
+
isColHidden(col: number): boolean;
|
|
344
|
+
}
|
|
345
|
+
/** Merged areas, so navigation treats each one as a single cell. */
|
|
346
|
+
interface SelectionMerges {
|
|
347
|
+
mergeAt(row: number, col: number): CellRange | null;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export type { CellAddr as C, DisplayList as D, FillRectCmd as F, GeometryPathCommand as G, HyperlinkRegion as H, KeyInput as K, LineCmd as L, MoveOpts as M, PathCmd as P, Rect as R, Selection as S, TextAlign as T, CellRange as a, ChartA11yAttrs as b, ChartRegion as c, Direction as d, DrawCmd as e, GridMeta as f, PathStroke as g, PatternFillCmd as h, PatternType as i, SelectionAction as j, SelectionData as k, SelectionHidden as l, SelectionLimits as m, SelectionMerges as n, TextCmd as o, TextWrap as p };
|
package/dist/worker.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { bC as WorkbookReplayReply, bD as WorkbookEditPeer, bE as WorkbookReplayMethod, bF as WorkbookReplayOp } from './editPeer-DN6JDr8Z.js';
|
|
2
|
+
export { bG as CommandBasis, bH as CommandIdentity, bI as CommandStatus, J as OpenWorkbookSessionOptions, bJ as WorkbookAck, a5 as WorkbookCellGeometry, a6 as WorkbookCellInputs, bK as WorkbookCommand, bL as WorkbookCommandContext, bM as WorkbookCommandFrame, bN as WorkbookCommandFrameRequest, bO as WorkbookCommandKind, bP as WorkbookCommandPayload, bQ as WorkbookCommandSelection, bR as WorkbookCommandTicket, bS as WorkbookEchoHooks, bT as WorkbookEditConnection, bU as WorkbookEditFrame, bV as WorkbookEditPayload, a7 as WorkbookEditPeerFailedError, bW as WorkbookEditPeerOptions, a8 as WorkbookEditSession, bX as WorkbookEditState, a9 as WorkbookFrame, aa as WorkbookFrameOptions, ad as WorkbookInitialPaint, ae as WorkbookInitialPaintRequest, af as WorkbookPeerHydrationError, ag as WorkbookPngUnavailableError, ah as WorkbookRecoveryReplayError, ai as WorkbookSession, aj as WorkbookSessionEvents, ak as WorkbookSessionMethods, al as WorkbookSessionOpenOptions, am as WorkbookSessionOpenReply, an as WorkbookSessionRecovery, ao as WorkbookSessionState, bY as WorkbookSharedAck, bZ as WorkbookSharedCommand, b_ as WorkbookSharedOutcome, b$ as WorkbookSharedWireAck, ap as WorkbookSheetSummary, aq as WorkbookSheetView, c0 as WorkbookSubmitOptions, c1 as WorkbookTicketOutcome, c2 as createWorkbookEditPeer, bp as createWorkbookEditSession, c3 as hydratePeer, by as openWorkbookSession, c4 as workbookSessionInternals, bB as workbookSessionRecovery } from './editPeer-DN6JDr8Z.js';
|
|
3
|
+
import './types-DdoEoFSX.js';
|
|
4
|
+
import './asyncReplica-DuZEFXjI.js';
|
|
5
|
+
|
|
6
|
+
/** @internal */
|
|
7
|
+
declare function localNowSerial(ms: number): number;
|
|
8
|
+
|
|
9
|
+
interface WorkbookEditPeerOperations {
|
|
10
|
+
fail(error: unknown): void;
|
|
11
|
+
whenAcknowledged(): Promise<void>;
|
|
12
|
+
applyQueuedOp(op: WorkbookReplayOp): WorkbookReplayReply['result'];
|
|
13
|
+
applyRecoveryOp(op: WorkbookReplayOp): WorkbookReplayReply['result'];
|
|
14
|
+
}
|
|
15
|
+
declare class WorkbookRecoveryRefusal extends Error {
|
|
16
|
+
readonly result: WorkbookReplayReply['result'];
|
|
17
|
+
constructor(result: WorkbookReplayReply['result']);
|
|
18
|
+
}
|
|
19
|
+
/** @internal */
|
|
20
|
+
declare function failWorkbookEditPeer(peer: WorkbookEditPeer, error: unknown): void;
|
|
21
|
+
declare function workbookEditPeerOperations(peer: WorkbookEditPeer): WorkbookEditPeerOperations;
|
|
22
|
+
/** @internal */
|
|
23
|
+
declare function createWorkbookRecoveryMutators(peer: WorkbookEditPeer): Pick<WorkbookEditPeer, WorkbookReplayMethod>;
|
|
24
|
+
|
|
25
|
+
export { WorkbookEditPeer, WorkbookRecoveryRefusal, WorkbookReplayOp, createWorkbookRecoveryMutators, failWorkbookEditPeer, localNowSerial, workbookEditPeerOperations };
|
package/dist/worker.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{j as WorkbookEditPeerFailedError,f as WorkbookRecoveryRefusal,b as WorkbookRecoveryReplayError,k as createWorkbookEditPeer,a as createWorkbookEditSession,i as createWorkbookRecoveryMutators,g as failWorkbookEditPeer,d as hydratePeer,e as openWorkbookSession,h as workbookEditPeerOperations,c as workbookSessionRecovery}from'./chunk-HJJEOLPD.js';export{P as WorkbookPeerHydrationError,F as WorkbookPngUnavailableError,ba as localNowSerial,L as workbookSessionInternals}from'./chunk-K7TMSGNA.js';import'./chunk-JGTBRHCP.js';import'./chunk-O2XFH626.js';
|