@arbidocs/blocks 0.4.117 → 0.4.119

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 (49) hide show
  1. package/dist/{NativeDocxEditor-BBTLE23K.cjs → NativeDocxEditor-2JTZNFKD.cjs} +7 -7
  2. package/dist/{NativeDocxEditor-BBTLE23K.cjs.map → NativeDocxEditor-2JTZNFKD.cjs.map} +1 -1
  3. package/dist/{NativeDocxEditor-6SCZDPKK.js → NativeDocxEditor-QIWYQDIO.js} +3 -3
  4. package/dist/{NativeDocxEditor-6SCZDPKK.js.map → NativeDocxEditor-QIWYQDIO.js.map} +1 -1
  5. package/dist/agents/index.cjs +207 -207
  6. package/dist/agents/index.js +2 -2
  7. package/dist/{chunk-JXZDGTJG.js → chunk-6Z7DLJU2.js} +3 -3
  8. package/dist/{chunk-JXZDGTJG.js.map → chunk-6Z7DLJU2.js.map} +1 -1
  9. package/dist/{chunk-GMDAQIRC.js → chunk-BDSKKIFZ.js} +57 -5
  10. package/dist/chunk-BDSKKIFZ.js.map +1 -0
  11. package/dist/{chunk-TKI34NP5.js → chunk-D72GGCXN.js} +3 -3
  12. package/dist/{chunk-TKI34NP5.js.map → chunk-D72GGCXN.js.map} +1 -1
  13. package/dist/{chunk-226AULED.cjs → chunk-FXUQZFAN.cjs} +3 -3
  14. package/dist/{chunk-226AULED.cjs.map → chunk-FXUQZFAN.cjs.map} +1 -1
  15. package/dist/{chunk-NL7M7VQ2.cjs → chunk-JSH43QMZ.cjs} +57 -5
  16. package/dist/chunk-JSH43QMZ.cjs.map +1 -0
  17. package/dist/{chunk-QZLK3F2E.cjs → chunk-KUW4ATIC.cjs} +5 -5
  18. package/dist/{chunk-QZLK3F2E.cjs.map → chunk-KUW4ATIC.cjs.map} +1 -1
  19. package/dist/{chunk-ES4H653I.cjs → chunk-N7ARMX3O.cjs} +4 -4
  20. package/dist/{chunk-ES4H653I.cjs.map → chunk-N7ARMX3O.cjs.map} +1 -1
  21. package/dist/{chunk-FEODWQLH.js → chunk-SHASZLGD.js} +3 -3
  22. package/dist/{chunk-FEODWQLH.js.map → chunk-SHASZLGD.js.map} +1 -1
  23. package/dist/connect/docx.cjs +6 -6
  24. package/dist/connect/docx.js +4 -4
  25. package/dist/connect/index.cjs +4 -4
  26. package/dist/connect/index.js +3 -3
  27. package/dist/docx/index.cjs +46 -46
  28. package/dist/docx/index.js +3 -3
  29. package/dist/facts/index.cjs +1 -1
  30. package/dist/facts/index.js +1 -1
  31. package/dist/files/index.cjs +1 -1
  32. package/dist/files/index.js +1 -1
  33. package/dist/home/index.cjs +1 -1
  34. package/dist/home/index.js +1 -1
  35. package/dist/index.cjs +258 -258
  36. package/dist/index.js +4 -4
  37. package/dist/retrieval/index.cjs +1 -1
  38. package/dist/retrieval/index.js +1 -1
  39. package/dist/shell/index.cjs +1 -1
  40. package/dist/shell/index.js +1 -1
  41. package/dist/studio/index.cjs +1 -1
  42. package/dist/studio/index.js +1 -1
  43. package/dist/workflow-canvas/index.cjs +9 -9
  44. package/dist/workflow-canvas/index.js +2 -2
  45. package/node_modules/@arbidocs/coedit/package.json +1 -1
  46. package/package.json +4 -4
  47. package/src/docx/styles.css +13 -0
  48. package/dist/chunk-GMDAQIRC.js.map +0 -1
  49. package/dist/chunk-NL7M7VQ2.cjs.map +0 -1
@@ -4514,6 +4514,7 @@ function CompactToolbar() {
4514
4514
  ] });
4515
4515
  }
4516
4516
  var fixedZoomMode = { type: "fixed" };
