@w100n/documents 0.15.1 → 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/dist/index.js CHANGED
@@ -12,12 +12,14 @@ import {
12
12
  rove,
13
13
  useRestore
14
14
  } from "./chunk-TDP6OJET.js";
15
+ import {
16
+ texts
17
+ } from "./chunk-RKV3N6OS.js";
15
18
  import {
16
19
  escape,
17
20
  readDocx,
18
- texts,
19
21
  writeDocx
20
- } from "./chunk-CAPICJ6B.js";
22
+ } from "./chunk-ZAVXCH7V.js";
21
23
 
22
24
  // src/DocumentOverlay.tsx
23
25
  import { Download, ExternalLink, FileSpreadsheet, FileText, FileType, Files, Presentation, X as X4 } from "lucide-react";
@@ -2407,8 +2409,8 @@ function PdfView({ bytes, t, language, worker, rights, host, documentId, onSaved
2407
2409
 
2408
2410
  // src/DocumentOverlay.tsx
2409
2411
  import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
2410
- var TextEditor = lazy(() => import("./TextEditor-D6QH2B7O.js"));
2411
- var SheetView = lazy(() => import("./SheetView-RPQS43XY.js"));
2412
+ var TextEditor = lazy(() => import("./TextEditor-MGCSGGGA.js"));
2413
+ var SheetView = lazy(() => import("./SheetView-EFBSMY7K.js"));
2412
2414
  var icons = { docx: FileText, markdown: FileType, pdf: Files, sheet: FileSpreadsheet, slides: Presentation };
2413
2415
  var read = { view: true, comment: false, edit: false };
2414
2416
  var quiet = () => {
@@ -2519,6 +2521,7 @@ import {
2519
2521
  Check as Check2,
2520
2522
  ChevronDown as ChevronDown2,
2521
2523
  ChevronRight as ChevronRight2,
2524
+ FileDiff,
2522
2525
  FileDown,
2523
2526
  FilePlus,
2524
2527
  FileSpreadsheet as FileSpreadsheet3,
@@ -3097,8 +3100,9 @@ function Thumb({ host, item, label }) {
3097
3100
 
3098
3101
  // src/DocumentsWorkspace.tsx
3099
3102
  import { Fragment as Fragment8, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
3100
- var TextEditor2 = lazy2(() => import("./TextEditor-D6QH2B7O.js"));
3101
- var SheetView2 = lazy2(() => import("./SheetView-RPQS43XY.js"));
3103
+ var TextEditor2 = lazy2(() => import("./TextEditor-MGCSGGGA.js"));
3104
+ var SheetView2 = lazy2(() => import("./SheetView-EFBSMY7K.js"));
3105
+ var Compare = lazy2(() => import("./Compare-M57FG4R3.js"));
3102
3106
  var icons3 = { docx: FileText3, markdown: FileType3, pdf: Files2, sheet: FileSpreadsheet3, slides: Presentation3 };
3103
3107
  function DocumentsWorkspace({ host, language = "en", theme = "light", place, onPlace, start, end, aside, actions }) {
3104
3108
  const t = texts[language];
@@ -3175,6 +3179,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3175
3179
  const [fold, setFold] = useState9({});
3176
3180
  const [version, setVersion] = useState9({ documentId: null, id: null });
3177
3181
  const versionId = version.documentId === here.documentId ? version.id : null;
3182
+ const [comparing, setComparing] = useState9(false);
3178
3183
  const [restoring, setRestoring] = useState9("idle");
3179
3184
  const [exporting, setExporting] = useState9("idle");
3180
3185
  const [copying, setCopying] = useState9("idle");
@@ -3271,6 +3276,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3271
3276
  if (id === versionId) return;
3272
3277
  ask(() => {
3273
3278
  setRestoring("idle");
3279
+ setComparing(false);
3274
3280
  setVersion({ documentId: here.documentId, id });
3275
3281
  });
3276
3282
  };
@@ -3362,6 +3368,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3362
3368
  content.retry();
3363
3369
  });
3364
3370
  else if (!doc.data || !content.data) stage = /* @__PURE__ */ jsx9("div", { className: "w100n-docs-empty", children: t.loading });
3371
+ else if (comparing && versionId && (doc.data.kind === "markdown" || doc.data.kind === "docx")) stage = /* @__PURE__ */ jsx9(Suspense2, { fallback: /* @__PURE__ */ jsx9("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx9(Compare, { host, documentId: doc.data.id, kind: doc.data.kind, older: content.data, t }, versionId) });
3365
3372
  else if (doc.data.kind === "markdown" || doc.data.kind === "docx") stage = /* @__PURE__ */ jsx9(Suspense2, { fallback: /* @__PURE__ */ jsx9("div", { className: "w100n-docs-empty", children: t.loading }), children: /* @__PURE__ */ jsx9(
3366
3373
  TextEditor2,
3367
3374
  {
@@ -3550,6 +3557,10 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3550
3557
  ] }, i)) }) : /* @__PURE__ */ jsx9("span", { className: "w100n-docs-hint", children: t.hint })
3551
3558
  ] }),
3552
3559
  versionId && /* @__PURE__ */ jsx9("span", { className: "w100n-docs-badge", children: versions.data?.find((v) => v.id === versionId) && date(versions.data.find((v) => v.id === versionId).createdAt) }),
3560
+ versionId && text && /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-action", "data-tone": "blue", "aria-pressed": comparing, onClick: () => setComparing(!comparing), children: [
3561
+ /* @__PURE__ */ jsx9(FileDiff, { "aria-hidden": true }),
3562
+ comparing ? t.hideChanges : t.showChanges
3563
+ ] }),
3553
3564
  versionId && here.documentId && host.restore && doc.data?.rights.edit && /* @__PURE__ */ jsxs9("button", { type: "button", className: "w100n-docs-action", disabled: restoring === "busy", onClick: () => void restore(here.documentId, versionId), children: [
3554
3565
  /* @__PURE__ */ jsx9(RotateCcw2, { "aria-hidden": true }),
3555
3566
  t.restore
@@ -3876,8 +3887,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3876
3887
  import { lazy as lazy3, Suspense as Suspense3, useRef as useRef7, useState as useState10 } from "react";
3877
3888
  import { Ban as Ban2, Download as Download3, Eye as Eye2, FileDown as FileDown2, FileSpreadsheet as FileSpreadsheet4, FileText as FileText4, FileType as FileType4, Files as Files3, Lock as Lock2, Presentation as Presentation4, UserRound } from "lucide-react";
3878
3889
  import { Fragment as Fragment9, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
3879
- var TextEditor3 = lazy3(() => import("./TextEditor-D6QH2B7O.js"));
3880
- var SheetView3 = lazy3(() => import("./SheetView-RPQS43XY.js"));
3890
+ var TextEditor3 = lazy3(() => import("./TextEditor-MGCSGGGA.js"));
3891
+ var SheetView3 = lazy3(() => import("./SheetView-EFBSMY7K.js"));
3881
3892
  var icons4 = { docx: FileText4, markdown: FileType4, pdf: Files3, sheet: FileSpreadsheet4, slides: Presentation4 };
3882
3893
  var GuestRefused = class extends Error {
3883
3894
  constructor(reason, file = "", sharedBy = "") {