@arbidocs/blocks 0.4.116 → 0.4.118

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 (54) 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 +5 -5
  26. package/dist/connect/index.js +4 -4
  27. package/dist/connection/ConnectedWorkflowBuilder.d.ts +21 -3
  28. package/dist/docx/index.cjs +46 -46
  29. package/dist/docx/index.js +3 -3
  30. package/dist/facts/index.cjs +1 -1
  31. package/dist/facts/index.js +1 -1
  32. package/dist/files/index.cjs +1 -1
  33. package/dist/files/index.js +1 -1
  34. package/dist/home/index.cjs +1 -1
  35. package/dist/home/index.js +1 -1
  36. package/dist/index.cjs +383 -383
  37. package/dist/index.js +8 -8
  38. package/dist/retrieval/index.cjs +1 -1
  39. package/dist/retrieval/index.js +1 -1
  40. package/dist/settings/index.cjs +1 -1
  41. package/dist/settings/index.js +1 -1
  42. package/dist/shell/index.cjs +1 -1
  43. package/dist/shell/index.js +1 -1
  44. package/dist/studio/index.cjs +1 -1
  45. package/dist/studio/index.js +1 -1
  46. package/dist/workflow-canvas/index.cjs +9 -10
  47. package/dist/workflow-canvas/index.cjs.map +1 -1
  48. package/dist/workflow-canvas/index.js +2 -3
  49. package/dist/workflow-canvas/index.js.map +1 -1
  50. package/node_modules/@arbidocs/coedit/package.json +1 -1
  51. package/package.json +4 -4
  52. package/src/docx/styles.css +13 -0
  53. package/dist/chunk-GMDAQIRC.js.map +0 -1
  54. package/dist/chunk-NL7M7VQ2.cjs.map +0 -1
@@ -4490,6 +4490,7 @@ function CompactToolbar() {
4490
4490
  ] });
4491
4491
  }
4492
4492
  var fixedZoomMode = { type: "fixed" };
