@ai-matrx/canvas 0.10.33 → 0.10.35

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/react.d.cts CHANGED
@@ -645,7 +645,11 @@ interface BrowserBarProps {
645
645
  readonly trailing?: ReactNode;
646
646
  readonly className?: string;
647
647
  }
648
- /** A browser's back · forward · reload · address bar, for a kind's leading slot or its body. */
648
+ /**
649
+ * A browser's toolbar row, as Safari draws it: Back and Forward in one capsule, the address field
650
+ * as a centred pill that shows only the site's host until it is clicked (then the whole address,
651
+ * selected) with Reload inside its trailing edge, and the page's own actions in a capsule after it.
652
+ */
649
653
  declare function BrowserBar({ url, canGoBack, canGoForward, onBack, onForward, onReload, onNavigate, trailing, className }: BrowserBarProps): react.JSX.Element;
650
654
 
651
655
  export { type AnyCanvasKind, BrowserBar, type BrowserBarProps, type BrowserTab, BrowserTabs, type BrowserTabsProps, CANVAS_TAB_LIST_ROOM, CANVAS_TAB_MIN_WIDTH, CanvasColumn, type CanvasColumnProps, type CanvasFloating, CanvasFrame, CanvasHeaderButton, type CanvasHeaderButtonProps, type CanvasHostPorts, type CanvasKind, type CanvasKindIcon, CanvasKindIcons, type CanvasKindProps, type CanvasKindSurface, type CanvasLauncherEntry, type CanvasMenuEntry, type CanvasMenuItem, CanvasMenuTrigger, type CanvasNativeBodyFrame, type CanvasNativeBodyInfo, type CanvasNativeRect, type CanvasOutputHandlers, type CanvasOutputPorts, type CanvasOutputRequest, type CanvasOverlayPort, CanvasPaneView, CanvasPanel, CanvasPanelEmpty, type CanvasPanelProps, CanvasProvider, type CanvasProviderProps, type CanvasShowMenu, type CanvasStripEntry, type CanvasStripTab, CanvasTab, type CanvasTabProps, type CanvasTabStripMode, type CanvasTabWindow, CanvasToggle, CanvasWindowScope, CanvasWindowTabs, beginCanvasResize, canvasItemElement, canvasKindOutputProblems, canvasKindSurface, canvasOutputMenu, canvasSessionKey, defineCanvasKind, fitCanvasTabWindow, getCanvasKind, itemTitle, listCanvasKinds, planCanvasTabStrip, registerCanvasKind, registerCanvasKinds, useCanvas, useCanvasColumnWidth, useCanvasHostPorts, useCanvasIsPresented, useCanvasKind, useCanvasKindToggle, useCanvasKinds, useCanvasLauncherEntries, useCanvasLauncherEntry, useCanvasMenuItems, useCanvasNativeBodies, useCanvasOutput, useCanvasPresentation, useCanvasState, useCanvasWindowId, useOptionalCanvas, useOptionalCanvasState };
package/dist/react.d.ts CHANGED
@@ -645,7 +645,11 @@ interface BrowserBarProps {
645
645
  readonly trailing?: ReactNode;
646
646
  readonly className?: string;
647
647
  }
648
- /** A browser's back · forward · reload · address bar, for a kind's leading slot or its body. */
648
+ /**
649
+ * A browser's toolbar row, as Safari draws it: Back and Forward in one capsule, the address field
650
+ * as a centred pill that shows only the site's host until it is clicked (then the whole address,
651
+ * selected) with Reload inside its trailing edge, and the page's own actions in a capsule after it.
652
+ */
649
653
  declare function BrowserBar({ url, canGoBack, canGoForward, onBack, onForward, onReload, onNavigate, trailing, className }: BrowserBarProps): react.JSX.Element;
650
654
 
