@docx-editor.dev/core 2.14.1 → 2.15.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.
- package/README.md +42 -0
- package/dist/automation.cjs +1 -1
- package/dist/automation.d.ts +6 -5
- package/dist/automation.js +1 -1
- package/dist/binding.cjs +1 -1
- package/dist/binding.d.ts +16 -10
- package/dist/binding.js +1 -1
- package/dist/chunk-24APKZAN.cjs +11 -0
- package/dist/chunk-2YH4MSHX.cjs +2 -0
- package/dist/chunk-5Y7AADI6.js +1 -0
- package/dist/chunk-AREFLNUP.js +11 -0
- package/dist/chunk-AS7YZNQE.cjs +2 -0
- package/dist/chunk-AVGCKH6A.cjs +20 -0
- package/dist/chunk-CDYVDQRI.cjs +5 -0
- package/dist/chunk-FGBADUSK.cjs +1 -0
- package/dist/chunk-HOEWFH5U.cjs +1 -0
- package/dist/chunk-KFELX7CN.js +2 -0
- package/dist/{chunk-OKEDGR65.js → chunk-KXPVOPR5.js} +1 -1
- package/dist/chunk-LGFKIF4M.cjs +1 -0
- package/dist/chunk-M52QXFKI.js +1 -0
- package/dist/chunk-MNUKSXRO.js +1 -0
- package/dist/chunk-PBOIGBDO.js +2 -0
- package/dist/chunk-PMHGONET.cjs +1 -0
- package/dist/chunk-PXKZUTHX.cjs +2 -0
- package/dist/chunk-Q4AB7E4O.cjs +1 -0
- package/dist/chunk-QJYH6AYD.js +1 -0
- package/dist/chunk-QRC37MWG.cjs +20 -0
- package/dist/chunk-RJSB6RJ7.js +20 -0
- package/dist/chunk-SB54HLFJ.js +20 -0
- package/dist/chunk-VP7SDFCM.js +1 -0
- package/dist/chunk-XCESLTJL.js +2 -0
- package/dist/{chunk-KIAP7PFQ.cjs → chunk-YL4Q5LZP.cjs} +1 -1
- package/dist/chunk-Z4527AXR.js +5 -0
- package/dist/collaboration/replication.cjs +1 -1
- package/dist/collaboration/replication.d.ts +4 -3
- package/dist/collaboration/replication.js +1 -1
- package/dist/collaboration.d.ts +4 -3
- package/dist/contracts/editor.d.ts +7 -7
- package/dist/contracts/interaction.d.ts +7 -7
- package/dist/contracts/modules.d.ts +8 -7
- package/dist/{custom-node-writes-DntmaAVW.d.ts → custom-node-writes-C9ArIlJh.d.ts} +2 -2
- package/dist/{editor-a6VvsfYU.d.ts → editor-sRxrFJd8.d.ts} +29 -21
- package/dist/editor.cjs +1 -1
- package/dist/editor.d.ts +27 -58
- package/dist/editor.js +1 -1
- package/dist/export.cjs +2 -0
- package/dist/export.d.ts +337 -0
- package/dist/export.js +2 -0
- package/dist/font-resolver-BYEHQGTw.d.ts +251 -0
- package/dist/headless-document-view-DELC4E5v.d.ts +134 -0
- package/dist/hf-references-DTrHkktY.d.ts +70 -0
- package/dist/{index-C5ZnSRkF.d.ts → index-C3Gvq4jN.d.ts} +55 -246
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +18 -16
- package/dist/index.js +1 -1
- package/dist/{shaped-measurer-CFPnXFs9.d.cts → layout-shaping-DoGR5cf8.d.ts} +86 -12
- package/dist/layout.cjs +1 -1
- package/dist/layout.d.ts +1106 -729
- package/dist/layout.js +1 -1
- package/dist/{note-properties-CDFiNXcD.d.ts → note-properties-DSe8igrz.d.ts} +2 -2
- package/dist/{omml-equation-BY49UOIF.d.ts → omml-equation-BpRmfDAf.d.ts} +1 -1
- package/dist/output.cjs +1 -1
- package/dist/output.d.ts +6 -6
- package/dist/output.js +1 -1
- package/dist/{protocol-gOY5GA8K.d.cts → protocol-DZzKxH5r.d.ts} +18 -12
- package/dist/{review-items-CCS1h93f.d.ts → review-items-DYRx187i.d.ts} +2 -2
- package/dist/{review-reads-BjZYeMd4.d.ts → review-reads-LbGUdNzn.d.ts} +22 -25
- package/dist/{revision-projection-BeXVrSSV.d.ts → revision-projection-DHRJH48u.d.ts} +1 -1
- package/dist/{semantic-cell-selection-BK91NCCG.d.ts → semantic-cell-selection-BXVWCBYm.d.ts} +4 -4
- package/dist/{semantic-interaction-BmQ7h2cq.d.ts → semantic-interaction-DZsDmPg5.d.ts} +1 -1
- package/dist/{semantic-paint-WJD2KeG1.d.ts → semantic-paint-f7SqN4oW.d.ts} +2 -2
- package/dist/{semantic-records-BpozY7-j.d.cts → semantic-records-EIdwId-a.d.ts} +301 -205
- package/dist/store.cjs +1 -1
- package/dist/store.d.ts +15 -65
- package/dist/store.js +1 -1
- package/dist/{tree-op-types-D6HzlPR4.d.ts → tree-op-types-egdarvH_.d.ts} +7 -3
- package/dist/{tree-package-fragment-CWFjgH6a.d.ts → tree-package-fragment-DjkH4ESI.d.ts} +4 -70
- package/dist/{tree-session-contract-B2HfGt79.d.ts → tree-session-contract-CGOOgPjW.d.ts} +29 -23
- package/dist/{tree-store-APgWx6qn.d.ts → tree-store-DKJB0IcA.d.ts} +2 -2
- package/package.json +7 -2
- package/dist/automation.d.cts +0 -82
- package/dist/binding.d.cts +0 -153
- package/dist/chunk-2PIHW2QM.cjs +0 -1
- package/dist/chunk-2QTY5S6T.js +0 -1
- package/dist/chunk-4Z5MODAE.cjs +0 -2
- package/dist/chunk-5TKAPFZT.cjs +0 -2
- package/dist/chunk-DRQHIQ4R.cjs +0 -1
- package/dist/chunk-F2K6SDHA.cjs +0 -20
- package/dist/chunk-FBA57EUJ.js +0 -2
- package/dist/chunk-KTAQ7BRQ.js +0 -20
- package/dist/chunk-LBAHXZCU.cjs +0 -5
- package/dist/chunk-MCDUQYWP.js +0 -5
- package/dist/chunk-MQP26KCF.js +0 -1
- package/dist/chunk-NDJGSR6M.cjs +0 -19
- package/dist/chunk-NJNFJPGB.cjs +0 -11
- package/dist/chunk-O5M4CR4P.cjs +0 -2
- package/dist/chunk-UKUOZXUD.js +0 -19
- package/dist/chunk-VQ4R5LTU.js +0 -2
- package/dist/chunk-ZBEJHJN2.js +0 -11
- package/dist/chunk-ZVTW7RGD.js +0 -2
- package/dist/collaboration/replication.d.cts +0 -216
- package/dist/collaboration.d.cts +0 -176
- package/dist/contracts/document.d.cts +0 -273
- package/dist/contracts/editor.d.cts +0 -10
- package/dist/contracts/interaction.d.cts +0 -10
- package/dist/contracts/modules.d.cts +0 -130
- package/dist/contracts/types.d.cts +0 -562
- package/dist/custom-node-writes-C46r3_5O.d.cts +0 -310
- package/dist/document-properties-D6Ahr8D6.d.cts +0 -28
- package/dist/document-properties-D6Ahr8D6.d.ts +0 -28
- package/dist/editor-AJ06hyyg.d.cts +0 -1994
- package/dist/editor.d.cts +0 -393
- package/dist/failure-BnGjoXf0.d.cts +0 -64
- package/dist/index-Cbw4lkOt.d.cts +0 -3391
- package/dist/index.d.cts +0 -23
- package/dist/layout.d.cts +0 -2486
- package/dist/note-properties-Y6qYh2Hv.d.cts +0 -67
- package/dist/omml-equation-DB8d-jCq.d.cts +0 -84
- package/dist/output.d.cts +0 -74
- package/dist/protocol-BsmQgblT.d.ts +0 -1358
- package/dist/review-items-CaAkgi5s.d.cts +0 -360
- package/dist/review-reads-DEsV0OOW.d.cts +0 -163
- package/dist/revision-projection-DXbrfNGD.d.cts +0 -156
- package/dist/semantic-cell-selection-BMhku3B1.d.cts +0 -451
- package/dist/semantic-interaction-DUAnxbgf.d.cts +0 -160
- package/dist/semantic-paint-DufNL1Zr.d.cts +0 -247
- package/dist/semantic-records-92UnKeU_.d.ts +0 -2821
- package/dist/shaped-measurer-BWbindlI.d.ts +0 -168
- package/dist/store.d.cts +0 -2500
- package/dist/tree-op-types-BUulYD5y.d.cts +0 -3099
- package/dist/tree-package-fragment-Dhyw7oPm.d.cts +0 -732
- package/dist/tree-session-contract-BY9xd7s_.d.cts +0 -613
- package/dist/tree-store-DEEQ9wz_.d.cts +0 -416
package/dist/chunk-ZVTW7RGD.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {q as q$1,p as p$1,m,r,n,t,s,l,u,v as v$1,o,x,d as d$1,y,e,A as A$1,k as k$1,f as f$1,w as w$1,z,a,b,g,c as c$1,h,i as i$1,j as j$1}from'./chunk-FBA57EUJ.js';import {c,d,p,f,k,j,i,Je,ch,Pe,ze as ze$1,ca,Zb,Ka,_b,N,x as x$1,Na,w,ma}from'./chunk-ZBEJHJN2.js';var on=["extension","capability","command","query","schema","dependencyKey","runtimePort","result","origin"],an=/^[a-z0-9]+(?:-[a-z0-9]+)*(?:\.[a-z0-9]+(?:-[a-z0-9]+)*)+$/,sn=/^@[a-z0-9.-]+\/[a-z0-9.-]+(?:#[a-z0-9]+(?:[/._-][a-z0-9]+)*)?$/;function Ft(e){return an.test(e)||sn.test(e)}function re(e,t){if(!Ft(e))throw new Error(`invalid ${t??"registry"} id ${JSON.stringify(e)}: must be reverse-domain (dev.docx-editor.core.x) or package-owned (@scope/pkg#kind/name)`)}var ln=/^(\d+)\.(\d+)\.(\d+)$/;function $(e){let t=ln.exec(e);if(!t)throw new Error(`invalid semantic version: ${JSON.stringify(e)}`);return {major:Number(t[1]),minor:Number(t[2]),patch:Number(t[3])}}function oe(e,t){return e.major!==t.major?e.major<t.major?-1:1:e.minor!==t.minor?e.minor<t.minor?-1:1:e.patch!==t.patch?e.patch<t.patch?-1:1:0}function ie(e,t){let n=$(e),r=t.trim();if(r==="*")return true;if(r.startsWith("^")){let o=$(r.slice(1));return oe(n,o)<0?false:o.major>0?n.major===o.major:o.minor>0?n.major===0&&n.minor===o.minor:n.major===0&&n.minor===0}if(r.includes(" ")){let o=r.split(/\s+/);if(o.length!==2)throw new Error(`unsupported version range: ${JSON.stringify(t)}`);let p=true;for(let i of o){let s=i.startsWith(">=")?">=":i.startsWith("<")?"<":null;if(!s)throw new Error(`unsupported version range: ${JSON.stringify(t)}`);let d=$(i.slice(s.length)),l=oe(n,d);s===">="?p=p&&l>=0:p=p&&l<0;}return p}return oe(n,$(r))===0}var v=class extends Error{constructor(n,r,o=[]){super(r);this.code=n;this.responsible=o;this.name="RegistryError";}code;responsible},Ae=(e,t)=>`${e}:${t}`;function dn(e,t={}){let n=new Map;for(let l of e){if(re(l.id,"extension"),Bt(l.version,l.id),n.has(l.id))throw new v("duplicate-extension",`duplicate extension id ${l.id}`,[l.id]);n.set(l.id,l);for(let c of l.contributions)re(c.id,c.kind),Bt(c.version,`${l.id} \u2192 ${c.id}`),c.replaces&&mn(c.replaces.targetRange,`${l.id} \u2192 replaces ${c.replaces.targetId}`);}for(let l of e){for(let c of l.dependencies??[])if(!n.has(c))throw new v("missing-dependency",`${l.id} requires missing extension ${c}`,[l.id,c]);for(let c of l.conflicts??[])if(n.has(c)){let g=[l.id,c].sort();throw new v("conflict",`extensions ${g[0]} and ${g[1]} conflict`,g)}}pn(n);let r=new Set(t.availablePorts??[]);for(let l of e)for(let c of l.contributions)c.kind==="runtimePort"&&r.add(c.id);for(let l of e)for(let c of l.requiredPorts??[])if(!r.has(c))throw new v("missing-port",`${l.id} requires unavailable port ${c}`,[l.id,c]);let o=new Map,p=new Map,i=new Map;for(let l of e)for(let c of l.contributions){let g=Ae(c.kind,c.id);if(c.replaces){let x=Ae(c.kind,c.replaces.targetId),R=i.get(x)??[];R.push({ext:l.id,c}),i.set(x,R);continue}if(p.has(g)){let x=[o.get(g),l.id].sort();throw new v("id-collision",`${c.kind} id ${c.id} registered by both ${x[0]} and ${x[1]}`,x)}p.set(g,c),o.set(g,l.id);}let s=new Map(p);for(let[l,c]of i){let g=p.get(l);if(!g){let O=c[0];throw new v("replacement-target-missing",`${O.ext} replaces missing target ${O.c.replaces.targetId}`,[O.ext,O.c.replaces.targetId])}let x=g.replaceable??{kind:"none"};for(let{ext:O,c:b}of c){if(!ie(g.version,b.replaces.targetRange))throw new v("replacement-version-mismatch",`${O} replaces ${b.replaces.targetId}@${g.version} outside range ${b.replaces.targetRange}`,[O,b.replaces.targetId]);if(x.kind==="none")throw new v("unauthorized-replacement",`${b.replaces.targetId} does not authorize replacement (attempted by ${O})`,[O,b.replaces.targetId])}let R=cn(g,c);s.set(l,R);}return {extensions:n,contributions:s,get:(l,c)=>s.get(Ae(l,c))}}function cn(e,t){let n=e.replaceable??{kind:"none"};if(t.length===1)return t[0].c;if(n.kind==="priority"){let o=[...t].sort((s,d)=>(d.c.replaces.priority??0)-(s.c.replaces.priority??0)),p=o[0].c.replaces.priority??0,i=o.filter(s=>(s.c.replaces.priority??0)===p);if(i.length>1){let s=i.map(d=>d.ext).sort();throw new v("ambiguous-replacement",`multiple replacers of ${e.id} share top priority ${p}: ${s.join(", ")}`,s)}return o[0].c}let r=t.map(o=>o.ext).sort();throw new v("ambiguous-replacement",`multiple replacers of ${e.id}: ${r.join(", ")}`,r)}function pn(e){let o=new Map,p=[],i=s=>{o.set(s,1),p.push(s);let d=[...e.get(s)?.dependencies??[]].sort();for(let l of d){let c=o.get(l)??0;if(c===1){let g=p.indexOf(l),x=[...p.slice(g),l];throw new v("dependency-cycle",`dependency cycle: ${x.join(" -> ")}`,x)}c===0&&i(l);}p.pop(),o.set(s,2);};for(let s of [...e.keys()].sort())(o.get(s)??0)===0&&i(s);}function Bt(e,t){try{$(e);}catch{throw new v("invalid-version",`invalid version ${JSON.stringify(e)} in ${t}`,[t])}}function mn(e,t){try{ie("0.0.0",e);}catch{throw new v("invalid-version",`invalid version range ${JSON.stringify(e)} in ${t}`,[t])}}var A=class extends Error{constructor(t){super(t),this.name="BudgetError";}},W=class e{constructor(t,n){this.label=t;this.capacity=n;this.used=new p(`${t}.budget`,n);}label;capacity;used;children=new Set;activeReservations=0;cleanups=[];disposed=false;carveAmount=0;parent;get inUse(){return this.used.current}get available(){return this.used.remaining}get isDisposed(){return this.disposed}reserve(t){this.assertLive(),this.used.add(t),this.activeReservations+=1;let n=false,r=this;return {amount:t,get released(){return n},release(){n||(n=true,r.used.release(t),r.activeReservations-=1);}}}child(t,n){this.assertLive(),this.used.add(n);let r=new e(t,n);return r.parent=this,r.carveAmount=n,this.children.add(r),r}onRelease(t){this.assertLive(),this.cleanups.push(t);}dispose(){if(this.disposed)return;if(this.children.size>0)throw new A(`${this.label}: cannot release with ${this.children.size} child budget(s) outstanding`);if(this.activeReservations>0)throw new A(`${this.label}: cannot release with ${this.activeReservations} reservation(s) outstanding`);let t=[];for(let n=this.cleanups.length-1;n>=0;n--)try{this.cleanups[n]();}catch(r){t.push(r);}if(this.disposed=true,this.parent&&(this.parent.children.delete(this),this.parent.used.release(this.carveAmount),this.parent=void 0),t.length>0)throw new A(`${this.label}: ${t.length} cleanup error(s); first: ${String(t[0])}`)}assertLive(){if(this.disposed)throw new A(`${this.label}: budget already released`)}};var ae=class extends Error{constructor(n,r){super(r?`cancelled: ${r}`:"cancelled");this.derivedOnly=n;this.name="CancellationError";}derivedOnly},K=class{_cancelled=false;_phase="pre-publication";_reason;cancel(t){this._cancelled=true,t!==void 0&&(this._reason=t);}markPublished(){this._phase="post-publication";}get isCancelled(){return this._cancelled}get phase(){return this._phase}get isPublished(){return this._phase==="post-publication"}get derivedOnly(){return this._cancelled&&this._phase==="post-publication"}get token(){let t=this;return {get isCancelled(){return t._cancelled},get phase(){return t._phase},get derivedOnly(){return t.derivedOnly},checkpoint(){if(t._cancelled)throw new ae(t.derivedOnly,t._reason)}}}};var se=class extends Error{constructor(n){super(`runtime port not available: ${n}`);this.portId=n;this.name="PortResolutionError";}portId},_e=class{ports=new Map;provide(t,n){return this.ports.set(t,n),this}has(t){return this.ports.has(t)}resolve(t){if(!this.ports.has(t))throw new se(t);return this.ports.get(t)}missing(t){return t.filter(n=>!this.ports.has(n))}availablePorts(){return [...this.ports.keys()]}clock(){return this.resolve(f.clock)}identity(){return this.resolve(f.identity)}},Me=class{constructor(t=0,n=1){this.step=n;this.t=t;}step;t;now(){let t=this.t;return this.t+=this.step,t}},Le=class{constructor(t="id"){this.prefix=t;}prefix;n=0;newId(){return this.n+=1,`${this.prefix}-${this.n}`}};function un(e){let t=k(e.limits),n=Object.freeze({...e.config??{}}),r=e.capacity??t.maxDecompressedBytes,o=e.id??"op",p={id:o,limits:t,config:n,ports:e.ports,budget:new W(`op:${o}`,r),cancellation:new K};return Object.freeze(p)}function fn(e){e.budget.dispose();}var Fe=Object.freeze({maxRecursionDepth:{unit:"depth",phase:"xml-parse"},maxElementCount:{unit:"count",phase:"xml-parse"},maxPartCount:{unit:"count",phase:"package-read"},maxDecompressedBytes:{unit:"bytes",phase:"package-read"},maxCompressedBytes:{unit:"bytes",phase:"package-read"},maxCompressionRatio:{unit:"ratio",phase:"package-read"},maxChunkBytes:{unit:"bytes",phase:"package-read"},maxPaginationPasses:{unit:"passes",phase:"layout"},maxQueueDepth:{unit:"count",phase:"output"}}),Vt=Object.keys(Fe);function yn(e,t){return new p(`${Fe[t].phase}:${t}`,e[t])}var De=class{counter;current=0;peak=0;constructor(t){this.counter=new p("memory",t);}allocate(t){this.counter.add(t),this.current+=t,this.current>this.peak&&(this.peak=this.current);}free(t){this.counter.release(t),this.current=Math.max(0,this.current-t);}get currentBytes(){return this.current}get peakBytes(){return this.peak}reset(){this.counter.release(this.current),this.current=0;}};function hn(){for(let e of Vt){let t=j[e],n=i[e];if(!Number.isFinite(t)||t<=0)throw new Error(`default ${e} must be finite > 0`);if(!Number.isFinite(n)||n<=0)throw new Error(`ceiling ${e} must be finite > 0`);if(t>n)throw new Error(`default ${e} exceeds ceiling`)}}function G(e,t=new Set){let n=new WeakSet,r=o=>{if(o===null)return "null";let p=typeof o;if(p==="boolean")return o?"true":"false";if(p==="number"){let i=o;if(!Number.isFinite(i))throw new Error(`non-finite number is not comparable: ${i}`);return Object.is(i,-0)?"0":String(i)}if(p==="string")return JSON.stringify(o);if(p==="bigint")return `${o.toString()}n`;if(Array.isArray(o))return `[${o.map(r).join(",")}]`;if(p==="object"){let i=o;if(n.has(i))throw new Error("cannot canonicalize a cyclic structure");n.add(i);let d=Object.keys(i).filter(l=>!t.has(l)).sort().map(l=>`${JSON.stringify(l)}:${r(i[l])}`).join(",");return n.delete(i),`{${d}}`}throw new Error(`unsupported value type in comparator input: ${p}`)};return r(e)}function Be(e,t){let n=G(e,t),r=0xcbf29ce484222325n,o=0x100000001b3n,p=0xffffffffffffffffn;for(let i=0;i<n.length;i++)r^=BigInt(n.charCodeAt(i)),r=r*o&p;return r.toString(16).padStart(16,"0")}var C="dev.docx-editor.core.comparator",Ve={authoredState:{id:`${C}.authored-state`,mode:"canonical-exact",ephemera:["revision","provenance","producedAt","commitId"],note:"canonical normalized authored records; ephemera excluded"},anchor:{id:`${C}.anchor`,mode:"exact",ephemera:[],note:"internal anchor identity/affinity compares exactly"},yjsStateVector:{id:`${C}.yjs-state-vector`,mode:"sync-optimization-only",ephemera:[],note:"exchange optimization only; never proves update or delete-set coverage"},shapedRun:{id:`${C}.shaped-run`,mode:"exact",ephemera:[],note:"glyph ids, clusters, and fixed-point advances compare exactly"},paginationFingerprint:{id:`${C}.pagination-fingerprint`,mode:"exact",ephemera:[],note:"page/column boundaries, break causes, fixed-point geometry compare exactly"},semanticTree:{id:`${C}.semantic-tree`,mode:"exact",ephemera:[],note:"reading order, roles, headings, alt text compare exactly"},hitTest:{id:`${C}.hit-test`,mode:"exact",ephemera:[],note:"resolved hit target and cluster affinity compare exactly"},pdfSemantics:{id:`${C}.pdf-semantics`,mode:"canonical-exact",ephemera:["objectNumber","producer","creationDate","modDate","subsetTag"],note:"canonical semantic PDF objects; container ephemera excluded"},rasterCheckpoint:{id:`${C}.raster-checkpoint`,mode:"tolerance",ephemera:[],note:"documented unavoidable raster comparison; explicit tolerance only"},benchmarkEvidence:{id:`${C}.benchmark-evidence`,mode:"sync-optimization-only",ephemera:[],note:"diagnostic evidence, not an equivalence basis"}};function ze(e,t,n,r={}){let o=Ve[e];switch(o.mode){case "sync-optimization-only":throw new Error(`${o.id} is not an equivalence basis (${o.note})`);case "tolerance":{if(r.epsilon===void 0)throw new Error(`${o.id} requires an explicit epsilon`);return {equal:zt(t,n,r.epsilon)}}case "exact":case "canonical-exact":{let p=o.mode==="canonical-exact"?new Set(o.ephemera):new Set,i=G(t,p),s=G(n,p);return i===s?{equal:true}:{equal:false,left:i,right:s}}}}function Ue(e,t){let n=Ve[e];if(n.mode==="tolerance"||n.mode==="sync-optimization-only")throw new Error(`${n.id} has no canonical fingerprint (${n.mode})`);let r=n.mode==="canonical-exact"?new Set(n.ephemera):void 0;return Be(t,r)}function zt(e,t,n){return typeof e=="number"&&typeof t=="number"?Number.isFinite(e)&&Number.isFinite(t)&&Math.abs(e-t)<=n:Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((r,o)=>zt(r,t[o],n)):false}var Ht=new Set([...c,...d]),Ut=/^[0-9a-f]{16}$/,gn=/^[0-9a-f]*$/;function He(e){let t=[],n=o=>t.push(o);e.formatVersion!==1&&n(`unsupported formatVersion ${e.formatVersion}`),e.documentId||n("documentId is required"),e.source.kind==="docx"&&!/^[0-9a-f]{64}$/.test(e.source.sha256)&&n("docx source requires a 64-hex sha256");let r=-1;e.steps.forEach((o,p)=>{let i=`step[${p}]`;Ht.has(o.origin)||n(`${i}: unknown origin ${o.origin}`),(!Number.isInteger(o.baseRevision)||o.baseRevision<0)&&n(`${i}: baseRevision must be a non-negative integer`),o.baseRevision<r&&n(`${i}: baseRevision regressed below ${r}`);let s=o.expect;s.outcome==="applied"?(s.committedRevision===void 0?n(`${i}: applied step needs committedRevision`):s.committedRevision<=o.baseRevision?n(`${i}: committedRevision ${s.committedRevision} must exceed baseRevision ${o.baseRevision}`):r=s.committedRevision,s.modelChange&&xn(s.modelChange,i,n)):(s.committedRevision!==void 0&&n(`${i}: ${s.outcome} step must not commit a revision`),s.authoredStateHash!==void 0&&n(`${i}: ${s.outcome} step must not change authored state`)),s.authoredStateHash!==void 0&&!Ut.test(s.authoredStateHash)&&n(`${i}: authoredStateHash must be 16-hex`),s.outputHash!==void 0&&!Ut.test(s.outputHash)&&n(`${i}: outputHash must be 16-hex`);});for(let o of [...e.snapshots??[],...e.updates??[]])o.documentId!==e.documentId&&n(`envelope documentId ${o.documentId} != ${e.documentId}`),gn.test(o.bytesHex)||n("envelope bytesHex must be hex"),o.bytesHex.length!==o.byteLength*2&&n(`envelope byteLength ${o.byteLength} disagrees with ${o.bytesHex.length/2} decoded bytes`);return {valid:t.length===0,errors:t}}function xn(e,t,n){Ht.has(e.origin)||n(`${t}: modelChange origin ${e.origin} unknown`),e.toRevision<=e.fromRevision&&n(`${t}: modelChange revision must advance`);}function Rn(e,t){let n=He(e);if(!n.valid)return {ok:false,mismatches:n.errors};let r=[];return t.init(e),e.steps.forEach((o,p)=>{let i=`step[${p}]`,s=t.applyStep(o),d=o.expect;if(s.outcome!==d.outcome){r.push(`${i}: outcome ${s.outcome} != expected ${d.outcome}`);return}if(d.outcome==="applied"&&(s.committedRevision!==d.committedRevision&&r.push(`${i}: revision ${s.committedRevision} != expected ${d.committedRevision}`),d.authoredStateHash!==void 0))if(s.authoredState===void 0)r.push(`${i}: store returned no authored state to hash`);else {ze("authoredState",s.authoredState,s.authoredState).equal||r.push(`${i}: authored state is not self-consistent`);let c=jt(s.authoredState);c!==d.authoredStateHash&&r.push(`${i}: authoredStateHash ${c} != expected ${d.authoredStateHash}`);}}),{ok:r.length===0,mismatches:r}}function jt(e){return Ue("authoredState",e)}function le(e,t){return {...e,children:t}}function de(e,t){return e.kind!=="textValue"&&e.localName===t&&e.namespaceUri===ca}function q(e,t=[]){if(e.kind==="textValue")return t;e.kind==="paragraph"&&t.push(e.id);for(let n of e.children)q(n,t);return t}function Wt(e,t){if(e.kind==="textValue")return null;if(e.kind==="paragraph"&&e.id===t)return e;for(let n of e.children){let r=Wt(n,t);if(r)return r}return null}function On(e){let t=(n,r)=>{if(n.kind==="textValue")return n;if(r&&de(n,"vMerge")){if(ze$1(n,"val")==="restart")return n;let p=[...n.attributes.filter(i=>!(i.localName==="val"&&i.namespaceUri===ca)),{kind:"wmlVal",namespaceUri:ca,localName:"val",prefix:"w",value:"restart"}];return {...n,attributes:p}}if(n.kind==="paragraph"||n.kind==="table")return n;let o=r||de(n,"tc");return le(n,n.children.map(p=>t(p,o)))};return le(e,e.children.map(n=>t(n,false)))}function Kt(e,t){if(!(e.kind==="textValue"||e.kind==="table")){if(de(e,"tr")){t.push(e);return}for(let n of e.children)Kt(n,t);}}function Gt(e,t,n){if(e.kind==="textValue"||e.kind==="table")return {node:e,hadRows:false,keptRows:false};if(de(e,"tr")){if(!t.has(e))return {node:null,hadRows:true,keptRows:false};let i=n.value?On(e):e;return n.value=false,{node:i,hadRows:true,keptRows:true}}let r=false,o=false,p=[];for(let i of e.children){let s=Gt(i,t,n);r||=s.hadRows,o||=s.keptRows,s.node!==null&&p.push(s.node);}return r?{node:o?le(e,p):null,hadRows:true,keptRows:o}:{node:e,hadRows:false,keptRows:false}}function qt(e,t,n){let r=[];for(let d of e.children)Kt(d,r);let o=new Set(q(e).filter(d=>t.inRange.has(d)));if(o.size===0)return;let p=r.filter(d=>{let l=q(d);return l.length>0&&l.every(c=>t.covered.has(c))}),i=new Set(p.flatMap(d=>q(d)));if(p.length>0&&o.size===i.size&&[...o].every(d=>i.has(d))){let d={value:true},l=new Set(p),c=[];for(let g of e.children){let x=Gt(g,l,d);x.node!==null&&c.push(x.node);}n.push(le(e,c));return}for(let d of q(e)){if(!t.inRange.has(d))continue;let l=Wt(e,d);l&&n.push(l);}}var vn="http://schemas.openxmlformats.org/package/2006/content-types",bn=5e4;function P(e){return e.kind!=="textValue"}function Yt(e,t=[]){if(e.kind==="textValue")return t;e.kind==="paragraph"&&t.push(e.id);for(let n of e.children)Yt(n,t);return t}function je(e,t){if(e.kind==="textValue")return null;if(e.kind==="paragraph"&&e.id===t)return e;for(let n of e.children){let r=je(n,t);if(r)return r}return null}function S(e,t){return {...e,children:t}}function wn(e,t){return e.kind!=="textValue"&&e.localName===t&&e.namespaceUri===ca}function Cn(e){if(e.root.kind==="document"){let t=e.root.children.find(n=>n.kind==="body");return t&&P(t)?t:null}return P(e.root)?e.root:null}function kn(e,t){return Yt(e).some(n=>t.has(n))}function We(e,t,n){for(let r of e)if(P(r)){if(r.kind==="paragraph"){t.inRange.has(r.id)&&n.push(r);continue}if(t.fullBlocks.has(r.id)){n.push(r);continue}if(r.kind==="table"){qt(r,t,n);continue}if(r.kind==="contentControl"){let o=r.children.find(p=>p.kind==="contentControlContent");o&&P(o)&&We(o.children,t,n);continue}kn(r,t.inRange)&&We(r.children,t,n);}}var En=new Set(["commentRangeStart","commentRangeEnd"]);function In(e){return e.kind==="run"&&e.children.some(t=>t.kind==="commentReference")}function Ke(e){if(e.kind==="textValue")return e;if(En.has(e.localName)&&e.namespaceUri===ca||In(e)||wn(e,"sectPr"))return null;let t=false,n=[];for(let r of e.children){let o=Ke(r);if(o===null){t=true;continue}o!==r&&(t=true),n.push(o);}return t?S(e,n):e}function Sn(e){let t=[],n=d=>{if(d.kind!=="textValue"){if(d.kind==="run"){for(let l of d.children)if(l.kind==="fldChar"){let c=ze$1(l,"fldCharType");t.push({nodeId:l.id,type:c==="separate"||c==="end"?c:"begin"});}else l.kind==="instrText"&&t.push({nodeId:l.id,type:"instr"});return}for(let l of d.children)n(l);}};for(let d of e)n(d);if(t.length===0)return e;let r=new Set,o=[],p=null,i=[];for(let d of t){if(d.type==="begin"){o.push({beginId:d.nodeId,separateId:null,instrIds:[]});continue}if(d.type==="separate"){let c=o[o.length-1];c?c.separateId=d.nodeId:p=d.nodeId;continue}if(d.type==="instr"){let c=o[o.length-1];c?c.instrIds.push(d.nodeId):p===null&&i.push(d.nodeId);continue}if(!o.pop()){r.add(d.nodeId),p!==null&&r.add(p);for(let c of i)r.add(c);p=null,i=[];}}for(let d of o){r.add(d.beginId),d.separateId!==null&&r.add(d.separateId);for(let l of d.instrIds)r.add(l);}p!==null&&r.add(p);for(let d of i)r.add(d);if(r.size===0)return e;let s=d=>{if(d.kind==="textValue")return d;if(r.has(d.id))return null;let l=[],c=false;for(let g of d.children){let x=s(g);if(x===null){c=true;continue}x!==g&&(c=true),l.push(x);}return c?S(d,l):d};return e.map(d=>s(d)).filter(d=>d!==null)}function Ge(e){if(e.kind==="textValue")return e.value.length;let t=0;for(let n of e.children)t+=Ge(n);return t}function Pn(e,t){let n=[];for(let r of e.children){if(r.kind!=="contentControl"){n.push(r);continue}let o=t.get(r.id),p=Ge(r);if(o===void 0||p>=o){n.push(r);continue}if(p===0)continue;let i=r.children.find(s=>s.kind==="contentControlContent");i&&P(i)?n.push(...i.children):n.push(r);}return S(e,n)}function Nn(e){let t=new Set,n=new Set,r=i=>{if(i.kind!=="textValue"){if(i.kind==="bookmarkStart"){let s=ze$1(i,"id");s!==void 0&&t.add(s);}if(i.kind==="bookmarkEnd"){let s=ze$1(i,"id");s!==void 0&&n.add(s);}for(let s of i.children)r(s);}};for(let i of e)r(i);let o=new Set([...t].filter(i=>n.has(i)));if(o.size===t.size&&o.size===n.size)return e;let p=i=>{if(i.kind==="textValue")return i;if(i.kind==="bookmarkStart"||i.kind==="bookmarkEnd"){let l=ze$1(i,"id");return l!==void 0&&o.has(l)?i:null}let s=[],d=false;for(let l of i.children){let c=p(l);if(c===null){d=true;continue}c!==l&&(d=true),s.push(c);}return d?S(i,s):i};return e.map(i=>p(i)??i)}function Tn(e$1,t$1,n$1){let r$1=e$1.parts.get(t$1.partName);if(!r$1)return {ok:false,reason:"unknown-part"};if(t$1.paragraphIds.length===0)return {ok:false,reason:"empty-range"};let o$1=t$1.paragraphIds[0],p=t$1.paragraphIds[t$1.paragraphIds.length-1],i=new Map;for(let a of [o$1,p]){let m=je(r$1.root,a);if(!m)return {ok:false,reason:"empty-range"};for(let u of m.children)u.kind==="contentControl"&&i.set(u.id,Ge(u));}let s$1=r$1,d=je(s$1.root,p);if(!d)return {ok:false,reason:"empty-range"};let l$1=Je(d);if(t$1.endOffset<l$1){let a=ch(s$1,{op:"deleteText",paragraphId:p,start:t$1.endOffset,end:l$1},{deferValidation:true});if(!a.ok)return {ok:false,reason:"trim-refused"};s$1=a.part;}if(t$1.startOffset>0){let a=ch(s$1,{op:"deleteText",paragraphId:o$1,start:0,end:t$1.startOffset},{deferValidation:true});if(!a.ok)return {ok:false,reason:"trim-refused"};s$1=a.part;}let c=Cn(s$1);if(!c)return {ok:false,reason:"unknown-part"};let g$1={inRange:new Set(t$1.paragraphIds),covered:new Set(t$1.coveredParagraphIds),fullBlocks:new Set(t$1.fullyCoveredBlockIds)},x$2=[];if(We(c.children,g$1,x$2),x$2.length===0)return {ok:false,reason:"empty-range"};if(x$2.length>bn)return {ok:false,reason:"resource-limit"};let R=x$2.map(a=>Ke(a)).filter(a=>a!==null).map(a=>a.kind!=="paragraph"||a.id!==o$1&&a.id!==p?a:Pn(a,i));R=[...Sn(R)],R=[...Nn(R)];let O=Pe(e$1,"footnote"),b$1=Pe(e$1,"endnote"),qe=(a,m)=>P(a)&&a.namespaceUri===ca&&a.localName===m,Ye=q$1(R,(a,m)=>{let u=a==="footnote"?O:b$1;if(!u||!P(u.root))return null;for(let f of u.root.children){if(!qe(f,a))continue;let y=ze$1(f,"id");if(y!==void 0&&p$1(y)===m)return f}return null}),Je$1=Ye.footnote,Xe=Ye.endnote;Je$1.size===0&&(O=null),Xe.size===0&&(b$1=null);let Qe=(a,m,u)=>{if(!a||!P(a.root))return [];let f=[];for(let y of a.root.children){if(!qe(y,m))continue;let h=ze$1(y,"id"),U=ze$1(y,"type");if(U==="separator"||U==="continuationSeparator"){f.push(y);continue}if(h!==void 0&&u.has(p$1(h))){let xe=Ke(y);xe&&P(xe)&&f.push(xe);}}return f},Ze=Qe(O,"footnote",Je$1),et=Qe(b$1,"endnote",Xe),Jt=[...Ze,...et],tt=[...R,...Jt],_=new Set;m(tt,_);let B=r(e$1,e$1.mainDocumentPart),M=new Set;n(tt,M);let ce=[],k=t(e$1,e$1.mainDocumentPart,M);for(;;){let a=_.size,m$1=M.size;ce=s(B,_),n(ce,M),k=t(e$1,e$1.mainDocumentPart,M);let u=[...k.nums,...k.abstracts];m(u,_);for(let f of u)l(f,y=>{if(y.kind!=="textValue"&&(y.localName==="styleLink"||y.localName==="numStyleLink")&&y.namespaceUri===ca){let h=ze$1(y,"val");h&&_.add(h);}});if(_.size===a&&M.size===m$1)break}let L=u(e$1,e$1.mainDocumentPart),nt=ce.map(a=>v$1(a,L)),pe=B.docDefaults?v$1(B.docDefaults,L):null;R=R.map(a=>v$1(a,L));let me=Ze.map(a=>v$1(a,L)),ue=et.map(a=>v$1(a,L)),rt=new Set;o(R,rt);let ot=Zb(e$1,r$1.name).filter(a=>rt.has(a.id)),it=new Map,at=0,st=a=>{let m=new Set;for(let u of a){if(u.targetMode==="External")continue;let f=w(u.ownerPart,u.rawTarget);if(!f.ok){m.add(u.id);continue}if((_b(e$1,f.partName)??"").toLowerCase().startsWith("image/")&&n$1?.omitMedia!==true){let h=e$1.partBytes.get(f.partName)??e$1.partBytes.get(f.partName.replace(/^\//,""));h?(it.set(f.partName,h),at+=h.byteLength):m.add(u.id);continue}m.add(u.id);}return m},fe=st(ot),ye=(a,m)=>{if(a.kind==="textValue")return a;if(a.kind==="drawing"){let y=new Set;o([a],y);for(let h of y)if(m.has(h))return null;return a}let u=[],f=false;for(let y of a.children){let h=ye(y,m);if(h===null){f=true;continue}h!==y&&(f=true),u.push(h);}return f?S(a,u):a};fe.size>0&&(R=R.map(a=>ye(a,fe)).filter(a=>a!==null));let Xt=ot.filter(a=>!fe.has(a.id)),lt=(a,m)=>{if(!a)return [];let u=new Set;o(m,u);let f=Zb(e$1,a.name).filter(h=>u.has(h.id)),y=st(f);if(y.size>0)for(let h=0;h<m.length;h+=1){let U=ye(m[h],y);U!==null&&(m[h]=U);}return f.filter(h=>!y.has(h.id))},Qt=lt(O,me),Zt=lt(b$1,ue),E=new Map,he=[],dt=new Map,V=(a,m,u)=>{let f=w$1(a,m,u);E.set(a.slice(1),Ka(ma(f))),he.push([a,m]),dt.set(a,f);},ge=(a,m)=>a.map(u=>{if(u.targetMode==="External")return {...u,ownerPart:m};let f=w(u.ownerPart,u.rawTarget);return {...u,ownerPart:m,rawTarget:f.ok?f.partName:u.rawTarget}}),z$1=ge(Xt,"/word/document.xml"),Y=ge(Qt,"/word/footnotes.xml"),J=ge(Zt,"/word/endnotes.xml"),ct=new Set(z$1.map(a=>a.id)),pt=9001,X=(a,m)=>{let u=z(ct,pt);pt+=1,ct.add(u),z$1.push({ownerPart:"/word/document.xml",id:u,type:a,rawTarget:m,targetMode:"Internal",order:z$1.length});},en=x(s$1,R);if(V("/word/document.xml",a,en),B.part&&(nt.length>0||pe)){let a=S(B.part.root,[...pe?[pe]:[],...nt]);V("/word/styles.xml",b,a),X(g,"styles.xml");}if(k.part&&(k.nums.length>0||k.abstracts.length>0)){let a=S(k.part.root,[...k.abstracts.map(m=>v$1(m,L)),...k.nums]);V("/word/numbering.xml",c$1,a),X(h,"numbering.xml");}O&&me.length>0&&(V("/word/footnotes.xml",d$1,S(O.root,me)),X(i$1,"footnotes.xml"),Y.length>0&&E.set("word/_rels/footnotes.xml.rels",Ka(y(Y)))),b$1&&ue.length>0&&(V("/word/endnotes.xml",e,S(b$1.root,ue)),X(j$1,"endnotes.xml"),J.length>0&&E.set("word/_rels/endnotes.xml.rels",Ka(y(J))));let Q=new Map;for(let[a,m]of it){E.set(a.slice(1),m);let u=A$1(a);u&&!Q.has(u)&&Q.set(u,_b(e$1,a)??"application/octet-stream");}let mt={ownerPart:"/",id:"rId1",type:k$1,rawTarget:"word/document.xml",targetMode:"Internal",order:0};E.set("word/_rels/document.xml.rels",Ka(y(z$1))),E.set("_rels/.rels",Ka(y([mt])));let tn=[`<Default Extension="rels" ContentType="${f$1}"/>`,'<Default Extension="xml" ContentType="application/xml"/>',...[...Q].map(([a,m])=>`<Default Extension="${N(a)}" ContentType="${N(m)}"/>`)].join(""),nn=he.map(([a,m])=>`<Override PartName="${N(a)}" ContentType="${N(m)}"/>`).join("");E.set("[Content_Types].xml",Ka(`<Types xmlns="${vn}">${tn}${nn}</Types>`));let D=new Map;D.set("/",[mt]),D.set("/word/document.xml",z$1),Y.length>0&&D.set("/word/footnotes.xml",Y),J.length>0&&D.set("/word/endnotes.xml",J);let ut=[];for(let a of D.values())for(let m of a)m.targetMode==="External"&&ut.push({ownerPart:m.ownerPart,id:m.id,type:m.type,rawTarget:m.rawTarget,sinkSafe:x$1(m.rawTarget).ok});let Z=new Map;Z.set("rels",f$1),Z.set("xml","application/xml");for(let[a,m]of Q)Z.set(a,m);let rn={defaults:Z,overrides:new Map(he)},ft=new Map;for(let[a,m]of E)ft.set(a.startsWith("/")?a:`/${a}`,m);return {ok:true,bytes:Na(E),package:Object.freeze({parts:dt,partBytes:ft,relationships:D,externalTargets:ut,contentTypes:rn,mainDocumentPart:"/word/document.xml"}),lastMarkCovered:t$1.lastMarkCovered,blockCount:R.length,mediaBytes:at}}
|
|
2
|
-
export{ze as A,Ue as B,He as C,Rn as D,jt as E,Tn as F,on as a,Ft as b,re as c,$ as d,oe as e,ie as f,v as g,dn as h,A as i,W as j,ae as k,K as l,se as m,_e as n,Me as o,Le as p,un as q,fn as r,Fe as s,Vt as t,yn as u,De as v,hn as w,G as x,Be as y,Ve as z};
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { T as TreeModelChange } from '../tree-store-DEEQ9wz_.cjs';
|
|
2
|
-
import { g as OoxmlElement, b as OoxmlPackage } from '../tree-op-types-BUulYD5y.cjs';
|
|
3
|
-
import { T as TreePackageStore } from '../tree-package-fragment-Dhyw7oPm.cjs';
|
|
4
|
-
import '../contracts/types.cjs';
|
|
5
|
-
|
|
6
|
-
/** Attribute name as the journal addresses it. Prefix is authored fidelity, not identity. @public */
|
|
7
|
-
interface CanonicalAttributeName {
|
|
8
|
-
readonly namespaceUri: string;
|
|
9
|
-
readonly localName: string;
|
|
10
|
-
readonly prefix?: string;
|
|
11
|
-
}
|
|
12
|
-
/** Content-addressed binary part reference. Bytes stay out of the journal. @public */
|
|
13
|
-
interface CanonicalBinaryDescriptor {
|
|
14
|
-
readonly storageKey: string;
|
|
15
|
-
readonly digest: string;
|
|
16
|
-
readonly size: number;
|
|
17
|
-
readonly mediaType: string;
|
|
18
|
-
}
|
|
19
|
-
/** Text node shell. Value arrives later through `spliceText`. @public */
|
|
20
|
-
interface CanonicalTextNodeDescriptor {
|
|
21
|
-
readonly logicalId: string;
|
|
22
|
-
readonly kind: 'textValue';
|
|
23
|
-
}
|
|
24
|
-
/** OOXML element shell. Attributes, bindings, and children arrive as later effects. @public */
|
|
25
|
-
interface CanonicalElementNodeDescriptor {
|
|
26
|
-
readonly logicalId: string;
|
|
27
|
-
readonly kind: OoxmlElement['kind'];
|
|
28
|
-
readonly qname: CanonicalAttributeName;
|
|
29
|
-
}
|
|
30
|
-
/** Immutable node record required to create a registry entry. @public */
|
|
31
|
-
type CanonicalNodeDescriptor = CanonicalTextNodeDescriptor | CanonicalElementNodeDescriptor;
|
|
32
|
-
/** One relationship as the journal records it. @public */
|
|
33
|
-
interface CanonicalRelationshipRecord {
|
|
34
|
-
readonly ownerPart: string;
|
|
35
|
-
readonly id: string;
|
|
36
|
-
readonly type: string;
|
|
37
|
-
readonly rawTarget: string;
|
|
38
|
-
readonly targetMode: 'Internal' | 'External';
|
|
39
|
-
readonly order: number;
|
|
40
|
-
}
|
|
41
|
-
/** One compositional tree or package effect captured from a canonical write. @public */
|
|
42
|
-
type CanonicalPrimitiveEffect = {
|
|
43
|
-
readonly kind: 'putNode';
|
|
44
|
-
readonly descriptor: CanonicalNodeDescriptor;
|
|
45
|
-
} | {
|
|
46
|
-
readonly kind: 'spliceText';
|
|
47
|
-
readonly logicalId: string;
|
|
48
|
-
readonly utf16Start: number;
|
|
49
|
-
readonly deleteCount: number;
|
|
50
|
-
readonly insert: string;
|
|
51
|
-
} | {
|
|
52
|
-
readonly kind: 'setAttribute';
|
|
53
|
-
readonly logicalId: string;
|
|
54
|
-
readonly qname: CanonicalAttributeName;
|
|
55
|
-
readonly value: string | null;
|
|
56
|
-
} | {
|
|
57
|
-
readonly kind: 'setNamespaceBinding';
|
|
58
|
-
readonly logicalId: string;
|
|
59
|
-
readonly prefix: string;
|
|
60
|
-
readonly uri: string | null;
|
|
61
|
-
} | {
|
|
62
|
-
readonly kind: 'spliceChildren';
|
|
63
|
-
readonly parentLogicalId: string;
|
|
64
|
-
readonly start: number;
|
|
65
|
-
readonly deleteCount: number;
|
|
66
|
-
readonly childLogicalIds: readonly string[];
|
|
67
|
-
} | {
|
|
68
|
-
readonly kind: 'moveNode';
|
|
69
|
-
readonly logicalId: string;
|
|
70
|
-
readonly destinationParentLogicalId: string;
|
|
71
|
-
readonly destinationIndex: number;
|
|
72
|
-
} | {
|
|
73
|
-
readonly kind: 'putXmlPart';
|
|
74
|
-
readonly name: string;
|
|
75
|
-
readonly rootLogicalId: string;
|
|
76
|
-
} | {
|
|
77
|
-
readonly kind: 'deleteXmlPart';
|
|
78
|
-
readonly name: string;
|
|
79
|
-
} | {
|
|
80
|
-
readonly kind: 'putRelationship';
|
|
81
|
-
readonly owner: string;
|
|
82
|
-
readonly record: CanonicalRelationshipRecord;
|
|
83
|
-
} | {
|
|
84
|
-
readonly kind: 'deleteRelationship';
|
|
85
|
-
readonly owner: string;
|
|
86
|
-
readonly relationshipId: string;
|
|
87
|
-
} | {
|
|
88
|
-
readonly kind: 'putContentTypeOverride';
|
|
89
|
-
readonly partName: string;
|
|
90
|
-
readonly mediaType: string;
|
|
91
|
-
} | {
|
|
92
|
-
readonly kind: 'deleteContentTypeOverride';
|
|
93
|
-
readonly partName: string;
|
|
94
|
-
} | {
|
|
95
|
-
readonly kind: 'putBinary';
|
|
96
|
-
readonly descriptor: CanonicalBinaryDescriptor;
|
|
97
|
-
} | {
|
|
98
|
-
readonly kind: 'deleteBinary';
|
|
99
|
-
readonly storageKey: string;
|
|
100
|
-
};
|
|
101
|
-
/**
|
|
102
|
-
* One immutable journal for one `TreePackageStore` transaction.
|
|
103
|
-
*
|
|
104
|
-
* Empty only when a committed write used a path the journal does not yet intercept.
|
|
105
|
-
*
|
|
106
|
-
* @public
|
|
107
|
-
*/
|
|
108
|
-
interface CanonicalPrimitiveJournal {
|
|
109
|
-
readonly effects: readonly CanonicalPrimitiveEffect[];
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/** Options for a canonical collaboration document port. @public */
|
|
113
|
-
interface CreateCollaborationDocumentPortOptions {
|
|
114
|
-
readonly documentId: string;
|
|
115
|
-
}
|
|
116
|
-
/** Create the narrow collaboration view over one canonical package store. @public */
|
|
117
|
-
declare function createCollaborationDocumentPort(store: TreePackageStore, options: CreateCollaborationDocumentPortOptions): CollaborationDocumentPort;
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* `@docx-editor.dev/core/collaboration/replication` — the seam a replication implementation
|
|
121
|
-
* binds to, not the surface a host consumes.
|
|
122
|
-
*
|
|
123
|
-
* Everything here exists for the layer BETWEEN a CRDT and the canonical tree: the document
|
|
124
|
-
* port an adapter writes through, the primitive journal it reads, and the descriptors that
|
|
125
|
-
* journal is made of. A host that renders presence and reads a status needs none of it, which
|
|
126
|
-
* is why it lives behind its own subpath — autocomplete on
|
|
127
|
-
* `@docx-editor.dev/core/collaboration` should not offer `putXmlPart` and `spliceChildren` to
|
|
128
|
-
* somebody wiring up an avatar stack.
|
|
129
|
-
*
|
|
130
|
-
* Reach for this when you are writing a provider. `@docx-editor.dev/pro` is one.
|
|
131
|
-
*
|
|
132
|
-
* @packageDocumentation
|
|
133
|
-
* @public
|
|
134
|
-
*/
|
|
135
|
-
|
|
136
|
-
/** One existing body paragraph exposed to the replication adapter. @public */
|
|
137
|
-
interface CollaborationParagraph {
|
|
138
|
-
/** Uppercase `w14:paraId`, stable across save and reopen. */
|
|
139
|
-
readonly paragraphId: string;
|
|
140
|
-
/** Replica-local canonical node identity. Never sent as wire identity. */
|
|
141
|
-
readonly nodeId: string;
|
|
142
|
-
/** Current canonical UTF-16 text. */
|
|
143
|
-
readonly text: string;
|
|
144
|
-
}
|
|
145
|
-
/** Attribution for one collaboration-derived canonical publication. @public */
|
|
146
|
-
interface CollaborationMutation {
|
|
147
|
-
readonly origin: string;
|
|
148
|
-
readonly actorId: string;
|
|
149
|
-
readonly operationId: string;
|
|
150
|
-
}
|
|
151
|
-
/** One paragraph text value in an atomic collaboration publication. @public */
|
|
152
|
-
interface CollaborationParagraphTextUpdate {
|
|
153
|
-
readonly paragraphId: string;
|
|
154
|
-
readonly text: string;
|
|
155
|
-
}
|
|
156
|
-
/** Result of replacing one supported paragraph's canonical text. @public */
|
|
157
|
-
type CollaborationApplyResult = {
|
|
158
|
-
readonly ok: true;
|
|
159
|
-
readonly changed: boolean;
|
|
160
|
-
} | {
|
|
161
|
-
readonly ok: false;
|
|
162
|
-
readonly reason: string;
|
|
163
|
-
};
|
|
164
|
-
/**
|
|
165
|
-
* Narrow canonical document capability handed to a collaboration implementation.
|
|
166
|
-
*
|
|
167
|
-
* It deliberately exposes no mutable package or tree store. Every write returns through the
|
|
168
|
-
* same validated transaction path as browser and automation edits.
|
|
169
|
-
*
|
|
170
|
-
* @public
|
|
171
|
-
*/
|
|
172
|
-
interface CollaborationDocumentPort {
|
|
173
|
-
readonly documentId: string;
|
|
174
|
-
paragraphs(): readonly CollaborationParagraph[];
|
|
175
|
-
paragraphByNodeId(nodeId: string): CollaborationParagraph | null;
|
|
176
|
-
/**
|
|
177
|
-
* Resolve a stable `w14:paraId` in any story this replica holds.
|
|
178
|
-
*
|
|
179
|
-
* `paragraphs()` stays body-only because text publication transacts against the body
|
|
180
|
-
* store. Presence may name a header, a footer, a note, or a cell, so this lookup covers
|
|
181
|
-
* those parts too. It resolves through an index, not a scan, because a remote caret
|
|
182
|
-
* resolves two addresses per selection on every caret move.
|
|
183
|
-
*/
|
|
184
|
-
paragraphByStableId(paragraphId: string): CollaborationParagraph | null;
|
|
185
|
-
applyParagraphText(paragraphId: string, text: string, mutation: CollaborationMutation): CollaborationApplyResult;
|
|
186
|
-
applyParagraphTexts(updates: readonly CollaborationParagraphTextUpdate[], mutation: CollaborationMutation): CollaborationApplyResult;
|
|
187
|
-
/**
|
|
188
|
-
* Publish one remotely materialized canonical package as one revision.
|
|
189
|
-
*
|
|
190
|
-
* The package is frozen canonical state. This port exposes no mutable store or CRDT.
|
|
191
|
-
*/
|
|
192
|
-
applyRemotePackage(pkg: OoxmlPackage, mutation: CollaborationMutation): CollaborationApplyResult;
|
|
193
|
-
revision(): number;
|
|
194
|
-
subscribe(listener: (change: TreeModelChange) => void): () => void;
|
|
195
|
-
/**
|
|
196
|
-
* Observe one settled primitive journal per committed canonical transaction.
|
|
197
|
-
*
|
|
198
|
-
* Disabled observation allocates no journal. This is the collaboration write seam;
|
|
199
|
-
* adapters never write a CRDT through this port.
|
|
200
|
-
*/
|
|
201
|
-
observePrimitiveJournal(listener: (journal: CanonicalPrimitiveJournal) => void): () => void;
|
|
202
|
-
/** True when a committed journal has not yet been frozen or delivered to observers. */
|
|
203
|
-
hasPendingJournals(): boolean;
|
|
204
|
-
/**
|
|
205
|
-
* Freeze and deliver queued journals in production order.
|
|
206
|
-
*
|
|
207
|
-
* Local edit, layout, and paint do not wait for this. Tests and teardown call it
|
|
208
|
-
* instead of sleeping on the publication timer.
|
|
209
|
-
*/
|
|
210
|
-
flushPendingJournals(): void;
|
|
211
|
-
save(): Uint8Array;
|
|
212
|
-
/** Bytes of one binary package part, or null when the part is absent. */
|
|
213
|
-
binaryPart(storageKey: string): Uint8Array | null;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
export { type CanonicalAttributeName, type CanonicalBinaryDescriptor, type CanonicalElementNodeDescriptor, type CanonicalNodeDescriptor, type CanonicalPrimitiveEffect, type CanonicalPrimitiveJournal, type CanonicalRelationshipRecord, type CanonicalTextNodeDescriptor, type CollaborationApplyResult, type CollaborationDocumentPort, type CollaborationMutation, type CollaborationParagraph, type CollaborationParagraphTextUpdate, type CreateCollaborationDocumentPortOptions, createCollaborationDocumentPort };
|
package/dist/collaboration.d.cts
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { S as StoryScope } from './tree-package-fragment-Dhyw7oPm.cjs';
|
|
2
|
-
import { T as TreeDocOp } from './tree-op-types-BUulYD5y.cjs';
|
|
3
|
-
import { CollaborationDocumentPort } from './collaboration/replication.cjs';
|
|
4
|
-
import { C as CollaborationStatus, a as CollaborationStatusSnapshot, b as CollaborationFailureCode } from './failure-BnGjoXf0.cjs';
|
|
5
|
-
export { c as CollaborationFailure, d as createCollaborationStatusTracker, i as isCollaborationFailureCode } from './failure-BnGjoXf0.cjs';
|
|
6
|
-
import './tree-store-DEEQ9wz_.cjs';
|
|
7
|
-
import './contracts/types.cjs';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* A peer's presence color is attacker-controlled: it arrives over awareness from whoever is in
|
|
11
|
-
* the room, and the engine paints it into a CSS custom property that the stylesheet consumes in
|
|
12
|
-
* a `background` shorthand. A custom property substitutes verbatim, so `url(...)` is a valid
|
|
13
|
-
* `<bg-image>` there — an unvalidated color is a zero-click GET to any host the peer names, on
|
|
14
|
-
* every replica that paints their caret. A length cap does not help: `url(//host/t)` is short.
|
|
15
|
-
*
|
|
16
|
-
* So the only colors that reach a style property are the two shapes this engine itself produces:
|
|
17
|
-
* a hex literal, or a reference to one of the review author slots the core stylesheet owns.
|
|
18
|
-
* Anything else is dropped and the caller falls back to the accent color.
|
|
19
|
-
*/
|
|
20
|
-
/**
|
|
21
|
-
* Return `value` when it is a color this engine can safely paint, otherwise `undefined`.
|
|
22
|
-
*
|
|
23
|
-
* @public
|
|
24
|
-
*/
|
|
25
|
-
declare function safeParticipantColor(value: string | undefined): string | undefined;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* `@docx-editor.dev/core/collaboration` — provider-neutral collaboration contracts.
|
|
29
|
-
*
|
|
30
|
-
* This lane names the attachment between the canonical tree and an optional replication
|
|
31
|
-
* implementation. It performs no networking and imports no CRDT.
|
|
32
|
-
*
|
|
33
|
-
* @packageDocumentation
|
|
34
|
-
* @public
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
/** Human or automation identity attached to authored collaboration transactions. @public */
|
|
38
|
-
interface CollaborationIdentity {
|
|
39
|
-
readonly actorId: string;
|
|
40
|
-
readonly name: string;
|
|
41
|
-
readonly color?: string;
|
|
42
|
-
readonly role?: 'human' | 'agent';
|
|
43
|
-
}
|
|
44
|
-
/** One validated identity visible through ephemeral collaboration presence. @public */
|
|
45
|
-
interface CollaborationParticipant extends CollaborationIdentity {
|
|
46
|
-
readonly isLocal: boolean;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* One endpoint of a published selection: a stable paragraph id and a UTF-16 offset.
|
|
50
|
-
*
|
|
51
|
-
* The wire payload carries only these two endpoints. The receiver walks its own canonical
|
|
52
|
-
* tree to find the paragraphs between them, so a select-all does not grow with document size.
|
|
53
|
-
*
|
|
54
|
-
* @public
|
|
55
|
-
*/
|
|
56
|
-
interface CollaborationSelectionAddress {
|
|
57
|
-
readonly paragraphId: string;
|
|
58
|
-
readonly offset: number;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* How a published selection covers the document.
|
|
62
|
-
*
|
|
63
|
-
* Absent or omitted means a character range. `cells` means the table rectangle whose
|
|
64
|
-
* corner cells contain the two endpoints. The payload still carries only those endpoints,
|
|
65
|
-
* so a large table selection does not grow with the number of selected cells.
|
|
66
|
-
*
|
|
67
|
-
* @public
|
|
68
|
-
*/
|
|
69
|
-
type CollaborationSelectionKind = 'cells';
|
|
70
|
-
/**
|
|
71
|
-
* One endpoint of a remote selection resolved into this replica's canonical addresses.
|
|
72
|
-
*
|
|
73
|
-
* `paragraphId` is the stable `w14:paraId`. `nodeId` is replica-local and is used to paint.
|
|
74
|
-
*
|
|
75
|
-
* @public
|
|
76
|
-
*/
|
|
77
|
-
interface CollaborationRemoteSelectionAddress {
|
|
78
|
-
readonly paragraphId: string;
|
|
79
|
-
readonly nodeId: string;
|
|
80
|
-
readonly offset: number;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Stable remote selection resolved into this replica's canonical paragraph addresses.
|
|
84
|
-
*
|
|
85
|
-
* Anchor and head may name different paragraphs. A collapsed caret is the same address twice.
|
|
86
|
-
*
|
|
87
|
-
* @public
|
|
88
|
-
*/
|
|
89
|
-
interface CollaborationRemoteSelection {
|
|
90
|
-
readonly actorId: string;
|
|
91
|
-
readonly name: string;
|
|
92
|
-
readonly color?: string;
|
|
93
|
-
readonly anchor: CollaborationRemoteSelectionAddress;
|
|
94
|
-
readonly head: CollaborationRemoteSelectionAddress;
|
|
95
|
-
readonly kind?: CollaborationSelectionKind;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Selection published by the local editor through ephemeral awareness.
|
|
99
|
-
*
|
|
100
|
-
* Publish an anchor address and a head address. Do not materialize every covered paragraph.
|
|
101
|
-
*
|
|
102
|
-
* @public
|
|
103
|
-
*/
|
|
104
|
-
interface CollaborationLocalSelection {
|
|
105
|
-
readonly anchor: CollaborationSelectionAddress;
|
|
106
|
-
readonly head: CollaborationSelectionAddress;
|
|
107
|
-
readonly kind?: CollaborationSelectionKind;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Optional replication session attached to an editor or headless automation host.
|
|
111
|
-
*
|
|
112
|
-
* Implementations own replication state only. The attached document port remains the authored
|
|
113
|
-
* authority for reads, layout, paint, and save.
|
|
114
|
-
*
|
|
115
|
-
* @public
|
|
116
|
-
*/
|
|
117
|
-
interface EditorCollaborationSession {
|
|
118
|
-
readonly documentId: string;
|
|
119
|
-
/** Unique identity for this attachment lifetime. It prevents operation ID reuse after reconnect. */
|
|
120
|
-
readonly sessionId: string;
|
|
121
|
-
readonly identity: CollaborationIdentity;
|
|
122
|
-
status(): CollaborationStatus;
|
|
123
|
-
/**
|
|
124
|
-
* Cached status, current reason, and last failure.
|
|
125
|
-
*
|
|
126
|
-
* Same reference until any of those values change. A host that mounts after a
|
|
127
|
-
* recovered error still reads {@link CollaborationStatusSnapshot.lastFailure}.
|
|
128
|
-
*/
|
|
129
|
-
statusSnapshot(): CollaborationStatusSnapshot;
|
|
130
|
-
subscribeStatus(listener: (status: CollaborationStatus, reason?: CollaborationFailureCode, detail?: string) => void): () => void;
|
|
131
|
-
attach(port: CollaborationDocumentPort): () => void;
|
|
132
|
-
/**
|
|
133
|
-
* Whether an editor has attached its document port to this replica.
|
|
134
|
-
*
|
|
135
|
-
* False means edits do not replicate, whatever `status()` says — the usual cause is a host
|
|
136
|
-
* that did not remount the editor when the session appeared, so `collaborationModule`
|
|
137
|
-
* never attached. That mistake used to be reachable only as a `console.warn`, which a
|
|
138
|
-
* production build discards; this is the same fact as a value a host can render.
|
|
139
|
-
*/
|
|
140
|
-
readonly attached: boolean;
|
|
141
|
-
gateOperations(ops: readonly TreeDocOp[], scope: StoryScope): CollaborationFailureCode | null;
|
|
142
|
-
canUndo(): boolean;
|
|
143
|
-
canRedo(): boolean;
|
|
144
|
-
undo(): boolean;
|
|
145
|
-
redo(): boolean;
|
|
146
|
-
setLocalSelection(selection: CollaborationLocalSelection | null): void;
|
|
147
|
-
participants(): readonly CollaborationParticipant[];
|
|
148
|
-
subscribeParticipants(listener: (participants: readonly CollaborationParticipant[]) => void): () => void;
|
|
149
|
-
remoteSelections(): readonly CollaborationRemoteSelection[];
|
|
150
|
-
subscribeRemoteSelections(listener: (selections: readonly CollaborationRemoteSelection[]) => void): () => void;
|
|
151
|
-
/**
|
|
152
|
-
* Publish queued local journals to shared state.
|
|
153
|
-
*
|
|
154
|
-
* Local typing does not wait for replication. Undo, destroy, and page hide call this
|
|
155
|
-
* so a queued journal is never dropped.
|
|
156
|
-
*/
|
|
157
|
-
flushPendingJournals(): void;
|
|
158
|
-
destroy(): void;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* What a collaboration module contributes: the replica the surface attaches.
|
|
162
|
-
*
|
|
163
|
-
* @public
|
|
164
|
-
*/
|
|
165
|
-
interface CollaborationModuleContribution {
|
|
166
|
-
/**
|
|
167
|
-
* A ready session. The host creates the Yjs room, then wraps it with
|
|
168
|
-
* `collaborationModule({ session })`.
|
|
169
|
-
*
|
|
170
|
-
* Core does not build a session from a document id: the opened package has
|
|
171
|
-
* no collaboration room identity. That identity is chosen before mount.
|
|
172
|
-
*/
|
|
173
|
-
readonly session: EditorCollaborationSession;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export { CollaborationFailureCode, type CollaborationIdentity, type CollaborationLocalSelection, type CollaborationModuleContribution, type CollaborationParticipant, type CollaborationRemoteSelection, type CollaborationRemoteSelectionAddress, type CollaborationSelectionAddress, type CollaborationSelectionKind, CollaborationStatus, CollaborationStatusSnapshot, type EditorCollaborationSession, safeParticipantColor };
|