diff --git a/packages/app/component-tests/browser-pane.spec.ts b/packages/app/component-tests/browser-pane.spec.ts index 5312f0df42c..cbe2db7a753 100644 --- a/packages/app/component-tests/browser-pane.spec.ts +++ b/packages/app/component-tests/browser-pane.spec.ts @@ -227,17 +227,17 @@ story("keeps the comment editor and its actions inside the page", async ({ page story("shows the empty state over a blank native page and restores navigation", async ({ page }) => { const root = page.getByTestId("browser-pane-fixture") await root.getByRole("button", { name: "Blank page", exact: true }).click() - await expect(root.getByText("Enter URL", { exact: true })).toBeVisible() - await expect(root.getByText('Or prompt "Open in the app browser"', { exact: true })).toBeVisible() + await expect(root.getByText("Open a page", { exact: true })).toBeVisible() + await expect(root.getByText("Preview your app, read docs, or browse the web.", { exact: true })).toBeVisible() await expect(root.getByTestId("native-Alpha")).toHaveAttribute("data-visible", "false") await expect(root.getByRole("button", { name: "Reload", exact: true })).toBeDisabled() - const address = root.getByRole("textbox", { name: "Browser address", exact: true }) + const address = root.getByRole("combobox", { name: "Browser address", exact: true }) await address.fill("https://example.com/") - await expect(root.getByText("Enter URL", { exact: true })).toBeVisible() + await expect(root.getByText("Open a page", { exact: true })).toBeVisible() await address.press("Enter") await expect(address).not.toBeFocused() - await expect(root.getByText("Enter URL", { exact: true })).toBeHidden() + await expect(root.getByText("Open a page", { exact: true })).toBeHidden() await expect(root.getByTestId("native-Alpha")).toHaveAttribute("data-visible", "true") await expect(root.getByRole("button", { name: "Reload", exact: true })).toBeEnabled() }) @@ -245,9 +245,9 @@ story("shows the empty state over a blank native page and restores navigation", story("keeps Stop available and hides the empty state while a blank page loads", async ({ page }) => { const root = page.getByTestId("browser-pane-fixture") await root.getByRole("button", { name: "Loading page", exact: true }).click() - await expect(root.getByText("Enter URL", { exact: true })).toBeHidden() + await expect(root.getByText("Open a page", { exact: true })).toBeHidden() await root.getByRole("button", { name: "Stop", exact: true }).click() - await expect(root.getByText("Enter URL", { exact: true })).toBeVisible() + await expect(root.getByText("Open a page", { exact: true })).toBeVisible() await expect(root.getByTestId("native-Alpha")).toHaveAttribute("data-visible", "false") }) @@ -255,12 +255,12 @@ story("keeps the submitted URL visible until the browser reports navigation", as const root = page.getByTestId("browser-pane-fixture") await root.getByRole("button", { name: "Blank page", exact: true }).click() await root.getByRole("button", { name: "Delay navigation", exact: true }).click() - const address = root.getByRole("textbox", { name: "Browser address", exact: true }) + const address = root.getByRole("combobox", { name: "Browser address", exact: true }) await address.fill("https://example.com/") await address.press("Enter") await expect(address).not.toBeFocused() await expect(address).toHaveValue("https://example.com/") - await expect(root.getByText("Enter URL", { exact: true })).toBeHidden() + await expect(root.getByText("Open a page", { exact: true })).toBeHidden() await root.getByRole("button", { name: "Complete navigation", exact: true }).click() await expect(root.getByTestId("native-Alpha")).toHaveAttribute("data-visible", "true") @@ -274,7 +274,7 @@ story("keeps the submitted URL visible until the browser reports navigation", as story("restores the current URL each time the same submitted navigation is blocked", async ({ page }) => { const root = page.getByTestId("browser-pane-fixture") await root.getByRole("button", { name: "Delay navigation", exact: true }).click() - const address = root.getByRole("textbox", { name: "Browser address", exact: true }) + const address = root.getByRole("combobox", { name: "Browser address", exact: true }) for (const submission of [1, 2]) { await story.step(`blocked submission ${submission}`, async () => { @@ -296,7 +296,7 @@ story("shows a themed failure state for only the failed tab and allows retry", a await expect(root.getByText("Check the URL and your connection, then try again.", { exact: true })).toBeVisible() await expect(root.getByText("Request failed", { exact: true })).toBeHidden() await expect(root.getByTestId("native-Alpha")).toHaveAttribute("data-visible", "false") - await expect(root.getByRole("textbox", { name: "Browser address", exact: true })).toHaveValue( + await expect(root.getByRole("combobox", { name: "Browser address", exact: true })).toHaveValue( "https://alpha.example/", ) @@ -317,7 +317,7 @@ story("returns a failed tab to the empty state when an empty URL is submitted", await expect(root.getByText("URL can't be reached", { exact: true })).toBeVisible() await root.getByRole("button", { name: "Delay navigation", exact: true }).click() - const address = root.getByRole("textbox", { name: "Browser address", exact: true }) + const address = root.getByRole("combobox", { name: "Browser address", exact: true }) await address.fill("") await address.press("Enter") await expect(address).not.toBeFocused() @@ -326,14 +326,14 @@ story("returns a failed tab to the empty state when an empty URL is submitted", await expect(root.getByRole("button", { name: "Stop", exact: true })).toBeEnabled() await root.getByRole("button", { name: "Complete navigation", exact: true }).click() await expect(root.getByText("URL can't be reached", { exact: true })).toBeHidden() - await expect(root.getByText("Enter URL", { exact: true })).toBeVisible() + await expect(root.getByText("Open a page", { exact: true })).toBeVisible() await expect(root.getByRole("button", { name: "Reload", exact: true })).toBeDisabled() await expect(root.getByTestId("native-Alpha")).toHaveAttribute("data-visible", "false") }) story("selects the full URL when the address field gains focus", async ({ page }) => { const root = page.getByTestId("browser-pane-fixture") - const address = root.getByRole("textbox", { name: "Browser address", exact: true }) + const address = root.getByRole("combobox", { name: "Browser address", exact: true }) await address.click() await expect(address).toHaveJSProperty("selectionStart", 0) await expect(address).toHaveJSProperty("selectionEnd", "https://alpha.example/".length) @@ -352,10 +352,55 @@ story("selects the full URL when the address field gains focus", async ({ page } .toBe(true) }) +story("draws only the address at rest when focus leaves the window with the field selected", async ({ page }) => { + const root = page.getByTestId("browser-pane-fixture") + const address = root.getByRole("combobox", { name: "Browser address", exact: true }) + await address.click() + // Chromium blurs the field when the window or the native page takes focus, and the field keeps its full selection. + await address.evaluate((input: HTMLInputElement) => { + input.dispatchEvent(new FocusEvent("blur")) + input.select() + }) + await expect(address).toHaveJSProperty("selectionStart", 0) + await expect(address).toHaveJSProperty("selectionEnd", "https://alpha.example/".length) + await page.mouse.move(0, 0) + + // Computed ::selection styles do not report the default highlight, so compare the input's own paint with the + // selection collapsed. The drawn address is hidden: a selection layer can change how its text is antialiased. + await page.addStyleTag({ content: '[data-slot="browser-address-display"] { visibility: hidden }' }) + const field = root.locator('[data-component="browser-address"]') + const selected = (await field.screenshot()).toString("base64") + await address.evaluate((input: HTMLInputElement) => input.setSelectionRange(0, 0)) + const collapsed = (await field.screenshot()).toString("base64") + + const changed = await page.evaluate( + async (shots) => { + const pixels = await Promise.all( + shots.map(async (data) => { + const image = new Image() + image.src = `data:image/png;base64,${data}` + await image.decode() + const canvas = new OffscreenCanvas(image.width, image.height) + canvas.getContext("2d")?.drawImage(image, 0, 0) + + return canvas.getContext("2d")?.getImageData(0, 0, image.width, image.height).data ?? new Uint8ClampedArray() + }), + ) + + return Array.from({ length: (pixels[0]?.length ?? 0) / 4 }, (_, index) => index * 4).filter((offset) => + [0, 1, 2].some((channel) => pixels[0]?.[offset + channel] !== pixels[1]?.[offset + channel]), + ).length + }, + [selected, collapsed], + ) + + expect(changed).toBe(0) +}) + story("keeps the current page visible while a submitted URL loads", async ({ page }) => { const root = page.getByTestId("browser-pane-fixture") await root.getByRole("button", { name: "Delay navigation", exact: true }).click() - const address = root.getByRole("textbox", { name: "Browser address", exact: true }) + const address = root.getByRole("combobox", { name: "Browser address", exact: true }) await address.fill("https://example.com/") await address.press("Enter") await expect(root.getByTestId("native-Alpha")).toHaveAttribute("data-visible", "true") @@ -371,12 +416,74 @@ story("keeps the current page visible while a submitted URL loads", async ({ pag story("keeps the current page and restores its URL when an empty address is submitted", async ({ page }) => { const root = page.getByTestId("browser-pane-fixture") - const address = root.getByRole("textbox", { name: "Browser address", exact: true }) + const address = root.getByRole("combobox", { name: "Browser address", exact: true }) await address.fill("") await address.press("Enter") await expect(address).not.toBeFocused() await expect(address).toHaveValue("https://alpha.example/") await expect(root.getByTestId("native-Alpha")).toHaveAttribute("data-visible", "true") - await expect(root.getByText("Enter URL", { exact: true })).toBeHidden() + await expect(root.getByText("Open a page", { exact: true })).toBeHidden() await expect(root.getByRole("button", { name: "Reload", exact: true })).toBeEnabled() }) + +story("suggests visited pages and opens the first one that completes the typed address", async ({ page }) => { + const root = page.getByTestId("browser-pane-fixture") + await root.getByRole("button", { name: "Seed history", exact: true }).click() + const address = root.getByRole("combobox", { name: "Browser address", exact: true }) + await address.click() + await address.pressSequentially("localhost") + const options = page.getByRole("option") + await expect(options).toHaveCount(1) + await expect(options.first()).toHaveAttribute("aria-selected", "true") + await address.press("Enter") + await expect(address).toHaveValue("http://localhost:5173/settings") + + // A search query also opens the first match; stepping past the list leaves the typed text, which searches. + await address.click() + await address.pressSequentially("color format") + await expect(options).toHaveCount(1) + await expect(options.first()).toHaveAttribute("aria-selected", "true") + await address.press("ArrowDown") + await expect(options.first()).toHaveAttribute("aria-selected", "false") + await address.press("Enter") + await expect(address).toHaveValue("https://www.google.com/search?q=color%20format") +}) + +story("lists recent pages on a blank tab and opens one", async ({ page }) => { + const root = page.getByTestId("browser-pane-fixture") + await root.getByRole("button", { name: "Seed history", exact: true }).click() + await root.getByRole("button", { name: "Blank page", exact: true }).click() + await expect(root.getByText("Recent", { exact: true })).toBeVisible() + await root.getByRole("button", { name: /^Settings - Preview/ }).click() + await expect(root.getByRole("combobox", { name: "Browser address", exact: true })).toHaveValue( + "http://localhost:5173/settings", + ) + await expect(root.getByTestId("native-Alpha")).toHaveAttribute("data-visible", "true") +}) + +story("focuses the address field when the page uses the address shortcut", async ({ page }) => { + const root = page.getByTestId("browser-pane-fixture") + await root.getByRole("button", { name: "Address shortcut", exact: true }).click() + const address = root.getByRole("combobox", { name: "Browser address", exact: true }) + await expect(address).toBeFocused() + await expect(address).toHaveJSProperty("selectionEnd", "https://alpha.example/".length) +}) + +story("shows the page's cookies in the site information and clears them", async ({ page }) => { + const root = page.getByTestId("browser-pane-fixture") + await root.getByRole("button", { name: "Site information", exact: true }).click() + const site = page.getByRole("dialog") + await expect(site).toContainText("3 cookies in use") + await site.getByRole("button", { name: "Clear", exact: true }).click() + await expect(site).toContainText("0 cookies in use") +}) + +story("zooms the page from the browser options and shows its zoom", async ({ page }) => { + const root = page.getByTestId("browser-pane-fixture") + await root.getByRole("button", { name: "Browser options", exact: true }).click() + await page.getByRole("menuitem", { name: /^Zoom in/ }).click() + await expect(root.getByText("Zoom: 110", { exact: true })).toBeVisible() + await expect(page.getByRole("menuitem", { name: /^Reset zoom/ })).toContainText("110%") + await page.getByRole("menuitem", { name: /^Reset zoom/ }).click() + await expect(root.getByText("Zoom: 100", { exact: true })).toBeVisible() +}) diff --git a/packages/gui-extensions/src/browser/address.test.ts b/packages/gui-extensions/src/browser/address.test.ts new file mode 100644 index 00000000000..b606a1f1828 --- /dev/null +++ b/packages/gui-extensions/src/browser/address.test.ts @@ -0,0 +1,82 @@ +import { expect, test } from "bun:test" +import { addressParts, resolveAddress } from "./address" +import { remember, suggest } from "./history" + +test("the address field navigates to what reads as an address and searches for anything else", () => { + const search = (query: string) => `https://www.google.com/search?q=${encodeURIComponent(query)}` + + expect( + [ + "", + "https://example.com/a b", + "about:blank", + "localhost:3000", + "localhost", + "[::1]:5173/app", + "127.0.0.1:8080", + "dev-box:4096/health", + "developer.mozilla.org/en-US/docs", + "mdn", + "css grid gap", + "localhost 3000", + ].map(resolveAddress), + ).toEqual([ + "about:blank", + "https://example.com/a b", + "about:blank", + "localhost:3000", + "localhost", + "[::1]:5173/app", + "127.0.0.1:8080", + "dev-box:4096/health", + "developer.mozilla.org/en-US/docs", + search("mdn"), + search("css grid gap"), + search("localhost 3000"), + ]) +}) + +test("the field draws the whole URL, split around its host, in exactly the input's characters", () => { + const urls = [ + "https://developer.mozilla.org/en-US/docs/Web?q=1#top", + "http://localhost:5173/", + "https://alpha.example", + "file:///C:/repo/out/index.html", + "HTTPS://Example.COM/%7Euser", + ] + + expect(urls.map(addressParts)).toEqual([ + { scheme: "https://", host: "developer.mozilla.org", rest: "/en-US/docs/Web?q=1#top" }, + { scheme: "http://", host: "localhost:5173", rest: "/" }, + { scheme: "https://", host: "alpha.example", rest: "" }, + { scheme: "file://", host: "", rest: "/C:/repo/out/index.html" }, + { scheme: "HTTPS://", host: "Example.COM", rest: "/%7Euser" }, + ]) + expect(urls.map((url) => Object.values(addressParts(url)).join(""))).toEqual(urls) +}) + +test("history keeps one newest-first visit per URL and suggests addresses that complete the query first", () => { + const visits = ["https://docs.example/mdn-guide", "https://developer.mozilla.org/", "https://www.mdn.dev/"].reduce( + (list, url) => remember(list, { url, title: url.includes("mozilla") ? "MDN Web Docs" : "Other" }), + remember([], { url: "https://developer.mozilla.org/", title: "Old title" }), + ) + + expect(visits.map((visit) => [visit.url, visit.title])).toEqual([ + ["https://www.mdn.dev/", "Other"], + ["https://developer.mozilla.org/", "MDN Web Docs"], + ["https://docs.example/mdn-guide", "Other"], + ]) + // A leading www. and the scheme are not typed, so mdn completes www.mdn.dev; the others only contain it. + expect(suggest(visits, "MDN", 5).map((visit) => visit.url)).toEqual([ + "https://www.mdn.dev/", + "https://developer.mozilla.org/", + "https://docs.example/mdn-guide", + ]) + expect(suggest(visits, " ", 5)).toEqual([]) + expect( + Array.from({ length: 40 }, (_, index) => `https://example.com/${index}`).reduce( + (list, url) => remember(list, { url, title: "" }), + visits, + ), + ).toHaveLength(30) +}) diff --git a/packages/gui-extensions/src/browser/address.ts b/packages/gui-extensions/src/browser/address.ts new file mode 100644 index 00000000000..0ff0070988e --- /dev/null +++ b/packages/gui-extensions/src/browser/address.ts @@ -0,0 +1,65 @@ +/** Where text that is not an address goes. Shared with the system browser's default so results look familiar. */ +const SEARCH = "https://www.google.com/search?q=" + +/** + * What the address field navigates to for the text the user entered: the text itself when it reads as an address + * (a scheme, `localhost`, a port, or a dotted host), else a web search for it. Main adds the missing scheme. + */ +export function resolveAddress(input: string) { + const value = input.trim() + + if (!value) return "about:blank" + + return searches(value) ? `${SEARCH}${encodeURIComponent(value)}` : value +} + +/** Whether the address field would search for the text rather than open it. */ +export function searches(input: string) { + const value = input.trim() + + if (/^[a-z][a-z\d+.-]*:\/\//i.test(value) || /^about:/i.test(value)) return false + + if (!value || /\s/.test(value)) return !!value + const host = value.split(/[/?#]/, 1)[0] ?? "" + + return !( + /^(?:localhost|\[[\da-f:.]+\])(?::\d+)?$/i.test(host) || + /:\d+$/.test(host) || + /^[^.]+(?:\.[^.]+)+$/.test(host) + ) +} + +/** + * The address as the field draws it at rest: always the whole URL, with its host emphasized. The parts join back to + * exactly the text given, so the drawing lines up with the input's own text. + */ +export function addressParts(url: string) { + const match = /^([a-z][a-z\d+.-]*:\/\/)?([^/?#]*)(.*)$/is.exec(url) + + return { scheme: match?.[1] ?? "", host: match?.[2] ?? url, rest: match?.[3] ?? "" } +} + +/** + * How a page reached its content, for the site information. + * - `secure`: HTTPS. + * - `local`: HTTP on a loopback host, which resolves on the machine running the server. + * - `insecure`: HTTP elsewhere. + * - `file`: a workspace file. + */ +export function connection(url: string) { + if (!URL.canParse(url)) return + const parsed = new URL(url) + + if (parsed.protocol === "https:") return "secure" + + if (parsed.protocol === "file:") return "file" + + if (parsed.protocol !== "http:") return + + return loopback(parsed.hostname) ? "local" : "insecure" +} + +/** Whether a host names this machine; for a remote server that is the server's machine, not the user's. */ +export function loopback(hostname: string) { + return /^(?:localhost|127(?:\.\d{1,3}){3}|\[::1\]|::1)$/i.test(hostname) || hostname.endsWith(".localhost") +} diff --git a/packages/gui-extensions/src/browser/bar.css b/packages/gui-extensions/src/browser/bar.css new file mode 100644 index 00000000000..e5fc6830e65 --- /dev/null +++ b/packages/gui-extensions/src/browser/bar.css @@ -0,0 +1,240 @@ +/* The browser bar's address field: the whole URL at rest, and an editable address with a focus border while the + field has focus. */ +[data-component="browser-address"] { + position: relative; + display: flex; + align-items: center; + gap: 6px; + flex: 1 1 0; + min-width: 0; + height: 28px; + padding-inline: 8px; + border-radius: 6px; + background-color: var(--v2-background-bg-layer-01); + box-shadow: inset 0 0 0 0.5px transparent; + color: var(--v2-text-text-base); + font-size: 13px; + font-weight: 440; + line-height: var(--line-height-compact); + letter-spacing: -0.04px; + cursor: text; + + &[data-site] { + padding-inline-start: 6px; + } + + &:hover:not([data-editing]) { + background-image: linear-gradient(var(--v2-overlay-simple-overlay-hover), var(--v2-overlay-simple-overlay-hover)); + } + + &[data-editing] { + padding-inline-start: 8px; + box-shadow: inset 0 0 0 0.5px var(--v2-border-border-focus); + } + + /* A focused page address sits where it sat at rest, 32px in; typed text and the placeholder sit at 30px. */ + &[data-editing][data-address] { + gap: 8px; + } + + [data-slot="browser-address-text"] { + position: relative; + flex: 1 1 0; + min-width: 0; + height: 100%; + } + + [data-slot="browser-address-input"] { + position: absolute; + inset: 0; + width: 100%; + padding: 0; + border: none; + outline: none; + background: transparent; + font: inherit; + letter-spacing: inherit; + color: transparent; + + &::placeholder { + color: var(--v2-text-text-faint); + } + } + + &[data-editing] [data-slot="browser-address-input"] { + color: var(--v2-text-text-base); + } + + /* Focus leaving the window (or into the page) ends editing but keeps the input's selection, which Chromium paints + over transparent text. At rest only the drawn address shows. */ + &:not([data-editing]) [data-slot="browser-address-input"]::selection { + color: transparent; + background-color: transparent; + } + + [data-slot="browser-address-display"], + [data-slot="browser-address-hint"] { + position: absolute; + inset: 0; + display: flex; + align-items: center; + overflow: hidden; + white-space: pre; + pointer-events: none; + } + + [data-slot="browser-address-hint"] { + color: var(--v2-text-text-muted); + } + + /* One line of the whole URL, ending in an ellipsis where the field ends. The scheme and the path are muted around + the host, and so is the ellipsis, which takes the line's color and almost always cuts the path. An address + without a host, such as a workspace file, keeps its path at full strength. */ + [data-slot="browser-address-url"] { + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + + &[data-host] { + color: var(--v2-text-text-faint); + } + } + + [data-slot="browser-address-muted"] { + color: var(--v2-text-text-faint); + } + + [data-slot="browser-address-host"] { + color: var(--v2-text-text-base); + } + + /* Page actions show on hover and while the field has focus. */ + [data-slot="browser-address-actions"] { + display: none; + flex: none; + align-items: center; + gap: 8px; + } + + &:is(:hover, :focus-within) [data-slot="browser-address-actions"] { + display: flex; + } +} + +/* Suggestions from the browsing history, under the address field. */ +[data-component="browser-suggestions"] { + z-index: 60; + width: calc(var(--kb-popper-anchor-width) + 16px); + padding: 8px; + border-radius: 12px; + background: var(--v2-background-bg-base); + box-shadow: var(--v2-elevation-floating); + outline: none; + transform-origin: var(--kb-popover-content-transform-origin); +} + +[data-component="browser-page-row"] { + display: flex; + align-items: center; + gap: 8px; + width: 100%; + height: 28px; + padding-inline: 8px; + border-radius: 6px; + color: var(--v2-text-text-base); + font-size: 13px; + font-weight: 440; + line-height: var(--line-height-compact); + letter-spacing: -0.04px; + text-align: start; + cursor: default; + + &:hover { + background: var(--v2-overlay-simple-overlay-hover); + } + + &[aria-selected="true"] { + background: var(--v2-overlay-simple-overlay-pressed); + } + + [data-slot="browser-page-row-text"] { + display: flex; + flex: 1 1 0; + gap: 4px; + min-width: 0; + white-space: pre; + } + + [data-slot="browser-page-row-title"] { + flex: none; + max-width: 60%; + overflow: hidden; + text-overflow: ellipsis; + } + + [data-slot="browser-page-row-url"] { + flex: 1 1 0; + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + color: var(--v2-text-text-muted); + } + + mark { + background: none; + color: inherit; + font-weight: 530; + } +} + +/* Suggestions read the address at full strength; the new tab page mutes it. */ +[data-component="browser-suggestions"] [data-slot="browser-page-row-url"] { + color: var(--v2-text-text-base); +} + +/* Site information under the site button. */ +[data-component="browser-site"] { + z-index: 60; + display: flex; + flex-direction: column; + gap: 12px; + width: 320px; + padding: 12px; + border-radius: 12px; + background: var(--v2-background-bg-base); + box-shadow: var(--v2-elevation-floating); + outline: none; + color: var(--v2-text-text-base); + font-size: 13px; + font-weight: 440; + line-height: var(--line-height-compact); + letter-spacing: -0.04px; + transform-origin: var(--kb-popover-content-transform-origin); + + [data-slot="browser-site-host"] { + min-width: 0; + margin: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-size: inherit; + font-weight: 530; + } + + [data-slot="browser-site-row"] { + display: flex; + gap: 8px; + align-items: flex-start; + color: var(--v2-icon-icon-muted); + } + + /* An action beside a row's text, centered on it. */ + [data-slot="browser-site-row"] > [data-component="button-v2"] { + flex: none; + align-self: center; + } + + [data-slot="browser-site-detail"] { + color: var(--v2-text-text-muted); + } +} diff --git a/packages/gui-extensions/src/browser/chromium.ts b/packages/gui-extensions/src/browser/chromium.ts index 433b3e7d992..9aaff748cf7 100644 --- a/packages/gui-extensions/src/browser/chromium.ts +++ b/packages/gui-extensions/src/browser/chromium.ts @@ -6,6 +6,7 @@ import type { Embeds } from "../sdk/main" import { createCdp, abortError, waitFor } from "./cdp" import { createBrowserFiles } from "./files" import { createDiagnostics } from "./diagnostics" +import { loadIcon } from "./icon" import { createProfiling, type Recording } from "./profiling" import type { BrowserNetwork } from "./network" import { allowedDestination, destinationOrigin, fileURLWithin, localFileURL, normalizeURL, type Policy } from "./policy" @@ -75,6 +76,35 @@ const pickedHighlight = { ...inspectHighlight, showInfo: false, showStyles: fals // next hideHighlight would put its hover tool back. const inspectOff = { mode: "none", highlightConfig: inspectHighlight } +// Chromium's zoom presets, so a step lands where it would in the system browser. +const zoomSteps = [0.25, 0.33, 0.5, 0.67, 0.75, 0.8, 0.9, 1, 1.1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4, 5] + +/** A page's icon as a data URL, and its zoom factor, 1 at 100%. */ +export type PageDetail = { icon?: string; zoom: number } + +/** The zoom a key press asks for: the system browser's zoom keys, with the platform's modifier already checked. */ +function zoomKey(input: Electron.Input) { + if (input.key === "=" || input.key === "+" || input.code === "NumpadAdd") return "in" + + if (input.key === "-" || input.code === "NumpadSubtract") return "out" + + if (input.key === "0") return "reset" +} + +/** The address a cookie is removed by: its domain without the leading dot, its path, and its scheme. */ +function cookieURL(cookie: Electron.Cookie) { + return `${cookie.secure ? "https" : "http"}://${(cookie.domain ?? "").replace(/^\./, "")}${cookie.path ?? "/"}` +} + +/** The next preset in the direction, or 100%; the current factor at either end. */ +function zoomStep(current: number, direction: "in" | "out" | "reset") { + if (direction === "reset") return 1 + + if (direction === "in") return zoomSteps.find((step) => step > current + 0.001) ?? current + + return zoomSteps.findLast((step) => step < current - 0.001) ?? current +} + export type BrowserPage = ReturnType export function createBrowserPage( @@ -86,8 +116,15 @@ export function createBrowserPage( publish: (error?: string) => void /** Reports the element picker starting, stopping, or picking an element. */ inspect?: (event: { active: boolean; element?: PaneElement }) => void + /** Reports the page's icon or zoom changing. */ + detail?: (detail: PageDetail) => void + /** The page's zoom changed, which Chromium applies to every page of the same origin in the partition. */ + zoomed?: () => void + /** The user pressed the address shortcut while the page had focus. */ + address?: () => void fail: () => void - popup: (options: Electron.BrowserWindowConstructorOptions) => WebContents + /** Adopts a page the document opened; a background one leaves the current tab selected. */ + popup: (options: Electron.BrowserWindowConstructorOptions, background: boolean) => WebContents initialize?: boolean restore?: Browser.Tab popupOptions?: Electron.BrowserWindowConstructorOptions @@ -148,16 +185,56 @@ export function createBrowserPage( return } - const step = - input.key === "=" || input.key === "+" || input.code === "NumpadAdd" - ? 0.5 - : input.key === "-" || input.code === "NumpadSubtract" - ? -0.5 - : 0 + // The system browser's address shortcut. The app's own focus moves to the address field. + if (!input.shift && input.code === "KeyL") { + event.preventDefault() + options.address?.() - if (!step && input.key !== "0") return + return + } + + const direction = zoomKey(input) + + if (!direction) return event.preventDefault() - contents.setZoomLevel(input.key === "0" ? 0 : contents.getZoomLevel() + step) + zoom(direction) + }) + // Ctrl or Cmd with the mouse wheel; Electron leaves applying it to the app. + contents.on("zoom-changed", (_event, direction) => zoom(direction)) + + const zoom = (direction: "in" | "out" | "reset") => { + const current = contents.getZoomFactor() + const next = zoomStep(current, direction) + + if (next === current) return + contents.setZoomFactor(next) + options.zoomed?.() + } + + let icon: string | undefined + // Bumped by every icon change, so a slow fetch for an earlier icon cannot replace a later one. + let iconRequest = 0 + let reported = "" + + const detail = () => { + if (closed) return + const next: PageDetail = { zoom: contents.getZoomFactor() } + + if (icon) next.icon = icon + const key = `${next.zoom}:${next.icon ?? ""}` + + if (key === reported) return + reported = key + options.detail?.(next) + } + + contents.on("page-favicon-updated", (_event, favicons) => { + const request = ++iconRequest + void loadIcon(favicons, options.network).then((value) => { + if (closed || request !== iconRequest) return + icon = value + detail() + }) }) const cdp = createCdp(contents) const documents = new Map() @@ -192,6 +269,8 @@ export function createBrowserPage( revision++ }) let closed = false + // The committed document's origin; its icon stays while navigations remain on it. + let origin = "" // Whether the native surface holds a real document worth showing. Chromium keeps the // previous document painted until the next one renders, so a shown page stays shown // through later navigations; blank and failed documents hide until a real one is ready. @@ -243,6 +322,16 @@ export function createBrowserPage( // error statuses are real documents from the user's server and stay visible. if (status === 502) failure = { url, message: `${status} ${statusText}`.trim().slice(0, 2_048) } + // Another site's icon arrives with its document; the same site keeps its icon meanwhile, as tabs do. + if (!URL.canParse(url) || new URL(url).origin !== origin) { + icon = undefined + iconRequest++ + } + + origin = URL.canParse(url) ? new URL(url).origin : "" + // Chromium keeps a zoom per origin, so a new site may have its own. + detail() + // A blank or failed document paints at commit; a real one waits for dom-ready. if (url === "about:blank" || failure) settle() publish() @@ -287,7 +376,8 @@ export function createBrowserPage( contents.on("will-frame-navigate", guard) contents.on("will-redirect", guard) - contents.setWindowOpenHandler(({ url }) => + // Links opened with Cmd or Ctrl arrive as background tabs, and stay behind the current one as in the system browser. + contents.setWindowOpenHandler(({ url, disposition }) => url === "about:blank" || destinationOrigin(url) ? { action: "allow", @@ -305,7 +395,7 @@ export function createBrowserPage( partition: options.partition, }, }, - createWindow: (popupOptions) => options.popup(popupOptions), + createWindow: (popupOptions) => options.popup(popupOptions, disposition === "background-tab"), } : { action: "deny" }, ) @@ -453,6 +543,33 @@ export function createBrowserPage( if (closed) return await highlightPicked(ref).catch(() => undefined) }, + zoom(direction: "in" | "out" | "reset") { + if (!closed) zoom(direction) + }, + async site() { + const url = contents.getURL() + + if (closed || !destinationOrigin(url)) return { cookies: 0 } + + return { cookies: (await contents.session.cookies.get({ url })).length } + }, + /** Deletes what the page's site stored: the cookies its address can read, and its origin's storage. */ + async clearSite() { + const url = contents.getURL() + const origin = destinationOrigin(url) + + if (closed || !origin) return + const cookies = await contents.session.cookies.get({ url }) + await Promise.all(cookies.map((cookie) => contents.session.cookies.remove(cookieURL(cookie), cookie.name))) + await contents.session.clearStorageData({ + origin, + storages: ["localstorage", "indexdb", "serviceworkers", "cachestorage", "filesystem", "shadercache"], + }) + + if (!closed) contents.reload() + }, + /** Reports the page's icon and zoom when either changed since the last report. */ + detail, async execute(command: Browser.Command, signal: AbortSignal): Promise { await ready abortError(signal) diff --git a/packages/gui-extensions/src/browser/comment.ts b/packages/gui-extensions/src/browser/comment.ts index de508db72e6..a6ab363e142 100644 --- a/packages/gui-extensions/src/browser/comment.ts +++ b/packages/gui-extensions/src/browser/comment.ts @@ -40,6 +40,30 @@ export function commentNote(input: ElementComment): ComposerNote { return ref ? { ...note, live: { subject: subject(input, ref), href: `${input.tabID}#${ref}` } } : note } +/** The composer note for a comment on a whole page; its chip shows the page's tab again. */ +export function pageNote(input: { + origin: string + tabID: Browser.TabID + url: string + title: string + label: string + comment: string +}): ComposerNote { + // Page-provided strings are quoted so they read as data, not as part of the user's request. + const title = input.title ? ` titled ${JSON.stringify(input.title)}` : "" + + return { + type: "note", + origin: input.origin, + commentID: crypto.randomUUID(), + label: input.label, + icon: "outline-globe", + subject: `the page in browser tab ${input.tabID} at ${input.url}${title}`, + comment: input.comment, + href: input.tabID, + } +} + /** The tab a note's href names, and its element ref while the note is live. */ export function readHref(href: string): NoteHref | undefined { const [tabID, ref] = href.split("#") diff --git a/packages/gui-extensions/src/browser/connection.test.ts b/packages/gui-extensions/src/browser/connection.test.ts index 981fc5cc957..5e4899b2e91 100644 --- a/packages/gui-extensions/src/browser/connection.test.ts +++ b/packages/gui-extensions/src/browser/connection.test.ts @@ -73,6 +73,9 @@ function fixture(strip: string[] = []) { highlight: async (input) => { highlights.push(input) }, + zoom: async () => undefined, + site: async () => ({ cookies: 0 }), + clearSite: async () => undefined, close: async (input) => { closed.push(input.binding) }, @@ -106,6 +109,8 @@ function fixture(strip: string[] = []) { focus: (tabID) => routed.focus.push(tabID), preview: (path) => routed.preview.push(path), inspect: (event) => routed.inspect.push(event), + page: () => undefined, + address: () => undefined, }) const emit = (index: number, event: PaneEvent) => listeners.get(calls[index].input.binding)?.(event) diff --git a/packages/gui-extensions/src/browser/connection.ts b/packages/gui-extensions/src/browser/connection.ts index ea5519a1ffc..ade15877109 100644 --- a/packages/gui-extensions/src/browser/connection.ts +++ b/packages/gui-extensions/src/browser/connection.ts @@ -6,6 +6,10 @@ type Client = IpcClient<(typeof BrowserPane)["spec"]> export type InspectEvent = Extract +export type PageEvent = Extract + +export type Zoom = "in" | "out" | "reset" + export type Connection = ReturnType export type Registration = { @@ -14,6 +18,9 @@ export type Registration = { command(command: Browser.Action): Promise inspect(tabID: Browser.TabID, enabled: boolean): void highlight(tabID: Browser.TabID, ref?: Browser.Ref): void + zoom(tabID: Browser.TabID, zoom: Zoom): void + site(tabID: Browser.TabID): Promise<{ cookies: number }> + clearSite(tabID: Browser.TabID): Promise close(): void } @@ -46,6 +53,10 @@ export function createConnection(input: { focus: (tabID: Browser.TabID) => void preview: (path: string) => void inspect: (event: InspectEvent) => void + /** A page's icon or zoom changed. */ + page: (event: PageEvent) => void + /** The user pressed the address shortcut while the page had focus. */ + address: (tabID: Browser.TabID) => void }) { const state: ConnectionState = { browser: null, embeds: {}, suspended: false } let disposed = false @@ -142,6 +153,10 @@ export function createConnection(input: { if (event.type === "inspect") return input.inspect(event) + if (event.type === "page") return input.page(event) + + if (event.type === "address") return input.address(event.tabID) + if (event.type === "embed") { state.embeds = { ...state.embeds, [event.tabID]: event.embed } @@ -230,6 +245,12 @@ export function createConnection(input: { highlight(tabID: Browser.TabID, ref?: Browser.Ref) { state.registration?.highlight(tabID, ref) }, + zoom(tabID: Browser.TabID, zoom: Zoom) { + state.registration?.zoom(tabID, zoom) + }, + /** The page's site data; undefined while no registration can answer. */ + site: (tabID: Browser.TabID) => state.registration?.site(tabID), + clearSite: (tabID: Browser.TabID) => state.registration?.clearSite(tabID), dispose() { disposed = true clearTimeout(retry) @@ -273,6 +294,12 @@ function open( .then(() => client.highlight(ref === undefined ? { binding, tabID } : { binding, tabID, ref })) .catch(() => undefined) }, + zoom(tabID, zoom) { + if (status.closed) return + void ready.then(() => client.zoom({ binding, tabID, zoom })).catch(() => undefined) + }, + site: (tabID) => ready.then(() => client.site({ binding, tabID })), + clearSite: (tabID) => ready.then(() => client.clearSite({ binding, tabID })), close() { if (status.closed) return status.closed = true diff --git a/packages/gui-extensions/src/browser/history.ts b/packages/gui-extensions/src/browser/history.ts new file mode 100644 index 00000000000..9a418df9a7f --- /dev/null +++ b/packages/gui-extensions/src/browser/history.ts @@ -0,0 +1,106 @@ +import { Schema } from "effect" + +/** A page the browser showed, newest first in the history. */ +export const Visit = Schema.Struct({ + url: Schema.String, + title: Schema.String, + /** The page's icon as a data URL, when it was small enough to keep. */ + icon: Schema.optionalKey(Schema.String), +}) + +export type Visit = typeof Visit.Type + +export const History = Schema.Struct({ visits: Schema.Array(Visit) }) + +export type History = typeof History.Type + +/** Visits the history keeps; the new tab page shows the first few. */ +const MAX_VISITS = 30 + +/** Icons larger than this stay out of the stored history; a 32px PNG is a few kilobytes. */ +const MAX_STORED_ICON = 6_000 + +/** The pages the history records: web pages and workspace files, not blank or internal ones. */ +export function recordable(url: string) { + return /^(?:https?|file):\/\//i.test(url) +} + +/** + * Puts a visit first, replacing an earlier visit of the same URL, and drops the oldest past the limit. A visit without + * a title or icon yet keeps the earlier visit's. + */ +export function remember(visits: readonly Visit[], visit: Pick, icon?: string): Visit[] { + const earlier = visits.find((item) => item.url === visit.url) + const kept = storable(icon) ?? earlier?.icon + const title = visit.title || earlier?.title || "" + + const next: Visit = kept ? { url: visit.url, title, icon: kept } : { url: visit.url, title } + + // Copies, so a store that reconciles the new list in place never sees its own records at moved positions. + return [next, ...visits.flatMap((item) => (item.url === visit.url ? [] : [{ ...item }]))].slice(0, MAX_VISITS) +} + +/** The visits with a newly loaded icon on the visit of `url`, or undefined when nothing would change. */ +export function withIcon(visits: readonly Visit[], url: string, icon: string) { + const stored = storable(icon) + + if (!stored || !visits.some((visit) => visit.url === url && visit.icon !== stored)) return + + return visits.map((visit) => (visit.url === url ? { ...visit, icon: stored } : { ...visit })) +} + +function storable(icon: string | undefined) { + return icon && icon.length <= MAX_STORED_ICON ? icon : undefined +} + +/** + * Visits whose address or title contains the query, case-insensitively. Addresses that begin with the query come + * first, as the address field completes them; within each group the newest visit leads. + */ +export function suggest(visits: readonly Visit[], query: string, limit: number) { + const needle = query.trim().toLowerCase() + + if (!needle) return [] + + const matches = visits.filter( + (visit) => bare(visit.url).toLowerCase().includes(needle) || visit.title.toLowerCase().includes(needle), + ) + + return [ + ...matches.filter((visit) => completes(visit, needle)), + ...matches.filter((visit) => !completes(visit, needle)), + ].slice(0, limit) +} + +/** Whether the visit's address begins with what the user typed, so Enter may open it in place of the typed text. */ +export function completes(visit: Visit, query: string) { + const needle = query.trim().toLowerCase() + + return !!needle && bare(visit.url).toLowerCase().startsWith(needle) +} + +/** Splits text around case-insensitive matches of the query, for drawing the matched parts. */ +export function highlight(text: string, query: string) { + const needle = query.trim().toLowerCase() + + if (!needle) return [{ text, match: false }] + const lower = text.toLowerCase() + + const starts = Array.from(lower.matchAll(new RegExp(escape(needle), "g")), (found) => found.index) + const bounds = starts.flatMap((start) => [start, start + needle.length]) + + return [0, ...bounds, text.length].flatMap((start, index, all) => { + const end = all[index + 1] + + return end === undefined || end === start ? [] : [{ text: text.slice(start, end), match: index % 2 === 1 }] + }) +} + +/** The address without its web scheme or a leading `www.`, as people type it. */ +export function bare(url: string) { + return url.replace(/^https?:\/\//i, "").replace(/^www\./i, "") +} + +function escape(text: string) { + return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") +} diff --git a/packages/gui-extensions/src/browser/i18n/am.ts b/packages/gui-extensions/src/browser/i18n/am.ts index 5eb414b8246..624fc93229e 100644 --- a/packages/gui-extensions/src/browser/i18n/am.ts +++ b/packages/gui-extensions/src/browser/i18n/am.ts @@ -3,13 +3,10 @@ export default { "command.reload": "የአሳሽ ገጽን እንደገና ጫን", "tab.title": "አሳሽ", "address.label": "የአሳሽ አድራሻ", - "address.placeholder": "URL ያስገቡ", "action.stop": "አቁም", replaced: "የአሳሽ መቆጣጠሪያ ወደ ሌላ የዴስክቶፕ መስኮት ተንቀሳቅሷል።", unsupported: "ይህ የዴስክቶፕ መተግበሪያ የአሳሽ ፓነሉን አይደግፍም።", suspended: "አሳሽ ታግዷል። እንደገና ለመገናኘት ከዚህ ክፍለ ጊዜ ጋር ይገናኙ።", - "empty.title": "URL ያስገቡ", - "empty.description": "ወይም «በመተግበሪያው አሳሽ ክፈት» ብለው ይጠይቁ", "failed.title": "URL ላይ መድረስ አልተቻለም", "failed.description": "URL-ውን እና ግንኙነትዎን ይፈትሹ፣ ከዚያ እንደገና ይሞክሩ።", "action.reload": "ዳግም ጫን", diff --git a/packages/gui-extensions/src/browser/i18n/ar.ts b/packages/gui-extensions/src/browser/i18n/ar.ts index 8e6ba4251de..109c62731c0 100644 --- a/packages/gui-extensions/src/browser/i18n/ar.ts +++ b/packages/gui-extensions/src/browser/i18n/ar.ts @@ -3,13 +3,10 @@ export default { "command.reload": "إعادة تحميل صفحة المتصفح", "tab.title": "المتصفح", "address.label": "عنوان المتصفح", - "address.placeholder": "أدخل URL", "action.stop": "إيقاف", replaced: "انتقل التحكم بالمتصفح إلى نافذة سطح مكتب أخرى.", unsupported: "لا يدعم تطبيق سطح المكتب هذا لوحة المتصفح.", suspended: "عُلّق المتصفح. تفاعل مع هذه الجلسة لإعادة الاتصال.", - "empty.title": "أدخل عنوان URL", - "empty.description": "أو اكتب الطلب «افتح في متصفح التطبيق»", "failed.title": "يتعذر الوصول إلى عنوان URL", "failed.description": "تحقق من عنوان URL واتصالك، ثم حاول مرة أخرى.", "action.reload": "إعادة التحميل", diff --git a/packages/gui-extensions/src/browser/i18n/az.ts b/packages/gui-extensions/src/browser/i18n/az.ts index 1e3fcaf8da5..ae7fa7dfaa0 100644 --- a/packages/gui-extensions/src/browser/i18n/az.ts +++ b/packages/gui-extensions/src/browser/i18n/az.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Brauzer səhifəsini yeniləyin", "tab.title": "Brauzer", "address.label": "Brauzer ünvanı", - "address.placeholder": "URL daxil edin", "action.stop": "Dayandır", replaced: "Brauzer idarəsi başqa masaüstü pəncərəsinə köçürüldü.", unsupported: "Bu masaüstü tətbiq brauzer panelini dəstəkləmir.", suspended: "Brauzer dayandırıldı. Təkrar qoşulmaq üçün bu sessiya ilə qarşılıqlı əlaqə qurun.", - "empty.title": "URL daxil edin", - "empty.description": "Və ya “Tətbiq brauzerində aç” sorğusunu göndərin", "failed.title": "URL əlçatan deyil", "failed.description": "URL-i və bağlantınızı yoxlayın, sonra yenidən cəhd edin.", "action.reload": "Yenidən yüklə", diff --git a/packages/gui-extensions/src/browser/i18n/bg.ts b/packages/gui-extensions/src/browser/i18n/bg.ts index c62a01141ba..810e918c0a5 100644 --- a/packages/gui-extensions/src/browser/i18n/bg.ts +++ b/packages/gui-extensions/src/browser/i18n/bg.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Презареждане на страницата в браузъра", "tab.title": "Браузър", "address.label": "Адрес на браузъра", - "address.placeholder": "Въведете URL адрес", "action.stop": "Спрете", replaced: "Управлението на браузъра е преместено в друг прозорец на настолното приложение.", unsupported: "Това настолно приложение не поддържа панела на браузъра.", suspended: "Браузърът е спрян временно. Взаимодействайте с тази сесия, за да се свържете отново.", - "empty.title": "Въведете URL адрес", - "empty.description": "Или подайте подкана „Отвори в браузъра на приложението“", "failed.title": "URL адресът не е достъпен", "failed.description": "Проверете URL адреса и връзката си, след което опитайте отново.", "action.reload": "Презареждане", diff --git a/packages/gui-extensions/src/browser/i18n/bn.ts b/packages/gui-extensions/src/browser/i18n/bn.ts index b5f04f5996e..2fc207b55c0 100644 --- a/packages/gui-extensions/src/browser/i18n/bn.ts +++ b/packages/gui-extensions/src/browser/i18n/bn.ts @@ -3,13 +3,10 @@ export default { "command.reload": "ব্রাউজার পৃষ্ঠা পুনরায় লোড করুন", "tab.title": "ব্রাউজার", "address.label": "ব্রাউজার ঠিকানা", - "address.placeholder": "URL লিখুন", "action.stop": "থামো", replaced: "ব্রাউজার নিয়ন্ত্রণ অন্য ডেস্কটপ উইন্ডোতে সরানো হয়েছে।", unsupported: "এই ডেস্কটপ অ্যাপ্লিকেশন ব্রাউজার ফলক সমর্থন করে না.", suspended: "ব্রাউজার সাসপেন্ড করা হয়েছে। পুনরায় সংযোগ করতে এই সেশনের সাথে ইন্টারঅ্যাক্ট করুন।", - "empty.title": "URL লিখুন", - "empty.description": "অথবা প্রম্পট করুন “অ্যাপ ব্রাউজারে খুলুন”", "failed.title": "URL-এ পৌঁছানো যাচ্ছে না", "failed.description": "URL এবং আপনার সংযোগ পরীক্ষা করে আবার চেষ্টা করুন।", "action.reload": "পুনরায় লোড করুন", diff --git a/packages/gui-extensions/src/browser/i18n/br.ts b/packages/gui-extensions/src/browser/i18n/br.ts index 16a4e73f6fd..8263fbc13a0 100644 --- a/packages/gui-extensions/src/browser/i18n/br.ts +++ b/packages/gui-extensions/src/browser/i18n/br.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Recarregar página do navegador", "tab.title": "Navegador", "address.label": "Endereço do navegador", - "address.placeholder": "Digite URL", "action.stop": "Parar", replaced: "O controle do navegador foi movido para outra janela da área de trabalho.", unsupported: "Este aplicativo para desktop não oferece suporte ao painel do navegador.", suspended: "Navegador suspenso. Interaja com esta sessão para se reconectar.", - "empty.title": "Insira a URL", - "empty.description": "Ou peça “Abrir no navegador do aplicativo”", "failed.title": "Não foi possível acessar a URL", "failed.description": "Verifique a URL e sua conexão e tente novamente.", "action.reload": "Recarregar", diff --git a/packages/gui-extensions/src/browser/i18n/bs.ts b/packages/gui-extensions/src/browser/i18n/bs.ts index 192e56427b8..0bf9cb135e1 100644 --- a/packages/gui-extensions/src/browser/i18n/bs.ts +++ b/packages/gui-extensions/src/browser/i18n/bs.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Ponovo učitaj stranicu preglednika", "tab.title": "Preglednik", "address.label": "Adresa preglednika", - "address.placeholder": "Unesite URL", "action.stop": "Zaustavi", replaced: "Upravljanje preglednikom premješteno je u drugi prozor Desktopa.", unsupported: "Ova aplikacija za računar ne podržava okno preglednika.", suspended: "Preglednik je obustavljen. Stupite u interakciju s ovom sesijom da biste se ponovo povezali.", - "empty.title": "Unesite URL", - "empty.description": "Ili zadajte upit „Otvori u pregledniku aplikacije“", "failed.title": "URL nije dostupan", "failed.description": "Provjerite URL i vezu, a zatim pokušajte ponovo.", "action.reload": "Ponovo učitaj", diff --git a/packages/gui-extensions/src/browser/i18n/ca.ts b/packages/gui-extensions/src/browser/i18n/ca.ts index a8a4ba67411..d284ad0c380 100644 --- a/packages/gui-extensions/src/browser/i18n/ca.ts +++ b/packages/gui-extensions/src/browser/i18n/ca.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Torna a carregar la pàgina del navegador", "tab.title": "Navegador", "address.label": "Adreça del navegador", - "address.placeholder": "Introduïu l'URL", "action.stop": "Atureu-vos", replaced: "El control del navegador s'ha mogut a una altra finestra d'escriptori.", unsupported: "Aquesta aplicació d'escriptori no admet el panell del navegador.", suspended: "Navegador suspès. Interacciona amb aquesta sessió per tornar a connectar.", - "empty.title": "Introduïu l’URL", - "empty.description": "O demaneu «Obre al navegador de l’aplicació»", "failed.title": "No es pot accedir a l’URL", "failed.description": "Comproveu l’URL i la connexió i torneu-ho a provar.", "action.reload": "Torna a carregar", diff --git a/packages/gui-extensions/src/browser/i18n/cs.ts b/packages/gui-extensions/src/browser/i18n/cs.ts index 94107a7ede4..67351247e9f 100644 --- a/packages/gui-extensions/src/browser/i18n/cs.ts +++ b/packages/gui-extensions/src/browser/i18n/cs.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Znovu načíst stránku prohlížeče", "tab.title": "Prohlížeč", "address.label": "Adresa prohlížeče", - "address.placeholder": "Zadejte URL", "action.stop": "Přestaň", replaced: "Ovládání prohlížeče bylo přesunuto do jiného okna aplikace Desktop.", unsupported: "Tato desktopová aplikace nepodporuje panel prohlížeče.", suspended: "Prohlížeč je pozastaven. Interakcí s touto relací se znovu připojíte.", - "empty.title": "Zadejte URL", - "empty.description": "Nebo zadejte pokyn „Otevřít v prohlížeči aplikace“", "failed.title": "URL není dostupná", "failed.description": "Zkontrolujte URL a připojení a zkuste to znovu.", "action.reload": "Načíst znovu", diff --git a/packages/gui-extensions/src/browser/i18n/da.ts b/packages/gui-extensions/src/browser/i18n/da.ts index b4936f5dc70..4e7b596edc6 100644 --- a/packages/gui-extensions/src/browser/i18n/da.ts +++ b/packages/gui-extensions/src/browser/i18n/da.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Genindlæs browsersiden", "tab.title": "Browser", "address.label": "Browser adresse", - "address.placeholder": "Indtast URL", "action.stop": "Stop", replaced: "Browserkontrol flyttet til et andet skrivebordsvindue.", unsupported: "Denne desktopapp understøtter ikke browserpanelet.", suspended: "Browser suspenderet. Interager med denne session for at genoprette forbindelsen.", - "empty.title": "Indtast URL", - "empty.description": "Eller bed om ”Åbn i appbrowseren”", "failed.title": "URL-adressen kan ikke nås", "failed.description": "Kontrollér URL-adressen og din forbindelse, og prøv igen.", "action.reload": "Genindlæs", diff --git a/packages/gui-extensions/src/browser/i18n/de.ts b/packages/gui-extensions/src/browser/i18n/de.ts index 242f95ca890..bc679da949a 100644 --- a/packages/gui-extensions/src/browser/i18n/de.ts +++ b/packages/gui-extensions/src/browser/i18n/de.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Browserseite neu laden", "tab.title": "Browser", "address.label": "Browseradresse", - "address.placeholder": "Geben Sie URL ein", "action.stop": "Stoppen", replaced: "Die Browsersteuerung wurde in ein anderes Desktop-Fenster verschoben.", unsupported: "Diese Desktop-App unterstützt den Browserbereich nicht.", suspended: "Browser angehalten. Interagieren Sie mit dieser Sitzung, um die Verbindung wiederherzustellen.", - "empty.title": "URL eingeben", - "empty.description": "Oder „Im App-Browser öffnen“ eingeben", "failed.title": "URL ist nicht erreichbar", "failed.description": "Überprüfen Sie die URL und Ihre Verbindung und versuchen Sie es erneut.", "action.reload": "Neu laden", diff --git a/packages/gui-extensions/src/browser/i18n/dv.ts b/packages/gui-extensions/src/browser/i18n/dv.ts index 002721a89b7..6744cbef769 100644 --- a/packages/gui-extensions/src/browser/i18n/dv.ts +++ b/packages/gui-extensions/src/browser/i18n/dv.ts @@ -3,13 +3,10 @@ export default { "command.reload": "ބްރައުޒާ ޕޭޖް އަލުން ލޯޑް ކުރާށެވެ", "tab.title": "ބްރައުޒާ އެވެ", "address.label": "ބްރައުޒާ އެޑްރެސް އެވެ", - "address.placeholder": "URL އަށް ވަދެވޭނެއެވެ.", "action.stop": "ހުއްޓުން", replaced: "ބްރައުޒާ ކޮންޓްރޯލް އެހެން ޑެސްކްޓޮޕް ވިންޑޯއަކަށް ބަދަލުވިއެވެ.", unsupported: "މި ޑެސްކްޓޮޕް އެޕް އިން ބްރައުޒާ ޕޭން އަށް ސަޕޯޓް ނުކުރެއެވެ.", suspended: "ބްރައުޒާ ސަސްޕެންޑް ކޮށްފިއެވެ. އަލުން ގުޅެން މި ސެޝަނާ މުއާމަލާތް ކުރުން.", - "empty.title": "URL ލިޔުއްވާ", - "empty.description": "ނުވަތަ ”އެޕް ބްރައުޒަރުގައި ހުޅުވާ“ އޭ ޕްރޮމްޕްޓް ކުރަން", "failed.title": "URL އަށް ނުފޯރާ", "failed.description": "URL އާއި ތިޔަ ކަނެކްޝަން ޗެކްކޮށް، އަލުން މަސައްކަތް ކުރައްވާ۔", "action.reload": "އަލުން ލޯޑްކުރުން", diff --git a/packages/gui-extensions/src/browser/i18n/dz.ts b/packages/gui-extensions/src/browser/i18n/dz.ts index 59e9d067407..cb1e92c8033 100644 --- a/packages/gui-extensions/src/browser/i18n/dz.ts +++ b/packages/gui-extensions/src/browser/i18n/dz.ts @@ -3,13 +3,10 @@ export default { "command.reload": "བརའུ་ཟར་ཤོག་ལེབ་ལོག་བཙུགས་", "tab.title": "བརའུ་ཟར་", "address.label": "བརྡ་འཚོལ་ཁ་བྱང་", - "address.placeholder": "ཡུ་ཨར་ཨེལ་བཙུགས།", "action.stop": "བཀག་པ", replaced: "བརའུ་ཟར་ཚད་འཛིན་འདི་ ཌེཀསི་ཊོཔ་སྒོ་སྒྲིག་གཞན་མི་ཅིག་ནང་ སྤོ་བཤུད་འབད་ཡི།", unsupported: "ཌེཀསི་ཊོཔ་གློག་རིམ་འདི་གིས་ བརའུ་ཟར་པེན་ལུ་རྒྱབ་སྐྱོར་མི་འབད།", suspended: "བརའུ་ཟར་བཀག་བཞག་ཡོདཔ། ལོག་སྟེ་མཐུད་ནིའི་དོན་ལུ་ ལཱ་ཡུན་འདི་དང་གཅིག་ཁར་ འབྲེལ་བ་འཐབ།", - "empty.title": "URL བཙུགས།", - "empty.description": "ཡང་ན་ “གློག་རིམ་བརའུ་ཟར་ནང་ཁ་ཕྱེ” ཟེར་བའི་ནུས་སྤེལ་བྱིན།", "failed.title": "URL ལུ་ལྷོད་མི་ཚུགས།", "failed.description": "URL དང་ཁྱོད་ཀྱི་མཐུད་ལམ་ཞིབ་དཔྱད་འབད་དེ་ལོག་སྟེ་འབད།", "action.reload": "ཡང་བསྐྱར་མངོན་གསལ།", diff --git a/packages/gui-extensions/src/browser/i18n/el.ts b/packages/gui-extensions/src/browser/i18n/el.ts index d8a8ff899e3..fc896e5db6e 100644 --- a/packages/gui-extensions/src/browser/i18n/el.ts +++ b/packages/gui-extensions/src/browser/i18n/el.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Επαναφόρτωση σελίδας προγράμματος περιήγησης", "tab.title": "Πρόγραμμα περιήγησης", "address.label": "Διεύθυνση προγράμματος περιήγησης", - "address.placeholder": "Εισαγάγετε τη διεύθυνση URL", "action.stop": "Διακοπή", replaced: "Ο έλεγχος του προγράμματος περιήγησης μετακινήθηκε σε άλλο παράθυρο επιφάνειας εργασίας.", unsupported: "Αυτή η εφαρμογή επιφάνειας εργασίας δεν υποστηρίζει το παράθυρο του προγράμματος περιήγησης.", suspended: "Το πρόγραμμα περιήγησης σε αναστολή. Αλληλεπιδράστε με αυτήν την περίοδο σύνδεσης για επανασύνδεση.", - "empty.title": "Εισαγάγετε URL", - "empty.description": "Ή ζητήστε «Άνοιγμα στο πρόγραμμα περιήγησης της εφαρμογής»", "failed.title": "Δεν είναι δυνατή η πρόσβαση στο URL", "failed.description": "Ελέγξτε το URL και τη σύνδεσή σας και δοκιμάστε ξανά.", "action.reload": "Επαναφόρτωση", diff --git a/packages/gui-extensions/src/browser/i18n/en.ts b/packages/gui-extensions/src/browser/i18n/en.ts index 0e65badc1f1..ac57016a16f 100644 --- a/packages/gui-extensions/src/browser/i18n/en.ts +++ b/packages/gui-extensions/src/browser/i18n/en.ts @@ -2,9 +2,12 @@ export default { "command.open": "Open browser", "command.reload": "Reload browser page", "command.inspect": "Select an element in the browser page", + "command.address": "Focus browser address", "tab.title": "Browser", + "tab.new": "New tab", "address.label": "Browser address", - "address.placeholder": "Enter URL", + "address.search": "Search or enter a URL", + "address.suggestions": "Suggestions", inspect: "Select an element to comment on", "inspect.active": "Click an element in the page to comment on it. Press Escape to cancel.", "inspect.pageShortcut": "While the page has focus", @@ -12,9 +15,38 @@ export default { replaced: "Browser control moved to another desktop window.", unsupported: "This desktop app does not support the browser pane.", suspended: "Browser suspended. Interact with this session to reconnect.", - "empty.title": "Enter URL", - "empty.description": 'Or prompt "Open in the app browser"', + "home.title": "Open a page", + "home.description": "Preview your app, read docs, or browse the web.", + "home.recent": "Recent", "failed.title": "URL can't be reached", "failed.description": "Check the URL and your connection, then try again.", "action.reload": "Reload", + "site.info": "Site information", + "site.secure": "Connection is secure", + "site.insecure": "Connection is not secure", + "site.insecure.description": "Don't enter passwords or other private information on this page.", + "site.local": "Local server", + "site.local.description": "Local addresses open on the machine that runs the OpenCode server.", + "site.file": "Workspace file", + "site.file.description": "Only files inside this session's workspace can open here.", + "site.network": "Pages load through the network of {{server}}.", + "site.cookies": "Cookies and site data", + "site.cookies.count.one": "{{count}} cookie in use", + "site.cookies.count.other": "{{count}} cookies in use", + "site.cookies.clear": "Clear", + "site.permissions": "Permissions are blocked", + "site.permissions.description": "Camera, microphone, location, and notifications don't work in this browser.", + "site.agent": "The agent can use this page", + "site.agent.description": "It can read the page, run scripts, and fill in forms.", + "page.add": "Add page to session", + "page.placeholder": "Add context about this page", + "external.open": "Open in system browser", + "external.unavailable": "This address only works on the server's machine.", + options: "Browser options", + "zoom.in": "Zoom in", + "zoom.out": "Zoom out", + "zoom.reset": "Reset zoom", + "zoom.percent": "{{percent}}%", + "link.copy": "Copy link", + "history.clear": "Clear browsing history", } diff --git a/packages/gui-extensions/src/browser/i18n/es.ts b/packages/gui-extensions/src/browser/i18n/es.ts index 56ec23f12f2..aaead9c5a4a 100644 --- a/packages/gui-extensions/src/browser/i18n/es.ts +++ b/packages/gui-extensions/src/browser/i18n/es.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Recargar la página del navegador", "tab.title": "Navegador", "address.label": "dirección del navegador", - "address.placeholder": "Introduzca URL", "action.stop": "Detener", replaced: "El control del navegador se movió a otra ventana del escritorio.", unsupported: "Esta aplicación de escritorio no admite el panel del navegador.", suspended: "Navegador suspendido. Interactúa con esta sesión para volver a conectarte.", - "empty.title": "Introduce la URL", - "empty.description": "O pide «Abrir en el navegador de la aplicación»", "failed.title": "No se puede acceder a la URL", "failed.description": "Comprueba la URL y la conexión e inténtalo de nuevo.", "action.reload": "Volver a cargar", diff --git a/packages/gui-extensions/src/browser/i18n/et.ts b/packages/gui-extensions/src/browser/i18n/et.ts index c5819a21ee5..a5713f9f818 100644 --- a/packages/gui-extensions/src/browser/i18n/et.ts +++ b/packages/gui-extensions/src/browser/i18n/et.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Laadi brauseri leht uuesti", "tab.title": "Brauser", "address.label": "Brauseri aadress", - "address.placeholder": "Sisesta URL", "action.stop": "Peatus", replaced: "Brauseri juhtimine teisaldati teise töölauaaknasse.", unsupported: "See töölauarakendus ei toeta brauseri paani.", suspended: "Brauser peatatud. Ühendage uuesti ühenduse loomiseks selle seansiga.", - "empty.title": "Sisesta URL", - "empty.description": "Või palu „Ava rakenduse brauseris”", "failed.title": "URL-ile ei pääse juurde", "failed.description": "Kontrolli URL-i ja ühendust ning proovi uuesti.", "action.reload": "Laadi uuesti", diff --git a/packages/gui-extensions/src/browser/i18n/fa.ts b/packages/gui-extensions/src/browser/i18n/fa.ts index bd31a299083..ddbee923de7 100644 --- a/packages/gui-extensions/src/browser/i18n/fa.ts +++ b/packages/gui-extensions/src/browser/i18n/fa.ts @@ -3,13 +3,10 @@ export default { "command.reload": "بارگیری دوبارهٔ صفحهٔ مرورگر", "tab.title": "مرورگر", "address.label": "نشانی مرورگر", - "address.placeholder": "نشانی وب را وارد کنید", "action.stop": "توقف کنید", replaced: "کنترل مرورگر به پنجرهٔ دسکتاپ دیگری منتقل شد.", unsupported: "این برنامهٔ دسکتاپ از پنل مرورگر پشتیبانی نمی‌کند.", suspended: "مرورگر تعلیق شد. برای اتصال دوباره با این نشست تعامل کنید.", - "empty.title": "نشانی URL را وارد کنید", - "empty.description": "یا درخواست «در مرورگر برنامه باز کن» را وارد کنید", "failed.title": "دسترسی به URL ممکن نیست", "failed.description": "URL و اتصال خود را بررسی کنید و دوباره تلاش کنید.", "action.reload": "بارگیری مجدد", diff --git a/packages/gui-extensions/src/browser/i18n/fi.ts b/packages/gui-extensions/src/browser/i18n/fi.ts index 0c425902b5c..a14f4548c97 100644 --- a/packages/gui-extensions/src/browser/i18n/fi.ts +++ b/packages/gui-extensions/src/browser/i18n/fi.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Lataa selainsivu uudelleen", "tab.title": "Selain", "address.label": "Selaimen osoite", - "address.placeholder": "Syötä URL", "action.stop": "Pysäytä", replaced: "Selaimen ohjaus siirrettiin toiseen työpöytäikkunaan.", unsupported: "Tämä työpöytäsovellus ei tue selainpaneelia.", suspended: "Selain jäädytetty. Ole vuorovaikutuksessa tämän istunnon kanssa yhdistääksesi uudelleen.", - "empty.title": "Anna URL-osoite", - "empty.description": "Tai kehota ”Avaa sovelluksen selaimessa”", "failed.title": "URL-osoitetta ei tavoiteta", "failed.description": "Tarkista URL-osoite ja yhteys ja yritä uudelleen.", "action.reload": "Lataa uudelleen", diff --git a/packages/gui-extensions/src/browser/i18n/fo.ts b/packages/gui-extensions/src/browser/i18n/fo.ts index 31c6457c3ca..938c1245b5a 100644 --- a/packages/gui-extensions/src/browser/i18n/fo.ts +++ b/packages/gui-extensions/src/browser/i18n/fo.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Endurlesa kagasíðuna", "tab.title": "Kaga", "address.label": "Kagaadressa", - "address.placeholder": "Skriva URL", "action.stop": "Steðga", replaced: "Kagastýring flutt til eitt annað skriviborðsvindeyga.", unsupported: "Hendan skriviborðsappin stuðlar ikki kagarútinum.", suspended: "Kagari steðgaður. Samskifta við hesa setuna fyri at fáa samband aftur.", - "empty.title": "Skriva URL", - "empty.description": "Ella bið um „Lat upp í kaganum í appini“", "failed.title": "URL-adressan kann ikki røkkast", "failed.description": "Kanna URL-adressuna og sambandið og royn aftur.", "action.reload": "Les inn aftur", diff --git a/packages/gui-extensions/src/browser/i18n/fr.ts b/packages/gui-extensions/src/browser/i18n/fr.ts index ba25373f5eb..7d6ba7d41f9 100644 --- a/packages/gui-extensions/src/browser/i18n/fr.ts +++ b/packages/gui-extensions/src/browser/i18n/fr.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Recharger la page du navigateur", "tab.title": "Navigateur", "address.label": "Adresse du navigateur", - "address.placeholder": "Entrez URL", "action.stop": "Arrêter", replaced: "Le contrôle du navigateur a été déplacé vers une autre fenêtre du bureau.", unsupported: "Cette application de bureau ne prend pas en charge le volet du navigateur.", suspended: "Navigateur suspendu. Interagissez avec cette session pour vous reconnecter.", - "empty.title": "Saisissez l’URL", - "empty.description": "Ou demandez « Ouvrir dans le navigateur de l’application »", "failed.title": "L’URL est inaccessible", "failed.description": "Vérifiez l’URL et votre connexion, puis réessayez.", "action.reload": "Recharger", diff --git a/packages/gui-extensions/src/browser/i18n/he.ts b/packages/gui-extensions/src/browser/i18n/he.ts index 5a154e9ca2f..f9d04307e13 100644 --- a/packages/gui-extensions/src/browser/i18n/he.ts +++ b/packages/gui-extensions/src/browser/i18n/he.ts @@ -3,13 +3,10 @@ export default { "command.reload": "טעינה מחדש של דף הדפדפן", "tab.title": "דפדפן", "address.label": "כתובת הדפדפן", - "address.placeholder": "הזנת URL", "action.stop": "עצור", replaced: "השליטה בדפדפן הועברה לחלון שולחן עבודה אחר.", unsupported: "יישום שולחן העבודה הזה אינו תומך בחלונית הדפדפן.", suspended: "הדפדפן הושהה. יש לקיים אינטראקציה עם הפעלה זו כדי להתחבר מחדש.", - "empty.title": "הזנת כתובת URL", - "empty.description": "או לבקש „פתיחה בדפדפן היישום”", "failed.title": "לא ניתן להגיע לכתובת ה-URL", "failed.description": "יש לבדוק את כתובת ה-URL ואת החיבור ולנסות שוב.", "action.reload": "טען מחדש", diff --git a/packages/gui-extensions/src/browser/i18n/hi.ts b/packages/gui-extensions/src/browser/i18n/hi.ts index e9a3b2ff8ca..f8b16ae3e70 100644 --- a/packages/gui-extensions/src/browser/i18n/hi.ts +++ b/packages/gui-extensions/src/browser/i18n/hi.ts @@ -3,13 +3,10 @@ export default { "command.reload": "ब्राउज़र पृष्ठ पुनः लोड करें", "tab.title": "ब्राउज़र", "address.label": "ब्राउज़र पता", - "address.placeholder": "URL दर्ज करें", "action.stop": "रोकें", replaced: "ब्राउज़र नियंत्रण किसी अन्य डेस्कटॉप विंडो पर ले जाया गया।", unsupported: "यह डेस्कटॉप ऐप ब्राउज़र फलक का समर्थन नहीं करता है.", suspended: "ब्राउज़र निलंबित. पुन: कनेक्ट करने के लिए इस सत्र से इंटरैक्ट करें.", - "empty.title": "URL दर्ज करें", - "empty.description": "या प्रॉम्प्ट दें “ऐप ब्राउज़र में खोलें”", "failed.title": "URL तक नहीं पहुँचा जा सका", "failed.description": "URL और अपना कनेक्शन जाँचें, फिर दोबारा कोशिश करें।", "action.reload": "पुनः लोड करें", diff --git a/packages/gui-extensions/src/browser/i18n/hr.ts b/packages/gui-extensions/src/browser/i18n/hr.ts index 064f3b21591..ad9ef70dfff 100644 --- a/packages/gui-extensions/src/browser/i18n/hr.ts +++ b/packages/gui-extensions/src/browser/i18n/hr.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Ponovno učitaj stranicu preglednika", "tab.title": "Preglednik", "address.label": "Adresa preglednika", - "address.placeholder": "Unesite URL", "action.stop": "Zaustavi", replaced: "Upravljanje preglednikom premješteno je u drugi prozor Desktopa.", unsupported: "Ova aplikacija za računalo ne podržava okno preglednika.", suspended: "Preglednik je obustavljen. Stupite u interakciju s ovom sesijom da biste se ponovno povezali.", - "empty.title": "Unesite URL", - "empty.description": "Ili zadajte upit „Otvori u pregledniku aplikacije“", "failed.title": "URL nije dostupan", "failed.description": "Provjerite URL i vezu, a zatim pokušajte ponovno.", "action.reload": "Ponovno učitaj", diff --git a/packages/gui-extensions/src/browser/i18n/hu.ts b/packages/gui-extensions/src/browser/i18n/hu.ts index 89340f60a84..fd63265d40c 100644 --- a/packages/gui-extensions/src/browser/i18n/hu.ts +++ b/packages/gui-extensions/src/browser/i18n/hu.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Böngészőoldal újratöltése", "tab.title": "Böngésző", "address.label": "Böngésző címe", - "address.placeholder": "Írja be az URL-t", "action.stop": "Leállítás", replaced: "A böngésző vezérlése átkerült egy másik asztali ablakba.", unsupported: "Ez az asztali alkalmazás nem támogatja a böngésző ablaktáblát.", suspended: "A böngésző felfüggesztve. Lépjen kapcsolatba ezzel a munkamenettel az újracsatlakozáshoz.", - "empty.title": "Adja meg az URL-címet", - "empty.description": "Vagy kérje ezt: „Megnyitás az alkalmazás böngészőjében”", "failed.title": "Az URL-cím nem érhető el", "failed.description": "Ellenőrizze az URL-címet és a kapcsolatot, majd próbálja újra.", "action.reload": "Újratöltés", diff --git a/packages/gui-extensions/src/browser/i18n/hy.ts b/packages/gui-extensions/src/browser/i18n/hy.ts index bc13aa6141d..d1549e91e30 100644 --- a/packages/gui-extensions/src/browser/i18n/hy.ts +++ b/packages/gui-extensions/src/browser/i18n/hy.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Թարմացրեք զննարկչի էջը", "tab.title": "Դիտարկիչ", "address.label": "Դիտարկչի հասցե", - "address.placeholder": "Ներմուծեք URL", "action.stop": "Կանգնեցնել", replaced: "Դիտարկիչների կառավարումը տեղափոխվել է այլ աշխատասեղանի պատուհան։", unsupported: "Այս աշխատասեղանի հավելվածը չի աջակցում դիտարկիչի վահանակը։", suspended: "Բրաուզերը ժամանակավորապես կանգնեցվել է։ Հետադարձ կապ հաստատեք այս նստաշրջանի հետ՝ նորից միանալու համար։", - "empty.title": "Մուտքագրեք URL", - "empty.description": "Կամ գրեք «Բացել հավելվածի դիտարկիչում»", "failed.title": "URL-ը հասանելի չէ", "failed.description": "Ստուգեք URL-ը և կապը, ապա կրկին փորձեք։", "action.reload": "Վերբեռնել կրկին", diff --git a/packages/gui-extensions/src/browser/i18n/id.ts b/packages/gui-extensions/src/browser/i18n/id.ts index f757ec99cea..f2c61f3c498 100644 --- a/packages/gui-extensions/src/browser/i18n/id.ts +++ b/packages/gui-extensions/src/browser/i18n/id.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Muat ulang halaman peramban", "tab.title": "Peramban", "address.label": "Alamat peramban", - "address.placeholder": "Masukkan URL", "action.stop": "Hentikan", replaced: "Kontrol peramban dipindahkan ke jendela desktop lain.", unsupported: "Aplikasi desktop ini tidak mendukung panel peramban.", suspended: "Peramban dijeda. Berinteraksilah dengan sesi ini untuk terhubung kembali.", - "empty.title": "Masukkan URL", - "empty.description": 'Atau masukkan prompt "Buka di peramban aplikasi"', "failed.title": "URL tidak dapat dijangkau", "failed.description": "Periksa URL dan koneksi Anda, lalu coba lagi.", "action.reload": "Muat ulang", diff --git a/packages/gui-extensions/src/browser/i18n/is.ts b/packages/gui-extensions/src/browser/i18n/is.ts index d9f23e1988a..7d411a08999 100644 --- a/packages/gui-extensions/src/browser/i18n/is.ts +++ b/packages/gui-extensions/src/browser/i18n/is.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Endurhlaða vafrasíðu", "tab.title": "Vafri", "address.label": "Heimilisfang vafra", - "address.placeholder": "Sláðu inn vefslóð", "action.stop": "Stöðva", replaced: "Vafrastýring færð í annan skjáborðsglugga.", unsupported: "Þetta skrifborðsforrit styður ekki vafrarúðuna.", suspended: "Vafra lokað. Vertu í samskiptum við þessa lotu til að tengjast aftur.", - "empty.title": "Sláðu inn vefslóð", - "empty.description": "Eða biddu um „Opna í vafra forritsins“", "failed.title": "Ekki næst í vefslóðina", "failed.description": "Athugaðu vefslóðina og tenginguna og reyndu aftur.", "action.reload": "Endurhlaða", diff --git a/packages/gui-extensions/src/browser/i18n/it.ts b/packages/gui-extensions/src/browser/i18n/it.ts index 1e8220083cd..8efc26dd089 100644 --- a/packages/gui-extensions/src/browser/i18n/it.ts +++ b/packages/gui-extensions/src/browser/i18n/it.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Ricarica la pagina del browser", "tab.title": "Navigatore", "address.label": "Indirizzo del browser", - "address.placeholder": "Inserisci URL", "action.stop": "Interrompi", replaced: "Il controllo del browser è stato spostato su un'altra finestra del desktop.", unsupported: "Questa app desktop non supporta il pannello del browser.", suspended: "Browser sospeso. Interagisci con questa sessione per riconnetterti.", - "empty.title": "Inserisci URL", - "empty.description": "Oppure chiedi “Apri nel browser dell’app”", "failed.title": "Impossibile raggiungere l’URL", "failed.description": "Controlla l’URL e la connessione, quindi riprova.", "action.reload": "Ricarica", diff --git a/packages/gui-extensions/src/browser/i18n/ja.ts b/packages/gui-extensions/src/browser/i18n/ja.ts index 77af37d93d9..b7ca826f32a 100644 --- a/packages/gui-extensions/src/browser/i18n/ja.ts +++ b/packages/gui-extensions/src/browser/i18n/ja.ts @@ -3,13 +3,10 @@ export default { "command.reload": "ブラウザーページを再読み込み", "tab.title": "ブラウザー", "address.label": "ブラウザーのアドレス", - "address.placeholder": "URLを入力", "action.stop": "停止", replaced: "ブラウザー制御が別のデスクトップウィンドウに移動しました。", unsupported: "このデスクトップアプリはブラウザペインをサポートしていません。", suspended: "ブラウザーが一時停止しました。このセッションと対話して再接続してください。", - "empty.title": "URLを入力", - "empty.description": "または「アプリ内ブラウザで開く」とプロンプトに入力", "failed.title": "URLにアクセスできません", "failed.description": "URLと接続を確認して、もう一度お試しください。", "action.reload": "再読み込み", diff --git a/packages/gui-extensions/src/browser/i18n/ka.ts b/packages/gui-extensions/src/browser/i18n/ka.ts index 2c5dfb82f73..a3ccb56ca55 100644 --- a/packages/gui-extensions/src/browser/i18n/ka.ts +++ b/packages/gui-extensions/src/browser/i18n/ka.ts @@ -3,13 +3,10 @@ export default { "command.reload": "ბრაუზერის გვერდის გადატვირთვა", "tab.title": "ბრაუზერი", "address.label": "ბრაუზერის მისამართი", - "address.placeholder": "შეიყვანეთ URL", "action.stop": "შეჩერება", replaced: "ბრაუზერის კონტროლი გადანაცვლდა სხვა დესკტოპის ფანჯარაში.", unsupported: "დესკტოპის ეს აპი ბრაუზერის პანელს არ უჭერს მხარს.", suspended: "ბრაუზერი შეჩერებულია. გამართეთ ინტერაქცია ამ სესიასთან, რათა კვლავ დაუკავშირდეთ.", - "empty.title": "შეიყვანეთ URL", - "empty.description": "ან შეიყვანეთ მოთხოვნა „გახსენი აპის ბრაუზერში“", "failed.title": "URL მიუწვდომელია", "failed.description": "შეამოწმეთ URL და კავშირი, შემდეგ ხელახლა სცადეთ.", "action.reload": "ხელახლა ჩატვირთვა", diff --git a/packages/gui-extensions/src/browser/i18n/km.ts b/packages/gui-extensions/src/browser/i18n/km.ts index 8adc24c20b1..203438122c9 100644 --- a/packages/gui-extensions/src/browser/i18n/km.ts +++ b/packages/gui-extensions/src/browser/i18n/km.ts @@ -3,13 +3,10 @@ export default { "command.reload": "ផ្ទុកទំព័រកម្មវិធីរុករកឡើងវិញ", "tab.title": "កម្មវិធីរុករក", "address.label": "អាសយដ្ឋានកម្មវិធីរុករក", - "address.placeholder": "បញ្ចូល URL", "action.stop": "ឈប់", replaced: "ការត្រួតពិនិត្យរុករកបានផ្លាស់ទៅវីនដូតែមួយផ្សេងទៀតលើឌេស្គ្ទុប។", unsupported: "កម្មវិធីដេស្គ្ទុបនេះមិនគាំទ្របានផ្ទាំងរុករកទេ។", suspended: "កម្មវិធីរុករកបានផ្អាក។ សូមអន្តរកម្មជាមួយសម័យនេះដើម្បីភ្ជាប់ឡើងវិញ។", - "empty.title": "បញ្ចូល URL", - "empty.description": 'ឬបញ្ចូល prompt "បើកក្នុងកម្មវិធីរុករករបស់កម្មវិធី"', "failed.title": "មិនអាចចូលដល់ URL បានទេ", "failed.description": "ពិនិត្យ URL និងការតភ្ជាប់របស់អ្នក រួចសាកល្បងម្តងទៀត។", "action.reload": "ផ្ទុកឡើងវិញ", diff --git a/packages/gui-extensions/src/browser/i18n/ko.ts b/packages/gui-extensions/src/browser/i18n/ko.ts index 49e098dd6b0..53f601509b0 100644 --- a/packages/gui-extensions/src/browser/i18n/ko.ts +++ b/packages/gui-extensions/src/browser/i18n/ko.ts @@ -3,13 +3,10 @@ export default { "command.reload": "브라우저 페이지 새로 고침", "tab.title": "브라우저", "address.label": "브라우저 주소", - "address.placeholder": "URL 입력", "action.stop": "중지", replaced: "브라우저 제어가 다른 데스크톱 창으로 이동되었습니다.", unsupported: "이 데스크톱 앱은 브라우저 창을 지원하지 않습니다.", suspended: "브라우저가 일시 중지되었습니다. 다시 연결하려면 이 세션과 상호작용하세요.", - "empty.title": "URL 입력", - "empty.description": '또는 "앱 브라우저에서 열어 줘"라고 프롬프트 입력', "failed.title": "URL에 연결할 수 없음", "failed.description": "URL과 연결을 확인한 후 다시 시도하세요.", "action.reload": "다시 로드", diff --git a/packages/gui-extensions/src/browser/i18n/lo.ts b/packages/gui-extensions/src/browser/i18n/lo.ts index b8aa6603f62..c366df1595a 100644 --- a/packages/gui-extensions/src/browser/i18n/lo.ts +++ b/packages/gui-extensions/src/browser/i18n/lo.ts @@ -3,13 +3,10 @@ export default { "command.reload": "ໂຫຼດຫນ້າບຣາວເຊີ", "tab.title": "ເບຣາວເຊີ", "address.label": "ທີ່ຢູ່ເບຣາວເຊີ", - "address.placeholder": "ໃສ່ URL", "action.stop": "ຢຸດ", replaced: "ການຄວບຄຸມເບຣາວເຊີໄດ້ຍ້າຍໄປຢູ່ຫນ້າຕ່າງເດສທັອບອື່ນ.", unsupported: "ແອັບເດສທັອບນີ້ບໍ່ຮອງຮັບແຖບບຣາວເຊີ.", suspended: "ເບຣາວເຊີຖືກລະງັບ.ປະຕິບັດກັບ session ນີ້ເພື່ອເຊື່ອມຕໍ່ອີກຄັ້ງ.", - "empty.title": "ໃສ່ URL", - "empty.description": 'ຫຼືປ້ອນ prompt "ເປີດໃນບຣາວເຊີຂອງແອັບ"', "failed.title": "ເຂົ້າເຖິງ URL ບໍ່ໄດ້", "failed.description": "ກວດສອບ URL ແລະການເຊື່ອມຕໍ່ ແລ້ວລອງໃໝ່.", "action.reload": "ໂຫຼດຄືນໃໝ່", diff --git a/packages/gui-extensions/src/browser/i18n/lt.ts b/packages/gui-extensions/src/browser/i18n/lt.ts index 8a42584b7a9..ff0beb49745 100644 --- a/packages/gui-extensions/src/browser/i18n/lt.ts +++ b/packages/gui-extensions/src/browser/i18n/lt.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Iš naujo įkelti naršyklės puslapį", "tab.title": "Naršyklė", "address.label": "Naršyklės adresas", - "address.placeholder": "Įveskite URL", "action.stop": "Stabdyti", replaced: "Naršyklės valdymas perkeltas į kitą darbalaukio langą.", unsupported: "Ši darbalaukio programa nepalaiko naršyklės srities.", suspended: "Naršyklė sustabdyta. Norėdami vėl prisijungti, sąveikaukite su šia sesija.", - "empty.title": "Įveskite URL", - "empty.description": "Arba paprašykite „Atverti programos naršyklėje“", "failed.title": "URL nepasiekiamas", "failed.description": "Patikrinkite URL bei ryšį ir bandykite dar kartą.", "action.reload": "Įkelti iš naujo", diff --git a/packages/gui-extensions/src/browser/i18n/lv.ts b/packages/gui-extensions/src/browser/i18n/lv.ts index f9be391d7d0..c0666e31ff3 100644 --- a/packages/gui-extensions/src/browser/i18n/lv.ts +++ b/packages/gui-extensions/src/browser/i18n/lv.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Pārlādēt pārlūkprogrammas lapu", "tab.title": "Pārlūkprogramma", "address.label": "Pārlūkprogrammas adrese", - "address.placeholder": "Ievadiet URL", "action.stop": "Apturēt", replaced: "Pārlūka vadība ir pārvietota uz citu darbvirsmas logu.", unsupported: "Šī darbvirsmas lietotne neatbalsta pārlūkprogrammas rūti.", suspended: "Pārlūka darbība ir apturēta. Mijiedarbojieties ar šo sesiju, lai atjaunotu savienojumu.", - "empty.title": "Ievadiet URL", - "empty.description": "Vai arī lūdziet “Atvērt lietotnes pārlūkā”", "failed.title": "URL nav sasniedzams", "failed.description": "Pārbaudiet URL un savienojumu un mēģiniet vēlreiz.", "action.reload": "Ielādēt atkārtoti", diff --git a/packages/gui-extensions/src/browser/i18n/mk.ts b/packages/gui-extensions/src/browser/i18n/mk.ts index 443b15034ab..88a9c840114 100644 --- a/packages/gui-extensions/src/browser/i18n/mk.ts +++ b/packages/gui-extensions/src/browser/i18n/mk.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Освежи страна на прелистувач", "tab.title": "Прелистувач", "address.label": "Адреса на прелистувач", - "address.placeholder": "Внесете URL", "action.stop": "Стоп", replaced: "Контролата на прелистувачот е преместена во друг прозорец на десктопот.", unsupported: "Оваа десктоп апликација не поддржува панел за прелистувач.", suspended: "Прелистувачот е суспендиран. Интеракцијата со оваа сесија ќе овозможи повторно поврзување.", - "empty.title": "Внесете URL", - "empty.description": "Или внесете барање „Отвори во прелистувачот на апликацијата“", "failed.title": "URL-адресата не е достапна", "failed.description": "Проверете ги URL-адресата и врската, па обидете се повторно.", "action.reload": "Превчитај", diff --git a/packages/gui-extensions/src/browser/i18n/mn.ts b/packages/gui-extensions/src/browser/i18n/mn.ts index 09f8fa5b93e..29b7fd4bdf6 100644 --- a/packages/gui-extensions/src/browser/i18n/mn.ts +++ b/packages/gui-extensions/src/browser/i18n/mn.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Браузерын хуудасыг дахин ачаалах", "tab.title": "Хөтөч", "address.label": "Хөтчийн хаяг", - "address.placeholder": "URL оруулах", "action.stop": "Зогс", replaced: "Хөтчийн хяналт өөр ширээний цонхны руу шилжсэн.", unsupported: "Энэ десктоп апп хөтчийн самбарыг дэмждэггүй.", suspended: "Браузер түр зогсоогдлоо. Дахин холбогдохын тулд энэ сесситэй харьцана уу.", - "empty.title": "URL оруулна уу", - "empty.description": "Эсвэл “Аппын хөтөч дээр нээ” гэж хүсэлт өгнө үү", "failed.title": "URL-д хандах боломжгүй", "failed.description": "URL болон холболтоо шалгаад дахин оролдоно уу.", "action.reload": "Дахин ачаалах", diff --git a/packages/gui-extensions/src/browser/i18n/ms.ts b/packages/gui-extensions/src/browser/i18n/ms.ts index 4ef71f85dde..3f92efc8338 100644 --- a/packages/gui-extensions/src/browser/i18n/ms.ts +++ b/packages/gui-extensions/src/browser/i18n/ms.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Muat semula halaman penyemak imbas", "tab.title": "Pelayar", "address.label": "Alamat pelayar", - "address.placeholder": "Masukkan URL", "action.stop": "Henti", replaced: "Kawalan pelayar dipindahkan ke tetingkap desktop lain.", unsupported: "Aplikasi desktop ini tidak menyokong panel pelayar.", suspended: "Pelayar digantung. Berinteraksi dengan sesi ini untuk menyambung semula.", - "empty.title": "Masukkan URL", - "empty.description": 'Atau masukkan prompt "Buka dalam pelayar aplikasi"', "failed.title": "URL tidak dapat dicapai", "failed.description": "Semak URL dan sambungan anda, kemudian cuba lagi.", "action.reload": "Muat semula", diff --git a/packages/gui-extensions/src/browser/i18n/my.ts b/packages/gui-extensions/src/browser/i18n/my.ts index c19dee01adc..12712e534c2 100644 --- a/packages/gui-extensions/src/browser/i18n/my.ts +++ b/packages/gui-extensions/src/browser/i18n/my.ts @@ -3,13 +3,10 @@ export default { "command.reload": "ဘရောက်ဇာစာမျက်နှာကို ပြန်လည်တင်ပါ", "tab.title": "ဘရောက်ဇာ", "address.label": "ဘရောက်ဇာလိပ်စာ", - "address.placeholder": "URL ထည့်ပါ", "action.stop": "ရပ်ပါ။", replaced: "ဘရောက်ဇာ ထိန်းချုပ်မှုကို အခြားဒက်စ်ကတော့ပြင်ပ ပြတင်းပေါက်သို့ ရွှေ့လိုက်သည်။", unsupported: "ဒီ desktop အက်ပ်သည် ဘရောက်ဇာပန်းကို မထောက်ပံ့ပါ။", suspended: "ဘရောက်ဇာ ရပ်ဆိုင်းထားပါသည်။ ထပ်မံချိတ်ဆက်ရန် ဒီအစည်းအဝေးနှင့် အပြန်အလှန် အပြုအမူ ပြုလုပ်ပါ။", - "empty.title": "URL ထည့်ပါ", - "empty.description": 'သို့မဟုတ် "အက်ပ်ဘရောက်ဇာတွင် ဖွင့်ပါ" ဟု prompt ရိုက်ထည့်ပါ', "failed.title": "URL ကို ချိတ်ဆက်၍မရပါ", "failed.description": "URL နှင့် ချိတ်ဆက်မှုကို စစ်ဆေးပြီး ထပ်မံကြိုးစားပါ။", "action.reload": "ပြန်လည်ဖွင့်ပါ", diff --git a/packages/gui-extensions/src/browser/i18n/ne.ts b/packages/gui-extensions/src/browser/i18n/ne.ts index 00a742d2845..5c65c839713 100644 --- a/packages/gui-extensions/src/browser/i18n/ne.ts +++ b/packages/gui-extensions/src/browser/i18n/ne.ts @@ -3,13 +3,10 @@ export default { "command.reload": "ब्राउजर पृष्ठ पुन: लोड गर्नुहोस्", "tab.title": "ब्राउजर", "address.label": "ब्राउजर ठेगाना", - "address.placeholder": "प्रविष्ट गर्नुहोस् URL", "action.stop": "रोक्नुहोस्", replaced: "ब्राउजर नियन्त्रण अर्को डेस्कटप विन्डोमा सारियो।", unsupported: "यो डेस्कटप एपले ब्राउजर फलकलाई समर्थन गर्दैन।", suspended: "ब्राउजर निलम्बित। पुन: जडान गर्न यो सत्रसँग अन्तर्क्रिया गर्नुहोस्।", - "empty.title": "URL प्रविष्ट गर्नुहोस्", - "empty.description": "वा “एप ब्राउजरमा खोल्नुहोस्” भनेर प्रम्प्ट गर्नुहोस्", "failed.title": "URL मा पुग्न सकिएन", "failed.description": "URL र आफ्नो जडान जाँचेर फेरि प्रयास गर्नुहोस्।", "action.reload": "पुनः लोड गर्नुहोस्", diff --git a/packages/gui-extensions/src/browser/i18n/nl.ts b/packages/gui-extensions/src/browser/i18n/nl.ts index 1206fac4ed4..533c7eeda95 100644 --- a/packages/gui-extensions/src/browser/i18n/nl.ts +++ b/packages/gui-extensions/src/browser/i18n/nl.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Browserpagina opnieuw laden", "tab.title": "Browser", "address.label": "Browseradres", - "address.placeholder": "Voer URL in", "action.stop": "Stop", replaced: "Browserbediening verplaatst naar een ander bureaubladvenster.", unsupported: "Deze desktopapp ondersteunt het browserpaneel niet.", suspended: "Browser opgeschort. Interactie met deze sessie om opnieuw verbinding te maken.", - "empty.title": "Voer URL in", - "empty.description": "Of vraag ‘Openen in de appbrowser’", "failed.title": "URL is niet bereikbaar", "failed.description": "Controleer de URL en je verbinding en probeer het opnieuw.", "action.reload": "Opnieuw laden", diff --git a/packages/gui-extensions/src/browser/i18n/no.ts b/packages/gui-extensions/src/browser/i18n/no.ts index 3ff30575393..bb165f22243 100644 --- a/packages/gui-extensions/src/browser/i18n/no.ts +++ b/packages/gui-extensions/src/browser/i18n/no.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Last nettlesersiden på nytt", "tab.title": "Nettleser", "address.label": "Nettleseradresse", - "address.placeholder": "Skriv inn URL", "action.stop": "Stopp", replaced: "Nettleserkontrollen flyttet til et annet skrivebordsvindu.", unsupported: "Denne skrivebordsappen støtter ikke nettleserpanelet.", suspended: "Nettleseren er suspendert. Samhandle med denne økten for å koble til på nytt.", - "empty.title": "Skriv inn URL", - "empty.description": "Eller be om «Åpne i appnettleseren»", "failed.title": "URL-en kan ikke nås", "failed.description": "Kontroller URL-en og tilkoblingen, og prøv på nytt.", "action.reload": "Last inn på nytt", diff --git a/packages/gui-extensions/src/browser/i18n/pa.ts b/packages/gui-extensions/src/browser/i18n/pa.ts index b792b954646..df979b626b4 100644 --- a/packages/gui-extensions/src/browser/i18n/pa.ts +++ b/packages/gui-extensions/src/browser/i18n/pa.ts @@ -3,13 +3,10 @@ export default { "command.reload": "براؤزر دا صفحہ دوبارہ لوڈ کرو۔", "tab.title": "براؤزر", "address.label": "براؤزر دا پتہ", - "address.placeholder": "درج کرو URL", "action.stop": "روکو", replaced: "براؤزر کنٹرول کو دوسری ڈیسک ٹاپ ونڈو میں منتقل کر دیا گیا۔", unsupported: "یہ ڈیسک ٹاپ ایپ براؤزر پین کو سپورٹ نئیں کرتی اے۔", suspended: "براؤزر معطل۔ دوبارہ منسلک ہونے لئی اس سیشن دے ساتھ تعامل کرو۔", - "empty.title": "URL درج کرو", - "empty.description": "یا پرامپٹ دیو ”ایپ براؤزر وچ کھولو“", "failed.title": "URL تک نہیں پہنچیا جا سکیا", "failed.description": "URL تے اپنا کنکشن چیک کرو، فیر کوشش کرو۔", "action.reload": "دوبارہ لوڈ کرو", diff --git a/packages/gui-extensions/src/browser/i18n/pl.ts b/packages/gui-extensions/src/browser/i18n/pl.ts index ae1f2a74b8a..eaa5faea406 100644 --- a/packages/gui-extensions/src/browser/i18n/pl.ts +++ b/packages/gui-extensions/src/browser/i18n/pl.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Przeładuj stronę przeglądarki", "tab.title": "Przeglądarka", "address.label": "Adres przeglądarki", - "address.placeholder": "Wprowadź URL", "action.stop": "Zatrzymaj", replaced: "Kontrola przeglądarki została przeniesiona do innego okna pulpitu.", unsupported: "Ta aplikacja na pulpit nie obsługuje panelu przeglądarki.", suspended: "Przeglądarka zawieszona. Wejdź w interakcję z tą sesją, aby ponownie połączyć.", - "empty.title": "Wprowadź adres URL", - "empty.description": "Lub wpisz polecenie „Otwórz w przeglądarce aplikacji”", "failed.title": "Nie można otworzyć adresu URL", "failed.description": "Sprawdź adres URL i połączenie, a następnie spróbuj ponownie.", "action.reload": "Wczytaj ponownie", diff --git a/packages/gui-extensions/src/browser/i18n/ro.ts b/packages/gui-extensions/src/browser/i18n/ro.ts index 83ce800f116..c37b25cc6e9 100644 --- a/packages/gui-extensions/src/browser/i18n/ro.ts +++ b/packages/gui-extensions/src/browser/i18n/ro.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Reîncărcați pagina browser", "tab.title": "Browser", "address.label": "Adresa browserului", - "address.placeholder": "Introduceți adresa URL", "action.stop": "Oprește", replaced: "Controlul browserului a fost mutat într-o altă fereastră de desktop.", unsupported: "Această aplicație desktop nu acceptă panoul browserului.", suspended: "Browser suspendat. Interacționați cu această sesiune pentru a vă reconecta.", - "empty.title": "Introdu adresa URL", - "empty.description": "Sau solicită „Deschide în browserul aplicației”", "failed.title": "Adresa URL nu poate fi accesată", "failed.description": "Verifică adresa URL și conexiunea, apoi încearcă din nou.", "action.reload": "Reîncarcă", diff --git a/packages/gui-extensions/src/browser/i18n/ru.ts b/packages/gui-extensions/src/browser/i18n/ru.ts index 9bdd87ceeb9..95fc167602d 100644 --- a/packages/gui-extensions/src/browser/i18n/ru.ts +++ b/packages/gui-extensions/src/browser/i18n/ru.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Перезагрузить страницу браузера", "tab.title": "Браузер", "address.label": "Адрес браузера", - "address.placeholder": "Введите URL", "action.stop": "Остановить", replaced: "Управление браузером перемещено в другое окно рабочего стола.", unsupported: "Это настольное приложение не поддерживает панель браузера.", suspended: "Браузер приостановлен. Взаимодействуйте с этой сессией, чтобы переподключиться.", - "empty.title": "Введите URL", - "empty.description": "Или отправьте запрос «Открыть во встроенном браузере»", "failed.title": "Не удаётся открыть URL", "failed.description": "Проверьте URL и подключение, затем повторите попытку.", "action.reload": "Перезагрузить", diff --git a/packages/gui-extensions/src/browser/i18n/si.ts b/packages/gui-extensions/src/browser/i18n/si.ts index 4508d286793..853bff1dc67 100644 --- a/packages/gui-extensions/src/browser/i18n/si.ts +++ b/packages/gui-extensions/src/browser/i18n/si.ts @@ -3,13 +3,10 @@ export default { "command.reload": "බ්‍රවුසර පිටුව නැවත පූරණය කරන්න", "tab.title": "බ්රවුසරය", "address.label": "බ්රවුසර ලිපිනය", - "address.placeholder": "URL ඇතුළු කරන්න", "action.stop": "නවත්වන්න", replaced: "බ්‍රවුසර පාලනය වෙනත් ඩෙස්ක්ටොප් කවුළුවකට ගෙන ගියේය.", unsupported: "මෙම ඩෙස්ක්ටොප් යෙදුම බ්‍රවුසර කවුළුව සඳහා සහය නොදක්වයි.", suspended: "බ්‍රව්සරය අත්හිටුවා ඇත. නැවත සම්බන්ධ වීමට මෙම සැසිය සමඟ අන්තර් ක්‍රියා කරන්න.", - "empty.title": "URL එකක් ඇතුළත් කරන්න", - "empty.description": "නැතහොත් “යෙදුම් බ්‍රවුසරයේ විවෘත කරන්න” යනුවෙන් ප්‍රේරකයක් දෙන්න", "failed.title": "URL වෙත ළඟා විය නොහැක", "failed.description": "URL එක සහ ඔබේ සම්බන්ධතාව පරීක්ෂා කර නැවත උත්සාහ කරන්න.", "action.reload": "නැවත පූරණය කරන්න", diff --git a/packages/gui-extensions/src/browser/i18n/sk.ts b/packages/gui-extensions/src/browser/i18n/sk.ts index 4b5992a6adb..b51677a72e6 100644 --- a/packages/gui-extensions/src/browser/i18n/sk.ts +++ b/packages/gui-extensions/src/browser/i18n/sk.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Obnoviť stránku webového prehliadača", "tab.title": "Webový prehliadač", "address.label": "Adresa prehliadača", - "address.placeholder": "Zadajte URL", "action.stop": "Zastaviť", replaced: "Ovládanie prehliadača presunuté do iného okna desktopu.", unsupported: "Táto desktopová aplikácia nepodporuje panel prehliadača.", suspended: "Prehliadač bol pozastavený. Interagujte s reláciou pre obnovenie pripojenia.", - "empty.title": "Zadajte URL", - "empty.description": "Alebo zadajte pokyn „Otvoriť v prehliadači aplikácie“", "failed.title": "URL nie je dostupná", "failed.description": "Skontrolujte URL a pripojenie a skúste to znova.", "action.reload": "Znova načítať", diff --git a/packages/gui-extensions/src/browser/i18n/sl.ts b/packages/gui-extensions/src/browser/i18n/sl.ts index 8354516db9c..71600a32705 100644 --- a/packages/gui-extensions/src/browser/i18n/sl.ts +++ b/packages/gui-extensions/src/browser/i18n/sl.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Osveži stran brskalnika", "tab.title": "Spletni brskalnik", "address.label": "Naslov v brskalniku", - "address.placeholder": "Vnesite URL", "action.stop": "Ustavi", replaced: "Nadzor brskalnika je premaknjen v drugo namizno okno.", unsupported: "Ta namizna aplikacija ne podpira podokna brskalnika.", suspended: "Brskalnik je začasno ustavljen. Interakcija s sejo za ponovno povezavo.", - "empty.title": "Vnesite URL", - "empty.description": "Ali vnesite poziv »Odpri v brskalniku aplikacije«", "failed.title": "URL ni dosegljiv", "failed.description": "Preverite URL in povezavo ter poskusite znova.", "action.reload": "Znova naloži", diff --git a/packages/gui-extensions/src/browser/i18n/sq.ts b/packages/gui-extensions/src/browser/i18n/sq.ts index 4eedb365101..61403dcb183 100644 --- a/packages/gui-extensions/src/browser/i18n/sq.ts +++ b/packages/gui-extensions/src/browser/i18n/sq.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Rifresko faqen e shfletuesit", "tab.title": "Shfletuesi", "address.label": "Adresa e shfletuesit", - "address.placeholder": "Futni URL-në", "action.stop": "Ndalo", replaced: "Kontrolli i shfletuesit u zhvendos në një dritare tjetër të desktopit.", unsupported: "Ky aplikacion desktopi nuk e mbështet panelin e shfletuesit.", suspended: "Shfletuesi është pezulluar. Ndërveproni me këtë seancë për t'u rilidhur.", - "empty.title": "Jep URL-në", - "empty.description": "Ose kërko “Hap në shfletuesin e aplikacionit”", "failed.title": "URL-ja nuk mund të arrihet", "failed.description": "Kontrollo URL-në dhe lidhjen, pastaj provo përsëri.", "action.reload": "Ringarko", diff --git a/packages/gui-extensions/src/browser/i18n/sr.ts b/packages/gui-extensions/src/browser/i18n/sr.ts index 2b9890c54e2..e7492ec9cb4 100644 --- a/packages/gui-extensions/src/browser/i18n/sr.ts +++ b/packages/gui-extensions/src/browser/i18n/sr.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Освежи страницу прегледника", "tab.title": "Прегледник", "address.label": "Адреса прегледника", - "address.placeholder": "Унесите URL", "action.stop": "Стоп", replaced: "Контрола прегледника пребачена је у други прозор радне површине.", unsupported: "Ова десктоп апликација не подржава панел прегледника.", suspended: "Прегледник је суспендован. Интерагујте са овом сесијом да бисте се поново повезали.", - "empty.title": "Унесите URL", - "empty.description": "Или задајте упит „Отвори у прегледачу апликације“", "failed.title": "URL није доступан", "failed.description": "Проверите URL и везу, па покушајте поново.", "action.reload": "Поново учитај", diff --git a/packages/gui-extensions/src/browser/i18n/sv.ts b/packages/gui-extensions/src/browser/i18n/sv.ts index bcaa55757e1..6252fb76d0a 100644 --- a/packages/gui-extensions/src/browser/i18n/sv.ts +++ b/packages/gui-extensions/src/browser/i18n/sv.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Ladda om webbläsarsidan", "tab.title": "Webbläsare", "address.label": "Webbläsarens adress", - "address.placeholder": "Ange URL", "action.stop": "Stoppa", replaced: "Webbläsarkontrollen har flyttats till ett annat skrivbordsfönster.", unsupported: "Den här skrivbordsappen stöder inte webbläsarpanelen.", suspended: "Webbläsaren avstängd. Interagera med den här sessionen för att återansluta.", - "empty.title": "Ange URL", - "empty.description": "Eller be ”Öppna i appens webbläsare”", "failed.title": "URL:en kan inte nås", "failed.description": "Kontrollera URL:en och anslutningen och försök igen.", "action.reload": "Läs in igen", diff --git a/packages/gui-extensions/src/browser/i18n/tg.ts b/packages/gui-extensions/src/browser/i18n/tg.ts index 381cbf26345..bd3d538ef01 100644 --- a/packages/gui-extensions/src/browser/i18n/tg.ts +++ b/packages/gui-extensions/src/browser/i18n/tg.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Саҳифаи браузерро аз нав бор кунед", "tab.title": "Браузер", "address.label": "Суроғаи браузер", - "address.placeholder": "URL-ро ворид кунед", "action.stop": "Ист", replaced: "Назорати браузер ба равзанаи дигари мизи корӣ кӯчонида шуд.", unsupported: "Ин барномаи мизи корӣ панели браузерро дастгирӣ намекунад.", suspended: "Браузер боздошта шуд. Барои аз нав пайваст шудан бо ин сессия муошират кунед.", - "empty.title": "URL-ро ворид кунед", - "empty.description": "Ё дархости «Дар браузери барнома кушоед»-ро ворид кунед", "failed.title": "URL дастнорас аст", "failed.description": "URL ва пайвастшавиро санҷед ва аз нав кӯшиш кунед.", "action.reload": "Аз нав бор кардан", diff --git a/packages/gui-extensions/src/browser/i18n/th.ts b/packages/gui-extensions/src/browser/i18n/th.ts index 4bcfbcf255d..1500c6c0833 100644 --- a/packages/gui-extensions/src/browser/i18n/th.ts +++ b/packages/gui-extensions/src/browser/i18n/th.ts @@ -3,13 +3,10 @@ export default { "command.reload": "โหลดหน้าของเบราว์เซอร์ใหม่", "tab.title": "เบราว์เซอร์", "address.label": "ที่อยู่เบราว์เซอร์", - "address.placeholder": "ป้อน URL", "action.stop": "หยุด", replaced: "การควบคุมเบราว์เซอร์ถูกย้ายไปยังหน้าต่างเดสก์ท็อปอื่น", unsupported: "แอปเดสก์ท็อปนี้ไม่รองรับแผงเบราว์เซอร์", suspended: "เบราว์เซอร์ถูกพักการทำงาน โต้ตอบกับเซสชันนี้เพื่อเชื่อมต่อใหม่", - "empty.title": "ป้อน URL", - "empty.description": 'หรือป้อนพรอมต์ "เปิดในเบราว์เซอร์ของแอป"', "failed.title": "เข้าถึง URL ไม่ได้", "failed.description": "ตรวจสอบ URL และการเชื่อมต่อ แล้วลองอีกครั้ง", "action.reload": "โหลดใหม่", diff --git a/packages/gui-extensions/src/browser/i18n/tk.ts b/packages/gui-extensions/src/browser/i18n/tk.ts index 6876c409046..397b6a5ec24 100644 --- a/packages/gui-extensions/src/browser/i18n/tk.ts +++ b/packages/gui-extensions/src/browser/i18n/tk.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Brauzer sahypasyny täzeden ýükläň", "tab.title": "Brauzer", "address.label": "Brauzeriň salgysy", - "address.placeholder": "URL giriziň", "action.stop": "Dur", replaced: "Brauzer dolandyryşy başga bir iş stolunyň penjiresine geçirildi.", unsupported: "Bu iş stoly programmasy brauzer panelini goldamaýar.", suspended: "Brauzer togtadyldy Birikdirmek üçin bu sessiýa bilen täsirleşiň.", - "empty.title": "URL giriziň", - "empty.description": "Ýa-da “Programmanyň brauzerinde aç” diýip soraň", "failed.title": "URL elýeterli däl", "failed.description": "URL-i we birikmäňizi barlaň, soňra gaýtadan synanyşyň.", "action.reload": "Täzeden ýükle", diff --git a/packages/gui-extensions/src/browser/i18n/tr.ts b/packages/gui-extensions/src/browser/i18n/tr.ts index 90886f398d9..4e32ec2155a 100644 --- a/packages/gui-extensions/src/browser/i18n/tr.ts +++ b/packages/gui-extensions/src/browser/i18n/tr.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Tarayıcı sayfasını yeniden yükle", "tab.title": "Tarayıcı", "address.label": "Tarayıcı adresi", - "address.placeholder": "URL'yi girin", "action.stop": "Durdur", replaced: "Tarayıcı kontrolü başka bir masaüstü penceresine taşındı.", unsupported: "Bu masaüstü uygulaması tarayıcı bölmesini desteklemiyor.", suspended: "Tarayıcı askıya alındı. Yeniden bağlanmak için bu oturumla etkileşim kurun.", - "empty.title": "URL girin", - "empty.description": "Ya da “Uygulama tarayıcısında aç” istemini kullanın", "failed.title": "URL’ye erişilemiyor", "failed.description": "URL’yi ve bağlantınızı kontrol edip yeniden deneyin.", "action.reload": "Yeniden yükle", diff --git a/packages/gui-extensions/src/browser/i18n/uk.ts b/packages/gui-extensions/src/browser/i18n/uk.ts index e4dedf74b02..3b396a8acff 100644 --- a/packages/gui-extensions/src/browser/i18n/uk.ts +++ b/packages/gui-extensions/src/browser/i18n/uk.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Оновити сторінку веббраузера", "tab.title": "Веббраузер", "address.label": "Адреса веббраузера", - "address.placeholder": "Введіть URL", "action.stop": "Зупинити", replaced: "Керування веббраузером переміщено в інше вікно робочого столу.", unsupported: "Цей додаток для робочого столу не підтримує панель веббраузера.", suspended: "Веббраузер призупинено. Взаємодійте із цією сесією, щоб перепідключитися.", - "empty.title": "Введіть URL", - "empty.description": "Або надішліть запит «Відкрити у браузері застосунку»", "failed.title": "Не вдається відкрити URL", "failed.description": "Перевірте URL і з’єднання, а потім повторіть спробу.", "action.reload": "Перезавантажити", diff --git a/packages/gui-extensions/src/browser/i18n/ur.ts b/packages/gui-extensions/src/browser/i18n/ur.ts index 372d2db736c..fb3c588af94 100644 --- a/packages/gui-extensions/src/browser/i18n/ur.ts +++ b/packages/gui-extensions/src/browser/i18n/ur.ts @@ -3,13 +3,10 @@ export default { "command.reload": "براؤزر کا صفحہ دوبارہ لوڈ کریں۔", "tab.title": "براؤزر", "address.label": "براؤزر کا پتہ", - "address.placeholder": "درج کریں URL", "action.stop": "روکیں", replaced: "براؤزر کنٹرول کو دوسری ڈیسک ٹاپ ونڈو میں منتقل کر دیا گیا۔", unsupported: "یہ ڈیسک ٹاپ ایپ براؤزر پین کو سپورٹ نہیں کرتی ہے۔", suspended: "براؤزر معطل۔ دوبارہ منسلک ہونے کے لیے اس سیشن کے ساتھ تعامل کریں۔", - "empty.title": "URL درج کریں", - "empty.description": "یا یہ پرامپٹ دیں: ”ایپ براؤزر میں کھولیں“", "failed.title": "URL تک رسائی نہیں ہو سکی", "failed.description": "URL اور اپنا کنکشن چیک کریں، پھر دوبارہ کوشش کریں۔", "action.reload": "دوبارہ لوڈ کریں", diff --git a/packages/gui-extensions/src/browser/i18n/uz.ts b/packages/gui-extensions/src/browser/i18n/uz.ts index bbfb9d49c98..438a79e2a07 100644 --- a/packages/gui-extensions/src/browser/i18n/uz.ts +++ b/packages/gui-extensions/src/browser/i18n/uz.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Brauzer sahifasini qayta yuklash", "tab.title": "Brauzer", "address.label": "Brauzer manzili", - "address.placeholder": "URL manzilini kiriting", "action.stop": "To'xtang", replaced: "Brauzer boshqaruvi boshqa ish stoli oynasiga ko'chirildi.", unsupported: "Bu ish stoli ilovasi brauzer panelini qoʻllab-quvvatlamaydi.", suspended: "Brauzer to'xtatildi. Qayta ulanish uchun ushbu seans bilan oʻzaro aloqada boʻling.", - "empty.title": "URL kiriting", - "empty.description": "Yoki “Ilova brauzerida ochish” so‘rovini yuboring", "failed.title": "URL manziliga kirib bo‘lmadi", "failed.description": "URL va ulanishingizni tekshiring, so‘ng qayta urinib ko‘ring.", "action.reload": "Qayta yuklash", diff --git a/packages/gui-extensions/src/browser/i18n/vi.ts b/packages/gui-extensions/src/browser/i18n/vi.ts index 5622c0d969e..7576ed7577f 100644 --- a/packages/gui-extensions/src/browser/i18n/vi.ts +++ b/packages/gui-extensions/src/browser/i18n/vi.ts @@ -3,13 +3,10 @@ export default { "command.reload": "Tải lại trang trình duyệt", "tab.title": "Trình duyệt", "address.label": "Địa chỉ trình duyệt", - "address.placeholder": "Nhập URL", "action.stop": "Dừng", replaced: "Điều khiển trình duyệt đã được chuyển sang cửa sổ máy tính để bàn khác.", unsupported: "Ứng dụng máy tính để bàn này không hỗ trợ ngăn trình duyệt.", suspended: "Trình duyệt bị tạm dừng. Tương tác với phiên này để kết nối lại.", - "empty.title": "Nhập URL", - "empty.description": 'Hoặc nhập lời nhắc "Mở trong trình duyệt của ứng dụng"', "failed.title": "Không thể truy cập URL", "failed.description": "Kiểm tra URL và kết nối, rồi thử lại.", "action.reload": "Tải lại", diff --git a/packages/gui-extensions/src/browser/i18n/zh.ts b/packages/gui-extensions/src/browser/i18n/zh.ts index b5c1137b588..2e07c45cbbb 100644 --- a/packages/gui-extensions/src/browser/i18n/zh.ts +++ b/packages/gui-extensions/src/browser/i18n/zh.ts @@ -3,13 +3,10 @@ export default { "command.reload": "重新加载浏览器页面", "tab.title": "浏览器", "address.label": "浏览器地址", - "address.placeholder": "输入 URL", "action.stop": "停止", replaced: "浏览器控件已移动到另一个桌面窗口。", unsupported: "此桌面应用程序不支持浏览器面板。", suspended: "浏览器已挂起。请与此会话交互以重新连接。", - "empty.title": "输入 URL", - "empty.description": "或提示“在应用内浏览器中打开”", "failed.title": "无法访问 URL", "failed.description": "请检查 URL 和网络连接,然后重试。", "action.reload": "重新加载", diff --git a/packages/gui-extensions/src/browser/i18n/zht.ts b/packages/gui-extensions/src/browser/i18n/zht.ts index f99ddcee0a7..995ebac8b48 100644 --- a/packages/gui-extensions/src/browser/i18n/zht.ts +++ b/packages/gui-extensions/src/browser/i18n/zht.ts @@ -3,13 +3,10 @@ export default { "command.reload": "重新載入瀏覽器頁面", "tab.title": "瀏覽器", "address.label": "瀏覽器位址", - "address.placeholder": "輸入 URL", "action.stop": "停止", replaced: "瀏覽器控制已移至另一個桌面視窗。", unsupported: "此桌面應用程式不支援瀏覽器面板。", suspended: "瀏覽器已暫停。與此工作階段互動以重新連線。", - "empty.title": "輸入 URL", - "empty.description": "或輸入提示「在應用程式內建瀏覽器中開啟」", "failed.title": "無法連上 URL", "failed.description": "請檢查 URL 和網路連線,然後再試一次。", "action.reload": "重新載入", diff --git a/packages/gui-extensions/src/browser/icon.ts b/packages/gui-extensions/src/browser/icon.ts new file mode 100644 index 00000000000..8383d7da6e7 --- /dev/null +++ b/packages/gui-extensions/src/browser/icon.ts @@ -0,0 +1,53 @@ +import { nativeImage } from "electron" +import { MAX_ICON_URL } from "./ipc" +import type { BrowserNetwork } from "./network" + +type Fetched = { mime: string; data: Buffer } + +/** + * The first of a page's icon candidates that loads, as a data URL small enough to report and store. An SVG stays as + * it is; any other format is redrawn as a PNG of at most 32px, which also drops anything that is not an image. + */ +export function loadIcon(candidates: readonly string[], network: BrowserNetwork | null) { + return candidates + .filter((url) => /^(?:https?:|data:image\/)/i.test(url)) + .slice(0, 3) + .reduce>( + (found, url) => + found.then(async (icon) => { + if (icon) return icon + const fetched = url.startsWith("data:") ? inline(url) : await network?.icon(url) + + return fetched ? encode(fetched) : undefined + }), + Promise.resolve(undefined), + ) +} + +function inline(url: string): Fetched | undefined { + const match = /^data:(image\/[\w.+-]+)(;base64)?,(.*)$/is.exec(url) + + if (!match) return + const body = match[3] ?? "" + + return { + mime: (match[1] ?? "").toLowerCase(), + data: match[2] ? Buffer.from(body, "base64") : Buffer.from(decodeURIComponent(body)), + } +} + +function encode(fetched: Fetched) { + // An SVG in an runs no script and loads nothing, so it needs no redrawing. + if (fetched.mime === "image/svg+xml") { + const url = `data:image/svg+xml;base64,${fetched.data.toString("base64")}` + + return url.length <= MAX_ICON_URL ? url : undefined + } + + const image = nativeImage.createFromBuffer(fetched.data) + + if (image.isEmpty()) return + const url = (image.getSize().width > 32 ? image.resize({ width: 32, quality: "best" }) : image).toDataURL() + + return url.length <= MAX_ICON_URL ? url : undefined +} diff --git a/packages/gui-extensions/src/browser/index.ts b/packages/gui-extensions/src/browser/index.ts index 3dadb22ee7d..f21859b083a 100644 --- a/packages/gui-extensions/src/browser/index.ts +++ b/packages/gui-extensions/src/browser/index.ts @@ -1,6 +1,7 @@ import { Schema } from "effect" import { Extension, Ipc, Store } from "../sdk" import { Browser } from "./contract" +import { History } from "./history" import en from "./i18n/en" import type { BrowserPane } from "./ipc" @@ -14,6 +15,9 @@ export default Extension.define({ stores: { // The end of the last block of element refs main reserved, so refs stay unique across reloads. refs: Store.main(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)), 0), + // Pages the browser showed, for the new tab page and the address field's suggestions. One list for every + // session and server, kept on this device. + history: Store.global(History, { visits: [] }), }, i18n: { en, diff --git a/packages/gui-extensions/src/browser/ipc.ts b/packages/gui-extensions/src/browser/ipc.ts index 3751267ba69..73a0d5e38b9 100644 --- a/packages/gui-extensions/src/browser/ipc.ts +++ b/packages/gui-extensions/src/browser/ipc.ts @@ -8,6 +8,9 @@ const detail = (maximum: number) => Schema.String.check(Schema.isMaxLength(maxim const binding = text(128) +/** The longest page icon data URL main reports: a 32px PNG is a few kilobytes; larger icons are dropped. */ +export const MAX_ICON_URL = 24_576 + /** An element the user picked in the page. The ref stays valid for browser tools until the page navigates. */ export const PaneElement = Schema.Struct({ ref: Browser.Ref, @@ -39,6 +42,16 @@ export const PaneEvent = Schema.Union([ active: Schema.Boolean, element: Schema.optionalKey(PaneElement), }), + // Details only this desktop shows, kept out of the server's tab state: the page's icon as a data URL, and its zoom + // factor, 1 at 100%. + Schema.Struct({ + type: Schema.Literal("page"), + tabID: Browser.TabID, + icon: Schema.optionalKey(detail(MAX_ICON_URL).check(Schema.isStartsWith("data:image/"))), + zoom: Schema.Finite.check(Schema.isBetween({ minimum: 0.25, maximum: 5 })), + }), + // The page asked for the address field, with the platform's address shortcut. + Schema.Struct({ type: Schema.Literal("address"), tabID: Browser.TabID }), ]) export type PaneEvent = typeof PaneEvent.Type @@ -65,6 +78,18 @@ export const BrowserPane = Ipc.define({ inspect: { input: Schema.Struct({ binding, tabID: Browser.TabID, enabled: Schema.Boolean }) }, // Highlights a picked element briefly, or clears any highlight when ref is omitted. highlight: { input: Schema.Struct({ binding, tabID: Browser.TabID, ref: Schema.optionalKey(Browser.Ref) }) }, + // Zooms the page one step in or out, or back to 100%; the page reports its new zoom as a page event. + zoom: { + input: Schema.Struct({ binding, tabID: Browser.TabID, zoom: Schema.Literals(["in", "out", "reset"]) }), + }, + // The site data the page's address can read in this desktop's browser: its cookie count. Zero for a page that is + // not a web page. + site: { + input: Schema.Struct({ binding, tabID: Browser.TabID }), + output: Schema.Struct({ cookies: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)) }), + }, + // Deletes the cookies the page's address can read and its origin's stored data, then reloads the page. + clearSite: { input: Schema.Struct({ binding, tabID: Browser.TabID }) }, close: { input: Schema.Struct({ binding }) }, }, events: { diff --git a/packages/gui-extensions/src/browser/main.ts b/packages/gui-extensions/src/browser/main.ts index 8c9b05baa5a..6cf62ea5f66 100644 --- a/packages/gui-extensions/src/browser/main.ts +++ b/packages/gui-extensions/src/browser/main.ts @@ -34,6 +34,9 @@ const setup: MainSetup = (ctx) => { (await existing()).inspect(caller.window, input.binding, input.tabID, input.enabled), highlight: async (input, caller) => (await existing()).highlight(caller.window, input.binding, input.tabID, input.ref), + zoom: async (input, caller) => (await existing()).zoom(caller.window, input.binding, input.tabID, input.zoom), + site: async (input, caller) => (await existing()).site(caller.window, input.binding, input.tabID), + clearSite: async (input, caller) => (await existing()).clearSite(caller.window, input.binding, input.tabID), close: async (input, caller) => (await existing()).close(caller.window, input.binding), }) diff --git a/packages/gui-extensions/src/browser/model.ts b/packages/gui-extensions/src/browser/model.ts index adaf0f964b4..e28fe3a3967 100644 --- a/packages/gui-extensions/src/browser/model.ts +++ b/packages/gui-extensions/src/browser/model.ts @@ -4,7 +4,15 @@ import { makeEventListener } from "@solid-primitives/event-listener" import type { Browser } from "@opencode/plugin-browser/rpc" import { createKeyed, type Link, type SessionRef, type SetupContext } from "../sdk" import { readHref } from "./comment" -import { createConnection, unavailable, type Connection, type InspectEvent, type Registration } from "./connection" +import { + createConnection, + unavailable, + type Connection, + type InspectEvent, + type Registration, + type Zoom, +} from "./connection" +import { recordable, remember, withIcon } from "./history" import type definition from "./index" import { isHtml, resolveLink, workspaceFileURL } from "./link" import { BrowserPane, type PaneEvent } from "./ipc" @@ -37,8 +45,13 @@ type ModelState = { /** Servers whose plugin lacks the browser RPC; sessions on them stop retrying. */ unsupported: Record errors: Record + /** Each session's page icons and zoom by tab, as this desktop reports them. */ + pages: Record | undefined> } +/** A page's icon as a data URL, and its zoom factor, 1 at 100%. */ +type PageDetail = { icon?: string; zoom: number } + /** A mounted pane; the newest one answers the reload and inspect commands. */ type PaneHandle = { visible: () => boolean @@ -47,6 +60,8 @@ type PaneHandle = { inspectable: () => boolean /** Turns the element picker on or off. */ inspect: () => void + /** Focuses the address field and selects its text. */ + focusAddress: () => void } export type Model = ReturnType @@ -68,13 +83,37 @@ export function createModel(ctx: SetupContext) { } const owner = getOwner() - const [state, setState] = createStore({ attachments: {}, unsupported: {}, errors: {} }) + const history = ctx.stores.history + const [state, setState] = createStore({ attachments: {}, unsupported: {}, errors: {}, pages: {} }) const [panes, setPanes] = createSignal([]) const live = new Map() const listeners = new Map void>() const inspectors = new Map void>>() + const addressed = new Map void>>() + // Sessions where the user just opened a tab; its pane focuses the address field once the blank page shows. + const opening = new Set() + // Each tab's last recorded page, so a state that repeats it does not write the history again. + const recorded = new Map() const key = (tabID: string) => `${ctx.id}:${tabID}` + // Pages the user or the agent opened, once loaded: only a tab whose page exists has a real URL and title, as a + // restored tab's saved URL carries no title until it loads again. + const record = (session: string, next: { browser: Browser.State | null; embeds: Readonly> }) => + next.browser?.tabs.forEach((tab) => { + if (tab.loading || tab.loadError || !next.embeds[tab.id] || !recordable(tab.url)) return + const page = `${tab.url}\n${tab.title}` + + if (recorded.get(`${session}\n${tab.id}`) === page) return + recorded.set(`${session}\n${tab.id}`, page) + history.set({ + visits: remember( + history.value.visits, + { url: tab.url, title: tab.title }, + state.pages[session]?.[tab.id]?.icon, + ), + }) + }) + // The SDK removes the listener when the Ipc's generation ends. createKeyed(pane, (current) => current.on("event", (value) => listeners.get(value.binding)?.(value.event))) @@ -100,7 +139,14 @@ export function createModel(ctx: SetupContext) { const close = (id: string) => { live.get(id)?.dispose() live.delete(id) - setState("attachments", id, undefined) + opening.delete(id) + Array.from(recorded.keys()) + .filter((item) => item.startsWith(`${id}\n`)) + .forEach((item) => recorded.delete(item)) + batch(() => { + setState("attachments", id, undefined) + setState("pages", id, undefined) + }) } const attach = (ref: SessionRef) => { @@ -137,6 +183,17 @@ export function createModel(ctx: SetupContext) { }, preview: (path) => preview(entry, path), inspect: (event) => inspectors.get(id)?.forEach((listener) => listener(event)), + page: (event) => { + setState("pages", id, (pages) => ({ + ...pages, + [event.tabID]: event.icon ? { icon: event.icon, zoom: event.zoom } : { zoom: event.zoom }, + })) + const url = tab({ key: id }, event.tabID)?.url + const visits = url && event.icon ? withIcon(history.value.visits, url, event.icon) : undefined + + if (visits) history.set({ visits }) + }, + address: (tabID) => addressed.get(id)?.forEach((listener) => listener(tabID)), change: (next, mirror) => { if (next.error === "browser.pane.unsupported") { setState("unsupported", ref.server.id, true) @@ -167,6 +224,7 @@ export function createModel(ctx: SetupContext) { : undefined, }), ) + record(id, next) // After the store: closing a strip tab asks this model whether the desktop still has it. if (ref.location) return mirror() @@ -379,8 +437,40 @@ export function createModel(ctx: SetupContext) { openURL, command, tab, + /** Opens a blank tab for the user, whose pane then focuses the address field. */ open(session: SessionRef) { - if (available(session)) command(session, { type: "tabs.open" }) + if (!available(session)) return + opening.add(session.key) + command(session, { type: "tabs.open" }) + }, + /** Whether the user just opened a tab in this session; true once, for the pane that focuses its address. */ + opened: (session: Session) => opening.delete(session.key), + /** A page's icon and zoom, once this desktop reported them. */ + page: (session: Session, tabID: string) => state.pages[session.key]?.[tabID], + zoom(session: Session, tabID: Browser.TabID, zoom: Zoom) { + live.get(session.key)?.connection.zoom(tabID, zoom) + }, + /** The page's cookie count; undefined while the pane cannot answer. */ + site: (session: Session, tabID: Browser.TabID) => live.get(session.key)?.connection.site(tabID), + /** Deletes the page's cookies and stored data, and reloads it. */ + clearSite: (session: Session, tabID: Browser.TabID) => live.get(session.key)?.connection.clearSite(tabID), + /** Pages the browser showed, newest first. */ + visits: () => history.value.visits, + clearHistory: () => { + recorded.clear() + history.set({ visits: [] }) + }, + /** The page asking for the address field with its shortcut. */ + onAddress(session: Session, listener: (tabID: Browser.TabID) => void) { + const set = addressed.get(session.key) ?? new Set() + set.add(listener) + addressed.set(session.key, set) + + return () => { + set.delete(listener) + + if (!set.size) addressed.delete(session.key) + } }, pending, /** diff --git a/packages/gui-extensions/src/browser/network.ts b/packages/gui-extensions/src/browser/network.ts index 35a24835b5e..aa21479d6b4 100644 --- a/packages/gui-extensions/src/browser/network.ts +++ b/packages/gui-extensions/src/browser/network.ts @@ -1,4 +1,4 @@ -import { session, type WebContents } from "electron" +import { net, session, type WebContents } from "electron" import type { RpcClient } from "@opencode/client/effect/api" import type { Session } from "@opencode/schema/session" import { Browser } from "@opencode/plugin-browser/rpc" @@ -73,5 +73,49 @@ export const createBrowserNetwork = Effect.fn("BrowserNetwork.create")(function* return () => contents.off("login", login) }, + /** + * Fetches a page icon through the server's network, as the page loaded it. Resolves undefined for anything but a + * small image: a failure, a timeout, another content type, or more than `MAX_ICON_BYTES`. + */ + icon: (url: string) => + new Promise<{ mime: string; data: Buffer } | undefined>((resolve) => { + const request = net.request({ url, session: partition, useSessionCookies: true, redirect: "follow" }) + const chunks: Buffer[] = [] + + const finish = (value?: { mime: string; data: Buffer }) => { + clearTimeout(timeout) + resolve(value) + } + + const fail = () => { + request.abort() + finish() + } + + const timeout = setTimeout(fail, 5_000) + request.on("login", (auth, callback) => { + if (auth.isProxy && auth.host === proxy.host && auth.port === proxy.port) + return callback(proxy.credentials.username, proxy.credentials.password) + callback() + }) + request.on("response", (response) => { + const header = response.headers["content-type"] + const mime = (Array.isArray(header) ? header[0] : header)?.split(";")[0]?.trim().toLowerCase() ?? "" + + if (response.statusCode !== 200 || !mime.startsWith("image/")) return fail() + response.on("data", (chunk) => { + chunks.push(chunk) + + if (chunks.reduce((size, item) => size + item.length, 0) > MAX_ICON_BYTES) fail() + }) + response.on("end", () => finish({ mime, data: Buffer.concat(chunks) })) + response.on("error", fail) + }) + request.on("error", fail) + request.end() + }), } }) + +/** Icons larger than this are not worth reducing; sites list a favicon of a few kilobytes. */ +const MAX_ICON_BYTES = 256 * 1024 diff --git a/packages/gui-extensions/src/browser/pane.ts b/packages/gui-extensions/src/browser/pane.ts index 6a6d4f27a85..5b5fa7f9d06 100644 --- a/packages/gui-extensions/src/browser/pane.ts +++ b/packages/gui-extensions/src/browser/pane.ts @@ -325,6 +325,15 @@ export function createBrowserPane(input: { async highlight(window: number, binding: string, tabID: Browser.TabID, ref?: Browser.Ref) { await owned(window, binding).pages.get(tabID)?.highlight(ref) }, + zoom(window: number, binding: string, tabID: Browser.TabID, direction: "in" | "out" | "reset") { + owned(window, binding).pages.get(tabID)?.zoom(direction) + }, + async site(window: number, binding: string, tabID: Browser.TabID) { + return (await owned(window, binding).pages.get(tabID)?.site()) ?? { cookies: 0 } + }, + async clearSite(window: number, binding: string, tabID: Browser.TabID) { + await owned(window, binding).pages.get(tabID)?.clearSite() + }, async command(window: number, binding: string, command: Browser.Action) { const entry = owned(window, binding) await execute(entry, { action: command, files: [] }, new AbortController().signal) @@ -480,9 +489,21 @@ export function createBrowserPane(input: { inspect: (event) => { if (entry.pages.has(id)) report(entry, { type: "inspect", tabID: id, ...event }) }, - popup: (popupOptions) => { + // Straight to the window: icons and zoom are local to this desktop, like the embed. + detail: (value) => { + if (entry.pages.has(id)) publish(entry, { type: "page", tabID: id, ...value }) + }, + zoomed: () => entry.pages.forEach((page) => page.detail()), + address: () => { + if (!entry.pages.has(id) || entry.win.isDestroyed()) return + // The page held keyboard focus; the app's address field needs it back. + entry.win.webContents.focus() + publish(entry, { type: "address", tabID: id }) + }, + popup: (popupOptions, background) => { const popup = create(entry, false, popupOptions) - focus(entry, popup.state().id) + + if (!background) focus(entry, popup.state().id) return popup.contents }, diff --git a/packages/gui-extensions/src/browser/panel.fixture.tsx b/packages/gui-extensions/src/browser/panel.fixture.tsx index 28c27d7051a..dfed61a7060 100644 --- a/packages/gui-extensions/src/browser/panel.fixture.tsx +++ b/packages/gui-extensions/src/browser/panel.fixture.tsx @@ -41,6 +41,8 @@ import { type Storage, type Workspaces, } from "../sdk" +import barStyles from "./bar.css?inline" +import type { History } from "./history" import browserEn from "./i18n/en" import type definition from "./index" import { createModel } from "./model" @@ -73,8 +75,35 @@ type PaneFixtureState = { picker: Record highlights: { sessionKey: string; ref?: Browser.Ref }[] comments: ComposerNote[] + /** The page's zoom as main last reported it. */ + zoom: number + /** The browser history store. */ + history: History + /** URLs the pane opened in the system browser. */ + external: string[] + /** Cookies the page's address can read. */ + cookies: number } +// A 16px blue square, as main reports a page icon. +const icon = + "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiI+PHJlY3Qgd2lkdGg9IjE2IiBoZWlnaHQ9IjE2IiByeD0iMyIgZmlsbD0iIzNiODJmNiIvPjwvc3ZnPg==" + +const visits: History["visits"] = [ + { + url: "https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements", + title: "HTML elements reference - HTML | MDN", + icon, + }, + { + url: "https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Colors/Color_format_converter", + title: "Color format converter - CSS | MDN", + icon, + }, + { url: "http://localhost:5173/settings", title: "Settings - Preview" }, + { url: "https://alpha.example/", title: "Alpha" }, +] + // Component-test fixture: the real pane on the real host embeds, with the desktop faked at its two // boundaries: the model's main-process pane (tab state, picker events) and the host bridge that shows native views. export function mountBrowserPane(input: PaneHost) { @@ -105,6 +134,10 @@ export function mountBrowserPane(input: PaneHost) { picker: {}, highlights: [], comments: [], + zoom: 1, + history: { visits: [] }, + external: [], + cookies: 3, }) // Each capture waits until the fixture releases it, so a spec can observe the pending state. @@ -151,12 +184,19 @@ export function mountBrowserPane(input: PaneHost) { // SAFETY: the host embeds call only `embed` and `capture` on their bridge (`runtime/extension/embeds.tsx`). const embeds = input.createEmbeds({ bridge: bridge as Bridge, zoom: () => 1, dialog: () => false }) + const t = (key: string, params?: Readonly>>) => + (messages.get(key) ?? language.t(key)).replace(/\{\{(\w+)\}\}/g, (_, name: string) => + String(params?.[name] ?? ""), + ) + const base = { id: "browser", keybinds: { keybind: () => [], keys: (bind: string) => bind.split("+") }, desktop: { zoom: () => 1 }, embeds, - t: (key: string) => messages.get(key) ?? language.t(key), + t, + // English plural forms, as the host picks them. + plural: (key: string, count: number) => t(`${key}.${count === 1 ? "one" : "other"}`, { count }), } const panel: PanelFrame = { @@ -169,7 +209,14 @@ export function mountBrowserPane(input: PaneHost) { open: () => [], } - const server = { id: "browser-test", compatible: true, data: { on: () => () => undefined } } + const server = { + id: "browser-test", + name: "Local", + local: true, + compatible: true, + data: { on: () => () => undefined }, + } + const [reads, setReads] = createStore({ directory: 0 }) // Frozen session refs, as the real host supplies. Only the key belongs in the pane's transient state. @@ -272,6 +319,20 @@ export function mountBrowserPane(input: PaneHost) { if (!key) throw new Error("Unknown highlight binding") setStore("highlights", (items) => [...items, { sessionKey: key, ref: value.ref }]) }, + // Main steps through Chromium's presets and reports the page's new zoom. + zoom: async (value) => { + const steps = [0.9, 1, 1.1, 1.25] + const index = steps.indexOf(store.zoom) + const next = value.zoom === "reset" ? 1 : (steps[index + (value.zoom === "in" ? 1 : -1)] ?? store.zoom) + setStore("zoom", next) + emit(store.session, { type: "page", tabID: value.tabID, zoom: next }) + }, + site: async () => ({ cookies: store.cookies }), + // Main deletes the site's data and reloads the page. + clearSite: async () => { + setStore({ cookies: 0, generation: store.generation + 1 }) + report() + }, close: async () => undefined, state: () => undefined, on: (_name, listener) => { @@ -292,6 +353,18 @@ export function mountBrowserPane(input: PaneHost) { screen: { current: () => screen }, layout: { narrow: () => false, stored: () => [], state: () => "visible", open() {}, close() {} }, links: { open() {} }, + stores: { + history: { + get value() { + return store.history + }, + set: (next: History) => setStore("history", reconcile(next)), + }, + }, + system: { + copy: async () => undefined, + openExternal: (url: string) => setStore("external", (items) => [...items, url]), + }, } // SAFETY: the real model and pane use only the host boundaries implemented above in this fixture's flows. @@ -319,6 +392,9 @@ export function mountBrowserPane(input: PaneHost) { return ( + {/* The extension contributes the bar's styles through the host's Style registry, which this fixture skips. + Menus and suggestions portal into , under this fixture's fixed host unless raised above it. */} +

Browser pane lifecycle

Captures: {store.captures}

+

Zoom: {Math.round(store.zoom * 100)}

+

Visits: {store.history.visits.map((visit) => visit.url).join(" ")}

+

External: {store.external.join(" ")}

Session getter reads: {reads.directory}

Picker: {store.picker[store.session] ? "on" : "off"}

- {(tab) =>

Picker {tab.title}: {store.picker[tab.title] ? "on" : "off"}

} + {(tab) => ( +

+ Picker {tab.title}: {store.picker[tab.title] ? "on" : "off"} +

+ )}

Highlights: {store.highlights.map((item) => item.ref ?? "clear").join(",")}

Highlight owners: {store.highlights.map((item) => item.sessionKey).join(",")}

@@ -689,6 +779,9 @@ export function mountBrowserRegion(input: RegionHost) { command: async () => undefined, inspect: async () => undefined, highlight: async () => undefined, + zoom: async () => undefined, + site: async () => ({ cookies: 0 }), + clearSite: async () => undefined, close: async () => undefined, state: () => undefined, on: (_name, listener) => { diff --git a/packages/gui-extensions/src/browser/panel.tsx b/packages/gui-extensions/src/browser/panel.tsx index 595d2591d0e..9b391d8fed7 100644 --- a/packages/gui-extensions/src/browser/panel.tsx +++ b/packages/gui-extensions/src/browser/panel.tsx @@ -1,16 +1,23 @@ +import { Popover } from "@kobalte/core/popover" +import { Button } from "@opencode/ui/button" import { Icon } from "@opencode/ui/icon" +import type { IconName } from "@opencode/ui/icons/catalog" import { IconButton } from "@opencode/ui/icon-button" import { LineCommentEditor } from "@opencode/ui/line-comment" import { Loader } from "@opencode/ui/loader" import { Keybind } from "@opencode/ui/keybind" +import { Menu } from "@opencode/ui/menu" +import { showToast } from "@opencode/ui/toast" import { Tooltip } from "@opencode/ui/tooltip" import { createEventListener } from "@solid-primitives/event-listener" import { createResizeObserver } from "@solid-primitives/resize-observer" -import { createMemo, For, on, onCleanup, Show, type Accessor } from "solid-js" +import { createMemo, For, on, onCleanup, Show, type Accessor, type JSX } from "solid-js" import { createStore } from "solid-js/store" import type { Browser } from "@opencode/plugin-browser/rpc" import { createKeyed, useExtension, usePanel, type PanelTab, type MountedSession, type SessionScreen } from "../sdk" -import { commentNote } from "./comment" +import { addressParts, connection, loopback, resolveAddress, searches } from "./address" +import { commentNote, pageNote } from "./comment" +import { bare, completes, highlight, suggest, type Visit } from "./history" import type { Model } from "./model" import type { PaneElement } from "./ipc" @@ -23,6 +30,12 @@ type PaneState = { kept: { followed: number; rejected: number } | undefined /** The movement count at a submit; the next reported movement ends the submitted navigation. */ navigating: number | undefined + /** The user typed since focusing the address field; suggestions follow typing, not a focused URL. */ + typed: boolean + /** The suggestion Enter opens; -1 opens the typed text. */ + active: number + /** Escape closed the suggestions; typing opens them again. */ + dismissed: boolean /** The tab whose element picker is on. */ picking: { sessionKey: string; tabID: Browser.TabID } | undefined /** A picked element awaiting its comment. The page stays frozen as a still until it closes. */ @@ -37,10 +50,17 @@ type PaneState = { draft: string } | undefined + /** A comment on the whole page awaiting its text, frozen like an element comment. */ + note: { sessionKey: string; tabID: Browser.TabID; url: string; title: string; draft: string } | undefined size: { width: number; height: number } editorHeight: number } +/** Suggestions the address field lists, and pages the new tab page lists. */ +const SUGGESTIONS = 5 + +const RECENT = 5 + export default function SessionBrowserPane(props: { tab: Accessor session: MountedSession @@ -51,6 +71,7 @@ export default function SessionBrowserPane(props: { const keybinds = extension.keybinds const desktop = extension.desktop const embeds = extension.embeds + const system = extension.system const panel = usePanel() const visible = () => panel.visible() const state = () => props.model.tab(props.session, props.tab().id) @@ -58,7 +79,12 @@ export default function SessionBrowserPane(props: { const failed = () => !!state()?.loadError const suspended = () => props.model.suspended(props.session) const command = (action: Browser.Action) => props.model.command(props.session, action) - const button = { variant: "ghost", size: "large" } as const + + const page = () => { + const tab = state() + + return tab ? props.model.page(props.session, tab.id) : undefined + } const [store, setStore] = createStore({ address: "", @@ -66,8 +92,12 @@ export default function SessionBrowserPane(props: { submitted: false, kept: undefined, navigating: undefined, + typed: false, + active: -1, + dismissed: false, picking: undefined, comment: undefined, + note: undefined, size: { width: 0, height: 0 }, editorHeight: 0, }) @@ -115,7 +145,8 @@ export default function SessionBrowserPane(props: { } let box: HTMLDivElement | undefined - const scheme = () => field().match(/^https?:\/\//i)?.[0] ?? "" + let input: HTMLInputElement | undefined + let anchor: HTMLFormElement | undefined const error = () => { const value = props.model.error(props.session) @@ -131,6 +162,33 @@ export default function SessionBrowserPane(props: { const picking = () => store.picking?.sessionKey === props.session.key && store.picking?.tabID === state()?.id // A comment on a picked element freezes the page so its editor can float above it. const commenting = () => store.comment?.sessionKey === props.session.key && store.comment?.tabID === state()?.id + const noting = () => store.note?.sessionKey === props.session.key && store.note?.tabID === state()?.id + + // The address field always shows the whole URL; at rest it draws the host emphasized. + const parts = () => addressParts(field()) + const site = () => !!field() && !store.editing + + // Suggestions follow what the user typed; a focused address is not a query. + const suggestions = createMemo(() => + store.editing && store.typed ? suggest(props.model.visits(), store.address, SUGGESTIONS) : [], + ) + + const listed = () => suggestions().length > 0 && !store.dismissed + const chosen = () => (listed() ? suggestions()[store.active] : undefined) + const recent = () => props.model.visits().slice(0, RECENT) + + // A loopback address opens on the machine that runs the server; the system browser here reaches it only when the + // server runs here too. + const reachable = () => { + const url = address() + + if (!URL.canParse(url)) return false + const parsed = new URL(url) + + if (parsed.protocol === "file:") return props.session.server.local + + return /^https?:$/.test(parsed.protocol) && (props.session.server.local || !loopback(parsed.hostname)) + } const setPicking = (current: NonNullable, enabled: boolean) => { props.model.inspect({ key: current.sessionKey }, current.tabID, enabled) @@ -145,15 +203,44 @@ export default function SessionBrowserPane(props: { setStore("comment", undefined) } + const closeNote = () => setStore("note", undefined) + const toggleInspect = () => { const tab = state() if (!tab || !inspectable()) return if (store.comment) closeComment() + closeNote() setPicking({ sessionKey: props.session.key, tabID: tab.id }, !picking()) } + const focusAddress = () => { + input?.focus() + input?.select() + } + + // Navigates the tab and keeps the submitted address in the field until the page reports where it went; a blank page + // keeps the field empty. + const go = (url: string) => { + const tab = state() + + if (!tab) return + setStore({ submitted: true, address: url === "about:blank" ? "" : url, navigating: moved() }) + command({ type: "navigate", tabID: tab.id, url }) + input?.blur() + } + + const step = (by: number) => { + const count = suggestions().length + + if (!count) return + setStore({ + dismissed: false, + active: store.active + by < -1 ? count - 1 : ((store.active + by + 1) % (count + 1)) - 1, + }) + } + const submitComment = (value: string) => { const current = store.comment @@ -184,6 +271,43 @@ export default function SessionBrowserPane(props: { closeComment() } + const openNote = () => { + const tab = state() + + if (!tab || !address()) return + + if (picking() && store.picking) setPicking(store.picking, false) + closeComment() + setStore("note", { sessionKey: props.session.key, tabID: tab.id, url: tab.url, title: tab.title, draft: "" }) + } + + const submitNote = (value: string) => { + const current = store.note + + if (!current) return + props.screen.composer.attach( + pageNote({ + origin: extension.id, + tabID: current.tabID, + url: current.url, + title: current.title, + label: current.title || addressParts(current.url).host || current.url, + comment: value, + }), + ) + closeNote() + } + + const copyLink = () => { + const url = address() + + if (!url) return + void system.copy(url).then( + () => showToast({ title: extension.t("common.copied") }), + () => showToast({ title: extension.t("common.requestFailed") }), + ) + } + // The picked element in surface pixels, and the editor anchored below it, above it, or over it. const spotlight = () => { const rect = store.comment?.element.rect @@ -229,6 +353,7 @@ export default function SessionBrowserPane(props: { }, inspectable, inspect: toggleInspect, + focusAddress, }), ) @@ -268,6 +393,25 @@ export default function SessionBrowserPane(props: { ), ) + // The page's address shortcut moves focus to this field when the page is the one on screen. + createKeyed( + () => props.session, + (session) => + onCleanup( + props.model.onAddress(session, (tabID) => { + if (tabID === state()?.id && visible()) focusAddress() + }), + ), + ) + + // A tab the user just opened starts in its address field, once its blank page is on screen. Syncs DOM focus. + createKeyed( + () => (visible() && empty() ? state()?.id : undefined), + () => { + if (props.model.opened(props.session)) focusAddress() + }, + ) + // A picker or comment belongs to the page on screen: the page's picker stops when its tab is switched away or the // pane hides, and a comment closes with its tab. const endPicker = () => { @@ -293,12 +437,15 @@ export default function SessionBrowserPane(props: { endPicker() if (store.comment?.sessionKey !== current.session || store.comment.tabID !== current.tabID) closeComment() + + if (store.note?.sessionKey !== current.session || store.note.tabID !== current.tabID) closeNote() }, { equals: (previous, next) => previous.session === next.session && previous.tabID === next.tabID, otherwise: () => { endPicker() closeComment() + closeNote() }, }, ) @@ -329,144 +476,339 @@ export default function SessionBrowserPane(props: { (tabID) => props.model.load(props.session, tabID), ) + const tip = (label: string, keys?: readonly string[]): JSX.Element => ( +
+ {label} + 0}> + + +
+ ) + return ( ) } + +/** A page's icon, or the globe while it has none. */ +function PageIcon(props: { icon: string | undefined }) { + return ( + }> + {(icon) => } + + ) +} + +/** A page in the suggestions or the new tab page: its icon, title and address, with the query's matches drawn. */ +function PageRow(props: { + visit: Visit + query?: string + /** Set for a suggestion: an option of the address field's list, which keeps keyboard focus in the field. */ + option?: { id: string; selected: boolean } + onClick: () => void +}) { + const body = () => ( + <> + + + + + + + - + + + + + + + ) + + return ( + props.onClick()}> + {body()} + + } + > + {(option) => ( +
event.preventDefault()} + onClick={() => props.onClick()} + > + {body()} +
+ )} +
+ ) +} + +function Marked(props: { text: string; query: string }) { + return ( + + {(part) => ( + + {part.text} + + )} + + ) +} + +const connections = { + secure: { icon: "lock", title: "site.secure", description: undefined }, + insecure: { icon: "outline-hexagonal-warning", title: "site.insecure", description: "site.insecure.description" }, + local: { icon: "monitor", title: "site.local", description: "site.local.description" }, + file: { icon: "folder", title: "site.file", description: "site.file.description" }, +} as const + +/** + * What the page can do and what can reach it, under the site button at the address field's start: its connection, + * its stored data, the permissions it never gets, the agent's access, and the network it loads through. + */ +function SiteInformation(props: { + url: string + server: string | undefined + /** The page's cookie count; undefined while the pane cannot answer. */ + site: () => Promise<{ cookies: number }> | undefined + clear: () => Promise | undefined +}) { + const extension = useExtension() + + // `load` counts openings and clears, so a count for an earlier one never replaces a later one. + const [state, setState] = createStore<{ open: boolean; cookies?: number; clearing: boolean; load: number }>({ + open: false, + clearing: false, + load: 0, + }) + + const kind = () => { + const value = connection(props.url) + + return value ? connections[value] : undefined + } + + // Only web pages have cookies and ask for permissions; a workspace file has neither. + const web = () => { + const value = connection(props.url) + + return !!value && value !== "file" + } + + const load = () => { + const run = state.load + 1 + setState({ load: run, cookies: undefined }) + void props.site()?.then( + (value) => { + if (state.load === run) setState("cookies", value.cookies) + }, + () => undefined, + ) + } + + const clear = () => { + setState("clearing", true) + void (props.clear() ?? Promise.reject(new Error("browser.pane.unavailable"))) + .catch(() => showToast({ title: extension.t("common.requestFailed") })) + .finally(() => { + setState("clearing", false) + load() + }) + } + + return ( + { + setState("open", open) + + if (open) load() + }} + > + + } + /> + + + { + event.preventDefault() + + if (event.currentTarget instanceof HTMLElement) event.currentTarget.focus() + }} + > +
+ + {addressParts(props.url).host || props.url} + + {/* A plain button: Kobalte's close button carries the open popover's data-expanded, which icon buttons + draw as pressed. */} + } + onClick={() => setState("open", false)} + /> +
+ + {(value) => ( + + )} + + + + + + + + + + {(server) => } + +
+
+
+ ) +} + +function SiteRow(props: { icon: IconName; title: string; detail?: string; children?: JSX.Element }) { + return ( +
+ +
+ {props.title} + {(detail) => {detail()}} +
+ {props.children} +
+ ) +} diff --git a/packages/gui-extensions/src/browser/renderer.tsx b/packages/gui-extensions/src/browser/renderer.tsx index 2ac371ea034..70118801c30 100644 --- a/packages/gui-extensions/src/browser/renderer.tsx +++ b/packages/gui-extensions/src/browser/renderer.tsx @@ -4,6 +4,7 @@ import { Command, createKeyed, LinkHandler, MenuItem, onIdle, Panel, Style, type import { Browser } from "./contract" import type definition from "./index" import type { Model } from "./model" +import barStyles from "./bar.css?inline" import commentStyles from "./comment.css?inline" import tabStyles from "./tabs.css?inline" @@ -32,6 +33,7 @@ const setup: Setup = (ctx) => { // Tab trigger styles render with the strip, before the pane chunk loads. ctx.add(Style, tabStyles) ctx.add(Style, commentStyles) + ctx.add(Style, barStyles) // Everything here serves a mounted session, so the attachment model and the pane's protocol // schemas load when the first session opens instead of at startup. const opened = createMemo((seen: boolean) => seen || !!sessions.current(), false) @@ -67,6 +69,25 @@ const setup: Setup = (ctx) => { } }) + // The system browser's address shortcut. While the page has focus, the page claims it and main forwards it; here it + // covers focus elsewhere in the pane. Ctrl+L focuses the composer outside the pane on Windows and Linux. + ctx.add(Command, (): Command | undefined => { + const pane = model()?.pane() + + if (!pane) return undefined + + return { + id: "address", + title: ctx.t("command.address"), + group: ctx.t("command.category.view"), + bind: "mod+l", + scope: "#browser-panel", + editable: true, + enabled: pane.visible(), + run: pane.focusAddress, + } + }) + // Ctrl+Shift+C copies in the terminal, so only the focused page claims it, as in Chromium. ctx.add(Command, (): Command | undefined => { const pane = model()?.pane() @@ -120,9 +141,11 @@ const setup: Setup = (ctx) => { const text = () => { const tab = model()?.tab({ key: session }, id) - return !tab?.url || tab.url === "about:blank" ? ctx.t("tab.title") : tab.title || tab.url + return !tab?.url || tab.url === "about:blank" ? ctx.t("tab.new") : tab.title || tab.url } + const icon = () => model()?.page({ key: session }, id)?.icon + return { id, get title() { @@ -130,7 +153,9 @@ const setup: Setup = (ctx) => { }, label: () => (
- + }> + {(source) => } + {text()}
), diff --git a/packages/ui/src/icons/catalog.ts b/packages/ui/src/icons/catalog.ts index 47895053744..cb33717a91e 100644 --- a/packages/ui/src/icons/catalog.ts +++ b/packages/ui/src/icons/catalog.ts @@ -186,6 +186,38 @@ const icons = { viewBox: "0 0 16 16", body: ``, }, + "outline-arrow-left": { + viewBox: "0 0 16 16", + body: ``, + }, + "outline-arrow-right": { + viewBox: "0 0 16 16", + body: ``, + }, + "outline-arrow-up-right": { + viewBox: "0 0 16 16", + body: ``, + }, + "outline-rotate-clockwise": { + viewBox: "0 0 16 16", + body: ``, + }, + "outline-globe": { + viewBox: "0 0 16 16", + body: ``, + }, + "outline-globe-plus": { + viewBox: "0 0 16 16", + body: ``, + }, + "outline-cookie": { + viewBox: "0 0 16 16", + body: ``, + }, + "outline-browser-annotate": { + viewBox: "0 0 16 16", + body: ``, + }, "arrow-up-right": { viewBox: "0 0 16 16", body: ``, diff --git a/packages/ui/src/icons/icon/icon.tsx b/packages/ui/src/icons/icon/icon.tsx index 1a4f265f9a7..dbb86c5865e 100644 --- a/packages/ui/src/icons/icon/icon.tsx +++ b/packages/ui/src/icons/icon/icon.tsx @@ -63,6 +63,8 @@ export function Icon(props: IconProps) { data-directional={ iconName() === "arrow-left" || iconName() === "arrow-right" || + iconName() === "outline-arrow-left" || + iconName() === "outline-arrow-right" || iconName() === "chevron-left" || iconName() === "chevron-right" ? ""