651
655
  export { type AnyCanvasKind, BrowserBar, type BrowserBarProps, type BrowserTab, BrowserTabs, type BrowserTabsProps, CANVAS_TAB_LIST_ROOM, CANVAS_TAB_MIN_WIDTH, CanvasColumn, type CanvasColumnProps, type CanvasFloating, CanvasFrame, CanvasHeaderButton, type CanvasHeaderButtonProps, type CanvasHostPorts, type CanvasKind, type CanvasKindIcon, CanvasKindIcons, type CanvasKindProps, type CanvasKindSurface, type CanvasLauncherEntry, type CanvasMenuEntry, type CanvasMenuItem, CanvasMenuTrigger, type CanvasNativeBodyFrame, type CanvasNativeBodyInfo, type CanvasNativeRect, type CanvasOutputHandlers, type CanvasOutputPorts, type CanvasOutputRequest, type CanvasOverlayPort, CanvasPaneView, CanvasPanel, CanvasPanelEmpty, type CanvasPanelProps, CanvasProvider, type CanvasProviderProps, type CanvasShowMenu, type CanvasStripEntry, type CanvasStripTab, CanvasTab, type CanvasTabProps, type CanvasTabStripMode, type CanvasTabWindow, CanvasToggle, CanvasWindowScope, CanvasWindowTabs, beginCanvasResize, canvasItemElement, canvasKindOutputProblems, canvasKindSurface, canvasOutputMenu, canvasSessionKey, defineCanvasKind, fitCanvasTabWindow, getCanvasKind, itemTitle, listCanvasKinds, planCanvasTabStrip, registerCanvasKind, registerCanvasKinds, useCanvas, useCanvasColumnWidth, useCanvasHostPorts, useCanvasIsPresented, useCanvasKind, useCanvasKindToggle, useCanvasKinds, useCanvasLauncherEntries, useCanvasLauncherEntry, useCanvasMenuItems, useCanvasNativeBodies, useCanvasOutput, useCanvasPresentation, useCanvasState, useCanvasWindowId, useOptionalCanvas, useOptionalCanvasState };
package/dist/react.js CHANGED
@@ -2268,14 +2268,6 @@ var AlertIcon = (p) => /* @__PURE__ */ jsxs2(Glyph, { ...p, children: [
2268
2268
  /* @__PURE__ */ jsx3("path", { d: "M12 8v4" }),
2269
2269
  /* @__PURE__ */ jsx3("path", { d: "M12 16h.01" })
2270
2270
  ] });
2271
- var ArrowLeftIcon = (p) => /* @__PURE__ */ jsxs2(Glyph, { ...p, children: [
2272
- /* @__PURE__ */ jsx3("path", { d: "m12 19-7-7 7-7" }),
2273
- /* @__PURE__ */ jsx3("path", { d: "M19 12H5" })
2274
- ] });
2275
- var ArrowRightIcon = (p) => /* @__PURE__ */ jsxs2(Glyph, { ...p, children: [
2276
- /* @__PURE__ */ jsx3("path", { d: "M5 12h14" }),
2277
- /* @__PURE__ */ jsx3("path", { d: "m12 5 7 7-7 7" })
2278
- ] });
2279
2271
  var RotateCwIcon = (p) => /* @__PURE__ */ jsxs2(Glyph, { ...p, children: [
2280
2272
  /* @__PURE__ */ jsx3("path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" }),
2281
2273
  /* @__PURE__ */ jsx3("path", { d: "M21 3v5h-5" })
@@ -2300,6 +2292,8 @@ var LayoutGridIcon = (p) => /* @__PURE__ */ jsxs2(Glyph, { ...p, children: [
2300
2292
  /* @__PURE__ */ jsx3("rect", { width: "7", height: "7", x: "14", y: "14", rx: "1" }),
2301
2293
  /* @__PURE__ */ jsx3("rect", { width: "7", height: "7", x: "3", y: "14", rx: "1" })
2302
2294
  ] });
2295
+ var ChevronLeftIcon = (p) => /* @__PURE__ */ jsx3(Glyph, { ...p, children: /* @__PURE__ */ jsx3("path", { d: "m15 18-6-6 6-6" }) });
2296
+ var ChevronRightIcon = (p) => /* @__PURE__ */ jsx3(Glyph, { ...p, children: /* @__PURE__ */ jsx3("path", { d: "m9 18 6-6-6-6" }) });
2303
2297
  var ChevronDownIcon = (p) => /* @__PURE__ */ jsx3(Glyph, { ...p, children: /* @__PURE__ */ jsx3("path", { d: "m6 9 6 6 6-6" }) });
2304
2298
 
2305
2299
  // src/react/chrome.tsx
@@ -2524,47 +2518,66 @@ function BrowserTabs({ tabs, activeId, onSelect, onClose, onNew, newLabel = "New
2524
2518
  onNew ? /* @__PURE__ */ jsx4(CanvasHeaderButton, { label: newLabel, "data-slot": "browser-tab-new", onClick: onNew, children: /* @__PURE__ */ jsx4(PlusIcon, {}) }) : null
2525
2519
  ] });
2526
2520
  }
