@arbidocs/blocks 0.5.154 → 0.5.156

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 (109) hide show
  1. package/dist/{ConnectedNativeDocxComparison-2DAQX5GX.cjs → ConnectedNativeDocxComparison-G3AIBKSN.cjs} +8 -8
  2. package/dist/{ConnectedNativeDocxComparison-2DAQX5GX.cjs.map → ConnectedNativeDocxComparison-G3AIBKSN.cjs.map} +1 -1
  3. package/dist/{ConnectedStreamedWordArtifact-LTYB62VM.cjs → ConnectedStreamedWordArtifact-ISNLUTAT.cjs} +8 -8
  4. package/dist/{ConnectedStreamedWordArtifact-LTYB62VM.cjs.map → ConnectedStreamedWordArtifact-ISNLUTAT.cjs.map} +1 -1
  5. package/dist/{DocumentReviewCard-ILDLYZ5A.cjs → DocumentReviewCard-7ZH575KX.cjs} +14 -15
  6. package/dist/DocumentReviewCard-7ZH575KX.cjs.map +1 -0
  7. package/dist/{FilesViewerDialog-YLD5YFP2.cjs → FilesViewerDialog-6RWJSZZV.cjs} +14 -15
  8. package/dist/FilesViewerDialog-6RWJSZZV.cjs.map +1 -0
  9. package/dist/{WorkspaceTableView-V3N64LJG.cjs → WorkspaceTableView-NMERZJZZ.cjs} +5 -5
  10. package/dist/{WorkspaceTableView-V3N64LJG.cjs.map → WorkspaceTableView-NMERZJZZ.cjs.map} +1 -1
  11. package/dist/agents/index.cjs +173 -173
  12. package/dist/{chunk-NRGLF4J4.cjs → chunk-44M4FI2N.cjs} +472 -8
  13. package/dist/chunk-44M4FI2N.cjs.map +1 -0
  14. package/dist/{chunk-KWWGUQJV.cjs → chunk-4I4IYVC6.cjs} +7 -7
  15. package/dist/{chunk-KWWGUQJV.cjs.map → chunk-4I4IYVC6.cjs.map} +1 -1
  16. package/dist/{chunk-BTQ7IAOH.cjs → chunk-B2L3XNZH.cjs} +4 -4
  17. package/dist/{chunk-BTQ7IAOH.cjs.map → chunk-B2L3XNZH.cjs.map} +1 -1
  18. package/dist/{chunk-T7BUGVSG.cjs → chunk-BNHFDXJI.cjs} +36 -36
  19. package/dist/{chunk-T7BUGVSG.cjs.map → chunk-BNHFDXJI.cjs.map} +1 -1
  20. package/dist/{chunk-BNDIMTWJ.cjs → chunk-DCD4OHDF.cjs} +28 -28
  21. package/dist/{chunk-BNDIMTWJ.cjs.map → chunk-DCD4OHDF.cjs.map} +1 -1
  22. package/dist/{chunk-YXY52OGU.cjs → chunk-FNBUFKHE.cjs} +4 -4
  23. package/dist/{chunk-YXY52OGU.cjs.map → chunk-FNBUFKHE.cjs.map} +1 -1
  24. package/dist/{chunk-AURL2KT5.cjs → chunk-HGD4B7GO.cjs} +4 -4
  25. package/dist/{chunk-AURL2KT5.cjs.map → chunk-HGD4B7GO.cjs.map} +1 -1
  26. package/dist/{chunk-CNBYM5Q7.cjs → chunk-HJHDKS4V.cjs} +5 -5
  27. package/dist/{chunk-CNBYM5Q7.cjs.map → chunk-HJHDKS4V.cjs.map} +1 -1
  28. package/dist/{chunk-ZW2ZFC3Q.cjs → chunk-HLUZMXEZ.cjs} +56 -56
  29. package/dist/{chunk-ZW2ZFC3Q.cjs.map → chunk-HLUZMXEZ.cjs.map} +1 -1
  30. package/dist/{chunk-BZVK7JW5.cjs → chunk-K7GBHLLY.cjs} +4 -4
  31. package/dist/{chunk-BZVK7JW5.cjs.map → chunk-K7GBHLLY.cjs.map} +1 -1
  32. package/dist/{chunk-6GKCGCMT.cjs → chunk-M24FBUAP.cjs} +4 -4
  33. package/dist/{chunk-6GKCGCMT.cjs.map → chunk-M24FBUAP.cjs.map} +1 -1
  34. package/dist/{chunk-GYI4UXX6.cjs → chunk-PD47L6KS.cjs} +4 -4
  35. package/dist/{chunk-GYI4UXX6.cjs.map → chunk-PD47L6KS.cjs.map} +1 -1
  36. package/dist/{chunk-OOANNOH4.cjs → chunk-PTT5MZ7O.cjs} +9 -9
  37. package/dist/{chunk-OOANNOH4.cjs.map → chunk-PTT5MZ7O.cjs.map} +1 -1
  38. package/dist/{chunk-TSAZWUPZ.cjs → chunk-Q7G2W5VQ.cjs} +4 -4
  39. package/dist/{chunk-TSAZWUPZ.cjs.map → chunk-Q7G2W5VQ.cjs.map} +1 -1
  40. package/dist/{chunk-RL2HI6NP.cjs → chunk-S3GVFAFB.cjs} +3 -3
  41. package/dist/{chunk-RL2HI6NP.cjs.map → chunk-S3GVFAFB.cjs.map} +1 -1
  42. package/dist/{chunk-O7U6KL2W.cjs → chunk-U6JUIJTP.cjs} +10 -10
  43. package/dist/{chunk-O7U6KL2W.cjs.map → chunk-U6JUIJTP.cjs.map} +1 -1
  44. package/dist/{chunk-I3XTTTPZ.cjs → chunk-V4B2GSC6.cjs} +29 -29
  45. package/dist/{chunk-I3XTTTPZ.cjs.map → chunk-V4B2GSC6.cjs.map} +1 -1
  46. package/dist/{chunk-TN3UP3CI.cjs → chunk-YHXJWYOF.cjs} +6 -6
  47. package/dist/{chunk-TN3UP3CI.cjs.map → chunk-YHXJWYOF.cjs.map} +1 -1
  48. package/dist/{chunk-FEAHTNTY.cjs → chunk-YO7GDNEW.cjs} +91 -5
  49. package/dist/chunk-YO7GDNEW.cjs.map +1 -0
  50. package/dist/connect/docx.cjs +11 -11
  51. package/dist/connect/index.cjs +722 -769
  52. package/dist/connect/index.cjs.map +1 -1
  53. package/dist/connect/viewer.cjs +12 -13
  54. package/dist/connection/export/ConnectedExportPanel.js +19 -78
  55. package/dist/connection/export/ConnectedExportPanel.js.map +2 -2
  56. package/dist/connection/export/transfer-targets.d.ts +66 -0
  57. package/dist/connection/export/transfer-targets.js +93 -0
  58. package/dist/connection/export/transfer-targets.js.map +7 -0
  59. package/dist/connection/export/transfer-text.js +5 -0
  60. package/dist/connection/export/transfer-text.js.map +2 -2
  61. package/dist/connection/files/page/ConnectedFilesPage.js +16 -13
  62. package/dist/connection/files/page/ConnectedFilesPage.js.map +2 -2
  63. package/dist/connection/pages/ConnectedPagesPage.d.ts +4 -1
  64. package/dist/connection/pages/ConnectedPagesPage.js +22 -2
  65. package/dist/connection/pages/ConnectedPagesPage.js.map +2 -2
  66. package/dist/connection/pages/DocumentBlocks.js +1 -1
  67. package/dist/connection/pages/DocumentBlocks.js.map +2 -2
  68. package/dist/connection/pages/EditablePageGrid.js +44 -13
  69. package/dist/connection/pages/EditablePageGrid.js.map +2 -2
  70. package/dist/connection/pages/PageTransferDialog.d.ts +38 -0
  71. package/dist/connection/pages/PageTransferDialog.js +219 -0
  72. package/dist/connection/pages/PageTransferDialog.js.map +7 -0
  73. package/dist/connection/pages/PageView.d.ts +6 -2
  74. package/dist/connection/pages/PageView.js +40 -15
  75. package/dist/connection/pages/PageView.js.map +2 -2
  76. package/dist/connection/pages/index.d.ts +1 -0
  77. package/dist/connection/pages/index.js +6 -0
  78. package/dist/connection/pages/index.js.map +2 -2
  79. package/dist/connection/pages/labels.d.ts +3 -1
  80. package/dist/connection/pages/labels.js +2 -0
  81. package/dist/connection/pages/labels.js.map +2 -2
  82. package/dist/connection/storage/ConnectedWorkspaceTrash.d.ts +5 -4
  83. package/dist/connection/storage/ConnectedWorkspaceTrash.js +1 -1
  84. package/dist/connection/storage/ConnectedWorkspaceTrash.js.map +2 -2
  85. package/dist/embed/index.cjs +15 -16
  86. package/dist/facts/index.cjs +43 -43
  87. package/dist/files/FilesPage.d.ts +4 -1
  88. package/dist/files/FilesPage.js +1 -1
  89. package/dist/files/FilesPage.js.map +2 -2
  90. package/dist/files/SelectionBar.js +1 -1
  91. package/dist/files/SelectionBar.js.map +2 -2
  92. package/dist/files/index.cjs +253 -254
  93. package/dist/index.cjs +238 -238
  94. package/dist/pages/index.cjs +291 -38
  95. package/dist/pages/index.cjs.map +1 -1
  96. package/dist/settings/index.cjs +9 -9
  97. package/dist/shell/index.cjs +1 -1
  98. package/dist/styles.css +1 -1
  99. package/dist/workflow-canvas/index.cjs +25 -26
  100. package/dist/workflow-canvas/index.cjs.map +1 -1
  101. package/node_modules/@arbidocs/coedit/package.json +1 -1
  102. package/package.json +5 -5
  103. package/src/blocks.css +18 -0
  104. package/dist/DocumentReviewCard-ILDLYZ5A.cjs.map +0 -1
  105. package/dist/FilesViewerDialog-YLD5YFP2.cjs.map +0 -1
  106. package/dist/chunk-FEAHTNTY.cjs.map +0 -1
  107. package/dist/chunk-NRGLF4J4.cjs.map +0 -1
  108. package/dist/chunk-T3Y3LZ4Y.cjs +0 -477
  109. package/dist/chunk-T3Y3LZ4Y.cjs.map +0 -1
