@zyro-sec/gui-plugins 0.0.0-stage → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +116 -0
- package/README.md +874 -3
- package/bunfig.toml +3 -0
- package/happydom.ts +77 -0
- package/package.json +63 -4
- package/src/browser/activation-delay.ts +134 -0
- package/src/browser/address-machine.ts +468 -0
- package/src/browser/address.ts +111 -0
- package/src/browser/agent-rendering.ts +61 -0
- package/src/browser/analysis.ts +260 -0
- package/src/browser/artifact-link.ts +69 -0
- package/src/browser/artifact-links.ts +55 -0
- package/src/browser/artifact-preview.ts +61 -0
- package/src/browser/assets/viewport-device-chevron.svg +5 -0
- package/src/browser/assets/viewport-rotate.svg +7 -0
- package/src/browser/bar.css +562 -0
- package/src/browser/capture.ts +158 -0
- package/src/browser/cdp.ts +97 -0
- package/src/browser/child-targets.ts +30 -0
- package/src/browser/choices.tsx +42 -0
- package/src/browser/chromium.ts +3018 -0
- package/src/browser/comment.css +38 -0
- package/src/browser/comment.ts +98 -0
- package/src/browser/connection.ts +122 -0
- package/src/browser/default-browser.ts +59 -0
- package/src/browser/diagnostics-machine.ts +522 -0
- package/src/browser/diagnostics.ts +317 -0
- package/src/browser/dialog-machine.ts +268 -0
- package/src/browser/disk/contained-file.ts +43 -0
- package/src/browser/disk/handle-path.fixture.ts +99 -0
- package/src/browser/disk/handle-path.ts +122 -0
- package/src/browser/disk/index.ts +5 -0
- package/src/browser/disk/preview-scope.ts +90 -0
- package/src/browser/electron-address.fixture.ts +143 -0
- package/src/browser/electron-app-badge.fixture.ts +97 -0
- package/src/browser/electron-crash.fixture.ts +216 -0
- package/src/browser/electron-dialogs.fixture.ts +114 -0
- package/src/browser/electron-history.fixture.ts +61 -0
- package/src/browser/electron-icon.fixture.ts +145 -0
- package/src/browser/electron-import-choice.fixture.ts +58 -0
- package/src/browser/electron-links.fixture.ts +549 -0
- package/src/browser/electron-main.ts +85 -0
- package/src/browser/electron-media.fixture.ts +66 -0
- package/src/browser/electron-open.fixture.ts +351 -0
- package/src/browser/electron-page.fixture.ts +253 -0
- package/src/browser/electron-restore.fixture.ts +135 -0
- package/src/browser/electron-run.ts +184 -0
- package/src/browser/electron-sign-in-copy.fixture.ts +365 -0
- package/src/browser/electron-webauthn.fixture.ts +229 -0
- package/src/browser/electron-workers.fixture.ts +54 -0
- package/src/browser/errors.ts +175 -0
- package/src/browser/failure-view.tsx +92 -0
- package/src/browser/failure.ts +174 -0
- package/src/browser/field-value.ts +60 -0
- package/src/browser/file-choosers.ts +42 -0
- package/src/browser/file-verification.ts +18 -0
- package/src/browser/files.ts +134 -0
- package/src/browser/find-bar.tsx +80 -0
- package/src/browser/find-machine.ts +43 -0
- package/src/browser/history/earlier.ts +23 -0
- package/src/browser/history/index.ts +5 -0
- package/src/browser/history/ipc.ts +44 -0
- package/src/browser/history/match.ts +196 -0
- package/src/browser/history/page.ts +86 -0
- package/src/browser/history/search.ts +209 -0
- package/src/browser/history/store.ts +272 -0
- package/src/browser/history/suggest.ts +51 -0
- package/src/browser/history/visits.ts +59 -0
- package/src/browser/host-display.ts +32 -0
- package/src/browser/i18n/am.ts +42 -0
- package/src/browser/i18n/ar.ts +46 -0
- package/src/browser/i18n/az.ts +42 -0
- package/src/browser/i18n/bg.ts +42 -0
- package/src/browser/i18n/bn.ts +42 -0
- package/src/browser/i18n/br.ts +44 -0
- package/src/browser/i18n/bs.ts +43 -0
- package/src/browser/i18n/ca.ts +44 -0
- package/src/browser/i18n/cs.ts +44 -0
- package/src/browser/i18n/da.ts +42 -0
- package/src/browser/i18n/de.ts +43 -0
- package/src/browser/i18n/dv.ts +43 -0
- package/src/browser/i18n/dz.ts +42 -0
- package/src/browser/i18n/el.ts +44 -0
- package/src/browser/i18n/en.ts +455 -0
- package/src/browser/i18n/es.ts +44 -0
- package/src/browser/i18n/et.ts +42 -0
- package/src/browser/i18n/fa.ts +42 -0
- package/src/browser/i18n/fi.ts +42 -0
- package/src/browser/i18n/fo.ts +42 -0
- package/src/browser/i18n/fr.ts +45 -0
- package/src/browser/i18n/he.ts +43 -0
- package/src/browser/i18n/hi.ts +42 -0
- package/src/browser/i18n/hr.ts +43 -0
- package/src/browser/i18n/hu.ts +43 -0
- package/src/browser/i18n/hy.ts +42 -0
- package/src/browser/i18n/id.ts +42 -0
- package/src/browser/i18n/is.ts +42 -0
- package/src/browser/i18n/it.ts +44 -0
- package/src/browser/i18n/ja.ts +42 -0
- package/src/browser/i18n/ka.ts +42 -0
- package/src/browser/i18n/km.ts +42 -0
- package/src/browser/i18n/ko.ts +42 -0
- package/src/browser/i18n/lo.ts +42 -0
- package/src/browser/i18n/lt.ts +44 -0
- package/src/browser/i18n/lv.ts +43 -0
- package/src/browser/i18n/mk.ts +42 -0
- package/src/browser/i18n/mn.ts +42 -0
- package/src/browser/i18n/ms.ts +42 -0
- package/src/browser/i18n/my.ts +43 -0
- package/src/browser/i18n/ne.ts +42 -0
- package/src/browser/i18n/nl.ts +42 -0
- package/src/browser/i18n/no.ts +42 -0
- package/src/browser/i18n/pa.ts +42 -0
- package/src/browser/i18n/pl.ts +44 -0
- package/src/browser/i18n/ro.ts +43 -0
- package/src/browser/i18n/ru.ts +44 -0
- package/src/browser/i18n/si.ts +42 -0
- package/src/browser/i18n/sk.ts +44 -0
- package/src/browser/i18n/sl.ts +44 -0
- package/src/browser/i18n/sq.ts +43 -0
- package/src/browser/i18n/sr.ts +43 -0
- package/src/browser/i18n/sv.ts +42 -0
- package/src/browser/i18n/tg.ts +42 -0
- package/src/browser/i18n/th.ts +42 -0
- package/src/browser/i18n/tk.ts +42 -0
- package/src/browser/i18n/tr.ts +42 -0
- package/src/browser/i18n/uk.ts +44 -0
- package/src/browser/i18n/ur.ts +42 -0
- package/src/browser/i18n/uz.ts +42 -0
- package/src/browser/i18n/vi.ts +42 -0
- package/src/browser/i18n/zh.ts +42 -0
- package/src/browser/i18n/zht.ts +42 -0
- package/src/browser/icon-image.ts +110 -0
- package/src/browser/icon-samples.ts +110 -0
- package/src/browser/icon.ts +72 -0
- package/src/browser/import-prompt.tsx +265 -0
- package/src/browser/index.ts +97 -0
- package/src/browser/ipc.ts +304 -0
- package/src/browser/jobs-machine.ts +181 -0
- package/src/browser/jobs.ts +373 -0
- package/src/browser/keys.ts +109 -0
- package/src/browser/lighthouse.ts +103 -0
- package/src/browser/link.ts +19 -0
- package/src/browser/machine.ts +1522 -0
- package/src/browser/main-machine.ts +99 -0
- package/src/browser/main.ts +394 -0
- package/src/browser/media-gate.ts +131 -0
- package/src/browser/mobile-emulation.ts +121 -0
- package/src/browser/model-machine.ts +93 -0
- package/src/browser/model.ts +1173 -0
- package/src/browser/native-page-menu.ts +189 -0
- package/src/browser/navigation-deadline.ts +20 -0
- package/src/browser/navigation-turn.ts +118 -0
- package/src/browser/network.ts +140 -0
- package/src/browser/notice-actions.ts +52 -0
- package/src/browser/overlay-machine.ts +330 -0
- package/src/browser/page-find.ts +71 -0
- package/src/browser/page-icon.tsx +27 -0
- package/src/browser/page-log.ts +276 -0
- package/src/browser/page-machine.ts +329 -0
- package/src/browser/page-menu.ts +158 -0
- package/src/browser/page-prompts.ts +753 -0
- package/src/browser/pane-machine.ts +664 -0
- package/src/browser/pane.ts +1335 -0
- package/src/browser/panel.fixture.tsx +2046 -0
- package/src/browser/panel.stories.tsx +147 -0
- package/src/browser/panel.tsx +2029 -0
- package/src/browser/passkey-groups.ts +34 -0
- package/src/browser/picker-machine.ts +214 -0
- package/src/browser/plugin-tabs.ts +26 -0
- package/src/browser/policy.ts +439 -0
- package/src/browser/preview.ts +40 -0
- package/src/browser/profile/chromium.ts +198 -0
- package/src/browser/profile/compatibility.ts +177 -0
- package/src/browser/profile/cookie.ts +215 -0
- package/src/browser/profile/database.ts +116 -0
- package/src/browser/profile/electron-import.fixture.ts +43 -0
- package/src/browser/profile/electron-link.fixture.ts +137 -0
- package/src/browser/profile/extension-api/action.ts +276 -0
- package/src/browser/profile/extension-api/api.ts +112 -0
- package/src/browser/profile/extension-api/app-badge.js +19 -0
- package/src/browser/profile/extension-api/context-menus.ts +327 -0
- package/src/browser/profile/extension-api/cookies.ts +192 -0
- package/src/browser/profile/extension-api/event-page.ts +73 -0
- package/src/browser/profile/extension-api/frame-styles.js +46 -0
- package/src/browser/profile/extension-api/host.ts +291 -0
- package/src/browser/profile/extension-api/index.ts +119 -0
- package/src/browser/profile/extension-api/label.ts +4 -0
- package/src/browser/profile/extension-api/manifest.ts +76 -0
- package/src/browser/profile/extension-api/match-pattern.ts +98 -0
- package/src/browser/profile/extension-api/notifications.ts +100 -0
- package/src/browser/profile/extension-api/permissions.ts +51 -0
- package/src/browser/profile/extension-api/popup.ts +200 -0
- package/src/browser/profile/extension-api/preload.js +203 -0
- package/src/browser/profile/extension-api/resource.ts +36 -0
- package/src/browser/profile/extension-api/storage-sync.ts +167 -0
- package/src/browser/profile/extension-api/stubs.ts +152 -0
- package/src/browser/profile/extension-api/styles.ts +230 -0
- package/src/browser/profile/extension-api/tab-activity.ts +23 -0
- package/src/browser/profile/extension-api/tabs.ts +545 -0
- package/src/browser/profile/extension-api/web-navigation.ts +172 -0
- package/src/browser/profile/extension-api/worker-events.ts +114 -0
- package/src/browser/profile/extensions.ts +491 -0
- package/src/browser/profile/filter-startup.fixture.ts +111 -0
- package/src/browser/profile/filter-startup.ts +178 -0
- package/src/browser/profile/firefox.ts +119 -0
- package/src/browser/profile/history.ts +146 -0
- package/src/browser/profile/import.ts +37 -0
- package/src/browser/profile/index.ts +694 -0
- package/src/browser/profile/install.ts +131 -0
- package/src/browser/profile/integrity.ts +56 -0
- package/src/browser/profile/ipc.ts +306 -0
- package/src/browser/profile/link-machine.ts +183 -0
- package/src/browser/profile/link.ts +335 -0
- package/src/browser/profile/made-up-firefox.fixture.ts +67 -0
- package/src/browser/profile/previews.ts +70 -0
- package/src/browser/profile/probe.ts +43 -0
- package/src/browser/profile/range.ts +14 -0
- package/src/browser/profile/review.ts +38 -0
- package/src/browser/profile/safari.ts +77 -0
- package/src/browser/profile/serve.ts +117 -0
- package/src/browser/profile/sites.ts +74 -0
- package/src/browser/profile/sources.ts +682 -0
- package/src/browser/profiling-machine.ts +554 -0
- package/src/browser/profiling.ts +404 -0
- package/src/browser/prompt-gate.ts +41 -0
- package/src/browser/prompt-keys.ts +120 -0
- package/src/browser/prompt-machine.ts +242 -0
- package/src/browser/prompts.tsx +594 -0
- package/src/browser/refs.ts +65 -0
- package/src/browser/refusal-bar.tsx +163 -0
- package/src/browser/refusal-notice.ts +60 -0
- package/src/browser/remote-address.ts +1 -0
- package/src/browser/remote-preview.ts +56 -0
- package/src/browser/renderer.tsx +683 -0
- package/src/browser/restore.ts +77 -0
- package/src/browser/saved-tabs.ts +135 -0
- package/src/browser/scheme.ts +1 -0
- package/src/browser/session-guard.ts +94 -0
- package/src/browser/settings-view.ts +49 -0
- package/src/browser/settings.fixture.tsx +306 -0
- package/src/browser/settings.tsx +1036 -0
- package/src/browser/site-auth.ts +58 -0
- package/src/browser/site-chooser.fixture.tsx +222 -0
- package/src/browser/site-chooser.tsx +778 -0
- package/src/browser/site-keys.ts +35 -0
- package/src/browser/site-machine.ts +134 -0
- package/src/browser/site-permissions.ts +239 -0
- package/src/browser/site-search.ts +26 -0
- package/src/browser/snapshot.ts +440 -0
- package/src/browser/system-media.ts +80 -0
- package/src/browser/tab-openers.ts +65 -0
- package/src/browser/tabs.css +20 -0
- package/src/browser/viewport-controls-machine.ts +134 -0
- package/src/browser/viewport-controls.tsx +170 -0
- package/src/browser/viewport-handles.tsx +119 -0
- package/src/browser/viewport-layout.ts +24 -0
- package/src/browser/viewport-native.ts +99 -0
- package/src/browser/viewport-preset-menu.tsx +69 -0
- package/src/browser/viewport-presets.ts +28 -0
- package/src/browser/viewport-toolbar-machine.ts +94 -0
- package/src/browser/webauthn-gate.ts +222 -0
- package/src/browser/window-open.ts +143 -0
- package/src/browser/wire.ts +20 -0
- package/src/browser/workspace-file.ts +126 -0
- package/src/browser/workspace-pages.ts +156 -0
- package/src/btw/i18n/en.ts +12 -0
- package/src/btw/index.ts +31 -0
- package/src/btw/machine.ts +341 -0
- package/src/btw/model.ts +222 -0
- package/src/btw/panel.tsx +229 -0
- package/src/btw/renderer.tsx +125 -0
- package/src/context/catalog-machine.ts +153 -0
- package/src/context/catalog.ts +123 -0
- package/src/context/export.ts +57 -0
- package/src/context/format.ts +32 -0
- package/src/context/i18n/am.ts +31 -0
- package/src/context/i18n/ar.ts +31 -0
- package/src/context/i18n/az.ts +31 -0
- package/src/context/i18n/bg.ts +31 -0
- package/src/context/i18n/bn.ts +31 -0
- package/src/context/i18n/br.ts +31 -0
- package/src/context/i18n/bs.ts +31 -0
- package/src/context/i18n/ca.ts +31 -0
- package/src/context/i18n/cs.ts +31 -0
- package/src/context/i18n/da.ts +31 -0
- package/src/context/i18n/de.ts +31 -0
- package/src/context/i18n/dv.ts +31 -0
- package/src/context/i18n/dz.ts +31 -0
- package/src/context/i18n/el.ts +31 -0
- package/src/context/i18n/en.ts +31 -0
- package/src/context/i18n/es.ts +31 -0
- package/src/context/i18n/et.ts +31 -0
- package/src/context/i18n/fa.ts +31 -0
- package/src/context/i18n/fi.ts +31 -0
- package/src/context/i18n/fo.ts +31 -0
- package/src/context/i18n/fr.ts +31 -0
- package/src/context/i18n/he.ts +31 -0
- package/src/context/i18n/hi.ts +31 -0
- package/src/context/i18n/hr.ts +31 -0
- package/src/context/i18n/hu.ts +31 -0
- package/src/context/i18n/hy.ts +31 -0
- package/src/context/i18n/id.ts +31 -0
- package/src/context/i18n/is.ts +31 -0
- package/src/context/i18n/it.ts +31 -0
- package/src/context/i18n/ja.ts +31 -0
- package/src/context/i18n/ka.ts +31 -0
- package/src/context/i18n/km.ts +31 -0
- package/src/context/i18n/ko.ts +31 -0
- package/src/context/i18n/lo.ts +31 -0
- package/src/context/i18n/lt.ts +31 -0
- package/src/context/i18n/lv.ts +31 -0
- package/src/context/i18n/mk.ts +31 -0
- package/src/context/i18n/mn.ts +31 -0
- package/src/context/i18n/ms.ts +31 -0
- package/src/context/i18n/my.ts +31 -0
- package/src/context/i18n/ne.ts +31 -0
- package/src/context/i18n/nl.ts +31 -0
- package/src/context/i18n/no.ts +31 -0
- package/src/context/i18n/pa.ts +31 -0
- package/src/context/i18n/pl.ts +31 -0
- package/src/context/i18n/ro.ts +31 -0
- package/src/context/i18n/ru.ts +31 -0
- package/src/context/i18n/si.ts +31 -0
- package/src/context/i18n/sk.ts +31 -0
- package/src/context/i18n/sl.ts +31 -0
- package/src/context/i18n/sq.ts +31 -0
- package/src/context/i18n/sr.ts +31 -0
- package/src/context/i18n/sv.ts +31 -0
- package/src/context/i18n/tg.ts +31 -0
- package/src/context/i18n/th.ts +31 -0
- package/src/context/i18n/tk.ts +31 -0
- package/src/context/i18n/tr.ts +31 -0
- package/src/context/i18n/uk.ts +31 -0
- package/src/context/i18n/ur.ts +31 -0
- package/src/context/i18n/uz.ts +31 -0
- package/src/context/i18n/vi.ts +31 -0
- package/src/context/i18n/zh.ts +31 -0
- package/src/context/i18n/zht.ts +31 -0
- package/src/context/index.ts +71 -0
- package/src/context/indicator.tsx +199 -0
- package/src/context/machine.ts +271 -0
- package/src/context/renderer.tsx +72 -0
- package/src/context/tab.tsx +439 -0
- package/src/debug/bar.tsx +409 -0
- package/src/debug/contract.ts +45 -0
- package/src/debug/focus-machine.ts +84 -0
- package/src/debug/heap-machine.ts +229 -0
- package/src/debug/i18n/am.ts +50 -0
- package/src/debug/i18n/ar.ts +50 -0
- package/src/debug/i18n/az.ts +50 -0
- package/src/debug/i18n/bg.ts +53 -0
- package/src/debug/i18n/bn.ts +50 -0
- package/src/debug/i18n/br.ts +51 -0
- package/src/debug/i18n/bs.ts +52 -0
- package/src/debug/i18n/ca.ts +53 -0
- package/src/debug/i18n/cs.ts +52 -0
- package/src/debug/i18n/da.ts +51 -0
- package/src/debug/i18n/de.ts +50 -0
- package/src/debug/i18n/dv.ts +51 -0
- package/src/debug/i18n/dz.ts +52 -0
- package/src/debug/i18n/el.ts +54 -0
- package/src/debug/i18n/en.ts +50 -0
- package/src/debug/i18n/es.ts +52 -0
- package/src/debug/i18n/et.ts +50 -0
- package/src/debug/i18n/fa.ts +50 -0
- package/src/debug/i18n/fi.ts +50 -0
- package/src/debug/i18n/fo.ts +50 -0
- package/src/debug/i18n/fr.ts +52 -0
- package/src/debug/i18n/he.ts +50 -0
- package/src/debug/i18n/hi.ts +50 -0
- package/src/debug/i18n/hr.ts +52 -0
- package/src/debug/i18n/hu.ts +52 -0
- package/src/debug/i18n/hy.ts +52 -0
- package/src/debug/i18n/id.ts +51 -0
- package/src/debug/i18n/is.ts +50 -0
- package/src/debug/i18n/it.ts +52 -0
- package/src/debug/i18n/ja.ts +50 -0
- package/src/debug/i18n/ka.ts +50 -0
- package/src/debug/i18n/km.ts +50 -0
- package/src/debug/i18n/ko.ts +50 -0
- package/src/debug/i18n/lo.ts +50 -0
- package/src/debug/i18n/lt.ts +51 -0
- package/src/debug/i18n/lv.ts +50 -0
- package/src/debug/i18n/mk.ts +53 -0
- package/src/debug/i18n/mn.ts +52 -0
- package/src/debug/i18n/ms.ts +51 -0
- package/src/debug/i18n/my.ts +53 -0
- package/src/debug/i18n/ne.ts +50 -0
- package/src/debug/i18n/nl.ts +50 -0
- package/src/debug/i18n/no.ts +50 -0
- package/src/debug/i18n/pa.ts +50 -0
- package/src/debug/i18n/pl.ts +51 -0
- package/src/debug/i18n/ro.ts +52 -0
- package/src/debug/i18n/ru.ts +51 -0
- package/src/debug/i18n/si.ts +50 -0
- package/src/debug/i18n/sk.ts +52 -0
- package/src/debug/i18n/sl.ts +50 -0
- package/src/debug/i18n/sq.ts +52 -0
- package/src/debug/i18n/sr.ts +52 -0
- package/src/debug/i18n/sv.ts +51 -0
- package/src/debug/i18n/tg.ts +51 -0
- package/src/debug/i18n/th.ts +50 -0
- package/src/debug/i18n/tk.ts +51 -0
- package/src/debug/i18n/tr.ts +50 -0
- package/src/debug/i18n/uk.ts +50 -0
- package/src/debug/i18n/ur.ts +50 -0
- package/src/debug/i18n/uz.ts +51 -0
- package/src/debug/i18n/vi.ts +51 -0
- package/src/debug/i18n/zh.ts +49 -0
- package/src/debug/i18n/zht.ts +50 -0
- package/src/debug/index.ts +79 -0
- package/src/debug/main.ts +417 -0
- package/src/debug/memory-infra.ts +159 -0
- package/src/debug/memory-log.ts +65 -0
- package/src/debug/memory-machine.ts +151 -0
- package/src/debug/memory-record.ts +36 -0
- package/src/debug/motion-machine.ts +229 -0
- package/src/debug/motion.tsx +697 -0
- package/src/debug/options.ts +15 -0
- package/src/debug/renderer.tsx +185 -0
- package/src/debug/server-heap.ts +63 -0
- package/src/debug/signal.ts +13 -0
- package/src/details/config-action-machine.ts +107 -0
- package/src/details/config-file.ts +43 -0
- package/src/details/details.css +555 -0
- package/src/details/flyout-machine.ts +252 -0
- package/src/details/flyout-motion.ts +26 -0
- package/src/details/i18n/am.ts +68 -0
- package/src/details/i18n/ar.ts +71 -0
- package/src/details/i18n/az.ts +71 -0
- package/src/details/i18n/bg.ts +73 -0
- package/src/details/i18n/bn.ts +71 -0
- package/src/details/i18n/br.ts +71 -0
- package/src/details/i18n/bs.ts +72 -0
- package/src/details/i18n/ca.ts +72 -0
- package/src/details/i18n/cs.ts +71 -0
- package/src/details/i18n/da.ts +71 -0
- package/src/details/i18n/de.ts +73 -0
- package/src/details/i18n/dv.ts +73 -0
- package/src/details/i18n/dz.ts +72 -0
- package/src/details/i18n/el.ts +73 -0
- package/src/details/i18n/en.ts +71 -0
- package/src/details/i18n/es.ts +72 -0
- package/src/details/i18n/et.ts +72 -0
- package/src/details/i18n/fa.ts +71 -0
- package/src/details/i18n/fi.ts +71 -0
- package/src/details/i18n/fo.ts +72 -0
- package/src/details/i18n/fr.ts +73 -0
- package/src/details/i18n/he.ts +71 -0
- package/src/details/i18n/hi.ts +71 -0
- package/src/details/i18n/hr.ts +72 -0
- package/src/details/i18n/hu.ts +72 -0
- package/src/details/i18n/hy.ts +72 -0
- package/src/details/i18n/id.ts +71 -0
- package/src/details/i18n/is.ts +71 -0
- package/src/details/i18n/it.ts +73 -0
- package/src/details/i18n/ja.ts +71 -0
- package/src/details/i18n/ka.ts +72 -0
- package/src/details/i18n/km.ts +72 -0
- package/src/details/i18n/ko.ts +71 -0
- package/src/details/i18n/lo.ts +72 -0
- package/src/details/i18n/lt.ts +72 -0
- package/src/details/i18n/lv.ts +72 -0
- package/src/details/i18n/mk.ts +73 -0
- package/src/details/i18n/mn.ts +71 -0
- package/src/details/i18n/ms.ts +71 -0
- package/src/details/i18n/my.ts +72 -0
- package/src/details/i18n/ne.ts +71 -0
- package/src/details/i18n/nl.ts +71 -0
- package/src/details/i18n/no.ts +71 -0
- package/src/details/i18n/pa.ts +71 -0
- package/src/details/i18n/pl.ts +72 -0
- package/src/details/i18n/ro.ts +72 -0
- package/src/details/i18n/ru.ts +72 -0
- package/src/details/i18n/si.ts +71 -0
- package/src/details/i18n/sk.ts +71 -0
- package/src/details/i18n/sl.ts +73 -0
- package/src/details/i18n/sq.ts +71 -0
- package/src/details/i18n/sr.ts +72 -0
- package/src/details/i18n/sv.ts +72 -0
- package/src/details/i18n/tg.ts +71 -0
- package/src/details/i18n/th.ts +72 -0
- package/src/details/i18n/tk.ts +72 -0
- package/src/details/i18n/tr.ts +71 -0
- package/src/details/i18n/uk.ts +71 -0
- package/src/details/i18n/ur.ts +71 -0
- package/src/details/i18n/uz.ts +72 -0
- package/src/details/i18n/vi.ts +71 -0
- package/src/details/i18n/zh.ts +69 -0
- package/src/details/i18n/zht.ts +70 -0
- package/src/details/index.ts +71 -0
- package/src/details/location-menu.tsx +82 -0
- package/src/details/location-workspace.tsx +39 -0
- package/src/details/mcp-machine.ts +278 -0
- package/src/details/panel.tsx +27 -0
- package/src/details/paths.ts +17 -0
- package/src/details/popover-machine.ts +97 -0
- package/src/details/popover.tsx +179 -0
- package/src/details/renderer.tsx +99 -0
- package/src/details/server-panel.tsx +1632 -0
- package/src/details/service-load-machine.ts +246 -0
- package/src/details/workspace-menu.tsx +490 -0
- package/src/details/workspace-move-machine.ts +643 -0
- package/src/file/apps.ts +25 -0
- package/src/file/arrival-guard-machine.ts +59 -0
- package/src/file/artifact-toolbar.tsx +161 -0
- package/src/file/artifact-view-machine.ts +396 -0
- package/src/file/artifact-view.css +336 -0
- package/src/file/artifact-view.tsx +1031 -0
- package/src/file/artifact.ts +225 -0
- package/src/file/browser.stories.tsx +57 -0
- package/src/file/browser.tsx +502 -0
- package/src/file/context.ts +67 -0
- package/src/file/contract.ts +10 -0
- package/src/file/drag.ts +35 -0
- package/src/file/find.tsx +376 -0
- package/src/file/i18n/am.ts +56 -0
- package/src/file/i18n/ar.ts +64 -0
- package/src/file/i18n/az.ts +56 -0
- package/src/file/i18n/bg.ts +56 -0
- package/src/file/i18n/bn.ts +56 -0
- package/src/file/i18n/br.ts +58 -0
- package/src/file/i18n/bs.ts +58 -0
- package/src/file/i18n/ca.ts +58 -0
- package/src/file/i18n/cs.ts +60 -0
- package/src/file/i18n/da.ts +56 -0
- package/src/file/i18n/de.ts +56 -0
- package/src/file/i18n/dv.ts +56 -0
- package/src/file/i18n/dz.ts +56 -0
- package/src/file/i18n/el.ts +56 -0
- package/src/file/i18n/en.ts +63 -0
- package/src/file/i18n/es.ts +58 -0
- package/src/file/i18n/et.ts +56 -0
- package/src/file/i18n/fa.ts +56 -0
- package/src/file/i18n/fi.ts +56 -0
- package/src/file/i18n/fo.ts +56 -0
- package/src/file/i18n/fr.ts +58 -0
- package/src/file/i18n/he.ts +58 -0
- package/src/file/i18n/hi.ts +56 -0
- package/src/file/i18n/hr.ts +58 -0
- package/src/file/i18n/hu.ts +56 -0
- package/src/file/i18n/hy.ts +56 -0
- package/src/file/i18n/id.ts +56 -0
- package/src/file/i18n/is.ts +56 -0
- package/src/file/i18n/it.ts +58 -0
- package/src/file/i18n/ja.ts +56 -0
- package/src/file/i18n/ka.ts +56 -0
- package/src/file/i18n/km.ts +56 -0
- package/src/file/i18n/ko.ts +56 -0
- package/src/file/i18n/lo.ts +56 -0
- package/src/file/i18n/lt.ts +60 -0
- package/src/file/i18n/lv.ts +58 -0
- package/src/file/i18n/mk.ts +56 -0
- package/src/file/i18n/mn.ts +56 -0
- package/src/file/i18n/ms.ts +56 -0
- package/src/file/i18n/my.ts +56 -0
- package/src/file/i18n/ne.ts +56 -0
- package/src/file/i18n/nl.ts +56 -0
- package/src/file/i18n/no.ts +56 -0
- package/src/file/i18n/pa.ts +56 -0
- package/src/file/i18n/pl.ts +60 -0
- package/src/file/i18n/ro.ts +58 -0
- package/src/file/i18n/ru.ts +60 -0
- package/src/file/i18n/si.ts +56 -0
- package/src/file/i18n/sk.ts +60 -0
- package/src/file/i18n/sl.ts +60 -0
- package/src/file/i18n/sq.ts +56 -0
- package/src/file/i18n/sr.ts +58 -0
- package/src/file/i18n/sv.ts +56 -0
- package/src/file/i18n/tg.ts +56 -0
- package/src/file/i18n/th.ts +56 -0
- package/src/file/i18n/tk.ts +56 -0
- package/src/file/i18n/tr.ts +56 -0
- package/src/file/i18n/uk.ts +60 -0
- package/src/file/i18n/ur.ts +57 -0
- package/src/file/i18n/uz.ts +56 -0
- package/src/file/i18n/vi.ts +56 -0
- package/src/file/i18n/zh.ts +56 -0
- package/src/file/i18n/zht.ts +56 -0
- package/src/file/index.ts +76 -0
- package/src/file/label.tsx +22 -0
- package/src/file/link-exists-machine.ts +137 -0
- package/src/file/link-open-machine.ts +249 -0
- package/src/file/list.tsx +224 -0
- package/src/file/mobile.css +35 -0
- package/src/file/mobile.tsx +116 -0
- package/src/file/open-in-app-machine.ts +185 -0
- package/src/file/open-in-app.tsx +395 -0
- package/src/file/path.ts +43 -0
- package/src/file/picker-machine.ts +190 -0
- package/src/file/pierre-tree-machine.ts +679 -0
- package/src/file/pierre-tree.tsx +503 -0
- package/src/file/renderer.tsx +1030 -0
- package/src/file/resolve-link.ts +152 -0
- package/src/file/scroll-machine.ts +272 -0
- package/src/file/search-machine.ts +202 -0
- package/src/file/styles.ts +5 -0
- package/src/file/tabs.css +15 -0
- package/src/file/tree-focus.css +6 -0
- package/src/file/tree-model.ts +239 -0
- package/src/file/view.tsx +572 -0
- package/src/goal/goal.css +43 -0
- package/src/goal/i18n/en.ts +12 -0
- package/src/goal/icons/active.svg +13 -0
- package/src/goal/icons/complete.svg +4 -0
- package/src/goal/icons/paused.svg +4 -0
- package/src/goal/index.ts +9 -0
- package/src/goal/machine.ts +364 -0
- package/src/goal/renderer.tsx +287 -0
- package/src/icon-name.typecheck.ts +9 -0
- package/src/main.ts +35 -0
- package/src/microsoft-office/document.tsx +436 -0
- package/src/microsoft-office/document.worker.ts +360 -0
- package/src/microsoft-office/fonts-cjk.ts +3 -0
- package/src/microsoft-office/fonts.ts +75 -0
- package/src/microsoft-office/i18n/en.ts +22 -0
- package/src/microsoft-office/index.ts +7 -0
- package/src/microsoft-office/links.ts +22 -0
- package/src/microsoft-office/office-worker.ts +124 -0
- package/src/microsoft-office/pages-machine.ts +356 -0
- package/src/microsoft-office/pages.tsx +387 -0
- package/src/microsoft-office/paper.ts +2 -0
- package/src/microsoft-office/presentation.tsx +303 -0
- package/src/microsoft-office/presentation.worker.ts +373 -0
- package/src/microsoft-office/renderer.tsx +57 -0
- package/src/microsoft-office/sheet-activate.ts +35 -0
- package/src/microsoft-office/sheet-cells.ts +188 -0
- package/src/microsoft-office/sheet-frame-machine.ts +286 -0
- package/src/microsoft-office/sheet-frame.ts +158 -0
- package/src/microsoft-office/sheet-paint.ts +357 -0
- package/src/microsoft-office/sheet-pick-machine.ts +138 -0
- package/src/microsoft-office/sheet-pointer-machine.ts +169 -0
- package/src/microsoft-office/sheet-protocol.ts +88 -0
- package/src/microsoft-office/slide-fonts-machine.ts +290 -0
- package/src/microsoft-office/slide-fonts.ts +157 -0
- package/src/microsoft-office/slide-paint-machine.ts +322 -0
- package/src/microsoft-office/slide-protocol.ts +50 -0
- package/src/microsoft-office/slide-text.ts +334 -0
- package/src/microsoft-office/spreadsheet.tsx +1165 -0
- package/src/microsoft-office/spreadsheet.worker.ts +259 -0
- package/src/microsoft-office/word-images.ts +105 -0
- package/src/microsoft-office/word-layout-machine.ts +219 -0
- package/src/microsoft-office/word-paint-machine.ts +174 -0
- package/src/microsoft-office/word-protocol.ts +78 -0
- package/src/microsoft-office/word-text.ts +260 -0
- package/src/microsoft-office/worker-machine.ts +111 -0
- package/src/microsoft-office/worker-rpc-machine.ts +336 -0
- package/src/microsoft-office/worker-rpc.fixture.ts +90 -0
- package/src/microsoft-office/worker-rpc.ts +292 -0
- package/src/pairing/contract.ts +24 -0
- package/src/pairing/copy-machine.ts +107 -0
- package/src/pairing/dialog.stories.tsx +69 -0
- package/src/pairing/dispatch.ts +42 -0
- package/src/pairing/i18n/en.ts +28 -0
- package/src/pairing/icons/pair.svg +4 -0
- package/src/pairing/index.ts +5 -0
- package/src/pairing/machine.ts +869 -0
- package/src/pairing/main-machine.ts +239 -0
- package/src/pairing/main.ts +130 -0
- package/src/pairing/page.stories.tsx +108 -0
- package/src/pairing/page.tsx +486 -0
- package/src/pairing/remote.ts +7 -0
- package/src/pairing/renderer.tsx +66 -0
- package/src/renderer.ts +55 -0
- package/src/review/contract.ts +31 -0
- package/src/review/detail-machine.ts +250 -0
- package/src/review/folder-machine.ts +404 -0
- package/src/review/i18n/am.ts +23 -0
- package/src/review/i18n/ar.ts +35 -0
- package/src/review/i18n/az.ts +23 -0
- package/src/review/i18n/bg.ts +23 -0
- package/src/review/i18n/bn.ts +23 -0
- package/src/review/i18n/br.ts +27 -0
- package/src/review/i18n/bs.ts +26 -0
- package/src/review/i18n/ca.ts +27 -0
- package/src/review/i18n/cs.ts +29 -0
- package/src/review/i18n/da.ts +23 -0
- package/src/review/i18n/de.ts +23 -0
- package/src/review/i18n/dv.ts +24 -0
- package/src/review/i18n/dz.ts +24 -0
- package/src/review/i18n/el.ts +23 -0
- package/src/review/i18n/en.ts +28 -0
- package/src/review/i18n/es.ts +27 -0
- package/src/review/i18n/et.ts +23 -0
- package/src/review/i18n/fa.ts +23 -0
- package/src/review/i18n/fi.ts +23 -0
- package/src/review/i18n/fo.ts +23 -0
- package/src/review/i18n/fr.ts +27 -0
- package/src/review/i18n/he.ts +26 -0
- package/src/review/i18n/hi.ts +23 -0
- package/src/review/i18n/hr.ts +26 -0
- package/src/review/i18n/hu.ts +23 -0
- package/src/review/i18n/hy.ts +23 -0
- package/src/review/i18n/id.ts +24 -0
- package/src/review/i18n/is.ts +23 -0
- package/src/review/i18n/it.ts +27 -0
- package/src/review/i18n/ja.ts +23 -0
- package/src/review/i18n/ka.ts +23 -0
- package/src/review/i18n/km.ts +23 -0
- package/src/review/i18n/ko.ts +23 -0
- package/src/review/i18n/lo.ts +23 -0
- package/src/review/i18n/lt.ts +29 -0
- package/src/review/i18n/lv.ts +26 -0
- package/src/review/i18n/mk.ts +23 -0
- package/src/review/i18n/mn.ts +23 -0
- package/src/review/i18n/ms.ts +24 -0
- package/src/review/i18n/my.ts +24 -0
- package/src/review/i18n/ne.ts +23 -0
- package/src/review/i18n/nl.ts +23 -0
- package/src/review/i18n/no.ts +23 -0
- package/src/review/i18n/pa.ts +23 -0
- package/src/review/i18n/pl.ts +29 -0
- package/src/review/i18n/ro.ts +26 -0
- package/src/review/i18n/ru.ts +29 -0
- package/src/review/i18n/si.ts +23 -0
- package/src/review/i18n/sk.ts +29 -0
- package/src/review/i18n/sl.ts +29 -0
- package/src/review/i18n/sq.ts +24 -0
- package/src/review/i18n/sr.ts +27 -0
- package/src/review/i18n/sv.ts +23 -0
- package/src/review/i18n/tg.ts +23 -0
- package/src/review/i18n/th.ts +23 -0
- package/src/review/i18n/tk.ts +23 -0
- package/src/review/i18n/tr.ts +23 -0
- package/src/review/i18n/uk.ts +30 -0
- package/src/review/i18n/ur.ts +23 -0
- package/src/review/i18n/uz.ts +23 -0
- package/src/review/i18n/vi.ts +24 -0
- package/src/review/i18n/zh.ts +23 -0
- package/src/review/i18n/zht.ts +23 -0
- package/src/review/index.ts +138 -0
- package/src/review/init-git-machine.ts +152 -0
- package/src/review/kinds.ts +191 -0
- package/src/review/machine.ts +274 -0
- package/src/review/mobile.tsx +91 -0
- package/src/review/model.ts +1123 -0
- package/src/review/panel.stories.tsx +50 -0
- package/src/review/panel.tsx +516 -0
- package/src/review/parts.tsx +141 -0
- package/src/review/render-machine.ts +74 -0
- package/src/review/renderer.tsx +403 -0
- package/src/review/screen-machine.ts +199 -0
- package/src/review/scroll-machine.ts +265 -0
- package/src/review/settings.tsx +28 -0
- package/src/schemes.ts +9 -0
- package/src/sources/i18n/en.ts +3 -0
- package/src/sources/index.ts +4 -0
- package/src/sources/panel.tsx +36 -0
- package/src/sources/renderer.tsx +95 -0
- package/src/ssh/add-machine.ts +63 -0
- package/src/ssh/askpass.ts +94 -0
- package/src/ssh/bootstrap.ts +160 -0
- package/src/ssh/command.ts +243 -0
- package/src/ssh/contract.ts +89 -0
- package/src/ssh/controller.ts +345 -0
- package/src/ssh/cover.tsx +66 -0
- package/src/ssh/dialog-machine.ts +249 -0
- package/src/ssh/dialog.stories.tsx +348 -0
- package/src/ssh/dialog.tsx +236 -0
- package/src/ssh/i18n/am.ts +37 -0
- package/src/ssh/i18n/ar.ts +38 -0
- package/src/ssh/i18n/az.ts +43 -0
- package/src/ssh/i18n/bg.ts +42 -0
- package/src/ssh/i18n/bn.ts +41 -0
- package/src/ssh/i18n/br.ts +43 -0
- package/src/ssh/i18n/bs.ts +43 -0
- package/src/ssh/i18n/ca.ts +43 -0
- package/src/ssh/i18n/cs.ts +43 -0
- package/src/ssh/i18n/da.ts +43 -0
- package/src/ssh/i18n/de.ts +44 -0
- package/src/ssh/i18n/dv.ts +43 -0
- package/src/ssh/i18n/dz.ts +43 -0
- package/src/ssh/i18n/el.ts +45 -0
- package/src/ssh/i18n/en.ts +40 -0
- package/src/ssh/i18n/es.ts +43 -0
- package/src/ssh/i18n/et.ts +41 -0
- package/src/ssh/i18n/fa.ts +39 -0
- package/src/ssh/i18n/fi.ts +40 -0
- package/src/ssh/i18n/fo.ts +41 -0
- package/src/ssh/i18n/fr.ts +43 -0
- package/src/ssh/i18n/he.ts +37 -0
- package/src/ssh/i18n/hi.ts +40 -0
- package/src/ssh/i18n/hr.ts +43 -0
- package/src/ssh/i18n/hu.ts +43 -0
- package/src/ssh/i18n/hy.ts +41 -0
- package/src/ssh/i18n/id.ts +42 -0
- package/src/ssh/i18n/is.ts +40 -0
- package/src/ssh/i18n/it.ts +43 -0
- package/src/ssh/i18n/ja.ts +43 -0
- package/src/ssh/i18n/ka.ts +43 -0
- package/src/ssh/i18n/km.ts +41 -0
- package/src/ssh/i18n/ko.ts +40 -0
- package/src/ssh/i18n/lo.ts +39 -0
- package/src/ssh/i18n/lt.ts +41 -0
- package/src/ssh/i18n/lv.ts +42 -0
- package/src/ssh/i18n/mk.ts +43 -0
- package/src/ssh/i18n/mn.ts +41 -0
- package/src/ssh/i18n/ms.ts +40 -0
- package/src/ssh/i18n/my.ts +41 -0
- package/src/ssh/i18n/ne.ts +39 -0
- package/src/ssh/i18n/nl.ts +43 -0
- package/src/ssh/i18n/no.ts +42 -0
- package/src/ssh/i18n/pa.ts +40 -0
- package/src/ssh/i18n/pl.ts +42 -0
- package/src/ssh/i18n/ro.ts +44 -0
- package/src/ssh/i18n/ru.ts +42 -0
- package/src/ssh/i18n/si.ts +41 -0
- package/src/ssh/i18n/sk.ts +42 -0
- package/src/ssh/i18n/sl.ts +41 -0
- package/src/ssh/i18n/sq.ts +43 -0
- package/src/ssh/i18n/sr.ts +41 -0
- package/src/ssh/i18n/sv.ts +43 -0
- package/src/ssh/i18n/tg.ts +43 -0
- package/src/ssh/i18n/th.ts +38 -0
- package/src/ssh/i18n/tk.ts +41 -0
- package/src/ssh/i18n/tr.ts +42 -0
- package/src/ssh/i18n/uk.ts +40 -0
- package/src/ssh/i18n/ur.ts +40 -0
- package/src/ssh/i18n/uz.ts +43 -0
- package/src/ssh/i18n/vi.ts +42 -0
- package/src/ssh/i18n/zh.ts +36 -0
- package/src/ssh/i18n/zht.ts +36 -0
- package/src/ssh/index.ts +71 -0
- package/src/ssh/main-machine.ts +532 -0
- package/src/ssh/main.ts +75 -0
- package/src/ssh/name.ts +28 -0
- package/src/ssh/remote-cli.ts +137 -0
- package/src/ssh/renderer.tsx +254 -0
- package/src/ssh/row.tsx +97 -0
- package/src/ssh/ssh.css +35 -0
- package/src/ssh/state.ts +217 -0
- package/src/ssh/window-machine.ts +533 -0
- package/src/terminal/connection-machine.ts +285 -0
- package/src/terminal/connection.ts +112 -0
- package/src/terminal/dispatch.ts +44 -0
- package/src/terminal/focus-machine.ts +112 -0
- package/src/terminal/focus.ts +23 -0
- package/src/terminal/hover-label.ts +20 -0
- package/src/terminal/i18n/am.ts +28 -0
- package/src/terminal/i18n/ar.ts +28 -0
- package/src/terminal/i18n/az.ts +29 -0
- package/src/terminal/i18n/bg.ts +29 -0
- package/src/terminal/i18n/bn.ts +28 -0
- package/src/terminal/i18n/br.ts +29 -0
- package/src/terminal/i18n/bs.ts +29 -0
- package/src/terminal/i18n/ca.ts +28 -0
- package/src/terminal/i18n/cs.ts +28 -0
- package/src/terminal/i18n/da.ts +28 -0
- package/src/terminal/i18n/de.ts +29 -0
- package/src/terminal/i18n/dv.ts +28 -0
- package/src/terminal/i18n/dz.ts +28 -0
- package/src/terminal/i18n/el.ts +30 -0
- package/src/terminal/i18n/en.ts +30 -0
- package/src/terminal/i18n/es.ts +28 -0
- package/src/terminal/i18n/et.ts +28 -0
- package/src/terminal/i18n/fa.ts +28 -0
- package/src/terminal/i18n/fi.ts +29 -0
- package/src/terminal/i18n/fo.ts +28 -0
- package/src/terminal/i18n/fr.ts +29 -0
- package/src/terminal/i18n/he.ts +28 -0
- package/src/terminal/i18n/hi.ts +28 -0
- package/src/terminal/i18n/hr.ts +28 -0
- package/src/terminal/i18n/hu.ts +28 -0
- package/src/terminal/i18n/hy.ts +29 -0
- package/src/terminal/i18n/id.ts +28 -0
- package/src/terminal/i18n/is.ts +28 -0
- package/src/terminal/i18n/it.ts +28 -0
- package/src/terminal/i18n/ja.ts +29 -0
- package/src/terminal/i18n/ka.ts +29 -0
- package/src/terminal/i18n/km.ts +28 -0
- package/src/terminal/i18n/ko.ts +28 -0
- package/src/terminal/i18n/lo.ts +28 -0
- package/src/terminal/i18n/lt.ts +29 -0
- package/src/terminal/i18n/lv.ts +28 -0
- package/src/terminal/i18n/mk.ts +29 -0
- package/src/terminal/i18n/mn.ts +30 -0
- package/src/terminal/i18n/ms.ts +28 -0
- package/src/terminal/i18n/my.ts +29 -0
- package/src/terminal/i18n/ne.ts +28 -0
- package/src/terminal/i18n/nl.ts +28 -0
- package/src/terminal/i18n/no.ts +28 -0
- package/src/terminal/i18n/pa.ts +28 -0
- package/src/terminal/i18n/pl.ts +28 -0
- package/src/terminal/i18n/ro.ts +28 -0
- package/src/terminal/i18n/ru.ts +28 -0
- package/src/terminal/i18n/si.ts +28 -0
- package/src/terminal/i18n/sk.ts +28 -0
- package/src/terminal/i18n/sl.ts +28 -0
- package/src/terminal/i18n/sq.ts +29 -0
- package/src/terminal/i18n/sr.ts +28 -0
- package/src/terminal/i18n/sv.ts +28 -0
- package/src/terminal/i18n/tg.ts +29 -0
- package/src/terminal/i18n/th.ts +28 -0
- package/src/terminal/i18n/tk.ts +29 -0
- package/src/terminal/i18n/tr.ts +29 -0
- package/src/terminal/i18n/uk.ts +28 -0
- package/src/terminal/i18n/ur.ts +28 -0
- package/src/terminal/i18n/uz.ts +29 -0
- package/src/terminal/i18n/vi.ts +28 -0
- package/src/terminal/i18n/zh.ts +28 -0
- package/src/terminal/i18n/zht.ts +28 -0
- package/src/terminal/index.ts +74 -0
- package/src/terminal/inline-rename.ts +93 -0
- package/src/terminal/label.tsx +71 -0
- package/src/terminal/machine.ts +767 -0
- package/src/terminal/model.ts +661 -0
- package/src/terminal/pane-machine.ts +260 -0
- package/src/terminal/panel.tsx +280 -0
- package/src/terminal/props.ts +16 -0
- package/src/terminal/quote-machine.ts +381 -0
- package/src/terminal/quote.css +7 -0
- package/src/terminal/quote.tsx +218 -0
- package/src/terminal/rename-machine.ts +98 -0
- package/src/terminal/renderer.tsx +298 -0
- package/src/terminal/runtime-adapters.ts +34 -0
- package/src/terminal/surface-machine.ts +186 -0
- package/src/terminal/tab.tsx +112 -0
- package/src/terminal/terminal-key-event.ts +58 -0
- package/src/terminal/terminal.fixture.tsx +71 -0
- package/src/terminal/terminal.tsx +652 -0
- package/src/terminal/title.ts +41 -0
- package/src/terminal/writer.ts +87 -0
- package/src/updater/action.ts +37 -0
- package/src/updater/actions.tsx +110 -0
- package/src/updater/i18n/am.ts +40 -0
- package/src/updater/i18n/ar.ts +40 -0
- package/src/updater/i18n/az.ts +41 -0
- package/src/updater/i18n/bg.ts +40 -0
- package/src/updater/i18n/bn.ts +41 -0
- package/src/updater/i18n/br.ts +40 -0
- package/src/updater/i18n/bs.ts +41 -0
- package/src/updater/i18n/ca.ts +41 -0
- package/src/updater/i18n/cs.ts +41 -0
- package/src/updater/i18n/da.ts +40 -0
- package/src/updater/i18n/de.ts +41 -0
- package/src/updater/i18n/dv.ts +41 -0
- package/src/updater/i18n/dz.ts +42 -0
- package/src/updater/i18n/el.ts +42 -0
- package/src/updater/i18n/en.ts +42 -0
- package/src/updater/i18n/es.ts +40 -0
- package/src/updater/i18n/et.ts +40 -0
- package/src/updater/i18n/fa.ts +40 -0
- package/src/updater/i18n/fi.ts +41 -0
- package/src/updater/i18n/fo.ts +40 -0
- package/src/updater/i18n/fr.ts +41 -0
- package/src/updater/i18n/he.ts +40 -0
- package/src/updater/i18n/hi.ts +40 -0
- package/src/updater/i18n/hr.ts +41 -0
- package/src/updater/i18n/hu.ts +40 -0
- package/src/updater/i18n/hy.ts +41 -0
- package/src/updater/i18n/id.ts +41 -0
- package/src/updater/i18n/is.ts +40 -0
- package/src/updater/i18n/it.ts +40 -0
- package/src/updater/i18n/ja.ts +41 -0
- package/src/updater/i18n/ka.ts +40 -0
- package/src/updater/i18n/km.ts +40 -0
- package/src/updater/i18n/ko.ts +40 -0
- package/src/updater/i18n/lo.ts +40 -0
- package/src/updater/i18n/lt.ts +41 -0
- package/src/updater/i18n/lv.ts +40 -0
- package/src/updater/i18n/mk.ts +41 -0
- package/src/updater/i18n/mn.ts +40 -0
- package/src/updater/i18n/ms.ts +41 -0
- package/src/updater/i18n/my.ts +40 -0
- package/src/updater/i18n/ne.ts +40 -0
- package/src/updater/i18n/nl.ts +41 -0
- package/src/updater/i18n/no.ts +40 -0
- package/src/updater/i18n/pa.ts +40 -0
- package/src/updater/i18n/pl.ts +41 -0
- package/src/updater/i18n/ro.ts +41 -0
- package/src/updater/i18n/ru.ts +40 -0
- package/src/updater/i18n/si.ts +40 -0
- package/src/updater/i18n/sk.ts +41 -0
- package/src/updater/i18n/sl.ts +40 -0
- package/src/updater/i18n/sq.ts +40 -0
- package/src/updater/i18n/sr.ts +41 -0
- package/src/updater/i18n/sv.ts +40 -0
- package/src/updater/i18n/tg.ts +41 -0
- package/src/updater/i18n/th.ts +40 -0
- package/src/updater/i18n/tk.ts +40 -0
- package/src/updater/i18n/tr.ts +40 -0
- package/src/updater/i18n/uk.ts +40 -0
- package/src/updater/i18n/ur.ts +40 -0
- package/src/updater/i18n/uz.ts +41 -0
- package/src/updater/i18n/vi.ts +41 -0
- package/src/updater/i18n/zh.ts +40 -0
- package/src/updater/i18n/zht.ts +40 -0
- package/src/updater/index.ts +94 -0
- package/src/updater/log.ts +41 -0
- package/src/updater/machine.ts +919 -0
- package/src/updater/main.ts +138 -0
- package/src/updater/platform.ts +160 -0
- package/src/updater/renderer.tsx +203 -0
- package/src/updater/section.tsx +65 -0
- package/src/updater/web-driver.ts +200 -0
- package/src/updater/web-machine.ts +222 -0
- package/src/updater/web.tsx +103 -0
- package/src/updater/whats-new-machine.ts +97 -0
- package/src/updater/whats-new.stories.tsx +38 -0
- package/src/updater/whats-new.tsx +304 -0
- package/src/updater/window-machine.ts +73 -0
- package/src/wsl/add-machine.ts +56 -0
- package/src/wsl/contract.ts +104 -0
- package/src/wsl/dialog-machine.ts +322 -0
- package/src/wsl/dialog.css +372 -0
- package/src/wsl/dialog.tsx +492 -0
- package/src/wsl/i18n/am.ts +53 -0
- package/src/wsl/i18n/ar.ts +55 -0
- package/src/wsl/i18n/az.ts +57 -0
- package/src/wsl/i18n/bg.ts +58 -0
- package/src/wsl/i18n/bn.ts +56 -0
- package/src/wsl/i18n/br.ts +58 -0
- package/src/wsl/i18n/bs.ts +58 -0
- package/src/wsl/i18n/ca.ts +58 -0
- package/src/wsl/i18n/cs.ts +57 -0
- package/src/wsl/i18n/da.ts +57 -0
- package/src/wsl/i18n/de.ts +59 -0
- package/src/wsl/i18n/dv.ts +58 -0
- package/src/wsl/i18n/dz.ts +59 -0
- package/src/wsl/i18n/el.ts +57 -0
- package/src/wsl/i18n/en.ts +55 -0
- package/src/wsl/i18n/es.ts +58 -0
- package/src/wsl/i18n/et.ts +55 -0
- package/src/wsl/i18n/fa.ts +56 -0
- package/src/wsl/i18n/fi.ts +57 -0
- package/src/wsl/i18n/fo.ts +56 -0
- package/src/wsl/i18n/fr.ts +57 -0
- package/src/wsl/i18n/he.ts +54 -0
- package/src/wsl/i18n/hi.ts +57 -0
- package/src/wsl/i18n/hr.ts +58 -0
- package/src/wsl/i18n/hu.ts +58 -0
- package/src/wsl/i18n/hy.ts +57 -0
- package/src/wsl/i18n/id.ts +56 -0
- package/src/wsl/i18n/is.ts +55 -0
- package/src/wsl/i18n/it.ts +57 -0
- package/src/wsl/i18n/ja.ts +57 -0
- package/src/wsl/i18n/ka.ts +56 -0
- package/src/wsl/i18n/km.ts +57 -0
- package/src/wsl/i18n/ko.ts +56 -0
- package/src/wsl/i18n/lo.ts +54 -0
- package/src/wsl/i18n/lt.ts +57 -0
- package/src/wsl/i18n/lv.ts +57 -0
- package/src/wsl/i18n/mk.ts +57 -0
- package/src/wsl/i18n/mn.ts +58 -0
- package/src/wsl/i18n/ms.ts +57 -0
- package/src/wsl/i18n/my.ts +57 -0
- package/src/wsl/i18n/ne.ts +57 -0
- package/src/wsl/i18n/nl.ts +57 -0
- package/src/wsl/i18n/no.ts +57 -0
- package/src/wsl/i18n/pa.ts +57 -0
- package/src/wsl/i18n/pl.ts +58 -0
- package/src/wsl/i18n/ro.ts +56 -0
- package/src/wsl/i18n/ru.ts +57 -0
- package/src/wsl/i18n/si.ts +56 -0
- package/src/wsl/i18n/sk.ts +57 -0
- package/src/wsl/i18n/sl.ts +57 -0
- package/src/wsl/i18n/sq.ts +56 -0
- package/src/wsl/i18n/sr.ts +57 -0
- package/src/wsl/i18n/sv.ts +58 -0
- package/src/wsl/i18n/tg.ts +57 -0
- package/src/wsl/i18n/th.ts +57 -0
- package/src/wsl/i18n/tk.ts +56 -0
- package/src/wsl/i18n/tr.ts +57 -0
- package/src/wsl/i18n/uk.ts +57 -0
- package/src/wsl/i18n/ur.ts +57 -0
- package/src/wsl/i18n/uz.ts +57 -0
- package/src/wsl/i18n/vi.ts +56 -0
- package/src/wsl/i18n/zh.ts +53 -0
- package/src/wsl/i18n/zht.ts +53 -0
- package/src/wsl/index.ts +72 -0
- package/src/wsl/local.ts +41 -0
- package/src/wsl/machine.ts +652 -0
- package/src/wsl/main.ts +95 -0
- package/src/wsl/model.ts +369 -0
- package/src/wsl/probe-machine.ts +143 -0
- package/src/wsl/probes.ts +107 -0
- package/src/wsl/remote-cli.ts +49 -0
- package/src/wsl/renderer.tsx +164 -0
- package/src/wsl/row-view.ts +25 -0
- package/src/wsl/row.tsx +76 -0
- package/src/wsl/runtime.ts +441 -0
- package/src/wsl/servers.ts +330 -0
- package/src/wsl/sidecar.ts +186 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1,2029 @@
|
|
|
1
|
+
import { Popover } from "@kobalte/core/popover"
|
|
2
|
+
import { Button } from "@zyro-sec/ui/button"
|
|
3
|
+
import { Icon } from "@zyro-sec/ui/icon"
|
|
4
|
+
import type { IconName } from "@zyro-sec/ui/icons/catalog"
|
|
5
|
+
import { IconButton } from "@zyro-sec/ui/icon-button"
|
|
6
|
+
import { LineCommentEditor } from "@zyro-sec/ui/line-comment"
|
|
7
|
+
import { Loader } from "@zyro-sec/ui/loader"
|
|
8
|
+
import { Keybind } from "@zyro-sec/ui/keybind"
|
|
9
|
+
import { Menu } from "@zyro-sec/ui/menu"
|
|
10
|
+
import { MenuScroll } from "@zyro-sec/ui/menu-scroll"
|
|
11
|
+
import { showToast } from "@zyro-sec/ui/toast"
|
|
12
|
+
import { Tooltip } from "@zyro-sec/ui/tooltip"
|
|
13
|
+
import { createEventListener } from "@solid-primitives/event-listener"
|
|
14
|
+
import { createResizeObserver } from "@solid-primitives/resize-observer"
|
|
15
|
+
import { debounce } from "@solid-primitives/scheduled"
|
|
16
|
+
import {
|
|
17
|
+
createMemo,
|
|
18
|
+
createSignal,
|
|
19
|
+
For,
|
|
20
|
+
getOwner,
|
|
21
|
+
Index,
|
|
22
|
+
onCleanup,
|
|
23
|
+
onMount,
|
|
24
|
+
runWithOwner,
|
|
25
|
+
Show,
|
|
26
|
+
untrack,
|
|
27
|
+
type Accessor,
|
|
28
|
+
type JSX,
|
|
29
|
+
type ParentProps,
|
|
30
|
+
} from "solid-js"
|
|
31
|
+
import type { Browser } from "@zyro-sec/plugin-browser/rpc"
|
|
32
|
+
import {
|
|
33
|
+
createKeyed,
|
|
34
|
+
usePlugin,
|
|
35
|
+
usePanel,
|
|
36
|
+
type ComposerNote,
|
|
37
|
+
type PanelTab,
|
|
38
|
+
type MountedSession,
|
|
39
|
+
type SessionScreen,
|
|
40
|
+
} from "@zyro-sec/plugin/gui"
|
|
41
|
+
import { addressParts, connection, externalAction, externalPage, loopback } from "./address"
|
|
42
|
+
import { hostDisplay } from "./host-display"
|
|
43
|
+
import { FileSource } from "../file/contract"
|
|
44
|
+
import { remotePath, workspacePrefix } from "./remote-address"
|
|
45
|
+
import {
|
|
46
|
+
addressRows,
|
|
47
|
+
addressView,
|
|
48
|
+
initialAddressState,
|
|
49
|
+
nextAddressEpoch,
|
|
50
|
+
transitionAddress,
|
|
51
|
+
type AddressEpoch,
|
|
52
|
+
type AddressEvent,
|
|
53
|
+
type AddressRow,
|
|
54
|
+
} from "./address-machine"
|
|
55
|
+
import { commentNote, pageNote } from "./comment"
|
|
56
|
+
import { Glyph } from "./choices"
|
|
57
|
+
import type { HistoryPage } from "./history/ipc"
|
|
58
|
+
import { markMatches, parseQuery, type Query } from "./history/match"
|
|
59
|
+
import { bare } from "./history/page"
|
|
60
|
+
import { SignInOffer } from "./import-prompt"
|
|
61
|
+
import { SiteChooserDialog } from "./site-chooser"
|
|
62
|
+
import type definition from "./index"
|
|
63
|
+
import type { Model } from "./model"
|
|
64
|
+
import {
|
|
65
|
+
capturesEscape,
|
|
66
|
+
initialOverlayState,
|
|
67
|
+
overlayComment,
|
|
68
|
+
overlayNote,
|
|
69
|
+
overlayView,
|
|
70
|
+
transitionOverlay,
|
|
71
|
+
type OverlayContext,
|
|
72
|
+
type OverlayEvent,
|
|
73
|
+
} from "./overlay-machine"
|
|
74
|
+
import { PageIcon } from "./page-icon"
|
|
75
|
+
import { loadFailure } from "./failure"
|
|
76
|
+
import { FailureBar, FailurePage } from "./failure-view"
|
|
77
|
+
import { FindBar } from "./find-bar"
|
|
78
|
+
import { RefusalBar } from "./refusal-bar"
|
|
79
|
+
import type { FindAction, PromptAnswer } from "./ipc"
|
|
80
|
+
import { blocking, PromptBar, PromptDialog } from "./prompts"
|
|
81
|
+
import { BrowserProfile, type ProfileExtension } from "./profile/ipc"
|
|
82
|
+
import { ViewportControls } from "./viewport-controls"
|
|
83
|
+
import {
|
|
84
|
+
initialViewportToolbar,
|
|
85
|
+
transitionViewportToolbar,
|
|
86
|
+
viewportToolbarAvailable,
|
|
87
|
+
viewportToolbarView,
|
|
88
|
+
type ViewportToolbarEvent,
|
|
89
|
+
} from "./viewport-toolbar-machine"
|
|
90
|
+
import { viewportLayout } from "./viewport-layout"
|
|
91
|
+
import { ViewportHandles } from "./viewport-handles"
|
|
92
|
+
import {
|
|
93
|
+
initialSiteState,
|
|
94
|
+
SITE_CLEAR_TIMEOUT_MS,
|
|
95
|
+
SITE_LOAD_TIMEOUT_MS,
|
|
96
|
+
siteView,
|
|
97
|
+
transitionSite,
|
|
98
|
+
type SiteEffect,
|
|
99
|
+
type SiteEvent,
|
|
100
|
+
} from "./site-machine"
|
|
101
|
+
|
|
102
|
+
const RECENT = 5
|
|
103
|
+
|
|
104
|
+
/** How long a notice about a command that did not work stays before it goes by itself. */
|
|
105
|
+
const FAILURE_NOTICE_MS = 8_000
|
|
106
|
+
|
|
107
|
+
const sendLabels = { send: "comment.send", steer: "comment.steer", queue: "comment.queue" } as const
|
|
108
|
+
|
|
109
|
+
const mac = /(Mac|iPhone|iPad)/.test(navigator.platform)
|
|
110
|
+
|
|
111
|
+
/** An element a component reads after render, such as a button a native view anchors to. */
|
|
112
|
+
type ElementRef = { element?: HTMLElement }
|
|
113
|
+
|
|
114
|
+
/** The site information's two controls that lead to its other view; each takes the keyboard when the view changes. */
|
|
115
|
+
type SiteViews = { open?: HTMLButtonElement; back?: HTMLButtonElement }
|
|
116
|
+
|
|
117
|
+
export default function SessionBrowserPane(props: {
|
|
118
|
+
tab: Accessor<PanelTab>
|
|
119
|
+
session: MountedSession
|
|
120
|
+
screen: SessionScreen
|
|
121
|
+
model: Model
|
|
122
|
+
}) {
|
|
123
|
+
const plugin = usePlugin<typeof definition>()
|
|
124
|
+
const keybinds = plugin.keybinds
|
|
125
|
+
const desktop = plugin.desktop
|
|
126
|
+
const embeds = plugin.embeds
|
|
127
|
+
const system = plugin.system
|
|
128
|
+
const panel = usePanel()
|
|
129
|
+
const visible = () => panel.visible()
|
|
130
|
+
const state = () => props.model.tab(props.session, props.tab().id)
|
|
131
|
+
const address = () => (state()?.url === "about:blank" ? "" : (state()?.url ?? ""))
|
|
132
|
+
const failed = () => !!state()?.loadError
|
|
133
|
+
|
|
134
|
+
// The page that did not load, as the page area explains it.
|
|
135
|
+
const loadFailed = createMemo(() => {
|
|
136
|
+
const error = state()?.loadError
|
|
137
|
+
|
|
138
|
+
return error === undefined ? undefined : loadFailure(error)
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
const serverFile = () => /^(workspace|artifact):/.test(address())
|
|
142
|
+
const offline = () => serverFile() && !props.session.server.connected
|
|
143
|
+
const suspended = () => offline() || props.model.suspended(props.session)
|
|
144
|
+
const command = (action: Browser.Action) => props.model.command(props.session, action)
|
|
145
|
+
const profile = plugin.use(BrowserProfile)
|
|
146
|
+
const fileSource = plugin.use(FileSource)
|
|
147
|
+
|
|
148
|
+
const sourcePath = () => {
|
|
149
|
+
const url = address()
|
|
150
|
+
|
|
151
|
+
if (!url.startsWith("file:///")) {
|
|
152
|
+
const prefix = workspacePrefix(props.session.id ?? "")
|
|
153
|
+
|
|
154
|
+
return remotePath(url, prefix) ? url.slice(prefix.length).split(/[?#]/, 1)[0] : undefined
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return url
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const source = () => {
|
|
161
|
+
const provider = fileSource()
|
|
162
|
+
const path = sourcePath()
|
|
163
|
+
|
|
164
|
+
return provider.status === "active" && path ? () => provider.value.open(props.session, path) : undefined
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// The pane offers to import sign-ins until the user imports or declines once, and keeps the offer's confirmation of
|
|
168
|
+
// an import until the user closes it.
|
|
169
|
+
const [confirming, setConfirming] = createSignal(false)
|
|
170
|
+
const offering = () => !plugin.stores.preferences.value.welcomed || confirming()
|
|
171
|
+
|
|
172
|
+
const extensions = () => {
|
|
173
|
+
const current = profile()
|
|
174
|
+
|
|
175
|
+
return current.status === "active" ? (current.value.state()?.extensions ?? []) : []
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// The extensions button, which an extension's popup opens under.
|
|
179
|
+
const extensionsButton: ElementRef = {}
|
|
180
|
+
|
|
181
|
+
// An extension's button opens its popup or tells it of the click; one without a button opens its options page.
|
|
182
|
+
const chooseExtension = (extension: ProfileExtension) => {
|
|
183
|
+
if (!visible()) return
|
|
184
|
+
const current = profile()
|
|
185
|
+
const rect = extensionsButton.element?.getBoundingClientRect()
|
|
186
|
+
// Where the page area starts, under the toolbar and any bar below it: a popup starts there too, as in every
|
|
187
|
+
// browser. A device viewport sits inside that area, smaller and inset, and the popup belongs to the button in
|
|
188
|
+
// the toolbar, not to the device: it stays under the bars and may cover the device's page.
|
|
189
|
+
const pageTop = preview?.getBoundingClientRect().top
|
|
190
|
+
const binding = props.model.binding(props.session)
|
|
191
|
+
const tab = state()
|
|
192
|
+
|
|
193
|
+
const fallback = () => {
|
|
194
|
+
const page = extension.options ?? extension.popup
|
|
195
|
+
|
|
196
|
+
if (page) props.model.openURL(props.session, page)
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (current.status !== "active" || !rect || pageTop === undefined || !binding || !tab) return fallback()
|
|
200
|
+
const anchor = { x: rect.x, y: rect.y, width: rect.width, height: rect.height }
|
|
201
|
+
// In a right-to-left layout the button is at the left end of the bar, and the popup opens to its right.
|
|
202
|
+
const rtl = !!extensionsButton.element?.matches(":dir(rtl)")
|
|
203
|
+
void current.value.click({ id: extension.id, binding, tabID: tab.id, anchor, pageTop, rtl }).then((handled) => {
|
|
204
|
+
if (!handled) fallback()
|
|
205
|
+
}, fallback)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const page = () => {
|
|
209
|
+
const tab = state()
|
|
210
|
+
|
|
211
|
+
return tab ? props.model.page(props.session, tab.id) : undefined
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const [addressState, setAddressState] = createSignal(initialAddressState)
|
|
215
|
+
const [available, setAvailable] = createSignal({ width: 0, height: 0 })
|
|
216
|
+
const [toolbar, setToolbar] = createSignal(initialViewportToolbar)
|
|
217
|
+
const [overlay, setOverlay] = createSignal(initialOverlayState)
|
|
218
|
+
|
|
219
|
+
// The page's reports, counted; a submitted address in the field ends at the next one.
|
|
220
|
+
const epoch = createMemo((previous: AddressEpoch | undefined) =>
|
|
221
|
+
nextAddressEpoch(previous, {
|
|
222
|
+
tabID: state()?.id,
|
|
223
|
+
url: address(),
|
|
224
|
+
loading: !!state()?.loading,
|
|
225
|
+
generation: state()?.generation ?? 0,
|
|
226
|
+
error: props.model.error(props.session),
|
|
227
|
+
}),
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
// The list follows what the user typed; a focused address is not a query.
|
|
231
|
+
const rows = createMemo(() => addressRows(addressState(), props.model.visits()))
|
|
232
|
+
const addressBar = createMemo(() => addressView(addressState(), epoch(), rows()))
|
|
233
|
+
// The typed words, whose matches each page of the list draws.
|
|
234
|
+
const query = createMemo(() => parseQuery(addressBar().query))
|
|
235
|
+
|
|
236
|
+
// Ends the questions to main's history that are still out when the pane goes.
|
|
237
|
+
const asking = new AbortController()
|
|
238
|
+
onCleanup(() => asking.abort())
|
|
239
|
+
|
|
240
|
+
const dispatchAddress = (event: AddressEvent, domEvent?: Event) => {
|
|
241
|
+
const next = transitionAddress(untrack(addressState), event)
|
|
242
|
+
setAddressState(next.state)
|
|
243
|
+
// The field's text is the machine's. After a key the input holds only what was typed, while the machine may show
|
|
244
|
+
// a completed address after it, or a row's text; the same text as before is not written by the binding.
|
|
245
|
+
const field = untrack(addressBar).field
|
|
246
|
+
|
|
247
|
+
if (input && input.value !== field) input.value = field
|
|
248
|
+
next.effects.forEach((effect) => {
|
|
249
|
+
if (effect.type === "select-input") return input?.select()
|
|
250
|
+
|
|
251
|
+
// The caret stays after the typed text, as Chrome's does, so the next key replaces the completed part.
|
|
252
|
+
if (effect.type === "select-completion") return input?.setSelectionRange(effect.start, input.value.length, "backward")
|
|
253
|
+
|
|
254
|
+
if (effect.type === "blur-input") return input?.blur()
|
|
255
|
+
|
|
256
|
+
if (effect.type === "prevent-default") return domEvent?.preventDefault()
|
|
257
|
+
|
|
258
|
+
if (effect.type === "forget") return props.model.forgetPage(effect.url)
|
|
259
|
+
|
|
260
|
+
if (effect.type === "prepare") return props.model.prepareHistory()
|
|
261
|
+
|
|
262
|
+
if (effect.type === "ask") {
|
|
263
|
+
// The field already shows what was typed and what the window knows; main's pages join when they come. A
|
|
264
|
+
// question main cannot answer, as on the web, is answered with none.
|
|
265
|
+
const answer = (pages: readonly HistoryPage[]) => {
|
|
266
|
+
if (!asking.signal.aborted) dispatchAddress({ type: "answered", attempt: effect.attempt, pages, visits: props.model.visits() })
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
return void props.model.searchHistory(effect.query, asking.signal).then(answer, () => answer([]))
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
command({ type: "navigate", tabID: effect.tabID, url: effect.url })
|
|
273
|
+
})
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// Editing shows the icon of what Enter would open: the chosen page's once the person typed, else the page's own.
|
|
277
|
+
const fieldIcon = () => {
|
|
278
|
+
const bar = addressBar()
|
|
279
|
+
|
|
280
|
+
if (!bar.editing || !bar.field) return undefined
|
|
281
|
+
|
|
282
|
+
if (!bar.typed) return page()?.icon
|
|
283
|
+
|
|
284
|
+
return bar.chosen?.type === "page" ? bar.chosen.page.icon : undefined
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// After a row's title: a page's address, what a search row searches with, or the typed address itself.
|
|
288
|
+
const rowDetail = (row: AddressRow) => {
|
|
289
|
+
if (row.type === "search") return plugin.t("address.search.web")
|
|
290
|
+
|
|
291
|
+
return row.type === "page" ? bare(row.url) : row.text
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// A caret or a selection that leaves the end of the text ends completing, as in Chrome: the completed address
|
|
295
|
+
// becomes part of the text, and no later answer completes text the person is working inside.
|
|
296
|
+
const caretMoved = () => {
|
|
297
|
+
const bar = untrack(addressBar)
|
|
298
|
+
|
|
299
|
+
if (!input || !bar.completing) return
|
|
300
|
+
const end = input.value.length
|
|
301
|
+
|
|
302
|
+
if (input.selectionStart === bar.field.length - bar.completion.length && input.selectionEnd === end) return
|
|
303
|
+
|
|
304
|
+
dispatchAddress({
|
|
305
|
+
type: "input.changed",
|
|
306
|
+
value: input.value,
|
|
307
|
+
completing: input.selectionStart === end && input.selectionEnd === end,
|
|
308
|
+
visits: props.model.visits(),
|
|
309
|
+
})
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
const empty = () => !address() && !state()?.loading && !addressBar().navigating
|
|
313
|
+
// The desktop page hides blank and loading documents itself; only hide here
|
|
314
|
+
// while the pane shows its own empty or failed state over the embed.
|
|
315
|
+
const shown = () => visible() && !empty() && !failed() && !suspended()
|
|
316
|
+
|
|
317
|
+
const embed = () => {
|
|
318
|
+
const tab = state()
|
|
319
|
+
|
|
320
|
+
return tab ? props.model.embed(props.session, tab.id) : undefined
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
let root: HTMLElement | undefined
|
|
324
|
+
let options: HTMLElement | undefined
|
|
325
|
+
let input: HTMLInputElement | undefined
|
|
326
|
+
let anchor: HTMLFormElement | undefined
|
|
327
|
+
let findInput: HTMLInputElement | undefined
|
|
328
|
+
|
|
329
|
+
// `tabID` is the tab whose find bar took the key or click, which answers for no other tab.
|
|
330
|
+
const find = (action: FindAction, tabID = state()?.id) => {
|
|
331
|
+
const tab = state()
|
|
332
|
+
|
|
333
|
+
// Nothing to search while a dialog blocks the page; the bar would also sit beside the dialog's focus trap.
|
|
334
|
+
if (!tab || tab.id !== tabID || (action.type !== "close" && promptKey(true))) return
|
|
335
|
+
|
|
336
|
+
if (action.type === "open" && findInput?.isConnected) {
|
|
337
|
+
findInput.focus()
|
|
338
|
+
findInput.select()
|
|
339
|
+
|
|
340
|
+
return
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
void props.model.find(props.session, tab.id, action).catch(() => showToast({ title: plugin.t("find.failed") }))
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// A command that did not work, or an address the pane refused. With no page to keep, it shows where the page would
|
|
347
|
+
// be; otherwise as a line above the page, which goes by itself unless it is a refusal the person should read.
|
|
348
|
+
const failure = createMemo(() => {
|
|
349
|
+
const tab = state()
|
|
350
|
+
|
|
351
|
+
return tab ? props.model.failure(props.session, tab.id) : undefined
|
|
352
|
+
})
|
|
353
|
+
|
|
354
|
+
const pageFailure = () => {
|
|
355
|
+
const current = failure()
|
|
356
|
+
|
|
357
|
+
return current && !current.lasting && empty() && !suspended() ? current : undefined
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
const barFailure = () => (pageFailure() ? undefined : failure())
|
|
361
|
+
|
|
362
|
+
createKeyed(
|
|
363
|
+
() => {
|
|
364
|
+
const current = barFailure()
|
|
365
|
+
|
|
366
|
+
return current && !current.lasting ? current.id : undefined
|
|
367
|
+
},
|
|
368
|
+
(id) => {
|
|
369
|
+
const timer = setTimeout(() => props.model.dismissFailure(props.session, id), FAILURE_NOTICE_MS)
|
|
370
|
+
onCleanup(() => clearTimeout(timer))
|
|
371
|
+
},
|
|
372
|
+
)
|
|
373
|
+
|
|
374
|
+
// What the tab on screen waits on the user for: a bar above a page that keeps working, or a dialog over the still of
|
|
375
|
+
// a page it blocks. Each prompt mounts afresh, so its fields start from its own values.
|
|
376
|
+
const prompt = () => {
|
|
377
|
+
const tab = state()
|
|
378
|
+
|
|
379
|
+
return tab && !suspended() ? props.model.prompt(props.session, tab.id) : undefined
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// A prompt is its tab's: each tab counts its prompts from 1, so without the tab the first prompt of two tabs would
|
|
383
|
+
// be one prompt here, and a bar would stay mounted, with its input protection spent, when the tab on screen changes.
|
|
384
|
+
const promptKey = (modal: boolean) => {
|
|
385
|
+
const tab = state()
|
|
386
|
+
const current = prompt()
|
|
387
|
+
|
|
388
|
+
return tab && current && blocking(current) === modal ? `${tab.id}:${current.ask.kind}:${current.id}` : undefined
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
const drawn = () => shown() && prompt()?.ask.kind !== "dialog"
|
|
392
|
+
createKeyed(() => visible() && state()?.id, id => props.model.seen(props.session, id))
|
|
393
|
+
const revealGuard = () => props.model.revealGuard(props.session, props.tab().id)
|
|
394
|
+
// One computation under the pane's owner. Written inline as the embed's prop, the condition compiles to a getter that
|
|
395
|
+
// makes a new one on every read, and the embed reads it from callbacks that have no owner to dispose them.
|
|
396
|
+
const pageVisible = createMemo(() => drawn() && revealGuard() === undefined)
|
|
397
|
+
// An agent's show request put this tab under the person's pointer. Until the guard ends, the page is hidden and the
|
|
398
|
+
// tab's bars, notices and dialogs answer no click or key. The keyboard stays where it is: an inert pane would drop
|
|
399
|
+
// it, and what the person was typing in the address field would go to the composer and from there to the agent.
|
|
400
|
+
const guarded = createMemo(() => revealGuard() !== undefined)
|
|
401
|
+
|
|
402
|
+
// The guard's delay starts when the person can see this tab: the pane shows it, in a window that is not hidden.
|
|
403
|
+
createKeyed(() => visible() && props.model.windowShown() && revealGuard(), (token) => props.model.revealDrawn(props.session, token))
|
|
404
|
+
|
|
405
|
+
// Focus moves to a prompt only when the user was in the pane or its page, never from the composer, and never to the
|
|
406
|
+
// prompt of a tab an agent has just shown: the keyboard stays where the person was typing.
|
|
407
|
+
const promptFocus = () => !guarded() && (!!prompt()?.focus || !!root?.contains(document.activeElement))
|
|
408
|
+
|
|
409
|
+
// What a prompt that just mounted under `promptKey` answers: the request it was drawn for, in its session and tab,
|
|
410
|
+
// whichever tab is on screen by the time the press arrives.
|
|
411
|
+
const answer = () => {
|
|
412
|
+
const session = untrack(() => props.session)
|
|
413
|
+
const tab = untrack(state)
|
|
414
|
+
const current = untrack(prompt)
|
|
415
|
+
|
|
416
|
+
if (!tab || !current) return () => undefined
|
|
417
|
+
|
|
418
|
+
return (value: PromptAnswer) =>
|
|
419
|
+
void props.model.answer(session, tab.id, current.id, value).catch(() => showToast({ title: plugin.t("prompt.failed") }))
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
const inspectable = () => !!address() && !failed() && !suspended()
|
|
423
|
+
const windowZoom = () => desktop?.zoom() ?? 1
|
|
424
|
+
|
|
425
|
+
const fixedViewport = () => {
|
|
426
|
+
const viewport = page()?.viewport
|
|
427
|
+
|
|
428
|
+
return inspectable() && viewport?.mode === "fixed" ? viewport : undefined
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
const fit = createMemo(() => {
|
|
432
|
+
const viewport = fixedViewport()
|
|
433
|
+
const area = available()
|
|
434
|
+
|
|
435
|
+
if (!viewport || area.width <= 0 || area.height <= 0) return
|
|
436
|
+
|
|
437
|
+
return viewportLayout(viewport, area, windowZoom())
|
|
438
|
+
})
|
|
439
|
+
|
|
440
|
+
const size = () => fit() ?? available()
|
|
441
|
+
// One computation, as `pageVisible` is: a fixed device viewport shows its page only once it has a place.
|
|
442
|
+
const embedVisible = createMemo(() => pageVisible() && (!fixedViewport() || !!fit()))
|
|
443
|
+
const tabID = createMemo(() => state()?.id)
|
|
444
|
+
|
|
445
|
+
// A new visit to the same tab must not receive the old visit's failure toast.
|
|
446
|
+
const toolbarTarget = createMemo(() => {
|
|
447
|
+
const id = tabID()
|
|
448
|
+
|
|
449
|
+
return id ? { sessionKey: props.session.key, tabID: id } : undefined
|
|
450
|
+
})
|
|
451
|
+
|
|
452
|
+
const toolbarContext = () => ({ target: toolbarTarget(), available: visible() && inspectable(), page: page() })
|
|
453
|
+
const toolbarView = createMemo(() => viewportToolbarView(toolbar(), toolbarContext()))
|
|
454
|
+
const toolbarVisible = () => toolbarView().visible
|
|
455
|
+
const notice = () => toolbarView().notice
|
|
456
|
+
|
|
457
|
+
const toggleTimeout = debounce(
|
|
458
|
+
(attempt: number) => dispatchToolbar({ type: "timeout", attempt, context: toolbarContext() }),
|
|
459
|
+
10_000,
|
|
460
|
+
)
|
|
461
|
+
|
|
462
|
+
const dispatchToolbar = (event: ViewportToolbarEvent) => {
|
|
463
|
+
const next = transitionViewportToolbar(untrack(toolbar), event)
|
|
464
|
+
setToolbar(next.state)
|
|
465
|
+
const effect = next.effect
|
|
466
|
+
|
|
467
|
+
if (!effect) return
|
|
468
|
+
|
|
469
|
+
if (effect.type === "notify-failed") return showToast({ title: plugin.t("viewport.error") })
|
|
470
|
+
const { attempt, target, open } = effect
|
|
471
|
+
toggleTimeout(attempt)
|
|
472
|
+
void props.model.toggleViewport({ key: target.sessionKey }, target.tabID, open).then(
|
|
473
|
+
() => dispatchToolbar({ type: "succeeded", attempt }),
|
|
474
|
+
() => dispatchToolbar({ type: "failed", attempt, context: toolbarContext() }),
|
|
475
|
+
)
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
const toggleToolbar = () => dispatchToolbar({ type: "toggled", context: toolbarContext() })
|
|
479
|
+
onCleanup(() => dispatchToolbar({ type: "disposed" }))
|
|
480
|
+
|
|
481
|
+
const overlayed = createMemo(() => overlayView(overlay(), props.session.key, state()?.id))
|
|
482
|
+
const picking = () => overlayed().picking
|
|
483
|
+
const comment = createMemo(() => overlayComment(overlay(), props.session.key, state()?.id))
|
|
484
|
+
const note = createMemo(() => overlayNote(overlay(), props.session.key, state()?.id))
|
|
485
|
+
|
|
486
|
+
// Where the pane is when an event happens; the overlay machine checks what it owns against it.
|
|
487
|
+
const context = (): OverlayContext => ({
|
|
488
|
+
sessionKey: props.session.key,
|
|
489
|
+
tab: state(),
|
|
490
|
+
visible: visible(),
|
|
491
|
+
inspectable: inspectable(),
|
|
492
|
+
})
|
|
493
|
+
|
|
494
|
+
const attach = (send: boolean, note: ComposerNote) => {
|
|
495
|
+
props.screen.composer.attach(note)
|
|
496
|
+
|
|
497
|
+
if (send) props.screen.composer.send(note.commentID)
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
const dispatchOverlay = (event: OverlayEvent) => {
|
|
501
|
+
const next = transitionOverlay(untrack(overlay), event)
|
|
502
|
+
setOverlay(next.state)
|
|
503
|
+
next.effects.forEach((effect) => {
|
|
504
|
+
if (effect.type === "set-inspect")
|
|
505
|
+
return props.model.inspect({ key: effect.sessionKey }, effect.tabID, effect.enabled)
|
|
506
|
+
|
|
507
|
+
if (effect.type === "clear-highlight") return props.model.highlight({ key: effect.sessionKey }, effect.tabID)
|
|
508
|
+
|
|
509
|
+
// The owning screen's composer serves the session the pane shows.
|
|
510
|
+
if (effect.type === "attach-comment")
|
|
511
|
+
return attach(
|
|
512
|
+
effect.send,
|
|
513
|
+
commentNote({
|
|
514
|
+
origin: plugin.id,
|
|
515
|
+
tabID: effect.tabID,
|
|
516
|
+
url: effect.url,
|
|
517
|
+
subtitle: plugin.t("comment.annotation"),
|
|
518
|
+
element: {
|
|
519
|
+
ref: effect.live ? effect.element.ref : undefined,
|
|
520
|
+
selector: effect.element.selector,
|
|
521
|
+
label: effect.element.label,
|
|
522
|
+
role: effect.element.role,
|
|
523
|
+
name: effect.element.name,
|
|
524
|
+
text: effect.element.text,
|
|
525
|
+
},
|
|
526
|
+
comment: effect.comment,
|
|
527
|
+
}),
|
|
528
|
+
)
|
|
529
|
+
|
|
530
|
+
attach(
|
|
531
|
+
effect.send,
|
|
532
|
+
pageNote({
|
|
533
|
+
origin: plugin.id,
|
|
534
|
+
tabID: effect.tabID,
|
|
535
|
+
url: effect.url,
|
|
536
|
+
title: effect.title,
|
|
537
|
+
label: effect.title || addressParts(effect.url).host || effect.url,
|
|
538
|
+
comment: effect.comment,
|
|
539
|
+
}),
|
|
540
|
+
)
|
|
541
|
+
})
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
// The address field always shows the whole URL; at rest it draws the host emphasized.
|
|
545
|
+
const webParts = createMemo(() => hostDisplay(addressBar().field))
|
|
546
|
+
const parts = () => webParts() ?? addressParts(addressBar().field)
|
|
547
|
+
const site = () => !!addressBar().field && !addressBar().editing && !page()?.retryOnly
|
|
548
|
+
const recent = () => props.model.visits().slice(0, RECENT)
|
|
549
|
+
|
|
550
|
+
const pageTarget = () => {
|
|
551
|
+
const tab = state()
|
|
552
|
+
const session = props.session
|
|
553
|
+
const url = tab?.url ?? ""
|
|
554
|
+
const id = tab?.id
|
|
555
|
+
const generation = tab?.generation
|
|
556
|
+
const failed = () => plugin.toast.show({ variant: "error", title: plugin.t("menu.failed") })
|
|
557
|
+
const current = () => props.session.key === session.key && state()?.id === id && state()?.generation === generation && state()?.url === url
|
|
558
|
+
|
|
559
|
+
return {
|
|
560
|
+
source: source(),
|
|
561
|
+
serverFile: serverFile(),
|
|
562
|
+
open: externalPage(url, session.server.local) && (!tab?.loadError || externalAction(url, session.server.local) === "browser"),
|
|
563
|
+
reveal: externalAction(url, session.server.local) === "reveal",
|
|
564
|
+
openPage() {
|
|
565
|
+
if (!id || !current()) return failed()
|
|
566
|
+
void props.model.openPage(session, id, url).catch(failed)
|
|
567
|
+
},
|
|
568
|
+
revealFile() {
|
|
569
|
+
if (!id || !current()) return failed()
|
|
570
|
+
void props.model.revealFile(session, id)?.catch(failed)
|
|
571
|
+
},
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
const [menuPage, setMenuPage] = createSignal<ReturnType<typeof pageTarget>>()
|
|
576
|
+
|
|
577
|
+
const closeOverlay = () => dispatchOverlay({ type: "overlay.cancelled" })
|
|
578
|
+
const toggleInspect = () => dispatchOverlay({ type: "picker.toggled", context: context() })
|
|
579
|
+
|
|
580
|
+
const focusAddress = () => {
|
|
581
|
+
input?.focus()
|
|
582
|
+
input?.select()
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
// Navigates the tab and keeps the address in the field until the page reports where it went. Ends editing here rather
|
|
586
|
+
// than on blur: a click elsewhere, such as a recent page, may have blurred the field already.
|
|
587
|
+
const go = (url: string) => dispatchAddress({ type: "navigated", url, epoch: epoch() })
|
|
588
|
+
|
|
589
|
+
// Cookies came in: the offer stays to say so, and the page loads again with them, so a signed-out site opens signed
|
|
590
|
+
// in.
|
|
591
|
+
const imported = () => {
|
|
592
|
+
const tab = state()
|
|
593
|
+
setConfirming(true)
|
|
594
|
+
|
|
595
|
+
if (tab && address()) command({ type: "reload", tabID: tab.id })
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
// A passkey sign-in this browser cannot do: the import opens on the page's site, chosen already only in a tab of the
|
|
599
|
+
// person's. The notice stays until an import brought cookies, which then load the page again; a cancelled import
|
|
600
|
+
// leaves it, to try again.
|
|
601
|
+
const owner = getOwner()
|
|
602
|
+
|
|
603
|
+
const importSignIn = (tabID: Browser.TabID, passkey: { site?: string; choose: boolean }) =>
|
|
604
|
+
runWithOwner(owner, () =>
|
|
605
|
+
plugin.dialogs.open((dialog) => (
|
|
606
|
+
<SiteChooserDialog
|
|
607
|
+
site={passkey.site ? { name: passkey.site, choose: passkey.choose } : undefined}
|
|
608
|
+
imported={() => {
|
|
609
|
+
void props.model.answerNotice(props.session, tabID, true).catch(() => undefined)
|
|
610
|
+
command({ type: "reload", tabID })
|
|
611
|
+
}}
|
|
612
|
+
close={() => dialog.close()}
|
|
613
|
+
/>
|
|
614
|
+
)),
|
|
615
|
+
)
|
|
616
|
+
|
|
617
|
+
const submitOverlay = (value: string) => dispatchOverlay({ type: "overlay.submitted", value, context: context() })
|
|
618
|
+
|
|
619
|
+
const sendOverlay = createMemo(() => {
|
|
620
|
+
const delivery = props.screen.composer.delivery()
|
|
621
|
+
|
|
622
|
+
return {
|
|
623
|
+
label: plugin.t(sendLabels[delivery ?? "send"]),
|
|
624
|
+
keys: [mac ? "⌘" : plugin.t("common.key.ctrl"), "⏎"],
|
|
625
|
+
disabled: delivery === undefined,
|
|
626
|
+
onSubmit: (value: string) =>
|
|
627
|
+
dispatchOverlay({ type: "overlay.submitted", value, context: context(), send: true }),
|
|
628
|
+
}
|
|
629
|
+
})
|
|
630
|
+
|
|
631
|
+
const openNote = () => dispatchOverlay({ type: "note.opened", context: context() })
|
|
632
|
+
|
|
633
|
+
const zoomed = () => !!address() && (page()?.zoom ?? 1) !== 1
|
|
634
|
+
|
|
635
|
+
// Keep the grip gutters in the measured layout while an annotation freezes the page.
|
|
636
|
+
const resizable = () => toolbarVisible() && !zoomed() && embed()
|
|
637
|
+
|
|
638
|
+
const dimensions = () => ({
|
|
639
|
+
width: Math.round((available().width * windowZoom()) / (page()?.zoom ?? 1)),
|
|
640
|
+
height: Math.round((available().height * windowZoom()) / (page()?.zoom ?? 1)),
|
|
641
|
+
})
|
|
642
|
+
|
|
643
|
+
const viewportMessage = () => {
|
|
644
|
+
if (notice() === "failed") return plugin.t("viewport.fitFailed")
|
|
645
|
+
|
|
646
|
+
if (notice() === "zoom") return plugin.t("viewport.zoomExit")
|
|
647
|
+
|
|
648
|
+
if (zoomed()) return plugin.t("viewport.zoomPrompt")
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
const zoomPage = (direction: "in" | "out" | "reset") => {
|
|
652
|
+
const tab = state()
|
|
653
|
+
|
|
654
|
+
if (tab) props.model.zoom(props.session, tab.id, direction)
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
const copyLink = () => {
|
|
658
|
+
const url = address()
|
|
659
|
+
|
|
660
|
+
if (!url || serverFile()) return
|
|
661
|
+
void system.copy(url).then(
|
|
662
|
+
() => showToast({ title: plugin.t("common.copied") }),
|
|
663
|
+
() => showToast({ title: plugin.t("link.copyFailed") }),
|
|
664
|
+
)
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
// What can help on the error page: loading again, and for a certificate problem on this computer's own address the
|
|
668
|
+
// system browser, where a development certificate is often trusted.
|
|
669
|
+
const failureActions = () => {
|
|
670
|
+
const view = loadFailed()
|
|
671
|
+
const tab = state()
|
|
672
|
+
|
|
673
|
+
if (!view || !tab) return []
|
|
674
|
+
const url = address()
|
|
675
|
+
const local = view.kind === "insecure" && URL.canParse(url) && loopback(new URL(url).hostname)
|
|
676
|
+
|
|
677
|
+
return [
|
|
678
|
+
...(view.reload ? [{ label: plugin.t("action.reload"), run: () => command({ type: "reload", tabID: tab.id }) }] : []),
|
|
679
|
+
...(local && pageTarget().open ? [{ label: plugin.t("external.open"), run: () => pageTarget().openPage() }] : []),
|
|
680
|
+
]
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
// Snapshot the surface in native DIPs at pick time so the spotlight scales with the still.
|
|
684
|
+
const pickedRect = createMemo(() => comment()?.element.rect)
|
|
685
|
+
|
|
686
|
+
const capture = createMemo(() => {
|
|
687
|
+
const rect = pickedRect()
|
|
688
|
+
|
|
689
|
+
if (!rect) return
|
|
690
|
+
const surface = untrack(size)
|
|
691
|
+
const zoom = untrack(windowZoom)
|
|
692
|
+
|
|
693
|
+
return { rect, width: surface.width * zoom, height: surface.height * zoom }
|
|
694
|
+
})
|
|
695
|
+
|
|
696
|
+
const spotlight = () => {
|
|
697
|
+
const original = capture()
|
|
698
|
+
|
|
699
|
+
if (!original?.width || !original.height) return
|
|
700
|
+
const rect = original.rect
|
|
701
|
+
const x = size().width / original.width
|
|
702
|
+
const y = size().height / original.height
|
|
703
|
+
|
|
704
|
+
return { x: rect.x * x, y: rect.y * y, width: rect.width * x, height: rect.height * y }
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
// The page area under the toolbar and its bars. An extension's popup opens at its top edge.
|
|
708
|
+
let preview: HTMLDivElement | undefined
|
|
709
|
+
let backdrop: HTMLDivElement | undefined
|
|
710
|
+
const [origin, setOrigin] = createSignal({ x: 0, y: 0 })
|
|
711
|
+
|
|
712
|
+
// The spotlight scrolls with the still. Translate its page coordinates to the visible pane for the editor.
|
|
713
|
+
const trackPage = (surface: HTMLDivElement) => {
|
|
714
|
+
const port = preview
|
|
715
|
+
|
|
716
|
+
if (!port) return
|
|
717
|
+
|
|
718
|
+
const measure = () => {
|
|
719
|
+
if (!backdrop) return
|
|
720
|
+
const page = surface.getBoundingClientRect()
|
|
721
|
+
const pane = backdrop.getBoundingClientRect()
|
|
722
|
+
|
|
723
|
+
setOrigin({ x: page.left - pane.left, y: page.top - pane.top })
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
onMount(measure)
|
|
727
|
+
createResizeObserver([surface, port], measure)
|
|
728
|
+
createEventListener(port, "scroll", measure, { passive: true })
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
const placement = () => {
|
|
732
|
+
const rect = spotlight()
|
|
733
|
+
|
|
734
|
+
if (!rect) return
|
|
735
|
+
const pane = available()
|
|
736
|
+
const gap = 8
|
|
737
|
+
const width = Math.max(0, Math.min(320, pane.width - gap * 2))
|
|
738
|
+
// The editor scrolls rather than growing past the surface, so its actions stay reachable.
|
|
739
|
+
const surfaceHeight = Math.max(0, pane.height - gap * 2)
|
|
740
|
+
// Pick the opening side from its first measurement, then grow upward from that bottom edge.
|
|
741
|
+
const initialHeight = Math.min(comment()?.editorInitialHeight || 80, surfaceHeight)
|
|
742
|
+
const y = origin().y + rect.y
|
|
743
|
+
const left = Math.min(Math.max(gap, origin().x + rect.x), Math.max(gap, pane.width - width - gap))
|
|
744
|
+
const below = Math.max(gap, y + rect.height + gap)
|
|
745
|
+
const above = y - gap - initialHeight
|
|
746
|
+
|
|
747
|
+
const openingTop =
|
|
748
|
+
below + initialHeight <= pane.height - gap
|
|
749
|
+
? below
|
|
750
|
+
: above >= gap
|
|
751
|
+
? above
|
|
752
|
+
: Math.max(gap, pane.height - initialHeight - gap)
|
|
753
|
+
|
|
754
|
+
const bottom = Math.min(openingTop + initialHeight, pane.height - gap)
|
|
755
|
+
const maxHeight = Math.max(0, bottom - gap)
|
|
756
|
+
const height = Math.min(comment()?.editorHeight || initialHeight, maxHeight)
|
|
757
|
+
const top = Math.max(gap, bottom - height)
|
|
758
|
+
|
|
759
|
+
return { left, top, width, maxHeight }
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
onCleanup(
|
|
763
|
+
props.model.mount({
|
|
764
|
+
visible,
|
|
765
|
+
address,
|
|
766
|
+
reload: (ignoreCache) => {
|
|
767
|
+
const tab = state()
|
|
768
|
+
|
|
769
|
+
if (tab) command({ type: "reload", tabID: tab.id, ignoreCache })
|
|
770
|
+
},
|
|
771
|
+
close: () => {
|
|
772
|
+
const tab = state()
|
|
773
|
+
|
|
774
|
+
if (tab) props.model.close(props.session, tab.id)
|
|
775
|
+
},
|
|
776
|
+
inspectable,
|
|
777
|
+
inspect: toggleInspect,
|
|
778
|
+
toggleToolbar: () => {
|
|
779
|
+
toggleToolbar()
|
|
780
|
+
// The toggle is an item of the options menu, so the shortcut leaves the keyboard where choosing that item
|
|
781
|
+
// does: on the menu's button, which stays when a closing toolbar takes the focused control with it.
|
|
782
|
+
options?.focus({ preventScroll: true, focusVisible: true })
|
|
783
|
+
},
|
|
784
|
+
focusAddress,
|
|
785
|
+
find: () => find({ type: "open" }),
|
|
786
|
+
findMatch: (type) => find({ type }),
|
|
787
|
+
// Dispatched inside the pane, so keybinds scoped to it, such as closing the browser tab, apply.
|
|
788
|
+
press: (event) => {
|
|
789
|
+
if (!visible()) return
|
|
790
|
+
root?.dispatchEvent(
|
|
791
|
+
new KeyboardEvent("keydown", {
|
|
792
|
+
key: event.key,
|
|
793
|
+
code: event.code,
|
|
794
|
+
ctrlKey: event.ctrl,
|
|
795
|
+
metaKey: event.meta,
|
|
796
|
+
shiftKey: event.shift,
|
|
797
|
+
altKey: event.alt,
|
|
798
|
+
bubbles: true,
|
|
799
|
+
cancelable: true,
|
|
800
|
+
composed: true,
|
|
801
|
+
}),
|
|
802
|
+
)
|
|
803
|
+
},
|
|
804
|
+
// A focusin inside the pane, so the app's focus tracking sees the page's focus as the side panel's.
|
|
805
|
+
focused: () => root?.dispatchEvent(new FocusEvent("focusin", { bubbles: true, composed: true })),
|
|
806
|
+
}),
|
|
807
|
+
)
|
|
808
|
+
|
|
809
|
+
// The pane stays mounted when another session is routed; it listens to the routed session's picker.
|
|
810
|
+
createKeyed(
|
|
811
|
+
() => props.session.key,
|
|
812
|
+
(sessionKey) =>
|
|
813
|
+
onCleanup(
|
|
814
|
+
props.model.onInspect({ key: sessionKey }, (event) =>
|
|
815
|
+
dispatchOverlay({
|
|
816
|
+
type: "inspect.reported",
|
|
817
|
+
sessionKey,
|
|
818
|
+
tabID: event.tabID,
|
|
819
|
+
active: event.active,
|
|
820
|
+
element: event.element,
|
|
821
|
+
context: context(),
|
|
822
|
+
}),
|
|
823
|
+
),
|
|
824
|
+
),
|
|
825
|
+
)
|
|
826
|
+
|
|
827
|
+
// A tab the user just opened starts in its address field, once its blank page is on screen. Syncs DOM focus.
|
|
828
|
+
createKeyed(
|
|
829
|
+
() => (visible() && empty() ? state()?.id : undefined),
|
|
830
|
+
(tabID) => {
|
|
831
|
+
if (props.model.opened(props.session, tabID)) focusAddress()
|
|
832
|
+
},
|
|
833
|
+
)
|
|
834
|
+
|
|
835
|
+
// Syncs main's native picker and highlight with the page on screen: the overlay machine stops a picker whose tab was
|
|
836
|
+
// switched away, hidden or made uninspectable, and closes a comment or note whose tab was switched away.
|
|
837
|
+
createKeyed(
|
|
838
|
+
() => ({ sessionKey: props.session.key, tabID: state()?.id, visible: visible(), inspectable: inspectable() }),
|
|
839
|
+
() => dispatchOverlay({ type: "context.changed", context: context() }),
|
|
840
|
+
{
|
|
841
|
+
equals: (previous, next) =>
|
|
842
|
+
previous.sessionKey === next.sessionKey &&
|
|
843
|
+
previous.tabID === next.tabID &&
|
|
844
|
+
previous.visible === next.visible &&
|
|
845
|
+
previous.inspectable === next.inspectable,
|
|
846
|
+
},
|
|
847
|
+
)
|
|
848
|
+
onCleanup(() => dispatchOverlay({ type: "disposed" }))
|
|
849
|
+
// The page does not have focus while the picker waits for a hover, so Escape reaches the app.
|
|
850
|
+
createEventListener(
|
|
851
|
+
window,
|
|
852
|
+
"keydown",
|
|
853
|
+
(event) => {
|
|
854
|
+
if (event.key !== "Escape" || !capturesEscape(untrack(overlay))) return
|
|
855
|
+
event.preventDefault()
|
|
856
|
+
event.stopPropagation()
|
|
857
|
+
dispatchOverlay({ type: "escape.pressed" })
|
|
858
|
+
},
|
|
859
|
+
{ capture: true },
|
|
860
|
+
)
|
|
861
|
+
|
|
862
|
+
createResizeObserver(
|
|
863
|
+
() => preview,
|
|
864
|
+
(rect) => setAvailable({ width: rect.width, height: rect.height }),
|
|
865
|
+
)
|
|
866
|
+
|
|
867
|
+
// The outer box anchors the editors while the preview grid scrolls underneath.
|
|
868
|
+
const Preview = (view: ParentProps) => (
|
|
869
|
+
<div class="relative flex min-h-0 flex-1 flex-col">
|
|
870
|
+
<div
|
|
871
|
+
ref={preview}
|
|
872
|
+
data-component="browser-preview"
|
|
873
|
+
data-fixed={fixedViewport() ? "" : undefined}
|
|
874
|
+
data-resizable={resizable() ? "" : undefined}
|
|
875
|
+
data-manual={fixedViewport()?.scale ? "" : undefined}
|
|
876
|
+
data-embed-clip={fixedViewport()?.scale ? "" : undefined}
|
|
877
|
+
style={{
|
|
878
|
+
"grid-template-columns": fit() ? `${size().width}px` : "minmax(0, 1fr)",
|
|
879
|
+
"grid-template-rows": fit() ? `${size().height}px` : "minmax(0, 1fr)",
|
|
880
|
+
}}
|
|
881
|
+
>
|
|
882
|
+
{view.children}
|
|
883
|
+
<Show when={resizable()} keyed>
|
|
884
|
+
{(id) => (
|
|
885
|
+
<ViewportHandles
|
|
886
|
+
disabled={overlayed().frozen}
|
|
887
|
+
size={fixedViewport() ?? dimensions()}
|
|
888
|
+
ratio={windowZoom() / (fit()?.scale ?? 1)}
|
|
889
|
+
centered={{ width: size().width <= available().width, height: size().height <= available().height }}
|
|
890
|
+
resize={({ width, height }) => {
|
|
891
|
+
const tab = state()
|
|
892
|
+
|
|
893
|
+
if (!tab || embed() !== id) return
|
|
894
|
+
void props.model
|
|
895
|
+
.setViewport(props.session, tab.id, { mode: "fixed", width, height, scale: fixedViewport()?.scale })
|
|
896
|
+
.catch(() => {
|
|
897
|
+
if (embed() === id && !page()?.viewportNotice) showToast({ title: plugin.t("viewport.error") })
|
|
898
|
+
})
|
|
899
|
+
}}
|
|
900
|
+
/>
|
|
901
|
+
)}
|
|
902
|
+
</Show>
|
|
903
|
+
</div>
|
|
904
|
+
</div>
|
|
905
|
+
)
|
|
906
|
+
|
|
907
|
+
// A restored tab has no page until the pane first shows it.
|
|
908
|
+
createKeyed(
|
|
909
|
+
() => {
|
|
910
|
+
const tab = state()
|
|
911
|
+
|
|
912
|
+
return tab && shown() && !embed() ? tab.id : undefined
|
|
913
|
+
},
|
|
914
|
+
(tabID) => props.model.load(props.session, tabID),
|
|
915
|
+
)
|
|
916
|
+
|
|
917
|
+
const tip = (label: string, keys?: readonly string[]): JSX.Element => (
|
|
918
|
+
<div class="flex items-center gap-2">
|
|
919
|
+
<span>{label}</span>
|
|
920
|
+
<Show when={keys && keys.length > 0}>
|
|
921
|
+
<Keybind keys={[...(keys ?? [])]} variant="neutral" />
|
|
922
|
+
</Show>
|
|
923
|
+
</div>
|
|
924
|
+
)
|
|
925
|
+
|
|
926
|
+
return (
|
|
927
|
+
<aside
|
|
928
|
+
ref={root}
|
|
929
|
+
id="browser-panel"
|
|
930
|
+
// A click on the pane's own surface, like its loading or error view, keeps focus here, so its shortcuts apply.
|
|
931
|
+
tabIndex={-1}
|
|
932
|
+
class="relative size-full min-w-0 overflow-hidden bg-v2-background-bg-base flex flex-col outline-none"
|
|
933
|
+
>
|
|
934
|
+
<div
|
|
935
|
+
data-component="browser-bar"
|
|
936
|
+
class="h-11 shrink-0 flex items-center gap-2 px-3 border-b-[0.5px] border-v2-border-border-muted"
|
|
937
|
+
>
|
|
938
|
+
<div class="flex shrink-0 items-center gap-1">
|
|
939
|
+
<For each={["back", "forward"] as const}>
|
|
940
|
+
{(direction) => (
|
|
941
|
+
<Tooltip placement="top" value={plugin.t(direction === "back" ? "common.goBack" : "common.goForward")}>
|
|
942
|
+
<IconButton
|
|
943
|
+
variant="ghost-muted"
|
|
944
|
+
size="large"
|
|
945
|
+
disabled={!state()?.[direction === "back" ? "canGoBack" : "canGoForward"]}
|
|
946
|
+
aria-label={plugin.t(direction === "back" ? "common.goBack" : "common.goForward")}
|
|
947
|
+
onClick={() => {
|
|
948
|
+
const tab = state()
|
|
949
|
+
|
|
950
|
+
if (tab) command({ type: direction, tabID: tab.id })
|
|
951
|
+
}}
|
|
952
|
+
icon={<Icon name={direction === "back" ? "arrow-left" : "arrow-right"} />}
|
|
953
|
+
/>
|
|
954
|
+
</Tooltip>
|
|
955
|
+
)}
|
|
956
|
+
</For>
|
|
957
|
+
<Tooltip
|
|
958
|
+
placement="top"
|
|
959
|
+
value={
|
|
960
|
+
state()?.loading
|
|
961
|
+
? plugin.t("action.stop")
|
|
962
|
+
: tip(plugin.t("action.reload"), keybinds.keybind("browser.reload"))
|
|
963
|
+
}
|
|
964
|
+
>
|
|
965
|
+
<IconButton
|
|
966
|
+
variant="ghost-muted"
|
|
967
|
+
size="large"
|
|
968
|
+
disabled={!state()?.loading && !address()}
|
|
969
|
+
aria-label={plugin.t(state()?.loading ? "action.stop" : "action.reload")}
|
|
970
|
+
onClick={(event) => {
|
|
971
|
+
const tab = state()
|
|
972
|
+
|
|
973
|
+
if (!tab) return
|
|
974
|
+
command(tab.loading ? { type: "stop", tabID: tab.id } : { type: "reload", tabID: tab.id, ignoreCache: event.shiftKey })
|
|
975
|
+
}}
|
|
976
|
+
icon={
|
|
977
|
+
<Show when={state()?.loading} fallback={<Icon name="outline-rotate-clockwise" />}>
|
|
978
|
+
<Loader />
|
|
979
|
+
</Show>
|
|
980
|
+
}
|
|
981
|
+
/>
|
|
982
|
+
</Tooltip>
|
|
983
|
+
</div>
|
|
984
|
+
<Popover
|
|
985
|
+
open={addressBar().listed}
|
|
986
|
+
anchorRef={() => anchor}
|
|
987
|
+
placement="bottom-start"
|
|
988
|
+
gutter={4}
|
|
989
|
+
// The list overhangs the field by its 8px padding, so suggestion icons and text line up with the field's.
|
|
990
|
+
shift={-8}
|
|
991
|
+
modal={false}
|
|
992
|
+
>
|
|
993
|
+
<form
|
|
994
|
+
ref={anchor}
|
|
995
|
+
dir="ltr"
|
|
996
|
+
data-component="browser-address"
|
|
997
|
+
data-editing={addressBar().editing ? "" : undefined}
|
|
998
|
+
data-site={site() ? "" : undefined}
|
|
999
|
+
data-address={addressBar().editing && !addressBar().typed && addressBar().field ? "" : undefined}
|
|
1000
|
+
onPointerDown={(event) => {
|
|
1001
|
+
// The whole field focuses the input, as the site button and page actions handle their own clicks.
|
|
1002
|
+
if (event.target === event.currentTarget) {
|
|
1003
|
+
event.preventDefault()
|
|
1004
|
+
input?.focus()
|
|
1005
|
+
}
|
|
1006
|
+
}}
|
|
1007
|
+
onSubmit={(event) => {
|
|
1008
|
+
event.preventDefault()
|
|
1009
|
+
dispatchAddress({ type: "submitted", epoch: epoch(), visits: props.model.visits(), failed: failed() })
|
|
1010
|
+
}}
|
|
1011
|
+
>
|
|
1012
|
+
{/* Editing shows the icon of what Enter would open: the page's own, or the chosen row's. */}
|
|
1013
|
+
<Show
|
|
1014
|
+
when={site()}
|
|
1015
|
+
fallback={<RowIcon search={addressBar().chosen?.type === "search"} icon={fieldIcon()} />}
|
|
1016
|
+
>
|
|
1017
|
+
{/* Site information describes one page: another tab or URL closes it, and opening it reads anew. */}
|
|
1018
|
+
<Show when={`${props.session.key}\n${state()?.id}\n${address()}`} keyed>
|
|
1019
|
+
<SiteInformation
|
|
1020
|
+
url={address()}
|
|
1021
|
+
server={props.session.server.local ? undefined : props.session.server.name}
|
|
1022
|
+
site={() => {
|
|
1023
|
+
const tab = state()
|
|
1024
|
+
|
|
1025
|
+
return tab ? props.model.site(props.session, tab.id) : undefined
|
|
1026
|
+
}}
|
|
1027
|
+
clear={() => {
|
|
1028
|
+
const tab = state()
|
|
1029
|
+
|
|
1030
|
+
return tab ? props.model.clearSite(props.session, tab.id) : undefined
|
|
1031
|
+
}}
|
|
1032
|
+
clearCache={() => {
|
|
1033
|
+
const tab = state()
|
|
1034
|
+
|
|
1035
|
+
return tab ? props.model.clearCache(props.session, tab.id, address()) : undefined
|
|
1036
|
+
}}
|
|
1037
|
+
/>
|
|
1038
|
+
</Show>
|
|
1039
|
+
</Show>
|
|
1040
|
+
<div data-slot="browser-address-text">
|
|
1041
|
+
<input
|
|
1042
|
+
ref={input}
|
|
1043
|
+
data-slot="browser-address-input"
|
|
1044
|
+
role="combobox"
|
|
1045
|
+
aria-autocomplete="both"
|
|
1046
|
+
aria-expanded={addressBar().listed}
|
|
1047
|
+
aria-controls={addressBar().listed ? "browser-suggestions" : undefined}
|
|
1048
|
+
aria-activedescendant={addressBar().chosen ? `browser-suggestion-${addressBar().active}` : undefined}
|
|
1049
|
+
spellcheck={false}
|
|
1050
|
+
autocomplete="off"
|
|
1051
|
+
value={addressBar().field}
|
|
1052
|
+
disabled={!state()}
|
|
1053
|
+
placeholder={plugin.t("address.search")}
|
|
1054
|
+
aria-label={plugin.t("address.label")}
|
|
1055
|
+
onFocus={() => dispatchAddress({ type: "focused", epoch: epoch() })}
|
|
1056
|
+
// Leaving the field without submitting cancels the edit; a submit already ended it. Focus that leaves
|
|
1057
|
+
// for the page or another window keeps the field as the document's focus, so the window's return would
|
|
1058
|
+
// focus it again and start an edit under the returning click, such as one on the site button.
|
|
1059
|
+
onBlur={(event) => {
|
|
1060
|
+
dispatchAddress({ type: "blurred", epoch: epoch() })
|
|
1061
|
+
|
|
1062
|
+
if (!document.hasFocus()) event.currentTarget.blur()
|
|
1063
|
+
}}
|
|
1064
|
+
onInput={(event) =>
|
|
1065
|
+
dispatchAddress({
|
|
1066
|
+
type: "input.changed",
|
|
1067
|
+
value: event.currentTarget.value,
|
|
1068
|
+
// Only text typed at the end completes an address: not a deletion, a paste or a drop, and not
|
|
1069
|
+
// text an IME is still composing, which a changed value would break.
|
|
1070
|
+
completing:
|
|
1071
|
+
(event.inputType === "insertText" || event.inputType === "insertCompositionText") &&
|
|
1072
|
+
!event.isComposing &&
|
|
1073
|
+
event.currentTarget.selectionStart === event.currentTarget.value.length,
|
|
1074
|
+
visits: props.model.visits(),
|
|
1075
|
+
})
|
|
1076
|
+
}
|
|
1077
|
+
onKeyDown={(event) => {
|
|
1078
|
+
// Keys during IME composition pick and cancel candidates, not rows. Safari can report the
|
|
1079
|
+
// composition-confirming keydown with isComposing false but keyCode 229.
|
|
1080
|
+
if (event.isComposing || event.keyCode === 229) return
|
|
1081
|
+
const modified = event.ctrlKey || event.altKey || event.metaKey
|
|
1082
|
+
|
|
1083
|
+
// Shift with an arrow selects text, and a modified Tab is a shortcut of the app's.
|
|
1084
|
+
if (((event.key === "ArrowDown" || event.key === "ArrowUp") && !event.shiftKey && !modified) || event.key === "Escape")
|
|
1085
|
+
dispatchAddress({ type: "key.pressed", key: event.key, epoch: epoch(), visits: props.model.visits() }, event)
|
|
1086
|
+
|
|
1087
|
+
if (event.key === "Tab" && !modified)
|
|
1088
|
+
dispatchAddress({ type: "key.pressed", key: event.shiftKey ? "Shift+Tab" : "Tab", epoch: epoch(), visits: props.model.visits() }, event)
|
|
1089
|
+
|
|
1090
|
+
// Shift+Delete forgets the chosen row's page, as in other browsers; on any other row it is the field's.
|
|
1091
|
+
if (event.key === "Delete" && event.shiftKey) dispatchAddress({ type: "forget.pressed", visits: props.model.visits() }, event)
|
|
1092
|
+
}}
|
|
1093
|
+
onKeyUp={caretMoved}
|
|
1094
|
+
onPointerUp={caretMoved}
|
|
1095
|
+
/>
|
|
1096
|
+
{/* At rest, draw the whole URL over the input's hidden text with its host emphasized. While editing, the
|
|
1097
|
+
input shows its own text so selection and the caret need no mirror. */}
|
|
1098
|
+
<Show when={!addressBar().editing && addressBar().field}>
|
|
1099
|
+
<div aria-hidden="true" data-slot="browser-address-display">
|
|
1100
|
+
<span data-slot="browser-address-url" data-host={parts().host ? "" : undefined} data-web={webParts() ? "" : undefined} dir="ltr">
|
|
1101
|
+
<span data-slot="browser-address-authority"><span data-slot="browser-address-muted">{parts().scheme}</span>
|
|
1102
|
+
<span data-slot="browser-address-host" title={parts().host}><bdi dir="ltr">{parts().host}</bdi></span></span>
|
|
1103
|
+
<span data-slot="browser-address-rest">{parts().rest}</span>
|
|
1104
|
+
</span>
|
|
1105
|
+
</div>
|
|
1106
|
+
</Show>
|
|
1107
|
+
</div>
|
|
1108
|
+
{/* Any zoom but 100% stays in sight, as the system browser shows it; a click resets it. */}
|
|
1109
|
+
<Show when={zoomed()}>
|
|
1110
|
+
<Tooltip placement="top" value={plugin.t("zoom.reset")}>
|
|
1111
|
+
<button
|
|
1112
|
+
type="button"
|
|
1113
|
+
data-slot="browser-address-zoom"
|
|
1114
|
+
onPointerDown={(event) => event.preventDefault()}
|
|
1115
|
+
onClick={() => zoomPage("reset")}
|
|
1116
|
+
>
|
|
1117
|
+
{plugin.t("zoom.percent", { percent: Math.round((page()?.zoom ?? 1) * 100) })}
|
|
1118
|
+
</button>
|
|
1119
|
+
</Tooltip>
|
|
1120
|
+
</Show>
|
|
1121
|
+
</form>
|
|
1122
|
+
<Popover.Portal>
|
|
1123
|
+
<Popover.Content
|
|
1124
|
+
data-component="browser-suggestions"
|
|
1125
|
+
data-browser-popup
|
|
1126
|
+
onOpenAutoFocus={(event) => event.preventDefault()}
|
|
1127
|
+
onCloseAutoFocus={(event) => event.preventDefault()}
|
|
1128
|
+
>
|
|
1129
|
+
<div id="browser-suggestions" role="listbox" aria-label={plugin.t("address.suggestions")}>
|
|
1130
|
+
<For each={rows()}>
|
|
1131
|
+
{(row, index) => (
|
|
1132
|
+
<PageRow
|
|
1133
|
+
search={row.type === "search"}
|
|
1134
|
+
icon={row.type === "page" ? row.page.icon : undefined}
|
|
1135
|
+
title={rowTitle(row)}
|
|
1136
|
+
detail={rowDetail(row)}
|
|
1137
|
+
// Only a page draws the typed words: the other rows are the typed text itself.
|
|
1138
|
+
query={row.type === "page" ? query() : undefined}
|
|
1139
|
+
option={{ id: `browser-suggestion-${index()}`, selected: index() === addressBar().active }}
|
|
1140
|
+
onClick={() => go(row.url)}
|
|
1141
|
+
/>
|
|
1142
|
+
)}
|
|
1143
|
+
</For>
|
|
1144
|
+
</div>
|
|
1145
|
+
</Popover.Content>
|
|
1146
|
+
</Popover.Portal>
|
|
1147
|
+
</Popover>
|
|
1148
|
+
<div class="flex shrink-0 items-center gap-1">
|
|
1149
|
+
{/* Extensions load into the profile, where pages of a server on this computer browse. */}
|
|
1150
|
+
{/* Keyed by the tab: when an agent's show request changes the tab on screen, an open menu closes rather than
|
|
1151
|
+
act on the other tab. */}
|
|
1152
|
+
<Show when={props.session.server.local && extensions().length > 0 && props.tab().id} keyed>
|
|
1153
|
+
<Menu gutter={4} modal={false} placement="bottom-end">
|
|
1154
|
+
<Tooltip placement="top" value={plugin.t("extensions.menu")}>
|
|
1155
|
+
<Menu.Trigger
|
|
1156
|
+
as={IconButton}
|
|
1157
|
+
ref={(element: HTMLElement) => {
|
|
1158
|
+
extensionsButton.element = element
|
|
1159
|
+
}}
|
|
1160
|
+
variant="ghost-muted"
|
|
1161
|
+
size="large"
|
|
1162
|
+
data-action="browser-extensions"
|
|
1163
|
+
// A browser extension's own mark, not the one for OpenCode's extensions.
|
|
1164
|
+
icon={<Icon name="puzzle" />}
|
|
1165
|
+
aria-label={plugin.t("extensions.menu")}
|
|
1166
|
+
/>
|
|
1167
|
+
</Tooltip>
|
|
1168
|
+
<Menu.Portal>
|
|
1169
|
+
<Menu.Content class="w-[220px]" data-browser-popup>
|
|
1170
|
+
<Index each={extensions()}>
|
|
1171
|
+
{(extension) => (
|
|
1172
|
+
<Menu.Item
|
|
1173
|
+
disabled={
|
|
1174
|
+
!extension().enabled ||
|
|
1175
|
+
extension().action?.enabled === false ||
|
|
1176
|
+
!(extension().action ?? extension().popup ?? extension().options)
|
|
1177
|
+
}
|
|
1178
|
+
onSelect={() => chooseExtension(extension())}
|
|
1179
|
+
>
|
|
1180
|
+
<Glyph image={extension().action?.icon ?? extension().icon} fallback="puzzle" class="!size-4" />
|
|
1181
|
+
<span class="min-w-0 flex-1 truncate">{extension().action?.title ?? extension().name}</span>
|
|
1182
|
+
<Show when={extension().action?.badge}>
|
|
1183
|
+
{(badge) => (
|
|
1184
|
+
<span
|
|
1185
|
+
class="shrink-0 rounded-[3px] px-1 text-[10px] font-[530] leading-[14px]"
|
|
1186
|
+
classList={{ "text-v2-text-text-muted": !extension().action?.badgeColor }}
|
|
1187
|
+
style={{
|
|
1188
|
+
"background-color": extension().action?.badgeColor,
|
|
1189
|
+
color: extension().action?.badgeColor ? (extension().action?.badgeTextColor ?? "#ffffff") : undefined,
|
|
1190
|
+
}}
|
|
1191
|
+
>
|
|
1192
|
+
{badge()}
|
|
1193
|
+
</span>
|
|
1194
|
+
)}
|
|
1195
|
+
</Show>
|
|
1196
|
+
</Menu.Item>
|
|
1197
|
+
)}
|
|
1198
|
+
</Index>
|
|
1199
|
+
<Menu.Separator />
|
|
1200
|
+
<Menu.Item onSelect={() => plugin.layout.settings("browser")}>
|
|
1201
|
+
{plugin.t("extensions.manage")}
|
|
1202
|
+
</Menu.Item>
|
|
1203
|
+
</Menu.Content>
|
|
1204
|
+
</Menu.Portal>
|
|
1205
|
+
</Menu>
|
|
1206
|
+
</Show>
|
|
1207
|
+
<Tooltip placement="top" value={tip(plugin.t("inspect"), keybinds.keybind("browser.inspect"))}>
|
|
1208
|
+
{/* The ghost variant sets the button color, so the active accent needs precedence over it. */}
|
|
1209
|
+
<IconButton
|
|
1210
|
+
variant="ghost-muted"
|
|
1211
|
+
size="large"
|
|
1212
|
+
disabled={!inspectable()}
|
|
1213
|
+
state={picking() ? "pressed" : undefined}
|
|
1214
|
+
classList={{ "!text-v2-icon-icon-accent": overlayed().accent }}
|
|
1215
|
+
aria-pressed={picking()}
|
|
1216
|
+
aria-label={plugin.t("inspect")}
|
|
1217
|
+
onClick={toggleInspect}
|
|
1218
|
+
icon={<Icon name="select-element" />}
|
|
1219
|
+
/>
|
|
1220
|
+
</Tooltip>
|
|
1221
|
+
{/* Keyed by the tab, as the extensions menu is: an open menu is of the tab it opened on, and closes with it. */}
|
|
1222
|
+
<Show when={props.tab().id} keyed>
|
|
1223
|
+
<Menu gutter={4} modal={false} placement="bottom-end" onOpenChange={open => setMenuPage(open ? pageTarget() : undefined)}>
|
|
1224
|
+
<Tooltip placement="top" value={plugin.t("options")}>
|
|
1225
|
+
<Menu.Trigger
|
|
1226
|
+
as={IconButton}
|
|
1227
|
+
ref={(element: HTMLElement) => {
|
|
1228
|
+
options = element
|
|
1229
|
+
}}
|
|
1230
|
+
variant="ghost-muted"
|
|
1231
|
+
size="large"
|
|
1232
|
+
disabled={!state()}
|
|
1233
|
+
icon={<Icon name="outline-dots" />}
|
|
1234
|
+
aria-label={plugin.t("options")}
|
|
1235
|
+
/>
|
|
1236
|
+
</Tooltip>
|
|
1237
|
+
<Menu.Portal>
|
|
1238
|
+
<Menu.Content class="w-[220px]" data-browser-popup>
|
|
1239
|
+
{/* What most people reach for comes first; the rest is one step away under "More tools". */}
|
|
1240
|
+
<Menu.Item
|
|
1241
|
+
disabled={!inspectable()}
|
|
1242
|
+
onSelect={() => find({ type: "open" })}
|
|
1243
|
+
shortcut={<Keybind keys={[...keybinds.keybind("browser.find")]} variant="neutral" />}
|
|
1244
|
+
>
|
|
1245
|
+
{plugin.t("find.open")}
|
|
1246
|
+
</Menu.Item>
|
|
1247
|
+
{/* One row: out, the zoom itself (which resets it), in. Zooming closes the menu: the page stays a
|
|
1248
|
+
still while the menu covers it, so a zoom would show only once it closed. */}
|
|
1249
|
+
<Menu.ItemRow label={plugin.t("zoom.label")}>
|
|
1250
|
+
<Menu.Item disabled={!address()} aria-label={plugin.t("zoom.out")} onSelect={() => zoomPage("out")}>
|
|
1251
|
+
<Icon name="minus" size="small" />
|
|
1252
|
+
</Menu.Item>
|
|
1253
|
+
<Menu.Item disabled={!zoomed()} aria-label={plugin.t("zoom.reset")} onSelect={() => zoomPage("reset")}>
|
|
1254
|
+
{plugin.t("zoom.percent", { percent: Math.round((page()?.zoom ?? 1) * 100) })}
|
|
1255
|
+
</Menu.Item>
|
|
1256
|
+
<Menu.Item disabled={!address()} aria-label={plugin.t("zoom.in")} onSelect={() => zoomPage("in")}>
|
|
1257
|
+
<Icon name="plus" size="small" />
|
|
1258
|
+
</Menu.Item>
|
|
1259
|
+
</Menu.ItemRow>
|
|
1260
|
+
{/* A disabled item takes no pointer events, so a tooltip never shows: its reason is a line below it. */}
|
|
1261
|
+
<Menu.Group>
|
|
1262
|
+
<Menu.Item disabled={!address() || serverFile()} onSelect={copyLink}>
|
|
1263
|
+
{plugin.t("link.copy")}
|
|
1264
|
+
</Menu.Item>
|
|
1265
|
+
<Show when={menuPage()?.serverFile}>
|
|
1266
|
+
<Menu.GroupLabel class="!h-auto !pb-1.5 !pt-0">
|
|
1267
|
+
<span dir="auto" class="break-words leading-4">{plugin.t("menu.privateAddress")}</span>
|
|
1268
|
+
</Menu.GroupLabel>
|
|
1269
|
+
</Show>
|
|
1270
|
+
</Menu.Group>
|
|
1271
|
+
<Menu.Item disabled={!address() || suspended() || failed()} onSelect={openNote}>
|
|
1272
|
+
{plugin.t("page.add")}
|
|
1273
|
+
</Menu.Item>
|
|
1274
|
+
<Show when={menuPage()?.source}>
|
|
1275
|
+
{(open) => <Menu.Item onSelect={() => open()()}>{plugin.t("preview.source")}</Menu.Item>}
|
|
1276
|
+
</Show>
|
|
1277
|
+
<Menu.Separator />
|
|
1278
|
+
<Menu.Sub gutter={4} overflowPadding={16} overlap>
|
|
1279
|
+
<Menu.SubTrigger>{plugin.t("menu.more")}</Menu.SubTrigger>
|
|
1280
|
+
<Menu.Portal>
|
|
1281
|
+
<Menu.SubContent class="w-max min-w-[220px] max-w-[calc(100vw-32px)]" aria-label={plugin.t("menu.more")} data-browser-popup>
|
|
1282
|
+
<Show when={viewportToolbarAvailable(plugin.app.channel)}>
|
|
1283
|
+
<Menu.Item
|
|
1284
|
+
disabled={!inspectable()}
|
|
1285
|
+
onSelect={toggleToolbar}
|
|
1286
|
+
shortcut={<Keybind keys={[...keybinds.keybind("browser.toggleToolbar")]} variant="neutral" />}
|
|
1287
|
+
>
|
|
1288
|
+
{plugin.t("command.toggleToolbar")}
|
|
1289
|
+
</Menu.Item>
|
|
1290
|
+
</Show>
|
|
1291
|
+
<Menu.Group>
|
|
1292
|
+
<Menu.Item disabled={!menuPage()?.open} onSelect={() => menuPage()?.openPage()}>
|
|
1293
|
+
{plugin.t("menu.openPage")}
|
|
1294
|
+
</Menu.Item>
|
|
1295
|
+
<Show when={!menuPage()?.open}>
|
|
1296
|
+
<Menu.GroupLabel class="!h-auto !pb-1.5 !pt-0">
|
|
1297
|
+
<span dir="auto" class="break-words leading-4">{plugin.t("menu.pageUnavailable")}</span>
|
|
1298
|
+
</Menu.GroupLabel>
|
|
1299
|
+
</Show>
|
|
1300
|
+
</Menu.Group>
|
|
1301
|
+
<Show when={menuPage()?.reveal}>
|
|
1302
|
+
<Menu.Item onSelect={() => menuPage()?.revealFile()}>{plugin.t("external.reveal")}</Menu.Item>
|
|
1303
|
+
</Show>
|
|
1304
|
+
<Menu.Item
|
|
1305
|
+
disabled={!address()}
|
|
1306
|
+
onSelect={() => {
|
|
1307
|
+
const tab = state()
|
|
1308
|
+
|
|
1309
|
+
if (tab) command({ type: "reload", tabID: tab.id, ignoreCache: true })
|
|
1310
|
+
}}
|
|
1311
|
+
shortcut={<Keybind keys={[...keybinds.keybind("browser.hardReload")]} variant="neutral" />}
|
|
1312
|
+
>
|
|
1313
|
+
{plugin.t("menu.hardReload")}
|
|
1314
|
+
</Menu.Item>
|
|
1315
|
+
<Menu.Item
|
|
1316
|
+
disabled={!props.model.historyClearable()}
|
|
1317
|
+
// The list empties at once; a history main could not clear is said, and the item stays to try again.
|
|
1318
|
+
onSelect={() =>
|
|
1319
|
+
void props.model.clearHistory().then((cleared) => {
|
|
1320
|
+
if (!cleared) plugin.toast.show({ variant: "error", title: plugin.t("history.clear.failed") })
|
|
1321
|
+
})
|
|
1322
|
+
}
|
|
1323
|
+
>
|
|
1324
|
+
{plugin.t("history.clear")}
|
|
1325
|
+
</Menu.Item>
|
|
1326
|
+
</Menu.SubContent>
|
|
1327
|
+
</Menu.Portal>
|
|
1328
|
+
</Menu.Sub>
|
|
1329
|
+
<Menu.Separator />
|
|
1330
|
+
<Menu.Item onSelect={() => plugin.layout.settings("browser")}>{plugin.t("settings.open")}</Menu.Item>
|
|
1331
|
+
</Menu.Content>
|
|
1332
|
+
</Menu.Portal>
|
|
1333
|
+
</Menu>
|
|
1334
|
+
</Show>
|
|
1335
|
+
</div>
|
|
1336
|
+
</div>
|
|
1337
|
+
{/*
|
|
1338
|
+
The bars above the page, always in this order: the sign-in offer, the site's permission request, the tab's
|
|
1339
|
+
notice, a command that did not work, then find. A page that did not load is never a bar: the page area says so. A dialog that blocks the page sits over the page area alone, never over a bar; find, which
|
|
1340
|
+
would search the page behind it, closes while it shows.
|
|
1341
|
+
*/}
|
|
1342
|
+
{/* Above a page, where a signed-out site is the reason to import; the new tab page shows the offer as a card. */}
|
|
1343
|
+
<Show when={offering() && !empty() && !suspended()}>
|
|
1344
|
+
<SignInOffer variant="bar" imported={imported} closed={() => setConfirming(false)} />
|
|
1345
|
+
</Show>
|
|
1346
|
+
<Show when={promptKey(false)} keyed>
|
|
1347
|
+
{(key) => (
|
|
1348
|
+
<Show when={key ? prompt() : undefined}>
|
|
1349
|
+
{(view) => <PromptBar view={view()} answer={answer()} focus={untrack(promptFocus)} held={guarded()} />}
|
|
1350
|
+
</Show>
|
|
1351
|
+
)}
|
|
1352
|
+
</Show>
|
|
1353
|
+
<Show when={state()?.id} keyed>
|
|
1354
|
+
{(id) => (
|
|
1355
|
+
<>
|
|
1356
|
+
<Show when={props.model.notice(props.session, id)}>
|
|
1357
|
+
{(notice) => (
|
|
1358
|
+
<RefusalBar
|
|
1359
|
+
notice={notice()}
|
|
1360
|
+
held={guarded()}
|
|
1361
|
+
answer={async (dismiss, copy) => {
|
|
1362
|
+
const passkey = notice().passkey
|
|
1363
|
+
|
|
1364
|
+
if (dismiss || !passkey) return props.model.answerNotice(props.session, id, dismiss, copy)
|
|
1365
|
+
|
|
1366
|
+
if (passkey.newTab !== undefined) {
|
|
1367
|
+
props.model.openURL(props.session, passkey.newTab)
|
|
1368
|
+
|
|
1369
|
+
return props.model.answerNotice(props.session, id, true)
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
importSignIn(id, passkey)
|
|
1373
|
+
}}
|
|
1374
|
+
/>
|
|
1375
|
+
)}
|
|
1376
|
+
</Show>
|
|
1377
|
+
<Show when={barFailure()}>
|
|
1378
|
+
{(current) => (
|
|
1379
|
+
<FailureBar
|
|
1380
|
+
text={current().text}
|
|
1381
|
+
retry={current().retry}
|
|
1382
|
+
dismiss={() => props.model.dismissFailure(props.session, current().id)}
|
|
1383
|
+
/>
|
|
1384
|
+
)}
|
|
1385
|
+
</Show>
|
|
1386
|
+
<Show when={!suspended() && !promptKey(true) && props.model.search(props.session, id)}>
|
|
1387
|
+
{(view) => <FindBar view={view()} input={(el) => { findInput = el }} run={(action) => find(action, id)} />}
|
|
1388
|
+
</Show>
|
|
1389
|
+
</>
|
|
1390
|
+
)}
|
|
1391
|
+
</Show>
|
|
1392
|
+
<Show when={toolbarVisible()}>
|
|
1393
|
+
<section data-component="browser-viewport" aria-label={plugin.t("viewport.label")}>
|
|
1394
|
+
<Show when={state()?.id} keyed>
|
|
1395
|
+
{(tabID) => (
|
|
1396
|
+
<Show when={props.session.key} keyed>
|
|
1397
|
+
<ViewportControls
|
|
1398
|
+
viewport={page()?.viewport}
|
|
1399
|
+
autoWidth={dimensions().width}
|
|
1400
|
+
autoHeight={dimensions().height}
|
|
1401
|
+
effectiveScale={fit()?.scale ?? 1}
|
|
1402
|
+
zoomed={zoomed()}
|
|
1403
|
+
apply={(viewport) => props.model.setViewport(props.session, tabID, viewport)}
|
|
1404
|
+
/>
|
|
1405
|
+
</Show>
|
|
1406
|
+
)}
|
|
1407
|
+
</Show>
|
|
1408
|
+
<Show when={viewportMessage()}>
|
|
1409
|
+
<div data-slot="browser-viewport-message" role="status">
|
|
1410
|
+
{viewportMessage()}
|
|
1411
|
+
<Show when={zoomed()}>
|
|
1412
|
+
<Button size="small" variant="ghost" onClick={() => zoomPage("reset")}>
|
|
1413
|
+
{plugin.t("zoom.reset")}
|
|
1414
|
+
</Button>
|
|
1415
|
+
</Show>
|
|
1416
|
+
<Show when={notice()}>
|
|
1417
|
+
<Button
|
|
1418
|
+
size="small"
|
|
1419
|
+
variant="ghost-muted"
|
|
1420
|
+
onClick={() => dispatchToolbar({ type: "notice.dismissed", context: toolbarContext() })}
|
|
1421
|
+
>
|
|
1422
|
+
{plugin.t("common.dismiss")}
|
|
1423
|
+
</Button>
|
|
1424
|
+
</Show>
|
|
1425
|
+
</div>
|
|
1426
|
+
</Show>
|
|
1427
|
+
</section>
|
|
1428
|
+
</Show>
|
|
1429
|
+
<Preview>
|
|
1430
|
+
<embeds.View
|
|
1431
|
+
id={embed()}
|
|
1432
|
+
// A page blocked in a JavaScript dialog draws no frame, so Chromium cannot capture a still of it: its dialog
|
|
1433
|
+
// sits over the dimmed, empty page area at once. "Leave site?" and a sign-in leave the page drawing.
|
|
1434
|
+
visible={embedVisible()}
|
|
1435
|
+
frozen={overlayed().frozen || !!promptKey(true)}
|
|
1436
|
+
// A navigation, in-page or not, a reload starting or a layout viewport change is another page.
|
|
1437
|
+
page={JSON.stringify([
|
|
1438
|
+
state()?.id,
|
|
1439
|
+
state()?.generation,
|
|
1440
|
+
state()?.url,
|
|
1441
|
+
!!state()?.loading,
|
|
1442
|
+
fixedViewport()?.width,
|
|
1443
|
+
fixedViewport()?.height,
|
|
1444
|
+
fixedViewport()?.scale,
|
|
1445
|
+
])}
|
|
1446
|
+
radius={fixedViewport() ? 0 : 10}
|
|
1447
|
+
class="relative min-h-0 min-w-0 overflow-hidden bg-v2-background-bg-base flex items-center justify-center"
|
|
1448
|
+
>
|
|
1449
|
+
<Show when={promptKey(true)} keyed>
|
|
1450
|
+
{(key) => (
|
|
1451
|
+
<Show when={key ? prompt() : undefined}>
|
|
1452
|
+
{(view) => (
|
|
1453
|
+
<PromptDialog view={view()} answer={answer()} focus={untrack(promptFocus)} leave={focusAddress} held={guarded()} />
|
|
1454
|
+
)}
|
|
1455
|
+
</Show>
|
|
1456
|
+
)}
|
|
1457
|
+
</Show>
|
|
1458
|
+
<Show when={empty() && !failed() && !suspended() && !pageFailure()}>
|
|
1459
|
+
<div dir="auto" data-scrollable class="size-full overflow-y-auto">
|
|
1460
|
+
<Show when={offering()}>
|
|
1461
|
+
<SignInOffer variant="card" imported={imported} closed={() => setConfirming(false)} />
|
|
1462
|
+
</Show>
|
|
1463
|
+
<Show
|
|
1464
|
+
when={recent().length > 0}
|
|
1465
|
+
fallback={
|
|
1466
|
+
<div class="mx-auto flex max-w-[360px] flex-col items-center gap-4 px-6 pt-20 text-center">
|
|
1467
|
+
<Icon name="outline-globe" size="large" class="text-v2-icon-icon-muted" />
|
|
1468
|
+
<div class="flex flex-col gap-2">
|
|
1469
|
+
<div class="text-[13px] font-[530] leading-[var(--line-height-compact)] text-v2-text-text-base">
|
|
1470
|
+
{plugin.t("home.title")}
|
|
1471
|
+
</div>
|
|
1472
|
+
<div class="text-[13px] font-[440] leading-[var(--line-height-compact)] text-v2-text-text-muted">
|
|
1473
|
+
{plugin.t("home.description")}
|
|
1474
|
+
</div>
|
|
1475
|
+
</div>
|
|
1476
|
+
</div>
|
|
1477
|
+
}
|
|
1478
|
+
>
|
|
1479
|
+
{/* The pages the browser showed last; the side panel's new tab view offers the other tabs. One visit is
|
|
1480
|
+
enough to list; the list stops at a handful. */}
|
|
1481
|
+
<div class="mx-auto flex w-full max-w-[608px] flex-col gap-4 px-6 pt-12 pb-10">
|
|
1482
|
+
<div class="text-[13px] font-[440] leading-[var(--line-height-compact)] text-v2-text-text-muted">
|
|
1483
|
+
{plugin.t("home.recent")}
|
|
1484
|
+
</div>
|
|
1485
|
+
<div class="flex flex-col gap-2">
|
|
1486
|
+
<For each={recent()}>
|
|
1487
|
+
{(visit) => <PageRow icon={visit.icon} title={visit.title} detail={bare(visit.url)} onClick={() => go(visit.url)} />}
|
|
1488
|
+
</For>
|
|
1489
|
+
</div>
|
|
1490
|
+
</div>
|
|
1491
|
+
</Show>
|
|
1492
|
+
</div>
|
|
1493
|
+
</Show>
|
|
1494
|
+
<Show when={suspended() ? undefined : loadFailed()}>
|
|
1495
|
+
{(view) => (
|
|
1496
|
+
<FailurePage
|
|
1497
|
+
title={plugin.t(view().title)}
|
|
1498
|
+
description={plugin.t(view().description)}
|
|
1499
|
+
warning={view().kind === "insecure"}
|
|
1500
|
+
actions={failureActions()}
|
|
1501
|
+
code={view().code}
|
|
1502
|
+
/>
|
|
1503
|
+
)}
|
|
1504
|
+
</Show>
|
|
1505
|
+
<Show when={failed() ? undefined : pageFailure()}>
|
|
1506
|
+
{(current) => (
|
|
1507
|
+
<FailurePage
|
|
1508
|
+
title={current().text}
|
|
1509
|
+
description={plugin.t("failed.command.description")}
|
|
1510
|
+
actions={[
|
|
1511
|
+
...(current().retry ? [{ label: plugin.t("common.retry"), run: () => current().retry?.() }] : []),
|
|
1512
|
+
{ label: plugin.t("common.close"), run: () => props.model.dismissFailure(props.session, current().id) },
|
|
1513
|
+
]}
|
|
1514
|
+
/>
|
|
1515
|
+
)}
|
|
1516
|
+
</Show>
|
|
1517
|
+
<Show when={suspended()}>
|
|
1518
|
+
<p class="px-6 text-center text-13-regular text-v2-text-text-subtle" role="status">
|
|
1519
|
+
{plugin.t(offline() ? "preview.offline" : "suspended")}
|
|
1520
|
+
</p>
|
|
1521
|
+
</Show>
|
|
1522
|
+
<Show when={spotlight()}>
|
|
1523
|
+
{(rect) => (
|
|
1524
|
+
<div ref={trackPage} class="pointer-events-none absolute inset-0 overflow-hidden">
|
|
1525
|
+
<div
|
|
1526
|
+
data-slot="browser-comment-spotlight"
|
|
1527
|
+
class="absolute rounded-[2px]"
|
|
1528
|
+
style={{
|
|
1529
|
+
left: `${rect().x}px`,
|
|
1530
|
+
top: `${rect().y}px`,
|
|
1531
|
+
width: `${rect().width}px`,
|
|
1532
|
+
height: `${rect().height}px`,
|
|
1533
|
+
}}
|
|
1534
|
+
/>
|
|
1535
|
+
</div>
|
|
1536
|
+
)}
|
|
1537
|
+
</Show>
|
|
1538
|
+
</embeds.View>
|
|
1539
|
+
<Show when={comment()}>
|
|
1540
|
+
{(current) => (
|
|
1541
|
+
<div
|
|
1542
|
+
ref={backdrop}
|
|
1543
|
+
data-component="browser-comment"
|
|
1544
|
+
class="absolute start-0 top-0 z-10"
|
|
1545
|
+
style={{ width: `${available().width}px`, height: `${available().height}px` }}
|
|
1546
|
+
onPointerDown={(event) => {
|
|
1547
|
+
// A click beside the editor dismisses it unless it would discard a draft.
|
|
1548
|
+
if (event.target === event.currentTarget) dispatchOverlay({ type: "backdrop.pressed" })
|
|
1549
|
+
}}
|
|
1550
|
+
>
|
|
1551
|
+
<Show when={placement()}>
|
|
1552
|
+
{(position) => (
|
|
1553
|
+
<div
|
|
1554
|
+
ref={(element) =>
|
|
1555
|
+
createResizeObserver(element, (rect) =>
|
|
1556
|
+
dispatchOverlay({ type: "editor.resized", height: rect.height }),
|
|
1557
|
+
)
|
|
1558
|
+
}
|
|
1559
|
+
data-slot="browser-comment-editor"
|
|
1560
|
+
data-prevent-autofocus
|
|
1561
|
+
class="absolute flex flex-col overflow-hidden rounded-[8px] shadow-[var(--v2-elevation-floating)]"
|
|
1562
|
+
style={{
|
|
1563
|
+
left: `${position().left}px`,
|
|
1564
|
+
top: `${position().top}px`,
|
|
1565
|
+
width: `${position().width}px`,
|
|
1566
|
+
"max-height": `${position().maxHeight}px`,
|
|
1567
|
+
}}
|
|
1568
|
+
>
|
|
1569
|
+
<MenuScroll class="min-h-0">
|
|
1570
|
+
<LineCommentEditor
|
|
1571
|
+
variant="compact"
|
|
1572
|
+
label={plugin.t("comment.label")}
|
|
1573
|
+
placeholder={plugin.t("comment.placeholder")}
|
|
1574
|
+
cancelLabel={plugin.t("comment.cancel")}
|
|
1575
|
+
submitLabel={plugin.t(current().draft.trim() ? "comment.submit" : "comment.attach")}
|
|
1576
|
+
allowEmpty
|
|
1577
|
+
style={{
|
|
1578
|
+
"--line-comment-preview-lines": 2,
|
|
1579
|
+
"--line-comment-max-height": `${position().maxHeight}px`,
|
|
1580
|
+
}}
|
|
1581
|
+
value={current().draft}
|
|
1582
|
+
onInput={(value) => dispatchOverlay({ type: "draft.changed", value })}
|
|
1583
|
+
onCancel={closeOverlay}
|
|
1584
|
+
onSubmit={submitOverlay}
|
|
1585
|
+
alternateSubmit={sendOverlay()}
|
|
1586
|
+
mention={{
|
|
1587
|
+
items: (query) => props.screen.file.search(query, { kind: "any" }),
|
|
1588
|
+
}}
|
|
1589
|
+
selection={
|
|
1590
|
+
<span>
|
|
1591
|
+
<Tooltip
|
|
1592
|
+
placement="top"
|
|
1593
|
+
contentStyle={{ "pointer-events": "none" }}
|
|
1594
|
+
value={
|
|
1595
|
+
<span
|
|
1596
|
+
dir="ltr"
|
|
1597
|
+
style={{ "font-family": "var(--font-family-mono)", "unicode-bidi": "isolate" }}
|
|
1598
|
+
>
|
|
1599
|
+
{current().element.selector || current().element.label}
|
|
1600
|
+
</span>
|
|
1601
|
+
}
|
|
1602
|
+
>
|
|
1603
|
+
<span
|
|
1604
|
+
dir="ltr"
|
|
1605
|
+
style={{
|
|
1606
|
+
"font-family": "var(--font-family-mono)",
|
|
1607
|
+
"unicode-bidi": "isolate",
|
|
1608
|
+
display: "-webkit-box",
|
|
1609
|
+
"-webkit-box-orient": "vertical",
|
|
1610
|
+
"-webkit-line-clamp": "var(--line-comment-preview-lines)",
|
|
1611
|
+
overflow: "hidden",
|
|
1612
|
+
"overflow-wrap": "anywhere",
|
|
1613
|
+
}}
|
|
1614
|
+
>
|
|
1615
|
+
{current().element.selector || current().element.label}
|
|
1616
|
+
</span>
|
|
1617
|
+
</Tooltip>
|
|
1618
|
+
</span>
|
|
1619
|
+
}
|
|
1620
|
+
/>
|
|
1621
|
+
</MenuScroll>
|
|
1622
|
+
</div>
|
|
1623
|
+
)}
|
|
1624
|
+
</Show>
|
|
1625
|
+
</div>
|
|
1626
|
+
)}
|
|
1627
|
+
</Show>
|
|
1628
|
+
<Show when={note()}>
|
|
1629
|
+
{(current) => (
|
|
1630
|
+
<div
|
|
1631
|
+
data-component="browser-comment"
|
|
1632
|
+
class="absolute start-0 top-0 z-10"
|
|
1633
|
+
style={{ width: `${available().width}px`, height: `${available().height}px` }}
|
|
1634
|
+
onPointerDown={(event) => {
|
|
1635
|
+
if (event.target === event.currentTarget) dispatchOverlay({ type: "backdrop.pressed" })
|
|
1636
|
+
}}
|
|
1637
|
+
>
|
|
1638
|
+
{/* Under the page actions at the address field's end, which opened it. */}
|
|
1639
|
+
<div
|
|
1640
|
+
data-slot="browser-comment-editor"
|
|
1641
|
+
data-prevent-autofocus
|
|
1642
|
+
class="absolute end-2 top-2 flex flex-col overflow-hidden rounded-[6px] shadow-[var(--v2-elevation-raised)]"
|
|
1643
|
+
style={{
|
|
1644
|
+
width: "min(400px, calc(100% - 16px))",
|
|
1645
|
+
"max-height": "calc(100% - 16px)",
|
|
1646
|
+
}}
|
|
1647
|
+
>
|
|
1648
|
+
<MenuScroll class="min-h-0">
|
|
1649
|
+
<LineCommentEditor
|
|
1650
|
+
value={current().draft}
|
|
1651
|
+
onInput={(value) => dispatchOverlay({ type: "draft.changed", value })}
|
|
1652
|
+
onCancel={closeOverlay}
|
|
1653
|
+
onSubmit={submitOverlay}
|
|
1654
|
+
alternateSubmit={sendOverlay()}
|
|
1655
|
+
placeholder={plugin.t("page.placeholder")}
|
|
1656
|
+
mention={{
|
|
1657
|
+
items: (query) => props.screen.file.search(query, { kind: "any" }),
|
|
1658
|
+
}}
|
|
1659
|
+
selection={
|
|
1660
|
+
<span class="flex min-w-0 items-center gap-1" dir="ltr">
|
|
1661
|
+
<Icon name="globe" class="shrink-0" />
|
|
1662
|
+
<span class="min-w-0 truncate leading-[var(--line-height-tight)]">
|
|
1663
|
+
{current().title || addressParts(current().url).host || current().url}
|
|
1664
|
+
</span>
|
|
1665
|
+
</span>
|
|
1666
|
+
}
|
|
1667
|
+
/>
|
|
1668
|
+
</MenuScroll>
|
|
1669
|
+
</div>
|
|
1670
|
+
</div>
|
|
1671
|
+
)}
|
|
1672
|
+
</Show>
|
|
1673
|
+
</Preview>
|
|
1674
|
+
<p class="sr-only" role="status" aria-live="polite">
|
|
1675
|
+
{picking() ? plugin.t("inspect.active") : ""}
|
|
1676
|
+
</p>
|
|
1677
|
+
</aside>
|
|
1678
|
+
)
|
|
1679
|
+
}
|
|
1680
|
+
|
|
1681
|
+
/** The title of a row of the address field's list: a page's own, or the text a search row searches for. */
|
|
1682
|
+
function rowTitle(row: AddressRow) {
|
|
1683
|
+
if (row.type === "page") return row.page.title
|
|
1684
|
+
|
|
1685
|
+
return row.type === "search" ? row.text : ""
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
/** The icon of a row of the address field's list, and of the field while that row is chosen: the search glyph, or a page's own. */
|
|
1689
|
+
function RowIcon(props: { search: boolean; icon: string | undefined }) {
|
|
1690
|
+
return (
|
|
1691
|
+
<Show when={props.search} fallback={<PageIcon icon={props.icon} class="text-v2-icon-icon-muted" />}>
|
|
1692
|
+
<Icon name="magnifying-glass" class="pointer-events-none size-4 shrink-0 text-v2-icon-icon-muted" />
|
|
1693
|
+
</Show>
|
|
1694
|
+
)
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
/**
|
|
1698
|
+
* A row of the address field's list or of the new tab page: an icon, a title and, after it, a page's address or what
|
|
1699
|
+
* a search row searches with. A page draws the query's matches.
|
|
1700
|
+
*/
|
|
1701
|
+
function PageRow(props: {
|
|
1702
|
+
search?: boolean
|
|
1703
|
+
icon: string | undefined
|
|
1704
|
+
title: string
|
|
1705
|
+
detail: string
|
|
1706
|
+
query?: Query
|
|
1707
|
+
/** Set for a row of the address field's list: an option, which keeps keyboard focus in the field. */
|
|
1708
|
+
option?: { id: string; selected: boolean }
|
|
1709
|
+
onClick: () => void
|
|
1710
|
+
}) {
|
|
1711
|
+
const body = () => (
|
|
1712
|
+
<>
|
|
1713
|
+
<RowIcon search={!!props.search} icon={props.icon} />
|
|
1714
|
+
<span data-slot="browser-page-row-text">
|
|
1715
|
+
<Show when={props.title}>
|
|
1716
|
+
<span data-slot="browser-page-row-title">
|
|
1717
|
+
<Marked text={props.title} query={props.query} />
|
|
1718
|
+
</span>
|
|
1719
|
+
<span>-</span>
|
|
1720
|
+
</Show>
|
|
1721
|
+
<span data-slot="browser-page-row-url">
|
|
1722
|
+
<Marked text={props.detail} query={props.query} />
|
|
1723
|
+
</span>
|
|
1724
|
+
</span>
|
|
1725
|
+
</>
|
|
1726
|
+
)
|
|
1727
|
+
|
|
1728
|
+
return (
|
|
1729
|
+
<Show
|
|
1730
|
+
when={props.option}
|
|
1731
|
+
fallback={
|
|
1732
|
+
<button type="button" data-component="browser-page-row" dir="ltr" onClick={() => props.onClick()}>
|
|
1733
|
+
{body()}
|
|
1734
|
+
</button>
|
|
1735
|
+
}
|
|
1736
|
+
>
|
|
1737
|
+
{(option) => (
|
|
1738
|
+
<div
|
|
1739
|
+
id={option().id}
|
|
1740
|
+
role="option"
|
|
1741
|
+
aria-selected={option().selected}
|
|
1742
|
+
data-component="browser-page-row"
|
|
1743
|
+
dir="ltr"
|
|
1744
|
+
// The address field keeps focus, so a click does not end editing before it opens the page.
|
|
1745
|
+
onPointerDown={(event) => event.preventDefault()}
|
|
1746
|
+
onClick={() => props.onClick()}
|
|
1747
|
+
>
|
|
1748
|
+
{body()}
|
|
1749
|
+
</div>
|
|
1750
|
+
)}
|
|
1751
|
+
</Show>
|
|
1752
|
+
)
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
function Marked(props: { text: string; query: Query | undefined }) {
|
|
1756
|
+
return (
|
|
1757
|
+
<For each={markMatches(props.text, props.query)}>
|
|
1758
|
+
{(part) => (
|
|
1759
|
+
<Show when={part.match} fallback={part.text}>
|
|
1760
|
+
<mark>{part.text}</mark>
|
|
1761
|
+
</Show>
|
|
1762
|
+
)}
|
|
1763
|
+
</For>
|
|
1764
|
+
)
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1767
|
+
const connections = {
|
|
1768
|
+
secure: { icon: "lock", title: "site.secure", description: "site.secure.description" },
|
|
1769
|
+
insecure: { icon: "outline-hexagonal-warning", title: "site.insecure", description: "site.insecure.description" },
|
|
1770
|
+
local: { icon: "monitor", title: "site.local", description: "site.local.description" },
|
|
1771
|
+
file: { icon: "folder", title: "site.file", description: "site.file.description" },
|
|
1772
|
+
workspace: { icon: "folder", title: "preview.workspace", description: "site.file.description" },
|
|
1773
|
+
} as const
|
|
1774
|
+
|
|
1775
|
+
/**
|
|
1776
|
+
* What the page can do and what can reach it, under the site button at the address field's start: its connection,
|
|
1777
|
+
* its stored data, the permissions it never gets, the agent's access, and the network it loads through.
|
|
1778
|
+
*/
|
|
1779
|
+
function SiteInformation(props: {
|
|
1780
|
+
url: string
|
|
1781
|
+
server: string | undefined
|
|
1782
|
+
/** The page's cookie count; undefined while the pane cannot answer. */
|
|
1783
|
+
site: () => Promise<{ cookies: number }> | undefined
|
|
1784
|
+
clear: () => Promise<void> | undefined
|
|
1785
|
+
clearCache: () => Promise<void> | undefined
|
|
1786
|
+
}) {
|
|
1787
|
+
const plugin = usePlugin()
|
|
1788
|
+
const [siteState, setSiteState] = createSignal(initialSiteState)
|
|
1789
|
+
// Whether a pointer opened the popover, so closing it returns focus without a focus ring.
|
|
1790
|
+
const [pointer, setPointer] = createSignal(false)
|
|
1791
|
+
const view = createMemo(() => siteView(siteState()))
|
|
1792
|
+
// The second view, "Site settings"; the popover opens on the first.
|
|
1793
|
+
const [detailed, setDetailed] = createSignal(false)
|
|
1794
|
+
// The control that leads to the other view, which takes the keyboard when the view changes.
|
|
1795
|
+
const views: SiteViews = {}
|
|
1796
|
+
let timer: ReturnType<typeof setTimeout> | undefined
|
|
1797
|
+
let trigger: HTMLButtonElement | undefined
|
|
1798
|
+
|
|
1799
|
+
const showDetails = (shown: boolean) => {
|
|
1800
|
+
setDetailed(shown)
|
|
1801
|
+
queueMicrotask(() => (shown ? views.back : views.open)?.focus({ preventScroll: true }))
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
const dispatch = (event: SiteEvent) => {
|
|
1805
|
+
const next = transitionSite(siteState(), event)
|
|
1806
|
+
setSiteState(next.state)
|
|
1807
|
+
next.effects.forEach(run)
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
const run = (effect: SiteEffect) => {
|
|
1811
|
+
if (effect.type === "notify-clear-failed") return showToast({ title: plugin.t("site.clearFailed") })
|
|
1812
|
+
const attempt = effect.attempt
|
|
1813
|
+
const phase = effect.type === "load" ? "loading" : "clearing"
|
|
1814
|
+
clearTimeout(timer)
|
|
1815
|
+
timer = setTimeout(
|
|
1816
|
+
() => dispatch({ type: "timeout", phase, attempt }),
|
|
1817
|
+
effect.type === "load" ? SITE_LOAD_TIMEOUT_MS : SITE_CLEAR_TIMEOUT_MS,
|
|
1818
|
+
)
|
|
1819
|
+
|
|
1820
|
+
if (effect.type === "load") {
|
|
1821
|
+
const pending = props.site()
|
|
1822
|
+
|
|
1823
|
+
if (!pending) return dispatch({ type: "load.failed", attempt })
|
|
1824
|
+
void pending.then(
|
|
1825
|
+
(value) => dispatch({ type: "load.succeeded", attempt, cookies: value.cookies }),
|
|
1826
|
+
() => dispatch({ type: "load.failed", attempt }),
|
|
1827
|
+
)
|
|
1828
|
+
|
|
1829
|
+
return
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
const pending = effect.type === "clear-cache" ? props.clearCache() : props.clear()
|
|
1833
|
+
|
|
1834
|
+
if (!pending) return dispatch({ type: "clear.failed", attempt })
|
|
1835
|
+
void pending.then(
|
|
1836
|
+
() => dispatch({ type: "clear.succeeded", attempt }),
|
|
1837
|
+
() => dispatch({ type: "clear.failed", attempt }),
|
|
1838
|
+
)
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
onCleanup(() => {
|
|
1842
|
+
clearTimeout(timer)
|
|
1843
|
+
dispatch({ type: "disposed" })
|
|
1844
|
+
})
|
|
1845
|
+
|
|
1846
|
+
const kind = () => {
|
|
1847
|
+
const value = connection(props.url)
|
|
1848
|
+
|
|
1849
|
+
return value ? connections[value] : undefined
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
// Only web pages have cookies and ask for permissions; a workspace file has neither.
|
|
1853
|
+
const web = () => {
|
|
1854
|
+
const value = connection(props.url)
|
|
1855
|
+
|
|
1856
|
+
return !!value && value !== "file" && value !== "workspace"
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1859
|
+
const cookieDetail = () => {
|
|
1860
|
+
const current = view()
|
|
1861
|
+
|
|
1862
|
+
if (current.failed) return plugin.t("site.cookies.failed")
|
|
1863
|
+
|
|
1864
|
+
return current.cookies === undefined ? undefined : plugin.plural("site.cookies.count", current.cookies)
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
return (
|
|
1868
|
+
<Popover
|
|
1869
|
+
open={view().open}
|
|
1870
|
+
placement="bottom-start"
|
|
1871
|
+
gutter={8}
|
|
1872
|
+
shift={-10}
|
|
1873
|
+
modal={false}
|
|
1874
|
+
onOpenChange={(open) => {
|
|
1875
|
+
if (!open) setDetailed(false)
|
|
1876
|
+
dispatch({ type: "open.changed", open })
|
|
1877
|
+
}}
|
|
1878
|
+
>
|
|
1879
|
+
<Tooltip placement="top" value={plugin.t("site.info")}>
|
|
1880
|
+
<Popover.Trigger
|
|
1881
|
+
ref={trigger}
|
|
1882
|
+
as={IconButton}
|
|
1883
|
+
type="button"
|
|
1884
|
+
onPointerDown={() => setPointer(true)}
|
|
1885
|
+
onKeyDown={() => setPointer(false)}
|
|
1886
|
+
variant="ghost-muted"
|
|
1887
|
+
size="small"
|
|
1888
|
+
aria-label={plugin.t("site.info")}
|
|
1889
|
+
icon={<Icon name="sliders" />}
|
|
1890
|
+
/>
|
|
1891
|
+
</Tooltip>
|
|
1892
|
+
<Popover.Portal>
|
|
1893
|
+
<Popover.Content
|
|
1894
|
+
data-component="browser-site"
|
|
1895
|
+
// Escape leaves "Site settings" for the first view before it closes the popover.
|
|
1896
|
+
onEscapeKeyDown={(event: KeyboardEvent) => {
|
|
1897
|
+
if (!detailed()) return
|
|
1898
|
+
event.preventDefault()
|
|
1899
|
+
showDetails(false)
|
|
1900
|
+
}}
|
|
1901
|
+
data-browser-popup
|
|
1902
|
+
// The panel takes focus itself rather than its close button, so a pointer opening shows no focus ring there.
|
|
1903
|
+
onOpenAutoFocus={(event: Event) => {
|
|
1904
|
+
event.preventDefault()
|
|
1905
|
+
|
|
1906
|
+
if (event.currentTarget instanceof HTMLElement) event.currentTarget.focus()
|
|
1907
|
+
}}
|
|
1908
|
+
// Focus returns to the trigger on close, which Chromium rings after Escape; a pointer opening keeps it unringed.
|
|
1909
|
+
onCloseAutoFocus={(event: Event) => {
|
|
1910
|
+
if (!pointer()) return
|
|
1911
|
+
event.preventDefault()
|
|
1912
|
+
const active = document.activeElement
|
|
1913
|
+
|
|
1914
|
+
// An outside press already moved focus where it belongs.
|
|
1915
|
+
if (active && active !== document.body && !active.closest('[data-component="browser-site"]')) return
|
|
1916
|
+
trigger?.focus({ preventScroll: true, focusVisible: false })
|
|
1917
|
+
}}
|
|
1918
|
+
>
|
|
1919
|
+
{/* Two views in one popover: what a person wants to know first, then everything else one step away. */}
|
|
1920
|
+
<Show
|
|
1921
|
+
when={detailed()}
|
|
1922
|
+
fallback={
|
|
1923
|
+
<>
|
|
1924
|
+
<div data-slot="browser-site-row">
|
|
1925
|
+
<span data-slot="browser-site-icon">
|
|
1926
|
+
<Icon name="outline-globe" />
|
|
1927
|
+
</span>
|
|
1928
|
+
<Popover.Title data-slot="browser-site-host" dir="ltr">
|
|
1929
|
+
{addressParts(props.url).host || props.url}
|
|
1930
|
+
</Popover.Title>
|
|
1931
|
+
</div>
|
|
1932
|
+
<div data-slot="browser-site-separator" aria-hidden="true" />
|
|
1933
|
+
<Show when={kind()}>
|
|
1934
|
+
{(value) => <SiteRow icon={value().icon} title={plugin.t(value().title)} detail={plugin.t(value().description)} />}
|
|
1935
|
+
</Show>
|
|
1936
|
+
<button
|
|
1937
|
+
ref={views.open}
|
|
1938
|
+
type="button"
|
|
1939
|
+
data-slot="browser-site-row"
|
|
1940
|
+
data-action="browser-site-settings"
|
|
1941
|
+
onClick={() => showDetails(true)}
|
|
1942
|
+
>
|
|
1943
|
+
<span data-slot="browser-site-icon">
|
|
1944
|
+
<Icon name="outline-sliders" />
|
|
1945
|
+
</span>
|
|
1946
|
+
<span class="min-w-0 flex-1 text-start">{plugin.t("site.settings")}</span>
|
|
1947
|
+
<span data-slot="browser-site-icon" class="rtl:-scale-x-100">
|
|
1948
|
+
<Icon name="outline-chevron-right" />
|
|
1949
|
+
</span>
|
|
1950
|
+
</button>
|
|
1951
|
+
</>
|
|
1952
|
+
}
|
|
1953
|
+
>
|
|
1954
|
+
<div data-slot="browser-site-row">
|
|
1955
|
+
{/* The back control stands in the icon column and the heading in the text column, as in every row. */}
|
|
1956
|
+
<span data-slot="browser-site-icon">
|
|
1957
|
+
<IconButton
|
|
1958
|
+
ref={views.back}
|
|
1959
|
+
type="button"
|
|
1960
|
+
variant="ghost-muted"
|
|
1961
|
+
size="small"
|
|
1962
|
+
class="rtl:-scale-x-100"
|
|
1963
|
+
aria-label={plugin.t("site.back")}
|
|
1964
|
+
onClick={() => showDetails(false)}
|
|
1965
|
+
icon={<Icon name="outline-arrow-left" />}
|
|
1966
|
+
/>
|
|
1967
|
+
</span>
|
|
1968
|
+
<span class="flex min-w-0 flex-1 items-baseline gap-2">
|
|
1969
|
+
<Popover.Title class="m-0 shrink-0" style={{ font: "inherit" }}>{plugin.t("site.settings")}</Popover.Title>
|
|
1970
|
+
<span data-slot="browser-site-detail" dir="ltr" class="min-w-0 flex-1 truncate text-end">
|
|
1971
|
+
{addressParts(props.url).host}
|
|
1972
|
+
</span>
|
|
1973
|
+
</span>
|
|
1974
|
+
</div>
|
|
1975
|
+
<div data-slot="browser-site-separator" aria-hidden="true" />
|
|
1976
|
+
<Show when={web()}>
|
|
1977
|
+
<SiteRow icon="outline-cookie" title={plugin.t("site.cookies")} detail={cookieDetail()}>
|
|
1978
|
+
<Button
|
|
1979
|
+
size="small"
|
|
1980
|
+
variant="neutral"
|
|
1981
|
+
disabled={view().actionDisabled}
|
|
1982
|
+
onClick={() => dispatch(view().failed ? { type: "retry" } : { type: "clear.clicked" })}
|
|
1983
|
+
>
|
|
1984
|
+
{plugin.t(view().failed ? "common.retry" : "site.cookies.clear")}
|
|
1985
|
+
</Button>
|
|
1986
|
+
</SiteRow>
|
|
1987
|
+
{/* What it does not do stands under it, so nobody fears losing a sign-in. */}
|
|
1988
|
+
<SiteRow icon="file-document" title={plugin.t("site.cache")} detail={plugin.t("site.clearCache.description")}>
|
|
1989
|
+
<Button
|
|
1990
|
+
size="small"
|
|
1991
|
+
variant="neutral"
|
|
1992
|
+
aria-label={plugin.t("site.clearCache")}
|
|
1993
|
+
disabled={view().actionDisabled || view().failed}
|
|
1994
|
+
onClick={() => dispatch({ type: "clear-cache.clicked" })}
|
|
1995
|
+
>
|
|
1996
|
+
{plugin.t("site.cookies.clear")}
|
|
1997
|
+
</Button>
|
|
1998
|
+
</SiteRow>
|
|
1999
|
+
<SiteRow
|
|
2000
|
+
icon="outline-eye-slash"
|
|
2001
|
+
title={plugin.t("site.permissions")}
|
|
2002
|
+
detail={plugin.t("site.permissions.description")}
|
|
2003
|
+
/>
|
|
2004
|
+
</Show>
|
|
2005
|
+
<SiteRow icon="select-element" title={plugin.t("site.agent")} detail={plugin.t("site.agent.description")} />
|
|
2006
|
+
<Show when={props.server}>
|
|
2007
|
+
{(server) => <SiteRow icon="server" title={plugin.t("site.network", { server: server() })} />}
|
|
2008
|
+
</Show>
|
|
2009
|
+
</Show>
|
|
2010
|
+
</Popover.Content>
|
|
2011
|
+
</Popover.Portal>
|
|
2012
|
+
</Popover>
|
|
2013
|
+
)
|
|
2014
|
+
}
|
|
2015
|
+
|
|
2016
|
+
function SiteRow(props: { icon: IconName; title: string; detail?: string; children?: JSX.Element }) {
|
|
2017
|
+
return (
|
|
2018
|
+
<div data-slot="browser-site-row">
|
|
2019
|
+
<span data-slot="browser-site-icon">
|
|
2020
|
+
<Icon name={props.icon} />
|
|
2021
|
+
</span>
|
|
2022
|
+
<div class="flex min-w-0 flex-1 flex-col gap-0.5">
|
|
2023
|
+
<span>{props.title}</span>
|
|
2024
|
+
<Show when={props.detail}>{(detail) => <span data-slot="browser-site-detail">{detail()}</span>}</Show>
|
|
2025
|
+
</div>
|
|
2026
|
+
{props.children}
|
|
2027
|
+
</div>
|
|
2028
|
+
)
|
|
2029
|
+
}
|