@zyro-sec/gui-plugins 0.0.0-stage → 1.0.4
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,1165 @@
|
|
|
1
|
+
import { createMemo, createSignal, createUniqueId, For, onCleanup, Show, untrack } from "solid-js"
|
|
2
|
+
import { createStore } from "solid-js/store"
|
|
3
|
+
import { createResizeObserver } from "@solid-primitives/resize-observer"
|
|
4
|
+
import { Loader } from "@zyro-sec/ui/loader"
|
|
5
|
+
import { showToast } from "@zyro-sec/ui/toast"
|
|
6
|
+
import {
|
|
7
|
+
cellAtPoint,
|
|
8
|
+
extendTo,
|
|
9
|
+
hyperlinkAtCell,
|
|
10
|
+
normalizeRange,
|
|
11
|
+
parseHyperlinkLocation,
|
|
12
|
+
rangeRect,
|
|
13
|
+
safeExternalHyperlink,
|
|
14
|
+
selectionAt,
|
|
15
|
+
selectionKeyReducer,
|
|
16
|
+
type CellAddr,
|
|
17
|
+
type DisplayList,
|
|
18
|
+
type GridMeta,
|
|
19
|
+
type HyperlinkRegion,
|
|
20
|
+
type Selection,
|
|
21
|
+
type SelectionLimits,
|
|
22
|
+
} from "@betteroffice/xlsx/headless"
|
|
23
|
+
import { createKeyed, createLatest, usePlugin } from "@zyro-sec/plugin/gui"
|
|
24
|
+
import type { FileViewerProps } from "@zyro-sec/plugin/gui/file"
|
|
25
|
+
import { externalUrl } from "./links"
|
|
26
|
+
import { paper } from "./paper"
|
|
27
|
+
import { columnName, contains, coverMerges, hiddenAt, lastCell, settleMerges, skipHidden } from "./sheet-cells"
|
|
28
|
+
import {
|
|
29
|
+
headerHeight,
|
|
30
|
+
paintCells,
|
|
31
|
+
paintHeaders,
|
|
32
|
+
paintSelection,
|
|
33
|
+
rowHeaderWidth,
|
|
34
|
+
shiftGrid,
|
|
35
|
+
trackIndex,
|
|
36
|
+
} from "./sheet-paint"
|
|
37
|
+
import {
|
|
38
|
+
createSheetFrameState,
|
|
39
|
+
needsSheetOpen,
|
|
40
|
+
sheetEnd,
|
|
41
|
+
sheetFrameNeeded,
|
|
42
|
+
sheetMoving,
|
|
43
|
+
sheetPainted,
|
|
44
|
+
sheetPaintFailed,
|
|
45
|
+
transitionSheetFrame,
|
|
46
|
+
type SheetFrameEffect,
|
|
47
|
+
type SheetFrameEvent,
|
|
48
|
+
} from "./sheet-frame-machine"
|
|
49
|
+
import {
|
|
50
|
+
createSheetPickState,
|
|
51
|
+
sheetActiveTab,
|
|
52
|
+
sheetShown,
|
|
53
|
+
sheetShownIndex,
|
|
54
|
+
transitionSheetPick,
|
|
55
|
+
type SheetPickEffect,
|
|
56
|
+
type SheetPickEvent,
|
|
57
|
+
} from "./sheet-pick-machine"
|
|
58
|
+
import {
|
|
59
|
+
IDLE_SHEET_POINTER_STATE,
|
|
60
|
+
sheetPointerMoveNeeded,
|
|
61
|
+
transitionSheetPointer,
|
|
62
|
+
type SheetHit,
|
|
63
|
+
type SheetPointerEffect,
|
|
64
|
+
type SheetPointerEvent,
|
|
65
|
+
type SheetPointerMoved,
|
|
66
|
+
type SheetPointerState,
|
|
67
|
+
} from "./sheet-pointer-machine"
|
|
68
|
+
import type { SheetFrameRequest, SheetLayout, SheetMethods, SheetTab } from "./sheet-protocol"
|
|
69
|
+
import { createOfficeWorker, type WorkerClient } from "./office-worker"
|
|
70
|
+
import { WorkerClosedError } from "./worker-rpc"
|
|
71
|
+
|
|
72
|
+
/** The workbook worker's end in the window. */
|
|
73
|
+
type Client = WorkerClient<SheetMethods>
|
|
74
|
+
|
|
75
|
+
/** An opened workbook: its worker, its visible sheets and the layout of the sheet it opened on. */
|
|
76
|
+
type Opened = { readonly client: Client; readonly tabs: readonly SheetTab[]; readonly layout: SheetLayout }
|
|
77
|
+
|
|
78
|
+
/** One worker call that has not answered yet, and its timeout. */
|
|
79
|
+
type PendingCall = { readonly controller: AbortController; readonly timer: number }
|
|
80
|
+
|
|
81
|
+
/** The timer that ends a scroll once no scroll event came for the settle delay. */
|
|
82
|
+
type FrameTimers = { settle: number }
|
|
83
|
+
|
|
84
|
+
/** The one pointer move event a grid dispatches, written in place so moves allocate nothing. */
|
|
85
|
+
type MoveEvent = { -readonly [K in keyof SheetPointerMoved]: SheetPointerMoved[K] }
|
|
86
|
+
|
|
87
|
+
/** The pointer's position past the headers, in CSS pixels, written in place by each hit test. */
|
|
88
|
+
type PointerSpot = { x: number; y: number }
|
|
89
|
+
|
|
90
|
+
/** The most cells one copy reads; a larger selection would hold the workbook worker for seconds. */
|
|
91
|
+
const copyLimit = 200_000
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The cells screen readers can browse: a block around the active cell that moves with it a step at a time, so a key
|
|
95
|
+
* press rarely rebuilds it and a sheet of any density costs a few hundred cells.
|
|
96
|
+
*/
|
|
97
|
+
const readerBlock = { rows: 10, cols: 5 }
|
|
98
|
+
|
|
99
|
+
/** A read-only Excel workbook with a tab per visible sheet. */
|
|
100
|
+
export default function OfficeSpreadsheet(props: FileViewerProps) {
|
|
101
|
+
const ctx = usePlugin()
|
|
102
|
+
|
|
103
|
+
const viewer = createOfficeWorker<SheetMethods, Opened>({
|
|
104
|
+
bytes: () => props.bytes,
|
|
105
|
+
createWorker: () => new Worker(new URL("./spreadsheet.worker.ts", import.meta.url), { type: "module" }),
|
|
106
|
+
open: async (client, buffer, signal) => {
|
|
107
|
+
const opened = await client.call("open", { bytes: buffer }, { transfer: [buffer], signal })
|
|
108
|
+
|
|
109
|
+
if (!opened) return undefined
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
value: { client, tabs: opened.tabs, layout: opened.layout },
|
|
113
|
+
details: [ctx.plural("sheets", opened.tabs.length)],
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
onDetails: (details) => props.onDetails(details),
|
|
117
|
+
onError: () => props.onError(),
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<Show
|
|
122
|
+
when={viewer.opened()}
|
|
123
|
+
keyed
|
|
124
|
+
fallback={
|
|
125
|
+
<Show when={viewer.loading()}>
|
|
126
|
+
<div class="flex min-h-0 flex-1 items-center justify-center">
|
|
127
|
+
<Loader />
|
|
128
|
+
</div>
|
|
129
|
+
</Show>
|
|
130
|
+
}
|
|
131
|
+
>
|
|
132
|
+
{(opened) => <SpreadsheetWorkbook opened={opened.value} />}
|
|
133
|
+
</Show>
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** One opened workbook: its sheet tabs and the grid of the sheet on show. A reloaded file mounts a new one. */
|
|
138
|
+
function SpreadsheetWorkbook(props: { opened: Opened }) {
|
|
139
|
+
const ctx = usePlugin()
|
|
140
|
+
const panel = createUniqueId()
|
|
141
|
+
|
|
142
|
+
// The sheet on show, and the tab the user picked while its sheet opens in the worker.
|
|
143
|
+
const [pickState, setPickState] = createSignal(createSheetPickState(props.opened.layout))
|
|
144
|
+
// The show calls still running, by attempt.
|
|
145
|
+
const calls = new Map<number, PendingCall>()
|
|
146
|
+
const shown = createMemo(() => sheetShown(pickState()))
|
|
147
|
+
const active = createMemo(() => sheetActiveTab(pickState()))
|
|
148
|
+
|
|
149
|
+
const dispatch = (event: SheetPickEvent) => {
|
|
150
|
+
const next = transitionSheetPick(untrack(pickState), event)
|
|
151
|
+
|
|
152
|
+
setPickState(() => next.state)
|
|
153
|
+
next.effects.forEach(run)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const run = (effect: SheetPickEffect) => {
|
|
157
|
+
if (effect.type === "request-show") return requestShow(effect.attempt, effect.sheet, effect.timeoutMs)
|
|
158
|
+
|
|
159
|
+
if (effect.type === "abort-show") {
|
|
160
|
+
const call = calls.get(effect.attempt)
|
|
161
|
+
|
|
162
|
+
calls.delete(effect.attempt)
|
|
163
|
+
clearTimeout(call?.timer)
|
|
164
|
+
call?.controller.abort()
|
|
165
|
+
|
|
166
|
+
return
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
showToast({ title: ctx.t("sheet.openFailed") })
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const requestShow = (attempt: number, sheet: number, timeoutMs: number) => {
|
|
173
|
+
const call: PendingCall = {
|
|
174
|
+
controller: new AbortController(),
|
|
175
|
+
timer: window.setTimeout(() => dispatch({ type: "show.timed-out", attempt }), timeoutMs),
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const settle = () => {
|
|
179
|
+
clearTimeout(call.timer)
|
|
180
|
+
calls.delete(attempt)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
calls.set(attempt, call)
|
|
184
|
+
void props.opened.client.call("show", { sheet }, { signal: call.controller.signal }).then(
|
|
185
|
+
(layout) => {
|
|
186
|
+
settle()
|
|
187
|
+
dispatch({ type: "show.succeeded", attempt, layout })
|
|
188
|
+
},
|
|
189
|
+
(error: Error) => {
|
|
190
|
+
settle()
|
|
191
|
+
// A stopped worker reports itself through the viewer, so the pick ends without a second notice.
|
|
192
|
+
dispatch({ type: "show.failed", attempt, closed: error instanceof WorkerClosedError })
|
|
193
|
+
},
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
onCleanup(() => dispatch({ type: "disposed" }))
|
|
198
|
+
|
|
199
|
+
const show = (index: number, target?: CellAddr) => dispatch({ type: "sheet.picked", sheet: index, target })
|
|
200
|
+
|
|
201
|
+
// A link to a hidden or missing sheet goes nowhere, as in Excel.
|
|
202
|
+
const navigate = (name: string, cell: CellAddr) => {
|
|
203
|
+
const tab = props.opened.tabs.find((candidate) => candidate.name.toLowerCase() === name.toLowerCase())
|
|
204
|
+
|
|
205
|
+
if (tab) show(tab.index, cell)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// The arrow keys move between the sheet tabs and open the one they reach; only the open tab is in the Tab order.
|
|
209
|
+
const roam = (event: KeyboardEvent & { currentTarget: HTMLDivElement }) => {
|
|
210
|
+
const tabs = props.opened.tabs
|
|
211
|
+
const current = tabs.findIndex((tab) => tab.index === active())
|
|
212
|
+
const forward = getComputedStyle(event.currentTarget).direction === "rtl" ? "ArrowLeft" : "ArrowRight"
|
|
213
|
+
const backward = forward === "ArrowRight" ? "ArrowLeft" : "ArrowRight"
|
|
214
|
+
|
|
215
|
+
const position = (() => {
|
|
216
|
+
if (event.key === "Home") return 0
|
|
217
|
+
|
|
218
|
+
if (event.key === "End") return tabs.length - 1
|
|
219
|
+
|
|
220
|
+
if (event.key === forward) return (current + 1) % tabs.length
|
|
221
|
+
|
|
222
|
+
if (event.key === backward) return (current - 1 + tabs.length) % tabs.length
|
|
223
|
+
|
|
224
|
+
return undefined
|
|
225
|
+
})()
|
|
226
|
+
|
|
227
|
+
const tab = position === undefined ? undefined : tabs[position]
|
|
228
|
+
|
|
229
|
+
if (position === undefined || !tab) return
|
|
230
|
+
|
|
231
|
+
event.preventDefault()
|
|
232
|
+
show(tab.index)
|
|
233
|
+
event.currentTarget.querySelectorAll<HTMLElement>("[role=tab]")[position]?.focus()
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const tabID = (index: number | undefined) => `${panel}-tab-${index}`
|
|
237
|
+
|
|
238
|
+
return (
|
|
239
|
+
<div class="flex min-h-0 flex-1 flex-col">
|
|
240
|
+
<div
|
|
241
|
+
id={panel}
|
|
242
|
+
role={props.opened.tabs.length > 1 ? "tabpanel" : undefined}
|
|
243
|
+
aria-labelledby={props.opened.tabs.length > 1 ? tabID(sheetShownIndex(pickState())) : undefined}
|
|
244
|
+
class="flex min-h-0 flex-1"
|
|
245
|
+
>
|
|
246
|
+
{/* Each sheet gets its own grid, so its selection and scroll position start fresh. */}
|
|
247
|
+
<Show when={shown()} keyed>
|
|
248
|
+
{(shown) => (
|
|
249
|
+
<SpreadsheetGrid
|
|
250
|
+
client={props.opened.client}
|
|
251
|
+
layout={shown.layout}
|
|
252
|
+
target={shown.target}
|
|
253
|
+
onNavigate={navigate}
|
|
254
|
+
/>
|
|
255
|
+
)}
|
|
256
|
+
</Show>
|
|
257
|
+
</div>
|
|
258
|
+
<Show when={props.opened.tabs.length > 1}>
|
|
259
|
+
<div
|
|
260
|
+
role="tablist"
|
|
261
|
+
aria-label={ctx.t("sheet.tabs")}
|
|
262
|
+
class="flex h-9 shrink-0 items-center gap-1 overflow-x-auto border-t border-v2-border-border-muted px-2"
|
|
263
|
+
onKeyDown={roam}
|
|
264
|
+
>
|
|
265
|
+
<For each={props.opened.tabs}>
|
|
266
|
+
{(tab) => (
|
|
267
|
+
<button
|
|
268
|
+
type="button"
|
|
269
|
+
role="tab"
|
|
270
|
+
id={tabID(tab.index)}
|
|
271
|
+
aria-controls={panel}
|
|
272
|
+
aria-selected={tab.index === active()}
|
|
273
|
+
tabIndex={tab.index === active() ? 0 : -1}
|
|
274
|
+
class="h-7 shrink-0 rounded-md px-2.5 text-13-regular text-text-weak hover:bg-v2-background-bg-layer-02 aria-selected:bg-v2-background-bg-layer-02 aria-selected:text-text-strong"
|
|
275
|
+
onClick={() => show(tab.index)}
|
|
276
|
+
>
|
|
277
|
+
{tab.name}
|
|
278
|
+
</button>
|
|
279
|
+
)}
|
|
280
|
+
</For>
|
|
281
|
+
</div>
|
|
282
|
+
</Show>
|
|
283
|
+
</div>
|
|
284
|
+
)
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* The active sheet as one canvas the size of the pane, with row and column headers along its edges. The workbook worker
|
|
289
|
+
* paints the cells under the scroll position, frozen panes included, so a sheet of any size costs one viewport; the
|
|
290
|
+
* window draws that bitmap with the headers and the selection over it. The scroll coordinates are the engine's: the
|
|
291
|
+
* frozen panes stay put while the rest scrolls beside them.
|
|
292
|
+
*/
|
|
293
|
+
function SpreadsheetGrid(props: {
|
|
294
|
+
client: Client
|
|
295
|
+
layout: SheetLayout
|
|
296
|
+
target: CellAddr | undefined
|
|
297
|
+
onNavigate: (sheet: string, cell: CellAddr) => void
|
|
298
|
+
}) {
|
|
299
|
+
const ctx = usePlugin()
|
|
300
|
+
const id = createUniqueId()
|
|
301
|
+
const controller = new AbortController()
|
|
302
|
+
let scroller: HTMLDivElement | undefined
|
|
303
|
+
let canvas: HTMLCanvasElement | undefined
|
|
304
|
+
let frame = 0
|
|
305
|
+
// The frame on screen's grid and links where the screen shows them, which pointer hits and links read.
|
|
306
|
+
let shown: { grid: GridMeta | undefined; links: DisplayList } | undefined
|
|
307
|
+
// The pointer gesture: what a pointer that is down drags across, and the cell a click without a drag follows.
|
|
308
|
+
const [pointerState, setPointerState] = createSignal<SheetPointerState>(IDLE_SHEET_POINTER_STATE)
|
|
309
|
+
|
|
310
|
+
// Built once: every pointer move during a drag writes them in place.
|
|
311
|
+
const moveEvent: MoveEvent = {
|
|
312
|
+
type: "pointer.moved",
|
|
313
|
+
pointerId: 0,
|
|
314
|
+
buttons: 0,
|
|
315
|
+
row: -1,
|
|
316
|
+
col: -1,
|
|
317
|
+
focusRow: 0,
|
|
318
|
+
focusCol: 0,
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
const spot: PointerSpot = { x: 0, y: 0 }
|
|
322
|
+
// The frames the worker draws, which the newest reply on screen stays until the next replaces it.
|
|
323
|
+
const [frameState, setFrameState] = createSignal(createSheetFrameState())
|
|
324
|
+
// The frame calls still running, and the timer that ends scrolling.
|
|
325
|
+
const calls = new Map<number, PendingCall>()
|
|
326
|
+
const timers: FrameTimers = { settle: 0 }
|
|
327
|
+
// Built once: the scroll path dispatches them on every event.
|
|
328
|
+
const scrollEvent: SheetFrameEvent = { type: "scroll" }
|
|
329
|
+
const settledEvent: SheetFrameEvent = { type: "scroll.settled" }
|
|
330
|
+
|
|
331
|
+
onCleanup(() => controller.abort())
|
|
332
|
+
|
|
333
|
+
// The last paint, in the engine's scroll coordinates: the scroll position, the size of the cells beside the headers,
|
|
334
|
+
// the frozen panes', the row headers' width, and the farthest point a jump asked for.
|
|
335
|
+
const [view, setView] = createStore({
|
|
336
|
+
left: 0,
|
|
337
|
+
top: 0,
|
|
338
|
+
width: 0,
|
|
339
|
+
height: 0,
|
|
340
|
+
frozenWidth: 0,
|
|
341
|
+
frozenHeight: 0,
|
|
342
|
+
header: 0,
|
|
343
|
+
reachX: 0,
|
|
344
|
+
reachY: 0,
|
|
345
|
+
})
|
|
346
|
+
|
|
347
|
+
// Where the sheet's last cell ends, past the frozen panes, as the frame on screen reports it. A viewport past it
|
|
348
|
+
// makes the engine throw.
|
|
349
|
+
const end = createMemo(() => sheetEnd(frameState()), undefined, {
|
|
350
|
+
equals: (previous, next) => previous?.x === next?.x && previous?.y === next?.y,
|
|
351
|
+
})
|
|
352
|
+
|
|
353
|
+
const paintFailed = createMemo(() => sheetPaintFailed(frameState()))
|
|
354
|
+
|
|
355
|
+
const [state, setState] = createStore<{
|
|
356
|
+
selection: Selection
|
|
357
|
+
hover: { cursor: string; title: string | undefined }
|
|
358
|
+
}>({
|
|
359
|
+
selection: selectionAt({ row: 0, col: 0 }),
|
|
360
|
+
hover: { cursor: "default", title: undefined },
|
|
361
|
+
})
|
|
362
|
+
|
|
363
|
+
const [ratio, setRatio] = createSignal(window.devicePixelRatio || 1)
|
|
364
|
+
|
|
365
|
+
const info = () => props.layout.info
|
|
366
|
+
const sheet = () => info().activeSheet
|
|
367
|
+
const name = () => info().sheetNames[sheet()] ?? ""
|
|
368
|
+
const frozen = () => ({ rows: info().frozenRows, cols: info().frozenCols })
|
|
369
|
+
|
|
370
|
+
// As in Excel, the sheet scrolls one screen past the farthest point seen, up to its last cell.
|
|
371
|
+
const area = () => {
|
|
372
|
+
const limit = end()
|
|
373
|
+
|
|
374
|
+
const width = Math.max(
|
|
375
|
+
info().contentWidth,
|
|
376
|
+
props.layout.chartWidth + view.frozenWidth,
|
|
377
|
+
view.reachX,
|
|
378
|
+
view.left + view.width,
|
|
379
|
+
)
|
|
380
|
+
|
|
381
|
+
const height = Math.max(
|
|
382
|
+
info().contentHeight,
|
|
383
|
+
props.layout.chartHeight + view.frozenHeight,
|
|
384
|
+
view.reachY,
|
|
385
|
+
view.top + view.height,
|
|
386
|
+
)
|
|
387
|
+
|
|
388
|
+
return {
|
|
389
|
+
width: view.header + Math.min(limit ? limit.x + view.frozenWidth : Infinity, width + view.width),
|
|
390
|
+
height: headerHeight + Math.min(limit ? limit.y + view.frozenHeight : Infinity, height + view.height),
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
const selected = createMemo(() => coverMerges(normalizeRange(state.selection), props.layout.merges))
|
|
395
|
+
|
|
396
|
+
const paint = () => {
|
|
397
|
+
if (!scroller || !canvas) return
|
|
398
|
+
|
|
399
|
+
const context = canvas.getContext("2d")
|
|
400
|
+
|
|
401
|
+
if (!context) return
|
|
402
|
+
|
|
403
|
+
const ratio = window.devicePixelRatio || 1
|
|
404
|
+
const width = scroller.clientWidth
|
|
405
|
+
const height = scroller.clientHeight
|
|
406
|
+
const headers = { width: view.header || rowHeaderWidth(context, 99), height: headerHeight }
|
|
407
|
+
const size = { width: width - headers.width, height: height - headers.height }
|
|
408
|
+
|
|
409
|
+
if (size.width <= 0 || size.height <= 0) return
|
|
410
|
+
|
|
411
|
+
if (needsSheetOpen(untrack(frameState))) dispatch({ type: "sheet.opened", width: size.width, height: size.height })
|
|
412
|
+
|
|
413
|
+
const limit = end()
|
|
414
|
+
const left = clamp(scroller.scrollLeft, limit ? limit.x + view.frozenWidth - size.width : Infinity)
|
|
415
|
+
const top = clamp(scroller.scrollTop, limit ? limit.y + view.frozenHeight - size.height : Infinity)
|
|
416
|
+
|
|
417
|
+
// While the sheet scrolls, frames reach past the screen, so the next scroll still shows cells while its own frame
|
|
418
|
+
// renders. Once it settles, a frame of the screen alone replaces it.
|
|
419
|
+
const margin = { x: Math.round(size.width / 4), y: Math.round(size.height / 2) }
|
|
420
|
+
const moving = sheetMoving(untrack(frameState))
|
|
421
|
+
const x = Math.max(0, left - margin.x)
|
|
422
|
+
const y = Math.max(0, top - margin.y)
|
|
423
|
+
|
|
424
|
+
const input: SheetFrameRequest = {
|
|
425
|
+
sheet: sheet(),
|
|
426
|
+
x: left,
|
|
427
|
+
y: top,
|
|
428
|
+
...size,
|
|
429
|
+
ratio,
|
|
430
|
+
offset: { x: fraction(headers.width * ratio), y: fraction(headers.height * ratio) },
|
|
431
|
+
wider:
|
|
432
|
+
moving && limit
|
|
433
|
+
? {
|
|
434
|
+
x,
|
|
435
|
+
y,
|
|
436
|
+
width: Math.min(left + size.width + margin.x, limit.x + view.frozenWidth) - x,
|
|
437
|
+
height: Math.min(top + size.height + margin.y, limit.y + view.frozenHeight) - y,
|
|
438
|
+
}
|
|
439
|
+
: undefined,
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
// While the sheet scrolls, a frame that still reaches half its margin past the screen serves on, so the worker
|
|
443
|
+
// paints the next one only as the scroll nears its edge.
|
|
444
|
+
const needed = limit && {
|
|
445
|
+
x: Math.max(0, left - margin.x / 2),
|
|
446
|
+
y: Math.max(0, top - margin.y / 2),
|
|
447
|
+
right: Math.min(left + size.width + margin.x / 2, limit.x + view.frozenWidth),
|
|
448
|
+
bottom: Math.min(top + size.height + margin.y / 2, limit.y + view.frozenHeight),
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// Only the newest request waits its turn in the worker: a scroll that outruns it skips the frames in between.
|
|
452
|
+
if (sheetFrameNeeded(untrack(frameState), input, needed)) dispatch({ type: "frame.requested", request: input })
|
|
453
|
+
|
|
454
|
+
const painted = sheetPainted(untrack(frameState))
|
|
455
|
+
|
|
456
|
+
// Until the first frame arrives the paper shows.
|
|
457
|
+
if (!painted) return setView({ left, top, ...size })
|
|
458
|
+
|
|
459
|
+
// A new backing size reallocates the canvas, so it changes only with the pane or the display; each paint below
|
|
460
|
+
// covers every pixel.
|
|
461
|
+
if (canvas.width !== Math.round(width * ratio) || canvas.height !== Math.round(height * ratio)) {
|
|
462
|
+
canvas.width = Math.round(width * ratio)
|
|
463
|
+
canvas.height = Math.round(height * ratio)
|
|
464
|
+
canvas.style.width = `${width}px`
|
|
465
|
+
canvas.style.height = `${height}px`
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
paintCells(context, painted, { ratio, headers, x: left, y: top, ...size })
|
|
469
|
+
|
|
470
|
+
const panes = painted.frame.frozen
|
|
471
|
+
const drawn = painted.frame.viewport
|
|
472
|
+
|
|
473
|
+
const grid =
|
|
474
|
+
painted.frame.grid && shiftGrid(painted.frame.grid, frozen(), panes, { x: drawn.x - left, y: drawn.y - top })
|
|
475
|
+
|
|
476
|
+
shown = { grid, links: { width: 0, height: 0, commands: [], hyperlinks: [...painted.frame.hyperlinks] } }
|
|
477
|
+
|
|
478
|
+
if (grid) {
|
|
479
|
+
const anchor = state.selection.anchor
|
|
480
|
+
|
|
481
|
+
paintSelection(context, {
|
|
482
|
+
grid,
|
|
483
|
+
ratio,
|
|
484
|
+
headers,
|
|
485
|
+
...size,
|
|
486
|
+
range: selected(),
|
|
487
|
+
active: coverMerges(
|
|
488
|
+
{ top: anchor.row, left: anchor.col, bottom: anchor.row, right: anchor.col },
|
|
489
|
+
props.layout.merges,
|
|
490
|
+
),
|
|
491
|
+
})
|
|
492
|
+
paintHeaders(context, { grid, ratio, headers, width, height, selected: selected() })
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
// The last row on screen; a frame with a margin holds rows past it.
|
|
496
|
+
const last = grid
|
|
497
|
+
? grid.rowOffsets.findLastIndex(
|
|
498
|
+
(offset, position) => position < grid.rowOffsets.length - 1 && offset < size.height,
|
|
499
|
+
)
|
|
500
|
+
: -1
|
|
501
|
+
|
|
502
|
+
const header = rowHeaderWidth(context, grid ? trackIndex(grid.startRow, grid.rowIndices, Math.max(0, last)) + 1 : 1)
|
|
503
|
+
|
|
504
|
+
setView({ left, top, ...size, frozenWidth: panes.width, frozenHeight: panes.height, header })
|
|
505
|
+
|
|
506
|
+
// Longer row numbers widen the row headers, which narrows the cells: draw again at the new width.
|
|
507
|
+
if (header !== headers.width) schedule()
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
const dispatch = (event: SheetFrameEvent) => {
|
|
511
|
+
const next = transitionSheetFrame(untrack(frameState), event)
|
|
512
|
+
|
|
513
|
+
setFrameState(() => next.state)
|
|
514
|
+
next.effects.forEach(run)
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
const run = (effect: SheetFrameEffect) => {
|
|
518
|
+
if (effect.type === "schedule-paint") return schedule()
|
|
519
|
+
|
|
520
|
+
if (effect.type === "restart-settle") {
|
|
521
|
+
clearTimeout(timers.settle)
|
|
522
|
+
timers.settle = window.setTimeout(() => dispatch(settledEvent), effect.delayMs)
|
|
523
|
+
|
|
524
|
+
return
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
if (effect.type === "request-frame") return requestFrame(effect.attempt, effect.request, effect.timeoutMs)
|
|
528
|
+
|
|
529
|
+
if (effect.type === "abort-frame") return calls.get(effect.attempt)?.controller.abort()
|
|
530
|
+
|
|
531
|
+
if (effect.type === "close-frame") return effect.frame.bitmap.close()
|
|
532
|
+
|
|
533
|
+
if (effect.type === "open-sheet") {
|
|
534
|
+
setView({ width: effect.width, height: effect.height })
|
|
535
|
+
open()
|
|
536
|
+
|
|
537
|
+
return
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
clearTimeout(timers.settle)
|
|
541
|
+
cancelAnimationFrame(frame)
|
|
542
|
+
calls.forEach((call) => {
|
|
543
|
+
clearTimeout(call.timer)
|
|
544
|
+
call.controller.abort()
|
|
545
|
+
})
|
|
546
|
+
calls.clear()
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
// Asks the worker for the frame under the scroll position. A newer request with the same key replaces one that
|
|
550
|
+
// still waits there; one that runs finishes, and shows while the newer renders.
|
|
551
|
+
const requestFrame = (attempt: number, request: SheetFrameRequest, timeoutMs: number) => {
|
|
552
|
+
const call: PendingCall = {
|
|
553
|
+
controller: new AbortController(),
|
|
554
|
+
timer: window.setTimeout(() => dispatch({ type: "frame.timed-out", attempt }), timeoutMs),
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
const settle = () => {
|
|
558
|
+
clearTimeout(call.timer)
|
|
559
|
+
calls.delete(attempt)
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
calls.set(attempt, call)
|
|
563
|
+
void props.client.call("frame", request, { key: "frame", signal: call.controller.signal }).then(
|
|
564
|
+
(reply) => {
|
|
565
|
+
settle()
|
|
566
|
+
// Cells the engine cannot draw here leave the last frame on screen, with a notice.
|
|
567
|
+
dispatch(
|
|
568
|
+
reply ? { type: "frame.succeeded", attempt, request, frame: reply } : { type: "frame.failed", attempt },
|
|
569
|
+
)
|
|
570
|
+
},
|
|
571
|
+
() => {
|
|
572
|
+
settle()
|
|
573
|
+
dispatch({ type: "frame.failed", attempt })
|
|
574
|
+
},
|
|
575
|
+
)
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
onCleanup(() => dispatch({ type: "disposed" }))
|
|
579
|
+
|
|
580
|
+
// A scroll draws frames with a margin until it settles, when one more paint draws the screen alone.
|
|
581
|
+
const scrolled = () => dispatch(scrollEvent)
|
|
582
|
+
|
|
583
|
+
// One paint per frame, however many scroll, resize and pointer events arrive in it.
|
|
584
|
+
const schedule = () => {
|
|
585
|
+
if (frame) return
|
|
586
|
+
|
|
587
|
+
frame = requestAnimationFrame(() => {
|
|
588
|
+
frame = 0
|
|
589
|
+
paint()
|
|
590
|
+
})
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
createResizeObserver(() => scroller, schedule)
|
|
594
|
+
|
|
595
|
+
// Syncs with the display's pixel ratio, which changes at the same CSS size when the window moves to another screen. A
|
|
596
|
+
// media query matches one ratio, so each new ratio arms a new one.
|
|
597
|
+
createKeyed(ratio, (value) => {
|
|
598
|
+
const query = window.matchMedia(`(resolution: ${value}dppx)`)
|
|
599
|
+
|
|
600
|
+
const change = () => {
|
|
601
|
+
setRatio(window.devicePixelRatio || 1)
|
|
602
|
+
schedule()
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
query.addEventListener("change", change)
|
|
606
|
+
onCleanup(() => query.removeEventListener("change", change))
|
|
607
|
+
})
|
|
608
|
+
|
|
609
|
+
// The block of cells around the active cell that the screen reader grid holds, which moves a step at a time.
|
|
610
|
+
const block = createMemo(
|
|
611
|
+
() => {
|
|
612
|
+
const focus = state.selection.focus
|
|
613
|
+
const top = Math.max(0, (Math.floor(focus.row / readerBlock.rows) - 1) * readerBlock.rows)
|
|
614
|
+
const left = Math.max(0, (Math.floor(focus.col / readerBlock.cols) - 1) * readerBlock.cols)
|
|
615
|
+
|
|
616
|
+
return {
|
|
617
|
+
top,
|
|
618
|
+
left,
|
|
619
|
+
bottom: Math.min(lastCell.row, top + readerBlock.rows * 3 - 1),
|
|
620
|
+
right: Math.min(lastCell.col, left + readerBlock.cols * 3 - 1),
|
|
621
|
+
}
|
|
622
|
+
},
|
|
623
|
+
undefined,
|
|
624
|
+
{ equals: (previous, next) => previous.top === next.top && previous.left === next.left },
|
|
625
|
+
)
|
|
626
|
+
|
|
627
|
+
const reading = createLatest(block, (range, signal) =>
|
|
628
|
+
props.client.call("cells", { sheet: sheet(), range }, { signal }).then((texts) => ({ range, texts })),
|
|
629
|
+
)
|
|
630
|
+
|
|
631
|
+
// The block's cells as they show, for screen readers, without the hidden rows and columns.
|
|
632
|
+
const readable = createMemo(() => {
|
|
633
|
+
const read = reading.latest
|
|
634
|
+
|
|
635
|
+
if (!read) return { columns: [], rows: [] }
|
|
636
|
+
|
|
637
|
+
const range = read.range
|
|
638
|
+
const hidden = props.layout.hidden
|
|
639
|
+
const tracks = (first: number, last: number) => Array.from({ length: last - first + 1 }, (_, step) => first + step)
|
|
640
|
+
const columns = tracks(range.left, range.right).filter((col) => !hiddenAt(hidden.columns, col))
|
|
641
|
+
|
|
642
|
+
return {
|
|
643
|
+
columns,
|
|
644
|
+
rows: tracks(range.top, range.bottom)
|
|
645
|
+
.filter((row) => !hiddenAt(hidden.rows, row))
|
|
646
|
+
.map((row) => ({
|
|
647
|
+
row,
|
|
648
|
+
cells: columns.map((col) => ({ row, col, text: read.texts[row - range.top]?.[col - range.left] ?? "" })),
|
|
649
|
+
})),
|
|
650
|
+
}
|
|
651
|
+
})
|
|
652
|
+
|
|
653
|
+
const cellID = (cell: CellAddr) => `${id}-${cell.row}-${cell.col}`
|
|
654
|
+
|
|
655
|
+
// The cell keyboard moves reach, which screen readers announce: the active cell, or the far corner of a selection the
|
|
656
|
+
// keys extend.
|
|
657
|
+
const activeCell = () => {
|
|
658
|
+
const focus = state.selection.focus
|
|
659
|
+
const grid = readable()
|
|
660
|
+
|
|
661
|
+
if (!grid.columns.includes(focus.col) || !grid.rows.some((row) => row.row === focus.row)) return undefined
|
|
662
|
+
|
|
663
|
+
return cellID(focus)
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
// Scrolls to where the workbook last showed the sheet, or to the cell a link opened it on.
|
|
667
|
+
const open = () => {
|
|
668
|
+
const target = props.target
|
|
669
|
+
|
|
670
|
+
// A link in the previous sheet's grid opened this one: keep the keyboard in the grid.
|
|
671
|
+
if (target) {
|
|
672
|
+
scroller?.focus({ preventScroll: true })
|
|
673
|
+
select(at(target))
|
|
674
|
+
reveal(target, "start")
|
|
675
|
+
|
|
676
|
+
return
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
setView({ reachX: info().initialScrollX + view.width, reachY: info().initialScrollY + view.height })
|
|
680
|
+
scroller?.scrollTo({ left: info().initialScrollX, top: info().initialScrollY })
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
const select = (selection: Selection) => {
|
|
684
|
+
setState("selection", selection)
|
|
685
|
+
schedule()
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
// One cell selected; a merged cell selects from its first cell.
|
|
689
|
+
const at = (cell: CellAddr) => {
|
|
690
|
+
const merge = props.layout.merges.find((candidate) => contains(candidate, cell))
|
|
691
|
+
|
|
692
|
+
return selectionAt(merge ? { row: merge.top, col: merge.left } : cell)
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
// Scrolls a cell into view, past the frozen panes; a cell inside them is always in view. A cell the frame on screen
|
|
696
|
+
// shows whole is in view already, which saves asking the worker where it is.
|
|
697
|
+
const reveal = (cell: CellAddr, align: "start" | "nearest") => {
|
|
698
|
+
if (!scroller || (align === "nearest" && whole(cell))) return
|
|
699
|
+
|
|
700
|
+
// A plain copy: the cell may come from a store, whose proxy cannot cross to the worker.
|
|
701
|
+
const target = { row: cell.row, col: cell.col }
|
|
702
|
+
|
|
703
|
+
void props.client
|
|
704
|
+
.call("position", { sheet: sheet(), cell: target }, { key: "position", signal: controller.signal })
|
|
705
|
+
.then(
|
|
706
|
+
(position) => {
|
|
707
|
+
if (!scroller || !position) return
|
|
708
|
+
|
|
709
|
+
const start = position.start
|
|
710
|
+
const next = position.next
|
|
711
|
+
|
|
712
|
+
const left =
|
|
713
|
+
cell.col < info().frozenCols
|
|
714
|
+
? scroller.scrollLeft
|
|
715
|
+
: place(start.x, next.x - start.x, scroller.scrollLeft, view.width - view.frozenWidth, align)
|
|
716
|
+
|
|
717
|
+
const top =
|
|
718
|
+
cell.row < info().frozenRows
|
|
719
|
+
? scroller.scrollTop
|
|
720
|
+
: place(start.y, next.y - start.y, scroller.scrollTop, view.height - view.frozenHeight, align)
|
|
721
|
+
|
|
722
|
+
// Grow the scroll area first, so the scroll is not cut short at its current edge.
|
|
723
|
+
setView({ reachX: left + view.width, reachY: top + view.height })
|
|
724
|
+
scroller.scrollTo({ left, top })
|
|
725
|
+
},
|
|
726
|
+
() => undefined,
|
|
727
|
+
)
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
// Whether the screen shows a cell whole and clear of the panes, as the frame on it tells.
|
|
731
|
+
const whole = (cell: CellAddr) => {
|
|
732
|
+
const grid = shown?.grid
|
|
733
|
+
|
|
734
|
+
if (!grid) return false
|
|
735
|
+
|
|
736
|
+
const rect = rangeRect(grid, { top: cell.row, left: cell.col, bottom: cell.row, right: cell.col })
|
|
737
|
+
|
|
738
|
+
if (!rect) return false
|
|
739
|
+
|
|
740
|
+
// A cell in the panes keeps the scroll along that side. Past them, a track that starts on the panes' edge may run
|
|
741
|
+
// on under them, so only one that starts after it is surely whole.
|
|
742
|
+
const clear = (start: number, pane: number, frozen: boolean) => frozen || (pane > 0 ? start > pane : start >= 0)
|
|
743
|
+
|
|
744
|
+
return (
|
|
745
|
+
clear(rect.x, view.frozenWidth, cell.col < info().frozenCols) &&
|
|
746
|
+
clear(rect.y, view.frozenHeight, cell.row < info().frozenRows) &&
|
|
747
|
+
rect.x + rect.w <= view.width &&
|
|
748
|
+
rect.y + rect.h <= view.height
|
|
749
|
+
)
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
// The cell under a pointer; where the pointer is past the headers lands in `spot`. While dragging, a pointer past the
|
|
753
|
+
// cells holds to the nearest one.
|
|
754
|
+
const locate = (event: PointerEvent, held: boolean): CellAddr | undefined => {
|
|
755
|
+
const grid = shown?.grid
|
|
756
|
+
|
|
757
|
+
if (!grid || !canvas) return undefined
|
|
758
|
+
|
|
759
|
+
const rect = canvas.getBoundingClientRect()
|
|
760
|
+
|
|
761
|
+
spot.x = event.clientX - rect.left - view.header
|
|
762
|
+
spot.y = event.clientY - rect.top - headerHeight
|
|
763
|
+
|
|
764
|
+
if (!held && (spot.x >= view.width || spot.y >= view.height)) return undefined
|
|
765
|
+
|
|
766
|
+
const cell = cellAtPoint(
|
|
767
|
+
grid,
|
|
768
|
+
Math.min(Math.max(spot.x, 0), view.width - 1, (grid.colOffsets[grid.colOffsets.length - 1] ?? 0) - 1),
|
|
769
|
+
Math.min(Math.max(spot.y, 0), view.height - 1, (grid.rowOffsets[grid.rowOffsets.length - 1] ?? 0) - 1),
|
|
770
|
+
)
|
|
771
|
+
|
|
772
|
+
if (!cell) return undefined
|
|
773
|
+
|
|
774
|
+
return cell
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
// Where a pointer went down: a cell, a whole row or column, or the corner that selects all.
|
|
778
|
+
const hit = (event: PointerEvent): SheetHit | undefined => {
|
|
779
|
+
const cell = locate(event, false)
|
|
780
|
+
|
|
781
|
+
if (!cell) return undefined
|
|
782
|
+
|
|
783
|
+
if (spot.x < 0 && spot.y < 0) return { kind: "all", cell }
|
|
784
|
+
|
|
785
|
+
if (spot.y < 0) return { kind: "column", cell }
|
|
786
|
+
|
|
787
|
+
if (spot.x < 0) return { kind: "row", cell }
|
|
788
|
+
|
|
789
|
+
return { kind: "cell", cell }
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
const dispatchPointer = (event: SheetPointerEvent) => {
|
|
793
|
+
const next = transitionSheetPointer(untrack(pointerState), event)
|
|
794
|
+
|
|
795
|
+
setPointerState(() => next.state)
|
|
796
|
+
next.effects.forEach(runPointer)
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
const runPointer = (effect: SheetPointerEffect) => {
|
|
800
|
+
if (effect.type === "capture-pointer") return scroller?.setPointerCapture(effect.pointerId)
|
|
801
|
+
|
|
802
|
+
if (effect.type === "follow-link") return follow(effect.cell)
|
|
803
|
+
|
|
804
|
+
const anchor = state.selection.anchor
|
|
805
|
+
|
|
806
|
+
// A whole row or column keeps its far end as the anchor, so the arrow keys move on from its first cell.
|
|
807
|
+
if (effect.type === "select-all")
|
|
808
|
+
return select({ anchor: { row: lastCell.row, col: lastCell.col }, focus: { row: 0, col: 0 } })
|
|
809
|
+
|
|
810
|
+
if (effect.type === "select-column")
|
|
811
|
+
return select({
|
|
812
|
+
anchor: { row: lastCell.row, col: effect.extend ? anchor.col : effect.col },
|
|
813
|
+
focus: { row: 0, col: effect.col },
|
|
814
|
+
})
|
|
815
|
+
|
|
816
|
+
if (effect.type === "select-row")
|
|
817
|
+
return select({
|
|
818
|
+
anchor: { row: effect.extend ? anchor.row : effect.row, col: lastCell.col },
|
|
819
|
+
focus: { row: effect.row, col: 0 },
|
|
820
|
+
})
|
|
821
|
+
|
|
822
|
+
if (effect.type === "select-cell")
|
|
823
|
+
return select(effect.extend ? extendTo(state.selection, effect.cell) : at(effect.cell))
|
|
824
|
+
|
|
825
|
+
// A drag moves the selection's far corner: to the cell under the pointer, or along the row or column headers.
|
|
826
|
+
select({ anchor, focus: effect.focus })
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
onCleanup(() => dispatchPointer({ type: "disposed" }))
|
|
830
|
+
|
|
831
|
+
const press = (event: PointerEvent) =>
|
|
832
|
+
dispatchPointer({
|
|
833
|
+
type: "pointer.down",
|
|
834
|
+
pointerId: event.pointerId,
|
|
835
|
+
button: event.button,
|
|
836
|
+
shift: event.shiftKey,
|
|
837
|
+
hit: event.button === 0 ? hit(event) : undefined,
|
|
838
|
+
})
|
|
839
|
+
|
|
840
|
+
// Runs on every pointer move: a drag dispatches only when the move changes something, and hovering writes the cursor
|
|
841
|
+
// and tooltip only when they change.
|
|
842
|
+
const move = (event: PointerEvent) => {
|
|
843
|
+
const current = untrack(pointerState)
|
|
844
|
+
|
|
845
|
+
if (current.status === "dragging") {
|
|
846
|
+
if (current.pointerId !== event.pointerId) return
|
|
847
|
+
|
|
848
|
+
moveEvent.pointerId = event.pointerId
|
|
849
|
+
moveEvent.buttons = event.buttons
|
|
850
|
+
moveEvent.focusRow = state.selection.focus.row
|
|
851
|
+
moveEvent.focusCol = state.selection.focus.col
|
|
852
|
+
|
|
853
|
+
if ((event.buttons & 1) !== 0) {
|
|
854
|
+
chase(current.axis, event)
|
|
855
|
+
|
|
856
|
+
const cell = locate(event, true)
|
|
857
|
+
|
|
858
|
+
moveEvent.row = cell ? cell.row : -1
|
|
859
|
+
moveEvent.col = cell ? cell.col : -1
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
if (sheetPointerMoveNeeded(current, moveEvent)) dispatchPointer(moveEvent)
|
|
863
|
+
|
|
864
|
+
return
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
const cell = locate(event, false)
|
|
868
|
+
const over = cell && spot.x >= 0 && spot.y >= 0 ? cell : undefined
|
|
869
|
+
const link = over && linkAt(over)
|
|
870
|
+
const cursor = over ? (link ? "pointer" : "cell") : "default"
|
|
871
|
+
const title = link ? linkTitle(link) : undefined
|
|
872
|
+
|
|
873
|
+
if (cursor !== state.hover.cursor) setState("hover", "cursor", cursor)
|
|
874
|
+
|
|
875
|
+
if (title !== state.hover.title) setState("hover", "title", title)
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
// A drag past the cells' edge scrolls the sheet toward the pointer, by how far past the edge it is. Along the headers
|
|
879
|
+
// it scrolls only along them.
|
|
880
|
+
const chase = (kind: "cells" | "rows" | "columns", event: PointerEvent) => {
|
|
881
|
+
if (!scroller || !canvas) return
|
|
882
|
+
|
|
883
|
+
const rect = canvas.getBoundingClientRect()
|
|
884
|
+
const past = (point: number, start: number, end: number) => Math.min(0, point - start) + Math.max(0, point - end)
|
|
885
|
+
|
|
886
|
+
scroller.scrollBy(
|
|
887
|
+
kind === "rows" ? 0 : past(event.clientX, rect.left + view.header, rect.right),
|
|
888
|
+
kind === "columns" ? 0 : past(event.clientY, rect.top + headerHeight, rect.bottom),
|
|
889
|
+
)
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
const release = (event: PointerEvent) =>
|
|
893
|
+
dispatchPointer({ type: "pointer.up", pointerId: event.pointerId, cell: locate(event, false) })
|
|
894
|
+
|
|
895
|
+
// A cancelled pointer, or one whose capture another element or the window took, ends its drag.
|
|
896
|
+
const cancel = (event: PointerEvent) => dispatchPointer({ type: "pointer.cancelled", pointerId: event.pointerId })
|
|
897
|
+
|
|
898
|
+
// The followable link on a cell; a merged cell's link sits on its first cell.
|
|
899
|
+
const linkAt = (cell: CellAddr): HyperlinkRegion | undefined => {
|
|
900
|
+
if (!shown) return undefined
|
|
901
|
+
|
|
902
|
+
const origin = at(cell).anchor
|
|
903
|
+
const link = hyperlinkAtCell(shown.links, origin.row, origin.col)
|
|
904
|
+
|
|
905
|
+
if (!link) return undefined
|
|
906
|
+
|
|
907
|
+
if (sheetLinkUrl(link) || (link.location && parseHyperlinkLocation(link.location, name()))) return link
|
|
908
|
+
|
|
909
|
+
return undefined
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
const follow = (cell: CellAddr) => {
|
|
913
|
+
const link = linkAt(cell)
|
|
914
|
+
|
|
915
|
+
if (!link) return
|
|
916
|
+
|
|
917
|
+
const url = sheetLinkUrl(link)
|
|
918
|
+
|
|
919
|
+
if (url) return ctx.system.openExternal(url)
|
|
920
|
+
|
|
921
|
+
const target = link.location ? parseHyperlinkLocation(link.location, name()) : null
|
|
922
|
+
|
|
923
|
+
if (!target) return
|
|
924
|
+
|
|
925
|
+
const destination = { row: target.row, col: target.col }
|
|
926
|
+
|
|
927
|
+
if (target.sheetName.toLowerCase() !== name().toLowerCase()) return props.onNavigate(target.sheetName, destination)
|
|
928
|
+
|
|
929
|
+
select(at(destination))
|
|
930
|
+
reveal(destination, "start")
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
const limits = (bounded: boolean): SelectionLimits => {
|
|
934
|
+
const rowsPerPage = Math.max(1, Math.floor((view.height - view.frozenHeight) / 20))
|
|
935
|
+
|
|
936
|
+
if (!bounded) return { rows: lastCell.row + 1, cols: lastCell.col + 1, rowsPerPage }
|
|
937
|
+
|
|
938
|
+
// Jumps to an edge stop at the used cells, or where the active cell already is past them.
|
|
939
|
+
const used = props.layout.used
|
|
940
|
+
const focus = state.selection.focus
|
|
941
|
+
|
|
942
|
+
return {
|
|
943
|
+
rows: Math.max((used?.bottom ?? 0) + 1, focus.row + 1),
|
|
944
|
+
cols: Math.max((used?.right ?? 0) + 1, focus.col + 1),
|
|
945
|
+
rowsPerPage,
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
const key = (event: KeyboardEvent) => {
|
|
950
|
+
const command = event.ctrlKey || event.metaKey
|
|
951
|
+
|
|
952
|
+
if (command && !event.altKey && event.key.toLowerCase() === "c") {
|
|
953
|
+
event.preventDefault()
|
|
954
|
+
copy()
|
|
955
|
+
|
|
956
|
+
return
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
// Tab leaves the grid for the next control rather than moving the active cell, and Alt keeps its browser meaning.
|
|
960
|
+
if (event.key === "Tab" || event.altKey || event.isComposing) return
|
|
961
|
+
|
|
962
|
+
// Enter follows a link on the active cell, as a click does; on any other cell it moves down, as in Excel.
|
|
963
|
+
if (event.key === "Enter" && !event.shiftKey && !command && linkAt(state.selection.anchor)) {
|
|
964
|
+
event.preventDefault()
|
|
965
|
+
follow(state.selection.anchor)
|
|
966
|
+
|
|
967
|
+
return
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
// As in Excel, Ctrl+Home goes to the first cell past the frozen panes and scrolls back to the start.
|
|
971
|
+
if (command && event.key === "Home") {
|
|
972
|
+
const home = { row: info().frozenRows, col: info().frozenCols }
|
|
973
|
+
|
|
974
|
+
event.preventDefault()
|
|
975
|
+
select(at(home))
|
|
976
|
+
reveal(home, "start")
|
|
977
|
+
|
|
978
|
+
return
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
const bounded =
|
|
982
|
+
event.key === "Home" ||
|
|
983
|
+
event.key === "End" ||
|
|
984
|
+
(command && (event.key.startsWith("Arrow") || event.key.toLowerCase() === "a"))
|
|
985
|
+
|
|
986
|
+
const action = selectionKeyReducer(
|
|
987
|
+
state.selection,
|
|
988
|
+
{
|
|
989
|
+
key: event.key,
|
|
990
|
+
shiftKey: event.shiftKey,
|
|
991
|
+
metaKey: event.metaKey,
|
|
992
|
+
ctrlKey: event.ctrlKey,
|
|
993
|
+
altKey: event.altKey,
|
|
994
|
+
},
|
|
995
|
+
limits(bounded),
|
|
996
|
+
)
|
|
997
|
+
|
|
998
|
+
// The viewer is read-only: keys that would edit or clear cells do nothing.
|
|
999
|
+
if (action.type !== "move") return
|
|
1000
|
+
|
|
1001
|
+
event.preventDefault()
|
|
1002
|
+
|
|
1003
|
+
const next = skipHidden(
|
|
1004
|
+
state.selection.focus,
|
|
1005
|
+
settleMerges(state.selection, action.selection, props.layout.merges),
|
|
1006
|
+
props.layout.hidden,
|
|
1007
|
+
)
|
|
1008
|
+
|
|
1009
|
+
select(next)
|
|
1010
|
+
|
|
1011
|
+
// Selecting everything leaves the view where it is, as in Excel.
|
|
1012
|
+
if (!(command && event.key.toLowerCase() === "a")) reveal(next.focus, "nearest")
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
// Copies the cells as they show, which the worker reads and joins as tab-separated text.
|
|
1016
|
+
const copy = () => {
|
|
1017
|
+
const range = selected()
|
|
1018
|
+
const used = props.layout.used
|
|
1019
|
+
|
|
1020
|
+
const clipped = {
|
|
1021
|
+
top: range.top,
|
|
1022
|
+
left: range.left,
|
|
1023
|
+
bottom: Math.min(range.bottom, Math.max(range.top, used?.bottom ?? 0)),
|
|
1024
|
+
right: Math.min(range.right, Math.max(range.left, used?.right ?? 0)),
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
if ((clipped.bottom - clipped.top + 1) * (clipped.right - clipped.left + 1) > copyLimit)
|
|
1028
|
+
return showToast({ title: ctx.t("sheet.copyTooLarge") })
|
|
1029
|
+
|
|
1030
|
+
const failed = () => {
|
|
1031
|
+
if (!controller.signal.aborted) showToast({ title: ctx.t("sheet.copyFailed") })
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
void props.client.call("copy", { sheet: sheet(), range: clipped }, { signal: controller.signal }).then(
|
|
1035
|
+
(text) => {
|
|
1036
|
+
if (text === undefined) return failed()
|
|
1037
|
+
|
|
1038
|
+
return ctx.system.copy(text).catch(failed)
|
|
1039
|
+
},
|
|
1040
|
+
(error: Error) => {
|
|
1041
|
+
// A withdrawn copy or a stopped worker is quiet: the viewer reports a stopped worker itself.
|
|
1042
|
+
if (error instanceof WorkerClosedError) return
|
|
1043
|
+
|
|
1044
|
+
failed()
|
|
1045
|
+
},
|
|
1046
|
+
)
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
return (
|
|
1050
|
+
<div class="relative flex min-h-0 flex-1 border-t border-v2-border-border-muted">
|
|
1051
|
+
{/* Grids keep their column order in right-to-left layouts, as spreadsheet apps do. */}
|
|
1052
|
+
{/* The scroller is the grid screen readers hear: its rows are the block around the active cell, which it points
|
|
1053
|
+
at as the active descendant, while the canvas shows the cells. */}
|
|
1054
|
+
<div
|
|
1055
|
+
ref={scroller}
|
|
1056
|
+
dir="ltr"
|
|
1057
|
+
tabIndex={0}
|
|
1058
|
+
role="grid"
|
|
1059
|
+
aria-label={name()}
|
|
1060
|
+
aria-readonly="true"
|
|
1061
|
+
aria-multiselectable="true"
|
|
1062
|
+
aria-rowcount={lastCell.row + 2}
|
|
1063
|
+
aria-colcount={lastCell.col + 2}
|
|
1064
|
+
aria-activedescendant={activeCell()}
|
|
1065
|
+
class="peer relative min-h-0 min-w-0 flex-1 select-none overflow-auto outline-none"
|
|
1066
|
+
// A sheet keeps its own colours in every theme, as Excel shows it.
|
|
1067
|
+
style={{ background: paper, cursor: state.hover.cursor }}
|
|
1068
|
+
title={state.hover.title}
|
|
1069
|
+
onScroll={scrolled}
|
|
1070
|
+
onKeyDown={key}
|
|
1071
|
+
onPointerDown={press}
|
|
1072
|
+
onPointerMove={move}
|
|
1073
|
+
onPointerUp={release}
|
|
1074
|
+
onPointerCancel={cancel}
|
|
1075
|
+
onLostPointerCapture={cancel}
|
|
1076
|
+
>
|
|
1077
|
+
<div
|
|
1078
|
+
aria-hidden="true"
|
|
1079
|
+
class="pointer-events-none absolute left-0 top-0"
|
|
1080
|
+
style={{ width: `${area().width}px`, height: `${area().height}px` }}
|
|
1081
|
+
/>
|
|
1082
|
+
<div aria-hidden="true" class="sticky left-0 top-0 h-0 w-0">
|
|
1083
|
+
<canvas ref={canvas} class="absolute left-0 top-0 block" />
|
|
1084
|
+
</div>
|
|
1085
|
+
<div class="sr-only">
|
|
1086
|
+
<div role="row" aria-rowindex={1}>
|
|
1087
|
+
<span role="columnheader" aria-colindex={1} />
|
|
1088
|
+
<For each={readable().columns}>
|
|
1089
|
+
{(col) => (
|
|
1090
|
+
<span role="columnheader" aria-colindex={col + 2}>
|
|
1091
|
+
{columnName(col)}
|
|
1092
|
+
</span>
|
|
1093
|
+
)}
|
|
1094
|
+
</For>
|
|
1095
|
+
</div>
|
|
1096
|
+
<For each={readable().rows}>
|
|
1097
|
+
{(row) => (
|
|
1098
|
+
<div role="row" aria-rowindex={row.row + 2}>
|
|
1099
|
+
<span role="rowheader" aria-colindex={1}>
|
|
1100
|
+
{row.row + 1}
|
|
1101
|
+
</span>
|
|
1102
|
+
<For each={row.cells}>
|
|
1103
|
+
{(cell) => (
|
|
1104
|
+
<span
|
|
1105
|
+
role="gridcell"
|
|
1106
|
+
id={cellID(cell)}
|
|
1107
|
+
aria-colindex={cell.col + 2}
|
|
1108
|
+
aria-selected={contains(selected(), cell)}
|
|
1109
|
+
>
|
|
1110
|
+
{cell.text}
|
|
1111
|
+
</span>
|
|
1112
|
+
)}
|
|
1113
|
+
</For>
|
|
1114
|
+
</div>
|
|
1115
|
+
)}
|
|
1116
|
+
</For>
|
|
1117
|
+
</div>
|
|
1118
|
+
</div>
|
|
1119
|
+
{/* The canvas would cover the scroller's own outline, so the focus ring is laid over both. */}
|
|
1120
|
+
<div class="pointer-events-none absolute inset-0 peer-focus-visible:shadow-[inset_0_0_0_2px_var(--v2-border-border-focus)]" />
|
|
1121
|
+
<Show when={paintFailed()}>
|
|
1122
|
+
<div
|
|
1123
|
+
role="status"
|
|
1124
|
+
class="pointer-events-none absolute bottom-3 left-1/2 -translate-x-1/2 rounded-md bg-v2-background-bg-base px-3 py-1.5 text-12-regular text-v2-text-text-muted shadow-[var(--v2-elevation-raised)]"
|
|
1125
|
+
>
|
|
1126
|
+
{ctx.t("sheet.paintFailed")}
|
|
1127
|
+
</div>
|
|
1128
|
+
</Show>
|
|
1129
|
+
</div>
|
|
1130
|
+
)
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
/** What a link's tooltip shows: where it goes, under any text of its own, so the text cannot hide the target. */
|
|
1134
|
+
function linkTitle(link: HyperlinkRegion) {
|
|
1135
|
+
const target = sheetLinkUrl(link) ?? link.location ?? ""
|
|
1136
|
+
|
|
1137
|
+
if (!link.tooltip || link.tooltip === target) return target
|
|
1138
|
+
|
|
1139
|
+
return `${link.tooltip}\n${target}`
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
/** A link's web or mail address: the engine's check, which lets `tel:` through, then the schemes the host opens. */
|
|
1143
|
+
function sheetLinkUrl(link: HyperlinkRegion) {
|
|
1144
|
+
const url = safeExternalHyperlink(link)
|
|
1145
|
+
|
|
1146
|
+
return url ? externalUrl(url) : undefined
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
/** Where to scroll so a cell shows: at the start, or just enough to bring it fully into view. */
|
|
1150
|
+
function place(start: number, size: number, current: number, visible: number, align: "start" | "nearest") {
|
|
1151
|
+
if (align === "start" || start < current || size >= visible) return start
|
|
1152
|
+
|
|
1153
|
+
if (start + size > current + visible) return start + size - visible
|
|
1154
|
+
|
|
1155
|
+
return current
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
function clamp(value: number, max: number) {
|
|
1159
|
+
return Math.max(0, Math.min(value, max))
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
/** The part of a length past its last whole device pixel. */
|
|
1163
|
+
function fraction(value: number) {
|
|
1164
|
+
return value - Math.floor(value)
|
|
1165
|
+
}
|