revise 2.2.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/CHANGELOG.md +56 -1182
  2. package/LICENSE +24 -41
  3. package/README.md +103 -26
  4. package/agent.d.ts +139 -0
  5. package/chunks/chunk-U5X47PZ6.js +135 -0
  6. package/chunks/chunk-U6YKQBKL.js +15 -0
  7. package/chunks/chunk-ZLQVPMBN.js +1650 -0
  8. package/chunks/package-5SHL5FOJ.js +14 -0
  9. package/chunks/render-QD5VWKSV.js +109 -0
  10. package/cli-output.schema.json +1984 -0
  11. package/cli.js +3609 -0
  12. package/document.d.ts +320 -0
  13. package/docx.d.ts +73 -0
  14. package/errors.d.ts +14 -0
  15. package/index.d.ts +13 -975
  16. package/index.js +31 -1
  17. package/legacy/editor.d.ts +19 -0
  18. package/legacy/editor.js +16 -0
  19. package/legacy/server.d.ts +37 -0
  20. package/legacy/server.js +25 -0
  21. package/legacy/style.css +2 -0
  22. package/package.d.ts +23 -0
  23. package/package.json +49 -55
  24. package/render.d.ts +27 -0
  25. package/FONT-LICENSE-HAN-EXT-B.txt +0 -91
  26. package/FONT-LICENSE-KATEX.txt +0 -95
  27. package/FONT-LICENSE-LIBERATION.txt +0 -102
  28. package/FONT-LICENSE-NOTO-MULTILINGUAL.txt +0 -93
  29. package/FONT-LICENSE-NOTO-SANS-SC.txt +0 -93
  30. package/FONT-LICENSE-NOTO.txt +0 -94
  31. package/FONT-LICENSE-SOURCE-CODE-PRO.txt +0 -94
  32. package/FONT-LICENSE-SOURCE-SERIF-4.txt +0 -93
  33. package/THIRD-PARTY-NOTICES.md +0 -3376
  34. package/assets/historyMaterializeWorker-B51R08XN.js +0 -612
  35. package/backend.d.ts +0 -161
  36. package/backend.js +0 -3
  37. package/chunks/AgentPageRenderer-CH8kSTJn.js +0 -1
  38. package/chunks/AgentPageRenderer-P23XVguo.js +0 -1
  39. package/chunks/AttachmentDocumentImporter-B1WOaa7d.js +0 -1
  40. package/chunks/AttachmentDocumentImporter-CT_PJp_e.js +0 -1
  41. package/chunks/BidiText-Swm5fl9J.js +0 -160
  42. package/chunks/ColorParserFull-BKH72fK8.js +0 -446
  43. package/chunks/DocumentMutator-btiDK57e.js +0 -31
  44. package/chunks/DocumentScrubber-CMPfm_HF.js +0 -18
  45. package/chunks/DocumentScrubber-Cm2kH8op.js +0 -1
  46. package/chunks/DocumentScrubber-bJoKijol.js +0 -1
  47. package/chunks/DocumentStylesheet-DreoD7sD.js +0 -7
  48. package/chunks/DocxConverter-BcVG-p5K.js +0 -13
  49. package/chunks/DocxConverter-D2bO5RE-.js +0 -1125
  50. package/chunks/DocxConverter-haCfRuWb.js +0 -13
  51. package/chunks/DocxGraft-BRKh4mHQ.js +0 -1
  52. package/chunks/DocxGraft-BxSQtl12.js +0 -7
  53. package/chunks/DocxGraft-C9MBQCnf.js +0 -1
  54. package/chunks/FileImporter-CszqRfVU.js +0 -1
  55. package/chunks/FileImporter-DObFoCCn.js +0 -1
  56. package/chunks/HorizontalRuleOrnaments-gmUZ3R7Q.js +0 -3
  57. package/chunks/HtmlConverter-DwXB4IDh.js +0 -267
  58. package/chunks/ListNumbering-Qlu6AuRZ.js +0 -23
  59. package/chunks/MarkdownConverter-CUC8GgsS.js +0 -57
  60. package/chunks/MathRenderer-DT6GyJXb.js +0 -68
  61. package/chunks/OdtConverter-7h9HHMpL.js +0 -125
  62. package/chunks/OdtConverter-Ct4qypJk.js +0 -6
  63. package/chunks/OdtConverter-DFl__sJc.js +0 -6
  64. package/chunks/OfficeImportShared-BY6FdZ8d.js +0 -1
  65. package/chunks/OfficeImportShared-BrZoDM0j.js +0 -30
  66. package/chunks/OfficeImportShared-Bvm-mOyj.js +0 -1
  67. package/chunks/ParagraphDiffAnalysis-DrmStvmz.js +0 -36
  68. package/chunks/PdfConverter-1wyvoT7X.js +0 -21
  69. package/chunks/PdfConverter-BAoEHILo.js +0 -21
  70. package/chunks/PdfConverter-CKEvFj11.js +0 -448
  71. package/chunks/PdfImportService-BhLPp5uG.js +0 -2
  72. package/chunks/PdfImportService-xbzrN__L.js +0 -2
  73. package/chunks/RtfConverter-Bxn-enp8.js +0 -15
  74. package/chunks/RtfConverter-LZPzBDSr.js +0 -15
  75. package/chunks/RtfConverter-_bacXqr1.js +0 -186
  76. package/chunks/TableBorders-CwnF3jvH.js +0 -30
  77. package/chunks/TableGrid-DbroRucl.js +0 -12
  78. package/chunks/TextFileDecoder--rsVs3NR.js +0 -9
  79. package/chunks/TxtConverter-C7FOwHpH.js +0 -14
  80. package/chunks/UnicodeUtils-CXtusU4g.js +0 -10
  81. package/chunks/XmlConverter-7oo8oeQB.js +0 -2
  82. package/chunks/XmlConverter-DGORHJcZ.js +0 -96
  83. package/chunks/XmlConverter-DeLHReK_.js +0 -2
  84. package/chunks/__vite-browser-external-l0sNRNKZ.js +0 -0
  85. package/chunks/_commonjsHelpers-DaMA6jEr.js +0 -2
  86. package/chunks/_revise-sdk-lazy-harfbuzz-CDWdjF9f.js +0 -1
  87. package/chunks/_revise-sdk-lazy-harfbuzz-X8gnYTZL.js +0 -1
  88. package/chunks/ar-ComXvtmh.js +0 -13
  89. package/chunks/backend-DecaBz-I.js +0 -490
  90. package/chunks/base64-sSPOzq-u.js +0 -198
  91. package/chunks/browser-module-CFmqfGkE.js +0 -1791
  92. package/chunks/browser-module-Dj5o3kuL.js +0 -3
  93. package/chunks/browser-module-UuM_O36W.js +0 -3
  94. package/chunks/bundle.min-DRpfgV69.js +0 -782
  95. package/chunks/capture-1btcWcPF.js +0 -9
  96. package/chunks/carrier-DQeng6yq.js +0 -6
  97. package/chunks/de-BkbpIKxx.js +0 -13
  98. package/chunks/es-CKkXujOF.js +0 -13
  99. package/chunks/fil-piIHMc8F.js +0 -13
  100. package/chunks/footnoteFlatten-DUQticYy.js +0 -6
  101. package/chunks/fr-DuA8qLje.js +0 -13
  102. package/chunks/graftExport-CYnStOdU.js +0 -82
  103. package/chunks/html2canvas.esm-CntiHiYW.js +0 -997
  104. package/chunks/index-2TBhRkX7.js +0 -387
  105. package/chunks/index-BWdRWxoH.js +0 -1807
  106. package/chunks/index-Bf14eTEW.js +0 -1096
  107. package/chunks/index-BwcX_r62.js +0 -387
  108. package/chunks/index.es-CI0QPo8w.js +0 -780
  109. package/chunks/index.es-CI7cDExj.js +0 -5
  110. package/chunks/index.es-DHpGt6Y5.js +0 -5
  111. package/chunks/ja-DgrSs555.js +0 -13
  112. package/chunks/jspdf.es.min--GshOuIm.js +0 -77
  113. package/chunks/jspdf.es.min-DU74zN8b.js +0 -1792
  114. package/chunks/jspdf.es.min-DurJZ1zW.js +0 -77
  115. package/chunks/jszip.min-CPW0h1Kx.js +0 -476
  116. package/chunks/katex-DWj8TvwO.js +0 -1462
  117. package/chunks/pdf-BLWDCiFF.js +0 -1828
  118. package/chunks/persistInlineDocumentImages-DQj2iaqg.js +0 -1
  119. package/chunks/pseudoLocale-BoYTjmiK.js +0 -1
  120. package/chunks/pseudoLocale-DG2NnZmz.js +0 -1
  121. package/chunks/purify.es-BwLardii.js +0 -107
  122. package/chunks/serverDocumentSession-CJ1EH3Tp.js +0 -15
  123. package/chunks/signatures-Bwt_OGik.js +0 -17
  124. package/chunks/suggestionAuthorship-B-IuLQlE.js +0 -1
  125. package/chunks/tree-sitter-D6zWWUMP.js +0 -4
  126. package/chunks/wasmInline.generated-CBYFkdSM.js +0 -1
  127. package/chunks/web-tree-sitter-BXGZGnNj.js +0 -2
  128. package/chunks/zh-9OF3SWWO.js +0 -13
  129. package/full.js +0 -1
  130. package/root.d.ts +0 -5
  131. package/root.js +0 -2
  132. package/serverToolContract.d.ts +0 -391
  133. package/serverToolInputs.generated.d.ts +0 -250
  134. package/style.css +0 -1