4493
+ var ZOOM_LEVELS = [50, 75, 100, 125, 150, 200];
4493
4494
  function NativeDocxEditor({
4494
4495
  documentId,
4495
4496
  title,
@@ -4505,7 +4506,9 @@ function NativeDocxEditor({
4505
4506
  const [ready, setReady] = useState(), [error, setError] = useState(""), [retry, setRetry] = useState(0);
4506
4507
  const [status, setStatus] = useState("Connecting\u2026"), [dirty, setDirty] = useState(false), [saving, setSaving] = useState(false), [offline, setOffline] = useState(false);
4507
4508
  const revision = useRef(0);
4508
- const stageRef = useRef(null), fitCleanup = useRef(void 0);
4509
+ const stageRef = useRef(null), fitCleanup = useRef(void 0), refit = useRef(void 0);
4510
+ const fitting = useRef(true), fitted = useRef(void 0);
4511
+ const [fitWidth, setFitWidth] = useState(true), [zoomPercent, setZoomPercent] = useState(100);
4509
4512
  const ref = useRef(null), dirtyRef = useRef(false), draftTimer = useRef(void 0);
4510
4513
  const isDraft = draftContent !== void 0;
4511
4514
  const streamRef = useRef(stream);
@@ -4755,16 +4758,29 @@ function NativeDocxEditor({
4755
4758
  updateStream();
4756
4759
  }
4757
4760
  fitCleanup.current?.();
4761
+ fitted.current = void 0;
4758
4762
  const viewport = stageRef.current?.querySelector(".native-docx-viewport");
4759
4763
  if (!viewport) return;
4764
+ let surface = null;
4760
4765
  const fit = () => {
4766
+ const page = viewport.querySelector(".docx-paginated-surface");
4767
+ if (page && page !== surface) resize.observe(surface = page);
4768
+ const current = editor.getZoom();
4769
+ if (fitting.current && fitted.current !== void 0 && Math.abs(current - fitted.current) > 1e-3)
4770
+ fitting.current = false;
4771
+ setFitWidth(fitting.current);
4772
+ setZoomPercent(Math.round(current * 100));
4773
+ if (!fitting.current) return;
4761
4774
  const pageWidth = editor.getPageGeometry()[0]?.box.width;
4762
4775
  if (!pageWidth) return;
4763
4776
  const style = getComputedStyle(viewport);
4764
4777
  const available = viewport.clientWidth - parseFloat(style.paddingLeft) - parseFloat(style.paddingRight);
4765
- const zoom = Math.max(0.1, Math.min(compact ? 1 : 2.5, available / pageWidth));
4766
- if (Math.abs(editor.getZoom() - zoom) > 1e-3) editor.setZoom(zoom);
4778
+ const zoom = Math.max(0.1, Math.min(compact ? 1 : 5, available / pageWidth));
4779
+ if (Math.abs(current - zoom) > 1e-3) editor.setZoom(zoom);
4780
+ fitted.current = editor.getZoom();
4781
+ setZoomPercent(Math.round(fitted.current * 100));
4767
4782
  };
4783
+ refit.current = fit;
4768
4784
  const resize = new ResizeObserver(fit);
4769
4785
  const chrome = new MutationObserver(fit);
4770
4786
  resize.observe(viewport);
@@ -4772,12 +4788,30 @@ function NativeDocxEditor({
4772
4788
  attributes: true,
4773
4789
  attributeFilter: ["style", "data-review-pane", "data-review-margin"]
4774
4790
  });
4791
+ const mount = viewport.querySelector(".docx-content-mount");
4792
+ if (mount) chrome.observe(mount, { childList: true });
4793
+ if (!fitting.current) editor.setZoom(zoomPercent / 100);
4775
4794
  fit();
4776
4795
  fitCleanup.current = () => {
4777
4796
  resize.disconnect();
4778
4797
  chrome.disconnect();
4798
+ refit.current = void 0;
4779
4799
  };
4780
4800
  }
4801
+ function pickZoom(value) {
4802
+ const editor = ref.current;
4803
+ if (!editor) return;
4804
+ if (value === "fit") {
4805
+ fitting.current = true;
4806
+ fitted.current = void 0;
4807
+ refit.current?.();
4808
+ return;
4809
+ }
4810
+ fitting.current = false;
4811
+ setFitWidth(false);
4812
+ setZoomPercent(Number(value));
4813
+ editor.setZoom(Number(value) / 100);
4814
+ }
4781
4815
  function changed() {
4782
4816
  if (snapshot) return;
4783
4817
  revision.current += 1;
@@ -4941,6 +4975,24 @@ function NativeDocxEditor({
4941
4975
  status
4942
4976
  ] }),
4943
4977
  /* @__PURE__ */ jsx(DocxParticipants, { session: ready?.room?.session }),
4978
+ !compact && /* @__PURE__ */ jsxs(
4979
+ "select",
4980
+ {
4981
+ className: "native-docx-zoom",
4982
+ "aria-label": "Zoom",
4983
+ "data-testid": "native-docx-zoom",
4984
+ disabled: !ready,
4985
+ value: fitWidth ? "fit" : String(zoomPercent),
4986
+ onChange: (event) => pickZoom(event.target.value),
4987
+ children: [
4988
+ /* @__PURE__ */ jsx("option", { value: "fit", children: "Fit width" }),
4989
+ [.../* @__PURE__ */ new Set([...ZOOM_LEVELS, ...fitWidth ? [] : [zoomPercent]])].sort((a, b) => a - b).map((level) => /* @__PURE__ */ jsxs("option", { value: String(level), children: [
4990
+ level,
4991
+ "%"
4992
+ ] }, level))
4993
+ ]
4994
+ }
4995
+ ),
4944
4996
  !compact && /* @__PURE__ */ jsxs(
4945
4997
  "button",
4946
4998
  {
@@ -4973,5 +5025,5 @@ function NativeDocxEditor({
4973
5025
  }
4974
5026
 
4975
5027
  export { BUILTIN_TEMPLATE_NAME, CrossReferenceDialog, CrossReferencesProvider, DEFAULT_CROSS_REFERENCES_LABELS, DEFAULT_DEFINED_TERMS_LABELS, DEFINED_TERM_TRIGGER, DefinedTermsProvider, DocxAuthorContext, DocxCommentActivity, DocxEditorReview, DocxMentions, DocxParticipants, DocxRibbon, GenerateImageButton, HouseTemplateProvider, LinkHoverCard, NativeDocxEditor, builtinHouseTemplate, contentPath, editorPort, normalizeDocxExport, referenceText, referencesPort, resolveHouseTemplate, reviewModule, shortTitle, structuralPort, templateFileName, trackedOrNoted, useCrossReferences, useDefinedTerms, useHouseTemplate, useReview, useReviewItem, useTrackedOrNoted, withDirectEditing };
4976
- //# sourceMappingURL=chunk-GMDAQIRC.js.map
4977
- //# sourceMappingURL=chunk-GMDAQIRC.js.map
5028
+ //# sourceMappingURL=chunk-BDSKKIFZ.js.map
5029
+ //# sourceMappingURL=chunk-BDSKKIFZ.js.map