@particle-academy/last-word-ui 0.6.0 → 0.7.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.d.cts CHANGED
@@ -283,6 +283,12 @@ interface DocViewerLayout {
283
283
  * Absent when there is none. The visible notice says the same thing.
284
284
  */
285
285
  notShown?: string[];
286
+ /**
287
+ * JSON Pointers to the document's `revision` keys (tracked changes), which this
288
+ * viewer does not show: deleted and moved-away text is hidden and a notice says so.
289
+ * Absent when there are none.
290
+ */
291
+ revisions?: string[];
286
292
  }
287
293
  type ViewerFont = "carlito" | "fallback" | "unused";
288
294
  /** How long the viewer waits for the bundled font before laying out without it. */
@@ -342,7 +348,10 @@ interface DocViewerProps {
342
348
  * (1-based); each block or fragment of one `data-block` (`b0`, `b1`, ... in
343
349
  * document order); each footnote `data-footnote`; bands `data-lw-band`, with
344
350
  * `data-lw-band-variant` naming the one drawn (`default`, `first`, `even`);
345
- * `data-lw-layout-notice` when the document asks for page layout it does not show.
351
+ * `data-lw-layout-notice` when the document asks for page layout it does not show;
352
+ * `data-lw-tracked-changes` on the root and `data-lw-tracked-changes-notice` (with
353
+ * `data-lw-revisions`, the count) when it carries tracked changes, which it does not
354
+ * show either: deleted and moved-away text is hidden (a fail-safe, see revisions.ts).
346
355
  * A `pageBreak` carrying `page` changes the page from there on, each page drawn and
347
356
  * its text measured at its own size.
348
357
  *
@@ -402,6 +411,33 @@ declare const LAYOUT_NOTICE = "Some page settings in this document aren't shown.
402
411
  */
403
412
  declare function unshownLayout(doc: Doc): string[];
404
413
 
414
+ /**
415
+ * A FAIL-SAFE for tracked changes, not support for them.
416
+ *
417
+ * last-word's model can carry a `revision` key: on a run (`insert`, `delete`,
418
+ * `moveFrom`, `moveTo`, `format`, with `author`, `date`, `name`), on a paragraph or
419
+ * heading block (its paragraph mark) and on a list item. This viewer cannot show
420
+ * revisions. Drawing the document as if they were not there would present DELETED
421
+ * text as live text, so a document carrying any revision draws with this notice, and
422
+ * a deleted or moved-away run is not drawn at all.
423
+ */
424
+ declare const TRACKED_CHANGES_NOTICE = "This document has tracked changes, which this viewer can't show yet. Accept them first. Deleted text is hidden.";
425
+ /**
426
+ * Whether a run's text must not be drawn: it was deleted, or moved away from here.
427
+ * FAILS SAFE: a `revision` it cannot read counts as deleted, because hiding text
428
+ * under a visible notice is recoverable and showing deleted text as live is not.
429
+ */
430
+ declare function isDeletedRun(run: Run): boolean;
431
+ /**
432
+ * JSON Pointers to every `revision` key in the document: the body, quotes, table
433
+ * cells, list items at any depth, footnotes and the page bands. A chart's `option` is
434
+ * arbitrary chart data and is not read. Nothing here trusts the Doc's shape, and the
435
+ * walk is iterative: the nesting is the file's.
436
+ */
437
+ declare function revisionPaths(doc: Doc): string[];
438
+ /** Whether the document carries any tracked change. A host can check this before showing it. */
439
+ declare function hasRevisions(doc: Doc): boolean;
440
+
405
441
  /**
406
442
  * The page packer: measured heights in, page assignments out.
407
443
  *
@@ -744,4 +780,4 @@ interface FootnoteNumbering {
744
780
  */
745
781
  declare function numberFootnotes(doc: Doc): FootnoteNumbering;
746
782
 
747
- export { type Align, type Band, type BandHeights, type BandKind, type BandSlot, type Block, type BlockFragment, type BlockItem, type BlocksBand, type BodyBox, type Border, type BorderStyle, type BoxBorders, type BoxSides, type BreakItem, CARLITO_FACES, CARLITO_FAMILY, type ChartBlock, type ChartRenderArgs, type CodeBlock, type Doc, type DocMeta, DocViewer, type DocViewerLayout, type DocViewerProps, FONT_LOAD_TIMEOUT_MS, type Footnote, type FootnoteMark, type FootnoteNumbering, type Fragment, type HeadingBlock, type HrBlock, type ImageBlock, LAYOUT_NOTICE, type ListBlock, type ListItem, OFFICE_PALETTE, type Orientation, PAGE_BAND_DISTANCE_DEFAULT, PAGE_MARGIN_DEFAULT, PAGE_SIZES_PT, PX_PER_PT, type PackInput, type PackItem, type PackOptions, type Page, type PageBreakBlock, type PageClass, type PageFields, type PageGeometry, type PageLayout, type PageMargins, type PageSize, type ParagraphBlock, type ParagraphProps, type QuoteBlock, type RenderChart, type ResolvedMargins, type Run, type Stretch, type TableBlock, type TableBorders, type TableCell, type TableFragment, type TableItem, type TableRow, type TableRowItem, type VAlign, type ViewerFont, bandSlot, blockStretches, bodyBox, carlitoFaces, docFromReader, docStretches, fontFaceCss, formatDatePicture, numberFootnotes, packInput, pageBand, pageBodyBoxes, pageCapacity, pageChartOption, pageClass, pageClassIn, pageGeometry, pageMargins, paginate, resolveNow, substituteFields, unshownLayout };
783
+ export { type Align, type Band, type BandHeights, type BandKind, type BandSlot, type Block, type BlockFragment, type BlockItem, type BlocksBand, type BodyBox, type Border, type BorderStyle, type BoxBorders, type BoxSides, type BreakItem, CARLITO_FACES, CARLITO_FAMILY, type ChartBlock, type ChartRenderArgs, type CodeBlock, type Doc, type DocMeta, DocViewer, type DocViewerLayout, type DocViewerProps, FONT_LOAD_TIMEOUT_MS, type Footnote, type FootnoteMark, type FootnoteNumbering, type Fragment, type HeadingBlock, type HrBlock, type ImageBlock, LAYOUT_NOTICE, type ListBlock, type ListItem, OFFICE_PALETTE, type Orientation, PAGE_BAND_DISTANCE_DEFAULT, PAGE_MARGIN_DEFAULT, PAGE_SIZES_PT, PX_PER_PT, type PackInput, type PackItem, type PackOptions, type Page, type PageBreakBlock, type PageClass, type PageFields, type PageGeometry, type PageLayout, type PageMargins, type PageSize, type ParagraphBlock, type ParagraphProps, type QuoteBlock, type RenderChart, type ResolvedMargins, type Run, type Stretch, TRACKED_CHANGES_NOTICE, type TableBlock, type TableBorders, type TableCell, type TableFragment, type TableItem, type TableRow, type TableRowItem, type VAlign, type ViewerFont, bandSlot, blockStretches, bodyBox, carlitoFaces, docFromReader, docStretches, fontFaceCss, formatDatePicture, hasRevisions, isDeletedRun, numberFootnotes, packInput, pageBand, pageBodyBoxes, pageCapacity, pageChartOption, pageClass, pageClassIn, pageGeometry, pageMargins, paginate, resolveNow, revisionPaths, substituteFields, unshownLayout };
package/dist/index.d.ts CHANGED
@@ -283,6 +283,12 @@ interface DocViewerLayout {
283
283
  * Absent when there is none. The visible notice says the same thing.
284
284
  */
285
285
  notShown?: string[];
286
+ /**
287
+ * JSON Pointers to the document's `revision` keys (tracked changes), which this
288
+ * viewer does not show: deleted and moved-away text is hidden and a notice says so.
289
+ * Absent when there are none.
290
+ */
291
+ revisions?: string[];
286
292
  }
287
293
  type ViewerFont = "carlito" | "fallback" | "unused";
288
294
  /** How long the viewer waits for the bundled font before laying out without it. */
@@ -342,7 +348,10 @@ interface DocViewerProps {
342
348
  * (1-based); each block or fragment of one `data-block` (`b0`, `b1`, ... in
343
349
  * document order); each footnote `data-footnote`; bands `data-lw-band`, with
344
350
  * `data-lw-band-variant` naming the one drawn (`default`, `first`, `even`);
345
- * `data-lw-layout-notice` when the document asks for page layout it does not show.
351
+ * `data-lw-layout-notice` when the document asks for page layout it does not show;
352
+ * `data-lw-tracked-changes` on the root and `data-lw-tracked-changes-notice` (with
353
+ * `data-lw-revisions`, the count) when it carries tracked changes, which it does not
354
+ * show either: deleted and moved-away text is hidden (a fail-safe, see revisions.ts).
346
355
  * A `pageBreak` carrying `page` changes the page from there on, each page drawn and
347
356
  * its text measured at its own size.
348
357
  *
@@ -402,6 +411,33 @@ declare const LAYOUT_NOTICE = "Some page settings in this document aren't shown.
402
411
  */
403
412
  declare function unshownLayout(doc: Doc): string[];
404
413
 
414
+ /**
415
+ * A FAIL-SAFE for tracked changes, not support for them.
416
+ *
417
+ * last-word's model can carry a `revision` key: on a run (`insert`, `delete`,
418
+ * `moveFrom`, `moveTo`, `format`, with `author`, `date`, `name`), on a paragraph or
419
+ * heading block (its paragraph mark) and on a list item. This viewer cannot show
420
+ * revisions. Drawing the document as if they were not there would present DELETED
421
+ * text as live text, so a document carrying any revision draws with this notice, and
422
+ * a deleted or moved-away run is not drawn at all.
423
+ */
424
+ declare const TRACKED_CHANGES_NOTICE = "This document has tracked changes, which this viewer can't show yet. Accept them first. Deleted text is hidden.";
425
+ /**
426
+ * Whether a run's text must not be drawn: it was deleted, or moved away from here.
427
+ * FAILS SAFE: a `revision` it cannot read counts as deleted, because hiding text
428
+ * under a visible notice is recoverable and showing deleted text as live is not.
429
+ */
430
+ declare function isDeletedRun(run: Run): boolean;
431
+ /**
432
+ * JSON Pointers to every `revision` key in the document: the body, quotes, table
433
+ * cells, list items at any depth, footnotes and the page bands. A chart's `option` is
434
+ * arbitrary chart data and is not read. Nothing here trusts the Doc's shape, and the
435
+ * walk is iterative: the nesting is the file's.
436
+ */
437
+ declare function revisionPaths(doc: Doc): string[];
438
+ /** Whether the document carries any tracked change. A host can check this before showing it. */
439
+ declare function hasRevisions(doc: Doc): boolean;
440
+
405
441
  /**
406
442
  * The page packer: measured heights in, page assignments out.
407
443
  *
@@ -744,4 +780,4 @@ interface FootnoteNumbering {
744
780
  */
745
781
  declare function numberFootnotes(doc: Doc): FootnoteNumbering;
746
782
 
747
- export { type Align, type Band, type BandHeights, type BandKind, type BandSlot, type Block, type BlockFragment, type BlockItem, type BlocksBand, type BodyBox, type Border, type BorderStyle, type BoxBorders, type BoxSides, type BreakItem, CARLITO_FACES, CARLITO_FAMILY, type ChartBlock, type ChartRenderArgs, type CodeBlock, type Doc, type DocMeta, DocViewer, type DocViewerLayout, type DocViewerProps, FONT_LOAD_TIMEOUT_MS, type Footnote, type FootnoteMark, type FootnoteNumbering, type Fragment, type HeadingBlock, type HrBlock, type ImageBlock, LAYOUT_NOTICE, type ListBlock, type ListItem, OFFICE_PALETTE, type Orientation, PAGE_BAND_DISTANCE_DEFAULT, PAGE_MARGIN_DEFAULT, PAGE_SIZES_PT, PX_PER_PT, type PackInput, type PackItem, type PackOptions, type Page, type PageBreakBlock, type PageClass, type PageFields, type PageGeometry, type PageLayout, type PageMargins, type PageSize, type ParagraphBlock, type ParagraphProps, type QuoteBlock, type RenderChart, type ResolvedMargins, type Run, type Stretch, type TableBlock, type TableBorders, type TableCell, type TableFragment, type TableItem, type TableRow, type TableRowItem, type VAlign, type ViewerFont, bandSlot, blockStretches, bodyBox, carlitoFaces, docFromReader, docStretches, fontFaceCss, formatDatePicture, numberFootnotes, packInput, pageBand, pageBodyBoxes, pageCapacity, pageChartOption, pageClass, pageClassIn, pageGeometry, pageMargins, paginate, resolveNow, substituteFields, unshownLayout };
783
+ export { type Align, type Band, type BandHeights, type BandKind, type BandSlot, type Block, type BlockFragment, type BlockItem, type BlocksBand, type BodyBox, type Border, type BorderStyle, type BoxBorders, type BoxSides, type BreakItem, CARLITO_FACES, CARLITO_FAMILY, type ChartBlock, type ChartRenderArgs, type CodeBlock, type Doc, type DocMeta, DocViewer, type DocViewerLayout, type DocViewerProps, FONT_LOAD_TIMEOUT_MS, type Footnote, type FootnoteMark, type FootnoteNumbering, type Fragment, type HeadingBlock, type HrBlock, type ImageBlock, LAYOUT_NOTICE, type ListBlock, type ListItem, OFFICE_PALETTE, type Orientation, PAGE_BAND_DISTANCE_DEFAULT, PAGE_MARGIN_DEFAULT, PAGE_SIZES_PT, PX_PER_PT, type PackInput, type PackItem, type PackOptions, type Page, type PageBreakBlock, type PageClass, type PageFields, type PageGeometry, type PageLayout, type PageMargins, type PageSize, type ParagraphBlock, type ParagraphProps, type QuoteBlock, type RenderChart, type ResolvedMargins, type Run, type Stretch, TRACKED_CHANGES_NOTICE, type TableBlock, type TableBorders, type TableCell, type TableFragment, type TableItem, type TableRow, type TableRowItem, type VAlign, type ViewerFont, bandSlot, blockStretches, bodyBox, carlitoFaces, docFromReader, docStretches, fontFaceCss, formatDatePicture, hasRevisions, isDeletedRun, numberFootnotes, packInput, pageBand, pageBodyBoxes, pageCapacity, pageChartOption, pageClass, pageClassIn, pageGeometry, pageMargins, paginate, resolveNow, revisionPaths, substituteFields, unshownLayout };
package/dist/index.js CHANGED
@@ -389,6 +389,49 @@ function safeHref(url) {
389
389
  return ALLOWED.has(parsed.protocol) ? url : void 0;
390
390
  }
391
391
 
392
+ // src/revisions.ts
393
+ var TRACKED_CHANGES_NOTICE = "This document has tracked changes, which this viewer can't show yet. Accept them first. Deleted text is hidden.";
394
+ var isObject = (v) => typeof v === "object" && v !== null;
395
+ var KEPT_KINDS = /* @__PURE__ */ new Set(["insert", "moveTo", "format"]);
396
+ var KINDS = ["insert", "delete", "moveFrom", "moveTo", "format"];
397
+ function revisionKind(revision) {
398
+ if (typeof revision === "string") return revision;
399
+ if (!isObject(revision)) return null;
400
+ for (const key of ["type", "kind"]) {
401
+ if (typeof revision[key] === "string") return revision[key];
402
+ }
403
+ const named = KINDS.filter((k) => revision[k] !== void 0 && revision[k] !== false);
404
+ return named.length === 1 ? named[0] : null;
405
+ }
406
+ function isDeletedRun(run) {
407
+ if (!isObject(run) || !("revision" in run) || run.revision === void 0) return false;
408
+ const kind = revisionKind(run.revision);
409
+ return kind === null || !KEPT_KINDS.has(kind);
410
+ }
411
+ var escape = (key) => key.replace(/~/g, "~0").replace(/\//g, "~1");
412
+ function revisionPaths(doc) {
413
+ const found = [];
414
+ if (!isObject(doc)) return found;
415
+ const seen = /* @__PURE__ */ new Set();
416
+ const stack = [{ value: doc, at: "" }];
417
+ while (stack.length > 0) {
418
+ const { value, at } = stack.pop();
419
+ if (!isObject(value) || seen.has(value)) continue;
420
+ seen.add(value);
421
+ if (Array.isArray(value)) {
422
+ for (let i = value.length - 1; i >= 0; i--) stack.push({ value: value[i], at: `${at}/${i}` });
423
+ continue;
424
+ }
425
+ if (value.revision !== void 0) found.push(`${at}/revision`);
426
+ const keys = Object.keys(value).filter((k) => k !== "revision" && !(k === "option" && value.type === "chart"));
427
+ for (let i = keys.length - 1; i >= 0; i--) stack.push({ value: value[keys[i]], at: `${at}/${escape(keys[i])}` });
428
+ }
429
+ return found;
430
+ }
431
+ function hasRevisions(doc) {
432
+ return revisionPaths(doc).length > 0;
433
+ }
434
+
392
435
  // src/style.ts
393
436
  var pt = (n) => `${Math.round(n * 1e3) / 1e3}pt`;
394
437
  var px = (n) => `${Math.round(n * 1e3) / 1e3}px`;
@@ -563,6 +606,7 @@ function WithContext({ value, children }) {
563
606
  }
564
607
  function RunView({ run }) {
565
608
  const ctx = useContext(RenderCtx);
609
+ if (isDeletedRun(run)) return null;
566
610
  const mark = ctx.marks.get(run);
567
611
  let text = typeof run.text === "string" ? run.text : "";
568
612
  if (ctx.fields) text = substituteFields(text, ctx.fields);
@@ -606,7 +650,9 @@ function RunView({ run }) {
606
650
  }
607
651
  function Runs({ runs }) {
608
652
  const list = Array.isArray(runs) ? runs : [];
609
- const visible = list.some((r) => typeof r?.text === "string" && r.text !== "" || r?.footnote);
653
+ const visible = list.some(
654
+ (r) => !!r && typeof r === "object" && !isDeletedRun(r) && (typeof r.text === "string" && r.text !== "" || !!r.footnote)
655
+ );
610
656
  return /* @__PURE__ */ jsxs(Fragment, { children: [
611
657
  list.map((run, i) => run && typeof run === "object" ? /* @__PURE__ */ jsx(RunView, { run }, i) : null),
612
658
  !visible && ZWSP
@@ -894,7 +940,7 @@ function numberFootnotes(doc) {
894
940
  if (!Array.isArray(list)) return;
895
941
  for (const run of list) {
896
942
  const fn = run?.footnote;
897
- if (fn && typeof fn === "object" && Array.isArray(fn.blocks)) {
943
+ if (fn && !isDeletedRun(run) && typeof fn === "object" && Array.isArray(fn.blocks)) {
898
944
  const id = notes.length + 1;
899
945
  marks.set(run, id);
900
946
  notes.push({ id, footnote: fn });
@@ -935,9 +981,9 @@ function numberFootnotes(doc) {
935
981
  }
936
982
 
937
983
  // src/stretches.ts
938
- var isObject = (v) => !!v && typeof v === "object" && !Array.isArray(v);
984
+ var isObject2 = (v) => !!v && typeof v === "object" && !Array.isArray(v);
939
985
  function isPageObject(page) {
940
- return isObject(page) || Array.isArray(page) && page.length === 0;
986
+ return isObject2(page) || Array.isArray(page) && page.length === 0;
941
987
  }
942
988
  function mergePage(page, change) {
943
989
  const out = { ...page ?? {} };
@@ -945,7 +991,7 @@ function mergePage(page, change) {
945
991
  delete out.firstFooter;
946
992
  for (const [key, value] of Object.entries(change)) {
947
993
  if (value === void 0 || value === null || key === "background") continue;
948
- if (key === "margins" && isObject(value) && isObject(out.margins)) {
994
+ if (key === "margins" && isObject2(value) && isObject2(out.margins)) {
949
995
  const merged = { ...out.margins };
950
996
  for (const [side, v] of Object.entries(value)) {
951
997
  if (v !== void 0 && v !== null) merged[side] = v;
@@ -967,8 +1013,8 @@ function docStretches(doc) {
967
1013
  const out = [make(null)];
968
1014
  (Array.isArray(doc?.blocks) ? doc.blocks : []).forEach((block, i) => {
969
1015
  const b = block;
970
- if (!isObject(b) || b.type !== "pageBreak" || !isPageObject(b.page)) return;
971
- page = mergePage(page, isObject(b.page) ? b.page : {});
1016
+ if (!isObject2(b) || b.type !== "pageBreak" || !isPageObject(b.page)) return;
1017
+ page = mergePage(page, isObject2(b.page) ? b.page : {});
972
1018
  out.push(make(i));
973
1019
  });
974
1020
  return out;
@@ -1018,17 +1064,17 @@ function packInput(stretches, measured) {
1018
1064
  // src/layout-notice.ts
1019
1065
  var LAYOUT_NOTICE = "Some page settings in this document aren't shown. It sets them somewhere they don't apply: on a page break directly, in a quote or a table cell, or under a sections key.";
1020
1066
  var NEAR_MISS_KEYS = ["size", "orientation", "margins", "header", "footer", "firstHeader", "firstFooter", "evenHeader", "evenFooter", "background", "border"];
1021
- var isObject2 = (v) => typeof v === "object" && v !== null;
1067
+ var isObject3 = (v) => typeof v === "object" && v !== null;
1022
1068
  function unshownLayout(doc) {
1023
1069
  const found = [];
1024
- if (!isObject2(doc)) return found;
1070
+ if (!isObject3(doc)) return found;
1025
1071
  if (doc.sections !== void 0) found.push("/sections");
1026
1072
  const stack = [{ blocks: doc.blocks, at: "/blocks" }];
1027
1073
  while (stack.length > 0) {
1028
1074
  const { blocks, at } = stack.pop();
1029
1075
  if (!Array.isArray(blocks)) continue;
1030
1076
  blocks.forEach((block, i) => {
1031
- if (!isObject2(block)) return;
1077
+ if (!isObject3(block)) return;
1032
1078
  const path = `${at}/${i}`;
1033
1079
  if (block.type === "pageBreak") {
1034
1080
  for (const key of NEAR_MISS_KEYS) {
@@ -1036,15 +1082,15 @@ function unshownLayout(doc) {
1036
1082
  }
1037
1083
  if (block.page !== void 0) {
1038
1084
  if (at !== "/blocks" || !isPageObject(block.page)) found.push(`${path}/page`);
1039
- else if (isObject2(block.page) && block.page.background !== void 0) found.push(`${path}/page/background`);
1085
+ else if (isObject3(block.page) && block.page.background !== void 0) found.push(`${path}/page/background`);
1040
1086
  }
1041
1087
  } else if (block.type === "quote") {
1042
1088
  stack.push({ blocks: block.blocks, at: `${path}/blocks` });
1043
1089
  } else if (block.type === "table" && Array.isArray(block.rows)) {
1044
1090
  block.rows.forEach((row, r) => {
1045
- if (!isObject2(row) || !Array.isArray(row.cells)) return;
1091
+ if (!isObject3(row) || !Array.isArray(row.cells)) return;
1046
1092
  row.cells.forEach((cell, c) => {
1047
- if (isObject2(cell)) stack.push({ blocks: cell.blocks, at: `${path}/rows/${r}/cells/${c}/blocks` });
1093
+ if (isObject3(cell)) stack.push({ blocks: cell.blocks, at: `${path}/rows/${r}/cells/${c}/blocks` });
1048
1094
  });
1049
1095
  });
1050
1096
  }
@@ -1572,6 +1618,7 @@ function DocViewer({
1572
1618
  const pageWpx = Math.max(...stretches.map((s) => s.geometry.width)) * PX_PER_PT;
1573
1619
  const scale = typeof fixedScale === "number" && fixedScale > 0 ? fixedScale : fit === "none" || !width ? 1 : Math.min(maxScale, width / pageWpx);
1574
1620
  const notShown = useMemo(() => unshownLayout(doc), [doc]);
1621
+ const revisions = useMemo(() => revisionPaths(doc), [doc]);
1575
1622
  const pageCount = layout?.pages.length ?? 0;
1576
1623
  useEffect(() => {
1577
1624
  if (layout && font !== "pending") {
@@ -1582,10 +1629,11 @@ function DocViewer({
1582
1629
  ...stretches.length > 1 ? { pageSizes: layout.pages.map((p) => ({ width: stretches[p.stretch ?? 0].geometry.width, height: stretches[p.stretch ?? 0].geometry.height })) } : {},
1583
1630
  scale,
1584
1631
  font,
1585
- ...notShown.length > 0 ? { notShown } : {}
1632
+ ...notShown.length > 0 ? { notShown } : {},
1633
+ ...revisions.length > 0 ? { revisions } : {}
1586
1634
  });
1587
1635
  }
1588
- }, [layout, geometry, stretches, scale, onLayout, font, notShown]);
1636
+ }, [layout, geometry, stretches, scale, onLayout, font, notShown, revisions]);
1589
1637
  const typography2 = typography(doc?.defaultFont, ctx.size);
1590
1638
  const ready = layout !== null && font !== "pending";
1591
1639
  return /* @__PURE__ */ jsxs(
@@ -1596,6 +1644,7 @@ function DocViewer({
1596
1644
  "data-lw-viewer": "",
1597
1645
  "data-lw-pages": ready && pageCount || void 0,
1598
1646
  "data-lw-font": ready ? font : void 0,
1647
+ "data-lw-tracked-changes": revisions.length > 0 ? "" : void 0,
1599
1648
  "aria-busy": ready ? void 0 : true,
1600
1649
  className,
1601
1650
  style: { position: "relative", ...style },
@@ -1603,6 +1652,7 @@ function DocViewer({
1603
1652
  injectStyles && /* @__PURE__ */ jsx("style", { href: "particle-academy-last-word-ui", precedence: "default", children: VIEWER_CSS }),
1604
1653
  injectStyles && FONT_CSS && /* @__PURE__ */ jsx("style", { href: "particle-academy-last-word-ui-fonts", precedence: "default", children: FONT_CSS }),
1605
1654
  notShown.length > 0 && /* @__PURE__ */ jsx("div", { "data-lw-layout-notice": "", style: { marginBottom: gap }, children: /* @__PURE__ */ jsx(Callout, { color: "amber", children: LAYOUT_NOTICE }) }),
1655
+ revisions.length > 0 && /* @__PURE__ */ jsx("div", { "data-lw-tracked-changes-notice": "", "data-lw-revisions": revisions.length, style: { marginBottom: gap }, children: /* @__PURE__ */ jsx(Callout, { color: "amber", children: TRACKED_CHANGES_NOTICE }) }),
1606
1656
  /* @__PURE__ */ jsx(
1607
1657
  "div",
1608
1658
  {
@@ -1818,6 +1868,6 @@ function docFromReader(output) {
1818
1868
  return value;
1819
1869
  }
1820
1870
 
1821
- export { CARLITO_FACES, CARLITO_FAMILY, DocViewer, FONT_LOAD_TIMEOUT_MS, LAYOUT_NOTICE, OFFICE_PALETTE, PAGE_BAND_DISTANCE_DEFAULT, PAGE_MARGIN_DEFAULT, PAGE_SIZES_PT, PX_PER_PT, bandSlot, blockStretches, bodyBox, carlitoFaces, docFromReader, docStretches, fontFaceCss, formatDatePicture, numberFootnotes, packInput, pageBand, pageBodyBoxes, pageCapacity, pageChartOption, pageClass, pageClassIn, pageGeometry, pageMargins, paginate, resolveNow, substituteFields, unshownLayout };
1871
+ export { CARLITO_FACES, CARLITO_FAMILY, DocViewer, FONT_LOAD_TIMEOUT_MS, LAYOUT_NOTICE, OFFICE_PALETTE, PAGE_BAND_DISTANCE_DEFAULT, PAGE_MARGIN_DEFAULT, PAGE_SIZES_PT, PX_PER_PT, TRACKED_CHANGES_NOTICE, bandSlot, blockStretches, bodyBox, carlitoFaces, docFromReader, docStretches, fontFaceCss, formatDatePicture, hasRevisions, isDeletedRun, numberFootnotes, packInput, pageBand, pageBodyBoxes, pageCapacity, pageChartOption, pageClass, pageClassIn, pageGeometry, pageMargins, paginate, resolveNow, revisionPaths, substituteFields, unshownLayout };
1822
1872
  //# sourceMappingURL=index.js.map
1823
1873
  //# sourceMappingURL=index.js.map