@@ -2,7 +2,7 @@
2
2
  'use strict';
3
3
 
4
4
  var chunkK5F2VNCX_cjs = require('../chunk-K5F2VNCX.cjs');
5
- var chunkFEAHTNTY_cjs = require('../chunk-FEAHTNTY.cjs');
5
+ var chunkYO7GDNEW_cjs = require('../chunk-YO7GDNEW.cjs');
6
6
  require('../chunk-DWRUGOTQ.cjs');
7
7
  require('../chunk-KD66CBYO.cjs');
8
8
  require('../chunk-7UPEFZCV.cjs');
@@ -10,7 +10,9 @@ require('../chunk-V27WLYTG.cjs');
10
10
  require('../chunk-SGYURQ23.cjs');
11
11
  var chunkDLGYR4JL_cjs = require('../chunk-DLGYR4JL.cjs');
12
12
  require('../chunk-JWCVA4LC.cjs');
13
- require('../chunk-T3Y3LZ4Y.cjs');
13
+ var chunk44M4FI2N_cjs = require('../chunk-44M4FI2N.cjs');
14
+ require('../chunk-223D4727.cjs');
15
+ require('../chunk-SNUBQMIS.cjs');
14
16
  require('../chunk-5GBM7BQB.cjs');
15
17
  require('../chunk-UD3LPATQ.cjs');