2521
+ function addressDisplay(url) {
2522
+ if (!url) return "";
2523
+ try {
2524
+ const parsed = new URL(url);
2525
+ if (parsed.protocol === "http:" || parsed.protocol === "https:") return parsed.host.replace(/^www\./, "") || url;
2526
+ return url;
2527
+ } catch {
2528
+ return url;
2529
+ }
2530
+ }
2527
2531
  function BrowserBar({ url, canGoBack, canGoForward, onBack, onForward, onReload, onNavigate, trailing, className }) {
2528
2532
  const [draft, setDraft] = useState3(url);
2529
2533
  const [editing, setEditing] = useState3(false);
2530
2534
  useEffect5(() => {
2531
2535
  if (!editing) setDraft(url);
2532
2536
  }, [url, editing]);
2537
+ const shown = addressDisplay(url);
2533
2538
  return /* @__PURE__ */ jsxs3("div", { "data-slot": "browser-bar", className: cx("mxc-browser-bar", className), children: [
2534
- /* @__PURE__ */ jsx4(CanvasHeaderButton, { size: "md", label: "Back", available: canGoBack, onClick: onBack, children: /* @__PURE__ */ jsx4(ArrowLeftIcon, {}) }),
2535
- /* @__PURE__ */ jsx4(CanvasHeaderButton, { size: "md", label: "Forward", available: canGoForward, onClick: onForward, children: /* @__PURE__ */ jsx4(ArrowRightIcon, {}) }),
2536
- /* @__PURE__ */ jsx4(CanvasHeaderButton, { size: "md", label: "Reload", onClick: onReload, children: /* @__PURE__ */ jsx4(RotateCwIcon, {}) }),
2537
- /* @__PURE__ */ jsx4(
2539
+ /* @__PURE__ */ jsxs3("div", { role: "group", "aria-label": "History", className: "mxc-capsule", children: [
2540
+ /* @__PURE__ */ jsx4(CanvasHeaderButton, { size: "md", label: "Back", available: canGoBack, onClick: onBack, children: /* @__PURE__ */ jsx4(ChevronLeftIcon, {}) }),
2541
+ /* @__PURE__ */ jsx4("span", { "aria-hidden": true, className: "mxc-capsule-divider" }),
2542
+ /* @__PURE__ */ jsx4(CanvasHeaderButton, { size: "md", label: "Forward", available: canGoForward, onClick: onForward, children: /* @__PURE__ */ jsx4(ChevronRightIcon, {}) })
2543
+ ] }),
2544
+ /* @__PURE__ */ jsxs3(
2538
2545
  "form",
2539
2546
  {
2540
2547
  className: "mxc-address-form",
2548
+ "data-editing": editing ? "" : void 0,
2541
2549
  onSubmit: (event) => {
2542
2550
  event.preventDefault();
2543
2551
  setEditing(false);
2544
2552
  onNavigate(draft.trim());
2545
2553
  event.currentTarget.elements.namedItem("address")?.blur();
2546
2554
  },
2547
- children: /* @__PURE__ */ jsx4(
2548
- "input",
2549
- {
2550
- name: "address",
2551
- "aria-label": "Address",
2552
- "data-slot": "browser-address",
2553
- className: "mxc-address",
2554
- value: draft,
2555
- placeholder: "Search or enter website",
2556
- spellCheck: false,
2557
- onFocus: (event) => {
2558
- setEditing(true);
2559
- event.currentTarget.select();
2560
- },
2561
- onBlur: () => setEditing(false),
2562
- onChange: (event) => setDraft(event.target.value)
2563
- }
2564
- )
2555
+ children: [
2556
+ /* @__PURE__ */ jsx4(
2557
+ "input",
2558
+ {
2559
+ name: "address",
2560
+ "aria-label": "Address",
2561
+ "data-slot": "browser-address",
2562
+ "data-shown": !editing && shown ? "host" : void 0,
2563
+ className: "mxc-address",
2564
+ value: draft,
2565
+ placeholder: "Search or enter website",
2566
+ spellCheck: false,
2567
+ onFocus: (event) => {
2568
+ setEditing(true);
2569
+ event.currentTarget.select();
2570
+ },
2571
+ onBlur: () => setEditing(false),
2572
+ onChange: (event) => setDraft(event.target.value)
2573
+ }
2574
+ ),
2575
+ !editing && shown ? /* @__PURE__ */ jsx4("span", { "aria-hidden": true, "data-slot": "browser-address-host", className: "mxc-address-host", children: shown }) : null,
2576
+ url ? /* @__PURE__ */ jsx4(CanvasHeaderButton, { label: "Reload", className: "mxc-address-reload", onClick: onReload, children: /* @__PURE__ */ jsx4(RotateCwIcon, {}) }) : null
2577
+ ]
2565
2578
  }
2566
2579
  ),
2567
- trailing ? /* @__PURE__ */ jsx4("div", { "data-slot": "browser-bar-trailing", className: "mxc-browser-bar-trailing", children: trailing }) : null
2580
+ trailing ? /* @__PURE__ */ jsx4("div", { "data-slot": "browser-bar-trailing", className: "mxc-browser-bar-trailing mxc-capsule", children: trailing }) : null
2568
2581
  ] });
2569
2582
  }
2570
2583
 
@@ -3330,7 +3343,7 @@ function CanvasPaneView({ paneId }) {
3330
3343
  focused,
3331
3344
  "data-mxc-pane": paneId,
3332
3345
  header: /* @__PURE__ */ jsxs6(Fragment2, { children: [
3333
- canGoBack && active ? /* @__PURE__ */ jsx7(CanvasHeaderButton, { className: "mxc-back", label: "Back", shortcut: canvasShortcutHint("canvas.back", isMac()), onClick: () => void canvas.back(active.id), children: /* @__PURE__ */ jsx7(ArrowLeftIcon, {}) }) : null,
3346
+ canGoBack && active ? /* @__PURE__ */ jsx7(CanvasHeaderButton, { className: "mxc-back", label: "Back", shortcut: canvasShortcutHint("canvas.back", isMac()), onClick: () => void canvas.back(active.id), children: /* @__PURE__ */ jsx7(ChevronLeftIcon, {}) }) : null,
3334
3347
  canGoForward && active ? /* @__PURE__ */ jsx7(
3335
3348
  CanvasHeaderButton,
3336
3349
  {
@@ -3338,7 +3351,7 @@ function CanvasPaneView({ paneId }) {
3338
3351
  label: "Forward",
3339
3352
  shortcut: canvasShortcutHint("canvas.forward", isMac()),
3340
3353
  onClick: () => void canvas.forward(active.id),
3341
- children: /* @__PURE__ */ jsx7(ArrowRightIcon, {})
3354
+ children: /* @__PURE__ */ jsx7(ChevronRightIcon, {})
3342
3355
  }
3343
3356
  ) : null,
3344
3357
  inWindowStrip ? active ? /* @__PURE__ */ jsx7(PaneTitle, { item: active, kind }) : /* @__PURE__ */ jsx7("span", { className: "mxc-panel-title", children: "New tab" }) : single && active ? /* @__PURE__ */ jsx7(SingleTitle, { item: active, kind }) : tabs.length > 0 ? /* @__PURE__ */ jsx7(TabStrip, { tabs, activeItemId: pane.activeItemId }) : /* @__PURE__ */ jsx7("span", { className: "mxc-panel-title", children: "New tab" }),