4517
+ var ZOOM_LEVELS = [50, 75, 100, 125, 150, 200];
4517
4518
  function NativeDocxEditor({
4518
4519
  documentId,
4519
4520
  title,
@@ -4529,7 +4530,9 @@ function NativeDocxEditor({
4529
4530
  const [ready, setReady] = React4.useState(), [error, setError] = React4.useState(""), [retry, setRetry] = React4.useState(0);
4530
4531
  const [status, setStatus] = React4.useState("Connecting\u2026"), [dirty, setDirty] = React4.useState(false), [saving, setSaving] = React4.useState(false), [offline, setOffline] = React4.useState(false);
4531
4532
  const revision = React4.useRef(0);
4532
- const stageRef = React4.useRef(null), fitCleanup = React4.useRef(void 0);
4533
+ const stageRef = React4.useRef(null), fitCleanup = React4.useRef(void 0), refit = React4.useRef(void 0);
4534
+ const fitting = React4.useRef(true), fitted = React4.useRef(void 0);
4535
+ const [fitWidth, setFitWidth] = React4.useState(true), [zoomPercent, setZoomPercent] = React4.useState(100);
4533
4536
  const ref = React4.useRef(null), dirtyRef = React4.useRef(false), draftTimer = React4.useRef(void 0);
4534
4537
  const isDraft = draftContent !== void 0;
4535
4538
  const streamRef = React4.useRef(stream);
@@ -4779,16 +4782,29 @@ function NativeDocxEditor({
4779
4782
  updateStream();
4780
4783
  }
4781
4784
  fitCleanup.current?.();
4785
+ fitted.current = void 0;
4782
4786
  const viewport = stageRef.current?.querySelector(".native-docx-viewport");
4783
4787
  if (!viewport) return;
4788
+ let surface = null;
4784
4789
  const fit = () => {
4790
+ const page = viewport.querySelector(".docx-paginated-surface");
4791
+ if (page && page !== surface) resize.observe(surface = page);
4792
+ const current = editor.getZoom();
4793
+ if (fitting.current && fitted.current !== void 0 && Math.abs(current - fitted.current) > 1e-3)
4794
+ fitting.current = false;
4795
+ setFitWidth(fitting.current);
4796
+ setZoomPercent(Math.round(current * 100));
4797
+ if (!fitting.current) return;
4785
4798
  const pageWidth = editor.getPageGeometry()[0]?.box.width;
4786
4799
  if (!pageWidth) return;
4787
4800
  const style = getComputedStyle(viewport);
4788
4801
  const available = viewport.clientWidth - parseFloat(style.paddingLeft) - parseFloat(style.paddingRight);
4789
- const zoom = Math.max(0.1, Math.min(compact ? 1 : 2.5, available / pageWidth));
4790
- if (Math.abs(editor.getZoom() - zoom) > 1e-3) editor.setZoom(zoom);
4802
+ const zoom = Math.max(0.1, Math.min(compact ? 1 : 5, available / pageWidth));
4803
+ if (Math.abs(current - zoom) > 1e-3) editor.setZoom(zoom);
4804
+ fitted.current = editor.getZoom();
4805
+ setZoomPercent(Math.round(fitted.current * 100));
4791
4806
  };
4807
+ refit.current = fit;
4792
4808
  const resize = new ResizeObserver(fit);
4793
4809
  const chrome = new MutationObserver(fit);
4794
4810
  resize.observe(viewport);
@@ -4796,12 +4812,30 @@ function NativeDocxEditor({
4796
4812
  attributes: true,
4797
4813
  attributeFilter: ["style", "data-review-pane", "data-review-margin"]
4798
4814
  });
4815
+ const mount = viewport.querySelector(".docx-content-mount");
4816
+ if (mount) chrome.observe(mount, { childList: true });
4817
+ if (!fitting.current) editor.setZoom(zoomPercent / 100);
4799
4818
  fit();
4800
4819
  fitCleanup.current = () => {
4801
4820
  resize.disconnect();
4802
4821
  chrome.disconnect();
4822
+ refit.current = void 0;
4803
4823
  };
4804
4824
  }
4825
+ function pickZoom(value) {
4826
+ const editor = ref.current;
4827
+ if (!editor) return;
4828
+ if (value === "fit") {
4829
+ fitting.current = true;
4830
+ fitted.current = void 0;
4831
+ refit.current?.();
4832
+ return;
4833
+ }
4834
+ fitting.current = false;
4835
+ setFitWidth(false);
4836
+ setZoomPercent(Number(value));
4837
+ editor.setZoom(Number(value) / 100);
4838
+ }
4805
4839
  function changed() {
4806
4840
  if (snapshot) return;
4807
4841
  revision.current += 1;
@@ -4965,6 +4999,24 @@ function NativeDocxEditor({
4965
4999
  status
4966
5000
  ] }),
4967
5001
  /* @__PURE__ */ jsxRuntime.jsx(DocxParticipants, { session: ready?.room?.session }),
5002
+ !compact && /* @__PURE__ */ jsxRuntime.jsxs(
5003
+ "select",
5004
+ {
5005
+ className: "native-docx-zoom",
5006
+ "aria-label": "Zoom",
5007
+ "data-testid": "native-docx-zoom",
5008
+ disabled: !ready,
5009
+ value: fitWidth ? "fit" : String(zoomPercent),
5010
+ onChange: (event) => pickZoom(event.target.value),
5011
+ children: [
5012
+ /* @__PURE__ */ jsxRuntime.jsx("option", { value: "fit", children: "Fit width" }),
5013
+ [.../* @__PURE__ */ new Set([...ZOOM_LEVELS, ...fitWidth ? [] : [zoomPercent]])].sort((a, b) => a - b).map((level) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: String(level), children: [
5014
+ level,
5015
+ "%"
5016
+ ] }, level))
5017
+ ]
5018
+ }
5019
+ ),
4968
5020
  !compact && /* @__PURE__ */ jsxRuntime.jsxs(
4969
5021
  "button",
4970
5022
  {
@@ -5056,5 +5108,5 @@ exports.useReview = useReview;
5056
5108
  exports.useReviewItem = useReviewItem;
5057
5109
  exports.useTrackedOrNoted = useTrackedOrNoted;
5058
5110
  exports.withDirectEditing = withDirectEditing;
5059
- //# sourceMappingURL=chunk-NL7M7VQ2.cjs.map
5060
- //# sourceMappingURL=chunk-NL7M7VQ2.cjs.map
5111
+ //# sourceMappingURL=chunk-JSH43QMZ.cjs.map
5112
+ //# sourceMappingURL=chunk-JSH43QMZ.cjs.map