@docx-editor.dev/pro 2.30.0 → 2.32.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 +24 -0
- package/dist/chunk-3WTOHPAB.js +1 -0
- package/dist/chunk-AVZO5ZHZ.js +1 -0
- package/dist/{chunk-CNXDNDD3.js → chunk-DLYVBBO7.js} +1 -1
- package/dist/chunk-GAGYRL3L.js +5 -0
- package/dist/chunk-HMSOWKXT.js +1 -0
- package/dist/chunk-I6HVINA4.cjs +1 -0
- package/dist/chunk-MHB6ID2P.cjs +1 -0
- package/dist/chunk-PMS3PGOE.cjs +1 -0
- package/dist/{chunk-N34IUO36.cjs → chunk-RYF4SNKX.cjs} +1 -1
- package/dist/chunk-YOWEY5F3.cjs +5 -0
- package/dist/collaboration/hocuspocus.cjs +1 -1
- package/dist/collaboration/hocuspocus.d.cts +3 -3
- package/dist/collaboration/hocuspocus.d.ts +3 -3
- package/dist/collaboration/hocuspocus.js +1 -1
- package/dist/collaboration/index.cjs +2 -2
- package/dist/collaboration/index.d.cts +63 -7
- package/dist/collaboration/index.d.ts +63 -7
- package/dist/collaboration/index.js +2 -2
- package/dist/collaboration/webrtc.cjs +2 -2
- package/dist/collaboration/webrtc.d.cts +34 -15
- package/dist/collaboration/webrtc.d.ts +34 -15
- package/dist/collaboration/webrtc.js +2 -2
- package/dist/{document-session-_v9vqiSX.d.cts → document-session-B-MlORjE.d.cts} +105 -9
- package/dist/{document-session-Bxs4_GgX.d.ts → document-session-B-iH-YCU.d.ts} +105 -9
- package/dist/document-session-B35ZX2W4.js +1 -0
- package/dist/document-session-V3O7XBJY.cjs +1 -0
- package/dist/{document-session-options-DelOC7PX.d.ts → document-session-options-CdOH-TNn.d.ts} +1 -1
- package/dist/{document-session-options-CfKypp9c.d.cts → document-session-options-CxR0F5xT.d.cts} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/react/hocuspocus.d.cts +2 -2
- package/dist/react/hocuspocus.d.ts +2 -2
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.d.cts +283 -16
- package/dist/react/index.d.ts +283 -16
- package/dist/react/index.js +2 -2
- package/dist/react/webrtc.d.cts +9 -4
- package/dist/react/webrtc.d.ts +9 -4
- package/dist/{types-BQ1vBt5Q.d.ts → types-DvGpDOcZ.d.cts} +9 -1
- package/dist/{types-BQ1vBt5Q.d.cts → types-DvGpDOcZ.d.ts} +9 -1
- package/dist/{types-6EmrEn4n.d.cts → types-bt2k1VO0.d.cts} +9 -1
- package/dist/{types-6EmrEn4n.d.ts → types-bt2k1VO0.d.ts} +9 -1
- package/dist/vue/hocuspocus.cjs +1 -1
- package/dist/vue/hocuspocus.d.cts +2 -2
- package/dist/vue/hocuspocus.d.ts +2 -2
- package/dist/vue/hocuspocus.js +1 -1
- package/dist/vue/index.cjs +2 -2
- package/dist/vue/index.d.cts +285 -16
- package/dist/vue/index.d.ts +285 -16
- package/dist/vue/index.js +2 -2
- package/dist/vue/webrtc.cjs +1 -1
- package/dist/vue/webrtc.d.cts +9 -4
- package/dist/vue/webrtc.d.ts +9 -4
- package/dist/vue/webrtc.js +1 -1
- package/docs/accept-reject-without-scrolling.md +95 -0
- package/docs/comment-on-found-text.md +72 -0
- package/docs/custom-review-cards.md +178 -0
- package/docs/highlight-ranges.md +48 -0
- package/docs/index.md +36 -0
- package/docs/propose-rewrite.md +247 -0
- package/docs/tracked-replacement.md +68 -0
- package/package.json +5 -4
- package/dist/chunk-FD2KDBHX.cjs +0 -1
- package/dist/chunk-JRHEYVVY.cjs +0 -1
- package/dist/chunk-L567WP3J.js +0 -5
- package/dist/chunk-MJECUVHQ.cjs +0 -5
- package/dist/chunk-P2EF7WMV.js +0 -1
- package/dist/chunk-Q5JTCGJI.js +0 -1
- package/dist/chunk-SNQCYZLT.js +0 -1
- package/dist/chunk-ZSAAX6HV.cjs +0 -1
- package/dist/document-session-3VC43WNI.cjs +0 -1
- package/dist/document-session-J2YKWERI.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docx-editor.dev/pro",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.32.0",
|
|
4
4
|
"description": "Commercial capabilities for @docx-editor.dev: the review module (comments, tracked changes, markup rendering), custom inline nodes, and realtime collaboration.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
},
|
|
60
60
|
"files": [
|
|
61
61
|
"dist",
|
|
62
|
+
"docs",
|
|
62
63
|
"!dist/metafile-*.json",
|
|
63
64
|
"LICENSE.md",
|
|
64
65
|
"THIRD_PARTY_NOTICES.md"
|
|
@@ -70,9 +71,9 @@
|
|
|
70
71
|
"license:add": "license-check-and-add add -f license-check.json"
|
|
71
72
|
},
|
|
72
73
|
"peerDependencies": {
|
|
73
|
-
"@docx-editor.dev/core": "~2.
|
|
74
|
-
"@docx-editor.dev/react": "~2.
|
|
75
|
-
"@docx-editor.dev/vue": "~2.
|
|
74
|
+
"@docx-editor.dev/core": "~2.32.0",
|
|
75
|
+
"@docx-editor.dev/react": "~2.32.0",
|
|
76
|
+
"@docx-editor.dev/vue": "~2.32.0",
|
|
76
77
|
"react": "^18.0.0 || ^19.0.0",
|
|
77
78
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
78
79
|
"vue": "^3.3.0",
|
package/dist/chunk-FD2KDBHX.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkQLZH2Q2C_cjs=require('./chunk-QLZH2Q2C.cjs'),store=require('@docx-editor.dev/core/store'),editor=require('@docx-editor.dev/core/editor'),i18n=require('@docx-editor.dev/i18n'),layout=require('@docx-editor.dev/core/layout');var je=64,le=new Set(["__proto__","constructor","prototype"]);function E(e,t,o){let n=new URLSearchParams;for(let[s,d]of Object.entries(o))n.set(s,d);let r=n.toString(),a=r.length>0?`${e}:${t}?${r}`:`${e}:${t}`;return a.length>64?{ok:false,reason:"tag-overflow",length:a.length}:{ok:true,tag:a}}function P(e){if(e.length>64)return null;let t=e.indexOf(":");if(t<=0)return null;let o=e.slice(0,t),n=e.slice(t+1),r=n.indexOf("?"),a=r===-1?n:n.slice(0,r);if(a.length===0)return null;let s=Object.create(null);if(r!==-1)for(let[d,i]of new URLSearchParams(n.slice(r+1))){if(le.has(d))return null;s[d]=i;}return {prefix:o,name:a,attrs:s}}var We=262144;function A(e,t){if(t.length===0)return {ok:false,reason:"malformed",issues:["the node carries no payload"]};if(t.length>262144)return {ok:false,reason:"malformed",issues:[`the payload is ${String(t.length)} characters; the cap is ${String(262144)}`]};let o;try{o=JSON.parse(t);}catch(a){return {ok:false,reason:"malformed",issues:[a instanceof Error?a.message:"the payload is not JSON"]}}let n=H(o);if(!e)return {ok:true,value:n};let r=e["~standard"].validate(n);return ce(r)?{ok:false,reason:"async",issues:["the schema validates asynchronously, which the read path cannot await"]}:r.issues?{ok:false,reason:"invalid",issues:r.issues.map(ue)}:{ok:true,value:r.value}}function F(e){let t;try{t=JSON.stringify(e)??"";}catch(o){return {ok:false,reason:"malformed",issues:[o instanceof Error?o.message:"the value cannot be serialized"]}}return t.length===0?{ok:false,reason:"malformed",issues:["the value serializes to nothing"]}:t.length>262144?{ok:false,reason:"malformed",issues:[`the payload is ${String(t.length)} characters; the cap is ${String(262144)}`]}:{ok:true,value:t}}function ce(e){return typeof e.then=="function"}function ue(e){let t=(e.path??[]).map(o=>String(typeof o=="object"?o.key:o)).join(".");return t.length>0?`${t}: ${e.message}`:e.message}var me=new Set(["__proto__","constructor","prototype"]);function H(e){if(Array.isArray(e))return e.map(H);if(e===null||typeof e!="object")return e;let t=Object.create(null);for(let[o,n]of Object.entries(e))me.has(o)||(t[o]=H(n));return t}function B(e){let t=(e.path??[]).map(o=>{let n=typeof o=="object"?o.key:o;return typeof n=="number"?n:String(n)});return {message:e.message,path:t,pointer:t.join(".")}}function D(e,t){return {ok:false,code:"invalidArgs",reason:e,issues:t}}var G="docxEditor";function T(e){return e.payloadNamespace??`urn:docx-editor.dev:custom-node:${e.tagPrefix}`}function J(e,t,o){let n=0;for(let r of store.customNodePayloadsOf(e,t,o).keys()){let a=/^cx(\d{1,9})$/.exec(r);if(!a)continue;let s=Number(a[1]);s>n&&(n=s);}return `cx${String(n+1)}`}function X(e,t){let o=F(t);if(!o.ok)return {ok:false,reason:`the payload cannot be serialized: ${o.issues.join(", ")}`,issues:[]};if(!e.schema)return {ok:true,data:o.value,value:t};let r=e.schema["~standard"].validate(JSON.parse(o.value));if(pe(r))return {ok:false,reason:`${e.name}'s schema validates asynchronously, which a write cannot await`,issues:[]};if(r.issues){let s=r.issues.map(B);return {ok:false,reason:`the payload does not match ${e.name}'s schema: `+s.map(d=>(d.pointer?`${d.pointer}: `:"")+d.message).join(", "),issues:s}}let a=F(r.value);return a.ok?{ok:true,data:a.value,value:r.value}:{ok:false,reason:`the payload cannot be serialized: ${a.issues.join(", ")}`,issues:[]}}function pe(e){return typeof e.then=="function"}function Y(e){return typeof e=="object"&&e!==null&&typeof e.name=="string"&&typeof e.tagPrefix=="string"}var q=/^[A-Za-z0-9_.-]+$/,ge=/['"<>&]|[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/;function he(e){return e.length>0&&!ge.test(e)}function ot(e){if(!q.test(e.name??""))throw new Error(`defineCustomNode: invalid name ${JSON.stringify(e.name)}`);if(!q.test(e.tagPrefix??""))throw new Error(`defineCustomNode: invalid tagPrefix ${JSON.stringify(e.tagPrefix)}`);let t=e.schema;if(t!==void 0&&typeof t?.["~standard"]?.validate!="function")throw new Error(`defineCustomNode: ${JSON.stringify(e.name)} has a schema that does not implement Standard Schema`);if(e.payloadNamespace!==void 0&&!he(e.payloadNamespace))throw new Error(`defineCustomNode: ${JSON.stringify(e.name)} has a payloadNamespace that cannot be written into an XPath \u2014 no quotes, angle brackets, ampersands or control characters: ${JSON.stringify(e.payloadNamespace)}`);if(e.preserveOnExport!==void 0&&e.preserveOnExport!==true&&e.preserveOnExport!==false&&e.preserveOnExport!=="text")throw new Error(`defineCustomNode: ${JSON.stringify(e.name)} has an unknown preserveOnExport ${JSON.stringify(e.preserveOnExport)}`);return Object.freeze({...e,dataOf:n=>{if(!n||n.data===void 0||n.name!==void 0&&n.name!==e.name)return;if(!e.schema)return n.data;let r=e.schema["~standard"].validate(n.data);if(typeof r.then=="function")return;let a=r;return a.issues?void 0:a.value}})}function nt(e){chunkQLZH2Q2C_cjs.a(e.licenseKey);let t=new Set;for(let o of e.nodes){let n=`${o.tagPrefix}:${o.name}`;if(t.has(n))throw new Error(`customNodesModule: two definitions claim ${JSON.stringify(n)}`);t.add(n);}return {id:"custom-nodes",customNodes:e.nodes,...e.onDiagnostic?{onCustomNodeDiagnostic:o=>{e.onDiagnostic?.(o);}}:{},customNodePayloadNamespaces:[...new Set(e.nodes.map(T))]}}function ve(e){for(let t of e.children)if(!(t.kind==="textValue"||t.localName!=="sdtPr")){for(let o of t.children)if(!(o.kind==="textValue"||o.localName!=="tag")){for(let n of o.attributes)if(n.localName==="val")return n.value}}}function Z(e){if(e.kind==="textValue")return e.value;let t="";for(let o of e.children)t+=Z(o);return t}function Q(e,t,o={}){if(t.length===0)return [];let n=new Map;for(let s of t){let d=`${s.tagPrefix}:${s.name}`;if(n.has(d))throw new Error(`recognizeCustomNodes: duplicate definition for ${JSON.stringify(d)}`);n.set(d,s);}let r=[],a=(s,d)=>{if(!(s.kind==="textValue"||d>64)){if(s.kind==="contentControl"){let i=ve(s),l=i!==void 0?P(i):null,f=l?n.get(`${l.prefix}:${l.name}`):void 0;if(l&&f&&i!==void 0){let g=Z(s),k=xe(f,s.id,o.payloads?.get(s.id),store.contentControlPropertiesOf(s).dataBinding!==void 0,o.onDiagnostic),N=f.fromDocx?f.fromDocx({attrs:l.attrs,text:g,...k.present?{data:k.value}:{}}):l.attrs;if(N!==null){r.push({name:f.name,attrs:N,text:g,nodeId:s.id,tag:i,...k.present?{data:k.value}:{}});return}}}for(let i of s.children)a(i,d+1);}};return a(e.root,0),r}function xe(e,t,o,n,r){if(!o)return n&&r?.({code:"payload-missing",name:e.name,nodeId:t,issues:["the control binds a store node this document does not hold"]}),{present:false};let a=A(e.schema,o.data);return a.ok?{present:true,value:a.value}:(r?.({code:"payload-invalid",name:e.name,nodeId:t,issues:a.issues}),{present:false})}function ee(e,t){let o=e.createElement("div");o.className="docx-revision-color-picker";let n=e.createElement("span");n.textContent=t.label,n.id=`${t.id}-label`;let r=e.createElement("button");r.type="button",r.className="docx-revision-color-trigger",r.setAttribute("aria-labelledby",`${n.id} ${t.id}-value`),r.setAttribute("aria-expanded","false"),r.setAttribute("aria-controls",`${t.id}-options`);let a=e.createElement("span");a.className="docx-revision-color-swatch",a.setAttribute("aria-hidden","true");let s=e.createElement("span");s.id=`${t.id}-value`,r.append(a,s);let d=e.createElement("div");d.id=`${t.id}-options`,d.className="docx-revision-color-options",d.hidden=true,d.setAttribute("role","group"),d.setAttribute("aria-labelledby",n.id);let i=new Map,l=c=>c==="auto"?"currentColor":c==="byAuthor"?"var(--doc-review-author-0)":c==="none"?"transparent":`var(--doc-revision-color-${c})`,f,g=()=>{f?.(),f=void 0,e.removeEventListener("pointerdown",k,true),d.hidden=true,r.setAttribute("aria-expanded","false");},k=c=>{o.contains(c.target)||g();};o.addEventListener("focusout",c=>{o.contains(c.relatedTarget)||g();});let N=e.createElement("div");N.className="docx-revision-color-special";let S=e.createElement("div");S.className="docx-toolbar__swatch-grid",d.append(N,S);for(let c of t.colors){let p=e.createElement("button");if(p.type="button",p.dataset.value=c,p.setAttribute("aria-label",t.translate(c)),p.title=t.translate(c),["auto","none","byAuthor"].includes(c)){p.className="docx-toolbar__swatch-clear";let m=e.createElement("span");m.className="docx-revision-color-swatch",m.style.backgroundColor=l(c),m.setAttribute("aria-hidden","true"),p.append(m,e.createTextNode(t.translate(c))),N.append(p);}else p.className="docx-toolbar__swatch",p.dataset.light="",p.style.backgroundColor=l(c),S.append(p);p.addEventListener("mousedown",m=>m.preventDefault()),p.addEventListener("click",()=>{t.change(c),g(),r.focus();}),i.set(c,p);}return r.addEventListener("click",()=>{let c=d.hidden;if(d.hidden=!c,r.setAttribute("aria-expanded",String(c)),!c){g();return}f=editor.observeContentControlPopup(d,r),e.addEventListener("pointerdown",k,true),(Array.from(i.values()).find(p=>p.hasAttribute("data-selected"))??i.values().next().value)?.focus();}),d.addEventListener("keydown",c=>{c.key==="Escape"&&(c.preventDefault(),c.stopPropagation(),g(),r.focus());let p=Array.from(d.querySelectorAll("button")),m=p.indexOf(c.target),u=c.key==="Home"?0:c.key==="End"?p.length-1:["ArrowRight","ArrowDown"].includes(c.key)?(m+1)%p.length:["ArrowLeft","ArrowUp"].includes(c.key)?(m-1+p.length)%p.length:null;u!==null&&(c.preventDefault(),c.stopPropagation(),p[u]?.focus());}),o.append(n,r,d),{element:o,destroy:g,update(c,p){s.textContent=t.translate(c),a.style.backgroundColor=l(c),r.disabled=p;for(let[m,u]of i)u.setAttribute("aria-pressed",String(m===c)),u.toggleAttribute("data-selected",m===c),u.disabled=p;p&&g();}}}var M=["none","colorOnly","bold","italic","underline","doubleUnderline","strikethrough","doubleStrikethrough"],te=[...M,"hidden","caret","pound"],j=0;function oe(e){let t=e.container.ownerDocument,o=null,n=e.get(),r=null,a=new Map,s=new Map,d=i18n.createT(i18n.en),i=m=>e.translate?.(`revisionMarkup.${m}`)??d(`revisionMarkup.${m}`),l=(m,u)=>{let y=t.createElement(m);return u!==void 0&&(y.textContent=u),y},f=()=>{o?.close(),o?.remove(),o=null,a.clear();for(let m of s.values())m.destroy();s.clear(),r?.isConnected&&r.focus({preventScroll:true}),r=null;},g=()=>{for(let[m,u]of a){let[y,h]=m.split("."),v=n[y];u.tagName==="INPUT"?u.checked=v:u.value=v[h],u.disabled=(y==="movedFrom"||y==="movedTo")&&!n.trackMoves;}for(let[m,u]of s){let[y,h]=m.split("."),v=n[y];u.update(v[h],(y==="movedFrom"||y==="movedTo")&&!n.trackMoves);}},k=m=>{e.set(m);},N=e.subscribe(()=>{n=e.get(),g();}),S=(m,u,y,h,v)=>{if(y==="color"||y==="background"||u==="cells"){let R=i(u==="cells"?`${y}Cells`:`${u}${y==="background"?"Background":"Color"}`),x=ee(t,{id:`docx-revision-color-${j++}`,label:R,colors:h,translate:C=>i(`values.${C}`),change:C=>k({[u]:{[y]:C}})});return s.set(`${u}.${y}`,x),m.append(x.element),x.element}let O=l("label"),b=l("span",i(u));b.className="docx-revision-markup-field-label",O.append(b);let w=l("select");for(let R of h){let x=l("option",i(`values.${R}`));x.value=R,w.append(x);}return w.value=v,w.addEventListener("change",()=>k({[u]:{[y]:w.value}})),O.append(w),m.append(O),a.set(`${u}.${y}`,w),O},c=(m,u,y)=>{let h=l("div");h.className="docx-revision-markup-row";let v=l("span",i(u));if(v.className="docx-revision-markup-row-title",v.setAttribute("aria-hidden","true"),h.append(v),S(h,u,"mark",y,n[u].mark),S(h,u,"color",["byAuthor","auto",...editor.REVISION_MARKUP_COLORS],n[u].color),m.append(h),u!=="changedLines"){let O=l("div");O.className="docx-revision-markup-background",S(O,u,"background",["none","byAuthor",...editor.REVISION_MARKUP_COLORS],n[u].background),m.append(O);}},p=(m,u)=>{let y=l("label"),h=l("input");h.type="checkbox",h.checked=n[u],h.addEventListener("change",()=>k({[u]:h.checked}));let v=l("p",i(`${u}Note`));v.id=`docx-revision-markup-note-${j++}`,h.setAttribute("aria-describedby",v.id),y.append(h,t.createTextNode(i(u))),m.append(y,v),a.set(u,h);};return {open(){if(e.signal.aborted)return;if(o){o.focus();return}n=e.get(),r=t.activeElement,o=l("dialog"),o.className="docx-revision-markup-dialog",o.contentEditable="false",o.setAttribute("data-docx-marker","");for(let x of ["keydown","mousedown","beforeinput"])o.addEventListener(x,C=>C.stopPropagation());let m=l("h2",i("title"));m.id=`docx-revision-markup-title-${j++}`,o.setAttribute("aria-labelledby",m.id),o.append(m),o.addEventListener("cancel",x=>{x.preventDefault(),e.cancel();});let u=l("div");u.className="docx-revision-markup-body",o.append(u);let y=x=>{let C=l("fieldset");return C.className=`docx-revision-markup-${x}`,C.append(l("legend",i(x))),u.append(C),C},h=y("markup");c(h,"insertions",M),c(h,"deletions",te),c(h,"changedLines",["none","leftBorder","rightBorder","outsideBorder"]);let v=y("moves");p(v,"trackMoves"),c(v,"movedFrom",te),c(v,"movedTo",M);let O=y("tableCells");for(let x of ["inserted","deleted","merged","split"])S(O,"cells",x,["byAuthor","none",...editor.REVISION_MARKUP_COLORS],n.cells[x]);let b=y("formatting");p(b,"trackFormatting"),c(b,"formatting",M);let w=l("div");w.className="docx-revision-markup-actions";let R=(x,C)=>{let V=l("button",i(x));V.type="button",V.addEventListener("click",C),w.append(V);};R("reset",()=>e.reset()),R("cancel",()=>e.cancel()),R("ok",()=>{e.apply();}),o.append(w),e.container.append(o),g(),o.showModal(),o.querySelector("select")?.focus({preventScroll:true});},destroy(){N(),f();}}}function re(e,t){let o=store.findNode(e,t);return !o||o.kind!=="paragraph"?[]:store.revisionItemsOf({id:e.id,name:e.name,contentType:e.contentType,root:o})}function Ie(e,t,o,n){if(t.length===0)return [];let r=Q(e,t,{...o===void 0?{}:{payloads:o},...n===void 0?{}:{onDiagnostic:n}});if(r.length===0)return [];let a=store.locateSites(e),s=[];for(let d of r){let i=t.find(g=>g.name===d.name&&d.tag.startsWith(`${g.tagPrefix}:`));if(!i)continue;let l=i.reviewCard?i.reviewCard({attrs:d.attrs,text:d.text,...d.data===void 0?{}:{data:d.data}}):null;if(i.reviewCard&&l===null)continue;let f=a.get(d.nodeId);s.push({kind:"custom",id:d.nodeId,name:d.name,tag:d.tag,attrs:d.attrs,text:d.text,...d.data===void 0?{}:{data:d.data},carded:i.reviewCard!==void 0&&l!==null,title:l?.title??"",...l?.detail!==void 0?{detail:l.detail}:{},...l?.icon!==void 0?{icon:l.icon}:{},range:f?{partName:e.name,start:{paragraphId:f.paragraphId,offset:f.start},end:{paragraphId:f.paragraphId,offset:f.end}}:null});}return s}function ae(e){let t=store.collectReviewItems(e),o=(e.customNodes??[]).filter(Y);if(o.length===0)return t;let n=[e.storyPart],r=new Set([e.storyPart.name]);for(let i of e.furnitureParts??[])r.has(i.name)||(r.add(i.name),n.push(i));let a=[],s=new Map;for(let i of n){a.push(...Ie(i,o,e.customNodePayloads,e.reportCustomNodeDiagnostic));let l=s.size;for(let[f,g]of store.paragraphOrderOfPart(i))s.has(f)||s.set(f,l+g);}return a.length===0?t:[...t,...a].sort((i,l)=>layout.reviewItemPositionRank(i,s)-layout.reviewItemPositionRank(l,s))}function It(e={}){let t=e.pane===void 0?void 0:{...editor.resolveReviewPane(e.pane)};return chunkQLZH2Q2C_cjs.a(e.licenseKey),{id:"review",review:{createRevisionMarkupDialog:oe,displayModes:["all-markup","simple-markup","proposed","original"],collectReviewItems:ae,revisionItemsOfParagraph:re,...t?{pane:t}:{}}}}function de(e){return e.surface??null}function U(e,t){if(t==null)return null;let o=X(e,t);return o.ok?{ok:true,serialized:o.data,value:o.value}:{ok:false,reason:o.reason,issues:o.issues}}function W(e,t,o,n,r){let a=T(t),s=e.session.part().name;return {namespaceUri:a,rootLocalName:G,nodeId:r??J(e.session.currentPackage(),s,a),label:n,data:o}}function $(e){let t=e.detail?`${e.reason}: ${e.detail}`:e.reason;return {ok:false,code:Ae.has(e.reason)?"invalidArgs":"unsupported",reason:t}}var Ae=new Set(["payload-too-large","unaddressable-payload","store-not-authored","offset-out-of-range","invalid-range","invalid-property-value","splits-surrogate-pair"]);function K(e,t,o){let n,r;if(o!==void 0)try{n=e.text?.(o),r=e.tagAttrs?.(o);}catch(s){return {reason:`${e.name} could not describe this payload: ${s instanceof Error?s.message:String(s)}`}}let a=t.text??n;return a===void 0?{reason:e.text?`${e.name} derives its text from \`data\`, so pass one \u2014 or pass \`text\` directly`:`${e.name} declares no \`text\`, so \`text\` is required`}:t.attrs===void 0&&e.tagAttrs&&r===void 0?{reason:`${e.name} derives its tag attrs from \`data\`, so pass one \u2014 or pass \`attrs\` directly`}:{attrs:t.attrs??r??{},text:a}}function L(e){return e.getEditingMode()==="viewing"?{ok:false,code:"locked",reason:"the document is open for viewing"}:null}function se(e){let t=e.getActiveScope();if(t.kind==="headerFooter")return {kind:"headerFooter",rId:t.rId};if(t.kind==="note"){let o=store.parseNoteScopeId(t.id);if(o)return {kind:"notesPart",noteKind:o.noteKind}}return {kind:"body"}}function _(e,t){let o=de(e),n=t===void 0?"":t.slice(0,t.indexOf("#"));if(!o||n.length===0)return se(e);if(n===o.session.part().name)return {kind:"body"};for(let r of o.session.headerFooterResolutionBySection())for(let a of [r.headers,r.footers])for(let s of a.values())if(s.partName===n)return {kind:"headerFooter",rId:s.rId};for(let r of ["footnote","endnote"])if(o.session.partFor({kind:"notesPart",noteKind:r})?.name===n)return {kind:"notesPart",noteKind:r};return se(e)}function Mt(e,t,o={}){let n=de(e);if(!n)return {ok:false,code:"notFound",reason:"no document is mounted"};let r=U(t,o.data);if(r&&!r.ok)return D(r.reason,r.issues);let a=K(t,o,r?.value);if("reason"in a)return {ok:false,code:"invalidArgs",reason:a.reason};let s=E(t.tagPrefix,t.name,a.attrs);if(!s.ok)return {ok:false,code:"invalidArgs",reason:`the encoded tag is ${s.length} characters; Word caps w:tag at 64 \u2014 move what does not fit into the payload (\`data\`), or shorten the attrs`};let d=L(e);if(d)return d;n.flushPendingInput();let i=o.at??n.state().selection.head,l=o.lock===void 0?"contentLocked":o.lock,f=_(e,i.paragraphId),g=n.session.insertCustomNode({paragraphId:i.paragraphId,offset:i.offset,tag:s.tag,text:a.text,...o.alias===void 0?{}:{alias:o.alias},...l===false?{}:{lock:l},...r?{payload:W(n,t,r.serialized,a.text)}:{}},f);return g.ok?{ok:true,changed:true,...g.nodeId===void 0?{}:{nodeId:g.nodeId}}:$(g)}function ie(e){return e.surface??null}function _e(e,t){let o=null,n=a=>a.id===t?true:a.kind==="textValue"?false:a.children.some(n),r=(a,s)=>{if(!(o||a.kind==="textValue"||s>64)){if(a.kind==="paragraph"){n(a)&&(o=a);return}for(let d of a.children)r(d,s+1);}};return r(e.root,0),o}function Ve(e,t){let o=new Set,n=i=>{if(o.add(i.id),i.kind!=="textValue")for(let l of i.children)n(l);},r=i=>{if(i.id===t)return i;if(i.kind==="textValue")return null;for(let l of i.children){let f=r(l);if(f)return f}return null},a=r(e);if(!a)return null;n(a);let s=Number.MAX_SAFE_INTEGER,d=-1;for(let i of store.segmentsOf(e))o.has(i.runId)&&(i.start<s&&(s=i.start),i.end>d&&(d=i.end));return d<0?null:{start:s,end:d}}function jt(e,t){let o=ie(e);if(!o)return {ok:false,code:"notFound",reason:"no document is mounted"};let n=L(e);if(n)return n;o.flushPendingInput();let r=o.session.removeCustomNode(t,_(e,t));return r.ok?{ok:true,changed:true}:$(r)}function Ut(e,t,o,n={}){let r=ie(e);if(!r)return {ok:false,code:"notFound",reason:"no document is mounted"};let a=L(e);if(a)return a;r.flushPendingInput();let s=_(e,o),d=r.session.partFor(s)??r.session.part(),i=_e(d,o),l=i?Ve(i,o):null,f=He(r,o,s);if(!i||!l||!f)return {ok:false,code:"notFound",reason:"no custom node with that id"};let g=`${t.tagPrefix}:${t.name}`;if(f.identity!==null&&f.identity!==g)return {ok:false,code:"invalidArgs",reason:`node ${o} is a ${f.identity}, not a ${g}`};let k=ze(r,o,s),N=n.data===null?null:n.data===void 0?Fe(k):U(t,n.data);if(N&&!N.ok)return D(N.reason,N.issues);let S=K(t,{attrs:n.attrs??(n.data===void 0?f.attrs:void 0),text:n.text??(N===null&&n.data===null?f.text:void 0)},N?.value);if("reason"in S)return {ok:false,code:"invalidArgs",reason:S.reason};let c=E(t.tagPrefix,t.name,S.attrs);if(!c.ok)return {ok:false,code:"invalidArgs",reason:`the encoded tag is ${c.length} characters; Word caps w:tag at 64 \u2014 move what does not fit into the payload (\`data\`), or shorten the attrs`};let p=n.alias??f.alias,m=n.lock??f.lock,u=r.session.insertCustomNode({replaceControlId:o,paragraphId:i.id,offset:l.start,tag:c.tag,text:S.text,...p===void 0?{}:{alias:p},...m===false||m===void 0?{}:{lock:m},...N?{payload:W(r,t,N.serialized,S.text,k?.nodeId)}:{}},s);return u.ok?{ok:true,changed:true,...u.nodeId===void 0?{}:{nodeId:u.nodeId}}:$(u)}function He(e,t,o){let n=e.session.partFor(o)??e.session.part(),r=store.contentControlsIn(n.root).find(i=>i.node.id===t);if(!r)return null;let a=store.contentControlPropertiesOf(r.node),s=a.tag===void 0?null:P(a.tag),d=a.lock;return {identity:s?`${s.prefix}:${s.name}`:null,attrs:s?.attrs??{},text:store.contentControlTextOf(r.node),alias:a.alias,lock:d==="sdtLocked"||d==="sdtContentLocked"||d==="contentLocked"?d:d==="unlocked"?false:void 0}}function Fe(e){if(!e)return null;let t=A(void 0,e.data);return t.ok?{ok:true,serialized:e.data,value:t.value}:{ok:false,reason:`the stored payload is not readable: ${t.issues.join(", ")}`,issues:[]}}function ze(e,t,o){let n=e.session.partFor(o)??e.session.part();return store.customNodePayloadsByControl(e.session.currentPackage(),n.name,e.session.part().name).get(t)}exports.a=je;exports.b=E;exports.c=P;exports.d=We;exports.e=A;exports.f=F;exports.g=G;exports.h=T;exports.i=X;exports.j=Y;exports.k=q;exports.l=ot;exports.m=nt;exports.n=Q;exports.o=It;exports.p=Mt;exports.q=jt;exports.r=Ut;
|
package/dist/chunk-JRHEYVVY.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
'use strict';var collaboration=require('@docx-editor.dev/core/collaboration');function x(e,o,r={}){let a=(Array.isArray(o)?o:[o]).flatMap(n=>n.kind==="revision"?[n.key]:[]),{author:l,date:i}=r;return !e||a.length===0||i!==void 0&&(!(i instanceof Date)||Number.isNaN(i.getTime()))?false:e.exec({type:"setReviewChangesAuthor",keys:a,...l===void 0?{}:{author:l},...i===void 0?{}:{date:i.toISOString()}}).ok}function I(e,o,r){let t=e.closest(".docx-editor__scroll-container")??e.offsetParent;if(!t)return ()=>{};let a=l=>{if(l.defaultPrevented||l.button!==0||!o.snapshot().selectionCollapsed)return;let i=l.target;if(!(i instanceof Element)||e.contains(i))return;let n=i.closest(".docx-paginated-surface");if(!n||!t.contains(n))return;let s=n.closest(".docx-editor__scroll-container");if(s&&s!==t)return;let d=o.getReviewItems({placement:false}).find(c=>c.isActive);d?.kind==="comment"&&!d.resolved&&r(d.key);};return t.addEventListener("click",a),()=>t.removeEventListener("click",a)}var f=8;function b(e){let o=/^var\(--doc-review-author-(\d{1,2})\)$/.exec(e);return o?Number(o[1])%f:null}function g(e,o,r,t){let a=new Map(e.map(n=>[n.author,n])),l=new Map,i=new Map;for(let n of o){if(i.has(n.actorId))continue;let s=collaboration.safeParticipantColor(t?.(n.name));if(s!==void 0){i.set(n.actorId,{color:s,slot:b(s)});continue}let d=collaboration.safeParticipantColor(n.color);if(d!==void 0){i.set(n.actorId,{color:d,slot:null});continue}let c=a.get(n.name),m=collaboration.safeParticipantColor(r?.(n.name));if(m!==void 0){i.set(n.actorId,{color:m,slot:b(m)??(c?c.slot%f:null)});continue}if(c!==void 0){let y=c.slot%f;i.set(n.actorId,{color:collaboration.safeParticipantColor(c.color)??`var(--doc-review-author-${y})`,slot:y});continue}let u=l.get(n.name);u===void 0&&(u=e.length+l.size,l.set(n.name,u)),i.set(n.actorId,{color:`var(--doc-review-author-${u%f})`,slot:u%f});}return i}function S(e,o,r,t){return g(e,[o],r,t).get(o.actorId)}function O(e){let o=e.trim().split(/\s+/,2),r="";for(let t of o){let a=[...t][0];a!==void 0&&(r+=a.toUpperCase());}return r}function P(e){return [...e].sort((o,r)=>{if(o.isLocal!==r.isLocal)return o.isLocal?-1:1;let t=o.name.localeCompare(r.name);return t!==0?t:o.actorId<r.actorId?-1:o.actorId>r.actorId?1:0})}function _(e,o,r){for(let t of e)if(t.author===o)return t.style?.avatarUrl;return r?.(o)?.avatarUrl}var v='a[href], button, input, select, textarea, [contenteditable]:not([contenteditable="false"]), .docx-review__reply-box';function R(e){return e instanceof Element&&e.closest(v)!==null}function T(e){return R(e)||e instanceof Element&&e.closest("[data-review-selectable]")!==null}var N=Object.freeze({connecting:"collaboration.status.connecting",offline:"collaboration.status.offline",offlinePaused:"collaboration.status.offlinePaused",syncing:"collaboration.status.syncing",waiting:"collaboration.status.waiting",stalled:"collaboration.status.stalled",editRefused:"collaboration.status.editRefused",outOfSync:"collaboration.status.outOfSync",upgradeRequired:"collaboration.status.upgradeRequired",newRoomRequired:"collaboration.status.newRoomRequired"}),w=new Set(["concurrent-seed","blob-digest-mismatch","blob-store-full","too-many-nodes","too-many-parts","too-many-relationships","too-many-children","too-many-attributes","tree-too-deep"]),C=new Set(["collaboration-format-mismatch","protocol-version-mismatch","schema-version-mismatch"]);function L(e){switch(e.status){case "inactive":case "destroyed":return null;case "initializing":return "connecting";case "error":return e.reasonCode!==void 0&&C.has(e.reasonCode)?"upgradeRequired":e.reasonCode!==void 0&&w.has(e.reasonCode)?"newRoomRequired":e.recovering?"syncing":"outOfSync";case "disconnected":return e.offlineEditing?"offline":"offlinePaused";case "ready":return e.waiting?e.stalled?"stalled":"waiting":e.refusedRecently?"editRefused":null}}exports.a=x;exports.b=I;exports.c=R;exports.d=T;exports.e=g;exports.f=S;exports.g=O;exports.h=P;exports.i=_;exports.j=N;exports.k=L;
|