@aperture-browser/session-react 0.0.0-nightly.131.764dc151c439 → 0.0.0-nightly.133.2b928e99e576
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.d.ts +7 -1
- package/dist/index.js +21 -17
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -98,6 +98,11 @@ type BrowserControlPaneProps = {
|
|
|
98
98
|
menuItems?: ReactNode; /** Extra items in the menu's "Share and connect" submenu. */
|
|
99
99
|
shareMenuItems?: ReactNode; /** Items at the end of the browser menu, such as deleting the session. */
|
|
100
100
|
menuFooterItems?: ReactNode;
|
|
101
|
+
/**
|
|
102
|
+
* The icon Aperture captured for a tab, null for none, or undefined while unknown. Without it
|
|
103
|
+
* tabs load the site's own `/favicon.ico`.
|
|
104
|
+
*/
|
|
105
|
+
targetFaviconUrl?: (targetId: string) => string | null | undefined;
|
|
101
106
|
};
|
|
102
107
|
declare function BrowserControlPane({
|
|
103
108
|
control,
|
|
@@ -112,7 +117,8 @@ declare function BrowserControlPane({
|
|
|
112
117
|
onSessionDetails,
|
|
113
118
|
menuItems,
|
|
114
119
|
shareMenuItems,
|
|
115
|
-
menuFooterItems
|
|
120
|
+
menuFooterItems,
|
|
121
|
+
targetFaviconUrl
|
|
116
122
|
}: BrowserControlPaneProps): import("react").JSX.Element;
|
|
117
123
|
//#endregion
|
|
118
124
|
//#region src/components/browser-viewport.d.ts
|
package/dist/index.js
CHANGED
|
@@ -441,7 +441,7 @@ const copyTextWithToast = (value, onCopied = () => {}) => copyText(value).pipe(E
|
|
|
441
441
|
//#endregion
|
|
442
442
|
//#region src/components/browser-tab-strip.tsx
|
|
443
443
|
const BROWSER_TAB_DRAG_KIND = "browser-tab";
|
|
444
|
-
function BrowserTabStrip({ targets, activeTargetId, recordingTargetIds, devToolsTargetIds, disabled, mutationDisabled, onActivate, onCreate, onDuplicate, onClose, onReload, onReorder, loadThumbnail = null }) {
|
|
444
|
+
function BrowserTabStrip({ targets, activeTargetId, recordingTargetIds, devToolsTargetIds, disabled, mutationDisabled, onActivate, onCreate, onDuplicate, onClose, onReload, onReorder, loadThumbnail = null, targetFaviconUrl }) {
|
|
445
445
|
const [previewHandle] = useState(() => createHoverCardHandle());
|
|
446
446
|
if (targets.length === 0) return /* @__PURE__ */ jsxs("div", {
|
|
447
447
|
className: "aperture:flex aperture:h-8 aperture:min-w-0 aperture:flex-1 aperture:items-center aperture:gap-2 aperture:px-2 aperture:text-xs aperture:text-muted-foreground",
|
|
@@ -456,9 +456,11 @@ function BrowserTabStrip({ targets, activeTargetId, recordingTargetIds, devTools
|
|
|
456
456
|
children: /* @__PURE__ */ jsxs("div", {
|
|
457
457
|
className: "aperture:flex aperture:min-w-max aperture:items-end aperture:gap-0.5 aperture:px-1 aperture:pt-1",
|
|
458
458
|
children: [targets.map((target, index) => {
|
|
459
|
+
const active = target.id === activeTargetId;
|
|
459
460
|
return /* @__PURE__ */ jsx(BrowserTab, {
|
|
460
461
|
target,
|
|
461
|
-
|
|
462
|
+
faviconSrc: faviconSource(target, targetFaviconUrl),
|
|
463
|
+
active,
|
|
462
464
|
recording: recordingTargetIds.has(target.id),
|
|
463
465
|
devToolsOpen: devToolsTargetIds.has(target.id),
|
|
464
466
|
disabled,
|
|
@@ -488,7 +490,7 @@ function BrowserTabStrip({ targets, activeTargetId, recordingTargetIds, devTools
|
|
|
488
490
|
}
|
|
489
491
|
}) : null] });
|
|
490
492
|
}
|
|
491
|
-
function BrowserTab({ target, active, recording, devToolsOpen, disabled, mutationDisabled, onActivate, onDuplicate, onClose, onReload, onReorder, previewHandle, closeOtherTargetIds, closeRightTargetIds }) {
|
|
493
|
+
function BrowserTab({ target, faviconSrc, active, recording, devToolsOpen, disabled, mutationDisabled, onActivate, onDuplicate, onClose, onReload, onReorder, previewHandle, closeOtherTargetIds, closeRightTargetIds }) {
|
|
492
494
|
const tabRef = useRef(null);
|
|
493
495
|
const [dragging, setDragging] = useState(false);
|
|
494
496
|
const [dropPlacement, setDropPlacement] = useState(null);
|
|
@@ -560,7 +562,7 @@ function BrowserTab({ target, active, recording, devToolsOpen, disabled, mutatio
|
|
|
560
562
|
className: "aperture:flex aperture:min-w-0 aperture:flex-1 aperture:items-center aperture:gap-1.5 aperture:text-left",
|
|
561
563
|
onClick: () => onActivate(target.id),
|
|
562
564
|
children: [
|
|
563
|
-
/* @__PURE__ */ jsx(TabFavicon, {
|
|
565
|
+
/* @__PURE__ */ jsx(TabFavicon, { src: faviconSrc }),
|
|
564
566
|
devToolsOpen ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Wrench, {
|
|
565
567
|
"aria-hidden": true,
|
|
566
568
|
className: "aperture:size-3.5 aperture:shrink-0 aperture:text-muted-foreground"
|
|
@@ -658,18 +660,18 @@ function NewTabButton({ disabled, onCreate }) {
|
|
|
658
660
|
children: "New tab"
|
|
659
661
|
})] });
|
|
660
662
|
}
|
|
661
|
-
function
|
|
662
|
-
const
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
if (!
|
|
663
|
+
function faviconSource(target, targetFaviconUrl) {
|
|
664
|
+
const captured = targetFaviconUrl?.(target.id);
|
|
665
|
+
return captured === void 0 ? resolveFaviconUrl(target.url) : captured;
|
|
666
|
+
}
|
|
667
|
+
function TabFavicon({ src }) {
|
|
668
|
+
const [failedSrc, setFailedSrc] = useState(null);
|
|
669
|
+
if (!src || failedSrc === src) return /* @__PURE__ */ jsx(Globe2, { className: "aperture:size-4 aperture:shrink-0 aperture:text-muted-foreground" });
|
|
668
670
|
return /* @__PURE__ */ jsx("img", {
|
|
669
|
-
src
|
|
671
|
+
src,
|
|
670
672
|
alt: "",
|
|
671
673
|
className: "aperture:size-4 aperture:shrink-0",
|
|
672
|
-
onError: () =>
|
|
674
|
+
onError: () => setFailedSrc(src)
|
|
673
675
|
});
|
|
674
676
|
}
|
|
675
677
|
function resolveFaviconUrl(url) {
|
|
@@ -2065,7 +2067,7 @@ function initials(name) {
|
|
|
2065
2067
|
}
|
|
2066
2068
|
//#endregion
|
|
2067
2069
|
//#region src/components/browser-toolbar.tsx
|
|
2068
|
-
function BrowserToolbar({ control, leading, trailing, toolbarLeading, toolbarTrailing, features, collaborationRole, cdpUrl, shareUrls, localCursorEnabled, onLocalCursorChange, paintingEnabled, onPaintingEnabledChange, devToolsOpen, devToolsTargetIds, devToolsDock, onDevToolsOpenChange, onDevToolsDockChange, onSessionDetails, menuItems, shareMenuItems, menuFooterItems }) {
|
|
2070
|
+
function BrowserToolbar({ control, leading, trailing, toolbarLeading, toolbarTrailing, features, collaborationRole, cdpUrl, shareUrls, localCursorEnabled, onLocalCursorChange, paintingEnabled, onPaintingEnabledChange, devToolsOpen, devToolsTargetIds, devToolsDock, onDevToolsOpenChange, onDevToolsDockChange, onSessionDetails, menuItems, shareMenuItems, menuFooterItems, targetFaviconUrl }) {
|
|
2069
2071
|
const [urlDraft, setUrlDraft] = useState(null);
|
|
2070
2072
|
const displayUrl = control.activeTarget?.url ?? "";
|
|
2071
2073
|
const busy = control.phase === "connecting";
|
|
@@ -2107,7 +2109,8 @@ function BrowserToolbar({ control, leading, trailing, toolbarLeading, toolbarTra
|
|
|
2107
2109
|
onClose: control.closeTarget,
|
|
2108
2110
|
onReload: control.reload,
|
|
2109
2111
|
onReorder: control.reorderTargets,
|
|
2110
|
-
loadThumbnail: control.loadTargetThumbnail
|
|
2112
|
+
loadThumbnail: control.loadTargetThumbnail,
|
|
2113
|
+
targetFaviconUrl
|
|
2111
2114
|
}) : /* @__PURE__ */ jsx("div", { className: "aperture:min-w-0 aperture:flex-1" }),
|
|
2112
2115
|
features.presence ? /* @__PURE__ */ jsx(CollaborationPresence, { collaboration: control.collaboration }) : null,
|
|
2113
2116
|
trailing
|
|
@@ -2429,7 +2432,7 @@ function ResizableHandle({ withHandle, className, ...props }) {
|
|
|
2429
2432
|
//#endregion
|
|
2430
2433
|
//#region src/components/browser-control-pane.tsx
|
|
2431
2434
|
const LOCAL_CURSOR_STORAGE_KEY = "aperture.workbench.localCursorEnabled";
|
|
2432
|
-
function BrowserControlPane({ control, leading, trailing, toolbarLeading, toolbarTrailing, features: featureOverrides, collaborationRole, cdpUrl, shareUrls, onSessionDetails, menuItems, shareMenuItems, menuFooterItems }) {
|
|
2435
|
+
function BrowserControlPane({ control, leading, trailing, toolbarLeading, toolbarTrailing, features: featureOverrides, collaborationRole, cdpUrl, shareUrls, onSessionDetails, menuItems, shareMenuItems, menuFooterItems, targetFaviconUrl }) {
|
|
2433
2436
|
const features = resolveSessionFeatures(featureOverrides);
|
|
2434
2437
|
const [localCursorEnabled, setLocalCursorEnabled] = useState(true);
|
|
2435
2438
|
const [paintingEnabled, setPaintingEnabled] = useState(false);
|
|
@@ -2504,7 +2507,8 @@ function BrowserControlPane({ control, leading, trailing, toolbarLeading, toolba
|
|
|
2504
2507
|
onSessionDetails,
|
|
2505
2508
|
menuItems,
|
|
2506
2509
|
shareMenuItems,
|
|
2507
|
-
menuFooterItems
|
|
2510
|
+
menuFooterItems,
|
|
2511
|
+
targetFaviconUrl
|
|
2508
2512
|
}), features.devTools ? /* @__PURE__ */ jsxs(ResizablePanelGroup, {
|
|
2509
2513
|
orientation: devToolsDock === "bottom" ? "vertical" : "horizontal",
|
|
2510
2514
|
className: "aperture:min-h-0 aperture:min-w-0 aperture:flex-1 aperture:has-[[data-separator=active]]:[&_iframe]:pointer-events-none",
|