16
18
  var chunk6I5HHWCD_cjs = require('../chunk-6I5HHWCD.cjs');
@@ -19,17 +21,25 @@ var chunkGK3U3FWY_cjs = require('../chunk-GK3U3FWY.cjs');
19
21
  require('../chunk-PBPO54KZ.cjs');
20
22
  var chunkQ25CZLK6_cjs = require('../chunk-Q25CZLK6.cjs');
21
23
  var chunkMWHVETKN_cjs = require('../chunk-MWHVETKN.cjs');
24
+ require('../chunk-DTMBAFIL.cjs');
22
25
  var chunkNSD37OF5_cjs = require('../chunk-NSD37OF5.cjs');
23
26
  require('../chunk-7G2LJMUG.cjs');
24
27
  require('../chunk-WRTEKOQP.cjs');
28
+ require('../chunk-SK6HQ46Q.cjs');
29
+ require('../chunk-WCT6FT2K.cjs');
25
30
  require('../chunk-2P7VH2SK.cjs');
26
31
  require('../chunk-ZU2B2RZK.cjs');
27
32
  require('../chunk-BH322H5B.cjs');
28
33
  require('../chunk-M55XUF4L.cjs');
29
34
  require('../chunk-EVZH6Z5O.cjs');
35
+ require('../chunk-S237ORM3.cjs');
36
+ require('../chunk-II2OEXHW.cjs');
30
37
  require('../chunk-G3MRW4WB.cjs');
31
38
  require('../chunk-AHDJXIUB.cjs');
39
+ require('../chunk-S3GVFAFB.cjs');
40
+ require('../chunk-6UZC4XVV.cjs');
32
41
  require('../chunk-SLCH5JRI.cjs');
42
+ require('../chunk-DKY67DA6.cjs');
33
43
  require('../chunk-YA6GXWC2.cjs');
34
44
  require('../chunk-ZVEW3JBT.cjs');
35
45
  var chunkMHIG6GGS_cjs = require('../chunk-MHIG6GGS.cjs');
@@ -64,7 +74,7 @@ var documentTools = require('@arbidocs/react/document-tools');
64
74
  var viewers = require('@arbidocs/react/viewers');
65
75
 
66
76
  var PAGE_TEMPLATES = [
67
- chunkFEAHTNTY_cjs.WORKSPACE_DASHBOARD_PAGE,
77
+ chunkYO7GDNEW_cjs.WORKSPACE_DASHBOARD_PAGE,
68
78
  ...chunkYSAUOJA7_cjs.DASHBOARD_TEMPLATES
69
79
  ];
70
80
  function pageOfTemplate(template) {
@@ -701,10 +711,31 @@ function pitchOf(grid) {
701
711
  row: px(PAGE_ROW_HEIGHT) * rem + px(style.rowGap)
702
712
  };
703
713
  }
