@ai-matrx/canvas 0.10.36 → 0.10.37

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.37
4
+
5
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
6
+ `git diff npm/canvas/v0.10.36..npm/canvas/v0.10.37 -- apps/shared/canvas`).
7
+ No source changes intended and no consumer action required.
8
+
3
9
  ## 0.10.36
4
10
 
5
11
  Automatic changed-only republish (docs/metadata drift since the last tag — see
package/README.md CHANGED
@@ -139,6 +139,16 @@ toggleKind(controller, { kind: "terminal" }); // absent → open · behind → f
139
139
 
140
140
  `CanvasPanel` (title or `header`, `leading`, `actions`, `renderMenu`, `onToggleExpand`, `onClose`), `CanvasPanelEmpty`, `CanvasHeaderButton`, `CanvasTab`, `BrowserTabs`, `BrowserBar` — the same components every canvas pane draws with. They render outside a provider too.
141
141
 
142
+ ## The macOS look
143
+
144
+ `<CanvasProvider look="mac">` draws every pane as a section of a Mac window instead of a card: the
145
+ column flush to the window's edge behind one hairline, panes split by hairlines, and each pane's
146
+ header the unified toolbar's band (`--mxc-toolbar-h`, default 52px) — the active tab's title centred
147
+ in bold with its kind icon as the proxy icon (Terminal, Finder), or the kind's `Toolbar` in its place
148
+ (Safari's address bar). "+" sits with the trailing controls; two or more tabs get macOS's tab bar
149
+ under the band. A host that puts the header under its own window buttons sets
150
+ `--mxc-header-inset-start` on the column. Default `look="card"` keeps the Claude desktop / Codex cards.
151
+
142
152
  ## Layout rules
143
153
 
144
154
  ```tsx
package/dist/react.cjs CHANGED
@@ -2073,6 +2073,7 @@ function CanvasProvider({
2073
2073
  layoutRules,
2074
2074
  regionWidth = null,
2075
2075
  tabStrip = "auto",
2076
+ look = "card",
2076
2077
  itemActions,
2077
2078
  popOut,
2078
2079
  dockBack,
@@ -2129,8 +2130,8 @@ function CanvasProvider({
2129
2130
  return () => window.removeEventListener("keydown", onKey);
2130
2131
  }, [controller, hotkeys, windowId]);
2131
2132
  const value = (0, import_react4.useMemo)(
2132
- () => ({ controller, windowId, ports: hostPorts, layer, regionWidth, tabStrip, launcherEntries, itemMenus, itemOutputs }),
2133
- [controller, windowId, hostPorts, layer, regionWidth, tabStrip, launcherEntries, itemMenus, itemOutputs]
2133
+ () => ({ controller, windowId, ports: hostPorts, layer, regionWidth, tabStrip, look, launcherEntries, itemMenus, itemOutputs }),
2134
+ [controller, windowId, hostPorts, layer, regionWidth, tabStrip, look, launcherEntries, itemMenus, itemOutputs]
2134
2135
  );
2135
2136
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(CanvasContext.Provider, { value, children: [
2136
2137
  children,
@@ -3343,7 +3344,8 @@ function parseWindowTabs(signature) {
3343
3344
  }
3344
3345
  function CanvasPaneView({ paneId }) {
3345
3346
  const canvas = useCanvas();
3346
- const { windowId, tabStrip } = useCanvasInternals();
3347
+ const { windowId, tabStrip, look } = useCanvasInternals();
3348
+ const mac = look === "mac";
3347
3349
  const columnSlots = useCanvasSlots();
3348
3350
  const [ownSlots] = (0, import_react10.useState)(createCanvasSlots);
3349
3351
  const slots = columnSlots ?? ownSlots;
@@ -3385,6 +3387,34 @@ function CanvasPaneView({ paneId }) {
3385
3387
  const tabs = singlePane ? parseWindowTabs(windowTabs) : pane.itemIds.map((itemId, index) => ({ itemId, paneId, index }));
3386
3388
  const single = tabStrip === "auto" && tabs.length === 1 && active;
3387
3389
  const closeLabel = role === "pop-out" && paneCount === 1 ? "Close window" : paneCount > 1 ? "Close pane" : "Close canvas";
3390
+ const newTab = inWindowStrip ? null : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CanvasHeaderButton, { className: "mxc-new-tab", label: "New tab", onClick: () => void canvas.newTab(paneId), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PlusIcon, {}) });
3391
+ const history = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
3392
+ canGoBack && active ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CanvasHeaderButton, { className: "mxc-back", label: "Back", shortcut: canvasShortcutHint("canvas.back", isMac()), onClick: () => void canvas.back(active.id), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ChevronLeftIcon, {}) }) : null,
3393
+ canGoForward && active ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3394
+ CanvasHeaderButton,
3395
+ {
3396
+ className: "mxc-forward",
3397
+ label: "Forward",
3398
+ shortcut: canvasShortcutHint("canvas.forward", isMac()),
3399
+ onClick: () => void canvas.forward(active.id),
3400
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ChevronRightIcon, {})
3401
+ }
3402
+ ) : null
3403
+ ] });
3404
+ const toolbar = Toolbar && kindProps ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mxc-item-toolbar", "data-kind": active?.kind, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ToolbarBoundary, { kindId: kind?.id ?? "", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Toolbar, { ...kindProps }) }) }) : null;
3405
+ const macTabBar = mac && !inWindowStrip && tabs.length > 1;
3406
+ const header = mac ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
3407
+ history,
3408
+ toolbar ? null : active ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(WindowTitle, { item: active, kind }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "mxc-panel-title mxc-window-title", children: "New tab" })
3409
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
3410
+ history,
3411
+ inWindowStrip ? active ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PaneTitle, { item: active, kind }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "mxc-panel-title", children: "New tab" }) : single && active ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SingleTitle, { item: active, kind }) : tabs.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TabStrip, { tabs, activeItemId: pane.activeItemId }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "mxc-panel-title", children: "New tab" }),
3412
+ newTab
3413
+ ] });
3414
+ const kindAction = Action && kindProps ? (
3415
+ // Its own gapless row: a kind's tap buttons space themselves (the tap-target placement rule).
3416
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "mxc-kind-actions", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Action, { ...kindProps }) })
3417
+ ) : null;
3388
3418
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
3389
3419
  CanvasPanel,
3390
3420
  {
@@ -3394,26 +3424,13 @@ function CanvasPaneView({ paneId }) {
3394
3424
  title: active ? itemTitle(active, kind) : "Canvas",
3395
3425
  focused,
3396
3426
  "data-mxc-pane": paneId,
3397
- header: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
3398
- canGoBack && active ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CanvasHeaderButton, { className: "mxc-back", label: "Back", shortcut: canvasShortcutHint("canvas.back", isMac()), onClick: () => void canvas.back(active.id), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ChevronLeftIcon, {}) }) : null,
3399
- canGoForward && active ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3400
- CanvasHeaderButton,
3401
- {
3402
- className: "mxc-forward",
3403
- label: "Forward",
3404
- shortcut: canvasShortcutHint("canvas.forward", isMac()),
3405
- onClick: () => void canvas.forward(active.id),
3406
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ChevronRightIcon, {})
3407
- }
3408
- ) : null,
3409
- inWindowStrip ? active ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PaneTitle, { item: active, kind }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "mxc-panel-title", children: "New tab" }) : single && active ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SingleTitle, { item: active, kind }) : tabs.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TabStrip, { tabs, activeItemId: pane.activeItemId }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "mxc-panel-title", children: "New tab" }),
3410
- inWindowStrip ? null : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CanvasHeaderButton, { className: "mxc-new-tab", label: "New tab", onClick: () => void canvas.newTab(paneId), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PlusIcon, {}) })
3411
- ] }),
3412
- leading: Leading && kindProps ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Leading, { ...kindProps }) : null,
3413
- actions: Action && kindProps ? (
3414
- // Its own gapless row: a kind's tap buttons space themselves (the tap-target placement rule).
3415
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "mxc-kind-actions", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Action, { ...kindProps }) })
3416
- ) : null,
3427
+ header,
3428
+ leading: mac ? toolbar : Leading && kindProps ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Leading, { ...kindProps }) : null,
3429
+ actions: mac ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
3430
+ Leading && kindProps ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Leading, { ...kindProps }) : null,
3431
+ kindAction,
3432
+ newTab
3433
+ ] }) : kindAction,
3417
3434
  renderMenu: () => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
3418
3435
  PaneMenu,
3419
3436
  {
@@ -3438,7 +3455,8 @@ function CanvasPaneView({ paneId }) {
3438
3455
  },
3439
3456
  ...drop,
3440
3457
  children: [
3441
- Toolbar && kindProps ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mxc-item-toolbar", "data-kind": active?.kind, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ToolbarBoundary, { kindId: kind?.id ?? "", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Toolbar, { ...kindProps }) }) }) : null,
3458
+ macTabBar ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mxc-tab-bar", "data-slot": "canvas-tab-bar", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TabStrip, { tabs, activeItemId: pane.activeItemId }) }) : null,
3459
+ mac ? null : toolbar,
3442
3460
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { ref: bodyRef, className: "mxc-pane-slot", "data-mxc-slot": paneId, children: pane.itemIds.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(EmptyPaneLauncher, { paneId }) : columnSlots ? null : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CanvasPaneInlineBodies, { paneId, slots }) })
3443
3461
  ]
3444
3462
  }
@@ -3468,6 +3486,16 @@ function SingleTitle({ item, kind }) {
3468
3486
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "button", className: "mxc-tab-close", "data-slot": "browser-tab-close", "aria-label": `Close ${title}`, onClick: () => canvas.close(item.id), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CloseIcon, {}) })
3469
3487
  ] });
3470
3488
  }
3489
+ function WindowTitle({ item, kind }) {
3490
+ const title = itemTitle(item, kind);
3491
+ const drag = useTabDrag(item.id, title);
3492
+ const name = useTruncated(title);
3493
+ const Icon = kind?.icon ?? AlertIcon;
3494
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "mxc-panel-title mxc-window-title", "data-slot": "canvas-window-title", "data-truncated": name.truncated ? "" : void 0, title, children: [
3495
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "mxc-proxy-icon", "data-draggable": "", ...drag, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { className: "mxc-title-icon" }) }),
3496
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { ref: name.ref, className: "mxc-tab-title", children: title })
3497
+ ] });
3498
+ }
3471
3499
  function PaneTitle({ item, kind }) {
3472
3500
  const title = itemTitle(item, kind);
3473
3501
  const drag = useTabDrag(item.id, title);
@@ -3918,7 +3946,7 @@ function useCanvasColumnWidth() {
3918
3946
  return fitCanvasWidth(width, region, controller.rules);
3919
3947
  }
3920
3948
  function CanvasColumn({ className, style, onLiveWidth, placement = "docked" }) {
3921
- const { controller, windowId, layer } = useCanvasInternals();
3949
+ const { controller, windowId, layer, look } = useCanvasInternals();
3922
3950
  const isOpen = useCanvasState((s) => selectCanvasIsOpen(s, windowId));
3923
3951
  const isFullscreen = useCanvasState((s) => selectCanvasIsFullscreen(s, windowId));
3924
3952
  const width = useCanvasState((s) => selectCanvasWidth(s, windowId));
@@ -3984,6 +4012,7 @@ function CanvasColumn({ className, style, onLiveWidth, placement = "docked" }) {
3984
4012
  "data-open": isOpen ? "" : void 0,
3985
4013
  "data-fullscreen": isOpen && isFullscreen ? "" : void 0,
3986
4014
  "data-placement": placement,
4015
+ "data-look": look,
3987
4016
  "data-mxc-window": windowId,
3988
4017
  "aria-label": "Canvas",
3989
4018
  "aria-hidden": isOpen ? void 0 : true,