dsh-builtin-browser 1.0.3 → 1.1.0
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 +16 -1
- package/README.en.md +89 -0
- package/browser-extension/constants.mjs +20 -0
- package/browser-extension/controller.mjs +293 -0
- package/browser-extension/locales.mjs +15 -0
- package/browser-extension/manifest.json +12 -0
- package/browser-extension/options.html +14 -0
- package/browser-extension/options.mjs +9 -0
- package/browser-extension/permission-guard.mjs +13 -0
- package/browser-extension/worker.mjs +74 -0
- package/desktop-bridge/desktop-identity.json +10 -2
- package/desktop-bridge/install.mjs +28 -2
- package/docs/issue-replies-2026-11-28.md +141 -0
- package/dsh-host-patch/apply.mjs +1 -1
- package/dsh-host-patch/rc3.json +4 -4
- package/dsh-host-patch/rc5.json +4 -4
- package/dsh-host-patch/v023-alpha2.json +2 -2
- package/lib/browser-electron/bridge-status.js +24 -1
- package/lib/browser-electron/desktop-identity.js +47 -8
- package/lib/client.js +2 -1
- package/native-host/install.mjs +5 -0
- package/package.json +20 -2
- package/scripts/build-client.mjs +305 -0
- package/scripts/build.mjs +69 -0
- package/scripts/bundle-host.mjs +28 -0
- package/scripts/fix-exports.mjs +40 -0
- package/scripts/install-electron.mjs +101 -0
- package/scripts/pack.mjs +99 -0
- package/scripts/publish-manifest.mjs +56 -0
- package/scripts/verify-exports.mjs +58 -0
- package/scripts/verify-preview-sdk.mjs +93 -0
- package/skills/dsh-builtin-browser/SKILL.md +98 -0
- package/skills/dsh-builtin-browser/references/batch.md +68 -0
- package/skills/dsh-builtin-browser/references/deliver.md +31 -0
- package/skills/dsh-builtin-browser/references/locate.md +11 -0
- package/skills/dsh-builtin-browser/references/recover.md +11 -0
- package/skills/dsh-builtin-browser/references/verify.md +13 -0
- package/skills/dsh-debug-host/SKILL.md +56 -0
- package/skills/dsh-debug-self/SKILL.md +50 -0
- package/src/bridge-compatibility.ts +39 -0
- package/src/browser/anti-bot.ts +251 -0
- package/src/browser/deep-dom.ts +40 -0
- package/src/browser/handles.ts +89 -0
- package/src/browser/runtime.ts +578 -0
- package/src/browser/takeover-target.ts +45 -0
- package/src/browser/types.ts +870 -0
- package/src/browser-electron/authenticated-route.ts +109 -0
- package/src/browser-electron/automatic-maintenance.ts +736 -0
- package/src/browser-electron/bridge-auto.ts +159 -0
- package/src/browser-electron/bridge-connection.ts +386 -0
- package/src/browser-electron/bridge-endpoint.ts +129 -0
- package/src/browser-electron/bridge-install.ts +290 -0
- package/src/browser-electron/bridge-maintenance.ts +189 -0
- package/src/browser-electron/bridge-status.ts +412 -0
- package/src/browser-electron/desktop-bridge-host.ts +253 -0
- package/src/browser-electron/desktop-identity.ts +400 -0
- package/src/browser-electron/desktop-shell.ts +100 -0
- package/src/browser-electron/document-readiness.ts +45 -0
- package/src/browser-electron/electron-provision.ts +347 -0
- package/src/browser-electron/entry.ts +1378 -0
- package/src/browser-electron/ephemeral-profile.ts +189 -0
- package/src/browser-electron/extension-browser.ts +230 -0
- package/src/browser-electron/extension-setup.ts +67 -0
- package/src/browser-electron/file-write.ts +31 -0
- package/src/browser-electron/foreground-watch.ts +142 -0
- package/src/browser-electron/guest-cookie-jar.ts +177 -0
- package/src/browser-electron/guest-cookie-store.ts +59 -0
- package/src/browser-electron/guest-css-runtime.ts +76 -0
- package/src/browser-electron/guest-css.ts +68 -0
- package/src/browser-electron/guest-route.ts +716 -0
- package/src/browser-electron/guest-runtime.ts +408 -0
- package/src/browser-electron/guest-storage-runtime.ts +54 -0
- package/src/browser-electron/guest-storage.ts +120 -0
- package/src/browser-electron/history-store.ts +224 -0
- package/src/browser-electron/host-main.ts +1385 -0
- package/src/browser-electron/host-patch-maintenance.ts +121 -0
- package/src/browser-electron/http-body.ts +65 -0
- package/src/browser-electron/json-reply.ts +47 -0
- package/src/browser-electron/maintenance-broker.ts +166 -0
- package/src/browser-electron/maintenance-lifecycle.ts +91 -0
- package/src/browser-electron/maintenance-route.ts +68 -0
- package/src/browser-electron/missing-system-browser.ts +114 -0
- package/src/browser-electron/open-slot.ts +49 -0
- package/src/browser-electron/paths.ts +25 -0
- package/src/browser-electron/preferred-browser.ts +130 -0
- package/src/browser-electron/preview-route.ts +215 -0
- package/src/browser-electron/process-ownership.ts +174 -0
- package/src/browser-electron/process.ts +23 -0
- package/src/browser-electron/profile-checkpoint.ts +187 -0
- package/src/browser-electron/profile-command.ts +47 -0
- package/src/browser-electron/profile-extension.ts +129 -0
- package/src/browser-electron/profile-lease.ts +211 -0
- package/src/browser-electron/profile-residue.ts +49 -0
- package/src/browser-electron/provider-core.ts +1107 -0
- package/src/browser-electron/provider-interaction.ts +1034 -0
- package/src/browser-electron/provider-media.ts +589 -0
- package/src/browser-electron/provider-navigation.ts +323 -0
- package/src/browser-electron/provider-observation.ts +664 -0
- package/src/browser-electron/provider-tabs.ts +372 -0
- package/src/browser-electron/provider.ts +666 -0
- package/src/browser-electron/reference-route.ts +598 -0
- package/src/browser-electron/remote-host.ts +1538 -0
- package/src/browser-electron/rpc-input.ts +13 -0
- package/src/browser-electron/rpc-ops.ts +41 -0
- package/src/browser-electron/runtime-diagnostics.ts +38 -0
- package/src/browser-electron/runtime-route.ts +105 -0
- package/src/browser-electron/runtime-status.ts +309 -0
- package/src/browser-electron/settings-route.ts +64 -0
- package/src/browser-electron/settings-store.ts +593 -0
- package/src/browser-electron/shortcuts-route.ts +112 -0
- package/src/browser-electron/sidebar-only-host.ts +300 -0
- package/src/browser-electron/startpage-shortcuts.ts +213 -0
- package/src/browser-electron/system-browser.ts +1850 -0
- package/src/browser-electron/tauri-host.ts +194 -0
- package/src/browser-electron/timing.ts +16 -0
- package/src/browser-electron/virtual-cursor.ts +162 -0
- package/src/browser-electron/windows-system.ts +24 -0
- package/src/browser-reference/delivery.ts +384 -0
- package/src/browser-reference/entry.ts +631 -0
- package/src/browser-reference/export.ts +339 -0
- package/src/browser-reference/import.ts +303 -0
- package/src/browser-reference/page-script.ts +1537 -0
- package/src/browser-reference/service.ts +1346 -0
- package/src/browser-reference/store.ts +172 -0
- package/src/browser-reference/text-quote.ts +219 -0
- package/src/browser-reference/types.ts +195 -0
- package/src/browser-reference/visible.ts +367 -0
- package/src/browser-reference/web-sources.ts +106 -0
- package/src/client/apply-guard.ts +22 -0
- package/src/client/browser/BrowserController.ts +693 -0
- package/src/client/browser/BrowserFrame.ts +78 -0
- package/src/client/browser/BrowserNavigation.ts +169 -0
- package/src/client/browser/BrowserPage.ts +23 -0
- package/src/client/browser/BrowserPersistence.ts +44 -0
- package/src/client/browser/IframeImpl.ts +182 -0
- package/src/client/browser/child-tabs.ts +14 -0
- package/src/client/browser/frame-history.ts +125 -0
- package/src/client/browser/frame-state.ts +27 -0
- package/src/client/browser/iframe-reference.ts +67 -0
- package/src/client/browser/initialization.ts +262 -0
- package/src/client/browser/omnibox.ts +243 -0
- package/src/client/browser/store.ts +38 -0
- package/src/client/browser/takeover-channel.ts +72 -0
- package/src/client/browser/url.ts +46 -0
- package/src/client/browser/web-reference-source.ts +56 -0
- package/src/client/css-modules.d.ts +4 -0
- package/src/client/definition.tsx +36 -0
- package/src/client/electron/ElectronWebViewImpl.ts +371 -0
- package/src/client/electron/ElectronWebviewPresentation.ts +140 -0
- package/src/client/electron/NativeChildPresentation.ts +53 -0
- package/src/client/electron/NativeViewPage.ts +265 -0
- package/src/client/electron/pages.ts +23 -0
- package/src/client/electron/reference-overlay.ts +53 -0
- package/src/client/electron/workspace.ts +33 -0
- package/src/client/index.ts +333 -0
- package/src/client/locales.ts +860 -0
- package/src/client/pages.ts +28 -0
- package/src/client/reference/client/BrowserRefLink.tsx +142 -0
- package/src/client/reference/client/draft-reference.ts +167 -0
- package/src/client/reference/client/index.ts +7 -0
- package/src/client/reference/client/ordered-submission.ts +108 -0
- package/src/client/reference/client/pending-delivery.ts +216 -0
- package/src/client/reference/client/plugin.ts +208 -0
- package/src/client/reference/client/production/ReferenceCapsules.tsx +345 -0
- package/src/client/reference/client/production/ReferenceDock.module.css +193 -0
- package/src/client/reference/client/production/ReferenceDock.tsx +6 -0
- package/src/client/reference/client/production/ReferenceFeedback.tsx +15 -0
- package/src/client/reference/client/production/ReferenceMath.tsx +44 -0
- package/src/client/reference/client/production/ReferenceText.tsx +36 -0
- package/src/client/reference/client/production/assembly.ts +447 -0
- package/src/client/reference/client/production/asset-store.ts +144 -0
- package/src/client/reference/client/production/availability.ts +72 -0
- package/src/client/reference/client/production/bytes.ts +36 -0
- package/src/client/reference/client/production/composer-attachments.ts +44 -0
- package/src/client/reference/client/production/delivery-client.ts +211 -0
- package/src/client/reference/client/production/draft-adapter.ts +512 -0
- package/src/client/reference/client/production/http-transport.ts +212 -0
- package/src/client/reference/client/production/production-submission.ts +70 -0
- package/src/client/reference/client/production/protocol.ts +234 -0
- package/src/client/reference/client/production/reference-card.ts +240 -0
- package/src/client/reference/client/production/reference-labels.ts +29 -0
- package/src/client/reference/client/production/reply-link-bridge.ts +222 -0
- package/src/client/reference/client/production/reveal.ts +215 -0
- package/src/client/reference/client/production/runtime.ts +1056 -0
- package/src/client/reference/client/production/snapshot-adapter.ts +154 -0
- package/src/client/reference/client/production/source-marker.ts +99 -0
- package/src/client/reference/client/production/source-opener.ts +55 -0
- package/src/client/reference/client/production/styles.ts +104 -0
- package/src/client/reference/client/production/user-text-rule.ts +67 -0
- package/src/client/reference/client/reveal.ts +109 -0
- package/src/client/reference/client/scheme.ts +114 -0
- package/src/client/reference/client/session-schedule.ts +36 -0
- package/src/client/reference/client/types.ts +168 -0
- package/src/client/reference/css-modules.d.ts +4 -0
- package/src/client/reference/index.ts +11 -0
- package/src/client/reference-capture-owner.ts +162 -0
- package/src/client/reference-intents.ts +36 -0
- package/src/client/settings/index.ts +42 -0
- package/src/client/settings/mount-guard.ts +31 -0
- package/src/client/settings/panel.ts +2773 -0
- package/src/client/shortcut-open.ts +30 -0
- package/src/client/startpage/binding.ts +99 -0
- package/src/client/startpage/controller.ts +300 -0
- package/src/client/startpage/model.ts +279 -0
- package/src/client/view/Browser.module.css +751 -0
- package/src/client/view/BrowserBody.tsx +315 -0
- package/src/client/view/BrowserPresentation.ts +9 -0
- package/src/client/view/BrowserTitle.tsx +17 -0
- package/src/client/view/IframePresentation.ts +365 -0
- package/src/client/view/StartPage.tsx +598 -0
- package/src/client/view/TakeoverBanner.tsx +21 -0
- package/src/compat/host-features.ts +92 -0
- package/src/index.ts +110 -0
- package/src/reference-owner.ts +5 -0
- package/src/reference-page.ts +9 -0
- package/src/reference-source.ts +3 -0
- package/src/reference-text.ts +219 -0
- package/src/startpage-settings.ts +103 -0
- package/src/startpage.ts +71 -0
- package/src/takeover-protocol.ts +28 -0
- package/src/tool-browser/block-recovery.ts +85 -0
- package/src/tool-browser/code-tool.ts +555 -0
- package/src/tool-browser/code-worker.ts +725 -0
- package/src/tool-browser/element-fields.ts +167 -0
- package/src/tool-browser/errors.ts +40 -0
- package/src/tool-browser/index.ts +265 -0
- package/src/tool-browser/page-probe.ts +675 -0
- package/src/tool-browser/panel-page.ts +126 -0
- package/src/tool-browser/probe-client.ts +183 -0
- package/src/tool-browser/screenshot-annotations.ts +131 -0
- package/src/tool-browser/screenshot-image.ts +49 -0
- package/src/tool-browser/state.ts +375 -0
- package/src/tool-browser/takeover.ts +199 -0
- package/src/tool-browser/tools-debug.ts +806 -0
- package/src/tool-browser/tools-interaction.ts +956 -0
- package/src/tool-browser/tools-navigation.ts +786 -0
- package/src/tool-browser/tools-observation.ts +474 -0
- package/src/tool-browser/tools-reference.ts +294 -0
- package/src/types/electron-shim.d.ts +144 -0
- package/src/types.ts +85 -0
- package/src/web-guest.ts +35 -0
- package/tools/accept-desktop.mjs +148 -0
- package/dist/client.d.cts +0 -516
- package/dist/client.d.mts +0 -516
- package/dist/index.cjs +0 -92
- package/dist/index.d.mts +0 -2960
- package/dist/index.mjs +0 -24
- package/dsh-builtin-browser-1.0.3-publish.tgz +0 -0
- package/dsh-builtin-browser-1.0.3.tgz +0 -0
- package/dsh-host-patch/sources/main/0001-feat-sidebar-right-add-session-rendering-holds.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0002-feat-desktop-load-trusted-profile-main-extensions.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0003-feat-desktop-report-resolved-and-running-main-extens.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0004-feat-desktop-compose-admitted-native-sidebar-views.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0005-fix-client-admit-coded-browser-errors-in-native-comp.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0006-fix-desktop-acknowledge-native-same-document-navigat.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0007-fix-desktop-restore-auth-in-the-native-lease-partiti.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0008-feat-desktop-adopt-native-children-in-admitted-sideb.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0009-fix-desktop-publish-complete-native-child-close-reco.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0010-fix-desktop-bundle-structured-errors-in-sandboxed-pr.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0011-feat-desktop-offer-persistent-Sidebar-sessions-per-D.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0012-feat-desktop-retain-sidebar-session-cookies-across-r.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0013-fix-desktop-honor-sidebar-session-cookie-sidecar-con.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0014-fix-desktop-retry-cookie-protection-without-failing-.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0015-fix-desktop-preserve-host-only-cookie-identity-in-se.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0016-fix-desktop-restore-session-cookies-before-checkpoin.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0017-fix-desktop-restore-sidebar-cookies-once-before-gues.patch.gz +0 -0
- package/dsh-host-patch/sources/main/0018-fix-sidebar-right-follow-animated-native-slot-placem.patch.gz +0 -0
- package/dsh-host-patch/sources/manifest.json +0 -218
- package/dsh-host-patch/sources/rc3/0001-feat-sidebar-right-add-session-rendering-holds.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0002-feat-desktop-load-trusted-profile-main-extensions.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0003-feat-desktop-report-resolved-and-running-main-extens.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0004-feat-desktop-compose-admitted-native-sidebar-views.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0005-fix-client-admit-coded-browser-errors-in-native-comp.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0006-fix-desktop-acknowledge-native-same-document-navigat.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0007-fix-desktop-restore-auth-in-the-native-lease-partiti.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0008-feat-desktop-adopt-native-children-in-admitted-sideb.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0009-fix-desktop-publish-complete-native-child-close-reco.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0010-fix-desktop-bundle-structured-errors-in-sandboxed-pr.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0011-feat-desktop-offer-persistent-Sidebar-sessions-per-D.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0012-feat-desktop-retain-sidebar-session-cookies-across-r.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0013-fix-desktop-honor-sidebar-session-cookie-sidecar-con.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0014-fix-desktop-retry-cookie-protection-without-failing-.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0015-fix-desktop-preserve-host-only-cookie-identity-in-se.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0016-fix-desktop-restore-session-cookies-before-checkpoin.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0017-fix-desktop-restore-sidebar-cookies-once-before-gues.patch.gz +0 -0
- package/dsh-host-patch/sources/rc3/0018-fix-sidebar-right-follow-animated-native-slot-placem.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0001-feat-sidebar-right-add-session-rendering-holds.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0002-feat-desktop-load-trusted-profile-main-extensions.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0003-feat-desktop-report-resolved-and-running-main-extens.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0004-feat-desktop-compose-admitted-native-sidebar-views.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0005-fix-client-admit-coded-browser-errors-in-native-comp.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0006-fix-desktop-acknowledge-native-same-document-navigat.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0007-fix-desktop-restore-auth-in-the-native-lease-partiti.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0008-feat-desktop-adopt-native-children-in-admitted-sideb.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0009-fix-desktop-publish-complete-native-child-close-reco.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0010-fix-desktop-bundle-structured-errors-in-sandboxed-pr.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0011-feat-desktop-offer-persistent-Sidebar-sessions-per-D.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0012-feat-desktop-retain-sidebar-session-cookies-across-r.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0013-fix-desktop-honor-sidebar-session-cookie-sidecar-con.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0014-fix-desktop-retry-cookie-protection-without-failing-.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0015-fix-desktop-preserve-host-only-cookie-identity-in-se.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0016-fix-desktop-restore-session-cookies-before-checkpoin.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0017-fix-desktop-restore-sidebar-cookies-once-before-gues.patch.gz +0 -0
- package/dsh-host-patch/sources/rc5/0018-fix-sidebar-right-follow-animated-native-slot-placem.patch.gz +0 -0
- package/dsh-host-patch/sources/series.json +0 -260
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
/** Common browser chrome; a presentation adapter attaches the page inside its content container. */
|
|
2
|
+
import { useEffect, useId, useLayoutEffect, useRef, useState, useSyncExternalStore } from 'react'
|
|
3
|
+
import type { FormEvent, ReactNode } from 'react'
|
|
4
|
+
import {
|
|
5
|
+
Button,
|
|
6
|
+
IconChevronLeftOutlineRegular,
|
|
7
|
+
IconChevronRightOutlineRegular,
|
|
8
|
+
IconLinkOutlineRegular,
|
|
9
|
+
IconRefreshOutlineRegular, Tooltip,
|
|
10
|
+
IconRightUpOutlineRegular,
|
|
11
|
+
SHIELD_OUTLINE_PATH,
|
|
12
|
+
ICON_REGULAR_STROKE,
|
|
13
|
+
} from '@deepseek-ai/dsh-client-ui-primitives'
|
|
14
|
+
import type { InjectFace, PropsLocale, PropsRuntime, PropsStore } from '@deepseek-ai/dsh-client-ui-slots'
|
|
15
|
+
import type { SIDEBAR_BROWSER_LOCALE_NS } from '../locales.ts'
|
|
16
|
+
import type { BrowserInjected } from '../browser/BrowserController.ts'
|
|
17
|
+
import type { BrowserInitFailure } from '../browser/initialization.ts'
|
|
18
|
+
import { emptyBrowserFrame } from '../browser/BrowserFrame.ts'
|
|
19
|
+
import { currentBrowserTarget } from '../browser/BrowserPersistence.ts'
|
|
20
|
+
import { resolveOmniboxInput } from '../browser/omnibox.ts'
|
|
21
|
+
import { searchEnginePreferences } from '../startpage/model.ts'
|
|
22
|
+
import type { StartPageFailure } from '../startpage/model.ts'
|
|
23
|
+
import type { BrowserStore } from '../browser/store.ts'
|
|
24
|
+
import { EngineSettingsDialog, SearchEngineMenu, ShortcutDialog, StartPage } from './StartPage.tsx'
|
|
25
|
+
import { TakeoverBanner } from './TakeoverBanner.tsx'
|
|
26
|
+
import { connectBrowserTakeover } from '../browser/takeover-channel.ts'
|
|
27
|
+
import { iframePage, subscribeIframePages } from '../browser/iframe-reference.ts'
|
|
28
|
+
import type { TakeoverNotice } from '../../takeover-protocol.ts'
|
|
29
|
+
import css from './Browser.module.css'
|
|
30
|
+
|
|
31
|
+
const EMPTY_FRAME = emptyBrowserFrame()
|
|
32
|
+
|
|
33
|
+
function SandboxPolicyIcon({ sandboxed }: { readonly sandboxed: boolean }): ReactNode {
|
|
34
|
+
return (
|
|
35
|
+
<svg width="15" height="15" viewBox="0 0 16 16" fill="none" aria-hidden>
|
|
36
|
+
<path d={SHIELD_OUTLINE_PATH} stroke="currentColor" strokeWidth={ICON_REGULAR_STROKE} strokeLinejoin="round" />
|
|
37
|
+
{sandboxed
|
|
38
|
+
? <path d="M12.1654 5.7552L8.9447 9.41475C8.73044 9.65816 8.53628 9.8804 8.35774 10.0423C8.1713 10.2114 7.94235 10.3717 7.64016 10.4254C7.48207 10.4535 7.32 10.4552 7.16151 10.4294C6.85843 10.3801 6.62728 10.2223 6.43836 10.0559C6.25752 9.89653 6.06037 9.67732 5.84264 9.43705L4.72925 8.20897L5.63557 7.38707L6.74897 8.61594C6.98603 8.87755 7.12974 9.03533 7.24673 9.13839C7.31033 9.19443 7.34485 9.21476 7.35823 9.22122C7.38068 9.22484 7.40352 9.22515 7.42593 9.22122C7.40522 9.22502 7.42893 9.23294 7.53583 9.136C7.65132 9.03126 7.79316 8.87139 8.02643 8.60638L11.2479 4.94763L12.1654 5.7552Z" fill="currentColor" />
|
|
39
|
+
: <path d="M10.6074 4.40278L8.00975 6.99973L10.6074 9.59739L9.59736 10.6074L6.9997 8.00978L4.40274 10.6074L3.3927 9.59739L5.98966 6.99973L3.3927 4.40278L4.40274 3.39273L6.9997 5.98969L9.59736 3.39273L10.6074 4.40278Z" fill="currentColor" transform="translate(1.2 0.8)" />}
|
|
40
|
+
</svg>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Browser body props assembled by the tab seat. */
|
|
45
|
+
export type BrowserBodyProps = PropsRuntime<'sidebar.right.pane.tab'>
|
|
46
|
+
& PropsStore<BrowserStore>
|
|
47
|
+
& PropsLocale<typeof SIDEBAR_BROWSER_LOCALE_NS>
|
|
48
|
+
& InjectFace<BrowserInjected>
|
|
49
|
+
|
|
50
|
+
function useBrowserDraft(url: string | undefined, revision: number): readonly [string, (value: string) => void, () => void] {
|
|
51
|
+
const [edit, setEdit] = useState<{ readonly revision: number; readonly value: string }>()
|
|
52
|
+
return [edit?.revision === revision ? edit.value : url ?? '',
|
|
53
|
+
(value) => { setEdit({ revision, value }) },
|
|
54
|
+
() => { setEdit(undefined) }]
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Render provider-neutral navigation state and optional controls. */
|
|
58
|
+
export function BrowserBody(props: BrowserBodyProps): ReactNode {
|
|
59
|
+
const {
|
|
60
|
+
mount, loadUrl, submitInput, restore, goBack, goForward, reload, setSandbox, shortcuts, engines,
|
|
61
|
+
bindAddressFocus, dismissShortcut, useBrowserState, useStartPage, useStore, useTabInfo, useContextMenu, t, sessionId,
|
|
62
|
+
} = props
|
|
63
|
+
const { tab } = useTabInfo()
|
|
64
|
+
const { getTriggerProps } = useContextMenu()
|
|
65
|
+
useEffect(() => tab.actions.bindCommands({ refresh: () => { reload(tab.id) } }), [tab.actions, tab.id, reload])
|
|
66
|
+
const addressRef = useRef<HTMLInputElement>(null)
|
|
67
|
+
useEffect(() => bindAddressFocus(tab.id, () => {
|
|
68
|
+
const input = addressRef.current
|
|
69
|
+
if (input === null) return
|
|
70
|
+
input.focus()
|
|
71
|
+
input.select()
|
|
72
|
+
}), [bindAddressFocus, tab.id])
|
|
73
|
+
const saved = useStore(state => state.byTab[tab.id])
|
|
74
|
+
const initial = useRef(saved)
|
|
75
|
+
const initialUrl = useRef(tab.navigation.params?.url)
|
|
76
|
+
const initialNavigationRevision = useRef(tab.navigation.revision)
|
|
77
|
+
const lastNavigationRevision = useRef(tab.navigation.revision)
|
|
78
|
+
const [initFailure, setInitFailure] = useState<BrowserInitFailure>()
|
|
79
|
+
// Capability fallback: a caller without the receipt API still gets the old
|
|
80
|
+
// initial-URL path, but never a crash when it returns nothing.
|
|
81
|
+
const runNavigate = (tabId: typeof tab.id, request: { url: string; navigationRevision: number }) => {
|
|
82
|
+
const runner = (props as { navigate?: typeof props.navigate }).navigate
|
|
83
|
+
if (runner !== undefined) return runner(tabId, request)
|
|
84
|
+
const outcome = loadUrl(tabId, request.url)
|
|
85
|
+
return outcome ?? { ok: true as const, requestId: '' }
|
|
86
|
+
}
|
|
87
|
+
const viewportId = useId()
|
|
88
|
+
const [mountEpoch, setMountEpoch] = useState(0)
|
|
89
|
+
const [focused, setFocused] = useState(false)
|
|
90
|
+
const [enginesOpen, setEnginesOpen] = useState(false)
|
|
91
|
+
const [engineFailure, setEngineFailure] = useState<StartPageFailure>()
|
|
92
|
+
const state = useBrowserState(tab.id)
|
|
93
|
+
const takeoverCurrent = useRef<{ url: string; active: boolean; navigationUrl?: string }>({ url: '', active: false })
|
|
94
|
+
const [takeover, setTakeover] = useState<{ notice?: TakeoverNotice; error?: boolean }>({})
|
|
95
|
+
const takeoverChannel = useRef<ReturnType<typeof connectBrowserTakeover>>()
|
|
96
|
+
const webPage = useSyncExternalStore(subscribeIframePages, () => iframePage(sessionId, viewportId))
|
|
97
|
+
const lastVerifiedWebPage = useRef<{ sessionId: string; epoch: number; page: NonNullable<typeof webPage> }>()
|
|
98
|
+
if (webPage) lastVerifiedWebPage.current = { sessionId, epoch: mountEpoch, page: webPage }
|
|
99
|
+
const takeoverWebPage = webPage ?? (lastVerifiedWebPage.current?.sessionId === sessionId
|
|
100
|
+
&& lastVerifiedWebPage.current.epoch === mountEpoch && state?.initialization?.stage !== 'failed' ? lastVerifiedWebPage.current.page : undefined)
|
|
101
|
+
const observedPage = props.currentPage?.(tab.id)
|
|
102
|
+
const carrierPageId = observedPage?.guestId ?? state?.initialization?.guestId
|
|
103
|
+
const pageId = takeoverWebPage?.pageId ?? (carrierPageId?.startsWith('iframe:') ? undefined : carrierPageId)
|
|
104
|
+
takeoverCurrent.current = { url: takeoverWebPage?.url ?? observedPage?.url ?? state?.frame.target?.url ?? '',
|
|
105
|
+
active: tab.visible === true && (takeoverWebPage === undefined || webPage !== undefined),
|
|
106
|
+
...takeoverWebPage?.navigationUrl === undefined ? {} : { navigationUrl: takeoverWebPage.navigationUrl } }
|
|
107
|
+
useEffect(() => {
|
|
108
|
+
if (!pageId) return
|
|
109
|
+
const lifetime = new AbortController()
|
|
110
|
+
takeoverChannel.current = connectBrowserTakeover({ owner: sessionId, tabId: tab.id, pageId,
|
|
111
|
+
current: () => takeoverCurrent.current,
|
|
112
|
+
changed: (notice, error) => { setTakeover({ notice, error }) },
|
|
113
|
+
}, lifetime.signal)
|
|
114
|
+
return () => { lifetime.abort(); takeoverChannel.current = undefined }
|
|
115
|
+
}, [sessionId, tab.id, pageId])
|
|
116
|
+
const startPage = useStartPage(value => value)
|
|
117
|
+
const frame = state?.frame ?? EMPTY_FRAME
|
|
118
|
+
const restoreTarget = state === undefined ? currentBrowserTarget(initial.current) : state.restoreTarget
|
|
119
|
+
const target = frame.target ?? restoreTarget
|
|
120
|
+
const [draft, setDraft, resetDraft] = useBrowserDraft(target?.url ?? initialUrl.current, state?.commandRevision ?? 0)
|
|
121
|
+
|
|
122
|
+
// A trusted navigation aimed at this tab (from the plugin bridge or another
|
|
123
|
+
// sidebar action) changes the revision without remounting the body. Hand the
|
|
124
|
+
// exact (tab, revision) to the controller; a missing controller is rebuilt
|
|
125
|
+
// from the last committed mount instead of being silently ignored.
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
if (tab.navigation.revision === lastNavigationRevision.current) return
|
|
128
|
+
lastNavigationRevision.current = tab.navigation.revision
|
|
129
|
+
const url = tab.navigation.params?.url
|
|
130
|
+
if (url === undefined || url === '') return
|
|
131
|
+
const outcome = runNavigate(tab.id, { url, navigationRevision: tab.navigation.revision })
|
|
132
|
+
setInitFailure(outcome.ok ? undefined : outcome.reason)
|
|
133
|
+
}, [tab.navigation.revision, tab.navigation.params, tab.id, runNavigate])
|
|
134
|
+
|
|
135
|
+
useLayoutEffect(() => {
|
|
136
|
+
const hide = mount({
|
|
137
|
+
tabId: tab.id, sessionId, navigationRevision: initialNavigationRevision.current,
|
|
138
|
+
signal: tab.signal, viewportId, applicationOrigin: window.location.origin,
|
|
139
|
+
initial: initial.current, initialUrl: initialUrl.current,
|
|
140
|
+
openTab: (url) => { tab.actions.openTab('browser', { params: { url }, revealIfOpened: false }) },
|
|
141
|
+
})
|
|
142
|
+
setMountEpoch(value => value + 1)
|
|
143
|
+
return hide
|
|
144
|
+
}, [mount, tab.id, tab.signal, tab.actions, viewportId, props.actions, sessionId])
|
|
145
|
+
|
|
146
|
+
const unknown = frame.address === 'unknown'
|
|
147
|
+
const externalUrl = unknown ? undefined : target?.url
|
|
148
|
+
const sandboxed = frame.sandboxEnabled
|
|
149
|
+
const addressShortcut = tab.shortcuts?.find(row => row.id === 'browser.address')
|
|
150
|
+
const failure = state?.addressFailure
|
|
151
|
+
const error = frame.error
|
|
152
|
+
const pageUrl = target?.url ?? ''
|
|
153
|
+
const preview = draft.trim() === '' || draft.trim() === pageUrl
|
|
154
|
+
? undefined
|
|
155
|
+
: resolveOmniboxInput(draft, {
|
|
156
|
+
defaultSearchEngineId: startPage.defaultSearchEngineId,
|
|
157
|
+
searchEngines: searchEnginePreferences(startPage),
|
|
158
|
+
applicationOrigin: window.location.origin,
|
|
159
|
+
})
|
|
160
|
+
const previewSearchEngineId = preview?.kind === 'resolved' && preview.primary.kind === 'search'
|
|
161
|
+
? preview.primary.engineId
|
|
162
|
+
: undefined
|
|
163
|
+
const previewEngine = previewSearchEngineId === undefined
|
|
164
|
+
? undefined
|
|
165
|
+
: startPage.engines.find(engine => engine.id === previewSearchEngineId)
|
|
166
|
+
const alternativeSearch = preview?.kind === 'resolved' && preview.alternative?.kind === 'search'
|
|
167
|
+
? preview.alternative
|
|
168
|
+
: undefined
|
|
169
|
+
const submit = (event: FormEvent): void => {
|
|
170
|
+
event.preventDefault()
|
|
171
|
+
const outcome = submitInput(tab.id, draft)
|
|
172
|
+
if (outcome !== undefined) setInitFailure(outcome.ok ? undefined : outcome.reason)
|
|
173
|
+
}
|
|
174
|
+
const openShortcutUrl = (url: string, mode: 'current' | 'new-tab'): void => {
|
|
175
|
+
if (mode === 'new-tab') tab.actions.openTab('browser', { params: { url }, revealIfOpened: false })
|
|
176
|
+
else {
|
|
177
|
+
const outcome = loadUrl(tab.id, url)
|
|
178
|
+
if (outcome !== undefined) setInitFailure(outcome.ok ? undefined : outcome.reason)
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
// A rejected address already has its precise `error.*` notice; showing the
|
|
182
|
+
// generic lifecycle failure next to it would duplicate the same event.
|
|
183
|
+
const reportedInitFailure = initFailure
|
|
184
|
+
?? (state?.initialization?.stage === 'failed' ? state.initialization.reason : undefined)
|
|
185
|
+
// `addressFailure` and `frame.error` already render these two precisely.
|
|
186
|
+
const activeInitFailure = reportedInitFailure === 'navigation-rejected' || reportedInitFailure === 'navigation-failed'
|
|
187
|
+
? undefined
|
|
188
|
+
: reportedInitFailure
|
|
189
|
+
|
|
190
|
+
return (
|
|
191
|
+
<div className={css.root}>
|
|
192
|
+
<div
|
|
193
|
+
style={{ display: 'contents' }}
|
|
194
|
+
onBlur={(event) => {
|
|
195
|
+
// Keep the hint — and its "search this" button — mounted while Tab
|
|
196
|
+
// moves focus between the address bar and the hint container. Only
|
|
197
|
+
// clear once focus leaves this whole toolbar/hint container.
|
|
198
|
+
const next = event.relatedTarget as Node | null
|
|
199
|
+
if (next !== null && event.currentTarget.contains(next)) return
|
|
200
|
+
setFocused(false)
|
|
201
|
+
}}
|
|
202
|
+
>
|
|
203
|
+
<TakeoverBanner notice={takeover.notice} error={takeover.error}
|
|
204
|
+
label={t('takeover.waiting', { reason: takeover.notice?.reason ?? '' })}
|
|
205
|
+
done={t('takeover.done')} skip={t('takeover.skip')} failure={t('takeover.failed')}
|
|
206
|
+
answer={outcome => { void takeoverChannel.current?.answer(outcome) }} />
|
|
207
|
+
<form className={css.toolbar} onSubmit={submit}>
|
|
208
|
+
<button type="button" className={css.tool} aria-label={t('back')} title={t('back')} disabled={!frame.canGoBack} onClick={() => { goBack(tab.id) }}><IconChevronLeftOutlineRegular /></button>
|
|
209
|
+
<button type="button" className={css.tool} aria-label={t('forward')} title={t('forward')} disabled={!frame.canGoForward} onClick={() => { goForward(tab.id) }}><IconChevronRightOutlineRegular /></button>
|
|
210
|
+
<Tooltip label={t('reload')} shortcutKeys={tab.refreshShortcut?.keys} side="bottom" delayMs={500}>
|
|
211
|
+
<button type="button" className={css.tool} aria-label={t('reload')} aria-keyshortcuts={tab.refreshShortcut?.aria} disabled={target === undefined || mountEpoch === 0} onClick={() => { reload(tab.id) }}><IconRefreshOutlineRegular /></button>
|
|
212
|
+
</Tooltip>
|
|
213
|
+
<SearchEngineMenu data={startPage} t={t} actions={engines} onManage={() => { setEnginesOpen(true) }}
|
|
214
|
+
onFailure={setEngineFailure} />
|
|
215
|
+
<div className={css.addressBox}>
|
|
216
|
+
<input
|
|
217
|
+
ref={addressRef}
|
|
218
|
+
className={[css.address, unknown ? css.addressUnknown : ''].join(' ')}
|
|
219
|
+
value={draft}
|
|
220
|
+
aria-label={t('address.placeholder')}
|
|
221
|
+
aria-keyshortcuts={addressShortcut?.aria}
|
|
222
|
+
title={addressShortcut === undefined ? undefined : t('address.shortcut', { keys: addressShortcut.keys.join(' ') })}
|
|
223
|
+
placeholder={t('address.placeholder')}
|
|
224
|
+
spellCheck={false}
|
|
225
|
+
onChange={(event) => { setDraft(event.currentTarget.value) }}
|
|
226
|
+
onFocus={() => { setFocused(true) }}
|
|
227
|
+
onKeyDown={(event) => {
|
|
228
|
+
if (event.key === 'Escape') {
|
|
229
|
+
event.preventDefault()
|
|
230
|
+
resetDraft()
|
|
231
|
+
event.currentTarget.blur()
|
|
232
|
+
return
|
|
233
|
+
}
|
|
234
|
+
// oxlint-disable-next-line typescript/no-deprecated -- IME 229 covers engines without isComposing.
|
|
235
|
+
if (event.key === 'Enter' && (event.nativeEvent.isComposing || event.keyCode === 229)) event.preventDefault()
|
|
236
|
+
}}
|
|
237
|
+
/>
|
|
238
|
+
{unknown && <span className={css.addressChanged}>{t('address.changed')}</span>}
|
|
239
|
+
<button type="submit" className={[css.tool, css.addressGo].join(' ')} aria-label={t('go')} title={t('go')}><IconLinkOutlineRegular /></button>
|
|
240
|
+
</div>
|
|
241
|
+
<button type="button" className={css.tool} aria-label={t('external')} title={t('external')} disabled={externalUrl === undefined}
|
|
242
|
+
onClick={externalUrl === undefined ? undefined : () => { window.open(externalUrl, '_blank', 'noopener,noreferrer') }}
|
|
243
|
+
><IconRightUpOutlineRegular size={14} /></button>
|
|
244
|
+
{sandboxed !== undefined && <button
|
|
245
|
+
type="button"
|
|
246
|
+
className={[css.tool, sandboxed ? '' : css.sandboxOff].join(' ')}
|
|
247
|
+
aria-label={t(sandboxed ? 'sandbox.disable' : 'sandbox.enable')}
|
|
248
|
+
title={t(sandboxed ? 'sandbox.disable' : 'sandbox.enable')}
|
|
249
|
+
aria-pressed={!sandboxed}
|
|
250
|
+
onClick={() => { setSandbox(tab.id, !sandboxed) }}
|
|
251
|
+
><SandboxPolicyIcon sandboxed={sandboxed} /></button>}
|
|
252
|
+
</form>
|
|
253
|
+
{focused && preview?.kind === 'resolved' && (
|
|
254
|
+
<div className={css.addressHint} role="status">
|
|
255
|
+
<span className={css.addressHintText}>
|
|
256
|
+
{preview.primary.kind === 'search'
|
|
257
|
+
? t('address.searchHint', { engine: previewEngine?.label ?? preview.primary.engineId, query: preview.primary.query })
|
|
258
|
+
: t('address.openHint', { url: preview.primary.target.url })}
|
|
259
|
+
</span>
|
|
260
|
+
{alternativeSearch !== undefined && (
|
|
261
|
+
<button type="button" className={css.addressHintAction}
|
|
262
|
+
onMouseDown={(event) => { event.preventDefault() }}
|
|
263
|
+
onClick={() => { loadUrl(tab.id, alternativeSearch.target.url) }}>
|
|
264
|
+
{t('address.searchThis')}
|
|
265
|
+
</button>
|
|
266
|
+
)}
|
|
267
|
+
</div>
|
|
268
|
+
)}
|
|
269
|
+
{focused && preview?.kind === 'refused' && preview.reason !== 'empty' && (
|
|
270
|
+
<div className={css.addressHint} role="alert">
|
|
271
|
+
<span className={css.addressHintError}>{t(`error.${preview.reason}`)}</span>
|
|
272
|
+
</div>
|
|
273
|
+
)}
|
|
274
|
+
</div>
|
|
275
|
+
{sandboxed === false && <div className={css.sandboxWarning} role="status">{t('sandbox.warning')}</div>}
|
|
276
|
+
{error !== undefined && <div className={css.failure} role="status">{error.code !== undefined && error.description !== undefined
|
|
277
|
+
? t('load.failed.detail', { code: String(error.code), description: error.description })
|
|
278
|
+
: t('load.failed')}</div>}
|
|
279
|
+
{failure !== undefined && <div className={css.failure} role="alert">{t(`error.${failure}`)}</div>}
|
|
280
|
+
{activeInitFailure !== undefined && (
|
|
281
|
+
<div className={css.failure} role="alert" data-init-failure={activeInitFailure}>
|
|
282
|
+
{t(`init.failed.${activeInitFailure}`)}
|
|
283
|
+
</div>
|
|
284
|
+
)}
|
|
285
|
+
{engineFailure !== undefined && <div className={css.failure} role="alert">{t(`error.${engineFailure}`)}</div>}
|
|
286
|
+
<div className={css.content} aria-busy={frame.loading}>
|
|
287
|
+
<div id={viewportId} className={css.viewport} aria-label={t('type.label')} />
|
|
288
|
+
{restoreTarget !== undefined && <section className={css.restore} aria-label={t('restore.previous')}>
|
|
289
|
+
<p className={css.restoreLabel}>{t('restore.previous')}</p>
|
|
290
|
+
<p className={css.restoreTitle}>{restoreTarget.title}</p>
|
|
291
|
+
<p className={css.restoreUrl}>{restoreTarget.url}</p>
|
|
292
|
+
<Button variant="primary" size="sm" disabled={mountEpoch === 0} onClick={() => { restore(tab.id) }}>
|
|
293
|
+
{t('restore.action')}
|
|
294
|
+
</Button>
|
|
295
|
+
</section>}
|
|
296
|
+
{restoreTarget === undefined && target === undefined && !frame.loading && error === undefined && (
|
|
297
|
+
startPage.status === 'ready'
|
|
298
|
+
? <StartPage data={startPage} t={t} actions={shortcuts} open={openShortcutUrl}
|
|
299
|
+
sessionId={sessionId} tabId={tab.id} getTriggerProps={getTriggerProps} />
|
|
300
|
+
: <div className={css.placeholder}>
|
|
301
|
+
<div className={css.start}>{t(startPage.status === 'loading' ? 'startpage.loading' : 'start')}</div>
|
|
302
|
+
</div>
|
|
303
|
+
)}
|
|
304
|
+
{restoreTarget === undefined && frame.loading && error === undefined && <div className={css.placeholder}>
|
|
305
|
+
<div className={css.start}>{t('loading')}</div>
|
|
306
|
+
</div>}
|
|
307
|
+
</div>
|
|
308
|
+
{unknown && <p className={css.limit}>{t('address.unknown')}</p>}
|
|
309
|
+
<EngineSettingsDialog open={enginesOpen} data={startPage} t={t} actions={engines}
|
|
310
|
+
onClose={() => { setEnginesOpen(false) }} />
|
|
311
|
+
<ShortcutDialog open={state?.shortcutDraft !== undefined} shortcut={undefined} seed={state?.shortcutDraft}
|
|
312
|
+
t={t} actions={shortcuts} onClose={() => { dismissShortcut(tab.id) }} />
|
|
313
|
+
</div>
|
|
314
|
+
)
|
|
315
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** The presentation face is separate from page navigation and terminal disposal. */
|
|
2
|
+
export interface BrowserPresentation {
|
|
3
|
+
/**
|
|
4
|
+
* Attach the page inside a committed content container.
|
|
5
|
+
* @param viewportId - content element id; its DOM ancestors must remain connected for page retention.
|
|
6
|
+
* @returns ends physical attachment, without disposing the navigation model; a later mount may reload the page.
|
|
7
|
+
*/
|
|
8
|
+
mount(viewportId: string): () => void
|
|
9
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Live Browser tab title from the Browser store. */
|
|
2
|
+
import type { ReactNode } from 'react'
|
|
3
|
+
import { IconGlobeOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives'
|
|
4
|
+
import type { PropsRuntime, PropsStore } from '@deepseek-ai/dsh-client-ui-slots'
|
|
5
|
+
import { currentBrowserTarget } from '../browser/BrowserPersistence.ts'
|
|
6
|
+
import type { BrowserStore } from '../browser/store.ts'
|
|
7
|
+
import css from './Browser.module.css'
|
|
8
|
+
|
|
9
|
+
/** Browser title props assembled by the Sidebar title seat. */
|
|
10
|
+
export type BrowserTitleProps = PropsRuntime<'sidebar.right.pane.tab.title'> & PropsStore<BrowserStore>
|
|
11
|
+
|
|
12
|
+
/** Browser icon and current host name. */
|
|
13
|
+
export function BrowserTitle({ useTabInfo, useStore }: BrowserTitleProps): ReactNode {
|
|
14
|
+
const { tab } = useTabInfo()
|
|
15
|
+
const entry = useStore(state => currentBrowserTarget(state.byTab[tab.id]))
|
|
16
|
+
return <><IconGlobeOutlineRegular className={css.titleIcon} />{entry?.title ?? tab.title}</>
|
|
17
|
+
}
|