704
- function pressesHeader(target) {
714
+ function pressesHeader(event, header) {
715
+ const target = event.target;
705
716
  if (!(target instanceof Element)) return false;
706
717
  if (target.closest("[data-page-move]")) return true;
707
- return !!target.closest("[data-page-header]") && !target.closest(NO_DRAG);
718
+ if (target.closest(NO_DRAG)) return false;
719
+ if (target.closest("[data-page-header]")) return true;
720
+ if (!header) return false;
721
+ const band = header.getBoundingClientRect();
722
+ return event.clientY >= band.top && event.clientY < band.bottom;
723
+ }
724
+ function useHeaderEnd(cell, controls) {
725
+ react$1.useLayoutEffect(() => {
726
+ const el = cell.current;
727
+ const box = controls.current;
728
+ if (!el || !box) return;
729
+ const measure = () => {
730
+ const width = box.offsetWidth;
731
+ el.style.setProperty("--page-header-end", width ? `${width}px` : "0px");
732
+ };
733
+ measure();
734
+ if (typeof ResizeObserver === "undefined") return;
735
+ const observer = new ResizeObserver(measure);
736
+ observer.observe(box);
737
+ return () => observer.disconnect();
738
+ }, [cell, controls]);
708
739
  }
709
740
  var keyOf = (blocks) => blocks.map((b) => `${b.id}:${b.layout.x},${b.layout.y},${b.layout.w},${b.layout.h}`).join("|");
710
741
  var ARROWS = {
@@ -728,13 +759,16 @@ function EditableCell({
728
759
  testId
729
760
  }) {
730
761
  const element = react$1.useRef(null);
762
+ const header = react$1.useRef(null);
763
+ const controls = react$1.useRef(null);
764
+ useHeaderEnd(element, controls);
731
765
  const dropped = react$1.useRef(false);
732
766
  const escape = react$1.useRef(null);
733
767
  const gesture = chunkK5F2VNCX_cjs.usePointerGesture({
734
768
  element,
735
769
  threshold: 4,
736
770
  begin: (kind, event) => {
737
- if (kind === "move" && !pressesHeader(event.target)) return null;
771
+ if (kind === "move" && !pressesHeader(event, header.current)) return null;
738
772
  const { col, row } = pitchOf(grid());
739
773
  if (!col || !row) return null;
740
774
  return { base: blocks, start: block.layout, col, row, shown: keyOf(blocks) };
@@ -813,6 +847,10 @@ function EditableCell({
813
847
  ),
814
848
  "data-dragging": dragged || void 0,
815
849
  ...gesture.handlers,
850
+ onPointerDown: (event) => {
851
+ dropped.current = false;
852
+ gesture.start(event, "move", { lazy: true });
853
+ },
816
854
  onClickCapture: (event) => {
817
855
  if (!dropped.current) return;
818
856
  dropped.current = false;
@@ -822,20 +860,17 @@ function EditableCell({
822
860
  testId: `${testId}-cell-${block.id}`,
823
861
  children: [
824
862
  renderBlock(block),
825
- /* @__PURE__ */ jsxRuntime.jsxs(
863
+ /* @__PURE__ */ jsxRuntime.jsx(
826
864
  "div",
827
865
  {
866
+ ref: header,
828
867
  className: ui.cn(
829
- "absolute inset-x-0 top-0 z-10 flex h-10 items-center justify-end gap-1 rounded-t-xl px-2 md:touch-none",
830
- dragged ? "cursor-grabbing" : "md:cursor-grab"
868
+ "pointer-events-none absolute inset-x-0 top-0 z-10 flex h-10 items-center justify-end rounded-t-xl px-2",
869
+ dragged && "cursor-grabbing"
831
870
  ),
832
871
  "data-page-header": true,
833
- onPointerDown: (event) => {
834
- dropped.current = false;
835
- gesture.start(event, "move", { lazy: true });
836
- },
837
872
  "data-testid": `${testId}-header-${block.id}`,
838
- children: [
873
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: controls, className: "pointer-events-auto flex items-center gap-1 md:touch-none", children: [
839
874
  actionsOf?.(block),
840
875
  /* @__PURE__ */ jsxRuntime.jsx(
841
876
  ui.Button,
@@ -855,7 +890,7 @@ function EditableCell({
855
890
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Move, { className: "size-3.5" })
856
891
  }
857
892
  )
858
- ]
893
+ ] })
859
894
  }
860
895
  ),
861
896
  RESIZE_HANDLES.map(({ kind, left, top, cursor }) => /* @__PURE__ */ jsxRuntime.jsx(
@@ -997,7 +1032,7 @@ function BlockCard({
997
1032
  className: ui.cn("flex h-full min-h-[14rem] flex-col overflow-hidden rounded-xl p-0", className),
998
1033
  "data-testid": testId,
999
1034
  children: [
1000
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 border-b border-border px-4 py-2", children: [
1035
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 border-b border-border py-2 pl-4 pr-[max(1rem,calc(var(--page-header-end,0px)+0.5rem))]", children: [
1001
1036
  icon,
1002
1037
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm font-medium", "data-testid": testId && `${testId}-name`, children: title }),
1003
1038
  actions && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "ml-auto flex gap-1", children: actions })
@@ -1220,7 +1255,7 @@ function WithNewFileMenu({ children }) {
1220
1255
  const [open, setOpen] = react$1.useState(false);
1221
1256
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1222
1257
  children(() => setOpen(true)),
1223
- /* @__PURE__ */ jsxRuntime.jsx(chunkFEAHTNTY_cjs.ConnectedNewFileMenu, { open, onOpenChange: setOpen })
1258
+ /* @__PURE__ */ jsxRuntime.jsx(chunkYO7GDNEW_cjs.ConnectedNewFileMenu, { open, onOpenChange: setOpen })
1224
1259
  ] });
1225
1260
  }
1226
1261
  function PageBlockView({
@@ -1301,18 +1336,18 @@ function PageBlockView({
1301
1336
  ) });
1302
1337
  case "list":
1303
1338
  return /* @__PURE__ */ jsxRuntime.jsx(LiveBlockCard, { actions, className, testId, children: block.config.source === "documents" ? /* @__PURE__ */ jsxRuntime.jsx(WithNewFileMenu, { children: (onCreateNew) => /* @__PURE__ */ jsxRuntime.jsx(
1304
- chunkFEAHTNTY_cjs.ConnectedListBlock,
1339
+ chunkYO7GDNEW_cjs.ConnectedListBlock,
1305
1340
  {
1306
1341
  config: block.config,
1307
1342
  onCreateNew,
1308
1343
  testId: testId && `${testId}-list`
1309
1344
  }
1310
- ) }) : /* @__PURE__ */ jsxRuntime.jsx(chunkFEAHTNTY_cjs.ConnectedListBlock, { config: block.config, testId: testId && `${testId}-list` }) });
1345
+ ) }) : /* @__PURE__ */ jsxRuntime.jsx(chunkYO7GDNEW_cjs.ConnectedListBlock, { config: block.config, testId: testId && `${testId}-list` }) });
1311
1346
  case "carousel":
1312
- return /* @__PURE__ */ jsxRuntime.jsx(LiveBlockCard, { actions, className, testId, children: /* @__PURE__ */ jsxRuntime.jsx(chunkFEAHTNTY_cjs.ConnectedCarouselBlock, { config: block.config, testId: testId && `${testId}-carousel` }) });
1347
+ return /* @__PURE__ */ jsxRuntime.jsx(LiveBlockCard, { actions, className, testId, children: /* @__PURE__ */ jsxRuntime.jsx(chunkYO7GDNEW_cjs.ConnectedCarouselBlock, { config: block.config, testId: testId && `${testId}-carousel` }) });
1313
1348
  case "agenda":
1314
1349
  return /* @__PURE__ */ jsxRuntime.jsx(LiveBlockCard, { actions, className, testId, children: /* @__PURE__ */ jsxRuntime.jsx(
1315
- chunkFEAHTNTY_cjs.ConnectedAgendaBlock,
1350
+ chunkYO7GDNEW_cjs.ConnectedAgendaBlock,
1316
1351
  {
1317
1352
  config: block.config,
1318
1353
  className: "border-0 p-0",
@@ -1320,7 +1355,7 @@ function PageBlockView({
1320
1355
  }
1321
1356
  ) });
1322
1357
  case "start":
1323
- return /* @__PURE__ */ jsxRuntime.jsx(LiveBlockCard, { actions, className, testId, children: /* @__PURE__ */ jsxRuntime.jsx(WithNewFileMenu, { children: (onCreateNew) => /* @__PURE__ */ jsxRuntime.jsx(chunkFEAHTNTY_cjs.ConnectedStartBlock, { onCreateNew }) }) });
1358
+ return /* @__PURE__ */ jsxRuntime.jsx(LiveBlockCard, { actions, className, testId, children: /* @__PURE__ */ jsxRuntime.jsx(WithNewFileMenu, { children: (onCreateNew) => /* @__PURE__ */ jsxRuntime.jsx(chunkYO7GDNEW_cjs.ConnectedStartBlock, { onCreateNew }) }) });
1324
1359
  }
1325
1360
  }
1326
1361
  function NewPageButton({
@@ -1455,6 +1490,8 @@ function PageView({
1455
1490
  onEdit,
1456
1491
  onShare,
1457
1492
  onDelete,
1493
+ onCopy,
1494
+ onMove,
1458
1495
  children,
1459
1496
  testId
1460
1497
  }) {
@@ -1489,7 +1526,7 @@ function PageView({
1489
1526
  " ",
1490
1527
  l.edit
1491
1528
  ] }),
1492
- canDelete && /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu, { children: [
1529
+ (canDelete || onCopy) && /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu, { children: [
1493
1530
  /* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
1494
1531
  ui.Button,
1495
1532
  {
@@ -1500,19 +1537,32 @@ function PageView({
1500
1537
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MoreHorizontal, { className: "size-4" })
1501
1538
  }
1502
1539
  ) }),
1503
- /* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenuContent, { align: "end", children: /* @__PURE__ */ jsxRuntime.jsxs(
1504
- ui.DropdownMenuItem,
1505
- {
1506
- onSelect: onDelete,
1507
- className: "text-destructive focus:text-destructive",
1508
- "data-testid": `${testId}-delete`,
1509
- children: [
1510
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "size-4" }),
1511
- " ",
1512
- l.delete
1513
- ]
1514
- }
1515
- ) })
1540
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenuContent, { align: "end", children: [
1541
+ onCopy && /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenuItem, { onSelect: onCopy, "data-testid": `${testId}-copy-to`, children: [
1542
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Copy, { className: "size-4" }),
1543
+ " ",
1544
+ l.copyToWorkspace
1545
+ ] }),
1546
+ onCopy && onMove && canDelete && /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenuItem, { onSelect: onMove, "data-testid": `${testId}-move-to`, children: [
1547
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowRightLeft, { className: "size-4" }),
1548
+ " ",
1549
+ l.moveToWorkspace
1550
+ ] }),
1551
+ onCopy && canDelete && /* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenuSeparator, {}),
1552
+ canDelete && /* @__PURE__ */ jsxRuntime.jsxs(
1553
+ ui.DropdownMenuItem,
1554
+ {
1555
+ onSelect: onDelete,
1556
+ className: "text-destructive focus:text-destructive",
1557
+ "data-testid": `${testId}-delete`,
1558
+ children: [
1559
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "size-4" }),
1560
+ " ",
1561
+ l.delete
1562
+ ]
1563
+ }
1564
+ )
1565
+ ] })
1516
1566
  ] })
