texlite 0.14.0 → 0.16.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/DESIGN.md +94 -4
- package/README.md +5 -2
- package/README.zh-CN.md +5 -2
- package/dist/client/assets/AdminUsers-Dyapv-3c.js +1 -0
- package/dist/client/assets/CitationLibraryDialog-CU7Q7r0Z.js +1 -0
- package/dist/client/assets/Dashboard-DsdhFENx.js +2 -0
- package/dist/client/assets/GitDialog-CZpnKw-J.js +3 -0
- package/dist/client/assets/{GitHubAccountDialog-yUPMZj-e.js → GitHubAccountDialog-CZ8O_PjD.js} +1 -1
- package/dist/client/assets/{HistoryDialog-CZK-cFfU.js → HistoryDialog-DWYErBwj.js} +3 -3
- package/dist/client/assets/LatexEditor-CssVgypt.js +141 -0
- package/dist/client/assets/{PdfPreview-BqohZpfh.js → PdfPreview-BjghzUb1.js} +1 -1
- package/dist/client/assets/{ProjectIconPickerDialog-63_apW1i.js → ProjectIconPickerDialog-CqRmgFBM.js} +1 -1
- package/dist/client/assets/{ProjectNavigationDialogs-D8I4OJQB.js → ProjectNavigationDialogs-BZxI3PJO.js} +1 -1
- package/dist/client/assets/ProjectSettings-CZE_xDKn.js +1 -0
- package/dist/client/assets/ProjectWorkspace-CAX3qEYr.js +32 -0
- package/dist/client/assets/{SelectionHistoryDialog-DiYNdIe5.js → SelectionHistoryDialog-CR5c3I8k.js} +2 -2
- package/dist/client/assets/{SystemMetricsDialog-B9cIXfPM.js → SystemMetricsDialog-DDpFwgXh.js} +1 -1
- package/dist/client/assets/{TagManagementDialog-DqGTPckP.js → TagManagementDialog-CXLA9h_j.js} +1 -1
- package/dist/client/assets/WordCountDialog-DUyR24vv.js +1 -0
- package/dist/client/assets/check-CwBYzomT.js +1 -0
- package/dist/client/assets/chevron-up-D5lCNKlk.js +1 -0
- package/dist/client/assets/chktex-CRkLYKcV.js +3 -0
- package/dist/client/assets/{citationLibrary-ZeQPCv5O.js → citationLibrary-C9WnXB-1.js} +2 -2
- package/dist/client/assets/{external-link-DtHz2OWn.js → external-link-C9Td1CCj.js} +1 -1
- package/dist/client/assets/{github-B3ClW0wI.js → github-D-JDXb-w.js} +1 -1
- package/dist/client/assets/{hard-drive-A2DTDrXg.js → hard-drive-Ctj3K_zx.js} +1 -1
- package/dist/client/assets/{index-Bgr9VmTh.js → index-9hnQ8Q9x.js} +1 -1
- package/dist/client/assets/index-C0qg2Ylw.css +1 -0
- package/dist/client/assets/index-DkpU9Fgs.js +10 -0
- package/dist/client/assets/index-_eYe7K9T.js +1 -0
- package/dist/client/assets/{minimize-2-CjavrBs6.js → minimize-2-BiVyoWZA.js} +1 -1
- package/dist/client/assets/{minus-417bfmnF.js → minus-Bl8l4LXq.js} +1 -1
- package/dist/client/assets/{plus-CCRSrXDi.js → plus-CCxK-HNt.js} +1 -1
- package/dist/client/assets/react-CltQJflK.js +49 -0
- package/dist/client/assets/{refresh-cw-0bKWvgVy.js → refresh-cw-BE8IbaHI.js} +1 -1
- package/dist/client/assets/{search-DhHW3xg7.js → search-CPbhRWQE.js} +1 -1
- package/dist/client/assets/{sigma-ggAZwYZs.js → sigma-LxGD9tK2.js} +1 -1
- package/dist/client/assets/spellCheck-hpm8qZTr.js +1 -0
- package/dist/client/assets/{tags-jYRdvWMN.js → tags-DuN89PsZ.js} +1 -1
- package/dist/client/assets/{type-CZnTyitQ.js → type-BiettCiY.js} +1 -1
- package/dist/client/assets/{x-CUwbFgRb.js → x-C_3swJOC.js} +1 -1
- package/dist/client/index.html +4 -4
- package/dist/client/texlite-icon.svg +8 -0
- package/dist/server/anchors.js +57 -96
- package/dist/server/auth.js +0 -3
- package/dist/server/chktex.js +3 -4
- package/dist/server/collaboration.js +34 -1
- package/dist/server/db.js +9 -1
- package/dist/server/i18n.js +4 -0
- package/dist/server/latexCompletion.js +11 -88
- package/dist/server/projectOutline.js +4 -39
- package/dist/server/projectSearch.js +0 -4
- package/dist/server/routes/citations.js +22 -0
- package/dist/server/routes/comments.js +4 -4
- package/dist/server/routes/projectShared.js +11 -2
- package/dist/server/routes/users.js +21 -3
- package/dist/shared/bibtexReferences.js +5 -1
- package/dist/shared/latexCompletion.js +1 -0
- package/dist/shared/latexReferences.js +13 -3
- package/dist/shared/latexSymbols.js +77 -0
- package/dist/shared/sourceCommentAnchors.js +128 -0
- package/package.json +1 -1
- package/dist/client/assets/AdminUsers-BMwfVHyu.js +0 -1
- package/dist/client/assets/CitationLibraryDialog-D_GkXecF.js +0 -1
- package/dist/client/assets/Dashboard-DhKiB4Lp.js +0 -2
- package/dist/client/assets/GitDialog-DHwqaGWR.js +0 -3
- package/dist/client/assets/LatexEditor-BuLjoc1X.js +0 -141
- package/dist/client/assets/ProjectSettings-ChIKBc0N.js +0 -1
- package/dist/client/assets/ProjectWorkspace-D8vBa8aq.js +0 -32
- package/dist/client/assets/WordCountDialog-B0pBzLsg.js +0 -1
- package/dist/client/assets/check-6jrUH-ay.js +0 -1
- package/dist/client/assets/chktex-Cp2H8q1t.js +0 -3
- package/dist/client/assets/index-DNQd-LXW.css +0 -1
- package/dist/client/assets/index-DprUq41V.js +0 -10
- package/dist/client/assets/react-BVUjbTTn.js +0 -49
- package/dist/client/assets/spellCheck-JOkkBKD7.js +0 -1
- package/dist/client/assets/user-plus-DFkFh0mU.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"./index-
|
|
1
|
+
import{c as e}from"./index-DkpU9Fgs.js";const t=e("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);export{t as R};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c}from"./index-
|
|
1
|
+
import{c}from"./index-DkpU9Fgs.js";const r=c("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);export{r as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as a}from"./index-
|
|
1
|
+
import{c as a}from"./index-DkpU9Fgs.js";const e=a("Sigma",[["path",{d:"M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",key:"wuwx1p"}]]);export{e as S};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as w,A as L}from"./index-DkpU9Fgs.js";import{s as y,c as S}from"./ProjectWorkspace-CAX3qEYr.js";import"./react-CltQJflK.js";import"./chevron-up-D5lCNKlk.js";import"./check-CwBYzomT.js";import"./x-C_3swJOC.js";import"./search-CPbhRWQE.js";import"./index-_eYe7K9T.js";import"./refresh-cw-BE8IbaHI.js";const k=5,f=new Map,C=12,x=S();let E=0;class p extends Error{constructor(){super("A newer writing check replaced this request."),this.name="HarperLintSupersededError"}}function N(e){return e instanceof p}function $(e){const t=[0];let r=0;for(const n of e)r+=n.length,t.push(r);return t}function d(e){return[...new Set(e.map(t=>t.trim()).filter(Boolean))].sort((t,r)=>t.localeCompare(r)).join("\0")}async function v(e,t,r,n){try{return(await w(`/api/projects/${e}/spellcheck`,{method:"POST",body:JSON.stringify({path:t,source:r,clientId:x,sequence:n})})).lints}catch(o){throw o instanceof L&&o.code==="SPELLCHECK_SUPERSEDED"?new p:o}}function A(e,t,r){if(!t.problem)return null;const n={from:t.start,to:t.end},o={from:r[t.start]??-1,to:r[t.end]??-1},i=c=>c.from>=0&&c.to>c.from&&c.to<=e.length,a=c=>i(c)&&e.slice(c.from,c.to)===t.problem;return a(o)?o:a(n)?n:null}function H(e,t,r){const n=A(e,t,r);if(!n)return null;const{from:o,to:i}=n,a=e.slice(o,i);if(!a.trim()||!/[A-Za-z]/.test(a)||t.kind==="Formatting")return null;const c=t.kind==="Spelling"||t.kind==="Typo"?"spelling":"grammar",u=t.suggestions.filter((m,s,l)=>s<k&&l.indexOf(m)===s);return{from:o,to:i,word:a,kind:c,message:t.message,suggestions:u}}function h(e,t){let r=2166136261;for(let n=0;n<t.length;n+=1)r^=t.charCodeAt(n),r=Math.imul(r,16777619);return`${e}\0${t.length}:${r>>>0}`}function g(e,t,r){const n=h(e,t),o=f.get(n);return!o||o.path!==e||o.source!==t||o.dictionary!==r?null:(f.delete(n),f.set(n,o),o.issues)}function R(e,t,r,n){const o=h(e,t);for(f.set(o,{path:e,source:t,dictionary:r,issues:n});f.size>C;){const i=f.keys().next().value;if(i===void 0)break;f.delete(i)}}async function b(e,t,r,n="main.tex"){const o=d(t),i=g(n,e,o);if(i)return i;const a=$(e),c=new Set(t.map(s=>s.trim().toLocaleLowerCase("en-US")).filter(Boolean)),u=new Set,m=r.map(s=>H(e,s,a)).filter(s=>!!s).filter(s=>s.kind!=="spelling"||!c.has(s.word.trim().toLocaleLowerCase("en-US"))).filter(s=>{const l=`${s.from}:${s.to}:${s.kind}`;return u.has(l)?!1:(u.add(l),!0)}).sort((s,l)=>s.from-l.from||s.to-l.to);return R(n,e,o,m),m}async function P(e,t,r,n){const o=d(n),i=g(t,r,o);if(i)return i;const a=await v(e,t,r,++E);return b(r,n,a,t)}function T(e,t,r,n=[]){return y(t)?P(e,t,r,n):Promise.resolve([])}export{p as HarperLintSupersededError,N as isHarperLintSupersededError,T as lintLatex,b as mapLatexLints};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as a}from"./index-
|
|
1
|
+
import{c as a}from"./index-DkpU9Fgs.js";const e=a("Tags",[["path",{d:"m15 5 6.3 6.3a2.4 2.4 0 0 1 0 3.4L17 19",key:"1cbfv1"}],["path",{d:"M9.586 5.586A2 2 0 0 0 8.172 5H3a1 1 0 0 0-1 1v5.172a2 2 0 0 0 .586 1.414L8.29 18.29a2.426 2.426 0 0 0 3.42 0l3.58-3.58a2.426 2.426 0 0 0 0-3.42z",key:"135mg7"}],["circle",{cx:"6.5",cy:"9.5",r:".5",fill:"currentColor",key:"5pm5xn"}]]);export{e as T};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"./index-
|
|
1
|
+
import{c as e}from"./index-DkpU9Fgs.js";const n=e("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);export{n as T};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as a}from"./index-
|
|
1
|
+
import{c as a}from"./index-DkpU9Fgs.js";const t=a("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const h=a("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]);const y=a("BookMarked",[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);const k=a("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);const d=a("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const p=a("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const c=a("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);const s=a("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);const r=a("FileArchive",[["path",{d:"M10 12v-1",key:"v7bkov"}],["path",{d:"M10 18v-2",key:"1cjy8d"}],["path",{d:"M10 7V6",key:"dljcrl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01",key:"gkbcor"}],["circle",{cx:"10",cy:"20",r:"2",key:"1xzdoj"}]]);const l=a("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);const o=a("FileSearch",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]]);const n=a("FileSpreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);const M=a("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const i=a("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);const v=a("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);const x=a("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);const m=a("ListTree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]);const H=a("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);const q=a("NotepadText",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"16",height:"18",x:"4",y:"4",rx:"2",key:"1u9h20"}],["path",{d:"M8 10h6",key:"3oa6kw"}],["path",{d:"M8 14h8",key:"1fgep2"}],["path",{d:"M8 18h5",key:"17enja"}]]);const u=a("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);const g=a("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);const f=a("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const w=a("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const z=a("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);const b=a("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);const F=a("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);export{h as A,y as B,p as C,c as D,s as E,o as F,x as G,m as L,H as M,q as N,u as P,g as S,f as T,b as U,F as X,v as a,n as b,l as c,k as d,M as e,t as f,z as g,i as h,d as i,r as j,w as k};
|
package/dist/client/index.html
CHANGED
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500;600&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&family=Source+Code+Pro:wght@400;500;600&display=swap" />
|
|
12
12
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource/iosevka@5.2.5/400.css" />
|
|
13
13
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource/iosevka@5.2.5/600.css" />
|
|
14
|
-
<link rel="icon" type="image/svg+xml" href="
|
|
14
|
+
<link rel="icon" type="image/svg+xml" href="texlite-icon.svg" />
|
|
15
15
|
<title>TexLite</title>
|
|
16
|
-
<script type="module" crossorigin src="./assets/index-
|
|
17
|
-
<link rel="modulepreload" crossorigin href="./assets/react-
|
|
18
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
16
|
+
<script type="module" crossorigin src="./assets/index-DkpU9Fgs.js"></script>
|
|
17
|
+
<link rel="modulepreload" crossorigin href="./assets/react-CltQJflK.js">
|
|
18
|
+
<link rel="stylesheet" crossorigin href="./assets/index-C0qg2Ylw.css">
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
|
21
21
|
<div id="root"></div>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64" role="img" aria-labelledby="t" xmlns:c2pa="http://c2pa.org/manifest"><metadata><c2pa:manifest>AAAWgmp1bWIAAAAeanVtZGMycGEAEQAQgAAAqgA4m3EDYzJwYQAAABZcanVtYgAAAEdqdW1kYzJtYQARABCAAACqADibcQN1cm46YzJwYTplZjg5YjM5My1lNjAwLTQ0NTItYWU5OC0yYzM2YmY2ZTJlODYAAAADl2p1bWIAAAApanVtZGMyYXMAEQAQgAAAqgA4m3EDYzJwYS5hc3NlcnRpb25zAAAAALxqdW1iAAAARGp1bWRjYm9yABEAEIAAAKoAOJtxE2MycGEuaW5ncmVkaWVudC52MwAAAAAYYzJzaLUd1FJdJGH5jIwitE5HqGwAAABwY2JvcqNpZGM6Zm9ybWF0bWltYWdlL3N2Zyt4bWxqaW5zdGFuY2VJRHgseG1wOmlpZDo0MzRjMDg5NS05NmQwLTQ5OTItYjRiYS0yMzUwNGRhMzJlMTVscmVsYXRpb25zaGlwaHBhcmVudE9mAAAB4mp1bWIAAABBanVtZGNib3IAEQAQgAAAqgA4m3ETYzJwYS5hY3Rpb25zLnYyAAAAABhjMnNo4FUWXkgHx+vY7+/ya6DnlAAAAZljYm9yomdhY3Rpb25zgqJmYWN0aW9ua2MycGEub3BlbmVkanBhcmFtZXRlcnOha2luZ3JlZGllbnRzgaJjdXJseC1zZWxmI2p1bWJmPWMycGEuYXNzZXJ0aW9ucy9jMnBhLmluZ3JlZGllbnQudjNkaGFzaFggmBWz1qNBNvWck2QA8dxqwl9VcRRBfeBPqRNKVk48pwqkZmFjdGlvbngdY29tLmFudGhyb3BpYy5jbGF1ZGUucHJvdmlkZWRqcGFyYW1ldGVyc6F4H2Nvb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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPZYQLuFaZnwpJUNQtLeprsklaEPiRtBapLZUytS9YAKH2lHCK7eAsGaJRtGmX28d/viiGF8E9ZSo73SqTcZ5X3qxSA=</c2pa:manifest></metadata>
|
|
2
|
+
<title id="t">TexLite</title>
|
|
3
|
+
<rect width="64" height="64" rx="15" fill="#E9F5EE"/>
|
|
4
|
+
<g fill="none" stroke-width="6" stroke-linecap="round" stroke-linejoin="round">
|
|
5
|
+
<path stroke="#133D2B" d="M13.5 16.5H31.5M22.5 16.5V41.5"/>
|
|
6
|
+
<path stroke="#1B8A57" d="M42.5 23.5V48.5M42.5 23.5H50.5M42.5 36H48.5M42.5 48.5H50.5"/>
|
|
7
|
+
</g>
|
|
8
|
+
</svg>
|
package/dist/server/anchors.js
CHANGED
|
@@ -1,116 +1,77 @@
|
|
|
1
1
|
import diff_match_patch from "diff-match-patch";
|
|
2
|
-
|
|
2
|
+
import { anchorSource, mapSourceAnchor, sourceAnchorAt } from "../shared/sourceCommentAnchors.js";
|
|
3
3
|
export function createSourceAnchor(source, startInput, endInput) {
|
|
4
|
-
|
|
5
|
-
const endOffset = clamp(Math.max(startInput, endInput), startOffset, source.length);
|
|
6
|
-
return anchorAt(source, startOffset, endOffset, false);
|
|
4
|
+
return sourceAnchorAt(anchorSource(source), startInput, endInput);
|
|
7
5
|
}
|
|
8
|
-
export function reanchorFileComments(db, projectId, filePath, oldSource, newSource) {
|
|
6
|
+
export function reanchorFileComments(db, projectId, filePath, oldSource, newSource, editBatches) {
|
|
9
7
|
if (oldSource === newSource)
|
|
10
8
|
return;
|
|
11
|
-
const
|
|
12
|
-
const diffs = dmp.diff_main(oldSource, newSource, true);
|
|
13
|
-
dmp.diff_cleanupSemantic(diffs);
|
|
14
|
-
const comments = db.prepare(`SELECT id, selected_text, start_offset, end_offset, context_before, context_after
|
|
9
|
+
const comments = db.prepare(`SELECT id, selected_text, start_offset, end_offset, context_before, context_after, orphaned
|
|
15
10
|
FROM comments WHERE project_id = ? AND file_path = ?`).all(projectId, filePath);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
11
|
+
if (!comments.length)
|
|
12
|
+
return;
|
|
13
|
+
// Validate the chain before using it. Disk/HTTP replacements have no Yjs
|
|
14
|
+
// chain, and must fall back to comparing their before/after snapshots.
|
|
15
|
+
const originalAnchors = comments.map((comment) => ({
|
|
16
|
+
startOffset: comment.start_offset, endOffset: comment.end_offset,
|
|
17
|
+
selectedText: comment.selected_text, contextBefore: comment.context_before,
|
|
18
|
+
contextAfter: comment.context_after, orphaned: Boolean(comment.orphaned)
|
|
19
|
+
}));
|
|
20
|
+
let anchors = originalAnchors;
|
|
21
|
+
let replayed = oldSource;
|
|
22
|
+
for (const batch of editBatches ?? []) {
|
|
23
|
+
let after = "";
|
|
24
|
+
let cursor = 0;
|
|
25
|
+
for (const edit of batch) {
|
|
26
|
+
after += replayed.slice(cursor, edit.from) + edit.insert;
|
|
27
|
+
cursor = edit.to;
|
|
32
28
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
after += replayed.slice(cursor);
|
|
30
|
+
anchors = anchors.map((anchor) => mapSourceAnchor(anchor, anchorSource(replayed), anchorSource(after), batch));
|
|
31
|
+
replayed = after;
|
|
32
|
+
}
|
|
33
|
+
if (!editBatches?.length || replayed !== newSource) {
|
|
34
|
+
const dmp = new diff_match_patch();
|
|
35
|
+
const diffs = dmp.diff_main(oldSource, newSource, true);
|
|
36
|
+
dmp.diff_cleanupSemantic(diffs);
|
|
37
|
+
const changes = [];
|
|
38
|
+
let offset = 0;
|
|
39
|
+
let pending = null;
|
|
40
|
+
for (const [kind, text] of diffs) {
|
|
41
|
+
if (kind === 0) {
|
|
42
|
+
if (pending)
|
|
43
|
+
changes.push(pending);
|
|
44
|
+
pending = null;
|
|
45
|
+
offset += text.length;
|
|
37
46
|
}
|
|
38
47
|
else {
|
|
39
|
-
|
|
40
|
-
|
|
48
|
+
pending ??= { from: offset, to: offset, insertLength: 0, inferred: true };
|
|
49
|
+
if (kind === -1) {
|
|
50
|
+
offset += text.length;
|
|
51
|
+
pending.to = offset;
|
|
52
|
+
}
|
|
53
|
+
else
|
|
54
|
+
pending.insertLength += text.length;
|
|
41
55
|
}
|
|
42
56
|
}
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
update.run(orphaned ? comment.selected_text : anchor.selectedText, anchor.startOffset, anchor.endOffset, anchor.contextBefore, anchor.contextAfter, Number(anchor.orphaned), new Date().toISOString(), comment.id);
|
|
57
|
+
if (pending)
|
|
58
|
+
changes.push(pending);
|
|
59
|
+
anchors = originalAnchors.map((anchor) => mapSourceAnchor(anchor, anchorSource(oldSource), anchorSource(newSource), changes));
|
|
47
60
|
}
|
|
61
|
+
const update = db.prepare(`UPDATE comments SET selected_text = ?, start_offset = ?, end_offset = ?,
|
|
62
|
+
context_before = ?, context_after = ?, orphaned = ?, updated_at = ? WHERE id = ?`);
|
|
63
|
+
db.transaction(() => {
|
|
64
|
+
for (const [index, comment] of comments.entries()) {
|
|
65
|
+
const anchor = anchors[index];
|
|
66
|
+
update.run(anchor.selectedText, anchor.startOffset, anchor.endOffset, anchor.contextBefore, anchor.contextAfter, Number(anchor.orphaned), new Date().toISOString(), comment.id);
|
|
67
|
+
}
|
|
68
|
+
})();
|
|
48
69
|
}
|
|
49
70
|
export function offsetToLine(source, offsetInput) {
|
|
50
|
-
const offset =
|
|
71
|
+
const offset = Math.max(0, Math.min(source.length, Number.isFinite(offsetInput) ? Math.floor(offsetInput) : 0));
|
|
51
72
|
let line = 1;
|
|
52
73
|
for (let index = 0; index < offset; index += 1)
|
|
53
74
|
if (source.charCodeAt(index) === 10)
|
|
54
75
|
line += 1;
|
|
55
76
|
return line;
|
|
56
77
|
}
|
|
57
|
-
function anchorAt(source, startOffset, endOffset, orphaned) {
|
|
58
|
-
return {
|
|
59
|
-
startOffset,
|
|
60
|
-
endOffset,
|
|
61
|
-
selectedText: source.slice(startOffset, endOffset),
|
|
62
|
-
contextBefore: source.slice(Math.max(0, startOffset - CONTEXT_SIZE), startOffset),
|
|
63
|
-
contextAfter: source.slice(endOffset, Math.min(source.length, endOffset + CONTEXT_SIZE)),
|
|
64
|
-
orphaned
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
function nearestContextualMatch(source, selected, expected, contextBefore, contextAfter) {
|
|
68
|
-
if (!selected)
|
|
69
|
-
return null;
|
|
70
|
-
let best = null;
|
|
71
|
-
let bestRank = Number.NEGATIVE_INFINITY;
|
|
72
|
-
let cursor = 0;
|
|
73
|
-
while (cursor <= source.length) {
|
|
74
|
-
const found = source.indexOf(selected, cursor);
|
|
75
|
-
if (found < 0)
|
|
76
|
-
break;
|
|
77
|
-
const distance = Math.abs(found - expected);
|
|
78
|
-
const before = source.slice(Math.max(0, found - contextBefore.length), found);
|
|
79
|
-
const after = source.slice(found + selected.length, found + selected.length + contextAfter.length);
|
|
80
|
-
const contextScore = commonSuffixLength(before, contextBefore) + commonPrefixLength(after, contextAfter);
|
|
81
|
-
// Do not relocate based solely on proximity. A repeated word with no
|
|
82
|
-
// matching context is ambiguous and must be surfaced as orphaned.
|
|
83
|
-
const availableContext = contextBefore.length + contextAfter.length;
|
|
84
|
-
if (availableContext === 0)
|
|
85
|
-
return null;
|
|
86
|
-
const minimumContext = Math.min(4, availableContext);
|
|
87
|
-
if (contextScore < minimumContext) {
|
|
88
|
-
cursor = found + Math.max(1, selected.length);
|
|
89
|
-
continue;
|
|
90
|
-
}
|
|
91
|
-
const rank = contextScore * 1000 - distance;
|
|
92
|
-
if (rank > bestRank) {
|
|
93
|
-
best = found;
|
|
94
|
-
bestRank = rank;
|
|
95
|
-
}
|
|
96
|
-
cursor = found + Math.max(1, selected.length);
|
|
97
|
-
}
|
|
98
|
-
return best;
|
|
99
|
-
}
|
|
100
|
-
function commonPrefixLength(left, right) {
|
|
101
|
-
const limit = Math.min(left.length, right.length);
|
|
102
|
-
let index = 0;
|
|
103
|
-
while (index < limit && left[index] === right[index])
|
|
104
|
-
index += 1;
|
|
105
|
-
return index;
|
|
106
|
-
}
|
|
107
|
-
function commonSuffixLength(left, right) {
|
|
108
|
-
const limit = Math.min(left.length, right.length);
|
|
109
|
-
let count = 0;
|
|
110
|
-
while (count < limit && left[left.length - 1 - count] === right[right.length - 1 - count])
|
|
111
|
-
count += 1;
|
|
112
|
-
return count;
|
|
113
|
-
}
|
|
114
|
-
function clamp(value, min, max) {
|
|
115
|
-
return Math.max(min, Math.min(max, Number.isFinite(value) ? Math.floor(value) : min));
|
|
116
|
-
}
|
package/dist/server/auth.js
CHANGED
|
@@ -13,9 +13,6 @@ export function publicUser(user) {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
const requestUserCache = new WeakMap();
|
|
16
|
-
export function clearCurrentUserCache(request) {
|
|
17
|
-
requestUserCache.delete(request);
|
|
18
|
-
}
|
|
19
16
|
export function currentUser(request, db) {
|
|
20
17
|
if (requestUserCache.has(request)) {
|
|
21
18
|
return requestUserCache.get(request) ?? null;
|
package/dist/server/chktex.js
CHANGED
|
@@ -120,7 +120,7 @@ export class ChktexService {
|
|
|
120
120
|
reject = rejectOperation;
|
|
121
121
|
});
|
|
122
122
|
const scheduled = {
|
|
123
|
-
key, source,
|
|
123
|
+
key, source, started: false, cancelled: false,
|
|
124
124
|
lanes: laneKey ? new Set([laneKey]) : new Set(), hasUnscopedWaiter: laneKey === null,
|
|
125
125
|
promise: operation, resolve, reject
|
|
126
126
|
};
|
|
@@ -191,7 +191,6 @@ export class ChktexService {
|
|
|
191
191
|
discardQueued(scheduled) {
|
|
192
192
|
this.queued.delete(scheduled);
|
|
193
193
|
scheduled.source = "";
|
|
194
|
-
scheduled.filePath = "";
|
|
195
194
|
}
|
|
196
195
|
acceptLaneSequence(lane, sequence, key) {
|
|
197
196
|
if (!Number.isSafeInteger(sequence) || sequence <= 0)
|
|
@@ -239,7 +238,7 @@ export class ChktexService {
|
|
|
239
238
|
}
|
|
240
239
|
async runScheduled(scheduled) {
|
|
241
240
|
try {
|
|
242
|
-
scheduled.resolve(await this.lintOnce(scheduled.source
|
|
241
|
+
scheduled.resolve(await this.lintOnce(scheduled.source));
|
|
243
242
|
}
|
|
244
243
|
catch (error) {
|
|
245
244
|
scheduled.reject(error);
|
|
@@ -270,7 +269,7 @@ export class ChktexService {
|
|
|
270
269
|
.finally(() => { this.probePromise = null; });
|
|
271
270
|
return this.probePromise;
|
|
272
271
|
}
|
|
273
|
-
async lintOnce(source
|
|
272
|
+
async lintOnce(source) {
|
|
274
273
|
await this.ensureAvailable();
|
|
275
274
|
// With no filename ChkTeX reads stdin. Passing `-` is interpreted as a
|
|
276
275
|
// literal filename by ChkTeX 1.7.x and silently produces no diagnostics.
|
|
@@ -701,6 +701,7 @@ export class CollaborationService {
|
|
|
701
701
|
observedContent: new Map(),
|
|
702
702
|
dirtyPaths: new Set(),
|
|
703
703
|
pendingEditSegments: [],
|
|
704
|
+
pendingCommentEdits: new Map(),
|
|
704
705
|
textObservers: new Map(),
|
|
705
706
|
saveTimer: null,
|
|
706
707
|
stateSaveTimer: null,
|
|
@@ -874,6 +875,7 @@ export class CollaborationService {
|
|
|
874
875
|
// edit record; keeping this mirror current prevents later edits from
|
|
875
876
|
// being mapped across such a replacement.
|
|
876
877
|
room.observedContent.set(filePath, after);
|
|
878
|
+
room.pendingCommentEdits.delete(filePath);
|
|
877
879
|
return;
|
|
878
880
|
}
|
|
879
881
|
if (!room.allowedPaths.has(filePath)) {
|
|
@@ -888,6 +890,35 @@ export class CollaborationService {
|
|
|
888
890
|
const connection = transaction.origin;
|
|
889
891
|
this.recordEditStep(room, filePath, connection, event, before, after);
|
|
890
892
|
}
|
|
893
|
+
if (before !== after) {
|
|
894
|
+
const edits = [];
|
|
895
|
+
let offset = 0;
|
|
896
|
+
let pending = null;
|
|
897
|
+
for (const delta of event.delta) {
|
|
898
|
+
if (delta.retain) {
|
|
899
|
+
if (pending)
|
|
900
|
+
edits.push(pending);
|
|
901
|
+
pending = null;
|
|
902
|
+
offset += delta.retain;
|
|
903
|
+
}
|
|
904
|
+
else if (delta.delete || typeof delta.insert === "string") {
|
|
905
|
+
pending ??= { from: offset, to: offset, insert: "", insertLength: 0 };
|
|
906
|
+
if (delta.delete) {
|
|
907
|
+
offset += delta.delete;
|
|
908
|
+
pending.to = offset;
|
|
909
|
+
}
|
|
910
|
+
if (typeof delta.insert === "string") {
|
|
911
|
+
pending.insert += delta.insert;
|
|
912
|
+
pending.insertLength += delta.insert.length;
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
if (pending)
|
|
917
|
+
edits.push(pending);
|
|
918
|
+
const batches = room.pendingCommentEdits.get(filePath) ?? [];
|
|
919
|
+
batches.push(edits);
|
|
920
|
+
room.pendingCommentEdits.set(filePath, batches);
|
|
921
|
+
}
|
|
891
922
|
room.observedContent.set(filePath, after);
|
|
892
923
|
room.dirtyPaths.add(filePath);
|
|
893
924
|
};
|
|
@@ -1415,7 +1446,7 @@ export class CollaborationService {
|
|
|
1415
1446
|
room.dirtyPaths.delete(filePath);
|
|
1416
1447
|
finalizedPaths.add(filePath);
|
|
1417
1448
|
try {
|
|
1418
|
-
reanchorFileComments(this.db, room.projectId, filePath, previous, next);
|
|
1449
|
+
reanchorFileComments(this.db, room.projectId, filePath, previous, next, room.pendingCommentEdits.get(filePath));
|
|
1419
1450
|
}
|
|
1420
1451
|
catch { /* Source durability is primary; comments can still be re-anchored by a later edit. */ }
|
|
1421
1452
|
changed = true;
|
|
@@ -1426,6 +1457,8 @@ export class CollaborationService {
|
|
|
1426
1457
|
// A reverted edit or rejected oversized file did not produce a durable
|
|
1427
1458
|
// source revision, so it must not become a misleading edit-history row.
|
|
1428
1459
|
if (finalizedPaths.size > 0) {
|
|
1460
|
+
for (const filePath of finalizedPaths)
|
|
1461
|
+
room.pendingCommentEdits.delete(filePath);
|
|
1429
1462
|
room.pendingEditSegments = room.pendingEditSegments.filter((segment) => !finalizedPaths.has(segment.filePath));
|
|
1430
1463
|
}
|
|
1431
1464
|
if (changed && room.lastModifiedUserId) {
|
package/dist/server/db.js
CHANGED
|
@@ -19,7 +19,15 @@ const databaseMigrations = [
|
|
|
19
19
|
return;
|
|
20
20
|
db.exec("ALTER TABLE projects ADD COLUMN chktex_enabled INTEGER NOT NULL DEFAULT 0 CHECK (chktex_enabled IN (0, 1))");
|
|
21
21
|
} },
|
|
22
|
-
{ version: 3, name: "move_github_tokens_to_user_accounts", apply: migrateGitHubTokensToUsers }
|
|
22
|
+
{ version: 3, name: "move_github_tokens_to_user_accounts", apply: migrateGitHubTokensToUsers },
|
|
23
|
+
{ version: 4, name: "add_comment_resolution_metadata", apply: (db) => {
|
|
24
|
+
if (missingColumn(db, "comments", "resolved_by")) {
|
|
25
|
+
db.exec("ALTER TABLE comments ADD COLUMN resolved_by TEXT REFERENCES users(id) ON DELETE SET NULL");
|
|
26
|
+
}
|
|
27
|
+
if (missingColumn(db, "comments", "resolved_at")) {
|
|
28
|
+
db.exec("ALTER TABLE comments ADD COLUMN resolved_at TEXT");
|
|
29
|
+
}
|
|
30
|
+
} }
|
|
23
31
|
];
|
|
24
32
|
function migrateGitHubTokensToUsers(db) {
|
|
25
33
|
db.exec(`
|
package/dist/server/i18n.js
CHANGED
|
@@ -10,6 +10,7 @@ const enMessages = {
|
|
|
10
10
|
CITATION_LIBRARY_PRIVATE: "Citation libraries are private to their owner.",
|
|
11
11
|
CITATION_NOT_FOUND: "The citation does not exist.",
|
|
12
12
|
CITATION_TAG_NOT_FOUND: "The citation tag does not exist.",
|
|
13
|
+
CITATION_TAG_NAME_EXISTS: "A citation tag with this name already exists.",
|
|
13
14
|
CITATION_TOO_LARGE: "The BibTeX entry is too large.",
|
|
14
15
|
CHK_TEX_SOURCE_INVALID: "The source to check is invalid.",
|
|
15
16
|
CHK_TEX_SOURCE_TOO_LARGE: "The source to check is too large.",
|
|
@@ -92,6 +93,7 @@ const enMessages = {
|
|
|
92
93
|
RESERVED_PATH: "This path is reserved by TexLite.",
|
|
93
94
|
SEARCH_QUERY_INVALID: "The search or replacement text is invalid.",
|
|
94
95
|
SELF_DELETE_FORBIDDEN: "You cannot delete the currently signed-in administrator.",
|
|
96
|
+
SELF_RESTRICT_FORBIDDEN: "You cannot disable or demote the currently signed-in administrator.",
|
|
95
97
|
SERVER_ERROR: "The server could not complete the request.",
|
|
96
98
|
SOURCE_FILE_NOT_FOUND: "The source file does not exist.",
|
|
97
99
|
SOURCE_FLUSH_FAILED: "Some source files could not be saved. The project operation was cancelled.",
|
|
@@ -147,6 +149,7 @@ const zhMessages = {
|
|
|
147
149
|
CITATION_LIBRARY_PRIVATE: "引用库仅对其所有者可见。",
|
|
148
150
|
CITATION_NOT_FOUND: "引用条目不存在。",
|
|
149
151
|
CITATION_TAG_NOT_FOUND: "引用标签不存在。",
|
|
152
|
+
CITATION_TAG_NAME_EXISTS: "已存在同名的引用标签。",
|
|
150
153
|
CITATION_TOO_LARGE: "BibTeX 条目过大。",
|
|
151
154
|
CHK_TEX_SOURCE_INVALID: "待检查源码格式不正确。",
|
|
152
155
|
CHK_TEX_SOURCE_TOO_LARGE: "待检查源码过大。",
|
|
@@ -229,6 +232,7 @@ const zhMessages = {
|
|
|
229
232
|
RESERVED_PATH: "此路径由 TexLite 保留。",
|
|
230
233
|
SEARCH_QUERY_INVALID: "搜索或替换内容格式不正确。",
|
|
231
234
|
SELF_DELETE_FORBIDDEN: "不能删除当前登录的管理员。",
|
|
235
|
+
SELF_RESTRICT_FORBIDDEN: "不能禁用当前登录的管理员或降低其角色权限。",
|
|
232
236
|
SERVER_ERROR: "服务器内部错误",
|
|
233
237
|
SOURCE_FILE_NOT_FOUND: "源码文件不存在。",
|
|
234
238
|
SOURCE_FLUSH_FAILED: "部分源码未能保存至磁盘,项目操作已取消。",
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { maskLatexComments, maskLatexLiteralContent } from "../shared/latexLiterals.js";
|
|
2
|
+
import { listProjectFilesAsync, resolveSourcePath } from "./files.js";
|
|
3
|
+
import { extractLatexSymbols } from "../shared/latexSymbols.js";
|
|
5
4
|
import { findLatexReferenceDefinitions } from "../shared/latexReferences.js";
|
|
6
5
|
import { declaredBibliographyPaths, latexDocumentDirectives } from "./latexDocumentGraph.js";
|
|
7
6
|
const textExtensions = /\.(?:tex|sty|cls|def|cfg|bib|bst|fd|dtx|ins)$/i;
|
|
@@ -111,9 +110,6 @@ function createIndex() {
|
|
|
111
110
|
commands: new Map(), environments: new Map(), labels: new Map(), citations: new Map(), packages: new Map(), classes: new Map(), files: new Map()
|
|
112
111
|
};
|
|
113
112
|
}
|
|
114
|
-
function withoutComments(content) {
|
|
115
|
-
return maskLatexComments(maskLatexLiteralContent(content));
|
|
116
|
-
}
|
|
117
113
|
function commandItem(index, name, detail, source, apply) {
|
|
118
114
|
if (!name.startsWith("\\"))
|
|
119
115
|
name = `\\${name}`;
|
|
@@ -126,60 +122,15 @@ function commandItem(index, name, detail, source, apply) {
|
|
|
126
122
|
index.commands.set(name, item(name, detail, "function", source, apply));
|
|
127
123
|
}
|
|
128
124
|
function extractSymbols(index, filePath, original) {
|
|
129
|
-
const
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
const arguments_ = newCommandArguments(Number.parseInt(match[2] ?? "0", 10), Boolean(match[3]));
|
|
133
|
-
commandItem(index, `\\${match[1]}`, `Project command (${arguments_.length} argument${arguments_.length === 1 ? "" : "s"})`, source, commandSnippet(`\\${match[1]}`, arguments_));
|
|
134
|
-
}
|
|
135
|
-
for (const definition of xparseCommandDefinitions(content)) {
|
|
136
|
-
const arguments_ = xparseCommandArguments(definition.specification);
|
|
137
|
-
const detail = arguments_
|
|
138
|
-
? `Project command (${arguments_.length} argument${arguments_.length === 1 ? "" : "s"})`
|
|
139
|
-
: "Project command";
|
|
140
|
-
commandItem(index, `\\${definition.name}`, detail, source, arguments_ ? commandSnippet(`\\${definition.name}`, arguments_) : undefined);
|
|
141
|
-
}
|
|
142
|
-
for (const match of content.matchAll(/\\(?:def|gdef|edef|xdef)\s*\\([A-Za-z@][A-Za-z@0-9:_]*)((?:\s*#\d+)*)/g)) {
|
|
143
|
-
const args = [...(match[2] ?? "").matchAll(/#\d+/g)].length;
|
|
144
|
-
commandItem(index, `\\${match[1]}`, "Project macro", source, commandSnippet(`\\${match[1]}`, newCommandArguments(args, false)));
|
|
145
|
-
}
|
|
146
|
-
for (const match of content.matchAll(/\\DeclareMathOperator\s*\*?\s*\{?\\([A-Za-z@][A-Za-z@0-9:_]*)\}?/g))
|
|
147
|
-
commandItem(index, `\\${match[1]}`, "Project math operator", source);
|
|
148
|
-
for (const match of content.matchAll(/\\DeclarePairedDelimiter\s*\{?\\([A-Za-z@][A-Za-z@0-9:_]*)\}?/g))
|
|
149
|
-
commandItem(index, `\\${match[1]}`, "Project math delimiter", source);
|
|
150
|
-
for (const match of content.matchAll(/\\cs_(?:new|set|gset|provide|generate)(?:_protected)?\:[A-Za-z]+\s+\\([A-Za-z@][A-Za-z@0-9:_]*)/g))
|
|
151
|
-
commandItem(index, `\\${match[1]}`, "Expl3 project command", source);
|
|
152
|
-
for (const match of content.matchAll(/\\(?:newenvironment|renewenvironment|NewDocumentEnvironment|RenewDocumentEnvironment|DeclareDocumentEnvironment)\s*\*?\s*\{([^}]+)\}/g)) {
|
|
153
|
-
const name = match[1].trim();
|
|
154
|
-
const existing = index.environments.get(name);
|
|
155
|
-
if (/^[A-Za-z][A-Za-z0-9*_-]*$/.test(name) && (!existing || (existing.source === "LaTeX" && source !== "LaTeX"))) {
|
|
156
|
-
index.environments.set(name, item(name, "Project environment", "keyword", source));
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
for (const match of content.matchAll(/\\(?:newtheorem|declaretheorem)\s*\*?\s*\{([^}]+)\}/g)) {
|
|
160
|
-
const name = match[1].trim();
|
|
161
|
-
const existing = index.environments.get(name);
|
|
162
|
-
if (/^[A-Za-z][A-Za-z0-9*_-]*$/.test(name) && (!existing || (existing.source === "LaTeX" && source !== "LaTeX"))) {
|
|
163
|
-
index.environments.set(name, item(name, "Theorem environment", "keyword", source));
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
for (const definition of findLatexReferenceDefinitions(content, "label")) {
|
|
167
|
-
if (definition.source !== "label")
|
|
168
|
-
continue;
|
|
169
|
-
const label = definition.key;
|
|
170
|
-
if (label && !index.labels.has(label))
|
|
171
|
-
index.labels.set(label, item(label, "Label", "constant", source));
|
|
172
|
-
}
|
|
173
|
-
for (const match of content.matchAll(/\\(?:input|include|subfile|import)\s*(?:\{([^}]+)\}|\s+([^\s%]+))/g)) {
|
|
174
|
-
const file = (match[1] ?? match[2] ?? "").trim();
|
|
175
|
-
if (file)
|
|
176
|
-
index.files.set(file, item(file, "Project file", "text", source));
|
|
125
|
+
const symbols = extractLatexSymbols(original);
|
|
126
|
+
for (const symbol of symbols.commands) {
|
|
127
|
+
commandItem(index, symbol.label, symbol.detail, filePath, symbol.apply);
|
|
177
128
|
}
|
|
178
|
-
for (const
|
|
179
|
-
for (const
|
|
180
|
-
const
|
|
181
|
-
if (!
|
|
182
|
-
|
|
129
|
+
for (const group of ["environments", "labels", "packages", "classes", "files"]) {
|
|
130
|
+
for (const symbol of symbols[group]) {
|
|
131
|
+
const existing = index[group].get(symbol.label);
|
|
132
|
+
if (!existing || existing.source === "LaTeX")
|
|
133
|
+
index[group].set(symbol.label, { ...symbol, source: filePath });
|
|
183
134
|
}
|
|
184
135
|
}
|
|
185
136
|
// `\\bibitem` suggestions are scoped by the client to the file currently
|
|
@@ -190,7 +141,7 @@ function extractSymbols(index, filePath, original) {
|
|
|
190
141
|
for (const definition of findLatexReferenceDefinitions(original, "citation", true)) {
|
|
191
142
|
const key = definition.key;
|
|
192
143
|
if (key && !index.citations.has(key))
|
|
193
|
-
index.citations.set(key, item(key, "BibTeX key", "constant",
|
|
144
|
+
index.citations.set(key, item(key, "BibTeX key", "constant", filePath));
|
|
194
145
|
}
|
|
195
146
|
}
|
|
196
147
|
}
|
|
@@ -216,34 +167,6 @@ function addProjectFile(index, filePath) {
|
|
|
216
167
|
index.classes.set(name, item(name, "Document class", "class", filePath));
|
|
217
168
|
}
|
|
218
169
|
}
|
|
219
|
-
export function buildLatexCompletionIndex(config, projectId) {
|
|
220
|
-
const index = standardIndex();
|
|
221
|
-
const allEntries = listProjectFiles(config, projectId).filter((entry) => entry.type === "file").slice(0, maxIndexedFiles);
|
|
222
|
-
for (const entry of allEntries)
|
|
223
|
-
addProjectFile(index, entry.path);
|
|
224
|
-
const entries = allEntries.filter((entry) => textExtensions.test(entry.path));
|
|
225
|
-
let indexedBytes = 0;
|
|
226
|
-
for (const entry of entries) {
|
|
227
|
-
const absolute = resolveSourcePath(config, projectId, entry.path);
|
|
228
|
-
let content;
|
|
229
|
-
try {
|
|
230
|
-
const size = fs.statSync(absolute).size;
|
|
231
|
-
if (size > maxIndexedFileBytes || indexedBytes + size > maxIndexedBytes)
|
|
232
|
-
continue;
|
|
233
|
-
indexedBytes += size;
|
|
234
|
-
content = fs.readFileSync(absolute, "utf8");
|
|
235
|
-
}
|
|
236
|
-
catch {
|
|
237
|
-
continue;
|
|
238
|
-
}
|
|
239
|
-
if (definitionExtensions.test(entry.path) || /\.bib$/i.test(entry.path))
|
|
240
|
-
extractSymbols(index, entry.path, content);
|
|
241
|
-
}
|
|
242
|
-
return {
|
|
243
|
-
commands: sorted(index.commands), environments: sorted(index.environments), labels: sorted(index.labels),
|
|
244
|
-
citations: sorted(index.citations), packages: sorted(index.packages), classes: sorted(index.classes), files: sorted(index.files)
|
|
245
|
-
};
|
|
246
|
-
}
|
|
247
170
|
/** Reuses extracted symbols for files whose mtime and size did not change. */
|
|
248
171
|
export class LatexCompletionService {
|
|
249
172
|
config;
|