@ai-matrx/office 0.8.59 → 0.8.60

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/pdf.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // src/pdf/PdfWorkspace.tsx
4
4
  import { Fragment as Fragment3, useCallback, useEffect as useEffect4, useLayoutEffect, useMemo as useMemo2, useRef as useRef2, useState as useState4 } from "react";
5
5
  import { cn as cn2 } from "@ai-matrx/design-system/cn";
6
- import { Button as Button3, Field as Field3, PageRangeInput as PageRangeInput2, SegmentedControl as SegmentedControl3, ToolRail, parsePageRanges as parsePageRanges2 } from "@ai-matrx/design-system/controls";
6
+ import { Button as Button3, Field as Field3, PageRangeInput as PageRangeInput2, SegmentedControl as SegmentedControl3, Tile as Tile2, ToolRail, parsePageRanges as parsePageRanges2 } from "@ai-matrx/design-system/controls";
7
7
  import {
8
8
  ChevronLeftIcon,
9
9
  ChevronRightIcon,
@@ -157,7 +157,7 @@ function LayersList({ host }) {
157
157
 
158
158
  // src/pdf/panels.tsx
159
159
  import { useEffect as useEffect2, useMemo, useRef, useState as useState2 } from "react";
160
- import { Button, Field, SegmentedControl as SegmentedControl2, Select } from "@ai-matrx/design-system/controls";
160
+ import { Button, Field, SegmentedControl as SegmentedControl2, Select, Textarea } from "@ai-matrx/design-system/controls";
161
161
  import { PageRangeInput, formatPageRanges, parsePageRanges } from "@ai-matrx/design-system/controls";
162
162
  import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
163
163
  function Row({ label, children }) {
@@ -199,12 +199,14 @@ function Result({ result, host, error }) {
199
199
  ] }) : null,
200
200
  result?.kind === "text" ? /* @__PURE__ */ jsxs2(Fragment, { children: [
201
201
  /* @__PURE__ */ jsx2(
202
- "textarea",
202
+ Textarea,
203
203
  {
204
204
  readOnly: true,
205
205
  value: result.text,
206
206
  "aria-label": "Extracted text",
207
- className: "h-48 w-full resize-none rounded-md border border-border bg-background p-2 text-xs text-foreground"
207
+ minHeight: 192,
208
+ maxHeight: 192,
209
+ className: "w-full resize-none"
208
210
  }
209
211
  ),
210
212
  /* @__PURE__ */ jsx2(Button, { variant: "outline", onClick: () => void copy(result.text), children: copied ? "Copied" : "Copy text" })
@@ -596,7 +598,7 @@ function formatKeys(keys, mac) {
596
598
  // src/pdf/markup-panel.tsx
597
599
  import { useEffect as useEffect3, useState as useState3 } from "react";
598
600
  import { cn } from "@ai-matrx/design-system/cn";
599
- import { AnchoredToolbar, Button as Button2, ColorSwatchRow, Field as Field2, OpacitySlider, Select as Select2 } from "@ai-matrx/design-system/controls";
601
+ import { AnchoredToolbar, Button as Button2, ColorSwatchRow, Field as Field2, OpacitySlider, Select as Select2, Tile } from "@ai-matrx/design-system/controls";
600
602
  import {
601
603
  HighlighterIcon,
602
604
  ImageIcon,
@@ -682,22 +684,19 @@ function MarkupPanel({ host, engine, snapshot, active, onPick, blocked, busy, on
682
684
  const Icon = MARKUP_ICONS[t.id];
683
685
  const on = t.id === active;
684
686
  return /* @__PURE__ */ jsxs3("li", { children: [
685
- /* @__PURE__ */ jsxs3(
686
- "button",
687
+ /* @__PURE__ */ jsx3(
688
+ Tile,
687
689
  {
688
690
  type: "button",
689
- "aria-pressed": t.status === "ready" ? on : void 0,
691
+ dense: true,
692
+ variant: "quiet",
693
+ title: t.label,
694
+ icon: /* @__PURE__ */ jsx3(Icon, {}),
695
+ end: t.status === "soon" ? /* @__PURE__ */ jsx3("span", { className: "shrink-0 whitespace-nowrap text-muted-foreground", children: "Soon" }) : /* @__PURE__ */ jsx3("kbd", { className: "text-muted-foreground", children: t.key?.toUpperCase() }),
696
+ ...t.status === "ready" ? { selected: on } : {},
690
697
  disabled: t.status === "ready" && (!engine || Boolean(blocked)),
691
698
  onClick: () => t.status === "soon" ? onSoon(markupComingSoonId(t.id)) : onPick(t.id),
692
- className: cn(
693
- "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:text-disabled-foreground",
694
- on && "bg-accent"
695
- ),
696
- children: [
697
- /* @__PURE__ */ jsx3(Icon, { className: "size-4 shrink-0" }),
698
- /* @__PURE__ */ jsx3("span", { className: "min-w-0 flex-1 truncate", children: t.label }),
699
- t.status === "soon" ? /* @__PURE__ */ jsx3("span", { className: "shrink-0 whitespace-nowrap text-muted-foreground", children: "Soon" }) : /* @__PURE__ */ jsx3("kbd", { className: "text-muted-foreground", children: t.key?.toUpperCase() })
700
- ]
699
+ className: "w-full"
701
700
  }
702
701
  ),
703
702
  t.status === "soon" && t.reason ? /* @__PURE__ */ jsx3("div", { className: "pl-8 pr-2 text-xs text-muted-foreground", children: t.reason }) : null
@@ -735,19 +734,22 @@ function MarkupPanel({ host, engine, snapshot, active, onPick, blocked, busy, on
735
734
  ] })
736
735
  ] }),
737
736
  host.existingAnnotations ? /* @__PURE__ */ jsxs3(Section, { label: "In this file", children: [
738
- existing === null ? /* @__PURE__ */ jsx3("div", { className: "text-xs text-muted-foreground", children: "Reading\u2026" }) : existing.filter((a) => a.subtype !== "Link" && a.subtype !== "Widget").length === 0 ? /* @__PURE__ */ jsx3("div", { className: "text-xs text-muted-foreground", children: "No comments or markup yet" }) : /* @__PURE__ */ jsx3("ul", { className: "flex flex-col", "aria-label": "Annotations in this file", children: existing.filter((a) => a.subtype !== "Link" && a.subtype !== "Widget").map((a, i) => /* @__PURE__ */ jsx3("li", { children: /* @__PURE__ */ jsxs3("button", { type: "button", onClick: () => goToPage(a.page), className: "flex w-full items-start gap-2 rounded-md px-2 py-1 text-left text-xs hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: [
739
- /* @__PURE__ */ jsxs3("span", { className: "w-8 shrink-0 tabular-nums text-muted-foreground", children: [
740
- "p. ",
741
- a.page
742
- ] }),
743
- /* @__PURE__ */ jsxs3("span", { className: "min-w-0 flex-1", children: [
744
- /* @__PURE__ */ jsxs3("span", { className: "block", children: [
745
- a.subtype,
746
- a.author ? ` \xB7 ${a.author}` : ""
737
+ existing === null ? /* @__PURE__ */ jsx3("div", { className: "text-xs text-muted-foreground", children: "Reading\u2026" }) : existing.filter((a) => a.subtype !== "Link" && a.subtype !== "Widget").length === 0 ? /* @__PURE__ */ jsx3("div", { className: "text-xs text-muted-foreground", children: "No comments or markup yet" }) : /* @__PURE__ */ jsx3("ul", { className: "flex flex-col", "aria-label": "Annotations in this file", children: existing.filter((a) => a.subtype !== "Link" && a.subtype !== "Widget").map((a, i) => /* @__PURE__ */ jsx3("li", { children: /* @__PURE__ */ jsx3(
738
+ Tile,
739
+ {
740
+ type: "button",
741
+ dense: true,
742
+ variant: "quiet",
743
+ title: `${a.subtype}${a.author ? ` \xB7 ${a.author}` : ""}`,
744
+ line: a.contents,
745
+ icon: /* @__PURE__ */ jsxs3("span", { className: "w-8 shrink-0 tabular-nums text-muted-foreground", children: [
746
+ "p. ",
747
+ a.page
747
748
  ] }),
748
- a.contents ? /* @__PURE__ */ jsx3("span", { className: "block truncate text-muted-foreground", children: a.contents }) : null
749
- ] })
750
- ] }) }, `${a.page}-${i}`)) }),
749
+ className: "w-full",
750
+ onClick: () => goToPage(a.page)
751
+ }
752
+ ) }, `${a.page}-${i}`)) }),
751
753
  /* @__PURE__ */ jsx3("div", { className: "text-xs text-muted-foreground", children: "Markup already saved shows on the page; changing it in place is coming." })
752
754
  ] }) : null,
753
755
  /* @__PURE__ */ jsx3(Section, { label: "Coming soon", children: /* @__PURE__ */ jsx3("ul", { className: "flex flex-col", "aria-label": "Markup coming soon", children: soon.map(row) }) })
@@ -866,35 +868,35 @@ function useWidth(ref) {
866
868
  }
867
869
  function ToolRows({ tool, hostTools, onPick, canMarkup = false }) {
868
870
  return /* @__PURE__ */ jsxs4(Fragment4, { children: [
869
- hostTools.map((t) => /* @__PURE__ */ jsx4("li", { role: "none", children: /* @__PURE__ */ jsxs4(
870
- "button",
871
+ hostTools.map((t) => /* @__PURE__ */ jsx4("li", { role: "none", children: /* @__PURE__ */ jsx4(
872
+ Tile2,
871
873
  {
872
874
  type: "button",
875
+ dense: true,
876
+ variant: "quiet",
873
877
  role: "menuitem",
874
878
  "aria-current": tool === `host:${t.id}` ? "true" : void 0,
875
- className: cn2("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", tool === `host:${t.id}` && "bg-accent"),
876
- onClick: () => onPick(`host:${t.id}`),
877
- children: [
878
- /* @__PURE__ */ jsx4(t.icon, { className: "size-4 shrink-0" }),
879
- /* @__PURE__ */ jsx4("span", { className: "flex-1 whitespace-nowrap", children: t.label })
880
- ]
879
+ title: t.label,
880
+ icon: /* @__PURE__ */ jsx4(t.icon, {}),
881
+ className: "w-full",
882
+ onClick: () => onPick(`host:${t.id}`)
881
883
  }
882
884
  ) }, `host:${t.id}`)),
883
885
  PDF_TOOLS.filter((t) => t.id !== "browse" && (t.id !== "markup" || canMarkup)).map((t) => {
884
886
  const Icon = PDF_TOOL_ICONS[t.id];
885
- return /* @__PURE__ */ jsx4("li", { role: "none", children: /* @__PURE__ */ jsxs4(
886
- "button",
887
+ return /* @__PURE__ */ jsx4("li", { role: "none", children: /* @__PURE__ */ jsx4(
888
+ Tile2,
887
889
  {
888
890
  type: "button",
891
+ dense: true,
892
+ variant: "quiet",
889
893
  role: "menuitem",
890
894
  "aria-current": t.id === tool ? "true" : void 0,
891
- className: cn2("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", t.id === tool && "bg-accent"),
892
- onClick: () => onPick(t.id),
893
- children: [
894
- /* @__PURE__ */ jsx4(Icon, { className: "size-4 shrink-0" }),
895
- /* @__PURE__ */ jsx4("span", { className: "flex-1 whitespace-nowrap", children: t.label }),
896
- t.status === "soon" ? /* @__PURE__ */ jsx4("span", { className: "text-muted-foreground", children: "Coming soon" }) : null
897
- ]
895
+ title: t.label,
896
+ icon: /* @__PURE__ */ jsx4(Icon, {}),
897
+ end: t.status === "soon" ? /* @__PURE__ */ jsx4("span", { className: "text-muted-foreground", children: "Coming soon" }) : void 0,
898
+ className: "w-full",
899
+ onClick: () => onPick(t.id)
898
900
  }
899
901
  ) }, t.id);
900
902
  })
@@ -1347,10 +1349,11 @@ function PdfWorkspace({ host, className }) {
1347
1349
  width: "lg"
1348
1350
  }
1349
1351
  ) : /* @__PURE__ */ jsx4(
1350
- "button",
1352
+ Button3,
1351
1353
  {
1352
1354
  type: "button",
1353
- className: "min-w-0 max-w-[16rem] truncate rounded-md px-2 text-sm font-medium text-foreground hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
1355
+ variant: "quiet",
1356
+ className: "min-w-0 max-w-[16rem]",
1354
1357
  title: host.rename ? "Rename" : host.file.name,
1355
1358
  onClick: () => host.rename && (setNameDraft(host.file.name), setEditingName(true)),
1356
1359
  children: host.file.name
@@ -1471,21 +1474,21 @@ function PdfWorkspace({ host, className }) {
1471
1474
  }
1472
1475
  }
1473
1476
  ),
1474
- pop === "tool-search" && toolHits.length ? /* @__PURE__ */ jsx4("ul", { role: "listbox", className: "absolute left-0 right-0 top-9 z-30 rounded-lg border border-border bg-popover p-1 shadow-lg", children: toolHits.map((t) => /* @__PURE__ */ jsx4("li", { role: "option", "aria-selected": false, children: /* @__PURE__ */ jsxs4(
1475
- "button",
1477
+ pop === "tool-search" && toolHits.length ? /* @__PURE__ */ jsx4("ul", { role: "listbox", className: "absolute left-0 right-0 top-9 z-30 rounded-lg border border-border bg-popover p-1 shadow-lg", children: toolHits.map((t) => /* @__PURE__ */ jsx4("li", { role: "option", "aria-selected": false, children: /* @__PURE__ */ jsx4(
1478
+ Tile2,
1476
1479
  {
1477
1480
  type: "button",
1478
- className: "flex w-full items-center justify-between rounded-md px-2 py-1 text-left text-xs hover:bg-accent",
1481
+ dense: true,
1482
+ variant: "quiet",
1483
+ title: t.label,
1484
+ end: t.status === "soon" ? /* @__PURE__ */ jsx4("span", { className: "text-muted-foreground", children: "Coming soon" }) : void 0,
1485
+ className: "w-full",
1479
1486
  onMouseDown: (e) => e.preventDefault(),
1480
1487
  onClick: () => {
1481
1488
  chooseTool(t.id);
1482
1489
  setToolQuery("");
1483
1490
  setPop(null);
1484
- },
1485
- children: [
1486
- /* @__PURE__ */ jsx4("span", { children: t.label }),
1487
- t.status === "soon" ? /* @__PURE__ */ jsx4("span", { className: "text-muted-foreground", children: "Coming soon" }) : null
1488
- ]
1491
+ }
1489
1492
  }
1490
1493
  ) }, t.id)) }) : null
1491
1494
  ] }) : null,
@@ -1590,7 +1593,7 @@ function PdfWorkspace({ host, className }) {
1590
1593
  ] }) : null
1591
1594
  ] }) : null,
1592
1595
  compact && sheet ? /* @__PURE__ */ jsxs4(Fragment4, { children: [
1593
- /* @__PURE__ */ jsx4("button", { type: "button", "aria-label": "Close", className: "absolute inset-0 z-30 bg-background/60", onClick: () => setSheet(null) }),
1596
+ /* @__PURE__ */ jsx4(Tile2, { type: "button", layout: "stack", variant: "quiet", title: /* @__PURE__ */ jsx4("span", { className: "sr-only", children: "Close" }), "aria-label": "Close", className: "absolute inset-0 z-30 h-full w-full bg-background/60", onClick: () => setSheet(null) }),
1594
1597
  /* @__PURE__ */ jsx4("div", { className: "absolute inset-x-0 bottom-0 z-40 flex max-h-[75%] flex-col rounded-t-xl border-t border-border bg-background", role: "dialog", "aria-label": sheet === "pages" ? "Pages" : "Tools", children: sheet === "pages" ? /* @__PURE__ */ jsx4("div", { className: "h-[60vh] min-h-0", children: leftPanel }) : /* @__PURE__ */ jsxs4("div", { className: "flex min-h-0 flex-col overflow-y-auto", children: [
1595
1598
  /* @__PURE__ */ jsx4("ul", { className: "p-2", role: "menu", "aria-label": "Tools", children: /* @__PURE__ */ jsx4(ToolRows, { tool: activeToolKey, hostTools, canMarkup, onPick: chooseTool }) }),
1596
1599
  /* @__PURE__ */ jsx4("div", { className: "border-t border-border", children: rightPanel })