1517
1567
  ] })
1518
1568
  }
@@ -1521,6 +1571,188 @@ function PageView({
1521
1571
  children
1522
1572
  ] });
1523
1573
  }
1574
+ var DEFAULT_PAGE_TRANSFER_LABELS = {
1575
+ title: (mode, title) => `${mode === "move" ? "Move" : "Copy"} \u201C${title}\u201D to a workspace`,
1576
+ description: (mode) => mode === "move" ? "The page goes to the workspace you pick, private to you, and is deleted here." : "A copy goes to the workspace you pick, private to you. This page stays as it is.",
1577
+ documents: "Documents on this page",
1578
+ documentsHelp: (documents) => `It shows ${documents === 1 ? "a document" : `${documents} documents`} of this workspace.`,
1579
+ documentsLink: "Leave them here \u2014 the copy keeps showing them to whoever can open them in this workspace",
1580
+ documentsInclude: "Copy them too \u2014 the copy shows the copies",
1581
+ viewsStay: (views) => `Its ${views === 1 ? "table view stays" : `${views} table views stay`} here: there, ${views === 1 ? "its block reads" : "their blocks read"} \u201Cnot available\u201D to anyone who cannot open ${views === 1 ? "it" : "them"} here.`,
1582
+ notRemovable: "You may not delete this page here, so it would be copied and stay here too.",
1583
+ cancel: "Cancel",
1584
+ submit: (mode) => mode === "move" ? "Move" : "Copy",
1585
+ starting: "Starting\u2026",
1586
+ progress: (mode, target) => `${mode === "move" ? "Moving" : "Copying"} to ${target}`,
1587
+ phase: {
1588
+ copy: "Copying",
1589
+ link: "Linking",
1590
+ remove: "Removing from this workspace",
1591
+ done: "Done"
1592
+ },
1593
+ done: (mode, target) => `${mode === "move" ? "Moved" : "Copied"} to ${target}.`,
1594
+ kept: (target) => `Copied to ${target}. It also stays here:`,
1595
+ failed: (mode, target) => `The page could not be ${mode === "move" ? "moved" : "copied"} to ${target}.`,
1596
+ open: "Open",
1597
+ close: "Close",
1598
+ startFailed: "The transfer could not start"
1599
+ };
1600
+ function PageTransferDialog(props) {
1601
+ if (!props.page) return null;
1602
+ return /* @__PURE__ */ jsxRuntime.jsx(OpenPageTransferDialog, { ...props, page: props.page });
1603
+ }
1604
+ function OpenPageTransferDialog({
1605
+ page,
1606
+ mode,
1607
+ onClose,
1608
+ onOpenCopy,
1609
+ labels,
1610
+ testId = "page-transfer"
1611
+ }) {
1612
+ const l = { ...DEFAULT_PAGE_TRANSFER_LABELS, ...labels };
1613
+ const { notify } = chunk46LX6EQT_cjs.useBlocksEnvironment();
1614
+ const { options, nameOf } = chunkYO7GDNEW_cjs.useTransferTargets();
1615
+ const trackTransfer = chunkYO7GDNEW_cjs.useExportStore((state) => state.trackTransfer);
1616
+ const [targetId, setTargetId] = react$1.useState(null);
1617
+ const [references, setReferences] = react$1.useState("link");
1618
+ const [jobId, setJobId] = react$1.useState(null);
1619
+ const [opening, setOpening] = react$1.useState(false);
1620
+ const scope = react$1.useMemo(() => react.pageTransferScope(page.id, references), [page.id, references]);
1621
+ const { data: plan } = react.usePlanWorkspaceTransfer(scope, mode, { enabled: !jobId });
1622
+ const start = react.useStartWorkspaceTransfer();
1623
+ const cancel = react.useCancelWorkspaceTransfer();
1624
+ const switchToPages = react.useSwitchToWorkspacePages();
1625
+ const { data: job } = react.useWorkspaceTransfer(jobId);
1626
+ const finished = !!jobId && react.isTransferFinished(job);
1627
+ const { data: items } = react.useWorkspaceTransferItems(jobId, { enabled: finished });
1628
+ const target = nameOf(job?.target_workspace_ext_id ?? targetId);
1629
+ const documents = page.documentIds.length;
1630
+ const views = page.viewIds.length;
1631
+ const copyId = react.transferredId(items, page.id);
1632
+ const pageItem = items?.find((i) => i.source_ext_id === page.id);
1633
+ const submit = async () => {
1634
+ if (!targetId) return;
1635
+ try {
1636
+ const started = await start.mutateAsync({
1637
+ scope,
1638
+ mode,
1639
+ targetWorkspaceId: targetId,
1640
+ // What the person asked for arrives: a same-titled page there is kept, the copy renamed "(2)".
1641
+ onConflict: "keep_both"
1642
+ });
1643
+ setJobId(started.external_id);
1644
+ trackTransfer(started.external_id);
1645
+ } catch (error) {
1646
+ const detail = error?.detail;
1647
+ notify(typeof detail === "string" ? detail : l.startFailed, "error");
1648
+ }
1649
+ };
1650
+ const openCopy = async () => {
1651
+ const workspaceId = job?.target_workspace_ext_id;
1652
+ if (!copyId || !workspaceId) return;
1653
+ setOpening(true);
1654
+ try {
1655
+ if (await switchToPages({ id: workspaceId, name: target })) onOpenCopy(copyId);
1656
+ onClose();
1657
+ } finally {
1658
+ setOpening(false);
1659
+ }
1660
+ };
1661
+ let body;
1662
+ let footer;
1663
+ if (!jobId) {
1664
+ body = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1665
+ /* @__PURE__ */ jsxRuntime.jsx(
1666
+ chunk44M4FI2N_cjs.ExportWorkspacePicker,
1667
+ {
1668
+ workspaces: options,
1669
+ selectedId: targetId,
1670
+ onSelect: setTargetId,
1671
+ testId: (id) => `${testId}-workspace-${id}`
1672
+ }
1673
+ ),
1674
+ documents > 0 && /* @__PURE__ */ jsxRuntime.jsx(
1675
+ chunk44M4FI2N_cjs.TransferReferencesChooser,
1676
+ {
1677
+ value: references,
1678
+ onChange: setReferences,
1679
+ labels: {
1680
+ references: l.documents,
1681
+ referencesHelp: l.documentsHelp(documents),
1682
+ referencesInclude: l.documentsInclude,
1683
+ referencesLink: l.documentsLink
1684
+ }
1685
+ }
1686
+ ),
1687
+ views > 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pt-2 text-sm text-muted-foreground", "data-testid": `${testId}-views`, children: l.viewsStay(views) }),
1688
+ mode === "move" && !!plan?.not_removable && /* @__PURE__ */ jsxRuntime.jsxs(
1689
+ "p",
1690
+ {
1691
+ className: "flex items-start gap-2 pt-2 text-sm",
1692
+ "data-testid": `${testId}-not-removable`,
1693
+ children: [
1694
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertTriangle, { className: "mt-0.5 size-4 shrink-0 text-yellow-text" }),
1695
+ l.notRemovable
1696
+ ]
1697
+ }
1698
+ )
1699
+ ] });
1700
+ footer = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1701
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "outline", onClick: onClose, "data-testid": `${testId}-cancel`, children: l.cancel }),
1702
+ /* @__PURE__ */ jsxRuntime.jsx(
1703
+ ui.Button,
1704
+ {
1705
+ onClick: () => void submit(),
1706
+ disabled: !targetId || start.isPending,
1707
+ "data-testid": `${testId}-submit`,
1708
+ children: start.isPending ? l.starting : l.submit(mode)
1709
+ }
1710
+ )
1711
+ ] });
1712
+ } else if (!finished || !items) {
1713
+ body = job ? /* @__PURE__ */ jsxRuntime.jsx(
1714
+ chunk44M4FI2N_cjs.TransferProgressView,
1715
+ {
1716
+ title: l.progress(mode, target),
1717
+ processed: job.processed ?? 0,
1718
+ total: job.total ?? 0,
1719
+ phaseLabel: l.phase[job.phase] ?? job.phase,
1720
+ onHide: finished ? void 0 : onClose,
1721
+ onCancel: finished ? void 0 : () => cancel.mutate(job.external_id),
1722
+ isCancelling: cancel.isPending
1723
+ }
1724
+ ) : /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
1725
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-4 animate-spin" }),
1726
+ " ",
1727
+ l.progress(mode, target)
1728
+ ] });
1729
+ } else {
1730
+ const kept = mode === "move" && pageItem?.status === "kept";
1731
+ const failed = !copyId;
1732
+ const Icon = failed ? lucideReact.XCircle : kept ? lucideReact.AlertTriangle : lucideReact.CheckCircle2;
1733
+ const tone = failed ? "text-red-text" : kept ? "text-yellow-text" : "text-green-text";
1734
+ const detail = failed ? pageItem?.message ?? job?.error : pageItem?.message;
1735
+ body = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3 pt-2", "data-testid": `${testId}-result`, children: [
1736
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: `mt-0.5 size-5 shrink-0 ${tone}` }),
1737
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 space-y-1 text-sm", children: [
1738
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-medium", children: failed ? l.failed(mode, target) : kept ? l.kept(target) : l.done(mode, target) }),
1739
+ detail && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "break-words text-muted-foreground", children: detail })
1740
+ ] })
1741
+ ] });
1742
+ footer = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1743
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "outline", onClick: onClose, "data-testid": `${testId}-close`, children: l.close }),
1744
+ copyId && /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick: () => void openCopy(), disabled: opening, "data-testid": `${testId}-open`, children: l.open })
1745
+ ] });
1746
+ }
1747
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.Dialog, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxRuntime.jsxs(ui.DialogContent, { className: "max-h-[90dvh] max-w-lg overflow-y-auto", "data-testid": testId, children: [
1748
+ /* @__PURE__ */ jsxRuntime.jsxs(ui.DialogHeader, { children: [
1749
+ /* @__PURE__ */ jsxRuntime.jsx(ui.DialogTitle, { children: l.title(mode, page.spec.title) }),
1750
+ /* @__PURE__ */ jsxRuntime.jsx(ui.DialogDescription, { children: l.description(mode) })
1751
+ ] }),
1752
+ body,
1753
+ footer && /* @__PURE__ */ jsxRuntime.jsx(ui.DialogFooter, { children: footer })
1754
+ ] }) });
1755
+ }
1524
1756
 
