@w100n/documents 0.18.0 → 0.18.1

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
@@ -2412,8 +2412,8 @@ function PdfView({ bytes, t, language, worker, rights, host, documentId, onSaved
2412
2412
 
2413
2413
  // src/DocumentOverlay.tsx
2414
2414
  import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
2415
- var TextEditor = lazy(() => import("./TextEditor-CYS4U5XA.js"));
2416
- var SheetView = lazy(() => import("./SheetView-43JDIP7D.js"));
2415
+ var TextEditor = lazy(() => import("./TextEditor-ZY4B7YIF.js"));
2416
+ var SheetView = lazy(() => import("./SheetView-F4CBWEOS.js"));
2417
2417
  var icons = { docx: FileText, markdown: FileType, pdf: Files, sheet: FileSpreadsheet, slides: Presentation };
2418
2418
  var read = { view: true, comment: false, edit: false };
2419
2419
  var quiet = () => {
@@ -3486,8 +3486,8 @@ function Tree({ items, folders, names: names2, spaceId, current, t, edit, onOpen
3486
3486
 
3487
3487
  // src/DocumentsWorkspace.tsx
3488
3488
  import { Fragment as Fragment11, jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
3489
- var TextEditor2 = lazy2(() => import("./TextEditor-CYS4U5XA.js"));
3490
- var SheetView2 = lazy2(() => import("./SheetView-43JDIP7D.js"));
3489
+ var TextEditor2 = lazy2(() => import("./TextEditor-ZY4B7YIF.js"));
3490
+ var SheetView2 = lazy2(() => import("./SheetView-F4CBWEOS.js"));
3491
3491
  var Compare = lazy2(() => import("./Compare-RHAUAKUJ.js"));
3492
3492
  var icons4 = { docx: FileText4, markdown: FileType6, pdf: Files3, sheet: FileSpreadsheet4, slides: Presentation4 };
3493
3493
  function DocumentsWorkspace({ host, language = "en", theme = "light", place, onPlace, start, end, aside, actions }) {
@@ -3564,6 +3564,14 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3564
3564
  const [menu, setMenu] = useState11(null);
3565
3565
  const [spot2, setSpot] = useState11(null);
3566
3566
  const [edit, setEdit] = useState11(null);
3567
+ const popup = useRef6(null);
3568
+ useLayoutEffect3(() => {
3569
+ const el = popup.current;
3570
+ const at = menu ?? spot2;
3571
+ if (!el || !at) return;
3572
+ el.style.top = `${Math.max(8, Math.min(at.y, innerHeight - el.offsetHeight - 8))}px`;
3573
+ el.style.left = `${Math.max(8, Math.min(at.x, innerWidth - el.offsetWidth - 8))}px`;
3574
+ }, [menu, spot2]);
3567
3575
  const [naming, setNaming] = useState11(null);
3568
3576
  const [notice, setNotice] = useState11(null);
3569
3577
  const early = useRef6(/* @__PURE__ */ new Map());
@@ -3785,8 +3793,8 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
3785
3793
  clearTimeout(hover.current);
3786
3794
  hover.current = window.setTimeout(() => {
3787
3795
  if (item.id === here.documentId) return;
3788
- if (item.kind === "docx" || item.kind === "markdown") void import("./TextEditor-CYS4U5XA.js");
3789
- if (item.kind === "sheet") void import("./SheetView-43JDIP7D.js");
3796
+ if (item.kind === "docx" || item.kind === "markdown") void import("./TextEditor-ZY4B7YIF.js");
3797
+ if (item.kind === "sheet") void import("./SheetView-F4CBWEOS.js");
3790
3798
  const kept2 = early.current.get(item.id);
3791
3799
  if (kept2 && Date.now() - kept2.at < 15e3 || item.size > 5e6) return;
3792
3800
  const next = { at: Date.now(), doc: host.document(item.id), bytes: host.content(item.id, null) };
@@ -4151,28 +4159,22 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
4151
4159
  kept?.id === here.documentId && kept.state === "failed" && /* @__PURE__ */ jsx12("span", { className: "w100n-docs-muted", role: "alert", children: t.templateFailed }),
4152
4160
  renamed === "failed" && /* @__PURE__ */ jsx12("span", { className: "w100n-docs-muted", children: t.renameFailed }),
4153
4161
  docbar && /* @__PURE__ */ jsx12("span", { ref: setStatusAt, className: "w100n-docs-status" }),
4154
- host.send && doc.data && !versionId && !doc.data.id.includes(":") && /* @__PURE__ */ jsxs12(
4162
+ host.send && doc.data && !versionId && !doc.data.id.includes(":") && /* @__PURE__ */ jsx12(
4155
4163
  "button",
4156
4164
  {
4157
4165
  type: "button",
4158
- className: "w100n-docs-action",
4166
+ className: "w100n-docs-action w100n-docs-square",
4159
4167
  "data-tone": "blue",
4160
4168
  "aria-label": t.sendChat,
4161
4169
  title: t.sendChat,
4162
4170
  onClick: () => host.send(doc.data.id),
4163
- children: [
4164
- /* @__PURE__ */ jsx12(Send, { "aria-hidden": true }),
4165
- /* @__PURE__ */ jsx12("span", { children: t.sendChat })
4166
- ]
4171
+ children: /* @__PURE__ */ jsx12(Send, { "aria-hidden": true })
4167
4172
  }
4168
4173
  ),
4169
- sharing && /* @__PURE__ */ jsxs12("button", { type: "button", className: "w100n-docs-action", "aria-label": t.share, title: t.share, onClick: () => {
4174
+ sharing && /* @__PURE__ */ jsx12("button", { type: "button", className: "w100n-docs-action w100n-docs-square", "aria-label": t.share, title: t.share, onClick: () => {
4170
4175
  setTab("sharing");
4171
4176
  side("panel", true);
4172
- }, children: [
4173
- /* @__PURE__ */ jsx12(Share2, { "aria-hidden": true }),
4174
- /* @__PURE__ */ jsx12("span", { children: t.share })
4175
- ] }),
4177
+ }, children: /* @__PURE__ */ jsx12(Share2, { "aria-hidden": true }) }),
4176
4178
  doc.data && !versionId && actions?.(doc.data),
4177
4179
  narrow && panelToggle,
4178
4180
  end && /* @__PURE__ */ jsx12("div", { className: "w100n-docs-end w100n-docs-slot", children: slot(end) })
@@ -4562,7 +4564,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
4562
4564
  setMaking(false);
4563
4565
  opened(made);
4564
4566
  } }),
4565
- menu && /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-menu w100n-docs-context", role: "menu", "aria-label": t.fileActions, style: { left: menu.x, top: menu.y }, children: [
4567
+ menu && /* @__PURE__ */ jsxs12("div", { ref: popup, className: "w100n-docs-menu w100n-docs-context", role: "menu", "aria-label": t.fileActions, style: { left: menu.x, top: menu.y }, children: [
4566
4568
  /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-context-head", children: [
4567
4569
  /* @__PURE__ */ jsx12("b", { children: menu.item.name }),
4568
4570
  /* @__PURE__ */ jsx12("small", { children: [t.kinds[menu.item.kind], size(menu.item.size), names2.get(menu.item.spaceId), menu.item.folder].filter(Boolean).join(" \xB7 ") }),
@@ -4662,7 +4664,7 @@ function DocumentsWorkspace({ host, language = "en", theme = "light", place, onP
4662
4664
  ] })
4663
4665
  ] })
4664
4666
  ] }),
4665
- spot2 && /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-menu w100n-docs-context", role: "menu", "aria-label": t.folderActions, style: { left: spot2.x, top: spot2.y }, children: [
4667
+ spot2 && /* @__PURE__ */ jsxs12("div", { ref: popup, className: "w100n-docs-menu w100n-docs-context", role: "menu", "aria-label": t.folderActions, style: { left: spot2.x, top: spot2.y }, children: [
4666
4668
  /* @__PURE__ */ jsxs12("div", { className: "w100n-docs-context-head", children: [
4667
4669
  /* @__PURE__ */ jsx12("b", { children: folderNamed(spot2.at) }),
4668
4670
  spot2.at.folder && /* @__PURE__ */ jsx12("small", { children: [names2.get(spot2.at.spaceId), ...spot2.at.folder.split("/").slice(0, -1)].filter(Boolean).join(" / ") })
@@ -4738,8 +4740,8 @@ function FilePreview({ url, name, mimeType, size = 0, bytes, pdfWorker }) {
4738
4740
  import { lazy as lazy3, Suspense as Suspense3, useRef as useRef7, useState as useState13 } from "react";
4739
4741
  import { Ban as Ban2, Download as Download4, Eye as Eye2, FileDown as FileDown2, FileSpreadsheet as FileSpreadsheet5, FileText as FileText5, FileType as FileType7, Files as Files4, Lock as Lock2, Presentation as Presentation5, UserRound } from "lucide-react";
4740
4742
  import { Fragment as Fragment12, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
4741
- var TextEditor3 = lazy3(() => import("./TextEditor-CYS4U5XA.js"));
4742
- var SheetView3 = lazy3(() => import("./SheetView-43JDIP7D.js"));
4743
+ var TextEditor3 = lazy3(() => import("./TextEditor-ZY4B7YIF.js"));
4744
+ var SheetView3 = lazy3(() => import("./SheetView-F4CBWEOS.js"));
4743
4745
  var icons5 = { docx: FileText5, markdown: FileType7, pdf: Files4, sheet: FileSpreadsheet5, slides: Presentation5 };
4744
4746
  var GuestRefused = class extends Error {
4745
4747
  constructor(reason, file = "", sharedBy = "") {