@@ -0,0 +1,14 @@
1
+ // revise: MIT License. https://revise.io/developer/docs
2
+ import {
3
+ CAT_MATCH_LIMIT,
4
+ catPart,
5
+ listParts,
6
+ patchPackage
7
+ } from "./chunk-U5X47PZ6.js";
8
+ import "./chunk-U6YKQBKL.js";
9
+ export {
10
+ CAT_MATCH_LIMIT,
11
+ catPart,
12
+ listParts,
13
+ patchPackage
14
+ };
@@ -0,0 +1,109 @@
1
+ // revise: MIT License. https://revise.io/developer/docs
2
+ import {
3
+ ReviseError
4
+ } from "./chunk-U6YKQBKL.js";
5
+
6
+ // src/embed-sdk/lib/render.ts
7
+ import { engineModules } from "@reviseio/engine";
8
+ var VIEW_NAMES = {
9
+ tracked: "show-tracked-changes",
10
+ accepted: "show-with-tracked-changes-accepted",
11
+ original: "show-before-tracked-changes"
12
+ };
13
+ async function loadCanvasFactory() {
14
+ const attempts = [];
15
+ for (const moduleName of ["@napi-rs/canvas", "canvas"]) {
16
+ try {
17
+ const mod = await import(
18
+ /* @vite-ignore */
19
+ moduleName
20
+ );
21
+ const create = mod.createCanvas ?? mod.default?.createCanvas;
22
+ if (create) return create;
23
+ } catch (error) {
24
+ attempts.push(
25
+ `${moduleName}: ${error.message.split("\n")[0]}`
26
+ );
27
+ }
28
+ }
29
+ throw new ReviseError(
30
+ `Rendering pages needs a Node canvas. Install one next to revise: npm i @napi-rs/canvas
31
+ (${attempts.join("; ")})`,
32
+ "canvas_missing"
33
+ );
34
+ }
35
+ async function renderPages(ydoc, documentId, options) {
36
+ const createCanvas = await loadCanvasFactory();
37
+ const [
38
+ { DocumentSession },
39
+ { renderDocumentPagesForAgent, createHeadlessPageRenderHost },
40
+ { createStandardLayout },
41
+ { resolvePageLayoutSettings, getPageDimensionsPx }
42
+ ] = await Promise.all([
43
+ engineModules.documentSession(),
44
+ engineModules.pageRenderer(),
45
+ engineModules.documentLayout(),
46
+ engineModules.pageLayout()
47
+ ]);
48
+ const session = new DocumentSession(documentId, ydoc, void 0, {
49
+ disableHistory: true,
50
+ disableProposalPersistence: true
51
+ });
52
+ const editor = createHeadlessPageRenderHost(session);
53
+ const settings = resolvePageLayoutSettings(
54
+ session.getWorkingDocument().pageLayout
55
+ );
56
+ const dimensions = getPageDimensionsPx(settings);
57
+ let result;
58
+ try {
59
+ result = await renderDocumentPagesForAgent({
60
+ editor,
61
+ pageLayoutSettings: settings,
62
+ layout: createStandardLayout({
63
+ ...dimensions,
64
+ pageMargin: settings.marginLeftPx,
65
+ pageMarginTop: settings.marginTopPx,
66
+ pageMarginRight: settings.marginRightPx,
67
+ pageMarginBottom: settings.marginBottomPx,
68
+ pageMarginLeft: settings.marginLeftPx,
69
+ indentStepPx: settings.indentStepPx,
70
+ blockSpacingPx: settings.blockSpacingPx
71
+ }),
72
+ request: {
73
+ startPage: options.startPage ?? 1,
74
+ pageCount: options.pageCount ?? 1,
75
+ mode: options.layout ? "layout" : "appearance",
76
+ quality: options.quality ?? ((options.pageCount ?? 1) > 1 ? "compact" : "detailed"),
77
+ view: VIEW_NAMES[options.view ?? "tracked"]
78
+ },
79
+ createCanvas: () => createCanvas(1, 1)
80
+ });
81
+ } catch (error) {
82
+ const message = error.message;
83
+ if (/outside this \d+-page document/.test(message)) {
84
+ throw new ReviseError(message, "page_out_of_range");
85
+ }
86
+ if (error instanceof ReviseError) throw error;
87
+ throw new ReviseError(`Rendering failed: ${message}`, "render_failed", {
88
+ cause: error
89
+ });
90
+ } finally {
91
+ session.dispose();
92
+ }
93
+ const match = /^data:([^;]+);base64,([\s\S]*)$/.exec(result.dataUrl);
94
+ if (!match) throw new Error("The renderer returned an unexpected image.");
95
+ return {
96
+ bytes: new Uint8Array(Buffer.from(match[2], "base64")),
97
+ mimeType: match[1],
98
+ width: result.width,
99
+ height: result.height,
100
+ pages: result.pages,
101
+ totalPages: result.totalPages,
102
+ placeholderImageCount: result.placeholderImageCount,
103
+ failedImageCount: result.failedImageCount,
104
+ description: result.snapshot.description
105
+ };
106
+ }
107
+ export {
108
+ renderPages
109
+ };