1525
1757
  // src/connection/pages/labels.ts
1526
1758
  var DEFAULT_PAGES_PAGE_LABELS = {
@@ -1542,6 +1774,8 @@ var DEFAULT_PAGES_PAGE_LABELS = {
1542
1774
  back: "All pages",
1543
1775
  edit: "Edit",
1544
1776
  more: "More page actions",
1777
+ copyToWorkspace: "Copy to workspace\u2026",
1778
+ moveToWorkspace: "Move to workspace\u2026",
1545
1779
  delete: "Delete",
1546
1780
  confirmDelete: (title) => `Delete the page \u201C${title}\u201D? Its blocks go with it.`,
1547
1781
  deleteFailed: "The page could not be deleted",
@@ -1647,6 +1881,7 @@ function ConnectedPagesPage({
1647
1881
  gridLabels,
1648
1882
  tableLabels,
1649
1883
  pickerLabels,
1884
+ transferLabels,
1650
1885
  className,
1651
1886
  testId = "pages"
1652
1887
  }) {
@@ -1675,6 +1910,7 @@ function ConnectedPagesPage({
1675
1910
  openIdRef.current = openId;
1676
1911
  }, [openId]);
1677
1912
  const [editing, setEditing] = react$1.useState(null);
1913
+ const [transfer, setTransfer] = react$1.useState(null);
1678
1914
  const open = react$1.useMemo(
1679
1915
  () => pages.data?.find((p) => p.id === openId && !p.unreadable),
1680
1916
  [pages.data, openId]
@@ -1931,6 +2167,8 @@ function ConnectedPagesPage({
1931
2167
  onEdit: () => startEditing(open),
1932
2168
  onShare: () => void sharePage(open),
1933
2169
  onDelete: () => void deletePage(open),
2170
+ onCopy: open.legacy ? void 0 : () => setTransfer({ page: open, mode: "copy" }),
2171
+ onMove: open.legacy ? void 0 : () => setTransfer({ page: open, mode: "move" }),
1934
2172
  testId,
1935
2173
  children: open.spec.blocks.length > 0 && (canArrange(open) ? (
1936
2174
  // Who may change the page arranges it as it is read: a drop saves at once.
@@ -1995,12 +2233,25 @@ function ConnectedPagesPage({
1995
2233
  }
1996
2234
  );
1997
2235
  }
1998
- return /* @__PURE__ */ jsxRuntime.jsx(
2236
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1999
2237
  "div",
2000
2238
  {
2001
2239
  className: ui.cn("h-full min-h-0 w-full overflow-y-auto p-4 sm:p-6", className),
2002
2240
  "data-testid": testId,
2003
- children: content
2241
+ children: [
2242
+ content,
2243
+ /* @__PURE__ */ jsxRuntime.jsx(
2244
+ PageTransferDialog,
2245
+ {
2246
+ page: transfer?.page ?? null,
2247
+ mode: transfer?.mode ?? "copy",
2248
+ onClose: () => setTransfer(null),
2249
+ onOpenCopy: setOpenId,
2250
+ labels: transferLabels,
2251
+ testId: `${testId}-transfer`
2252
+ }
2253
+ )
2254
+ ]
2004
2255
  }
2005
2256
  );
2006
2257
  }
@@ -2014,6 +2265,7 @@ exports.DEFAULT_DOCUMENT_BLOCK_LABELS = DEFAULT_DOCUMENT_BLOCK_LABELS;
2014
2265
  exports.DEFAULT_EDITABLE_PAGE_GRID_LABELS = DEFAULT_EDITABLE_PAGE_GRID_LABELS;
2015
2266
  exports.DEFAULT_LIVE_BLOCK_EDITOR_LABELS = DEFAULT_LIVE_BLOCK_EDITOR_LABELS;
2016
2267
  exports.DEFAULT_PAGES_PAGE_LABELS = DEFAULT_PAGES_PAGE_LABELS;
2268
+ exports.DEFAULT_PAGE_TRANSFER_LABELS = DEFAULT_PAGE_TRANSFER_LABELS;
2017
2269
  exports.DEFAULT_TABLE_VIEW_BLOCK_LABELS = DEFAULT_TABLE_VIEW_BLOCK_LABELS;
2018
2270
  exports.DEFAULT_VIEW_PICKER_LABELS = DEFAULT_VIEW_PICKER_LABELS;
2019
2271
  exports.DocumentBlockView = DocumentBlockView;
@@ -2029,6 +2281,7 @@ exports.PAGE_TEMPLATES = PAGE_TEMPLATES;
2029
2281
  exports.PageBlockView = PageBlockView;
2030
2282
  exports.PageCell = PageCell;
2031
2283
  exports.PageGrid = PageGrid;
2284
+ exports.PageTransferDialog = PageTransferDialog;
2032
2285
  exports.SLOTS_ACROSS = SLOTS_ACROSS;
2033
2286
  exports.SLOT_COLUMNS = SLOT_COLUMNS;
2034
2287
  exports.SLOT_ROWS = SLOT_ROWS;