Compare commits
No commits in common. "8dfaa9c66d3e4b7f122ba231dfb379d9e7ebd27e" and "711fc53c55588a1fad157a1639eade6cf2c1016d" have entirely different histories.
8dfaa9c66d
...
711fc53c55
143 changed files with 638 additions and 10677 deletions
128
README.md
128
README.md
|
|
@ -1,35 +1,22 @@
|
||||||
<p align="center"><img src="assets/readme/hero.webp" width="880" alt="wayBetter, the framework, and wayBetter for X, the first app built on it"></p>
|
# waybetter
|
||||||
|
|
||||||
<h1 align="center">wayBetter</h1>
|
A framework for desktop apps that run one website (or a web app you would otherwise use through a
|
||||||
|
heavy Electron client) in a small native window and extend it in place, the way BetterDiscord
|
||||||
|
extends Discord. You get tabs, split panes, several signed-in accounts side by side, themes,
|
||||||
|
plugins, a signed store for them, backups and updates. You write a small adapter that says what
|
||||||
|
the site is.
|
||||||
|
|
||||||
<p align="center"><b>Make the apps you use way better.</b> A framework for light desktop apps that wrap one
|
The first app built on it is [wayBetter for X](https://git.crt.fyi/CRT/waybetter-for-x).
|
||||||
website and extend it in place, the way BetterDiscord extends Discord.<br>
|
License: GPL-3.0-or-later.
|
||||||
GPL-3.0-or-later · <code>npm create waybetter</code></p>
|
|
||||||
|
|
||||||
<p align="center"><a href="https://waybetter.fyi"><b>waybetter.fyi</b></a> ·
|
```sh
|
||||||
<a href="https://www.npmjs.com/package/waybetter">npm</a> ·
|
npm install waybetter # page runtime, shell, CLI tools
|
||||||
<a href="docs/ARCHITECTURE.md">Architecture</a> ·
|
npm create waybetter # scaffold a plugin, a theme or a whole app
|
||||||
<a href="docs/STORE.md">Store</a> ·
|
```
|
||||||
<a href="docs/STRING-PACKS.md">String packs</a> ·
|
|
||||||
<a href="https://git.crt.fyi/CRT/waybetter-for-x">wayBetter for X</a></p>
|
|
||||||
|
|
||||||
You bring a site and a small adapter that says what the site is. wayBetter gives you the rest: a
|
Links: [source](https://git.crt.fyi/CRT/waybetter) · [npm](https://www.npmjs.com/package/waybetter) · [waybetter.fyi](https://waybetter.fyi)
|
||||||
Tauri 2 window with tabs, split panes and every account signed in side by side; a page runtime with
|
|
||||||
a plugin API, a theme engine and string packs; a signed Store with a safe install screen; backups,
|
|
||||||
encrypted sync and signed updates; and the tooling to scaffold, sign, scan and release it.
|
|
||||||
|
|
||||||
| What you get | |
|
## The three layers
|
||||||
| --- | --- |
|
|
||||||
| **A window around the site** | Tabs in the titlebar, split panes, an address bar per tab, command palette, decks of columns, workspaces. One WebView profile per account, so all of them stay signed in. |
|
|
||||||
| **Plugins** | `*.plugin.js` files with a declared `@permissions` line, a themed UI kit (toast, dialog, prompt), commands in the palette, live reload in developer mode. |
|
|
||||||
| **Themes** | One JSON document: colours with contrast enforced, fonts per role (Google Fonts downloaded once, after asking), shapes, layout, decoration, icon packs, per-pane and per-account themes, a Theme Builder with a doctor report. |
|
|
||||||
| **String packs** | Data that re-words the site's own interface: a language it does not offer, a fix, your own wording. Never code. |
|
|
||||||
| **A signed Store** | One Ed25519-signed catalog for every wayBetter app, `waybetter://install` links, drag-and-drop and Open With, all through one install screen that shows the source, SHA-256, permissions and code first. |
|
|
||||||
| **Release tooling** | `waybetter store`, `release`, `privacy-scan`, `build-env`, `i18n` and `strings`: sign the catalog, build binaries free of the builder's paths, and refuse to ship a build with a privacy hit. |
|
|
||||||
|
|
||||||
## How it fits together
|
|
||||||
|
|
||||||
<p align="center"><img src="assets/readme/architecture.svg" width="880" alt="Architecture: a Tauri 2 window with a trusted shell webview and untrusted site-tab webviews running the page runtime, the Rust host underneath that re-checks every command, the app's adapter on the side and the waybetter tooling"></p>
|
|
||||||
|
|
||||||
A wayBetter app is one Tauri 2 window with several webviews. The framework has one piece for each
|
A wayBetter app is one Tauri 2 window with several webviews. The framework has one piece for each
|
||||||
layer and does not need to know which site you wrap.
|
layer and does not need to know which site you wrap.
|
||||||
|
|
@ -40,58 +27,9 @@ layer and does not need to know which site you wrap.
|
||||||
| Page runtime | `packages/runtime` (TypeScript, no dependencies) | Injected into tabs that are on the site's exact origin: one DOM hub and one fetch/XHR hub, the plugin API and its themed UI kit, the theme engine, split-view navigation, link routing, account reporting, deck columns, string packs. |
|
| Page runtime | `packages/runtime` (TypeScript, no dependencies) | Injected into tabs that are on the site's exact origin: one DOM hub and one fetch/XHR hub, the plugin API and its themed UI kit, the theme engine, split-view navigation, link routing, account reporting, deck columns, string packs. |
|
||||||
| Shell | `packages/shell` (TypeScript and React) | The local UI around the tabs: `createShell(site)` gives tabs in the titlebar, split panes, address bar, command palette, account switcher, decks and workspaces; `createPanel(site)` gives the app's own settings tab (appearance, theme builder, plugins, store, backup, developer mode). |
|
| Shell | `packages/shell` (TypeScript and React) | The local UI around the tabs: `createShell(site)` gives tabs in the titlebar, split panes, address bar, command palette, account switcher, decks and workspaces; `createPanel(site)` gives the app's own settings tab (appearance, theme builder, plugins, store, backup, developer mode). |
|
||||||
|
|
||||||
Details of every module are in [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).
|
Both TypeScript packages ship as the npm package `waybetter` (plain ESM with `.d.ts`). The Rust
|
||||||
|
crate is used from source, as a git submodule or a path dependency. Details of every module are in
|
||||||
## Quick start
|
[docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).
|
||||||
|
|
||||||
```sh
|
|
||||||
npm create waybetter app kickapp -- --site kick.com --name "wayBetter for Kick" --yes
|
|
||||||
```
|
|
||||||
|
|
||||||
<p align="center"><img src="assets/readme/create-terminal.svg" width="820" alt="Terminal output: Created a wayBetter app in kickapp (32 files), then the next steps: cd kickapp, add the framework as a git submodule, npm install, npm run build, npm run tauri dev"></p>
|
|
||||||
|
|
||||||
The same tool starts a plugin or a theme:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm create waybetter plugin -- --name "Hide Trends" # add --ts for TypeScript
|
|
||||||
npm create waybetter theme -- --name "Midnight Mint" --accent "#3ddc97"
|
|
||||||
```
|
|
||||||
|
|
||||||
The app scaffold adds the framework as a git submodule at `waybetter/` by default (`--host-source
|
|
||||||
path` and `--host-source git` are the alternatives). After `npm run tauri dev`, replace the
|
|
||||||
placeholder selectors in `src/site.ts` and `src-tauri/src/site.rs`. All flags:
|
|
||||||
`npm create waybetter -- --help`, and [packages/create-waybetter](packages/create-waybetter/README.md).
|
|
||||||
|
|
||||||
Inside an app, plugins and themes are plain files, the docs and examples are built in, and developer
|
|
||||||
mode reloads them as you save:
|
|
||||||
|
|
||||||
<video src="/CRT/waybetter/media/branch/main/assets/readme/make.mp4" poster="/CRT/waybetter/media/branch/main/assets/readme/make.webp" autoplay loop muted playsinline width="860"></video>
|
|
||||||
|
|
||||||
## Packages
|
|
||||||
|
|
||||||
| Package | Where | What it is |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| [`waybetter`](https://www.npmjs.com/package/waybetter) | `packages/waybetter` | The npm package: the built runtime and shell (plain ESM with `.d.ts`), JSON Schemas for themes, icon packs, catalogs and i18n, the locales, and the `waybetter` command (`dev`, `store`, `release`, `i18n`, `strings`, `privacy-scan`, `build-env`) |
|
|
||||||
| `create-waybetter` | `packages/create-waybetter` | `npm create waybetter`: scaffolds a plugin (JS or TypeScript), a theme or a whole app. No dependencies |
|
|
||||||
| `@waybetter/runtime` | `packages/runtime` | The page runtime (published inside `waybetter`) |
|
|
||||||
| `@waybetter/shell` | `packages/shell` | Shell models, frame, panel and Store screens (published inside `waybetter`) |
|
|
||||||
| `waybetter-host` | `crates/waybetter-host` | The Rust host crate (features `tauri`, `net`, `app`), used from source as a git submodule or a path dependency |
|
|
||||||
|
|
||||||
## Built with wayBetter
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td width="50%"><a href="https://git.crt.fyi/CRT/waybetter-for-x"><img src="assets/readme/showcase-panes.webp" alt="wayBetter for X: a theme per pane, two accounts in one window"></a></td>
|
|
||||||
<td width="50%"><a href="https://git.crt.fyi/CRT/waybetter-for-x"><img src="assets/readme/showcase-themes.webp" alt="wayBetter for X: fourteen themes, each a full redesign"></a></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="2"><b><a href="https://git.crt.fyi/CRT/waybetter-for-x">wayBetter for X</a></b> (x.com; macOS, Windows, Linux). Tabs, split panes,
|
|
||||||
every account side by side, a deck, 14 themes, eight area plugins, string packs, drafts, and fixes
|
|
||||||
for X's own bugs. <a href="https://waybetter.fyi/x/">waybetter.fyi/x</a></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
Built something on wayBetter? Add it here with a pull request.
|
|
||||||
|
|
||||||
## A minimal adapter
|
## A minimal adapter
|
||||||
|
|
||||||
|
|
@ -154,6 +92,21 @@ The app itself is `waybetter_host::app` configured with an `AppConfig` and a `Si
|
||||||
implementation (what only your site knows: page scripts, legacy domains, link routing). Anything
|
implementation (what only your site knows: page scripts, legacy domains, link routing). Anything
|
||||||
else the app needs is an ordinary `#[tauri::command]` in your crate.
|
else the app needs is an ordinary `#[tauri::command]` in your crate.
|
||||||
|
|
||||||
|
## Start a project
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm create waybetter plugin -- --name "Hide Trends"
|
||||||
|
npm create waybetter theme -- --name "Midnight Mint" --accent "#3ddc97"
|
||||||
|
npm create waybetter app kickapp -- --site kick.com --name "wayBetter for Kick" --yes
|
||||||
|
```
|
||||||
|
|
||||||
|
The app scaffold adds the framework as a git submodule at `waybetter/` by default (`--host-source
|
||||||
|
path` and `--host-source git` are the alternatives). Its next steps, as the tool prints them:
|
||||||
|
`git init && git submodule add https://git.crt.fyi/CRT/waybetter.git waybetter`, then
|
||||||
|
`npm install`, `npm run build`, `npm run tauri dev`, then replace the placeholder selectors in
|
||||||
|
`src/site.ts` and `src-tauri/src/site.rs`. Flags: `npm create waybetter -- --help`.
|
||||||
|
See [packages/create-waybetter](packages/create-waybetter/README.md).
|
||||||
|
|
||||||
## The dev loop
|
## The dev loop
|
||||||
|
|
||||||
In a scaffolded app, `npm run dev` runs `waybetter dev --watch "node scripts/build.mjs --watch"`:
|
In a scaffolded app, `npm run dev` runs `waybetter dev --watch "node scripts/build.mjs --watch"`:
|
||||||
|
|
@ -242,19 +195,12 @@ bun run test:create # scaffolds each kind into temp folders and checks them a
|
||||||
`test:create` also runs `cargo check` on a generated app (about a minute cold);
|
`test:create` also runs `cargo check` on a generated app (about a minute cold);
|
||||||
`WAYBETTER_SKIP_CARGO_CHECK=1` skips that step. Requires Bun 1.4.2+, Node 24+ and Rust 1.88+.
|
`WAYBETTER_SKIP_CARGO_CHECK=1` skips that step. Requires Bun 1.4.2+, Node 24+ and Rust 1.88+.
|
||||||
|
|
||||||
## Docs
|
|
||||||
|
|
||||||
- [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md): every module of the host, runtime and shell
|
|
||||||
- [docs/STORE.md](docs/STORE.md): the signed catalog, install links and the install screen
|
|
||||||
- [docs/STRING-PACKS.md](docs/STRING-PACKS.md): the string pack format and `waybetter strings check`
|
|
||||||
- [packages/waybetter](packages/waybetter/README.md), [packages/create-waybetter](packages/create-waybetter/README.md), [packages/runtime](packages/runtime/README.md), [packages/shell](packages/shell/README.md)
|
|
||||||
- A full app on the framework: [wayBetter for X](https://git.crt.fyi/CRT/waybetter-for-x), whose docs cover themes, plugins, area plugins and translating
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Issues and pull requests go to [git.crt.fyi/CRT/waybetter](https://git.crt.fyi/CRT/waybetter).
|
Issues and pull requests go to [git.crt.fyi/CRT/waybetter](https://git.crt.fyi/CRT/waybetter).
|
||||||
Keep the split: generic mechanisms belong here, site-specific ones in the app.
|
Keep the split: generic mechanisms belong here, site-specific ones in the app. If you built
|
||||||
|
something on wayBetter, add it to the list below with a pull request.
|
||||||
|
|
||||||
## License
|
| Project | Target | What it is |
|
||||||
|
| --- | --- | --- |
|
||||||
GPL-3.0-or-later. Made by [@CRTkafa](https://x.com/CRTkafa).
|
| [wayBetter for X](https://git.crt.fyi/CRT/waybetter-for-x) | x.com | Tabs, split panes, real accounts side by side, themes, plugins, drafts and fixes for X's own bugs. |
|
||||||
|
|
|
||||||
|
|
@ -1,127 +0,0 @@
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 760" width="1200" height="760" role="img" aria-label="wayBetter architecture: one Tauri 2 window with a trusted shell webview and one webview per site tab, a Rust host underneath, your adapter on the side, and the waybetter command for store, release and privacy tooling">
|
|
||||||
<defs>
|
|
||||||
<linearGradient id="bg" x1="0" y1="0" x2="0" y2="1">
|
|
||||||
<stop offset="0" stop-color="#0b1020"/>
|
|
||||||
<stop offset="1" stop-color="#06070c"/>
|
|
||||||
</linearGradient>
|
|
||||||
<radialGradient id="glow" cx="0.5" cy="0" r="0.7">
|
|
||||||
<stop offset="0" stop-color="#1d3a8a" stop-opacity="0.55"/>
|
|
||||||
<stop offset="1" stop-color="#1d3a8a" stop-opacity="0"/>
|
|
||||||
</radialGradient>
|
|
||||||
<linearGradient id="accent" x1="0" y1="0" x2="1" y2="0">
|
|
||||||
<stop offset="0" stop-color="#3b82f6"/>
|
|
||||||
<stop offset="0.55" stop-color="#22d3ee"/>
|
|
||||||
<stop offset="1" stop-color="#a855f7"/>
|
|
||||||
</linearGradient>
|
|
||||||
<marker id="arr" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
|
||||||
<path d="M0 0L10 5L0 10z" fill="#64748b"/>
|
|
||||||
</marker>
|
|
||||||
<style>
|
|
||||||
.t{font-family:ui-sans-serif,"Segoe UI",system-ui,-apple-system,Helvetica,Arial,sans-serif;fill:#e6e9f2}
|
|
||||||
.m{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace}
|
|
||||||
.h{font-size:22px;font-weight:700;letter-spacing:-0.01em}
|
|
||||||
.k{font-size:12px;font-weight:600;letter-spacing:0.14em;fill:#7dd3fc}
|
|
||||||
.s{font-size:14px;fill:#a3acc2}
|
|
||||||
.c{font-size:13px;fill:#cbd5e1}
|
|
||||||
.box{fill:#0f1626;stroke:#24304a;stroke-width:1.2}
|
|
||||||
.trust{fill:#101b33;stroke:#3b82f6;stroke-width:1.4}
|
|
||||||
.site{fill:#140f26;stroke:#7c3aed;stroke-width:1.4}
|
|
||||||
.chip{fill:#17213a;stroke:#2b3a5c}
|
|
||||||
.ln{stroke:#64748b;stroke-width:1.4;fill:none}
|
|
||||||
.dash{stroke-dasharray:5 5}
|
|
||||||
</style>
|
|
||||||
</defs>
|
|
||||||
<rect width="1200" height="760" rx="18" fill="url(#bg)"/>
|
|
||||||
<rect width="1200" height="380" rx="18" fill="url(#glow)"/>
|
|
||||||
|
|
||||||
<!-- title -->
|
|
||||||
<text class="t k" x="48" y="54">— ARCHITECTURE</text>
|
|
||||||
<text class="t" x="48" y="92" font-size="32" font-weight="760" letter-spacing="-0.02em">One window, three layers, one small adapter.</text>
|
|
||||||
<rect x="48" y="104" width="560" height="3" rx="1.5" fill="url(#accent)"/>
|
|
||||||
|
|
||||||
<!-- the site -->
|
|
||||||
<rect x="48" y="138" width="760" height="64" rx="12" fill="none" stroke="#334155" stroke-dasharray="6 6"/>
|
|
||||||
<text class="t h" x="72" y="170" font-size="18">The website you already use</text>
|
|
||||||
<text class="t s" x="72" y="190">loaded live from its exact https origin, never copied: x.com, kick.com, …</text>
|
|
||||||
|
|
||||||
<!-- window -->
|
|
||||||
<rect x="48" y="226" width="760" height="300" rx="16" class="box"/>
|
|
||||||
<text class="t k" x="72" y="256">TAURI 2 WINDOW · SYSTEM WEBVIEW</text>
|
|
||||||
|
|
||||||
<!-- shell -->
|
|
||||||
<rect x="72" y="272" width="300" height="234" rx="12" class="trust"/>
|
|
||||||
<text class="t h" x="92" y="304">Shell</text>
|
|
||||||
<text class="t m s" x="92" y="326" font-size="12">packages/shell · local, trusted</text>
|
|
||||||
<g class="t c">
|
|
||||||
<text x="92" y="356">Tabs, split panes, address bar</text>
|
|
||||||
<text x="92" y="380">Command palette, accounts, decks</text>
|
|
||||||
<text x="92" y="404">Settings panel, theme builder</text>
|
|
||||||
<text x="92" y="428">Store and the install screen</text>
|
|
||||||
<text x="92" y="452">Workspaces, backup, updates</text>
|
|
||||||
</g>
|
|
||||||
<text class="t s" x="92" y="488" font-size="12">the only webview allowed to change anything</text>
|
|
||||||
|
|
||||||
<!-- tabs -->
|
|
||||||
<rect x="392" y="272" width="396" height="234" rx="12" class="site"/>
|
|
||||||
<text class="t h" x="412" y="304">Site tabs</text>
|
|
||||||
<text class="t m s" x="412" y="326" font-size="12">one webview + profile per tab · packages/runtime</text>
|
|
||||||
<g>
|
|
||||||
<rect x="412" y="342" width="110" height="30" rx="8" class="chip"/><text class="t c" x="425" y="362">Plugin API</text>
|
|
||||||
<rect x="530" y="342" width="106" height="30" rx="8" class="chip"/><text class="t c" x="543" y="362">Theme engine</text>
|
|
||||||
<rect x="644" y="342" width="124" height="30" rx="8" class="chip"/><text class="t c" x="657" y="362">String packs</text>
|
|
||||||
<rect x="412" y="380" width="110" height="30" rx="8" class="chip"/><text class="t c" x="425" y="400">DOM hub</text>
|
|
||||||
<rect x="530" y="380" width="106" height="30" rx="8" class="chip"/><text class="t c" x="543" y="400">Fetch / XHR hub</text>
|
|
||||||
<rect x="644" y="380" width="124" height="30" rx="8" class="chip"/><text class="t c" x="657" y="400">Link routing</text>
|
|
||||||
<rect x="412" y="418" width="110" height="30" rx="8" class="chip"/><text class="t c" x="425" y="438">Accounts</text>
|
|
||||||
<rect x="530" y="418" width="106" height="30" rx="8" class="chip"/><text class="t c" x="543" y="438">UI kit</text>
|
|
||||||
<rect x="644" y="418" width="124" height="30" rx="8" class="chip"/><text class="t c" x="657" y="438">Deck columns</text>
|
|
||||||
</g>
|
|
||||||
<text class="t s" x="412" y="488" font-size="12">untrusted: may only report about itself</text>
|
|
||||||
|
|
||||||
<!-- arrows site -> tabs -->
|
|
||||||
<path class="ln" d="M590 202 V268" marker-end="url(#arr)"/>
|
|
||||||
|
|
||||||
<!-- host -->
|
|
||||||
<rect x="48" y="550" width="760" height="166" rx="16" class="box"/>
|
|
||||||
<text class="t k" x="72" y="580">NATIVE HOST · RUST</text>
|
|
||||||
<text class="t h" x="72" y="612">waybetter-host</text>
|
|
||||||
<text class="t m s" x="258" y="612" font-size="12">crates/waybetter-host</text>
|
|
||||||
<g class="t c">
|
|
||||||
<text x="72" y="644">Every command re-checks its caller (webview label, exact origin)</text>
|
|
||||||
<text x="72" y="668">Profiles, settings, plugins, themes, fonts, workspaces</text>
|
|
||||||
<text x="72" y="692">Signed Store (Ed25519), backup, encrypted sync, signed updates</text>
|
|
||||||
</g>
|
|
||||||
<path class="ln" d="M222 506 V546" marker-end="url(#arr)" marker-start="url(#arr)"/>
|
|
||||||
<path class="ln dash" d="M590 506 V546" marker-end="url(#arr)"/>
|
|
||||||
<text class="t s" x="236" y="532" font-size="12">all commands</text>
|
|
||||||
<text class="t s" x="604" y="532" font-size="12">a short, reviewed list</text>
|
|
||||||
|
|
||||||
<!-- adapter -->
|
|
||||||
<rect x="836" y="138" width="316" height="300" rx="16" fill="#0f1a1a" stroke="#14b8a6" stroke-width="1.4"/>
|
|
||||||
<text class="t k" x="860" y="168" style="fill:#5eead4">YOUR APP</text>
|
|
||||||
<text class="t h" x="860" y="200">The adapter</text>
|
|
||||||
<text class="t s" x="860" y="222">what only your site knows</text>
|
|
||||||
<rect x="860" y="242" width="268" height="52" rx="10" class="chip"/>
|
|
||||||
<text class="t m c" x="876" y="264">site.rs · SiteSpec</text>
|
|
||||||
<text class="t s" x="876" y="283" font-size="12">hosts, account rules</text>
|
|
||||||
<rect x="860" y="304" width="268" height="52" rx="10" class="chip"/>
|
|
||||||
<text class="t m c" x="876" y="326">site.ts · SiteAdapter</text>
|
|
||||||
<text class="t s" x="876" y="345" font-size="12">selectors, API marks, links</text>
|
|
||||||
<rect x="860" y="366" width="268" height="52" rx="10" class="chip"/>
|
|
||||||
<text class="t m c" x="876" y="388">capabilities/*.json</text>
|
|
||||||
<text class="t s" x="876" y="407" font-size="12">who may call what</text>
|
|
||||||
<path class="ln dash" d="M836 290 H812" marker-end="url(#arr)"/>
|
|
||||||
|
|
||||||
<!-- tooling -->
|
|
||||||
<rect x="836" y="462" width="316" height="254" rx="16" fill="#151022" stroke="#a855f7" stroke-width="1.4"/>
|
|
||||||
<text class="t k" x="860" y="492" style="fill:#d8b4fe">NPM · waybetter</text>
|
|
||||||
<text class="t h" x="860" y="524">The tooling</text>
|
|
||||||
<g class="t m c">
|
|
||||||
<text x="860" y="558">npm create waybetter</text>
|
|
||||||
<text x="860" y="584">waybetter dev --watch</text>
|
|
||||||
<text x="860" y="610">waybetter store build|sign|verify</text>
|
|
||||||
<text x="860" y="636">waybetter strings check</text>
|
|
||||||
<text x="860" y="662">waybetter release</text>
|
|
||||||
<text x="860" y="688">waybetter privacy-scan</text>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 7.4 KiB |
|
|
@ -1,29 +0,0 @@
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 400" width="1000" height="400" role="img" aria-label="Terminal: npm create waybetter app kickapp creates a wayBetter app in kickapp (32 files) and prints the next steps">
|
|
||||||
<defs>
|
|
||||||
<linearGradient id="bg" x1="0" y1="0" x2="0" y2="1">
|
|
||||||
<stop offset="0" stop-color="#0d1222"/>
|
|
||||||
<stop offset="1" stop-color="#080a12"/>
|
|
||||||
</linearGradient>
|
|
||||||
<style>
|
|
||||||
.m{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;font-size:15px;fill:#cbd5e1}
|
|
||||||
.p{fill:#22c55e}.d{fill:#7c8aa5}.o{fill:#e6e9f2;font-weight:600}.a{fill:#7dd3fc}
|
|
||||||
</style>
|
|
||||||
</defs>
|
|
||||||
<rect width="1000" height="400" rx="14" fill="url(#bg)" stroke="#24304a"/>
|
|
||||||
<rect width="1000" height="36" rx="14" fill="#121a2e"/>
|
|
||||||
<rect y="22" width="1000" height="14" fill="#121a2e"/>
|
|
||||||
<circle cx="22" cy="18" r="6" fill="#ef4444" opacity=".8"/><circle cx="42" cy="18" r="6" fill="#f59e0b" opacity=".8"/><circle cx="62" cy="18" r="6" fill="#22c55e" opacity=".8"/>
|
|
||||||
<text class="m d" x="500" y="23" text-anchor="middle" font-size="13">npm create waybetter</text>
|
|
||||||
<g class="m">
|
|
||||||
<text x="28" y="76"><tspan class="p">$</tspan> npm create waybetter app kickapp -- --site kick.com --name "wayBetter for Kick" --yes</text>
|
|
||||||
<text x="28" y="120" class="o">Created a wayBetter app in kickapp (32 files).</text>
|
|
||||||
<text x="28" y="160">Next:</text>
|
|
||||||
<text x="52" y="186"><tspan class="a">cd kickapp</tspan></text>
|
|
||||||
<text x="52" y="210"><tspan class="a">git init && git submodule add https://git.crt.fyi/CRT/waybetter.git waybetter</tspan></text>
|
|
||||||
<text x="52" y="234"><tspan class="a">npm install</tspan></text>
|
|
||||||
<text x="52" y="258"><tspan class="a">npm run build</tspan></text>
|
|
||||||
<text x="52" y="282"><tspan class="a">npm run tauri dev</tspan></text>
|
|
||||||
<text x="52" y="306" class="d">then replace the PLACEHOLDER selectors in src/site.ts and src-tauri/src/site.rs</text>
|
|
||||||
<text x="28" y="356"><tspan class="p">$</tspan> <tspan class="d">▍</tspan></text>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 36 KiB |
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 43 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 82 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 60 KiB |
85
crates/waybetter-host/Cargo.lock
generated
85
crates/waybetter-host/Cargo.lock
generated
|
|
@ -1207,18 +1207,6 @@ dependencies = [
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "fallible-iterator"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "fallible-streaming-iterator"
|
|
||||||
version = "0.1.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fastrand"
|
name = "fastrand"
|
||||||
version = "2.5.0"
|
version = "2.5.0"
|
||||||
|
|
@ -1739,30 +1727,12 @@ version = "0.14.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
|
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hashbrown"
|
|
||||||
version = "0.16.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
|
|
||||||
dependencies = [
|
|
||||||
"foldhash",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.17.1"
|
version = "0.17.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
|
checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hashlink"
|
|
||||||
version = "0.11.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "824e001ac4f3012dd16a264bec811403a67ca9deb6c102fc5049b32c4574b35f"
|
|
||||||
dependencies = [
|
|
||||||
"hashbrown 0.16.1",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "heck"
|
name = "heck"
|
||||||
version = "0.4.1"
|
version = "0.4.1"
|
||||||
|
|
@ -2388,17 +2358,6 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libsqlite3-sys"
|
|
||||||
version = "0.36.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "95b4103cffefa72eb8428cb6b47d6627161e51c2739fc5e3b734584157bc642a"
|
|
||||||
dependencies = [
|
|
||||||
"cc",
|
|
||||||
"pkg-config",
|
|
||||||
"vcpkg",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linux-raw-sys"
|
name = "linux-raw-sys"
|
||||||
version = "0.12.1"
|
version = "0.12.1"
|
||||||
|
|
@ -3465,31 +3424,6 @@ dependencies = [
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rsqlite-vfs"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c51c9ae4df8a7fba42103df5c621fa3c37eccf3a3c650879e90fc48b11cc192c"
|
|
||||||
dependencies = [
|
|
||||||
"hashbrown 0.16.1",
|
|
||||||
"thiserror 2.0.21",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rusqlite"
|
|
||||||
version = "0.38.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f1c93dd1c9683b438c392c492109cb702b8090b2bfc8fed6f6e4eb4523f17af3"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 2.13.2",
|
|
||||||
"fallible-iterator",
|
|
||||||
"fallible-streaming-iterator",
|
|
||||||
"hashlink",
|
|
||||||
"libsqlite3-sys",
|
|
||||||
"smallvec",
|
|
||||||
"sqlite-wasm-rs",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rust-ini"
|
name = "rust-ini"
|
||||||
version = "0.21.3"
|
version = "0.21.3"
|
||||||
|
|
@ -4037,18 +3971,6 @@ dependencies = [
|
||||||
"der",
|
"der",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "sqlite-wasm-rs"
|
|
||||||
version = "0.5.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "dc3efc0da82635d7e1ced0053bbbfa8c7ab9645d0bf36ceb4f7127bb85315d75"
|
|
||||||
dependencies = [
|
|
||||||
"cc",
|
|
||||||
"js-sys",
|
|
||||||
"rsqlite-vfs",
|
|
||||||
"wasm-bindgen",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "stable_deref_trait"
|
name = "stable_deref_trait"
|
||||||
version = "1.2.1"
|
version = "1.2.1"
|
||||||
|
|
@ -5146,12 +5068,6 @@ dependencies = [
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "vcpkg"
|
|
||||||
version = "0.2.15"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "version-compare"
|
name = "version-compare"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
|
|
@ -5304,7 +5220,6 @@ dependencies = [
|
||||||
"minisign-verify",
|
"minisign-verify",
|
||||||
"objc2-app-kit",
|
"objc2-app-kit",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"rusqlite",
|
|
||||||
"rustls",
|
"rustls",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,6 @@ default = []
|
||||||
tauri = ["dep:tauri", "dep:tauri-plugin-notification", "dep:tauri-plugin-updater", "dep:tokio", "dep:arboard", "dep:clipboard-win", "dep:windows", "dep:webview2-com", "dep:gtk", "dep:objc2-app-kit"]
|
tauri = ["dep:tauri", "dep:tauri-plugin-notification", "dep:tauri-plugin-updater", "dep:tokio", "dep:arboard", "dep:clipboard-win", "dep:windows", "dep:webview2-com", "dep:gtk", "dep:objc2-app-kit"]
|
||||||
# Store downloads (`store::net`): allow-listed https, no redirects or cookies, size caps.
|
# Store downloads (`store::net`): allow-listed https, no redirects or cookies, size caps.
|
||||||
net = ["dep:reqwest", "dep:rustls"]
|
net = ["dep:reqwest", "dep:rustls"]
|
||||||
# The drafts vault (`vault`): the app's local SQLite store of drafts with CAS revisions.
|
|
||||||
vault = ["dep:rusqlite"]
|
|
||||||
# The whole app (`app::run_app`): window, shell and tab webviews, the generic commands and the
|
# The whole app (`app::run_app`): window, shell and tab webviews, the generic commands and the
|
||||||
# Tauri plugins every wayBetter app registers.
|
# Tauri plugins every wayBetter app registers.
|
||||||
app = ["tauri", "dep:tauri-plugin-single-instance", "dep:tauri-plugin-deep-link", "dep:tauri-plugin-window-state", "dep:tauri-plugin-opener", "dep:tauri-plugin-process", "dep:tauri-plugin-dialog"]
|
app = ["tauri", "dep:tauri-plugin-single-instance", "dep:tauri-plugin-deep-link", "dep:tauri-plugin-window-state", "dep:tauri-plugin-opener", "dep:tauri-plugin-process", "dep:tauri-plugin-dialog"]
|
||||||
|
|
@ -62,7 +60,6 @@ tauri-plugin-window-state = { version = "2", optional = true }
|
||||||
tauri-plugin-opener = { version = "2", optional = true }
|
tauri-plugin-opener = { version = "2", optional = true }
|
||||||
tauri-plugin-process = { version = "2", optional = true }
|
tauri-plugin-process = { version = "2", optional = true }
|
||||||
tauri-plugin-dialog = { version = "2", optional = true }
|
tauri-plugin-dialog = { version = "2", optional = true }
|
||||||
rusqlite = { version = "0.38", features = ["bundled"], optional = true }
|
|
||||||
reqwest = { version = "0.13", default-features = false, features = ["rustls-no-provider"], optional = true }
|
reqwest = { version = "0.13", default-features = false, features = ["rustls-no-provider"], optional = true }
|
||||||
rustls = { version = "0.23", default-features = false, features = ["ring"], optional = true }
|
rustls = { version = "0.23", default-features = false, features = ["ring"], optional = true }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,16 +7,6 @@ use serde::{Deserialize, Serialize};
|
||||||
use std::collections::{HashMap, HashSet, VecDeque};
|
use std::collections::{HashMap, HashSet, VecDeque};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
||||||
/// What an app declares about its alerts for the host's settings commands
|
|
||||||
/// ([`crate::alerts_commands`]): where they are saved and how the page runtime takes the keywords
|
|
||||||
/// (`window.<global>.<member>.set(keywords)`, else parked in `window.<queue>`).
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
|
||||||
pub struct AlertsConfig {
|
|
||||||
pub file: &'static str,
|
|
||||||
pub member: &'static str,
|
|
||||||
pub queue: &'static str,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub const MAX_KEYWORDS: usize = 32;
|
pub const MAX_KEYWORDS: usize = 32;
|
||||||
pub const MIN_KEYWORD_CHARS: usize = 2;
|
pub const MIN_KEYWORD_CHARS: usize = 2;
|
||||||
pub const MAX_KEYWORD_CHARS: usize = 64;
|
pub const MAX_KEYWORD_CHARS: usize = 64;
|
||||||
|
|
|
||||||
|
|
@ -1,78 +0,0 @@
|
||||||
//! Keyword alert settings, native side, for every app that sets [`crate::app::AppConfig::alerts`]:
|
|
||||||
//! the shell-only `alerts_get` / `alerts_set` ([`crate::commands::ALERTS`]) over the owner's
|
|
||||||
//! [`AlertSettings`] (saved in app data, validated by [`crate::alerts`]). Site tabs gain no command
|
|
||||||
//! here: native code hands the page runtime the keywords to watch ([`script`]) at every page load
|
|
||||||
//! and whenever they change. What a match looks like and the notification are the app's.
|
|
||||||
|
|
||||||
use crate::alerts::AlertSettings;
|
|
||||||
use crate::app::config;
|
|
||||||
use crate::host::{eval_in_site_tabs, read_json, shell_only, write_json};
|
|
||||||
use crate::tabs::deliver_script;
|
|
||||||
use std::sync::{Mutex, MutexGuard};
|
|
||||||
use tauri::{AppHandle, Manager, Webview};
|
|
||||||
|
|
||||||
pub use crate::alerts::AlertsConfig;
|
|
||||||
|
|
||||||
struct AlertState(Mutex<AlertSettings>);
|
|
||||||
|
|
||||||
/// Loads the saved settings. Does nothing unless the app set [`crate::app::AppConfig::alerts`].
|
|
||||||
pub(crate) fn init(app: &AppHandle) {
|
|
||||||
let Some(alerts) = config(app).alerts else { return };
|
|
||||||
let settings = read_json::<AlertSettings>(app, alerts.file).and_then(|settings| settings.validated().ok()).unwrap_or_default();
|
|
||||||
app.manage(AlertState(Mutex::new(settings)));
|
|
||||||
}
|
|
||||||
|
|
||||||
fn state(app: &AppHandle) -> Result<MutexGuard<'_, AlertSettings>, String> {
|
|
||||||
app.try_state::<AlertState>()
|
|
||||||
.ok_or("DATABASE: alert state unavailable; restart safely")?
|
|
||||||
.inner()
|
|
||||||
.0
|
|
||||||
.lock()
|
|
||||||
.map_err(|_| "DATABASE: alert state unavailable; restart safely".into())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The owner's alert settings.
|
|
||||||
pub fn settings(app: &AppHandle) -> Result<AlertSettings, String> {
|
|
||||||
Ok(state(app)?.clone())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The script that hands the page runtime the keywords to watch (empty = alerts off).
|
|
||||||
pub fn script(app: &AppHandle) -> String {
|
|
||||||
let (Some(alerts), Ok(settings)) = (config(app).alerts, settings(app)) else { return String::new() };
|
|
||||||
script_for(app, alerts, &settings)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn script_for(app: &AppHandle, alerts: &AlertsConfig, settings: &AlertSettings) -> String {
|
|
||||||
let keywords = serde_json::to_string(settings.active_keywords()).unwrap_or_else(|_| "[]".into());
|
|
||||||
deliver_script(config(app).site.runtime_global, alerts.member, "set", alerts.queue, &keywords)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Validates, saves and keeps the settings, and does not touch the tabs: for the app's own
|
|
||||||
/// writers (a backup import), which then evaluate [`script`] themselves.
|
|
||||||
pub fn store(app: &AppHandle, settings: AlertSettings) -> Result<AlertSettings, String> {
|
|
||||||
let alerts = config(app).alerts.ok_or_else(|| "UNAVAILABLE: this app has no alerts".to_owned())?;
|
|
||||||
let settings = settings.validated()?;
|
|
||||||
// The lock is held across the write so concurrent saves cannot leave disk and memory disagreeing.
|
|
||||||
let mut current = state(app)?;
|
|
||||||
write_json(app, alerts.file, &settings)?;
|
|
||||||
*current = settings.clone();
|
|
||||||
Ok(settings)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tauri::command]
|
|
||||||
pub(crate) async fn alerts_get(webview: Webview, app: AppHandle) -> Result<AlertSettings, String> {
|
|
||||||
shell_only(&webview)?;
|
|
||||||
settings(&app)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tauri::command]
|
|
||||||
pub(crate) async fn alerts_set(webview: Webview, app: AppHandle, settings: AlertSettings) -> Result<AlertSettings, String> {
|
|
||||||
shell_only(&webview)?;
|
|
||||||
let settings = store(&app, settings)?;
|
|
||||||
eval_in_site_tabs(&app, config(&app).site, &script(&app));
|
|
||||||
Ok(settings)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn handler() -> impl Fn(tauri::ipc::Invoke<tauri::Wry>) -> bool + Send + Sync + 'static {
|
|
||||||
tauri::generate_handler![alerts_get, alerts_set]
|
|
||||||
}
|
|
||||||
|
|
@ -96,16 +96,6 @@ pub struct AppConfig {
|
||||||
/// [`commands::DEV`] and runs the watcher while it is on; the theme file is the app's
|
/// [`commands::DEV`] and runs the watcher while it is on; the theme file is the app's
|
||||||
/// ([`SiteHooks::dev_theme_apply`]).
|
/// ([`SiteHooks::dev_theme_apply`]).
|
||||||
pub dev: bool,
|
pub dev: bool,
|
||||||
/// Site themes (the owner's theme, account and pane themes, the live preview): serves
|
|
||||||
/// [`commands::THEME`]; the app names its built-in themes and the files they are saved in.
|
|
||||||
pub themes: Option<&'static crate::theme_commands::ThemeConfig>,
|
|
||||||
/// Keyword alert settings (saved in app data, handed to the page runtime): serves
|
|
||||||
/// [`commands::ALERTS`]; the match and the notification are the app's.
|
|
||||||
pub alerts: Option<&'static crate::alerts_commands::AlertsConfig>,
|
|
||||||
/// The drafts vault (a SQLite database in app data with CAS revisions): serves
|
|
||||||
/// [`commands::VAULT`]; the rules (kinds, limits, capture ownership) are the app's.
|
|
||||||
#[cfg(feature = "vault")]
|
|
||||||
pub vault: Option<&'static crate::vault_commands::VaultConfig>,
|
|
||||||
/// Native updates and the hotfix channel: serves [`commands::UPDATE`] and runs the update loop.
|
/// Native updates and the hotfix channel: serves [`commands::UPDATE`] and runs the update loop.
|
||||||
/// Needs `updater` (the plugin) and the `net` feature.
|
/// Needs `updater` (the plugin) and the `net` feature.
|
||||||
#[cfg(feature = "net")]
|
#[cfg(feature = "net")]
|
||||||
|
|
@ -136,10 +126,6 @@ impl AppConfig {
|
||||||
fonts: false,
|
fonts: false,
|
||||||
sync: false,
|
sync: false,
|
||||||
dev: false,
|
dev: false,
|
||||||
themes: None,
|
|
||||||
alerts: None,
|
|
||||||
#[cfg(feature = "vault")]
|
|
||||||
vault: None,
|
|
||||||
#[cfg(feature = "net")]
|
#[cfg(feature = "net")]
|
||||||
updates: None,
|
updates: None,
|
||||||
}
|
}
|
||||||
|
|
@ -158,25 +144,6 @@ impl AppConfig {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Serves the theme commands ([`commands::THEME`]) with these built-in themes.
|
|
||||||
pub const fn with_themes(mut self, themes: &'static crate::theme_commands::ThemeConfig) -> Self {
|
|
||||||
self.themes = Some(themes);
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Serves the alert settings commands ([`commands::ALERTS`]).
|
|
||||||
pub const fn with_alerts(mut self, alerts: &'static crate::alerts_commands::AlertsConfig) -> Self {
|
|
||||||
self.alerts = Some(alerts);
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Serves the drafts vault commands ([`commands::VAULT`]) over this database and rules.
|
|
||||||
#[cfg(feature = "vault")]
|
|
||||||
pub const fn with_vault(mut self, vault: &'static crate::vault_commands::VaultConfig) -> Self {
|
|
||||||
self.vault = Some(vault);
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Serves the sync commands ([`commands::SYNC`]).
|
/// Serves the sync commands ([`commands::SYNC`]).
|
||||||
pub const fn with_sync(mut self) -> Self {
|
pub const fn with_sync(mut self) -> Self {
|
||||||
self.sync = true;
|
self.sync = true;
|
||||||
|
|
@ -279,8 +246,8 @@ pub trait SiteHooks: Send + Sync + 'static {
|
||||||
/// A tab webview was created.
|
/// A tab webview was created.
|
||||||
fn tab_created(&self, _app: &AppHandle) {}
|
fn tab_created(&self, _app: &AppHandle) {}
|
||||||
|
|
||||||
/// A Google font was installed or removed ([`commands::GFONTS`]); the host has already given the
|
/// A Google font was installed or removed ([`commands::GFONTS`]): give the site tabs their
|
||||||
/// site tabs their theme, and the font bytes, again ([`crate::theme_commands::apply`]).
|
/// theme, and the font bytes, again.
|
||||||
fn fonts_changed(&self, _app: &AppHandle) {}
|
fn fonts_changed(&self, _app: &AppHandle) {}
|
||||||
|
|
||||||
/// The app's native settings as backup sections (themes, plugins, tweaks, ... keyed by section
|
/// The app's native settings as backup sections (themes, plugins, tweaks, ... keyed by section
|
||||||
|
|
@ -722,31 +689,13 @@ async fn tab_zoom(webview: Webview, app: AppHandle, id: String, factor: Option<f
|
||||||
|
|
||||||
/// Find in page for tab `id` (the shell's find bar): `start` with a query, `next`, `previous`, `stop`.
|
/// Find in page for tab `id` (the shell's find bar): `start` with a query, `next`, `previous`, `stop`.
|
||||||
/// The engine's own find where this build can drive it (counts arrive as `tab-find` events), else the
|
/// The engine's own find where this build can drive it (counts arrive as `tab-find` events), else the
|
||||||
/// evaluated Custom Highlight script. The query is one typed line (validated) and is kept nowhere.
|
/// evaluated `window.find`. The query is one typed line (validated) and is kept nowhere.
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
async fn tab_find(webview: Webview, app: AppHandle, id: String, action: String, query: Option<String>) -> Result<(), String> {
|
async fn tab_find(webview: Webview, app: AppHandle, id: String, action: String, query: Option<String>) -> Result<(), String> {
|
||||||
shell_only(&webview)?;
|
shell_only(&webview)?;
|
||||||
host::tab_find(&app, &id, &action, query.as_deref())
|
host::tab_find(&app, &id, &action, query.as_deref())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets the native menu bar (macOS) from the shell's description ([`crate::menu`]); other platforms keep the
|
|
||||||
/// in-app menu and answer false. Choosing an item sends its id to the shell (`native-menu`).
|
|
||||||
#[tauri::command]
|
|
||||||
async fn menu_set(webview: Webview, app: AppHandle, spec: serde_json::Value) -> Result<bool, String> {
|
|
||||||
shell_only(&webview)?;
|
|
||||||
let spec = crate::menu::parse(spec)?;
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
{
|
|
||||||
crate::menu::set(&app, &spec)?;
|
|
||||||
Ok(true)
|
|
||||||
}
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
|
||||||
{
|
|
||||||
let _ = (app, spec);
|
|
||||||
Ok(false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Whether safe mode is on ([`crate::safe`]): the shell shows it in the titlebar and drops its chrome theme.
|
/// Whether safe mode is on ([`crate::safe`]): the shell shows it in the titlebar and drops its chrome theme.
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
async fn safe_mode_get(webview: Webview) -> Result<crate::safe::SafeState, String> {
|
async fn safe_mode_get(webview: Webview) -> Result<crate::safe::SafeState, String> {
|
||||||
|
|
@ -971,14 +920,6 @@ async fn features_set(webview: Webview, app: AppHandle, features: serde_json::Ma
|
||||||
set_features(&app, features)
|
set_features(&app, features)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Runs a plugin's palette command in tab `id`: only a command that tab reported, only while it is
|
|
||||||
/// on the site. The command's code runs in the page; the tab gets keyboard focus for what it opens.
|
|
||||||
#[tauri::command]
|
|
||||||
async fn tab_run_command(webview: Webview, app: AppHandle, id: String, command: String) -> Result<(), String> {
|
|
||||||
shell_only(&webview)?;
|
|
||||||
crate::tab_commands::run(&app, &id, &command)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The onboarding mode: what was chosen, whether the first-run screen was answered, and whether
|
/// The onboarding mode: what was chosen, whether the first-run screen was answered, and whether
|
||||||
/// this app was set up before modes existed.
|
/// this app was set up before modes existed.
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
|
|
@ -1165,7 +1106,6 @@ fn tab_builder(app: &AppHandle, hooks: &Arc<dyn SiteHooks>, tab: &NewTab, url: U
|
||||||
}
|
}
|
||||||
let finished = matches!(payload.event(), PageLoadEvent::Finished);
|
let finished = matches!(payload.event(), PageLoadEvent::Finished);
|
||||||
if !finished {
|
if !finished {
|
||||||
crate::tab_commands::cleared(app, tab.label());
|
|
||||||
load_hooks.page_started(app, &tab);
|
load_hooks.page_started(app, &tab);
|
||||||
// An engine that resets page zoom on navigation still shows this tab's.
|
// An engine that resets page zoom on navigation still shows this tab's.
|
||||||
host::restore_tab_zoom(app, &tab);
|
host::restore_tab_zoom(app, &tab);
|
||||||
|
|
@ -1254,7 +1194,6 @@ fn host_handler() -> impl Fn(tauri::ipc::Invoke<Wry>) -> bool + Send + Sync + 's
|
||||||
tab_action,
|
tab_action,
|
||||||
tab_zoom,
|
tab_zoom,
|
||||||
tab_find,
|
tab_find,
|
||||||
menu_set,
|
|
||||||
safe_mode_get,
|
safe_mode_get,
|
||||||
safe_mode_set,
|
safe_mode_set,
|
||||||
diag_get,
|
diag_get,
|
||||||
|
|
@ -1280,7 +1219,6 @@ fn host_handler() -> impl Fn(tauri::ipc::Invoke<Wry>) -> bool + Send + Sync + 's
|
||||||
mode_set,
|
mode_set,
|
||||||
settings_get,
|
settings_get,
|
||||||
settings_set,
|
settings_set,
|
||||||
tab_run_command,
|
|
||||||
tab_shortcut,
|
tab_shortcut,
|
||||||
tab_link_drag,
|
tab_link_drag,
|
||||||
open_panel
|
open_panel
|
||||||
|
|
@ -1308,24 +1246,6 @@ fn dev_handler() -> impl Fn(tauri::ipc::Invoke<Wry>) -> bool + Send + Sync + 'st
|
||||||
crate::dev_commands::handler()
|
crate::dev_commands::handler()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The alert settings commands ([`commands::ALERTS`]).
|
|
||||||
fn alerts_handler() -> impl Fn(tauri::ipc::Invoke<Wry>) -> bool + Send + Sync + 'static {
|
|
||||||
crate::alerts_commands::handler()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The drafts vault commands ([`commands::VAULT`]); without the `vault` feature none are served.
|
|
||||||
fn vault_handler() -> impl Fn(tauri::ipc::Invoke<Wry>) -> bool + Send + Sync + 'static {
|
|
||||||
#[cfg(feature = "vault")]
|
|
||||||
return crate::vault_commands::handler();
|
|
||||||
#[cfg(not(feature = "vault"))]
|
|
||||||
|_: tauri::ipc::Invoke<Wry>| false
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The theme commands ([`commands::THEME`]).
|
|
||||||
fn theme_handler() -> impl Fn(tauri::ipc::Invoke<Wry>) -> bool + Send + Sync + 'static {
|
|
||||||
crate::theme_commands::handler()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The workspaces and sync commands ([`commands::WORKSPACES`], [`commands::SYNC`]).
|
/// The workspaces and sync commands ([`commands::WORKSPACES`], [`commands::SYNC`]).
|
||||||
fn sync_handler() -> impl Fn(tauri::ipc::Invoke<Wry>) -> bool + Send + Sync + 'static {
|
fn sync_handler() -> impl Fn(tauri::ipc::Invoke<Wry>) -> bool + Send + Sync + 'static {
|
||||||
crate::sync_commands::handler()
|
crate::sync_commands::handler()
|
||||||
|
|
@ -1394,31 +1314,16 @@ impl App {
|
||||||
let update_handler = update_handler();
|
let update_handler = update_handler();
|
||||||
let sync_handler = sync_handler();
|
let sync_handler = sync_handler();
|
||||||
let dev_handler = dev_handler();
|
let dev_handler = dev_handler();
|
||||||
let theme_handler = theme_handler();
|
|
||||||
let alerts_handler = alerts_handler();
|
|
||||||
let vault_handler = vault_handler();
|
|
||||||
let backup_handler = backup_handler();
|
let backup_handler = backup_handler();
|
||||||
let builder = tauri::Builder::<Wry>::default()
|
let builder = tauri::Builder::<Wry>::default()
|
||||||
// The native menu bar's choices go to the shell, which runs them ([`crate::menu`]).
|
|
||||||
.on_menu_event(|app, event| {
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
if let Some(id) = crate::menu::chosen(event.id().as_ref()) {
|
|
||||||
emit_shell(app, crate::menu::EVENT_NATIVE_MENU, id.to_owned());
|
|
||||||
}
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
|
||||||
let _ = (app, event);
|
|
||||||
})
|
|
||||||
// Must be first: a second launch focuses the running window instead of fighting over
|
// Must be first: a second launch focuses the running window instead of fighting over
|
||||||
// the app's data and WebView profile (and hands over its link).
|
// the app's data and WebView profile (and hands over its link).
|
||||||
.plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| {
|
.plugin(tauri_plugin_single_instance::init(|app, _, _| {
|
||||||
if let Some(window) = app.get_window(policy::MAIN_LABEL) {
|
if let Some(window) = app.get_window(policy::MAIN_LABEL) {
|
||||||
let _ = window.unminimize();
|
let _ = window.unminimize();
|
||||||
let _ = window.show();
|
let _ = window.show();
|
||||||
let _ = window.set_focus();
|
let _ = window.set_focus();
|
||||||
}
|
}
|
||||||
// A double-click or "Open with" on a file while the app runs: its path arrives here.
|
|
||||||
#[cfg(feature = "net")]
|
|
||||||
crate::store_commands::opened_args(app, &_args, &_cwd);
|
|
||||||
}));
|
}));
|
||||||
// Install links (after single-instance, which forwards a second launch's link).
|
// Install links (after single-instance, which forwards a second launch's link).
|
||||||
let builder = if config.deep_link { builder.plugin(tauri_plugin_deep_link::init()) } else { builder };
|
let builder = if config.deep_link { builder.plugin(tauri_plugin_deep_link::init()) } else { builder };
|
||||||
|
|
@ -1492,10 +1397,6 @@ impl App {
|
||||||
crate::media_commands::init(&handle);
|
crate::media_commands::init(&handle);
|
||||||
crate::sync_commands::init(&handle);
|
crate::sync_commands::init(&handle);
|
||||||
crate::dev_commands::init(&handle);
|
crate::dev_commands::init(&handle);
|
||||||
crate::theme_commands::init(&handle);
|
|
||||||
crate::alerts_commands::init(&handle);
|
|
||||||
#[cfg(feature = "vault")]
|
|
||||||
crate::vault_commands::init(&handle)?;
|
|
||||||
#[cfg(feature = "net")]
|
#[cfg(feature = "net")]
|
||||||
crate::fonts_commands::init(&handle);
|
crate::fonts_commands::init(&handle);
|
||||||
#[cfg(feature = "net")]
|
#[cfg(feature = "net")]
|
||||||
|
|
@ -1528,57 +1429,14 @@ impl App {
|
||||||
dev_handler(invoke)
|
dev_handler(invoke)
|
||||||
} else if commands::BACKUP.contains(&invoke.message.command()) {
|
} else if commands::BACKUP.contains(&invoke.message.command()) {
|
||||||
backup_handler(invoke)
|
backup_handler(invoke)
|
||||||
} else if commands::THEME.contains(&invoke.message.command()) {
|
|
||||||
theme_handler(invoke)
|
|
||||||
} else if commands::ALERTS.contains(&invoke.message.command()) {
|
|
||||||
alerts_handler(invoke)
|
|
||||||
} else if commands::VAULT.contains(&invoke.message.command()) {
|
|
||||||
vault_handler(invoke)
|
|
||||||
} else if commands::is_host(invoke.message.command()) {
|
} else if commands::is_host(invoke.message.command()) {
|
||||||
host_handler(invoke)
|
host_handler(invoke)
|
||||||
} else {
|
} else {
|
||||||
handler(invoke)
|
handler(invoke)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.build(context)
|
.run(context)
|
||||||
.unwrap_or_else(|error| panic!("Failed to launch {}: {error}", config.title))
|
.unwrap_or_else(|error| panic!("Failed to launch {}: {error}", config.title));
|
||||||
.run(|app, event| on_run_event(app, &event));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Run-loop events: the macOS close-hides rule, and why the app is going away for `--diag` ([`crate::diag`]): an exit request with its code (None is a
|
|
||||||
/// polite quit from outside: Cmd+Q, the Dock, or another app such as an auto-quitter closing the last
|
|
||||||
/// window), window close/destroy events and the final exit. Nothing is written without diagnostics.
|
|
||||||
fn on_run_event(app: &AppHandle, event: &tauri::RunEvent) {
|
|
||||||
// macOS: the red close button sends the main window to the Dock (minimized, not hidden: an auto-quitter
|
|
||||||
// such as Swift Quit terminates an app whose window list goes empty, but not one with a minimized window)
|
|
||||||
// and the app keeps running; a Dock click shows it
|
|
||||||
// again; Cmd+Q still quits (an exit request, not a window close).
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
match event {
|
|
||||||
tauri::RunEvent::WindowEvent { label, event: tauri::WindowEvent::CloseRequested { api, .. }, .. } if label == policy::MAIN_LABEL => {
|
|
||||||
api.prevent_close();
|
|
||||||
if let Some(window) = app.get_window(policy::MAIN_LABEL) {
|
|
||||||
let _ = window.minimize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tauri::RunEvent::Reopen { .. } => {
|
|
||||||
if let Some(window) = app.get_window(policy::MAIN_LABEL) {
|
|
||||||
let _ = window.unminimize();
|
|
||||||
let _ = window.show();
|
|
||||||
let _ = window.set_focus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
|
||||||
let _ = app;
|
|
||||||
match event {
|
|
||||||
tauri::RunEvent::ExitRequested { code, .. } => crate::diag::log("host", &format!("exit requested code={code:?}")),
|
|
||||||
tauri::RunEvent::Exit => crate::diag::log("host", "exit"),
|
|
||||||
tauri::RunEvent::WindowEvent { label, event: tauri::WindowEvent::CloseRequested { .. }, .. } => crate::diag::log("host", &format!("window {label} close requested")),
|
|
||||||
tauri::RunEvent::WindowEvent { label, event: tauri::WindowEvent::Destroyed, .. } => crate::diag::log("host", &format!("window {label} destroyed")),
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ pub const SHELL: &[&str] = &[
|
||||||
"tab_action",
|
"tab_action",
|
||||||
"tab_zoom",
|
"tab_zoom",
|
||||||
"tab_find",
|
"tab_find",
|
||||||
"menu_set",
|
|
||||||
"safe_mode_get",
|
"safe_mode_get",
|
||||||
"safe_mode_set",
|
"safe_mode_set",
|
||||||
"diag_get",
|
"diag_get",
|
||||||
|
|
@ -39,7 +38,6 @@ pub const SHELL: &[&str] = &[
|
||||||
"mode_set",
|
"mode_set",
|
||||||
"settings_get",
|
"settings_get",
|
||||||
"settings_set",
|
"settings_set",
|
||||||
"tab_run_command",
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/// Tab-only: any tab webview, speaking only about itself.
|
/// Tab-only: any tab webview, speaking only about itself.
|
||||||
|
|
@ -56,7 +54,6 @@ pub const STORE: &[&str] = &[
|
||||||
"install_pending",
|
"install_pending",
|
||||||
"install_stage_link",
|
"install_stage_link",
|
||||||
"install_stage_file",
|
"install_stage_file",
|
||||||
"install_stage_opened",
|
|
||||||
"install_cancel",
|
"install_cancel",
|
||||||
"install_commit",
|
"install_commit",
|
||||||
"plugin_remove",
|
"plugin_remove",
|
||||||
|
|
@ -121,24 +118,9 @@ pub const DEV: &[&str] = &["dev_get", "dev_set", "dev_pick_theme", "dev_clear_th
|
||||||
/// (`SiteHooks::backup_sections`, `backup_drafts`, `backup_apply`).
|
/// (`SiteHooks::backup_sections`, `backup_drafts`, `backup_apply`).
|
||||||
pub const BACKUP: &[&str] = &["backup_collect", "backup_export_file", "backup_open_file", "backup_apply"];
|
pub const BACKUP: &[&str] = &["backup_collect", "backup_export_file", "backup_open_file", "backup_apply"];
|
||||||
|
|
||||||
/// Shell-only, optional: site themes (the owner's theme, account and pane themes, the Theme
|
|
||||||
/// Builder's live preview), served when the app sets `AppConfig::themes`. An app that uses them
|
|
||||||
/// grants these to the shell (`testkit::Capabilities::assert_shell_only_group`).
|
|
||||||
pub const THEME: &[&str] = &["theme_get", "theme_set", "theme_preview", "theme_scopes_get", "theme_scopes_set"];
|
|
||||||
|
|
||||||
/// Shell-only, optional: the keyword alert settings (`alerts_get`, `alerts_set`), served when the app
|
|
||||||
/// sets `AppConfig::alerts`. An app that uses them grants these to the shell
|
|
||||||
/// (`testkit::Capabilities::assert_shell_only_group`).
|
|
||||||
pub const ALERTS: &[&str] = &["alerts_get", "alerts_set"];
|
|
||||||
|
|
||||||
/// Shell-only, optional: the drafts vault (list, save with a revision check, revisions, archive and
|
|
||||||
/// restore, observations, one consistent export), served when the app sets `AppConfig::vault`. An app
|
|
||||||
/// that uses them grants these to the shell (`testkit::Capabilities::assert_shell_only_group`).
|
|
||||||
pub const VAULT: &[&str] = &["draft_list", "draft_save", "draft_revisions", "draft_status", "observation_list", "data_export"];
|
|
||||||
|
|
||||||
/// Whether `command` is one of the host's (dispatched to the host, never to the app's handler).
|
/// Whether `command` is one of the host's (dispatched to the host, never to the app's handler).
|
||||||
pub fn is_host(command: &str) -> bool {
|
pub fn is_host(command: &str) -> bool {
|
||||||
SHELL.contains(&command) || TAB.contains(&command) || SITE.contains(&command) || STORE.contains(&command) || MEDIA.contains(&command) || GFONTS.contains(&command) || UPDATE.contains(&command) || WORKSPACES.contains(&command) || SYNC.contains(&command) || DEV.contains(&command) || BACKUP.contains(&command) || THEME.contains(&command) || ALERTS.contains(&command) || VAULT.contains(&command)
|
SHELL.contains(&command) || TAB.contains(&command) || SITE.contains(&command) || STORE.contains(&command) || MEDIA.contains(&command) || GFONTS.contains(&command) || UPDATE.contains(&command) || WORKSPACES.contains(&command) || SYNC.contains(&command) || DEV.contains(&command) || BACKUP.contains(&command)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The capability permission tauri-build generates for `command` (`tabs_sync` → `allow-tabs-sync`).
|
/// The capability permission tauri-build generates for `command` (`tabs_sync` → `allow-tabs-sync`).
|
||||||
|
|
@ -150,11 +132,11 @@ pub fn permission(command: &str) -> String {
|
||||||
/// once). Leaked on purpose: tauri-build wants `&'static` and a build script runs once.
|
/// once). Leaked on purpose: tauri-build wants `&'static` and a build script runs once.
|
||||||
///
|
///
|
||||||
/// ```ignore
|
/// ```ignore
|
||||||
/// tauri_build::AppManifest::new().commands(waybetter_host::commands::manifest(&["capture_draft"]))
|
/// tauri_build::AppManifest::new().commands(waybetter_host::commands::manifest(&["draft_list"]))
|
||||||
/// ```
|
/// ```
|
||||||
pub fn manifest(app: &[&'static str]) -> &'static [&'static str] {
|
pub fn manifest(app: &[&'static str]) -> &'static [&'static str] {
|
||||||
let mut all: Vec<&'static str> = Vec::with_capacity(app.len() + SHELL.len() + TAB.len() + SITE.len() + STORE.len() + MEDIA.len() + GFONTS.len() + UPDATE.len() + WORKSPACES.len() + SYNC.len() + DEV.len() + BACKUP.len() + THEME.len() + ALERTS.len() + VAULT.len());
|
let mut all: Vec<&'static str> = Vec::with_capacity(app.len() + SHELL.len() + TAB.len() + SITE.len() + STORE.len() + MEDIA.len() + GFONTS.len() + UPDATE.len() + WORKSPACES.len() + SYNC.len() + DEV.len() + BACKUP.len());
|
||||||
for command in app.iter().chain(SHELL).chain(TAB).chain(SITE).chain(STORE).chain(MEDIA).chain(GFONTS).chain(UPDATE).chain(WORKSPACES).chain(SYNC).chain(DEV).chain(BACKUP).chain(THEME).chain(ALERTS).chain(VAULT) {
|
for command in app.iter().chain(SHELL).chain(TAB).chain(SITE).chain(STORE).chain(MEDIA).chain(GFONTS).chain(UPDATE).chain(WORKSPACES).chain(SYNC).chain(DEV).chain(BACKUP) {
|
||||||
if !all.contains(command) {
|
if !all.contains(command) {
|
||||||
all.push(command);
|
all.push(command);
|
||||||
}
|
}
|
||||||
|
|
@ -168,20 +150,20 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn manifest_adds_the_host_commands_once() {
|
fn manifest_adds_the_host_commands_once() {
|
||||||
let all = manifest(&["capture_draft", "tabs_sync"]);
|
let all = manifest(&["draft_list", "tabs_sync"]);
|
||||||
assert_eq!(all[0], "capture_draft");
|
assert_eq!(all[0], "draft_list");
|
||||||
assert_eq!(all.iter().filter(|c| **c == "tabs_sync").count(), 1);
|
assert_eq!(all.iter().filter(|c| **c == "tabs_sync").count(), 1);
|
||||||
for command in SHELL.iter().chain(TAB).chain(SITE).chain(STORE).chain(MEDIA).chain(GFONTS).chain(UPDATE).chain(WORKSPACES).chain(SYNC).chain(DEV).chain(BACKUP).chain(THEME).chain(ALERTS).chain(VAULT) {
|
for command in SHELL.iter().chain(TAB).chain(SITE).chain(STORE).chain(MEDIA).chain(GFONTS).chain(UPDATE).chain(WORKSPACES).chain(SYNC).chain(DEV).chain(BACKUP) {
|
||||||
assert!(all.contains(command), "{command}");
|
assert!(all.contains(command), "{command}");
|
||||||
assert!(is_host(command));
|
assert!(is_host(command));
|
||||||
}
|
}
|
||||||
assert!(!is_host("capture_draft"));
|
assert!(!is_host("draft_list"));
|
||||||
assert_eq!(permission("tab_link_drag"), "allow-tab-link-drag");
|
assert_eq!(permission("tab_link_drag"), "allow-tab-link-drag");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn shell_and_tab_commands_do_not_overlap() {
|
fn shell_and_tab_commands_do_not_overlap() {
|
||||||
assert!(!SHELL.iter().any(|command| TAB.contains(command) || SITE.contains(command) || STORE.contains(command) || MEDIA.contains(command) || GFONTS.contains(command) || UPDATE.contains(command) || WORKSPACES.contains(command) || SYNC.contains(command) || DEV.contains(command) || BACKUP.contains(command) || THEME.contains(command) || ALERTS.contains(command)));
|
assert!(!SHELL.iter().any(|command| TAB.contains(command) || SITE.contains(command) || STORE.contains(command) || MEDIA.contains(command) || GFONTS.contains(command) || UPDATE.contains(command) || WORKSPACES.contains(command) || SYNC.contains(command) || DEV.contains(command) || BACKUP.contains(command)));
|
||||||
assert!(!TAB.iter().any(|command| SITE.contains(command)));
|
assert!(!TAB.iter().any(|command| SITE.contains(command)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
//! overlays and `shell_raise` calls with their results, native focus calls, and the shell document's
|
//! overlays and `shell_raise` calls with their results, native focus calls, and the shell document's
|
||||||
//! focus, blur and visibility changes. A line is an event name and a few words: never a URL, a
|
//! focus, blur and visibility changes. A line is an event name and a few words: never a URL, a
|
||||||
//! query, page text or anything about an account ([`clean`] keeps plain printable ASCII only and
|
//! query, page text or anything about an account ([`clean`] keeps plain printable ASCII only and
|
||||||
//! caps the length). Each launch with diagnostics on starts a new file; the one before it is kept as `diag.prev.log`.
|
//! caps the length). The file is truncated at each launch with diagnostics on.
|
||||||
|
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
@ -15,7 +15,6 @@ use std::time::Instant;
|
||||||
pub const ARG: &str = "--diag";
|
pub const ARG: &str = "--diag";
|
||||||
pub const ENV: &str = "WAYBETTER_DIAG";
|
pub const ENV: &str = "WAYBETTER_DIAG";
|
||||||
pub const FILE: &str = "diag.log";
|
pub const FILE: &str = "diag.log";
|
||||||
pub const PREVIOUS: &str = "diag.prev.log";
|
|
||||||
const MAX_LINE: usize = 300;
|
const MAX_LINE: usize = 300;
|
||||||
|
|
||||||
static ON: AtomicBool = AtomicBool::new(false);
|
static ON: AtomicBool = AtomicBool::new(false);
|
||||||
|
|
@ -35,13 +34,10 @@ pub fn clean(line: &str) -> String {
|
||||||
line.chars().take(MAX_LINE).map(|ch| if (' '..='~').contains(&ch) { ch } else { '?' }).collect()
|
line.chars().take(MAX_LINE).map(|ch| if (' '..='~').contains(&ch) { ch } else { '?' }).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Starts writing to `dir/diag.log` (created, truncated); the previous run's log is kept as `diag.prev.log`.
|
/// Starts writing to `dir/diag.log` (created, truncated). Nothing happens without a folder.
|
||||||
/// Nothing happens without a folder.
|
|
||||||
pub fn start(dir: Option<PathBuf>) {
|
pub fn start(dir: Option<PathBuf>) {
|
||||||
let Some(dir) = dir else { return };
|
let Some(dir) = dir else { return };
|
||||||
let _ = std::fs::create_dir_all(&dir);
|
let _ = std::fs::create_dir_all(&dir);
|
||||||
// A run that went wrong is usually relaunched at once: keep its log.
|
|
||||||
let _ = std::fs::rename(dir.join(FILE), dir.join(PREVIOUS));
|
|
||||||
if let Ok(file) = std::fs::File::create(dir.join(FILE)) {
|
if let Ok(file) = std::fs::File::create(dir.join(FILE)) {
|
||||||
if let Ok(mut sink) = SINK.lock() {
|
if let Ok(mut sink) = SINK.lock() {
|
||||||
*sink = Some((file, Instant::now()));
|
*sink = Some((file, Instant::now()));
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
//! (Windows, WebView2 Runtime with `ICoreWebView2_28`; its own find bar suppressed), which also
|
//! (Windows, WebView2 Runtime with `ICoreWebView2_28`; its own find bar suppressed), which also
|
||||||
//! reports the match count and the active match (`tab-find` events to the shell). Everywhere else
|
//! reports the match count and the active match (`tab-find` events to the shell). Everywhere else
|
||||||
//! (macOS, Linux, an older WebView2 Runtime) native code evaluates [`fallback_script`] in the tab:
|
//! (macOS, Linux, an older WebView2 Runtime) native code evaluates [`fallback_script`] in the tab:
|
||||||
//! the page's matches drawn with the CSS Custom Highlight API (see [`fallback_script`]), which counts nothing.
|
//! the engine's `window.find`, which selects the next match and scrolls to it but counts nothing.
|
||||||
//!
|
//!
|
||||||
//! The query is data: it goes from the shell to the engine and is kept nowhere (no file, no log,
|
//! The query is data: it goes from the shell to the engine and is kept nowhere (no file, no log,
|
||||||
//! no state in this crate). Tabs gain no command; a tab may only forward the key name `find`
|
//! no state in this crate). Tabs gain no command; a tab may only forward the key name `find`
|
||||||
|
|
@ -86,79 +86,23 @@ pub fn request(action: &str, query: Option<&str>) -> Result<FindRequest, String>
|
||||||
Ok(FindRequest { action, query: if action == FindAction::Stop { None } else { query } })
|
Ok(FindRequest { action, query: if action == FindAction::Stop { None } else { query } })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The script native code evaluates where the engine's find cannot be driven natively (macOS,
|
/// The script native code evaluates where the engine's find cannot be driven natively: the
|
||||||
/// Linux, an old WebView2): the page's matches drawn with the CSS Custom Highlight API (every match
|
/// engine's `window.find` (case-insensitive, wrapping), or clearing the selection for `stop`.
|
||||||
/// tinted, the active one stronger and scrolled into view; independent of window focus, which the
|
/// The query appears only as a JSON string literal; nothing is sent anywhere or stored in the page.
|
||||||
/// engine's selection-based `window.find` is not: it shows nothing while the page is not the key
|
|
||||||
/// view), or `window.find` where an engine lacks that API. `stop` removes the highlights.
|
|
||||||
/// The query appears only as a JSON string literal; nothing is sent anywhere or stored: the
|
|
||||||
/// matches live in the page's highlight registry until `stop`, the query nowhere.
|
|
||||||
pub fn fallback_script(request: &FindRequest) -> String {
|
pub fn fallback_script(request: &FindRequest) -> String {
|
||||||
let action = match request.action {
|
match (&request.action, &request.query) {
|
||||||
FindAction::Start => "start",
|
(FindAction::Stop, _) | (_, None) => {
|
||||||
FindAction::Next => "next",
|
"(()=>{try{const s=getSelection();if(s)s.removeAllRanges();}catch(e){}})();".to_owned()
|
||||||
FindAction::Previous => "previous",
|
|
||||||
FindAction::Stop => "stop",
|
|
||||||
};
|
|
||||||
let query = request.query.as_ref().map_or_else(|| "null".to_owned(), |query| serde_json::to_string(query).unwrap_or_else(|_| "null".into()));
|
|
||||||
HIGHLIGHT_SCRIPT.replace("__ACTION__", action).replace("__QUERY__", &query)
|
|
||||||
}
|
}
|
||||||
|
(action, Some(query)) => {
|
||||||
const HIGHLIGHT_SCRIPT: &str = r#"(()=>{try{
|
let text = serde_json::to_string(query).unwrap_or_else(|_| "\"\"".into());
|
||||||
const action="__ACTION__",query=__QUERY__;
|
// A new query starts from the top of the page; next/previous continue from the selection.
|
||||||
const H=window.CSS&&CSS.highlights,ALL="wb-find",ACT="wb-find-active";
|
let restart = if *action == FindAction::Start { "const s=getSelection();if(s)s.removeAllRanges();" } else { "" };
|
||||||
const sheets=()=>document.adoptedStyleSheets||[];
|
let backwards = *action == FindAction::Previous;
|
||||||
const stop=()=>{if(H){H.delete(ALL);H.delete(ACT);}try{document.adoptedStyleSheets=sheets().filter(s=>!s.__wbFind);}catch(e){}};
|
format!("(()=>{{try{{{restart}if(typeof window.find==='function')window.find({text},false,{backwards},true,false,false,false);}}catch(e){{}}}})();")
|
||||||
if(action==="stop"||(action==="start"&&query===null)){stop();return;}
|
|
||||||
if(!H||typeof Highlight!=="function"){
|
|
||||||
if(query!==null&&typeof window.find==="function"){if(action==="start"){const s=getSelection();if(s)s.removeAllRanges();}window.find(query,false,action==="previous",true,false,false,false);}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const live=r=>r.startContainer.isConnected&&r.endContainer.isConnected;
|
|
||||||
const collect=q=>{
|
|
||||||
const needle=q.toLowerCase(),out=[];
|
|
||||||
if(!needle||needle.length!==q.length)return out;
|
|
||||||
const walker=document.createTreeWalker(document.body||document.documentElement,NodeFilter.SHOW_TEXT,{acceptNode:n=>{const p=n.parentElement;return !p||/^(SCRIPT|STYLE|NOSCRIPT|TEXTAREA)$/.test(p.tagName)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT;}});
|
|
||||||
for(let n;(n=walker.nextNode())&&out.length<2000;){
|
|
||||||
const t=n.nodeValue;
|
|
||||||
if(t.length<needle.length)continue;
|
|
||||||
const hay=t.toLowerCase();
|
|
||||||
if(hay.length!==t.length)continue;
|
|
||||||
const el=n.parentElement;
|
|
||||||
if(el.checkVisibility&&!el.checkVisibility())continue;
|
|
||||||
for(let i=hay.indexOf(needle);i>=0&&out.length<2000;i=hay.indexOf(needle,i+needle.length)){
|
|
||||||
const r=document.createRange();r.setStart(n,i);r.setEnd(n,i+needle.length);out.push(r);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return out;
|
|
||||||
};
|
|
||||||
const active=H.get(ACT);
|
|
||||||
const current=active?[...active][0]:null;
|
|
||||||
let all,idx;
|
|
||||||
if(action==="start"){
|
|
||||||
all=collect(query);
|
|
||||||
idx=all.findIndex(r=>r.getBoundingClientRect().bottom>0);
|
|
||||||
if(idx<0)idx=0;
|
|
||||||
}else{
|
|
||||||
all=[...(H.get(ALL)||[])].filter(live);
|
|
||||||
if(!all.length&&query!==null)all=collect(query);
|
|
||||||
const at=current?all.indexOf(current):-1;
|
|
||||||
idx=!all.length?-1:action==="previous"?(at<=0?all.length-1:at-1):(at+1)%all.length;
|
|
||||||
}
|
}
|
||||||
H.set(ALL,new Highlight(...all));
|
|
||||||
if(idx<0||!all.length){H.delete(ACT);}
|
|
||||||
else{
|
|
||||||
const mark=new Highlight(all[idx]);mark.priority=1;H.set(ACT,mark);
|
|
||||||
const box=all[idx].getBoundingClientRect();
|
|
||||||
if(box.top<0||box.bottom>innerHeight){const el=all[idx].startContainer.parentElement;if(el)el.scrollIntoView({block:"center",inline:"nearest"});}
|
|
||||||
}
|
|
||||||
if(!sheets().some(s=>s.__wbFind)){
|
|
||||||
const sheet=new CSSStyleSheet();
|
|
||||||
sheet.replaceSync("::highlight(wb-find){background-color:rgba(255,213,74,.55);color:inherit}::highlight(wb-find-active){background-color:#ff9632;color:#000}");
|
|
||||||
sheet.__wbFind=true;
|
|
||||||
document.adoptedStyleSheets=[...sheets(),sheet];
|
|
||||||
}
|
|
||||||
}catch(e){}})();"#;
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
@ -183,16 +127,19 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn the_fallback_script_carries_the_query_only_as_a_string_literal() {
|
fn the_fallback_script_carries_the_query_only_as_a_string_literal() {
|
||||||
let script = fallback_script(&request("start", Some("it's \"quoted\" </script> \\ ${x} `y`")).unwrap());
|
let script = fallback_script(&request("start", Some("it's \"quoted\" </script> \\ ${x} `y`")).unwrap());
|
||||||
assert!(script.contains(r#"const action="start",query="it's \"quoted\" </script> \\ ${x} `y`";"#), "{script}");
|
assert!(script.contains(r#"window.find("it's \"quoted\" </script> \\ ${x} `y`",false,false,true"#), "{script}");
|
||||||
|
assert!(script.contains("removeAllRanges"), "a new query starts from the top");
|
||||||
let next = fallback_script(&request("next", Some("a")).unwrap());
|
let next = fallback_script(&request("next", Some("a")).unwrap());
|
||||||
assert!(next.contains(r#"const action="next",query="a";"#));
|
assert!(next.contains(r#"window.find("a",false,false,true"#) && !next.contains("removeAllRanges"));
|
||||||
assert!(fallback_script(&request("previous", Some("a")).unwrap()).contains(r#"action="previous""#));
|
assert!(fallback_script(&request("previous", Some("a")).unwrap()).contains(r#"window.find("a",false,true,true"#));
|
||||||
// Stop and a step without a query carry no query: stop clears the highlights, a step uses the page's matches.
|
// Stop (and a step without a query) only clears the selection.
|
||||||
assert!(fallback_script(&request("stop", None).unwrap()).contains(r#"action="stop",query=null;"#));
|
for request in [request("stop", None).unwrap(), request("next", None).unwrap()] {
|
||||||
assert!(fallback_script(&request("next", None).unwrap()).contains("query=null;"));
|
let script = fallback_script(&request);
|
||||||
// Nothing leaves the page or stays in it: no network, storage, invoke or markup writes.
|
assert!(script.contains("removeAllRanges") && !script.contains("window.find"), "{script}");
|
||||||
|
}
|
||||||
|
// Nothing leaves the page or stays in it: no network, storage, invoke or DOM writes.
|
||||||
for script in [script, next] {
|
for script in [script, next] {
|
||||||
for forbidden in ["fetch", "XMLHttpRequest", "localStorage", "sessionStorage", "invoke", "postMessage", "innerHTML", "document.cookie", "eval(", "__ACTION__", "__QUERY__"] {
|
for forbidden in ["fetch", "XMLHttpRequest", "localStorage", "sessionStorage", "invoke", "postMessage", "innerHTML", "document.cookie", "eval("] {
|
||||||
assert!(!script.contains(forbidden), "{forbidden} in {script}");
|
assert!(!script.contains(forbidden), "{forbidden} in {script}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ pub(crate) fn init(app: &AppHandle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn changed(app: &AppHandle) {
|
fn changed(app: &AppHandle) {
|
||||||
crate::theme_commands::apply(app);
|
|
||||||
crate::app::hooks(app).fonts_changed(app);
|
crate::app::hooks(app).fonts_changed(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,7 @@ pub fn forget_tab_zoom<R: Runtime>(app: &AppHandle<R>, id: &str) {
|
||||||
|
|
||||||
/// `tab_find`: searches tab `id`'s page ([`crate::find`]). The engine's own find where this build
|
/// `tab_find`: searches tab `id`'s page ([`crate::find`]). The engine's own find where this build
|
||||||
/// can drive it (WebView2's `ICoreWebView2Find`, which reports counts through `tab-find` events);
|
/// can drive it (WebView2's `ICoreWebView2Find`, which reports counts through `tab-find` events);
|
||||||
/// otherwise the evaluated Custom Highlight fallback ([`crate::find::fallback_script`]). The query is kept nowhere.
|
/// otherwise the evaluated `window.find` fallback. The query is kept nowhere.
|
||||||
pub fn tab_find<R: Runtime>(app: &AppHandle<R>, id: &str, action: &str, query: Option<&str>) -> Result<(), String> {
|
pub fn tab_find<R: Runtime>(app: &AppHandle<R>, id: &str, action: &str, query: Option<&str>) -> Result<(), String> {
|
||||||
if !policy::valid_tab_id(id) {
|
if !policy::valid_tab_id(id) {
|
||||||
return Err("VALIDATION: invalid tab id".into());
|
return Err("VALIDATION: invalid tab id".into());
|
||||||
|
|
@ -451,20 +451,10 @@ pub fn place_child<R: Runtime>(webview: &Webview<R>, x: f64, y: f64, width: f64,
|
||||||
// One native move+resize: separate set_position/set_size calls were two WebView2 `SetBounds`
|
// One native move+resize: separate set_position/set_size calls were two WebView2 `SetBounds`
|
||||||
// (the page re-laid out at the old size, then at the new one) and two main-thread messages.
|
// (the page re-laid out at the old size, then at the new one) and two main-thread messages.
|
||||||
#[cfg(not(target_os = "linux"))]
|
#[cfg(not(target_os = "linux"))]
|
||||||
{
|
|
||||||
let _ = webview.set_bounds(tauri::Rect {
|
let _ = webview.set_bounds(tauri::Rect {
|
||||||
position: tauri::LogicalPosition::new(x, y).into(),
|
position: tauri::LogicalPosition::new(x, y).into(),
|
||||||
size: tauri::LogicalSize::new(width, height).into(),
|
size: tauri::LogicalSize::new(width, height).into(),
|
||||||
});
|
});
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
if crate::diag::active() {
|
|
||||||
let actual = webview.bounds().map(|b| {
|
|
||||||
let (p, s) = (b.position.to_logical::<f64>(1.0), b.size.to_logical::<f64>(1.0));
|
|
||||||
format!("{},{} {}x{}", p.x, p.y, s.width, s.height)
|
|
||||||
});
|
|
||||||
crate::diag::log("host", &format!("place {} asked {x},{y} {width}x{height} now {actual:?}", webview.label()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Linux: the shell webview becomes the base layer of a GtkOverlay filling the window, which
|
/// Linux: the shell webview becomes the base layer of a GtkOverlay filling the window, which
|
||||||
|
|
@ -919,49 +909,17 @@ pub fn place_tab<R: Runtime>(webview: &Webview<R>, rect: crate::layout::Rect, vi
|
||||||
let was_visible = placed.was_visible(webview.label());
|
let was_visible = placed.was_visible(webview.label());
|
||||||
(placed.place(webview.label(), rect, visible), was_visible)
|
(placed.place(webview.label(), rect, visible), was_visible)
|
||||||
};
|
};
|
||||||
// macOS: a pane that comes back from hidden (parked at 1x1) and is resized while still hidden keeps
|
if changed.bounds {
|
||||||
// the page's old viewport (X drew an empty timeline until the next real resize). Show it first, then
|
|
||||||
// size it, then tell the page its window changed.
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
let reveal = changed.visible && visible;
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
|
||||||
let reveal = false;
|
|
||||||
if reveal {
|
|
||||||
set_tab_visible(webview, visible, parked, was_visible);
|
|
||||||
}
|
|
||||||
// macOS: the cached placement says nothing moved, but AppKit (window animations, a monitor change, a
|
|
||||||
// restore from the Dock) can move or resize a child behind our back; the pane then shows the shell's
|
|
||||||
// black ground until relaunch. A visible pane whose real frame differs is placed again.
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
let drifted = visible && !changed.bounds && !reveal && native_frame_differs(webview, rect);
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
|
||||||
let drifted = false;
|
|
||||||
if changed.bounds || drifted {
|
|
||||||
let (x, y, width, height) = rect;
|
let (x, y, width, height) = rect;
|
||||||
place_child(webview, x, y, width, height);
|
place_child(webview, x, y, width, height);
|
||||||
}
|
}
|
||||||
if reveal {
|
if changed.visible {
|
||||||
let _ = webview.eval("window.dispatchEvent(new Event('resize'));");
|
|
||||||
} else if changed.visible {
|
|
||||||
set_tab_visible(webview, visible, parked, was_visible);
|
set_tab_visible(webview, visible, parked, was_visible);
|
||||||
} else {
|
} else {
|
||||||
set_memory_target(webview, visible, parked);
|
set_memory_target(webview, visible, parked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// macOS: whether a child webview's real frame is off the rectangle last asked for (more than 1.5 px).
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
fn native_frame_differs<R: Runtime>(webview: &Webview<R>, rect: crate::layout::Rect) -> bool {
|
|
||||||
let Ok(actual) = webview.bounds() else { return false };
|
|
||||||
let (position, size) = (actual.position.to_logical::<f64>(1.0), actual.size.to_logical::<f64>(1.0));
|
|
||||||
let (x, y, width, height) = rect;
|
|
||||||
let off = (position.x - x).abs() > 1.5 || (position.y - y).abs() > 1.5 || (size.width - width).abs() > 1.5 || (size.height - height).abs() > 1.5;
|
|
||||||
if off {
|
|
||||||
crate::diag::log("host", &format!("pane {} drifted to {},{} {}x{}, placing it again", webview.label(), position.x, position.y, size.width, size.height));
|
|
||||||
}
|
|
||||||
off
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A tab webview was closed: a new one with the same label is placed from scratch.
|
/// A tab webview was closed: a new one with the same label is placed from scratch.
|
||||||
pub fn forget_tab<R: Runtime>(app: &AppHandle<R>, label: &str) {
|
pub fn forget_tab<R: Runtime>(app: &AppHandle<R>, label: &str) {
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
|
|
|
||||||
|
|
@ -63,10 +63,8 @@ pub mod hotfix;
|
||||||
pub mod i18n;
|
pub mod i18n;
|
||||||
pub mod layout;
|
pub mod layout;
|
||||||
pub mod media;
|
pub mod media;
|
||||||
pub mod menu;
|
|
||||||
pub mod modes;
|
pub mod modes;
|
||||||
pub mod plugins;
|
pub mod plugins;
|
||||||
pub mod popover;
|
|
||||||
pub mod policy;
|
pub mod policy;
|
||||||
pub mod profiles;
|
pub mod profiles;
|
||||||
pub mod safe;
|
pub mod safe;
|
||||||
|
|
@ -78,8 +76,6 @@ pub mod tabs;
|
||||||
pub mod testkit;
|
pub mod testkit;
|
||||||
pub mod theme;
|
pub mod theme;
|
||||||
pub mod update;
|
pub mod update;
|
||||||
#[cfg(feature = "vault")]
|
|
||||||
pub mod vault;
|
|
||||||
pub mod window_fit;
|
pub mod window_fit;
|
||||||
pub mod workspaces;
|
pub mod workspaces;
|
||||||
pub mod zoom;
|
pub mod zoom;
|
||||||
|
|
@ -95,14 +91,6 @@ mod sync_commands;
|
||||||
#[cfg(feature = "app")]
|
#[cfg(feature = "app")]
|
||||||
mod dev_commands;
|
mod dev_commands;
|
||||||
#[cfg(feature = "app")]
|
#[cfg(feature = "app")]
|
||||||
pub mod theme_commands;
|
|
||||||
#[cfg(feature = "app")]
|
|
||||||
pub mod tab_commands;
|
|
||||||
#[cfg(feature = "app")]
|
|
||||||
pub mod alerts_commands;
|
|
||||||
#[cfg(all(feature = "app", feature = "vault"))]
|
|
||||||
pub mod vault_commands;
|
|
||||||
#[cfg(feature = "app")]
|
|
||||||
mod backup_commands;
|
mod backup_commands;
|
||||||
#[cfg(all(feature = "app", feature = "net"))]
|
#[cfg(all(feature = "app", feature = "net"))]
|
||||||
mod fonts_commands;
|
mod fonts_commands;
|
||||||
|
|
@ -112,8 +100,6 @@ mod update_commands;
|
||||||
pub mod devloop;
|
pub mod devloop;
|
||||||
#[cfg(feature = "tauri")]
|
#[cfg(feature = "tauri")]
|
||||||
pub mod host;
|
pub mod host;
|
||||||
#[cfg(feature = "tauri")]
|
|
||||||
pub mod popover_host;
|
|
||||||
#[cfg(all(feature = "tauri", feature = "net"))]
|
#[cfg(all(feature = "tauri", feature = "net"))]
|
||||||
pub mod updater;
|
pub mod updater;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,255 +0,0 @@
|
||||||
//! The native menu bar (macOS): the shell describes the whole bar (`menu_set`, shell-only) and
|
|
||||||
//! native code builds it; choosing an item sends its id back to the shell (`native-menu` event),
|
|
||||||
//! which runs the same actions the in-app menu does. Nothing here performs an action itself, and
|
|
||||||
//! tabs gain no command: the bar is the shell's alone.
|
|
||||||
//!
|
|
||||||
//! The description is data and is validated before anything is built: bounded depth and size,
|
|
||||||
//! one-line labels, ids of a fixed alphabet, accelerators of a fixed alphabet, and system items
|
|
||||||
//! (Services, Hide, Quit, Edit's Cut/Copy/Paste, Window's Minimize/Zoom) only by name from a fixed
|
|
||||||
//! list. Other platforms keep the in-app menu: `menu_set` does nothing there.
|
|
||||||
|
|
||||||
use serde::Deserialize;
|
|
||||||
|
|
||||||
/// The shell event carrying the id of the chosen item.
|
|
||||||
pub const EVENT_NATIVE_MENU: &str = "native-menu";
|
|
||||||
|
|
||||||
const MAX_NODES: usize = 400;
|
|
||||||
const MAX_DEPTH: usize = 4;
|
|
||||||
const MAX_LABEL: usize = 120;
|
|
||||||
const MAX_ID: usize = 96;
|
|
||||||
const MAX_ACCELERATOR: usize = 32;
|
|
||||||
|
|
||||||
/// System items the shell may ask for by name.
|
|
||||||
pub const ROLES: &[&str] = &[
|
|
||||||
"services", "hide", "hide_others", "show_all", "quit", "undo", "redo", "cut", "copy", "paste", "select_all", "minimize", "maximize", "fullscreen",
|
|
||||||
];
|
|
||||||
|
|
||||||
/// A submenu the system treats specially (macOS lists the open windows in the Window menu, adds the
|
|
||||||
/// search field to Help).
|
|
||||||
pub const SUBMENU_ROLES: &[&str] = &["window", "help"];
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
|
|
||||||
#[serde(tag = "kind", rename_all = "camelCase", deny_unknown_fields)]
|
|
||||||
pub enum Node {
|
|
||||||
/// An item the shell handles: its id comes back when it is chosen. `checked` makes it a check item.
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
Item { id: String, label: String, #[serde(default)] accelerator: Option<String>, #[serde(default)] checked: Option<bool>, #[serde(default = "yes")] enabled: bool },
|
|
||||||
Separator,
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
Submenu { label: String, items: Vec<Node>, #[serde(default = "yes")] enabled: bool, #[serde(default)] role: Option<String> },
|
|
||||||
/// A system item by name ([`ROLES`]); `label` overrides its title.
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
Predefined { role: String, #[serde(default)] label: Option<String> },
|
|
||||||
}
|
|
||||||
|
|
||||||
fn yes() -> bool {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The whole bar: top-level submenus only.
|
|
||||||
#[derive(Clone, Debug, Deserialize, PartialEq, Eq)]
|
|
||||||
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
|
||||||
pub struct MenuSpec {
|
|
||||||
pub menus: Vec<Node>,
|
|
||||||
}
|
|
||||||
|
|
||||||
fn valid_label(text: &str) -> bool {
|
|
||||||
let count = text.chars().count();
|
|
||||||
count > 0 && count <= MAX_LABEL && !text.chars().any(char::is_control)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Ids are ASCII words (`theme:midnight`, `plugin.chat`, `file/new-tab`).
|
|
||||||
pub fn valid_id(id: &str) -> bool {
|
|
||||||
!id.is_empty() && id.len() <= MAX_ID && id.chars().all(|c| c.is_ascii_alphanumeric() || matches!(c, '_' | '.' | ':' | '-' | '/'))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Accelerators like `CmdOrCtrl+Shift+G`: words, `+` and one key (a letter, digit or punctuation mark).
|
|
||||||
fn valid_accelerator(text: &str) -> bool {
|
|
||||||
!text.is_empty() && text.len() <= MAX_ACCELERATOR && text.chars().all(|c| c.is_ascii_alphanumeric() || matches!(c, '+' | '\\' | '[' | ']' | ',' | '.' | ';' | '\'' | '=' | '-' | '`' | '/'))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Validates a description before anything is built.
|
|
||||||
pub fn validate(spec: &MenuSpec) -> Result<(), String> {
|
|
||||||
fn walk(nodes: &[Node], depth: usize, count: &mut usize) -> Result<(), String> {
|
|
||||||
if depth > MAX_DEPTH {
|
|
||||||
return Err("VALIDATION: menu too deep".into());
|
|
||||||
}
|
|
||||||
for node in nodes {
|
|
||||||
*count += 1;
|
|
||||||
if *count > MAX_NODES {
|
|
||||||
return Err("VALIDATION: menu too large".into());
|
|
||||||
}
|
|
||||||
match node {
|
|
||||||
Node::Item { id, label, accelerator, .. } => {
|
|
||||||
if !valid_id(id) || !valid_label(label) || accelerator.as_deref().is_some_and(|text| !valid_accelerator(text)) {
|
|
||||||
return Err("VALIDATION: invalid menu item".into());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Node::Separator => {}
|
|
||||||
Node::Submenu { label, items, role, .. } => {
|
|
||||||
if !valid_label(label) || role.as_deref().is_some_and(|role| !SUBMENU_ROLES.contains(&role)) {
|
|
||||||
return Err("VALIDATION: invalid submenu".into());
|
|
||||||
}
|
|
||||||
walk(items, depth + 1, count)?;
|
|
||||||
}
|
|
||||||
Node::Predefined { role, label } => {
|
|
||||||
if !ROLES.contains(&role.as_str()) || label.as_deref().is_some_and(|text| !valid_label(text)) {
|
|
||||||
return Err("VALIDATION: invalid system item".into());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
if spec.menus.is_empty() || spec.menus.iter().any(|node| !matches!(node, Node::Submenu { .. })) {
|
|
||||||
return Err("VALIDATION: the bar is a list of menus".into());
|
|
||||||
}
|
|
||||||
walk(&spec.menus, 0, &mut 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Parses and validates the shell's JSON description.
|
|
||||||
pub fn parse(value: serde_json::Value) -> Result<MenuSpec, String> {
|
|
||||||
let spec: MenuSpec = serde_json::from_value(value).map_err(|_| "VALIDATION: invalid menu".to_string())?;
|
|
||||||
validate(&spec)?;
|
|
||||||
Ok(spec)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(all(feature = "tauri", target_os = "macos"))]
|
|
||||||
pub use build::set;
|
|
||||||
|
|
||||||
#[cfg(all(feature = "tauri", target_os = "macos"))]
|
|
||||||
mod build {
|
|
||||||
use super::{valid_id, Node};
|
|
||||||
use tauri::menu::{CheckMenuItem, IsMenuItem, Menu, MenuItem, PredefinedMenuItem, Submenu};
|
|
||||||
use tauri::{AppHandle, Runtime};
|
|
||||||
|
|
||||||
fn append<R: Runtime>(app: &AppHandle<R>, menu: &Submenu<R>, nodes: &[Node]) -> tauri::Result<()> {
|
|
||||||
for node in nodes {
|
|
||||||
let item: Box<dyn IsMenuItem<R>> = match node {
|
|
||||||
Node::Item { id, label, accelerator, checked, enabled } => {
|
|
||||||
// An accelerator the platform cannot parse leaves the item without a key, not without an item.
|
|
||||||
let key = accelerator.as_deref();
|
|
||||||
match checked {
|
|
||||||
Some(state) => Box::new(CheckMenuItem::with_id(app, id.as_str(), label, *enabled, *state, key).or_else(|_| CheckMenuItem::with_id(app, id.as_str(), label, *enabled, *state, None::<&str>))?),
|
|
||||||
None => Box::new(MenuItem::with_id(app, id.as_str(), label, *enabled, key).or_else(|_| MenuItem::with_id(app, id.as_str(), label, *enabled, None::<&str>))?),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Node::Separator => Box::new(PredefinedMenuItem::separator(app)?),
|
|
||||||
Node::Submenu { label, items, enabled, role } => {
|
|
||||||
let sub = Submenu::new(app, label, *enabled)?;
|
|
||||||
append(app, &sub, items)?;
|
|
||||||
match role.as_deref() {
|
|
||||||
Some("window") => sub.set_as_windows_menu_for_nsapp()?,
|
|
||||||
Some("help") => sub.set_as_help_menu_for_nsapp()?,
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
Box::new(sub)
|
|
||||||
}
|
|
||||||
Node::Predefined { role, label } => {
|
|
||||||
let text = label.as_deref();
|
|
||||||
Box::new(match role.as_str() {
|
|
||||||
"services" => PredefinedMenuItem::services(app, text)?,
|
|
||||||
"hide" => PredefinedMenuItem::hide(app, text)?,
|
|
||||||
"hide_others" => PredefinedMenuItem::hide_others(app, text)?,
|
|
||||||
"show_all" => PredefinedMenuItem::show_all(app, text)?,
|
|
||||||
"quit" => PredefinedMenuItem::quit(app, text)?,
|
|
||||||
"undo" => PredefinedMenuItem::undo(app, text)?,
|
|
||||||
"redo" => PredefinedMenuItem::redo(app, text)?,
|
|
||||||
"cut" => PredefinedMenuItem::cut(app, text)?,
|
|
||||||
"copy" => PredefinedMenuItem::copy(app, text)?,
|
|
||||||
"paste" => PredefinedMenuItem::paste(app, text)?,
|
|
||||||
"select_all" => PredefinedMenuItem::select_all(app, text)?,
|
|
||||||
"minimize" => PredefinedMenuItem::minimize(app, text)?,
|
|
||||||
"maximize" => PredefinedMenuItem::maximize(app, text)?,
|
|
||||||
_ => PredefinedMenuItem::fullscreen(app, text)?,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
};
|
|
||||||
menu.append(item.as_ref())?;
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Builds the bar and makes it the application's menu (on the main thread).
|
|
||||||
pub fn set<R: Runtime>(app: &AppHandle<R>, spec: &super::MenuSpec) -> Result<(), String> {
|
|
||||||
let spec = spec.clone();
|
|
||||||
let handle = app.clone();
|
|
||||||
app.run_on_main_thread(move || {
|
|
||||||
let build = || -> tauri::Result<Menu<R>> {
|
|
||||||
let menu = Menu::new(&handle)?;
|
|
||||||
for node in &spec.menus {
|
|
||||||
if let Node::Submenu { label, items, enabled, role } = node {
|
|
||||||
let top = Submenu::new(&handle, label, *enabled)?;
|
|
||||||
append(&handle, &top, items)?;
|
|
||||||
match role.as_deref() {
|
|
||||||
Some("window") => top.set_as_windows_menu_for_nsapp()?,
|
|
||||||
Some("help") => top.set_as_help_menu_for_nsapp()?,
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
menu.append(&top)?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(menu)
|
|
||||||
};
|
|
||||||
if let Ok(menu) = build() {
|
|
||||||
let _ = handle.set_menu(menu);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.map_err(|error| format!("MENU: {error}"))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The id of a chosen item when it is one the shell described.
|
|
||||||
pub fn chosen(id: &str) -> Option<&str> {
|
|
||||||
valid_id(id).then_some(id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(all(feature = "tauri", target_os = "macos"))]
|
|
||||||
pub use build::chosen;
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
use serde_json::json;
|
|
||||||
|
|
||||||
fn bar(items: serde_json::Value) -> serde_json::Value {
|
|
||||||
json!({ "menus": [{ "kind": "submenu", "label": "File", "items": items }] })
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn a_bar_of_items_submenus_and_system_items_is_accepted() {
|
|
||||||
let value = json!({ "menus": [
|
|
||||||
{ "kind": "submenu", "label": "App", "items": [
|
|
||||||
{ "kind": "item", "id": "settings", "label": "Settings…", "accelerator": "CmdOrCtrl+," },
|
|
||||||
{ "kind": "separator" },
|
|
||||||
{ "kind": "predefined", "role": "services" },
|
|
||||||
{ "kind": "predefined", "role": "quit" } ] },
|
|
||||||
{ "kind": "submenu", "label": "View", "items": [
|
|
||||||
{ "kind": "submenu", "label": "Theme", "items": [ { "kind": "item", "id": "theme:midnight", "label": "Midnight", "checked": true } ] } ] },
|
|
||||||
{ "kind": "submenu", "label": "Window", "role": "window", "items": [ { "kind": "predefined", "role": "minimize" } ] },
|
|
||||||
] });
|
|
||||||
let spec = parse(value).unwrap();
|
|
||||||
assert_eq!(spec.menus.len(), 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn the_description_is_bounded_and_made_of_known_things() {
|
|
||||||
assert!(parse(json!({ "menus": [] })).is_err(), "an empty bar");
|
|
||||||
assert!(parse(json!({ "menus": [{ "kind": "item", "id": "a", "label": "A" }] })).is_err(), "the bar holds menus only");
|
|
||||||
assert!(parse(bar(json!([{ "kind": "item", "id": "bad id", "label": "A" }]))).is_err(), "ids are words");
|
|
||||||
assert!(parse(bar(json!([{ "kind": "item", "id": "a", "label": "two\nlines" }]))).is_err(), "labels are one line");
|
|
||||||
assert!(parse(bar(json!([{ "kind": "item", "id": "a", "label": "" }]))).is_err());
|
|
||||||
assert!(parse(bar(json!([{ "kind": "item", "id": "a", "label": "A", "accelerator": "Cmd+<script>" }]))).is_err());
|
|
||||||
assert!(parse(bar(json!([{ "kind": "predefined", "role": "close_window" }]))).is_err(), "system items by name from the list only");
|
|
||||||
assert!(parse(bar(json!([{ "kind": "item", "id": "a", "label": "A", "extra": 1 }]))).is_err(), "no unknown fields");
|
|
||||||
assert!(parse(json!({ "menus": [{ "kind": "submenu", "label": "W", "role": "dock", "items": [] }] })).is_err());
|
|
||||||
let too_many: Vec<_> = (0..MAX_NODES + 1).map(|n| json!({ "kind": "item", "id": format!("i{n}"), "label": "x" })).collect();
|
|
||||||
assert!(parse(bar(json!(too_many))).is_err(), "size");
|
|
||||||
let mut deep = json!([{ "kind": "item", "id": "a", "label": "A" }]);
|
|
||||||
for _ in 0..MAX_DEPTH + 1 {
|
|
||||||
deep = json!([{ "kind": "submenu", "label": "S", "items": deep }]);
|
|
||||||
}
|
|
||||||
assert!(parse(bar(deep)).is_err(), "depth");
|
|
||||||
assert!(parse(bar(json!([{ "kind": "item", "id": "a".repeat(MAX_ID + 1), "label": "A" }]))).is_err());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,213 +0,0 @@
|
||||||
//! Popover geometry: where a small trusted local webview (a card with a caret) goes when it is
|
|
||||||
//! layered over a site tab right under a button of the site's page, so the site stays visible. The
|
|
||||||
//! page reports only the button rectangle (in its own viewport); native code adds the tab
|
|
||||||
//! webview's position and keeps the card inside that tab. Pure and headless-tested.
|
|
||||||
|
|
||||||
use serde::Serialize;
|
|
||||||
|
|
||||||
/// Labels of the popover webview are `popover-<n>` (a fresh label whenever it is recreated, so a
|
|
||||||
/// closing webview never collides with the new one).
|
|
||||||
pub const LABEL_PREFIX: &str = "popover-";
|
|
||||||
|
|
||||||
/// Card size in logical px. The card shrinks to the room left in the tab, never below the minimum.
|
|
||||||
pub const CARD_WIDTH: f64 = 408.0;
|
|
||||||
pub const CARD_MAX_HEIGHT: f64 = 472.0;
|
|
||||||
pub const CARD_MIN_WIDTH: f64 = 260.0;
|
|
||||||
pub const CARD_MIN_HEIGHT: f64 = 200.0;
|
|
||||||
/// Prefer flipping above the button when less than this is left below it.
|
|
||||||
pub const FLIP_BELOW: f64 = 300.0;
|
|
||||||
/// Space between the button and the card (the caret lives here).
|
|
||||||
pub const GAP: f64 = 8.0;
|
|
||||||
/// Minimum distance from the tab's edges.
|
|
||||||
pub const EDGE: f64 = 8.0;
|
|
||||||
/// Transparent margin around the card for its shadow (not on the button side).
|
|
||||||
pub const SHADOW: f64 = 22.0;
|
|
||||||
/// The caret never gets closer than this to the card's corners.
|
|
||||||
const CARET_INSET: f64 = 20.0;
|
|
||||||
|
|
||||||
pub fn valid_label(label: &str) -> bool {
|
|
||||||
label
|
|
||||||
.strip_prefix(LABEL_PREFIX)
|
|
||||||
.is_some_and(|n| !n.is_empty() && n.len() <= 12 && n.bytes().all(|b| b.is_ascii_digit()))
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Serialize)]
|
|
||||||
pub struct Rect {
|
|
||||||
pub x: f64,
|
|
||||||
pub y: f64,
|
|
||||||
pub width: f64,
|
|
||||||
pub height: f64,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Rect {
|
|
||||||
pub const fn new(x: f64, y: f64, width: f64, height: f64) -> Self {
|
|
||||||
Self { x, y, width, height }
|
|
||||||
}
|
|
||||||
fn finite(&self) -> bool {
|
|
||||||
[self.x, self.y, self.width, self.height].iter().all(|v| v.is_finite())
|
|
||||||
}
|
|
||||||
fn right(&self) -> f64 {
|
|
||||||
self.x + self.width
|
|
||||||
}
|
|
||||||
fn bottom(&self) -> f64 {
|
|
||||||
self.y + self.height
|
|
||||||
}
|
|
||||||
/// Same rectangle within half a px (layout reports round differently on each side).
|
|
||||||
pub fn near(&self, other: &Rect) -> bool {
|
|
||||||
(self.x - other.x).abs() < 0.5
|
|
||||||
&& (self.y - other.y).abs() < 0.5
|
|
||||||
&& (self.width - other.width).abs() < 0.5
|
|
||||||
&& (self.height - other.height).abs() < 0.5
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Where the popover goes. `webview` is in window coordinates (logical px); `card` is relative to
|
|
||||||
/// the webview; `caret_x` is relative to the card.
|
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Serialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Placement {
|
|
||||||
pub webview: Rect,
|
|
||||||
pub card: Rect,
|
|
||||||
pub above: bool,
|
|
||||||
pub caret_x: f64,
|
|
||||||
}
|
|
||||||
|
|
||||||
fn clamp(value: f64, min: f64, max: f64) -> f64 {
|
|
||||||
value.max(min).min(max.max(min))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Places the card under `anchor` (the button, in the tab's viewport), flipping above it when the
|
|
||||||
/// room below is short, always inside `tab` (the tab webview, in window coordinates). `None` when
|
|
||||||
/// the input is not finite or the tab is too small to hold a usable card.
|
|
||||||
pub fn place(anchor: Rect, tab: Rect) -> Option<Placement> {
|
|
||||||
if !anchor.finite() || !tab.finite() || tab.width <= 0.0 || tab.height <= 0.0 {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
// The page's numbers are only a hint: keep the anchor inside its own viewport.
|
|
||||||
let ax = tab.x + clamp(anchor.x, 0.0, tab.width);
|
|
||||||
let ay = tab.y + clamp(anchor.y, 0.0, tab.height);
|
|
||||||
let aw = clamp(anchor.width, 0.0, (tab.right() - ax).min(400.0));
|
|
||||||
let ah = clamp(anchor.height, 0.0, (tab.bottom() - ay).min(200.0));
|
|
||||||
|
|
||||||
let width = CARD_WIDTH.min(tab.width - 2.0 * EDGE);
|
|
||||||
if width < CARD_MIN_WIDTH {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
// Left edge a little left of the button so the caret sits near the card's corner.
|
|
||||||
let left = clamp(ax + aw / 2.0 - 34.0, tab.x + EDGE, tab.right() - EDGE - width);
|
|
||||||
|
|
||||||
let below = tab.bottom() - EDGE - (ay + ah + GAP);
|
|
||||||
let above_room = ay - GAP - (tab.y + EDGE);
|
|
||||||
let above = below < FLIP_BELOW.min(CARD_MAX_HEIGHT) && above_room > below;
|
|
||||||
let room = if above { above_room } else { below };
|
|
||||||
if room < CARD_MIN_HEIGHT.min(tab.height - 2.0 * EDGE).max(120.0) {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
let height = CARD_MAX_HEIGHT.min(room);
|
|
||||||
let top = if above { ay - GAP - height } else { ay + ah + GAP };
|
|
||||||
let card = Rect::new(left, top, width, height);
|
|
||||||
|
|
||||||
// Shadow margin on every side except toward the button, clipped to the tab so the popover
|
|
||||||
// never covers the shell's address bar or another pane.
|
|
||||||
let (pad_top, pad_bottom) = if above { (SHADOW, GAP) } else { (GAP, SHADOW) };
|
|
||||||
let wx = (card.x - SHADOW).max(tab.x);
|
|
||||||
let wy = (card.y - pad_top).max(tab.y);
|
|
||||||
let wr = (card.right() + SHADOW).min(tab.right());
|
|
||||||
let wb = (card.bottom() + pad_bottom).min(tab.bottom());
|
|
||||||
let webview = Rect::new(wx, wy, wr - wx, wb - wy);
|
|
||||||
|
|
||||||
let caret_x = clamp(ax + aw / 2.0 - card.x, CARET_INSET, width - CARET_INSET);
|
|
||||||
Some(Placement {
|
|
||||||
webview,
|
|
||||||
card: Rect::new(card.x - wx, card.y - wy, width, height),
|
|
||||||
above,
|
|
||||||
caret_x,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
const TAB: Rect = Rect::new(100.0, 92.0, 800.0, 700.0);
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn labels() {
|
|
||||||
assert!(valid_label("popover-1"));
|
|
||||||
assert!(valid_label("popover-42"));
|
|
||||||
assert!(!valid_label("popover-"));
|
|
||||||
assert!(!valid_label("popover-x"));
|
|
||||||
assert!(!valid_label("tab-1"));
|
|
||||||
assert!(!valid_label("shell"));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn opens_below_the_button_in_window_coordinates() {
|
|
||||||
let p = place(Rect::new(200.0, 150.0, 34.0, 34.0), TAB).unwrap();
|
|
||||||
assert!(!p.above);
|
|
||||||
// Card: left = 100 + 200 + 17 - 34 = 283; top = 92 + 150 + 34 + 8 = 284.
|
|
||||||
let card_x = p.webview.x + p.card.x;
|
|
||||||
let card_y = p.webview.y + p.card.y;
|
|
||||||
assert_eq!((card_x, card_y), (283.0, 284.0));
|
|
||||||
assert_eq!(p.card.width, CARD_WIDTH);
|
|
||||||
assert_eq!(p.card.height, CARD_MAX_HEIGHT);
|
|
||||||
// Only a GAP-high strip above the card (no shadow margin over the button).
|
|
||||||
assert_eq!(p.card.y, GAP);
|
|
||||||
assert_eq!(p.card.x, SHADOW);
|
|
||||||
// The caret points at the button's center.
|
|
||||||
assert_eq!(card_x + p.caret_x, 100.0 + 200.0 + 17.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn flips_above_near_the_bottom() {
|
|
||||||
let p = place(Rect::new(200.0, 600.0, 34.0, 34.0), TAB).unwrap();
|
|
||||||
assert!(p.above);
|
|
||||||
let card_bottom = p.webview.y + p.card.y + p.card.height;
|
|
||||||
assert_eq!(card_bottom, 92.0 + 600.0 - GAP);
|
|
||||||
assert_eq!(p.webview.y + p.webview.height, card_bottom + GAP);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn stays_inside_the_tab() {
|
|
||||||
for anchor in [
|
|
||||||
Rect::new(790.0, 10.0, 34.0, 34.0),
|
|
||||||
Rect::new(-50.0, -50.0, 34.0, 34.0),
|
|
||||||
Rect::new(5_000.0, 5_000.0, 34.0, 34.0),
|
|
||||||
Rect::new(400.0, 330.0, 34.0, 34.0),
|
|
||||||
] {
|
|
||||||
let p = place(anchor, TAB).unwrap();
|
|
||||||
let w = p.webview;
|
|
||||||
assert!(w.x >= TAB.x && w.y >= TAB.y && w.right() <= TAB.right() && w.bottom() <= TAB.bottom(), "{anchor:?} -> {w:?}");
|
|
||||||
let (cx, cy) = (w.x + p.card.x, w.y + p.card.y);
|
|
||||||
assert!(cx >= TAB.x + EDGE && cx + p.card.width <= TAB.right() - EDGE, "{anchor:?}");
|
|
||||||
assert!(cy >= TAB.y + EDGE && cy + p.card.height <= TAB.bottom() - EDGE, "{anchor:?}");
|
|
||||||
assert!(p.caret_x >= CARET_INSET && p.caret_x <= p.card.width - CARET_INSET);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn right_edge_keeps_the_caret_on_the_button() {
|
|
||||||
let p = place(Rect::new(740.0, 100.0, 34.0, 34.0), TAB).unwrap();
|
|
||||||
let card_x = p.webview.x + p.card.x;
|
|
||||||
assert_eq!(card_x + p.card.width, TAB.right() - EDGE);
|
|
||||||
assert_eq!(card_x + p.caret_x, 100.0 + 740.0 + 17.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn narrow_panes_shrink_the_card() {
|
|
||||||
let tab = Rect::new(0.0, 44.0, 300.0, 700.0);
|
|
||||||
let p = place(Rect::new(10.0, 100.0, 34.0, 34.0), tab).unwrap();
|
|
||||||
assert_eq!(p.card.width, 300.0 - 2.0 * EDGE);
|
|
||||||
let short = Rect::new(0.0, 44.0, 800.0, 400.0);
|
|
||||||
let p = place(Rect::new(10.0, 60.0, 34.0, 34.0), short).unwrap();
|
|
||||||
assert!(p.card.height < CARD_MAX_HEIGHT && p.card.height >= 120.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn rejects_unusable_input() {
|
|
||||||
assert!(place(Rect::new(f64::NAN, 0.0, 1.0, 1.0), TAB).is_none());
|
|
||||||
assert!(place(Rect::new(0.0, 0.0, 1.0, 1.0), Rect::new(0.0, 0.0, f64::INFINITY, 10.0)).is_none());
|
|
||||||
assert!(place(Rect::new(0.0, 0.0, 1.0, 1.0), Rect::new(0.0, 0.0, 200.0, 700.0)).is_none());
|
|
||||||
assert!(place(Rect::new(0.0, 60.0, 1.0, 1.0), Rect::new(0.0, 0.0, 800.0, 140.0)).is_none());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,293 +0,0 @@
|
||||||
//! The popover host: one small trusted local webview (`popover-<n>`, the app's own page) layered
|
|
||||||
//! over a site tab right under a button of the site's page ([`crate::popover`] places it), so the
|
|
||||||
//! site stays visible and interactive around it. The app decides what the card shows and which
|
|
||||||
//! commands it may call; this module only owns the webview and the session.
|
|
||||||
//!
|
|
||||||
//! A session has the opening's number (`seq`, so a stale click from an earlier opening fails), the
|
|
||||||
//! tab that opened it (`from`), the placement and the app's own `meta` (flattened into the session
|
|
||||||
//! JSON the popover page reads, e.g. `kind`, `contextUrl`).
|
|
||||||
//!
|
|
||||||
//! Z-order: a new child webview is placed on top of its siblings (wry: HWND_TOP on Windows,
|
|
||||||
//! addSubview on macOS). A tab webview created after the popover would cover it, so the popover is
|
|
||||||
//! recreated whenever a tab webview was created since it was ([`tab_created`]).
|
|
||||||
//!
|
|
||||||
//! Closing: the popover closes when the source tab's layout changes ([`layout_changed`]), when the
|
|
||||||
//! app says the tab moved on ([`tab_navigated`]), when the shell is raised over the tabs
|
|
||||||
//! ([`shell_raised`]) or by the app's own commands ([`close`]). A click that lands right after a
|
|
||||||
//! close is the same click that blurred it: it toggles closed instead of reopening.
|
|
||||||
|
|
||||||
use crate::host::tab_webview;
|
|
||||||
use crate::policy;
|
|
||||||
use crate::popover::{self, Placement, Rect};
|
|
||||||
use serde::Serialize;
|
|
||||||
use std::sync::atomic::{AtomicU64, Ordering};
|
|
||||||
use std::sync::{Mutex, MutexGuard, OnceLock};
|
|
||||||
use std::time::{Duration, Instant};
|
|
||||||
use tauri::webview::NewWindowResponse;
|
|
||||||
use tauri::{AppHandle, LogicalPosition, LogicalSize, Manager, Webview, WebviewBuilder, WebviewUrl};
|
|
||||||
|
|
||||||
/// What the app declares about its popover.
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
|
||||||
pub struct PopoverConfig {
|
|
||||||
/// The app page the popover loads (`index.html?popover=drafts`).
|
|
||||||
pub url: &'static str,
|
|
||||||
/// The window event a reused popover page listens to, re-reading its session (detail: `seq`).
|
|
||||||
pub open_event: &'static str,
|
|
||||||
/// macOS has no transparent webview without the private API: the margin shows this ground.
|
|
||||||
pub ground: (u8, u8, u8),
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Bumped whenever a tab webview is created (see the z-order note above).
|
|
||||||
static TAB_GENERATION: AtomicU64 = AtomicU64::new(0);
|
|
||||||
/// A click that lands right after the popover closed on blur is the same click that blurred it.
|
|
||||||
const TOGGLE_WINDOW: Duration = Duration::from_millis(350);
|
|
||||||
|
|
||||||
pub fn tab_created() {
|
|
||||||
TAB_GENERATION.fetch_add(1, Ordering::SeqCst);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// What the popover shows.
|
|
||||||
#[derive(Clone, Serialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct Session {
|
|
||||||
pub seq: u64,
|
|
||||||
pub from: String,
|
|
||||||
/// The app's own fields, flattened into this object.
|
|
||||||
#[serde(flatten)]
|
|
||||||
pub meta: serde_json::Map<String, serde_json::Value>,
|
|
||||||
pub placement: Placement,
|
|
||||||
#[serde(skip)]
|
|
||||||
tab_rect: Rect,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default)]
|
|
||||||
struct Popover {
|
|
||||||
label: Option<String>,
|
|
||||||
created_generation: u64,
|
|
||||||
next_label: u64,
|
|
||||||
seq: u64,
|
|
||||||
open: Option<Session>,
|
|
||||||
last_closed: Option<(String, Instant)>,
|
|
||||||
}
|
|
||||||
|
|
||||||
fn state() -> MutexGuard<'static, Popover> {
|
|
||||||
static STATE: OnceLock<Mutex<Popover>> = OnceLock::new();
|
|
||||||
STATE.get_or_init(Default::default).lock().unwrap_or_else(|poisoned| poisoned.into_inner())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Only the popover webview, on the app's own local origin.
|
|
||||||
pub fn popover_only(webview: &Webview) -> Result<(), String> {
|
|
||||||
let url = webview.url().map_err(|_| "FORBIDDEN: cannot verify popover origin")?;
|
|
||||||
if popover::valid_label(webview.label()) && policy::local_navigation_allowed(&url, cfg!(debug_assertions)) {
|
|
||||||
Ok(())
|
|
||||||
} else {
|
|
||||||
Err("FORBIDDEN: popover required".into())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The open session, if `seq` names it and the caller is the current popover webview.
|
|
||||||
pub fn current(webview: &Webview, seq: u64) -> Result<Session, String> {
|
|
||||||
popover_only(webview)?;
|
|
||||||
let data = state();
|
|
||||||
if data.label.as_deref() != Some(webview.label()) {
|
|
||||||
return Err("FORBIDDEN: stale popover".into());
|
|
||||||
}
|
|
||||||
match &data.open {
|
|
||||||
Some(session) if session.seq == seq => Ok(session.clone()),
|
|
||||||
_ => Err("CLOSED: the popover is not open".into()),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The session of the popover `webview` (None when it is not the current popover or is closed).
|
|
||||||
pub fn session_of(webview: &Webview) -> Result<Option<Session>, String> {
|
|
||||||
popover_only(webview)?;
|
|
||||||
let data = state();
|
|
||||||
if data.label.as_deref() != Some(webview.label()) {
|
|
||||||
return Ok(None);
|
|
||||||
}
|
|
||||||
Ok(data.open.clone())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Whether tab `id` opened the popover that is open now.
|
|
||||||
pub fn opened_by(id: &str) -> bool {
|
|
||||||
state().open.as_ref().is_some_and(|session| session.from == id)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn logical_rect(tab: &Webview) -> Result<Rect, String> {
|
|
||||||
// GTK child webviews report no position of their own; the host knows where it put them.
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
if let Some((x, y, width, height)) = crate::host::placed_rect(tab) {
|
|
||||||
return Ok(Rect::new(x, y, width, height));
|
|
||||||
}
|
|
||||||
let scale = tab.window().scale_factor().map_err(|e| format!("POPOVER: {e}"))?;
|
|
||||||
let position = tab.position().map_err(|e| format!("POPOVER: {e}"))?.to_logical::<f64>(scale);
|
|
||||||
let size = tab.size().map_err(|e| format!("POPOVER: {e}"))?.to_logical::<f64>(scale);
|
|
||||||
Ok(Rect::new(position.x, position.y, size.width, size.height))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn builder(config: &PopoverConfig, label: &str) -> WebviewBuilder<tauri::Wry> {
|
|
||||||
let builder = WebviewBuilder::new(label, WebviewUrl::App(config.url.into()))
|
|
||||||
.disable_drag_drop_handler()
|
|
||||||
.focused(true)
|
|
||||||
.on_navigation(|url| policy::local_navigation_allowed(url, cfg!(debug_assertions)))
|
|
||||||
.on_new_window(|_, _| NewWindowResponse::Deny);
|
|
||||||
// The card draws its own rounded corners and shadow over the site. macOS would need the private
|
|
||||||
// API for transparency; there the margin shows the popover's ground instead.
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
|
||||||
let builder = {
|
|
||||||
let _ = config.ground;
|
|
||||||
builder.transparent(true)
|
|
||||||
};
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
let builder = builder.background_color(tauri::window::Color(config.ground.0, config.ground.1, config.ground.2, 255));
|
|
||||||
builder
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Opens (or moves) the popover for tab `from` under `anchor` (the button, in the tab's viewport).
|
|
||||||
/// An error means the caller should fall back to something else.
|
|
||||||
pub fn open(app: &AppHandle, config: &PopoverConfig, tab: &Webview, from: String, meta: serde_json::Map<String, serde_json::Value>, anchor: Rect) -> Result<(), String> {
|
|
||||||
let tab_rect = logical_rect(tab)?;
|
|
||||||
let placement = popover::place(anchor, tab_rect).ok_or("POPOVER: no room in this pane")?;
|
|
||||||
let window = tab.window();
|
|
||||||
let generation = TAB_GENERATION.load(Ordering::SeqCst);
|
|
||||||
|
|
||||||
let (label, fresh, session) = {
|
|
||||||
let mut data = state();
|
|
||||||
if let Some((closed_from, at)) = &data.last_closed {
|
|
||||||
if *closed_from == from && at.elapsed() < TOGGLE_WINDOW && data.open.is_none() {
|
|
||||||
data.last_closed = None;
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Recreate when a tab webview may now sit above it, or when it is gone.
|
|
||||||
let existing = data.label.clone().and_then(|label| app.get_webview(&label));
|
|
||||||
let reuse = existing.filter(|_| data.created_generation == generation);
|
|
||||||
if reuse.is_none() {
|
|
||||||
if let Some(old) = data.label.take().and_then(|label| app.get_webview(&label)) {
|
|
||||||
let _ = old.close();
|
|
||||||
}
|
|
||||||
data.next_label += 1;
|
|
||||||
data.label = Some(format!("{}{}", popover::LABEL_PREFIX, data.next_label));
|
|
||||||
data.created_generation = generation;
|
|
||||||
}
|
|
||||||
data.seq += 1;
|
|
||||||
let session = Session { seq: data.seq, from, meta, placement, tab_rect };
|
|
||||||
data.open = Some(session.clone());
|
|
||||||
(data.label.clone().unwrap_or_default(), reuse.is_none(), session)
|
|
||||||
};
|
|
||||||
|
|
||||||
let rect = placement.webview;
|
|
||||||
let popover = if fresh {
|
|
||||||
window
|
|
||||||
.add_child(builder(config, &label), LogicalPosition::new(rect.x, rect.y), LogicalSize::new(rect.width, rect.height))
|
|
||||||
.map_err(|error| {
|
|
||||||
let mut data = state();
|
|
||||||
data.label = None;
|
|
||||||
data.open = None;
|
|
||||||
format!("POPOVER: {error}")
|
|
||||||
})?
|
|
||||||
} else {
|
|
||||||
let popover = app.get_webview(&label).ok_or("POPOVER: missing webview")?;
|
|
||||||
crate::host::place_child(&popover, rect.x, rect.y, rect.width, rect.height);
|
|
||||||
// The page re-reads its session (placement, content) on this event.
|
|
||||||
let _ = popover.eval(&format!("window.dispatchEvent(new CustomEvent('{}',{{detail:{}}}))", config.open_event, session.seq));
|
|
||||||
popover
|
|
||||||
};
|
|
||||||
// Linux: out of the window box, over the tabs (see `host::place_child`).
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
if fresh {
|
|
||||||
crate::host::place_child(&popover, rect.x, rect.y, rect.width, rect.height);
|
|
||||||
}
|
|
||||||
let _ = popover.show();
|
|
||||||
let _ = popover.set_focus();
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Hides the popover. `refocus` gives keyboard focus back to the tab (Esc, after inserting).
|
|
||||||
pub fn close(app: &AppHandle, refocus: bool) -> Option<Session> {
|
|
||||||
let (session, label) = {
|
|
||||||
let mut data = state();
|
|
||||||
let session = data.open.take()?;
|
|
||||||
data.last_closed = Some((session.from.clone(), Instant::now()));
|
|
||||||
(session, data.label.clone())
|
|
||||||
};
|
|
||||||
if let Some(popover) = label.and_then(|label| app.get_webview(&label)) {
|
|
||||||
let _ = popover.hide();
|
|
||||||
}
|
|
||||||
if refocus {
|
|
||||||
if let Some(tab) = tab_webview(app, &session.from) {
|
|
||||||
let _ = tab.set_focus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some(session)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Whether the popover must close after a layout change: its source tab is gone, hidden or moved.
|
|
||||||
fn layout_stale(session: &Session, tabs: &[(String, Rect, bool)]) -> bool {
|
|
||||||
!tabs.iter().any(|(id, rect, visible)| {
|
|
||||||
*id == session.from
|
|
||||||
&& *visible
|
|
||||||
&& (rect.x - session.tab_rect.x).abs() < 2.0
|
|
||||||
&& (rect.y - session.tab_rect.y).abs() < 2.0
|
|
||||||
&& (rect.width - session.tab_rect.width).abs() < 2.0
|
|
||||||
&& (rect.height - session.tab_rect.height).abs() < 2.0
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Layout changed (tabs_sync): close unless the source tab is still visible at the same place.
|
|
||||||
pub fn layout_changed(app: &AppHandle, tabs: &[(String, Rect, bool)]) {
|
|
||||||
let stale = state().open.as_ref().is_some_and(|session| layout_stale(session, tabs));
|
|
||||||
if stale {
|
|
||||||
close(app, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Tab `id` navigated (SPA or full load): close if it opened the popover and `moved_on` says the
|
|
||||||
/// session's context is gone (the app compares its own `meta` with the new place).
|
|
||||||
pub fn tab_navigated(app: &AppHandle, id: &str, moved_on: impl Fn(&Session) -> bool) {
|
|
||||||
let navigated = state().open.as_ref().is_some_and(|session| session.from == id && moved_on(session));
|
|
||||||
if navigated {
|
|
||||||
close(app, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The shell is raised over the tabs for one of its own overlays: the popover would sit under it.
|
|
||||||
pub fn shell_raised(app: &AppHandle) {
|
|
||||||
close(app, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
fn session(from: &str, tab: Rect) -> Session {
|
|
||||||
let placement = popover::place(Rect::new(10.0, 10.0, 20.0, 20.0), tab).unwrap();
|
|
||||||
Session { seq: 1, from: from.into(), meta: Default::default(), placement, tab_rect: tab }
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn a_layout_change_keeps_the_popover_only_for_the_same_visible_tab_in_the_same_place() {
|
|
||||||
let tab = Rect::new(100.0, 90.0, 800.0, 700.0);
|
|
||||||
let s = session("a", tab);
|
|
||||||
assert!(!layout_stale(&s, &[("a".into(), Rect::new(101.0, 91.0, 799.0, 701.0), true)]));
|
|
||||||
assert!(layout_stale(&s, &[("a".into(), Rect::new(100.0, 90.0, 800.0, 700.0), false)]), "hidden");
|
|
||||||
assert!(layout_stale(&s, &[("a".into(), Rect::new(160.0, 90.0, 800.0, 700.0), true)]), "moved");
|
|
||||||
assert!(layout_stale(&s, &[("b".into(), tab, true)]), "another tab");
|
|
||||||
assert!(layout_stale(&s, &[]), "gone");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn the_session_json_carries_the_app_fields_beside_its_own() {
|
|
||||||
let tab = Rect::new(0.0, 0.0, 800.0, 700.0);
|
|
||||||
let mut s = session("a", tab);
|
|
||||||
s.meta.insert("kind".into(), "reply".into());
|
|
||||||
s.meta.insert("contextUrl".into(), "https://example.com/p".into());
|
|
||||||
let json = serde_json::to_value(&s).unwrap();
|
|
||||||
assert_eq!(json["seq"], 1);
|
|
||||||
assert_eq!(json["from"], "a");
|
|
||||||
assert_eq!(json["kind"], "reply");
|
|
||||||
assert_eq!(json["contextUrl"], "https://example.com/p");
|
|
||||||
assert!(json["placement"]["card"].is_object());
|
|
||||||
assert!(json.get("tabRect").is_none() && json.get("tab_rect").is_none());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -17,18 +17,9 @@ pub const DEFAULT_HOSTS: &[AllowedHost] = &[
|
||||||
AllowedHost { host: "cdn1.crt.fyi", raw_files_only: false },
|
AllowedHost { host: "cdn1.crt.fyi", raw_files_only: false },
|
||||||
AllowedHost { host: "git.crt.fyi", raw_files_only: true },
|
AllowedHost { host: "git.crt.fyi", raw_files_only: true },
|
||||||
];
|
];
|
||||||
/// The catalog format every app reads. Format 2: every item names the apps it is for (`apps`), and only
|
/// The catalog format this code reads. Format 2: every item names the apps it is for (`apps`).
|
||||||
/// the kinds every app knows (theme, plugin, strings): an app from before a kind existed refuses a
|
|
||||||
/// whole catalog that lists it, so `catalog.json` never does.
|
|
||||||
pub const CATALOG_FORMAT: u32 = 2;
|
pub const CATALOG_FORMAT: u32 = 2;
|
||||||
/// Format 3 is the same file with every kind (icons, builtin, ...), as `catalog.v3.json`. Apps that
|
|
||||||
/// know it read it first and fall back to `catalog.json` when it is not published.
|
|
||||||
pub const CATALOG_FORMAT_NEXT: u32 = 3;
|
|
||||||
pub const CATALOG_FILE: &str = "catalog.json";
|
|
||||||
pub const CATALOG_FILE_NEXT: &str = "catalog.v3.json";
|
|
||||||
pub const MAX_THEME_BYTES: usize = 2 * 1024 * 1024;
|
pub const MAX_THEME_BYTES: usize = 2 * 1024 * 1024;
|
||||||
/// An icon pack file (the runtime's `ICON_LIMITS.packBytes`).
|
|
||||||
pub const MAX_ICONS_BYTES: usize = 120_000;
|
|
||||||
pub const MAX_CATALOG_BYTES: usize = 1024 * 1024;
|
pub const MAX_CATALOG_BYTES: usize = 1024 * 1024;
|
||||||
pub const MAX_SIGNATURE_BYTES: usize = 512;
|
pub const MAX_SIGNATURE_BYTES: usize = 512;
|
||||||
pub const MAX_LINK_CHARS: usize = 2048;
|
pub const MAX_LINK_CHARS: usize = 2048;
|
||||||
|
|
@ -70,11 +61,6 @@ pub enum Kind {
|
||||||
Plugin,
|
Plugin,
|
||||||
/// A string pack: data that replaces the site's own UI strings (`store::strings`).
|
/// A string pack: data that replaces the site's own UI strings (`store::strings`).
|
||||||
Strings,
|
Strings,
|
||||||
/// An icon pack (`*.icons.json`): path data and small drawings, never code.
|
|
||||||
Icons,
|
|
||||||
/// Catalog only: a feature that ships inside the app (an area plugin). The Store lists it as
|
|
||||||
/// built in with its switch; there is nothing to download, stage or install.
|
|
||||||
Builtin,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Kind {
|
impl Kind {
|
||||||
|
|
@ -83,24 +69,15 @@ impl Kind {
|
||||||
"theme" => Ok(Kind::Theme),
|
"theme" => Ok(Kind::Theme),
|
||||||
"plugin" => Ok(Kind::Plugin),
|
"plugin" => Ok(Kind::Plugin),
|
||||||
"strings" => Ok(Kind::Strings),
|
"strings" => Ok(Kind::Strings),
|
||||||
"icons" => Ok(Kind::Icons),
|
_ => Err("VALIDATION: kind must be \"theme\", \"plugin\" or \"strings\"".into()),
|
||||||
"builtin" => Ok(Kind::Builtin),
|
|
||||||
_ => Err("VALIDATION: kind must be \"theme\", \"plugin\", \"strings\", \"icons\" or \"builtin\"".into()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Kinds every app knows, the only ones a format 2 catalog may list.
|
|
||||||
pub fn is_legacy(self) -> bool {
|
|
||||||
matches!(self, Kind::Theme | Kind::Plugin | Kind::Strings)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn as_str(self) -> &'static str {
|
pub fn as_str(self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
Kind::Theme => "theme",
|
Kind::Theme => "theme",
|
||||||
Kind::Plugin => "plugin",
|
Kind::Plugin => "plugin",
|
||||||
Kind::Strings => "strings",
|
Kind::Strings => "strings",
|
||||||
Kind::Icons => "icons",
|
|
||||||
Kind::Builtin => "builtin",
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -109,8 +86,6 @@ impl Kind {
|
||||||
Kind::Theme => MAX_THEME_BYTES,
|
Kind::Theme => MAX_THEME_BYTES,
|
||||||
Kind::Plugin => MAX_PLUGIN_BYTES as usize,
|
Kind::Plugin => MAX_PLUGIN_BYTES as usize,
|
||||||
Kind::Strings => super::strings::MAX_STRINGS_BYTES,
|
Kind::Strings => super::strings::MAX_STRINGS_BYTES,
|
||||||
Kind::Icons => MAX_ICONS_BYTES,
|
|
||||||
Kind::Builtin => 0,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -188,10 +163,7 @@ pub fn parse_install_link(config: &StoreConfig, link: &str) -> Result<InstallLin
|
||||||
return Err("LINK: repeated parameter".into());
|
return Err("LINK: repeated parameter".into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let kind = Kind::parse(kind.as_deref().ok_or("LINK: missing kind")?).map_err(|_| "LINK: kind must be theme, plugin, strings or icons")?;
|
let kind = Kind::parse(kind.as_deref().ok_or("LINK: missing kind")?).map_err(|_| "LINK: kind must be theme or plugin")?;
|
||||||
if kind == Kind::Builtin {
|
|
||||||
return Err("LINK: built-in items cannot be installed".into());
|
|
||||||
}
|
|
||||||
let target = Url::parse(url.as_deref().ok_or("LINK: missing url")?).map_err(|_| "LINK: url is not a URL")?;
|
let target = Url::parse(url.as_deref().ok_or("LINK: missing url")?).map_err(|_| "LINK: url is not a URL")?;
|
||||||
if !allowed_download_url(config.allowed_hosts, &target) {
|
if !allowed_download_url(config.allowed_hosts, &target) {
|
||||||
return Err(format!("LINK: only https links on {} can be installed", hosts_text(config.allowed_hosts)));
|
return Err(format!("LINK: only https links on {} can be installed", hosts_text(config.allowed_hosts)));
|
||||||
|
|
@ -272,62 +244,6 @@ pub fn validate_theme(bytes: &[u8]) -> Result<ThemeInfo, String> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// What the confirmation screen shows about an icon pack (the shell parses the rest and draws it).
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, Serialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct IconsInfo {
|
|
||||||
pub id: String,
|
|
||||||
pub name: String,
|
|
||||||
pub author: String,
|
|
||||||
pub license: String,
|
|
||||||
pub glyphs: usize,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// An icon pack file: at most [`MAX_ICONS_BYTES`], UTF-8 JSON, an object with an `id`
|
|
||||||
/// (`[a-z0-9-]{1,40}`), a non-empty `name` and a `glyphs` object. It is data: the shell's own
|
|
||||||
/// sanitizer (`parseIconPackJson`) keeps only valid path data and small drawings.
|
|
||||||
pub fn validate_icons(bytes: &[u8]) -> Result<IconsInfo, String> {
|
|
||||||
if bytes.is_empty() {
|
|
||||||
return Err("VALIDATION: the icon pack file is empty".into());
|
|
||||||
}
|
|
||||||
if bytes.len() > MAX_ICONS_BYTES {
|
|
||||||
return Err("VALIDATION: icon packs are limited to 120 KB".into());
|
|
||||||
}
|
|
||||||
let text = std::str::from_utf8(bytes).map_err(|_| "VALIDATION: an icon pack must be UTF-8 JSON")?;
|
|
||||||
let value: serde_json::Value = serde_json::from_str(text.trim_start_matches('\u{feff}')).map_err(|_| "VALIDATION: this file is not valid JSON")?;
|
|
||||||
let object = value.as_object().ok_or("VALIDATION: an icon pack is a JSON object")?;
|
|
||||||
let id = object.get("id").and_then(serde_json::Value::as_str).unwrap_or_default();
|
|
||||||
if !valid_id(id) {
|
|
||||||
return Err("VALIDATION: an icon pack needs an \"id\" of lowercase letters, digits and dashes".into());
|
|
||||||
}
|
|
||||||
let name = short(object.get("name"), 60);
|
|
||||||
if name.trim().is_empty() {
|
|
||||||
return Err("VALIDATION: an icon pack needs a \"name\"".into());
|
|
||||||
}
|
|
||||||
let glyphs = object.get("glyphs").and_then(serde_json::Value::as_object).map(|glyphs| glyphs.len()).unwrap_or(0);
|
|
||||||
if glyphs == 0 {
|
|
||||||
return Err("VALIDATION: an icon pack needs a \"glyphs\" object with at least one icon".into());
|
|
||||||
}
|
|
||||||
Ok(IconsInfo { id: id.to_owned(), name, author: short(object.get("author"), 60), license: short(object.get("license"), 60), glyphs })
|
|
||||||
}
|
|
||||||
|
|
||||||
/// What a file name says it is: `.plugin.js` a plugin, `.strings.json` a string pack,
|
|
||||||
/// `.icons.json` an icon pack, any other `.json` a theme; anything else nothing.
|
|
||||||
pub fn kind_for_file_name(name: &str) -> Option<Kind> {
|
|
||||||
let lower = name.to_ascii_lowercase();
|
|
||||||
if lower.ends_with(plugins::PLUGIN_SUFFIX) {
|
|
||||||
Some(Kind::Plugin)
|
|
||||||
} else if lower.ends_with(".strings.json") {
|
|
||||||
Some(Kind::Strings)
|
|
||||||
} else if lower.ends_with(".icons.json") {
|
|
||||||
Some(Kind::Icons)
|
|
||||||
} else if lower.ends_with(".json") {
|
|
||||||
Some(Kind::Theme)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Validates a plugin for installation (see `plugins::validate_plugin`).
|
/// Validates a plugin for installation (see `plugins::validate_plugin`).
|
||||||
pub fn validate_plugin(file: &str, bytes: &[u8]) -> Result<ValidatedPlugin, String> {
|
pub fn validate_plugin(file: &str, bytes: &[u8]) -> Result<ValidatedPlugin, String> {
|
||||||
plugins::validate_plugin(file, bytes)
|
plugins::validate_plugin(file, bytes)
|
||||||
|
|
@ -363,15 +279,11 @@ pub struct CatalogItem {
|
||||||
pub category: String,
|
pub category: String,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub tags: Vec<String>,
|
pub tags: Vec<String>,
|
||||||
/// Where the file is (every kind but `builtin`, which has nothing to download).
|
|
||||||
#[serde(default, skip_serializing_if = "String::is_empty")]
|
|
||||||
pub url: String,
|
pub url: String,
|
||||||
/// Plugins: the file name it is installed under.
|
/// Plugins: the file name it is installed under.
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub file: Option<String>,
|
pub file: Option<String>,
|
||||||
#[serde(default, skip_serializing_if = "String::is_empty")]
|
|
||||||
pub sha256: String,
|
pub sha256: String,
|
||||||
#[serde(default, skip_serializing_if = "is_zero")]
|
|
||||||
pub size: u64,
|
pub size: u64,
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub preview: Option<String>,
|
pub preview: Option<String>,
|
||||||
|
|
@ -392,16 +304,6 @@ pub struct CatalogItem {
|
||||||
pub credits: Option<String>,
|
pub credits: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The catalog as signed, before its items are looked at one by one.
|
|
||||||
#[derive(Deserialize)]
|
|
||||||
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
|
||||||
struct RawCatalog {
|
|
||||||
format: u32,
|
|
||||||
name: String,
|
|
||||||
generated_at: String,
|
|
||||||
items: Vec<serde_json::Value>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
||||||
pub struct Catalog {
|
pub struct Catalog {
|
||||||
|
|
@ -419,10 +321,6 @@ impl Catalog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_zero(value: &u64) -> bool {
|
|
||||||
*value == 0
|
|
||||||
}
|
|
||||||
|
|
||||||
fn valid_id(id: &str) -> bool {
|
fn valid_id(id: &str) -> bool {
|
||||||
!id.is_empty() && id.len() <= 40 && id.bytes().all(|b| b.is_ascii_lowercase() || b.is_ascii_digit() || b == b'-')
|
!id.is_empty() && id.len() <= 40 && id.bytes().all(|b| b.is_ascii_lowercase() || b.is_ascii_digit() || b == b'-')
|
||||||
}
|
}
|
||||||
|
|
@ -460,29 +358,22 @@ impl CatalogItem {
|
||||||
if self.tags.len() > 12 || self.tags.iter().any(|tag| !valid_text(tag, 32)) {
|
if self.tags.len() > 12 || self.tags.iter().any(|tag| !valid_text(tag, 32)) {
|
||||||
return bad("tags");
|
return bad("tags");
|
||||||
}
|
}
|
||||||
if self.kind == Kind::Builtin {
|
|
||||||
// Part of the app: nothing to download, so nothing to hash or point at.
|
|
||||||
if !self.url.is_empty() || !self.sha256.is_empty() || self.size != 0 || self.file.is_some() || self.permissions.is_some() || self.colors.is_some() || self.language.is_some() {
|
|
||||||
return bad("built-in item fields");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
let url = Url::parse(&self.url).map_err(|_| format!("STORE: item {}: invalid url", self.id))?;
|
let url = Url::parse(&self.url).map_err(|_| format!("STORE: item {}: invalid url", self.id))?;
|
||||||
if url.scheme() != "https" || url.as_str().len() > MAX_LINK_CHARS || hosts.is_some_and(|hosts| !allowed_download_url(hosts, &url)) {
|
if url.scheme() != "https" || url.as_str().len() > MAX_LINK_CHARS || hosts.is_some_and(|hosts| !allowed_download_url(hosts, &url)) {
|
||||||
return bad("url (host not allowed)");
|
return bad("url (host not allowed)");
|
||||||
}
|
}
|
||||||
if self.sha256.len() != 64 || !self.sha256.bytes().all(|b| b.is_ascii_hexdigit() && !b.is_ascii_uppercase()) {
|
|
||||||
return bad("sha256");
|
|
||||||
}
|
|
||||||
if self.size == 0 || self.size > self.kind.max_bytes() as u64 {
|
|
||||||
return bad("size");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if let Some(preview) = &self.preview {
|
if let Some(preview) = &self.preview {
|
||||||
let ok = Url::parse(preview).is_ok_and(|url| url.scheme() == "https" && hosts.is_none_or(|hosts| allowed_download_url(hosts, &url)));
|
let ok = Url::parse(preview).is_ok_and(|url| url.scheme() == "https" && hosts.is_none_or(|hosts| allowed_download_url(hosts, &url)));
|
||||||
if !ok {
|
if !ok {
|
||||||
return bad("preview");
|
return bad("preview");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if self.sha256.len() != 64 || !self.sha256.bytes().all(|b| b.is_ascii_hexdigit() && !b.is_ascii_uppercase()) {
|
||||||
|
return bad("sha256");
|
||||||
|
}
|
||||||
|
if self.size == 0 || self.size > self.kind.max_bytes() as u64 {
|
||||||
|
return bad("size");
|
||||||
|
}
|
||||||
// Any item may name its licence and credit its authors; only a string pack has a language.
|
// Any item may name its licence and credit its authors; only a string pack has a language.
|
||||||
if !self.license.as_deref().is_none_or(|v| !v.trim().is_empty() && valid_text(v, 60)) || !self.credits.as_deref().is_none_or(|v| valid_text(v, 600)) {
|
if !self.license.as_deref().is_none_or(|v| !v.trim().is_empty() && valid_text(v, 60)) || !self.credits.as_deref().is_none_or(|v| valid_text(v, 600)) {
|
||||||
return bad("license or credits");
|
return bad("license or credits");
|
||||||
|
|
@ -502,12 +393,6 @@ impl CatalogItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Kind::Icons => {
|
|
||||||
if self.file.is_some() || self.permissions.is_some() || self.colors.is_some() {
|
|
||||||
return bad("icon pack fields");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Kind::Builtin => {}
|
|
||||||
Kind::Strings => {
|
Kind::Strings => {
|
||||||
if self.file.is_some() || self.permissions.is_some() || self.colors.is_some() {
|
if self.file.is_some() || self.permissions.is_some() || self.colors.is_some() {
|
||||||
return bad("string pack fields");
|
return bad("string pack fields");
|
||||||
|
|
@ -561,27 +446,13 @@ pub fn verify_catalog(config: &StoreConfig, body: &[u8], signature: &str) -> Res
|
||||||
if !verified {
|
if !verified {
|
||||||
return Err("STORE: the catalog signature does not verify".into());
|
return Err("STORE: the catalog signature does not verify".into());
|
||||||
}
|
}
|
||||||
let raw: RawCatalog = serde_json::from_slice(body).map_err(|error| format!("STORE: catalog schema: {error}"))?;
|
let catalog: Catalog = serde_json::from_slice(body).map_err(|error| format!("STORE: catalog schema: {error}"))?;
|
||||||
if raw.format != CATALOG_FORMAT && raw.format != CATALOG_FORMAT_NEXT {
|
if catalog.format != CATALOG_FORMAT {
|
||||||
return Err("STORE: unsupported catalog format (update the app)".into());
|
return Err("STORE: unsupported catalog format (update the app)".into());
|
||||||
}
|
}
|
||||||
if raw.items.len() > MAX_ITEMS {
|
if catalog.items.len() > MAX_ITEMS {
|
||||||
return Err("STORE: too many items".into());
|
return Err("STORE: too many items".into());
|
||||||
}
|
}
|
||||||
// An item of a kind this version does not know is skipped, not a reason to refuse the whole
|
|
||||||
// signed file (a later catalog may list kinds this version has no use for). Everything else
|
|
||||||
// about an item is held to the rules below, as ever.
|
|
||||||
let mut items = Vec::with_capacity(raw.items.len());
|
|
||||||
for value in raw.items {
|
|
||||||
if value.get("kind").and_then(serde_json::Value::as_str).is_some_and(|kind| Kind::parse(kind).is_err()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
items.push(serde_json::from_value::<CatalogItem>(value).map_err(|error| format!("STORE: catalog schema: {error}"))?);
|
|
||||||
}
|
|
||||||
if raw.format == CATALOG_FORMAT && items.iter().any(|item| !item.kind.is_legacy()) {
|
|
||||||
return Err("STORE: a format 2 catalog lists only theme, plugin and strings items".into());
|
|
||||||
}
|
|
||||||
let catalog = Catalog { format: raw.format, name: raw.name, generated_at: raw.generated_at, items };
|
|
||||||
let mut ids = HashSet::new();
|
let mut ids = HashSet::new();
|
||||||
let mut files = HashSet::new();
|
let mut files = HashSet::new();
|
||||||
for item in &catalog.items {
|
for item in &catalog.items {
|
||||||
|
|
@ -602,9 +473,6 @@ pub fn verify_catalog(config: &StoreConfig, body: &[u8], signature: &str) -> Res
|
||||||
|
|
||||||
/// A downloaded item must be exactly what the signed catalog describes.
|
/// A downloaded item must be exactly what the signed catalog describes.
|
||||||
pub fn verify_item(item: &CatalogItem, bytes: &[u8]) -> Result<(), String> {
|
pub fn verify_item(item: &CatalogItem, bytes: &[u8]) -> Result<(), String> {
|
||||||
if item.kind == Kind::Builtin {
|
|
||||||
return Err("STORE: built-in items are part of the app; there is nothing to download".into());
|
|
||||||
}
|
|
||||||
if bytes.len() as u64 != item.size {
|
if bytes.len() as u64 != item.size {
|
||||||
return Err("STORE: the download's size does not match the signed catalog".into());
|
return Err("STORE: the download's size does not match the signed catalog".into());
|
||||||
}
|
}
|
||||||
|
|
@ -781,11 +649,7 @@ pub(crate) mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn catalog_json(items: serde_json::Value) -> Vec<u8> {
|
pub(crate) fn catalog_json(items: serde_json::Value) -> Vec<u8> {
|
||||||
catalog_json_format(CATALOG_FORMAT, items)
|
serde_json::to_vec(&serde_json::json!({ "format": CATALOG_FORMAT, "name": "Test", "generatedAt": "2026-09-28T00:00:00Z", "items": items })).unwrap()
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn catalog_json_format(format: u32, items: serde_json::Value) -> Vec<u8> {
|
|
||||||
serde_json::to_vec(&serde_json::json!({ "format": format, "name": "Test", "generatedAt": "2026-09-28T00:00:00Z", "items": items })).unwrap()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn plugin_item(body: &[u8]) -> serde_json::Value {
|
pub(crate) fn plugin_item(body: &[u8]) -> serde_json::Value {
|
||||||
|
|
@ -931,119 +795,6 @@ pub(crate) mod tests {
|
||||||
assert!(verify_catalog(c, &body, &sign(&key, &body)).unwrap_err().contains("update the app"));
|
assert!(verify_catalog(c, &body, &sign(&key, &body)).unwrap_err().contains("update the app"));
|
||||||
}
|
}
|
||||||
|
|
||||||
const ICONS: &[u8] = br#"{"id":"line-2","name":"Line 2","author":"me","license":"CC0-1.0","glyphs":{"home":{"d":"M3 3h18v18H3z"}}}"#;
|
|
||||||
|
|
||||||
fn icons_item(body: &[u8]) -> serde_json::Value {
|
|
||||||
serde_json::json!({
|
|
||||||
"apps": ["x"], "kind": "icons", "id": "line-2", "name": "Line 2", "version": "1.0.0", "category": "icons",
|
|
||||||
"url": "https://waybetter.fyi/store/icons/line-2.icons.json", "sha256": sha256_hex(body), "size": body.len(), "license": "CC0-1.0"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn builtin_item() -> serde_json::Value {
|
|
||||||
serde_json::json!({ "apps": ["x"], "kind": "builtin", "id": "compose", "name": "Compose+", "version": "1.0.0", "description": "Writing tools.", "category": "writing" })
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn icon_packs_and_built_in_items_are_catalog_kinds() {
|
|
||||||
let (key, public) = test_key(7);
|
|
||||||
let c = config("x", &[public]);
|
|
||||||
let body = catalog_json_format(CATALOG_FORMAT_NEXT, serde_json::json!([icons_item(ICONS), builtin_item()]));
|
|
||||||
let catalog = verify_catalog(c, &body, &sign(&key, &body)).unwrap();
|
|
||||||
// The newer kinds are a format 3 catalog only: a format 2 file that lists them is refused, so
|
|
||||||
// the file older apps read can never carry a kind they would refuse.
|
|
||||||
let old = catalog_json(serde_json::json!([icons_item(ICONS)]));
|
|
||||||
assert!(verify_catalog(c, &old, &sign(&key, &old)).unwrap_err().contains("format 2"));
|
|
||||||
let both = catalog_json_format(CATALOG_FORMAT_NEXT, serde_json::json!([plugin_item(PLUGIN)]));
|
|
||||||
assert_eq!(verify_catalog(c, &both, &sign(&key, &both)).unwrap().format, CATALOG_FORMAT_NEXT);
|
|
||||||
assert_eq!(catalog.items.iter().map(|item| item.kind).collect::<Vec<_>>(), [Kind::Icons, Kind::Builtin]);
|
|
||||||
verify_item(&catalog.items[0], ICONS).unwrap();
|
|
||||||
assert!(verify_item(&catalog.items[0], b"{}").is_err());
|
|
||||||
assert!(verify_item(&catalog.items[1], b"").unwrap_err().contains("built-in"), "nothing to download for a built-in item");
|
|
||||||
// A built-in item serializes without file fields (the signed bytes stay what the builder wrote).
|
|
||||||
let json = serde_json::to_value(&catalog.items[1]).unwrap();
|
|
||||||
for field in ["url", "sha256", "size", "file"] {
|
|
||||||
assert!(json.get(field).is_none(), "{field}");
|
|
||||||
}
|
|
||||||
// Built-in items carry no file, hash, size, url, permissions, colors or language; icon packs no plugin or theme fields.
|
|
||||||
let mut cases: Vec<(&str, serde_json::Value)> = Vec::new();
|
|
||||||
for (what, patch) in [
|
|
||||||
("url", serde_json::json!({ "url": "https://waybetter.fyi/a" })),
|
|
||||||
("sha256", serde_json::json!({ "sha256": sha256_hex(b"x") })),
|
|
||||||
("size", serde_json::json!({ "size": 5 })),
|
|
||||||
("file", serde_json::json!({ "file": "a.plugin.js" })),
|
|
||||||
("permissions", serde_json::json!({ "permissions": ["ui"] })),
|
|
||||||
("language", serde_json::json!({ "language": "eo" })),
|
|
||||||
("colors", serde_json::json!({ "colors": { "bg": "#000000", "text": "#ffffff", "accent": "#ff0000" } })),
|
|
||||||
] {
|
|
||||||
let mut item = builtin_item();
|
|
||||||
for (k, v) in patch.as_object().unwrap() {
|
|
||||||
item[k] = v.clone();
|
|
||||||
}
|
|
||||||
cases.push((what, item));
|
|
||||||
}
|
|
||||||
for (what, patch) in [("file", serde_json::json!({ "file": "a.plugin.js" })), ("permissions", serde_json::json!({ "permissions": ["ui"] })), ("language", serde_json::json!({ "language": "eo" }))] {
|
|
||||||
let mut item = icons_item(ICONS);
|
|
||||||
for (k, v) in patch.as_object().unwrap() {
|
|
||||||
item[k] = v.clone();
|
|
||||||
}
|
|
||||||
cases.push((what, item));
|
|
||||||
}
|
|
||||||
let mut no_url = icons_item(ICONS);
|
|
||||||
no_url.as_object_mut().unwrap().remove("url");
|
|
||||||
cases.push(("icon pack without url", no_url));
|
|
||||||
let mut big = icons_item(ICONS);
|
|
||||||
big["size"] = serde_json::json!(MAX_ICONS_BYTES + 1);
|
|
||||||
cases.push(("icon pack over the cap", big));
|
|
||||||
for (what, item) in cases {
|
|
||||||
let body = catalog_json_format(CATALOG_FORMAT_NEXT, serde_json::json!([item]));
|
|
||||||
assert!(verify_catalog(c, &body, &sign(&key, &body)).is_err(), "accepted bad {what}");
|
|
||||||
}
|
|
||||||
// Another app's built-in items are not this app's.
|
|
||||||
let mut other = builtin_item();
|
|
||||||
other["apps"] = serde_json::json!(["kick"]);
|
|
||||||
let body = catalog_json_format(CATALOG_FORMAT_NEXT, serde_json::json!([other]));
|
|
||||||
assert!(verify_catalog(c, &body, &sign(&key, &body)).unwrap().items.is_empty());
|
|
||||||
// A kind this version has never heard of is skipped (a later catalog may list it); a malformed
|
|
||||||
// item of a known kind, or an item without a kind, still refuses the file.
|
|
||||||
let future = serde_json::json!({ "apps": ["x"], "kind": "widget", "id": "w", "name": "W", "version": "1", "extra": [1, 2] });
|
|
||||||
let body = catalog_json_format(CATALOG_FORMAT_NEXT, serde_json::json!([future.clone(), plugin_item(PLUGIN)]));
|
|
||||||
assert_eq!(verify_catalog(c, &body, &sign(&key, &body)).unwrap().items.iter().map(|item| item.id.as_str()).collect::<Vec<_>>(), ["tool"]);
|
|
||||||
let mut kindless = future;
|
|
||||||
kindless.as_object_mut().unwrap().remove("kind");
|
|
||||||
let body = catalog_json_format(CATALOG_FORMAT_NEXT, serde_json::json!([kindless]));
|
|
||||||
assert!(verify_catalog(c, &body, &sign(&key, &body)).is_err());
|
|
||||||
// Links and the shell's kind names: icons yes, built-in never.
|
|
||||||
assert_eq!(parse_install_link(c, "waybetter://install?kind=icons&url=https://waybetter.fyi/store/icons/line-2.icons.json").unwrap().kind, Kind::Icons);
|
|
||||||
assert!(parse_install_link(c, "waybetter://install?kind=builtin&url=https://waybetter.fyi/a.json").unwrap_err().contains("built-in"));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn icon_packs_are_small_json_objects_with_an_id_a_name_and_glyphs() {
|
|
||||||
let info = validate_icons(ICONS).unwrap();
|
|
||||||
assert_eq!((info.id.as_str(), info.name.as_str(), info.license.as_str(), info.glyphs), ("line-2", "Line 2", "CC0-1.0", 1));
|
|
||||||
for bad in [
|
|
||||||
&b""[..], b"[]", b"{not json", br#"{"name":"A","glyphs":{"home":{}}}"#, br#"{"id":"Bad Id","name":"A","glyphs":{"home":{}}}"#,
|
|
||||||
br#"{"id":"a","glyphs":{"home":{}}}"#, br#"{"id":"a","name":"A"}"#, br#"{"id":"a","name":"A","glyphs":{}}"#,
|
|
||||||
] {
|
|
||||||
assert!(validate_icons(bad).is_err(), "accepted {}", String::from_utf8_lossy(bad));
|
|
||||||
}
|
|
||||||
let big = format!(r#"{{"id":"a","name":"A","glyphs":{{"home":{{"d":"{}"}}}}}}"#, "M".repeat(MAX_ICONS_BYTES));
|
|
||||||
assert!(validate_icons(big.as_bytes()).unwrap_err().contains("120 KB"));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn file_names_say_what_a_file_is() {
|
|
||||||
assert_eq!(kind_for_file_name("tool.plugin.js"), Some(Kind::Plugin));
|
|
||||||
assert_eq!(kind_for_file_name("TOOL.PLUGIN.JS"), Some(Kind::Plugin));
|
|
||||||
assert_eq!(kind_for_file_name("eo.strings.json"), Some(Kind::Strings));
|
|
||||||
assert_eq!(kind_for_file_name("line.icons.json"), Some(Kind::Icons), "not a theme");
|
|
||||||
assert_eq!(kind_for_file_name("nord.json"), Some(Kind::Theme));
|
|
||||||
for other in ["script.js", "photo.png", "notes.txt", "json", ""] {
|
|
||||||
assert_eq!(kind_for_file_name(other), None, "{other}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn versions_compare_numerically() {
|
fn versions_compare_numerically() {
|
||||||
assert!(newer_version("1.10.0", "1.9.3"));
|
assert!(newer_version("1.10.0", "1.9.3"));
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,12 @@
|
||||||
//! and passes a function that runs a plugin start/stop script in its site tabs.
|
//! and passes a function that runs a plugin start/stop script in its site tabs.
|
||||||
|
|
||||||
use super::catalog::{
|
use super::catalog::{
|
||||||
self as dist, Catalog, CatalogItem, IconsInfo, InstallLink, InstallRecord, InstallRecords, Kind, SourceKind, StoreConfig, ThemeInfo,
|
self as dist, Catalog, CatalogItem, InstallLink, InstallRecord, InstallRecords, Kind, SourceKind, StoreConfig, ThemeInfo,
|
||||||
};
|
};
|
||||||
use super::strings::{self as packs, StringsInfo, StringsList, StringsStore};
|
use super::strings::{self as packs, StringsInfo, StringsList, StringsStore};
|
||||||
use crate::plugins::{self, PluginHost, PluginStore, ScriptPlugin};
|
use crate::plugins::{self, PluginHost, PluginStore, ScriptPlugin, PLUGIN_SUFFIX};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::collections::{BTreeMap, HashMap, VecDeque};
|
use std::collections::{BTreeMap, HashMap, VecDeque};
|
||||||
use std::io::Read;
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::{Mutex, MutexGuard};
|
use std::sync::{Mutex, MutexGuard};
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
|
|
@ -21,8 +20,7 @@ pub const RECORDS_FILE: &str = "store-installed.json";
|
||||||
/// The last verified catalog and its signature (verified again when read back).
|
/// The last verified catalog and its signature (verified again when read back).
|
||||||
pub const CATALOG_CACHE: &str = "store-catalog.json";
|
pub const CATALOG_CACHE: &str = "store-catalog.json";
|
||||||
pub const CATALOG_SIG_CACHE: &str = "store-catalog.json.sig";
|
pub const CATALOG_SIG_CACHE: &str = "store-catalog.json.sig";
|
||||||
/// Shell event: a validated install link (`{ link: { kind, url } }`), a file the OS handed over
|
/// Shell event: a validated install link (`{ link: { kind, url } }`), a "Share my setup" link
|
||||||
/// ("Open with", double-click: `{ opened: { id, name, kind } }`), a "Share my setup" link
|
|
||||||
/// (`{ setup }`: its text, for the shell's preview) or `{ error }`.
|
/// (`{ setup }`: its text, for the shell's preview) or `{ error }`.
|
||||||
pub const EVENT_LINK: &str = "install-link";
|
pub const EVENT_LINK: &str = "install-link";
|
||||||
/// "Share my setup" links: `waybetter://setup?app=…&d=…`. Native code only checks the shape and
|
/// "Share my setup" links: `waybetter://setup?app=…&d=…`. Native code only checks the shape and
|
||||||
|
|
@ -33,8 +31,6 @@ const MAX_SETUP_LINK: usize = 24 * 1024;
|
||||||
/// Links received before the shell asked for them (startup, or while the shell reloads).
|
/// Links received before the shell asked for them (startup, or while the shell reloads).
|
||||||
const MAX_PENDING: usize = 8;
|
const MAX_PENDING: usize = 8;
|
||||||
const MAX_STAGED: usize = 8;
|
const MAX_STAGED: usize = 8;
|
||||||
/// Files the OS handed over that the shell has not asked for yet.
|
|
||||||
const MAX_OPENED: usize = 8;
|
|
||||||
const STAGED_TTL: Duration = Duration::from_secs(15 * 60);
|
const STAGED_TTL: Duration = Duration::from_secs(15 * 60);
|
||||||
/// The confirmation screen enables Install after a moment; a commit faster than this was not read.
|
/// The confirmation screen enables Install after a moment; a commit faster than this was not read.
|
||||||
pub const MIN_REVIEW: Duration = Duration::from_millis(600);
|
pub const MIN_REVIEW: Duration = Duration::from_millis(600);
|
||||||
|
|
@ -51,19 +47,6 @@ pub struct LinkEvent {
|
||||||
/// A "Share my setup" link, as text (see [`SETUP_LINK`]).
|
/// A "Share my setup" link, as text (see [`SETUP_LINK`]).
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub setup: Option<String>,
|
pub setup: Option<String>,
|
||||||
/// A file the OS handed to the app; the shell asks for it by `id` (`install_stage_opened`).
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub opened: Option<OpenedFile>,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A file the OS handed to the app. Only its random id, its name and what it would be reach the
|
|
||||||
/// shell; the path stays in native code and the shell cannot name a path of its own.
|
|
||||||
#[derive(Clone, Debug, Serialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct OpenedFile {
|
|
||||||
pub id: String,
|
|
||||||
pub name: String,
|
|
||||||
pub kind: Kind,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `Some` when `raw` is a setup link: its text when it has the plain shape (the path, a query of
|
/// `Some` when `raw` is a setup link: its text when it has the plain shape (the path, a query of
|
||||||
|
|
@ -114,8 +97,6 @@ pub struct InstallPreview {
|
||||||
pub theme: Option<ThemeInfo>,
|
pub theme: Option<ThemeInfo>,
|
||||||
/// String packs: what the pack says about itself (the shell adds coverage from the inventory).
|
/// String packs: what the pack says about itself (the shell adds coverage from the inventory).
|
||||||
pub strings: Option<StringsInfo>,
|
pub strings: Option<StringsInfo>,
|
||||||
/// Icon packs: what the pack says about itself (the shell parses and draws the rest).
|
|
||||||
pub icons: Option<IconsInfo>,
|
|
||||||
pub findings: Vec<&'static str>,
|
pub findings: Vec<&'static str>,
|
||||||
pub existing: Option<Existing>,
|
pub existing: Option<Existing>,
|
||||||
pub store: Option<CatalogItem>,
|
pub store: Option<CatalogItem>,
|
||||||
|
|
@ -131,8 +112,6 @@ pub struct InstallOutcome {
|
||||||
pub theme_text: Option<String>,
|
pub theme_text: Option<String>,
|
||||||
/// String packs: the installed packs after installing.
|
/// String packs: the installed packs after installing.
|
||||||
pub strings: Option<StringsList>,
|
pub strings: Option<StringsList>,
|
||||||
/// Icon packs: the exact JSON the owner confirmed; the shell adds it (sanitized) to its packs.
|
|
||||||
pub icons_text: Option<String>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize)]
|
#[derive(Clone, Debug, Serialize)]
|
||||||
|
|
@ -182,16 +161,8 @@ struct CatalogCache {
|
||||||
fetched_at: String,
|
fetched_at: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Opened {
|
|
||||||
path: PathBuf,
|
|
||||||
name: String,
|
|
||||||
kind: Kind,
|
|
||||||
created: Instant,
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Inner {
|
struct Inner {
|
||||||
pending: VecDeque<LinkEvent>,
|
pending: VecDeque<LinkEvent>,
|
||||||
opened: HashMap<String, Opened>,
|
|
||||||
staged: HashMap<String, Staged>,
|
staged: HashMap<String, Staged>,
|
||||||
catalog: Option<CatalogCache>,
|
catalog: Option<CatalogCache>,
|
||||||
records: InstallRecords,
|
records: InstallRecords,
|
||||||
|
|
@ -231,7 +202,7 @@ impl Store {
|
||||||
config,
|
config,
|
||||||
plugins,
|
plugins,
|
||||||
data_dir,
|
data_dir,
|
||||||
inner: Mutex::new(Inner { pending: VecDeque::new(), opened: HashMap::new(), staged: HashMap::new(), catalog: None, records }),
|
inner: Mutex::new(Inner { pending: VecDeque::new(), staged: HashMap::new(), catalog: None, records }),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -271,19 +242,14 @@ impl Store {
|
||||||
/// A link reached the app (OS deep link, second launch): validate it and queue it for the
|
/// A link reached the app (OS deep link, second launch): validate it and queue it for the
|
||||||
/// shell. Returns the event to emit ([`EVENT_LINK`]). Nothing is downloaded or installed here.
|
/// shell. Returns the event to emit ([`EVENT_LINK`]). Nothing is downloaded or installed here.
|
||||||
pub fn receive_link(&self, raw: &str) -> LinkEvent {
|
pub fn receive_link(&self, raw: &str) -> LinkEvent {
|
||||||
let mut event = LinkEvent { link: None, error: None, setup: None, opened: None };
|
let event = match setup_link(raw) {
|
||||||
match setup_link(raw) {
|
Some(Ok(text)) => LinkEvent { link: None, error: None, setup: Some(text) },
|
||||||
Some(Ok(text)) => event.setup = Some(text),
|
Some(Err(error)) => LinkEvent { link: None, error: Some(error), setup: None },
|
||||||
Some(Err(error)) => event.error = Some(error),
|
|
||||||
None => match dist::parse_install_link(self.config, raw) {
|
None => match dist::parse_install_link(self.config, raw) {
|
||||||
Ok(link) => event.link = Some(link),
|
Ok(link) => LinkEvent { link: Some(link), error: None, setup: None },
|
||||||
Err(error) => event.error = Some(error),
|
Err(error) => LinkEvent { link: None, error: Some(error), setup: None },
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
self.queue(event)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn queue(&self, event: LinkEvent) -> LinkEvent {
|
|
||||||
let mut inner = self.lock();
|
let mut inner = self.lock();
|
||||||
if inner.pending.len() >= MAX_PENDING {
|
if inner.pending.len() >= MAX_PENDING {
|
||||||
inner.pending.pop_front();
|
inner.pending.pop_front();
|
||||||
|
|
@ -292,62 +258,6 @@ impl Store {
|
||||||
event
|
event
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A file the OS handed over (a double-click or "Open with", at launch or to the running app):
|
|
||||||
/// check its name and size, keep its path under a random id and queue the event for the shell.
|
|
||||||
/// The file is read only when the shell asks ([`Self::stage_opened`]), and what it shows is the
|
|
||||||
/// install screen: nothing is written without the owner's Install there.
|
|
||||||
pub fn receive_file(&self, path: &Path) -> LinkEvent {
|
|
||||||
let mut event = LinkEvent { link: None, error: None, setup: None, opened: None };
|
|
||||||
match self.keep_opened(path) {
|
|
||||||
Ok(opened) => event.opened = Some(opened),
|
|
||||||
Err(error) => event.error = Some(error),
|
|
||||||
}
|
|
||||||
self.queue(event)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn keep_opened(&self, path: &Path) -> Result<OpenedFile, String> {
|
|
||||||
let name = path.file_name().and_then(|name| name.to_str()).ok_or("FILE: this file's name cannot be read")?.to_owned();
|
|
||||||
let kind = dist::kind_for_file_name(&name)
|
|
||||||
.ok_or("FILE: only a theme (.json), a plugin (.plugin.js), a string pack (.strings.json) or an icon pack (.icons.json) can be opened here")?;
|
|
||||||
let meta = std::fs::metadata(path).map_err(|_| "FILE: this file cannot be read")?;
|
|
||||||
if !meta.is_file() {
|
|
||||||
return Err("FILE: this is not a file".into());
|
|
||||||
}
|
|
||||||
if meta.len() > kind.max_bytes() as u64 {
|
|
||||||
return Err("FILE: the file is larger than allowed".into());
|
|
||||||
}
|
|
||||||
let id = new_token();
|
|
||||||
let mut inner = self.lock();
|
|
||||||
inner.opened.retain(|_, opened| opened.created.elapsed() < STAGED_TTL);
|
|
||||||
while inner.opened.len() >= MAX_OPENED {
|
|
||||||
let oldest = inner.opened.iter().min_by_key(|(_, opened)| opened.created).map(|(id, _)| id.clone());
|
|
||||||
match oldest {
|
|
||||||
Some(id) => inner.opened.remove(&id),
|
|
||||||
None => break,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
inner.opened.insert(id.clone(), Opened { path: path.to_path_buf(), name: name.clone(), kind, created: Instant::now() });
|
|
||||||
Ok(OpenedFile { id, name, kind })
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Reads the file kept under `id` (single use) and stages it like a dropped file.
|
|
||||||
pub fn stage_opened(&self, id: &str) -> Result<InstallPreview, String> {
|
|
||||||
let opened = self.lock().opened.remove(id).filter(|opened| opened.created.elapsed() < STAGED_TTL);
|
|
||||||
let Some(opened) = opened else {
|
|
||||||
return Err("INSTALL: this file is no longer waiting; open it again".into());
|
|
||||||
};
|
|
||||||
let max = opened.kind.max_bytes();
|
|
||||||
let mut bytes = Vec::new();
|
|
||||||
std::fs::File::open(&opened.path)
|
|
||||||
.and_then(|file| file.take(max as u64 + 1).read_to_end(&mut bytes))
|
|
||||||
.map_err(|_| "FILE: this file cannot be read")?;
|
|
||||||
if bytes.len() > max {
|
|
||||||
return Err("VALIDATION: the file is larger than allowed".into());
|
|
||||||
}
|
|
||||||
let file = (opened.kind == Kind::Plugin).then(|| opened.name.clone());
|
|
||||||
self.stage(opened.kind, file, bytes, SourceKind::File, None, None)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Links that arrived before the shell listened (drained).
|
/// Links that arrived before the shell listened (drained).
|
||||||
pub fn take_pending(&self) -> Vec<LinkEvent> {
|
pub fn take_pending(&self) -> Vec<LinkEvent> {
|
||||||
self.lock().pending.drain(..).collect()
|
self.lock().pending.drain(..).collect()
|
||||||
|
|
@ -360,7 +270,7 @@ impl Store {
|
||||||
let link = dist::parse_install_link(self.config, &dist::install_link(self.config, kind, url))?;
|
let link = dist::parse_install_link(self.config, &dist::install_link(self.config, kind, url))?;
|
||||||
let file = match kind {
|
let file = match kind {
|
||||||
Kind::Plugin => Some(dist::plugin_file_from_url(&Url::parse(&link.url).map_err(|_| "VALIDATION: invalid URL")?)?),
|
Kind::Plugin => Some(dist::plugin_file_from_url(&Url::parse(&link.url).map_err(|_| "VALIDATION: invalid URL")?)?),
|
||||||
Kind::Theme | Kind::Strings | Kind::Icons | Kind::Builtin => None,
|
Kind::Theme | Kind::Strings => None,
|
||||||
};
|
};
|
||||||
Ok((link, file))
|
Ok((link, file))
|
||||||
}
|
}
|
||||||
|
|
@ -381,7 +291,6 @@ impl Store {
|
||||||
}
|
}
|
||||||
let text = String::from_utf8(bytes.clone()).map_err(|_| "VALIDATION: not UTF-8 text")?;
|
let text = String::from_utf8(bytes.clone()).map_err(|_| "VALIDATION: not UTF-8 text")?;
|
||||||
let mut strings = None;
|
let mut strings = None;
|
||||||
let mut icons = None;
|
|
||||||
let (plugin, theme, findings, version, existing) = match kind {
|
let (plugin, theme, findings, version, existing) = match kind {
|
||||||
Kind::Plugin => {
|
Kind::Plugin => {
|
||||||
let file = file.as_deref().ok_or("VALIDATION: missing plugin file name")?;
|
let file = file.as_deref().ok_or("VALIDATION: missing plugin file name")?;
|
||||||
|
|
@ -416,18 +325,6 @@ impl Store {
|
||||||
let version = store.as_ref().map(|item| item.version.clone()).unwrap_or_default();
|
let version = store.as_ref().map(|item| item.version.clone()).unwrap_or_default();
|
||||||
(None, Some(info), Vec::new(), version, None)
|
(None, Some(info), Vec::new(), version, None)
|
||||||
}
|
}
|
||||||
Kind::Icons => {
|
|
||||||
let info = dist::validate_icons(&bytes)?;
|
|
||||||
let version = store.as_ref().map(|item| item.version.clone()).unwrap_or_default();
|
|
||||||
let existing = inner.records.items.get(&InstallRecords::key(Kind::Icons, &info.id)).map(|record| Existing {
|
|
||||||
version: record.version.clone(),
|
|
||||||
enabled: false,
|
|
||||||
same: record.sha256 == dist::sha256_hex(&bytes),
|
|
||||||
});
|
|
||||||
icons = Some(info);
|
|
||||||
(None, None, Vec::new(), version, existing)
|
|
||||||
}
|
|
||||||
Kind::Builtin => return Err("VALIDATION: built-in items are part of the app; there is nothing to install".into()),
|
|
||||||
};
|
};
|
||||||
let label = match source {
|
let label = match source {
|
||||||
SourceKind::Store => "wayBetter Store (signed catalog, sha256 verified)".to_owned(),
|
SourceKind::Store => "wayBetter Store (signed catalog, sha256 verified)".to_owned(),
|
||||||
|
|
@ -448,7 +345,6 @@ impl Store {
|
||||||
plugin,
|
plugin,
|
||||||
theme,
|
theme,
|
||||||
strings,
|
strings,
|
||||||
icons,
|
|
||||||
findings,
|
findings,
|
||||||
existing,
|
existing,
|
||||||
store: store.clone(),
|
store: store.clone(),
|
||||||
|
|
@ -471,9 +367,16 @@ impl Store {
|
||||||
|
|
||||||
/// A file dropped on the window (the shell read it with the File API; validated here).
|
/// A file dropped on the window (the shell read it with the File API; validated here).
|
||||||
pub fn stage_file(&self, name: &str, text: String) -> Result<InstallPreview, String> {
|
pub fn stage_file(&self, name: &str, text: String) -> Result<InstallPreview, String> {
|
||||||
let kind = dist::kind_for_file_name(name)
|
let lower = name.to_ascii_lowercase();
|
||||||
.ok_or("VALIDATION: drop a theme (.json), a plugin (.plugin.js), a string pack (.strings.json) or an icon pack (.icons.json)")?;
|
let (kind, file) = if lower.ends_with(PLUGIN_SUFFIX) {
|
||||||
let file = (kind == Kind::Plugin).then(|| name.to_owned());
|
(Kind::Plugin, Some(name.to_owned()))
|
||||||
|
} else if lower.ends_with(".strings.json") {
|
||||||
|
(Kind::Strings, None)
|
||||||
|
} else if lower.ends_with(".json") {
|
||||||
|
(Kind::Theme, None)
|
||||||
|
} else {
|
||||||
|
return Err("VALIDATION: drop a theme (.json), a plugin (.plugin.js) or a string pack (.strings.json)".into());
|
||||||
|
};
|
||||||
if text.len() > kind.max_bytes() {
|
if text.len() > kind.max_bytes() {
|
||||||
return Err("VALIDATION: the file is larger than allowed".into());
|
return Err("VALIDATION: the file is larger than allowed".into());
|
||||||
}
|
}
|
||||||
|
|
@ -546,7 +449,7 @@ impl Store {
|
||||||
store.set_enabled(&file, true)?;
|
store.set_enabled(&file, true)?;
|
||||||
run(&script);
|
run(&script);
|
||||||
}
|
}
|
||||||
Ok(InstallOutcome { kind: Kind::Plugin, plugins: Some(store.list()?), theme_text: None, strings: None, icons_text: None })
|
Ok(InstallOutcome { kind: Kind::Plugin, plugins: Some(store.list()?), theme_text: None, strings: None })
|
||||||
}
|
}
|
||||||
Kind::Strings => {
|
Kind::Strings => {
|
||||||
let info = packs::validate_strings(&staged.bytes)?;
|
let info = packs::validate_strings(&staged.bytes)?;
|
||||||
|
|
@ -557,7 +460,7 @@ impl Store {
|
||||||
let records = inner.records.clone();
|
let records = inner.records.clone();
|
||||||
drop(inner);
|
drop(inner);
|
||||||
self.save_records(&records);
|
self.save_records(&records);
|
||||||
Ok(InstallOutcome { kind: Kind::Strings, plugins: None, theme_text: None, strings: Some(local.list()), icons_text: None })
|
Ok(InstallOutcome { kind: Kind::Strings, plugins: None, theme_text: None, strings: Some(local.list()) })
|
||||||
}
|
}
|
||||||
Kind::Theme => {
|
Kind::Theme => {
|
||||||
let id = theme_id.filter(|id| valid_theme_id(id)).ok_or("VALIDATION: invalid theme id")?;
|
let id = theme_id.filter(|id| valid_theme_id(id)).ok_or("VALIDATION: invalid theme id")?;
|
||||||
|
|
@ -566,18 +469,8 @@ impl Store {
|
||||||
drop(inner);
|
drop(inner);
|
||||||
self.save_records(&records);
|
self.save_records(&records);
|
||||||
let text = String::from_utf8(staged.bytes).map_err(|_| "VALIDATION: not UTF-8")?;
|
let text = String::from_utf8(staged.bytes).map_err(|_| "VALIDATION: not UTF-8")?;
|
||||||
Ok(InstallOutcome { kind: Kind::Theme, plugins: None, theme_text: Some(text), strings: None, icons_text: None })
|
Ok(InstallOutcome { kind: Kind::Theme, plugins: None, theme_text: Some(text), strings: None })
|
||||||
}
|
}
|
||||||
Kind::Icons => {
|
|
||||||
let info = dist::validate_icons(&staged.bytes)?;
|
|
||||||
inner.records.insert(InstallRecords::key(Kind::Icons, &info.id), record(staged.version.clone()));
|
|
||||||
let records = inner.records.clone();
|
|
||||||
drop(inner);
|
|
||||||
self.save_records(&records);
|
|
||||||
let text = String::from_utf8(staged.bytes).map_err(|_| "VALIDATION: not UTF-8")?;
|
|
||||||
Ok(InstallOutcome { kind: Kind::Icons, plugins: None, theme_text: None, strings: None, icons_text: Some(text) })
|
|
||||||
}
|
|
||||||
Kind::Builtin => Err("INSTALL: built-in items are part of the app".into()),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -848,105 +741,6 @@ mod tests {
|
||||||
assert!(store.commit(&other.token, true, Some("other".into()), |_| {}).is_err());
|
assert!(store.commit(&other.token, true, Some("other".into()), |_| {}).is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
const ICONS: &str = r#"{"id":"line-2","name":"Line 2","author":"me","license":"CC0-1.0","glyphs":{"home":{"d":"M3 3h18v18H3z"}}}"#;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn icon_packs_install_as_text_for_the_shell_and_are_never_themes() {
|
|
||||||
let (_dir, store, _, _) = store_with_catalog();
|
|
||||||
assert!(store.stage_file("bad.icons.json", r#"{"name":"A"}"#.into()).unwrap_err().contains("id"), "an icon pack is not read as a theme");
|
|
||||||
let dropped = store.stage_file("line-2.icons.json", ICONS.into()).unwrap();
|
|
||||||
assert_eq!(dropped.kind, Kind::Icons);
|
|
||||||
assert_eq!(dropped.icons.as_ref().map(|info| (info.id.as_str(), info.glyphs)), Some(("line-2", 1)));
|
|
||||||
assert!(dropped.plugin.is_none() && dropped.theme.is_none() && !dropped.source.signed);
|
|
||||||
reviewed();
|
|
||||||
let outcome = store.commit(&dropped.token, false, None, |_| panic!("icon packs run nothing")).unwrap();
|
|
||||||
assert_eq!((outcome.kind, outcome.icons_text.as_deref()), (Kind::Icons, Some(ICONS)));
|
|
||||||
assert!(outcome.theme_text.is_none() && outcome.plugins.is_none());
|
|
||||||
assert_eq!(store.records().items["icons:line-2"].source, SourceKind::File);
|
|
||||||
// Staging the same pack again says it is installed; forgetting it clears the record.
|
|
||||||
let again = store.stage_file("line-2.icons.json", ICONS.into()).unwrap();
|
|
||||||
assert!(again.existing.as_ref().is_some_and(|existing| existing.same));
|
|
||||||
store.forget("icons", "line-2").unwrap();
|
|
||||||
assert!(store.records().items.is_empty());
|
|
||||||
assert!(store.stage_file("big.icons.json", format!(r#"{{"id":"a","name":"A","glyphs":{{"home":{{"d":"{}"}}}}}}"#, "M".repeat(dist::MAX_ICONS_BYTES))).unwrap_err().contains("larger"));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn built_in_items_have_nothing_to_stage() {
|
|
||||||
let (_dir, store, _, _) = store_with_catalog();
|
|
||||||
let entry: CatalogItem = serde_json::from_value(serde_json::json!({ "apps": ["x"], "kind": "builtin", "id": "compose", "name": "Compose+", "version": "1.0.0" })).unwrap();
|
|
||||||
assert!(store.stage_store_download(entry, Vec::new()).unwrap_err().contains("built-in"));
|
|
||||||
assert!(store.stage(Kind::Builtin, None, b"{}".to_vec(), SourceKind::File, None, None).unwrap_err().contains("built-in"));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn files_the_os_hands_over_are_kept_under_an_id_and_staged_like_a_drop() {
|
|
||||||
let (dir, store, _, _) = store_with_catalog();
|
|
||||||
let theme = dir.path().join("nord.json");
|
|
||||||
std::fs::write(&theme, THEME).unwrap();
|
|
||||||
let event = store.receive_file(&theme);
|
|
||||||
let opened = event.opened.clone().expect("a theme file is offered");
|
|
||||||
assert_eq!((opened.name.as_str(), opened.kind), ("nord.json", Kind::Theme));
|
|
||||||
assert!(event.link.is_none() && event.error.is_none() && event.setup.is_none());
|
|
||||||
// The shell sees an id and a name, never the path.
|
|
||||||
let wire = serde_json::to_string(&event).unwrap();
|
|
||||||
assert!(!wire.contains("path") && !wire.contains(dir.path().file_name().unwrap().to_str().unwrap()), "{wire}");
|
|
||||||
assert_eq!(store.take_pending().len(), 1, "queued for a shell that was not listening yet");
|
|
||||||
let preview = store.stage_opened(&opened.id).unwrap();
|
|
||||||
assert_eq!((preview.kind, preview.source.kind.clone()), (Kind::Theme, SourceKind::File));
|
|
||||||
assert_eq!(preview.theme.as_ref().unwrap().name, "Nord");
|
|
||||||
reviewed();
|
|
||||||
let outcome = store.commit(&preview.token, true, Some("nord-3".into()), |_| {}).unwrap();
|
|
||||||
assert_eq!(outcome.theme_text.as_deref().map(str::as_bytes), Some(THEME));
|
|
||||||
// Single use, and an id the OS did not hand over is refused (the shell cannot name a path).
|
|
||||||
assert!(store.stage_opened(&opened.id).unwrap_err().contains("no longer waiting"));
|
|
||||||
assert!(store.stage_opened("../nord.json").unwrap_err().contains("no longer waiting"));
|
|
||||||
assert!(store.stage_opened(&theme.to_string_lossy()).is_err());
|
|
||||||
|
|
||||||
// A plugin keeps its file name; an icon pack and a string pack are told apart from a theme.
|
|
||||||
let plugin = dir.path().join("tool.plugin.js");
|
|
||||||
std::fs::write(&plugin, PLUGIN).unwrap();
|
|
||||||
let opened = store.receive_file(&plugin).opened.unwrap();
|
|
||||||
let preview = store.stage_opened(&opened.id).unwrap();
|
|
||||||
assert_eq!((preview.kind, preview.file.as_deref()), (Kind::Plugin, Some("tool.plugin.js")));
|
|
||||||
let pack = dir.path().join("line-2.icons.json");
|
|
||||||
std::fs::write(&pack, ICONS).unwrap();
|
|
||||||
assert_eq!(store.receive_file(&pack).opened.unwrap().kind, Kind::Icons);
|
|
||||||
let strings = dir.path().join("eo.strings.json");
|
|
||||||
std::fs::write(&strings, "{}").unwrap();
|
|
||||||
assert_eq!(store.receive_file(&strings).opened.unwrap().kind, Kind::Strings);
|
|
||||||
|
|
||||||
// Refused up front, with an error for the shell: other files, folders, missing and oversize files.
|
|
||||||
let other = dir.path().join("photo.png");
|
|
||||||
std::fs::write(&other, "x").unwrap();
|
|
||||||
let big = dir.path().join("big.json");
|
|
||||||
std::fs::write(&big, vec![b'a'; dist::MAX_THEME_BYTES + 1]).unwrap();
|
|
||||||
for bad in [other, big, dir.path().to_path_buf(), dir.path().join("missing.json")] {
|
|
||||||
let event = store.receive_file(&bad);
|
|
||||||
assert!(event.opened.is_none() && event.error.as_deref().is_some_and(|error| error.starts_with("FILE:")), "{}: {:?}", bad.display(), event.error);
|
|
||||||
}
|
|
||||||
// A file that grew after it was offered is refused when read; one that vanished says so.
|
|
||||||
let late = dir.path().join("late.json");
|
|
||||||
std::fs::write(&late, THEME).unwrap();
|
|
||||||
let opened = store.receive_file(&late).opened.unwrap();
|
|
||||||
std::fs::write(&late, vec![b'a'; dist::MAX_THEME_BYTES + 1]).unwrap();
|
|
||||||
assert!(store.stage_opened(&opened.id).unwrap_err().contains("larger"));
|
|
||||||
let gone = dir.path().join("gone.json");
|
|
||||||
std::fs::write(&gone, THEME).unwrap();
|
|
||||||
let opened = store.receive_file(&gone).opened.unwrap();
|
|
||||||
std::fs::remove_file(&gone).unwrap();
|
|
||||||
assert!(store.stage_opened(&opened.id).unwrap_err().starts_with("FILE:"));
|
|
||||||
// Bounded: only the newest ones are kept.
|
|
||||||
let ids: Vec<String> = (0..MAX_OPENED + 3)
|
|
||||||
.map(|_| {
|
|
||||||
std::thread::sleep(Duration::from_millis(2));
|
|
||||||
store.receive_file(&theme).opened.unwrap().id
|
|
||||||
})
|
|
||||||
.collect();
|
|
||||||
assert_eq!(store.lock().opened.len(), MAX_OPENED);
|
|
||||||
assert!(store.stage_opened(&ids[0]).is_err() && store.stage_opened(ids.last().unwrap()).is_ok());
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn staging_is_bounded() {
|
fn staging_is_bounded() {
|
||||||
let (_dir, store, _, _) = store_with_catalog();
|
let (_dir, store, _, _) = store_with_catalog();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
//! Store downloads (`net` feature): allow-listed https only, no redirects, no cookies, size caps.
|
//! Store downloads (`net` feature): allow-listed https only, no redirects, no cookies, size caps.
|
||||||
|
|
||||||
use super::catalog::{self as dist, StoreConfig, CATALOG_FILE, CATALOG_FILE_NEXT, MAX_CATALOG_BYTES, MAX_SIGNATURE_BYTES};
|
use super::catalog::{self as dist, StoreConfig, MAX_CATALOG_BYTES, MAX_SIGNATURE_BYTES};
|
||||||
use super::install::{InstallPreview, Store, StoreItemRef, StoreView};
|
use super::install::{InstallPreview, Store, StoreItemRef, StoreView};
|
||||||
use std::sync::OnceLock;
|
use std::sync::OnceLock;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
@ -48,13 +48,6 @@ pub async fn fetch(config: &StoreConfig, url: &str, max: usize) -> Result<Vec<u8
|
||||||
Ok(bytes)
|
Ok(bytes)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A catalog file and its detached signature.
|
|
||||||
async fn fetch_pair(config: &StoreConfig, url: &str) -> Result<(Vec<u8>, String), String> {
|
|
||||||
let body = fetch(config, url, MAX_CATALOG_BYTES).await?;
|
|
||||||
let signature = fetch(config, &format!("{url}.sig"), MAX_SIGNATURE_BYTES).await?;
|
|
||||||
Ok((body, String::from_utf8(signature).map_err(|_| "STORE: invalid signature")?))
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Store {
|
impl Store {
|
||||||
/// Downloads what an install link points at and stages it for the confirmation screen.
|
/// Downloads what an install link points at and stages it for the confirmation screen.
|
||||||
pub async fn stage_link(&self, kind: &str, url: &str) -> Result<InstallPreview, String> {
|
pub async fn stage_link(&self, kind: &str, url: &str) -> Result<InstallPreview, String> {
|
||||||
|
|
@ -86,16 +79,12 @@ impl Store {
|
||||||
self.view(error)
|
self.view(error)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The newer catalog first (`catalog.v3.json`: every kind), then `catalog.json` (what every app
|
|
||||||
/// knows) when the newer one is not there. A newer catalog that is there but does not verify is an
|
|
||||||
/// error, never a reason to fall back.
|
|
||||||
async fn fetch_catalog(&self) -> Result<(), String> {
|
async fn fetch_catalog(&self) -> Result<(), String> {
|
||||||
let base = self.config().store_base;
|
let base = self.config().store_base;
|
||||||
let pair = match fetch_pair(self.config(), &format!("{base}{CATALOG_FILE_NEXT}")).await {
|
let body = fetch(self.config(), &format!("{base}catalog.json"), MAX_CATALOG_BYTES).await?;
|
||||||
Ok(pair) => pair,
|
let signature = fetch(self.config(), &format!("{base}catalog.json.sig"), MAX_SIGNATURE_BYTES).await?;
|
||||||
Err(_) => fetch_pair(self.config(), &format!("{base}{CATALOG_FILE}")).await?,
|
let signature = String::from_utf8(signature).map_err(|_| "STORE: invalid signature")?;
|
||||||
};
|
self.accept_catalog(&body, &signature)
|
||||||
self.accept_catalog(&pair.0, &pair.1)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -101,28 +101,7 @@ pub fn validate_strings(bytes: &[u8]) -> Result<StringsInfo, String> {
|
||||||
return Err(format!("VALIDATION: string {} is not plain text", id.chars().take(64).collect::<String>()));
|
return Err(format!("VALIDATION: string {} is not plain text", id.chars().take(64).collect::<String>()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Conditions and rewording rules are data too: shapes are checked here, words and values by the page runtime's own validator.
|
const KNOWN: &[&str] = &["$schema", "format", "site", "catalog", "language", "base", "name", "authors", "version", "description", "strings"];
|
||||||
if let Some(when) = object.get("when") {
|
|
||||||
let ok = when.as_object().is_some_and(|w| {
|
|
||||||
w.keys().all(|key| key == "languages")
|
|
||||||
&& w.get("languages").and_then(serde_json::Value::as_array).is_some_and(|list| !list.is_empty() && list.len() <= 16 && list.iter().all(|tag| tag.as_str().is_some_and(valid_language)))
|
|
||||||
});
|
|
||||||
if !ok {
|
|
||||||
return Err("VALIDATION: invalid \"when\"".into());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if let Some(rewrite) = object.get("rewrite") {
|
|
||||||
let ok = rewrite.as_object().is_some_and(|r| {
|
|
||||||
r.keys().all(|key| key == "words")
|
|
||||||
&& r.get("words").and_then(serde_json::Value::as_object).is_some_and(|words| {
|
|
||||||
!words.is_empty() && words.len() <= 64 && words.iter().all(|(from, to)| from.chars().count() <= 40 && to.as_str().is_some_and(|to| plain(to, 40) && !to.contains(['<', '>', '{', '}'])) && !from.contains(['<', '>', '{', '}']) && !from.is_empty())
|
|
||||||
})
|
|
||||||
});
|
|
||||||
if !ok {
|
|
||||||
return Err("VALIDATION: invalid \"rewrite\"".into());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const KNOWN: &[&str] = &["$schema", "format", "site", "catalog", "language", "base", "when", "rewrite", "name", "authors", "version", "description", "strings"];
|
|
||||||
if let Some(key) = object.keys().find(|key| !KNOWN.contains(&key.as_str())) {
|
if let Some(key) = object.keys().find(|key| !KNOWN.contains(&key.as_str())) {
|
||||||
return Err(format!("VALIDATION: unknown field \"{}\"", key.chars().take(40).collect::<String>()));
|
return Err(format!("VALIDATION: unknown field \"{}\"", key.chars().take(40).collect::<String>()));
|
||||||
}
|
}
|
||||||
|
|
@ -382,26 +361,6 @@ mod tests {
|
||||||
format!(r#"{{"format":1,"site":"x","catalog":"web","language":"eo","name":"Esperanto","authors":["A"],"version":"1.0.0","strings":{strings}}}"#).into_bytes()
|
format!(r#"{{"format":1,"site":"x","catalog":"web","language":"eo","name":"Esperanto","authors":["A"],"version":"1.0.0","strings":{strings}}}"#).into_bytes()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn conditions_and_rewording_rules_are_plain_data() {
|
|
||||||
let with = |extra: &str| format!(r#"{{"format":1,"site":"x","catalog":"web","language":"en-x-twitter","name":"W","authors":["A"],{extra},"strings":{{}}}}"#).into_bytes();
|
|
||||||
let info = validate_strings(&with(r#""when":{"languages":["en","en-GB"]},"rewrite":{"words":{"Post":"Tweet","posts":"tweets"}}"#)).unwrap();
|
|
||||||
assert_eq!((info.language.as_str(), info.strings), ("en-x-twitter", 0));
|
|
||||||
for bad in [
|
|
||||||
r#""when":{"languages":[]}"#,
|
|
||||||
r#""when":{"languages":["not a tag"]}"#,
|
|
||||||
r#""when":{"code":"x"}"#,
|
|
||||||
r#""when":"en""#,
|
|
||||||
r#""rewrite":{"words":{}}"#,
|
|
||||||
r#""rewrite":{"words":{"Post":"<b>Tweet</b>"}}"#,
|
|
||||||
r#""rewrite":{"words":{"Post":"{x}"}}"#,
|
|
||||||
r#""rewrite":{"words":{"Post":1}}"#,
|
|
||||||
r#""rewrite":{"words":{"Post":"Tweet"},"code":"x"}"#,
|
|
||||||
] {
|
|
||||||
assert!(validate_strings(&with(bad)).is_err(), "{bad}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn packs_are_plain_data_with_the_envelope() {
|
fn packs_are_plain_data_with_the_envelope() {
|
||||||
let info = validate_strings(&pack(r#"{"a0000001":"Hejmo","b0000002":"{count, plural, one {# afiŝo} other {# afiŝoj}}"}"#)).unwrap();
|
let info = validate_strings(&pack(r#"{"a0000001":"Hejmo","b0000002":"{count, plural, one {# afiŝo} other {# afiŝoj}}"}"#)).unwrap();
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ use crate::host::{emit_shell, eval_in_site_tabs, shell_only};
|
||||||
use crate::plugins::ScriptPlugin;
|
use crate::plugins::ScriptPlugin;
|
||||||
use crate::policy;
|
use crate::policy;
|
||||||
use crate::store::{delivery_script, InstallOutcome, InstallPreview, InstallRecords, LinkEvent, Store, StoreItemRef, StoreView, StringsList, EVENT_LINK};
|
use crate::store::{delivery_script, InstallOutcome, InstallPreview, InstallRecords, LinkEvent, Store, StoreItemRef, StoreView, StringsList, EVENT_LINK};
|
||||||
use std::path::{Path, PathBuf};
|
|
||||||
use tauri::{AppHandle, Manager, State, Webview};
|
use tauri::{AppHandle, Manager, State, Webview};
|
||||||
use tauri_plugin_deep_link::DeepLinkExt;
|
use tauri_plugin_deep_link::DeepLinkExt;
|
||||||
|
|
||||||
|
|
@ -41,63 +40,18 @@ pub(crate) fn init(app: &AppHandle, config: &AppConfig) {
|
||||||
received(app, url.as_str());
|
received(app, url.as_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Launched by a double-click or "Open with" on a file (Windows/Linux pass its path as an argument).
|
|
||||||
let args: Vec<String> = std::env::args().collect();
|
|
||||||
opened_args(app, &args, "");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Most files taken from one launch's arguments.
|
|
||||||
const MAX_OPENED_ARGS: usize = 8;
|
|
||||||
|
|
||||||
/// The files named in a launch's arguments (the first launch's own, or a second launch forwarded
|
|
||||||
/// by single-instance, with its working directory): flags and links are not files and are skipped;
|
|
||||||
/// each file that exists is kept under a random id and offered to the shell
|
|
||||||
/// ([`Store::receive_file`]), and the window comes forward. Nothing is read or installed here.
|
|
||||||
pub(crate) fn opened_args(app: &AppHandle, args: &[String], cwd: &str) {
|
|
||||||
let paths = file_args(args, cwd);
|
|
||||||
if paths.is_empty() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let Some(store) = app.try_state::<Store>() else { return };
|
|
||||||
for path in paths {
|
|
||||||
emit_shell(app, EVENT_LINK, store.receive_file(&path));
|
|
||||||
}
|
|
||||||
bring_forward(app);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The existing files among a launch's arguments (the first argument is the program itself).
|
|
||||||
fn file_args(args: &[String], cwd: &str) -> Vec<PathBuf> {
|
|
||||||
args.iter()
|
|
||||||
.skip(1)
|
|
||||||
.filter(|arg| !arg.starts_with('-') && !arg.contains("://"))
|
|
||||||
.map(|arg| if Path::new(arg).is_absolute() || cwd.is_empty() { PathBuf::from(arg) } else { Path::new(cwd).join(arg) })
|
|
||||||
.filter(|path| path.is_file())
|
|
||||||
.take(MAX_OPENED_ARGS)
|
|
||||||
.collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn bring_forward(app: &AppHandle) {
|
|
||||||
if let Some(window) = app.get_window(policy::MAIN_LABEL) {
|
|
||||||
let _ = window.unminimize();
|
|
||||||
let _ = window.show();
|
|
||||||
let _ = window.set_focus();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A `waybetter://` link reached the app: validate it, queue it for the shell and bring the window
|
/// A `waybetter://` link reached the app: validate it, queue it for the shell and bring the window
|
||||||
/// forward. Nothing is downloaded or installed until the shell's screen asks for it.
|
/// forward. Nothing is downloaded or installed until the shell's screen asks for it.
|
||||||
fn received(app: &AppHandle, raw: &str) {
|
fn received(app: &AppHandle, raw: &str) {
|
||||||
let Some(store) = app.try_state::<Store>() else { return };
|
let Some(store) = app.try_state::<Store>() else { return };
|
||||||
// macOS hands a double-clicked file over as an open-URL event with a `file://` URL.
|
emit_shell(app, EVENT_LINK, store.receive_link(raw));
|
||||||
let event = match url::Url::parse(raw).ok().filter(|url| url.scheme() == "file") {
|
if let Some(window) = app.get_window(policy::MAIN_LABEL) {
|
||||||
Some(url) => match url.to_file_path() {
|
let _ = window.unminimize();
|
||||||
Ok(path) => store.receive_file(&path),
|
let _ = window.show();
|
||||||
Err(()) => store.receive_file(Path::new("")),
|
let _ = window.set_focus();
|
||||||
},
|
}
|
||||||
None => store.receive_link(raw),
|
|
||||||
};
|
|
||||||
emit_shell(app, EVENT_LINK, event);
|
|
||||||
bring_forward(app);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn store(app: &AppHandle) -> Result<State<'_, Store>, String> {
|
fn store(app: &AppHandle) -> Result<State<'_, Store>, String> {
|
||||||
|
|
@ -129,15 +83,6 @@ pub(crate) async fn install_stage_file(webview: Webview, app: AppHandle, name: S
|
||||||
store(&app)?.stage_file(&name, text)
|
store(&app)?.stage_file(&name, text)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A file the OS handed to the app (a double-click or "Open with"), asked for by the random id the
|
|
||||||
/// `install-link` event carried: native code reads it and stages it exactly like a dropped file,
|
|
||||||
/// for the same install screen. The shell never supplies a path; an unknown id is refused.
|
|
||||||
#[tauri::command]
|
|
||||||
pub(crate) async fn install_stage_opened(webview: Webview, app: AppHandle, id: String) -> Result<InstallPreview, String> {
|
|
||||||
shell_only(&webview)?;
|
|
||||||
store(&app)?.stage_opened(&id)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub(crate) async fn install_cancel(webview: Webview, app: AppHandle, token: String) -> Result<(), String> {
|
pub(crate) async fn install_cancel(webview: Webview, app: AppHandle, token: String) -> Result<(), String> {
|
||||||
shell_only(&webview)?;
|
shell_only(&webview)?;
|
||||||
|
|
@ -244,7 +189,6 @@ pub(crate) fn handler() -> impl Fn(tauri::ipc::Invoke<tauri::Wry>) -> bool + Sen
|
||||||
install_pending,
|
install_pending,
|
||||||
install_stage_link,
|
install_stage_link,
|
||||||
install_stage_file,
|
install_stage_file,
|
||||||
install_stage_opened,
|
|
||||||
install_cancel,
|
install_cancel,
|
||||||
install_commit,
|
install_commit,
|
||||||
plugin_remove,
|
plugin_remove,
|
||||||
|
|
@ -259,30 +203,3 @@ pub(crate) fn handler() -> impl Fn(tauri::ipc::Invoke<tauri::Wry>) -> bool + Sen
|
||||||
strings_apply
|
strings_apply
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
fn args(list: &[&str]) -> Vec<String> {
|
|
||||||
list.iter().map(|arg| (*arg).to_owned()).collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn launch_arguments_name_files_never_flags_or_links() {
|
|
||||||
let dir = std::env::temp_dir().join(format!("wb-opened-{}", std::process::id()));
|
|
||||||
std::fs::create_dir_all(&dir).unwrap();
|
|
||||||
let theme = dir.join("nord.json");
|
|
||||||
std::fs::write(&theme, "{}").unwrap();
|
|
||||||
let absolute = theme.to_string_lossy().into_owned();
|
|
||||||
let found = file_args(&args(&["wayBetter.exe", "--diag", "waybetter://install?kind=theme&url=https://waybetter.fyi/a.json", "file:///x.json", "missing.json", &absolute]), "");
|
|
||||||
assert_eq!(found, [theme.clone()], "the program, flags, links and missing files are skipped");
|
|
||||||
// A second launch's relative name is resolved against its own working directory.
|
|
||||||
let found = file_args(&args(&["wayBetter.exe", "nord.json"]), &dir.to_string_lossy());
|
|
||||||
assert_eq!(found, [dir.join("nord.json")]);
|
|
||||||
assert!(file_args(&args(&["wayBetter.exe", &dir.to_string_lossy()]), "").is_empty(), "a folder is not a file");
|
|
||||||
let many: Vec<String> = std::iter::once("wayBetter.exe".to_owned()).chain((0..20).map(|_| absolute.clone())).collect();
|
|
||||||
assert_eq!(file_args(&many, "").len(), MAX_OPENED_ARGS);
|
|
||||||
std::fs::remove_dir_all(&dir).unwrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,71 +0,0 @@
|
||||||
//! The plugin commands in the shell's command palette, native side, for every app: the list each
|
|
||||||
//! site tab last reported ([`reported`]; validated by [`crate::plugins::commands`]), kept per tab,
|
|
||||||
//! forwarded to the shell, and the check behind the shell-only `tab_run_command` ([`run`]: only a
|
|
||||||
//! command that tab reported, only while it is on the site; the command's code runs in the page).
|
|
||||||
|
|
||||||
use crate::app::config;
|
|
||||||
use crate::host::{emit_shell, tab_webview};
|
|
||||||
use crate::plugins::commands::{self as palette, PaletteCommand};
|
|
||||||
use serde::Serialize;
|
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::sync::{Mutex, MutexGuard, OnceLock};
|
|
||||||
use tauri::{AppHandle, Webview};
|
|
||||||
|
|
||||||
fn lists() -> MutexGuard<'static, HashMap<String, Vec<PaletteCommand>>> {
|
|
||||||
static LISTS: OnceLock<Mutex<HashMap<String, Vec<PaletteCommand>>>> = OnceLock::new();
|
|
||||||
LISTS.get_or_init(Default::default).lock().unwrap_or_else(|poisoned| poisoned.into_inner())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Stores what tab `label` has (empty = none) and tells the shell when it changed.
|
|
||||||
fn store(app: &AppHandle, label: &str, list: Vec<PaletteCommand>) {
|
|
||||||
let Some(id) = crate::policy::tab_id(label) else { return };
|
|
||||||
let changed = {
|
|
||||||
let mut lists = lists();
|
|
||||||
let changed = lists.get(label).map(Vec::as_slice).unwrap_or(&[]) != list.as_slice();
|
|
||||||
if list.is_empty() {
|
|
||||||
lists.remove(label);
|
|
||||||
} else {
|
|
||||||
lists.insert(label.to_owned(), list.clone());
|
|
||||||
}
|
|
||||||
changed
|
|
||||||
};
|
|
||||||
if changed {
|
|
||||||
#[derive(Clone, Serialize)]
|
|
||||||
struct Commands {
|
|
||||||
id: String,
|
|
||||||
commands: Vec<PaletteCommand>,
|
|
||||||
}
|
|
||||||
emit_shell(app, palette::EVENT, Commands { id: id.to_owned(), commands: list });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A new document started in tab `label`: its plugins register their commands again.
|
|
||||||
pub(crate) fn cleared(app: &AppHandle, label: &str) {
|
|
||||||
store(app, label, Vec::new());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A tab reported its commands. Accepted only from a tab that is on the site right now; the list
|
|
||||||
/// is validated as a whole (any bad entry rejects the report).
|
|
||||||
pub fn reported(app: &AppHandle, webview: &Webview, list: Vec<PaletteCommand>) -> Result<(), String> {
|
|
||||||
if !webview.url().is_ok_and(|url| config(app).site.is_origin(&url)) {
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
store(app, webview.label(), palette::validate(list)?);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Runs command `command` in tab `id` (the caller checked it is the shell).
|
|
||||||
pub(crate) fn run(app: &AppHandle, id: &str, command: &str) -> Result<(), String> {
|
|
||||||
let label = crate::policy::tab_label(id);
|
|
||||||
if !lists().get(&label).is_some_and(|list| list.iter().any(|item| item.id == command)) {
|
|
||||||
return Err("VALIDATION: that tab has no such command".into());
|
|
||||||
}
|
|
||||||
let site = config(app).site;
|
|
||||||
let tab = tab_webview(app, id).ok_or("VALIDATION: no such tab")?;
|
|
||||||
if !tab.url().is_ok_and(|url| site.is_origin(&url)) {
|
|
||||||
return Err("VALIDATION: the tab is not on the site".into());
|
|
||||||
}
|
|
||||||
let script = palette::run_script(site, command)?;
|
|
||||||
let _ = tab.set_focus();
|
|
||||||
tab.eval(&script).map_err(|error| format!("TABS: {error}"))
|
|
||||||
}
|
|
||||||
|
|
@ -217,11 +217,6 @@ pub fn assert_store_guards() {
|
||||||
for command in commands::STORE {
|
for command in commands::STORE {
|
||||||
assert_guarded(source, command, "shell_only(&webview)?");
|
assert_guarded(source, command, "shell_only(&webview)?");
|
||||||
}
|
}
|
||||||
// A file the OS handed over is asked for by its random id: the command takes no path, so the
|
|
||||||
// shell cannot make native code read a file of its own choosing.
|
|
||||||
let at = source.find("fn install_stage_opened(").expect("install_stage_opened exists");
|
|
||||||
let signature = &source[at..at + source[at..].find(')').expect("signature")];
|
|
||||||
assert!(signature.contains("id: String") && !signature.contains("path") && !signature.contains("PathBuf"), "install_stage_opened takes an id only: {signature}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The media commands' wrappers check their caller first. Runs against the host's source.
|
/// The media commands' wrappers check their caller first. Runs against the host's source.
|
||||||
|
|
@ -264,30 +259,6 @@ pub fn assert_dev_guards() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The theme commands' wrappers check their caller first. Runs against the host's source.
|
|
||||||
pub fn assert_theme_guards() {
|
|
||||||
let source = include_str!("theme_commands.rs");
|
|
||||||
for command in commands::THEME {
|
|
||||||
assert_guarded(source, command, "shell_only(&webview)?");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The alert settings' wrappers check their caller first. Runs against the host's source.
|
|
||||||
pub fn assert_alerts_guards() {
|
|
||||||
let source = include_str!("alerts_commands.rs");
|
|
||||||
for command in commands::ALERTS {
|
|
||||||
assert_guarded(source, command, "shell_only(&webview)?");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The vault commands' wrappers check their caller first. Runs against the host's source.
|
|
||||||
pub fn assert_vault_guards() {
|
|
||||||
let source = include_str!("vault_commands.rs");
|
|
||||||
for command in commands::VAULT {
|
|
||||||
assert_guarded(source, command, "shell_only(&webview)?");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The backup commands' wrappers check their caller first. Runs against the host's source.
|
/// The backup commands' wrappers check their caller first. Runs against the host's source.
|
||||||
pub fn assert_backup_guards() {
|
pub fn assert_backup_guards() {
|
||||||
let source = include_str!("backup_commands.rs");
|
let source = include_str!("backup_commands.rs");
|
||||||
|
|
@ -309,9 +280,6 @@ mod tests {
|
||||||
assert_sync_guards();
|
assert_sync_guards();
|
||||||
assert_dev_guards();
|
assert_dev_guards();
|
||||||
assert_backup_guards();
|
assert_backup_guards();
|
||||||
assert_theme_guards();
|
|
||||||
assert_alerts_guards();
|
|
||||||
assert_vault_guards();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn caps_with(shell_extra: &str, tab_extra: &str, site_extra: &str) -> Capabilities {
|
fn caps_with(shell_extra: &str, tab_extra: &str, site_extra: &str) -> Capabilities {
|
||||||
|
|
|
||||||
|
|
@ -16,18 +16,6 @@ use serde::{Deserialize, Serialize};
|
||||||
use serde_json::{Map, Value};
|
use serde_json::{Map, Value};
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
/// What an app declares about its themes for the host's theme commands
|
|
||||||
/// ([`crate::theme_commands`]): the built-in ones and where the owner's choice is saved (app data
|
|
||||||
/// file names).
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
|
||||||
pub struct ThemeConfig {
|
|
||||||
pub site: &'static ThemeSite,
|
|
||||||
/// The owner's theme choice (absent = the site's own look).
|
|
||||||
pub file: &'static str,
|
|
||||||
/// Account and pane themes and the chrome setting (absent = defaults).
|
|
||||||
pub scopes_file: &'static str,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A site's built-in themes. The first preset is the site's own look (the default choice).
|
/// A site's built-in themes. The first preset is the site's own look (the default choice).
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
pub struct ThemeSite {
|
pub struct ThemeSite {
|
||||||
|
|
@ -314,17 +302,6 @@ impl ThemeScopes {
|
||||||
pub fn for_tab(&self, site: &ThemeSite, global: &ThemeChoice, tab: &str, profile: Option<&str>) -> ThemeChoice {
|
pub fn for_tab(&self, site: &ThemeSite, global: &ThemeChoice, tab: &str, profile: Option<&str>) -> ThemeChoice {
|
||||||
global.for_theme(site, self.theme_id(site, global, tab, profile))
|
global.for_theme(site, self.theme_id(site, global, tab, profile))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// What site tab `tab` shows with the Theme Builder's (or developer mode's) `preview` in play: a
|
|
||||||
/// pane the owner gave a theme of its own keeps it, every other tab shows the preview. A preview
|
|
||||||
/// replaces the global theme, not a choice made for one pane (a preview left on must not make
|
|
||||||
/// "Theme for this pane" look broken).
|
|
||||||
pub fn for_tab_with_preview(&self, site: &ThemeSite, global: &ThemeChoice, preview: Option<&ThemeChoice>, tab: &str, profile: Option<&str>) -> ThemeChoice {
|
|
||||||
match preview {
|
|
||||||
Some(preview) if !self.panes.get(tab).is_some_and(|id| global.knows(site, id)) => preview.clone(),
|
|
||||||
_ => self.for_tab(site, global, tab, profile),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
@ -342,17 +319,6 @@ mod tests {
|
||||||
theme.validate(&SITE).map(|()| theme)
|
theme.validate(&SITE).map(|()| theme)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn a_preview_replaces_the_global_theme_but_not_a_pane_theme() {
|
|
||||||
let global = ThemeChoice { preset: "paper".into(), ..ThemeChoice::default_for(&SITE) };
|
|
||||||
let preview = ThemeChoice { preset: "nord".into(), ..ThemeChoice::default_for(&SITE) };
|
|
||||||
let scopes = ThemeScopes { panes: [("pane1".to_string(), "night-ink".to_string())].into_iter().collect(), ..ThemeScopes::default() };
|
|
||||||
assert_eq!(scopes.for_tab_with_preview(&SITE, &global, Some(&preview), "pane1", None).preset, "night-ink");
|
|
||||||
assert_eq!(scopes.for_tab_with_preview(&SITE, &global, Some(&preview), "other", None).preset, "nord");
|
|
||||||
assert_eq!(scopes.for_tab_with_preview(&SITE, &global, None, "pane1", None).preset, "night-ink");
|
|
||||||
assert_eq!(scopes.for_tab_with_preview(&SITE, &global, None, "other", None).preset, "paper");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn page_color_follows_the_shown_theme() {
|
fn page_color_follows_the_shown_theme() {
|
||||||
let preset = |id: &str| ThemeChoice { preset: id.into(), ..ThemeChoice::default_for(&SITE) };
|
let preset = |id: &str| ThemeChoice { preset: id.into(), ..ThemeChoice::default_for(&SITE) };
|
||||||
|
|
|
||||||
|
|
@ -1,219 +0,0 @@
|
||||||
//! Site themes, native side, for every app that sets [`crate::app::AppConfig::themes`]: the
|
|
||||||
//! shell-only `theme_*` commands ([`crate::commands::THEME`]) over [`crate::theme`]'s state (the
|
|
||||||
//! owner's theme, the account and pane themes, the Theme Builder's preview). The app only names
|
|
||||||
//! its built-in themes ([`ThemeConfig`]) and the two files they are saved in.
|
|
||||||
//!
|
|
||||||
//! Site tabs gain no command: native code evaluates the theme script (and the cached Google font
|
|
||||||
//! bytes it needs) in every site tab and sets each tab's native background to its theme's page color.
|
|
||||||
//! The app's own writers (a backup import, developer mode's theme file) use [`set_theme`],
|
|
||||||
//! [`set_scopes`] and [`set_preview`], then [`apply`].
|
|
||||||
|
|
||||||
use crate::app::{config, tab_profile};
|
|
||||||
use crate::host::{data_file, read_json, shell_only, write_json};
|
|
||||||
use crate::theme::{ThemeChoice, ThemeScopes};
|
|
||||||
use std::sync::{Mutex, MutexGuard};
|
|
||||||
use tauri::{AppHandle, Manager, Webview};
|
|
||||||
|
|
||||||
pub use crate::theme::ThemeConfig;
|
|
||||||
|
|
||||||
#[derive(Default)]
|
|
||||||
struct Themes {
|
|
||||||
theme: Option<ThemeChoice>,
|
|
||||||
scopes: ThemeScopes,
|
|
||||||
/// The Theme Builder's unsaved draft, shown in every site tab until it ends.
|
|
||||||
preview: Option<ThemeChoice>,
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ThemeState(Mutex<Themes>);
|
|
||||||
|
|
||||||
/// Loads the saved theme and scopes (anything that no longer validates is dropped). Does nothing
|
|
||||||
/// unless the app set [`crate::app::AppConfig::themes`].
|
|
||||||
pub(crate) fn init(app: &AppHandle) {
|
|
||||||
let Some(themes) = config(app).themes else { return };
|
|
||||||
let theme = read_json::<ThemeChoice>(app, themes.file).filter(|theme| theme.validate(themes.site).is_ok());
|
|
||||||
let scopes = read_json::<ThemeScopes>(app, themes.scopes_file).filter(|scopes| scopes.validate().is_ok()).unwrap_or_default();
|
|
||||||
app.manage(ThemeState(Mutex::new(Themes { theme, scopes, preview: None })));
|
|
||||||
}
|
|
||||||
|
|
||||||
fn themes(app: &AppHandle) -> Result<&'static ThemeConfig, String> {
|
|
||||||
config(app).themes.ok_or_else(|| "UNAVAILABLE: this app has no themes".to_owned())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn state(app: &AppHandle) -> Result<MutexGuard<'_, Themes>, String> {
|
|
||||||
app.try_state::<ThemeState>()
|
|
||||||
.ok_or("DATABASE: theme state unavailable; restart safely")?
|
|
||||||
.inner()
|
|
||||||
.0
|
|
||||||
.lock()
|
|
||||||
.map_err(|_| "DATABASE: theme state unavailable; restart safely".into())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The theme the owner chose (the site's own look when none).
|
|
||||||
pub fn current(app: &AppHandle) -> Result<ThemeChoice, String> {
|
|
||||||
let themes = themes(app)?;
|
|
||||||
Ok(state(app)?.theme.clone().unwrap_or_else(|| ThemeChoice::default_for(themes.site)))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Account and pane themes and the chrome setting.
|
|
||||||
pub fn scopes(app: &AppHandle) -> Result<ThemeScopes, String> {
|
|
||||||
Ok(state(app)?.scopes.clone())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The theme for site tab webview `label`: its pane's own theme; else the Theme Builder's preview
|
|
||||||
/// while one is open; else its account's or the global theme.
|
|
||||||
fn tab_theme(app: &AppHandle, themes: &ThemeConfig, state: &Themes, label: &str) -> ThemeChoice {
|
|
||||||
let global = state.theme.clone().unwrap_or_else(|| ThemeChoice::default_for(themes.site));
|
|
||||||
let tab = crate::policy::tab_id(label).unwrap_or_default();
|
|
||||||
state.scopes.for_tab_with_preview(themes.site, &global, state.preview.as_ref(), tab, tab_profile(app, label).as_deref())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn background(theme: &ThemeChoice, themes: &ThemeConfig) -> Option<tauri::window::Color> {
|
|
||||||
theme.page_color(themes.site).map(|(r, g, b)| tauri::window::Color(r, g, b, 255))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn scripts_for(app: &AppHandle, themes: &ThemeConfig, theme: &ThemeChoice) -> Vec<String> {
|
|
||||||
let site = config(app).site;
|
|
||||||
let mut scripts = Vec::new();
|
|
||||||
#[cfg(feature = "net")]
|
|
||||||
if let Some(fonts) = crate::fonts::page_script_for(site, &theme.google_fonts()) {
|
|
||||||
scripts.push(fonts);
|
|
||||||
}
|
|
||||||
if let Ok(script) = theme.script(themes.site, site) {
|
|
||||||
scripts.push(script);
|
|
||||||
}
|
|
||||||
scripts
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The native background of site tab `label` until its page paints: its theme's page color.
|
|
||||||
pub fn tab_background(app: &AppHandle, label: &str) -> Option<tauri::window::Color> {
|
|
||||||
let themes = config(app).themes?;
|
|
||||||
let state = state(app).ok()?;
|
|
||||||
background(&tab_theme(app, themes, &state, label), themes)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The scripts a freshly loaded site document in tab `label` gets for its theme (and the font
|
|
||||||
/// bytes it needs); none while the site keeps its own look.
|
|
||||||
pub fn page_scripts(app: &AppHandle, label: &str) -> Vec<String> {
|
|
||||||
let Some(themes) = config(app).themes else { return Vec::new() };
|
|
||||||
let Ok(state) = state(app) else { return Vec::new() };
|
|
||||||
if state.theme.is_none() && state.preview.is_none() && state.scopes.is_default() {
|
|
||||||
return Vec::new();
|
|
||||||
}
|
|
||||||
scripts_for(app, themes, &tab_theme(app, themes, &state, label))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Sends every site tab its theme again (after the theme, the scopes, the preview or the fonts
|
|
||||||
/// changed). In safe mode site pages keep the site's own look; a theme chosen meanwhile applies
|
|
||||||
/// when safe mode is left.
|
|
||||||
pub fn apply(app: &AppHandle) {
|
|
||||||
if crate::safe::active() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let Some(themes) = config(app).themes else { return };
|
|
||||||
let site = config(app).site;
|
|
||||||
let per_tab: Vec<(Webview, ThemeChoice)> = {
|
|
||||||
let Ok(state) = state(app) else { return };
|
|
||||||
app.webviews()
|
|
||||||
.into_iter()
|
|
||||||
.filter(|(label, tab)| crate::policy::tab_id(label).is_some() && tab.url().is_ok_and(|url| site.is_origin(&url)))
|
|
||||||
.map(|(label, tab)| (tab, tab_theme(app, themes, &state, &label)))
|
|
||||||
.collect()
|
|
||||||
};
|
|
||||||
for (tab, theme) in per_tab {
|
|
||||||
let _ = tab.set_background_color(background(&theme, themes));
|
|
||||||
for script in scripts_for(app, themes, &theme) {
|
|
||||||
let _ = tab.eval(&script);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Saves the owner's theme (checked against the built-in ones; `None` or an unchanged site look
|
|
||||||
/// removes the file). Does not apply it: call [`apply`].
|
|
||||||
pub fn set_theme(app: &AppHandle, theme: Option<ThemeChoice>) -> Result<(), String> {
|
|
||||||
let themes = themes(app)?;
|
|
||||||
let theme = theme.unwrap_or_else(|| ThemeChoice::default_for(themes.site));
|
|
||||||
theme.validate(themes.site)?;
|
|
||||||
if theme.is_empty(themes.site) {
|
|
||||||
if let Some(path) = data_file(app, themes.file) {
|
|
||||||
let _ = std::fs::remove_file(path);
|
|
||||||
}
|
|
||||||
state(app)?.theme = None;
|
|
||||||
} else {
|
|
||||||
write_json(app, themes.file, &theme)?;
|
|
||||||
state(app)?.theme = Some(theme);
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Saves the account and pane themes (bounded, ids checked). Does not apply them: call [`apply`].
|
|
||||||
pub fn set_scopes(app: &AppHandle, scopes: ThemeScopes) -> Result<(), String> {
|
|
||||||
let themes = themes(app)?;
|
|
||||||
scopes.validate()?;
|
|
||||||
if scopes.is_default() {
|
|
||||||
if let Some(path) = data_file(app, themes.scopes_file) {
|
|
||||||
let _ = std::fs::remove_file(path);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
write_json(app, themes.scopes_file, &scopes)?;
|
|
||||||
}
|
|
||||||
state(app)?.scopes = scopes;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Shows an unsaved theme in every site tab (not persisted); `None` ends the preview. Does not
|
|
||||||
/// apply it: call [`apply`].
|
|
||||||
pub fn set_preview(app: &AppHandle, theme: Option<ThemeChoice>) -> Result<(), String> {
|
|
||||||
let themes = themes(app)?;
|
|
||||||
if let Some(theme) = &theme {
|
|
||||||
theme.validate(themes.site)?;
|
|
||||||
}
|
|
||||||
state(app)?.preview = theme;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Applies a theme to every site tab and persists it. `None` (or the site's own preset without an
|
|
||||||
/// accent) restores the site's own look.
|
|
||||||
#[tauri::command]
|
|
||||||
pub(crate) async fn theme_set(webview: Webview, app: AppHandle, theme: Option<ThemeChoice>) -> Result<(), String> {
|
|
||||||
shell_only(&webview)?;
|
|
||||||
set_theme(&app, theme)?;
|
|
||||||
apply(&app);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The persisted theme (the site's own look when none).
|
|
||||||
#[tauri::command]
|
|
||||||
pub(crate) async fn theme_get(webview: Webview, app: AppHandle) -> Result<ThemeChoice, String> {
|
|
||||||
shell_only(&webview)?;
|
|
||||||
current(&app)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Account and pane themes and the chrome setting.
|
|
||||||
#[tauri::command]
|
|
||||||
pub(crate) async fn theme_scopes_get(webview: Webview, app: AppHandle) -> Result<ThemeScopes, String> {
|
|
||||||
shell_only(&webview)?;
|
|
||||||
scopes(&app)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Saves account and pane themes and re-themes every site tab.
|
|
||||||
#[tauri::command]
|
|
||||||
pub(crate) async fn theme_scopes_set(webview: Webview, app: AppHandle, scopes: ThemeScopes) -> Result<(), String> {
|
|
||||||
shell_only(&webview)?;
|
|
||||||
set_scopes(&app, scopes)?;
|
|
||||||
apply(&app);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The Theme Builder's live preview: an unsaved theme shown in every site tab. `None` ends the
|
|
||||||
/// preview and gives every tab its own theme back.
|
|
||||||
#[tauri::command]
|
|
||||||
pub(crate) async fn theme_preview(webview: Webview, app: AppHandle, theme: Option<ThemeChoice>) -> Result<(), String> {
|
|
||||||
shell_only(&webview)?;
|
|
||||||
set_preview(&app, theme)?;
|
|
||||||
apply(&app);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn handler() -> impl Fn(tauri::ipc::Invoke<tauri::Wry>) -> bool + Send + Sync + 'static {
|
|
||||||
tauri::generate_handler![theme_get, theme_set, theme_preview, theme_scopes_get, theme_scopes_set]
|
|
||||||
}
|
|
||||||
|
|
@ -1,492 +0,0 @@
|
||||||
//! The drafts vault: an app's local SQLite store of drafts with CAS revisions, an append-only revision
|
|
||||||
//! history, archive/restore (nothing is ever deleted), the observations table and one consistent
|
|
||||||
//! export. "Saved" means acknowledged: a write returns only after its SQLite transaction committed
|
|
||||||
//! (`synchronous=FULL`, WAL), and a refused write (stale revision, other account, over the budget)
|
|
||||||
//! leaves no trace.
|
|
||||||
//!
|
|
||||||
//! What is the app's is a [`VaultRules`] value: the draft kinds and sources, the size limits, the
|
|
||||||
//! identifier and context checks, and who owns captured drafts (account, source, budget). The schema
|
|
||||||
//! is version 1 and its text is derived from the rules, so a database an app created before the
|
|
||||||
//! vault moved here opens unchanged (pinned by the app's persistence tests).
|
|
||||||
|
|
||||||
use chrono::{SecondsFormat, Utc};
|
|
||||||
use rusqlite::{params, Connection, OptionalExtension, Row, TransactionBehavior};
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use std::{path::Path, time::Duration};
|
|
||||||
|
|
||||||
pub type Result<T> = std::result::Result<T, String>;
|
|
||||||
|
|
||||||
/// Who owns captured drafts and how much of them the vault keeps.
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
|
||||||
pub struct CaptureRules {
|
|
||||||
/// The account every captured draft belongs to (page-reported text never picks it).
|
|
||||||
pub account: &'static str,
|
|
||||||
/// The `source` of captured drafts.
|
|
||||||
pub source: &'static str,
|
|
||||||
pub budget_bytes: i64,
|
|
||||||
pub budget_revisions: i64,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// What an app decides about its drafts.
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
|
||||||
pub struct VaultRules {
|
|
||||||
pub kinds: &'static [&'static str],
|
|
||||||
pub sources: &'static [&'static str],
|
|
||||||
pub max_title_utf16: usize,
|
|
||||||
pub max_text_bytes: usize,
|
|
||||||
pub valid_identifier: fn(&str) -> bool,
|
|
||||||
/// Checked on every save (an empty context is the app's call).
|
|
||||||
pub validate_context: fn(&str) -> Result<()>,
|
|
||||||
pub capture: CaptureRules,
|
|
||||||
}
|
|
||||||
|
|
||||||
fn quoted(values: &[&str]) -> String {
|
|
||||||
values.iter().map(|value| format!("'{value}'")).collect::<Vec<_>>().join(",")
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
|
||||||
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
|
||||||
pub struct Draft {
|
|
||||||
pub id: String,
|
|
||||||
pub account_id: String,
|
|
||||||
pub kind: String,
|
|
||||||
pub title: String,
|
|
||||||
pub text: String,
|
|
||||||
pub context_url: String,
|
|
||||||
pub revision: i64,
|
|
||||||
pub status: String,
|
|
||||||
pub created_at: String,
|
|
||||||
pub updated_at: String,
|
|
||||||
pub source: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
|
||||||
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
|
||||||
pub struct DraftRevision {
|
|
||||||
pub draft_id: String,
|
|
||||||
pub revision: i64,
|
|
||||||
pub title: String,
|
|
||||||
pub text: String,
|
|
||||||
pub context_url: String,
|
|
||||||
pub source: String,
|
|
||||||
pub created_at: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
||||||
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
|
||||||
pub struct SaveDraftInput {
|
|
||||||
pub id: String,
|
|
||||||
pub account_id: String,
|
|
||||||
pub kind: String,
|
|
||||||
pub title: String,
|
|
||||||
pub text: String,
|
|
||||||
pub context_url: String,
|
|
||||||
pub expected_revision: i64,
|
|
||||||
pub source: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
|
||||||
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
|
||||||
pub struct Observation {
|
|
||||||
pub id: String,
|
|
||||||
pub account_id: String,
|
|
||||||
pub user_id: String,
|
|
||||||
pub following: Option<bool>,
|
|
||||||
pub followed_by: Option<bool>,
|
|
||||||
pub observed_at: String,
|
|
||||||
pub source: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize)]
|
|
||||||
#[serde(rename_all = "camelCase")]
|
|
||||||
pub struct ExportData {
|
|
||||||
pub version: u8,
|
|
||||||
pub exported_at: String,
|
|
||||||
pub drafts: Vec<Draft>,
|
|
||||||
pub revisions: Vec<DraftRevision>,
|
|
||||||
pub observations: Vec<Observation>,
|
|
||||||
}
|
|
||||||
|
|
||||||
const SELECT_DRAFT: &str = "SELECT id,account_id,kind,title,text,context_url,revision,status,created_at,updated_at,source FROM drafts";
|
|
||||||
|
|
||||||
pub fn now() -> String {
|
|
||||||
Utc::now().to_rfc3339_opts(SecondsFormat::Millis, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn sql_error(error: rusqlite::Error) -> String {
|
|
||||||
// Database errors never include SQL parameters (draft contents).
|
|
||||||
format!("DATABASE: {error}")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn draft_row(row: &Row<'_>) -> rusqlite::Result<Draft> {
|
|
||||||
Ok(Draft {
|
|
||||||
id: row.get(0)?,
|
|
||||||
account_id: row.get(1)?,
|
|
||||||
kind: row.get(2)?,
|
|
||||||
title: row.get(3)?,
|
|
||||||
text: row.get(4)?,
|
|
||||||
context_url: row.get(5)?,
|
|
||||||
revision: row.get(6)?,
|
|
||||||
status: row.get(7)?,
|
|
||||||
created_at: row.get(8)?,
|
|
||||||
updated_at: row.get(9)?,
|
|
||||||
source: row.get(10)?,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn revision_row(row: &Row<'_>) -> rusqlite::Result<DraftRevision> {
|
|
||||||
Ok(DraftRevision {
|
|
||||||
draft_id: row.get(0)?,
|
|
||||||
revision: row.get(1)?,
|
|
||||||
title: row.get(2)?,
|
|
||||||
text: row.get(3)?,
|
|
||||||
context_url: row.get(4)?,
|
|
||||||
source: row.get(5)?,
|
|
||||||
created_at: row.get(6)?,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn validate_input(rules: &VaultRules, input: &SaveDraftInput) -> Result<()> {
|
|
||||||
if !(rules.valid_identifier)(&input.id) || !(rules.valid_identifier)(&input.account_id) {
|
|
||||||
return Err("VALIDATION: invalid draft or account identifier".into());
|
|
||||||
}
|
|
||||||
if !rules.kinds.contains(&input.kind.as_str())
|
|
||||||
|| !rules.sources.contains(&input.source.as_str())
|
|
||||||
|| !(0..9_007_199_254_740_991).contains(&input.expected_revision)
|
|
||||||
{
|
|
||||||
return Err("VALIDATION: invalid draft kind, source, or revision".into());
|
|
||||||
}
|
|
||||||
if input.title.encode_utf16().count() > rules.max_title_utf16 || input.text.len() > rules.max_text_bytes {
|
|
||||||
return Err("VALIDATION: draft size limit exceeded".into());
|
|
||||||
}
|
|
||||||
(rules.validate_context)(&input.context_url)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct Vault {
|
|
||||||
rules: &'static VaultRules,
|
|
||||||
connection: Connection,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Vault {
|
|
||||||
/// Opens (creating) the database at `path` for `rules`. A database made by a newer schema is refused.
|
|
||||||
pub fn open(path: impl AsRef<Path>, rules: &'static VaultRules) -> Result<Self> {
|
|
||||||
let mut connection = Connection::open(path).map_err(sql_error)?;
|
|
||||||
connection
|
|
||||||
.busy_timeout(Duration::from_secs(5))
|
|
||||||
.map_err(sql_error)?;
|
|
||||||
connection
|
|
||||||
.execute_batch(
|
|
||||||
"PRAGMA journal_mode=WAL; PRAGMA synchronous=FULL; PRAGMA foreign_keys=ON;",
|
|
||||||
)
|
|
||||||
.map_err(sql_error)?;
|
|
||||||
let version: i64 = connection
|
|
||||||
.pragma_query_value(None, "user_version", |row| row.get(0))
|
|
||||||
.map_err(sql_error)?;
|
|
||||||
if version > 1 {
|
|
||||||
return Err("DATABASE: newer schema; use a newer application version".into());
|
|
||||||
}
|
|
||||||
if version == 0 {
|
|
||||||
let tx = connection
|
|
||||||
.transaction_with_behavior(TransactionBehavior::Immediate)
|
|
||||||
.map_err(sql_error)?;
|
|
||||||
tx.execute_batch(&format!(
|
|
||||||
"CREATE TABLE IF NOT EXISTS drafts (
|
|
||||||
id TEXT PRIMARY KEY, account_id TEXT NOT NULL,
|
|
||||||
kind TEXT NOT NULL CHECK(kind IN ({kinds})),
|
|
||||||
title TEXT NOT NULL, text TEXT NOT NULL, context_url TEXT NOT NULL,
|
|
||||||
revision INTEGER NOT NULL CHECK(revision > 0),
|
|
||||||
status TEXT NOT NULL CHECK(status IN ('active','archived')),
|
|
||||||
created_at TEXT NOT NULL, updated_at TEXT NOT NULL,
|
|
||||||
source TEXT NOT NULL CHECK(source IN ({sources}))
|
|
||||||
);
|
|
||||||
CREATE INDEX IF NOT EXISTS drafts_updated ON drafts(updated_at DESC);
|
|
||||||
CREATE TABLE IF NOT EXISTS revisions (
|
|
||||||
draft_id TEXT NOT NULL REFERENCES drafts(id), revision INTEGER NOT NULL,
|
|
||||||
title TEXT NOT NULL, text TEXT NOT NULL, context_url TEXT NOT NULL,
|
|
||||||
source TEXT NOT NULL, created_at TEXT NOT NULL,
|
|
||||||
PRIMARY KEY(draft_id,revision)
|
|
||||||
);
|
|
||||||
CREATE TABLE IF NOT EXISTS observations (
|
|
||||||
id TEXT PRIMARY KEY, account_id TEXT NOT NULL, user_id TEXT NOT NULL,
|
|
||||||
following INTEGER CHECK(following IN (0,1)),
|
|
||||||
followed_by INTEGER CHECK(followed_by IN (0,1)),
|
|
||||||
observed_at TEXT NOT NULL, source TEXT NOT NULL
|
|
||||||
);
|
|
||||||
CREATE TABLE IF NOT EXISTS capture_usage (
|
|
||||||
singleton INTEGER PRIMARY KEY CHECK(singleton=1),
|
|
||||||
stored_bytes INTEGER NOT NULL, revision_count INTEGER NOT NULL
|
|
||||||
);
|
|
||||||
INSERT OR IGNORE INTO capture_usage VALUES(1,0,0);
|
|
||||||
PRAGMA user_version=1;",
|
|
||||||
kinds = quoted(rules.kinds),
|
|
||||||
sources = quoted(rules.sources),
|
|
||||||
))
|
|
||||||
.map_err(sql_error)?;
|
|
||||||
tx.commit().map_err(sql_error)?;
|
|
||||||
}
|
|
||||||
Ok(Self { rules, connection })
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn list_drafts(&self) -> Result<Vec<Draft>> {
|
|
||||||
let mut statement = self
|
|
||||||
.connection
|
|
||||||
.prepare(&format!("{SELECT_DRAFT} ORDER BY updated_at DESC,id"))
|
|
||||||
.map_err(sql_error)?;
|
|
||||||
let rows = statement.query_map([], draft_row).map_err(sql_error)?;
|
|
||||||
rows.collect::<rusqlite::Result<_>>().map_err(sql_error)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn get_draft(&self, id: &str) -> Result<Option<Draft>> {
|
|
||||||
self.connection
|
|
||||||
.query_row(&format!("{SELECT_DRAFT} WHERE id=?1"), [id], draft_row)
|
|
||||||
.optional()
|
|
||||||
.map_err(sql_error)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn save_draft(&mut self, input: &SaveDraftInput) -> Result<Draft> {
|
|
||||||
self.save(input, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Saves a draft the app's capture owns: only its account and source, under the capture budget.
|
|
||||||
pub fn save_capture(&mut self, input: &SaveDraftInput) -> Result<Draft> {
|
|
||||||
if input.account_id != self.rules.capture.account || input.source != self.rules.capture.source {
|
|
||||||
return Err("FORBIDDEN: capture account/source are native-owned".into());
|
|
||||||
}
|
|
||||||
self.save(input, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn save(&mut self, input: &SaveDraftInput, capture: bool) -> Result<Draft> {
|
|
||||||
validate_input(self.rules, input)?;
|
|
||||||
let tx = self
|
|
||||||
.connection
|
|
||||||
.transaction_with_behavior(TransactionBehavior::Immediate)
|
|
||||||
.map_err(sql_error)?;
|
|
||||||
let old = tx
|
|
||||||
.query_row(
|
|
||||||
&format!("{SELECT_DRAFT} WHERE id=?1"),
|
|
||||||
[&input.id],
|
|
||||||
draft_row,
|
|
||||||
)
|
|
||||||
.optional()
|
|
||||||
.map_err(sql_error)?;
|
|
||||||
match &old {
|
|
||||||
Some(draft) if draft.revision != input.expected_revision => {
|
|
||||||
return Err("CONFLICT: draft changed; reload before saving".into())
|
|
||||||
}
|
|
||||||
Some(draft) if draft.account_id != input.account_id => {
|
|
||||||
return Err("FORBIDDEN: draft account cannot change".into())
|
|
||||||
}
|
|
||||||
Some(draft) if capture && (draft.status != "active" || draft.source != self.rules.capture.source) => {
|
|
||||||
return Err("CONFLICT: captured draft was edited or archived locally".into())
|
|
||||||
}
|
|
||||||
None if input.expected_revision != 0 => {
|
|
||||||
return Err("CONFLICT: draft no longer matches expected revision".into())
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
if capture {
|
|
||||||
let bytes =
|
|
||||||
(input.text.len() + input.title.len() + input.context_url.len() + 256) as i64;
|
|
||||||
let changed = tx.execute(
|
|
||||||
"UPDATE capture_usage SET stored_bytes=stored_bytes+?1,revision_count=revision_count+1 WHERE singleton=1 AND stored_bytes+?1<=?2 AND revision_count+1<=?3",
|
|
||||||
params![bytes, self.rules.capture.budget_bytes, self.rules.capture.budget_revisions],
|
|
||||||
).map_err(sql_error)?;
|
|
||||||
if changed != 1 {
|
|
||||||
return Err(
|
|
||||||
"QUOTA: capture storage limit reached; existing drafts are preserved".into(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let stamp = now();
|
|
||||||
let draft = Draft {
|
|
||||||
id: input.id.clone(),
|
|
||||||
account_id: input.account_id.clone(),
|
|
||||||
kind: input.kind.clone(),
|
|
||||||
title: input.title.clone(),
|
|
||||||
text: input.text.clone(),
|
|
||||||
context_url: input.context_url.clone(),
|
|
||||||
revision: input.expected_revision + 1,
|
|
||||||
status: old
|
|
||||||
.as_ref()
|
|
||||||
.map_or("active", |draft| draft.status.as_str())
|
|
||||||
.to_string(),
|
|
||||||
created_at: old.map_or_else(|| stamp.clone(), |draft| draft.created_at),
|
|
||||||
updated_at: stamp,
|
|
||||||
source: input.source.clone(),
|
|
||||||
};
|
|
||||||
tx.execute(
|
|
||||||
"INSERT INTO drafts(id,account_id,kind,title,text,context_url,revision,status,created_at,updated_at,source)
|
|
||||||
VALUES(?1,?2,?3,?4,?5,?6,?7,?8,?9,?10,?11)
|
|
||||||
ON CONFLICT(id) DO UPDATE SET kind=excluded.kind,title=excluded.title,text=excluded.text,
|
|
||||||
context_url=excluded.context_url,revision=excluded.revision,updated_at=excluded.updated_at,source=excluded.source",
|
|
||||||
params![draft.id,draft.account_id,draft.kind,draft.title,draft.text,draft.context_url,draft.revision,draft.status,draft.created_at,draft.updated_at,draft.source],
|
|
||||||
).map_err(sql_error)?;
|
|
||||||
Self::append_revision(&tx, &draft)?;
|
|
||||||
tx.commit().map_err(sql_error)?;
|
|
||||||
Ok(draft)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn append_revision(connection: &Connection, draft: &Draft) -> Result<()> {
|
|
||||||
connection.execute(
|
|
||||||
"INSERT INTO revisions(draft_id,revision,title,text,context_url,source,created_at) VALUES(?1,?2,?3,?4,?5,?6,?7)",
|
|
||||||
params![draft.id,draft.revision,draft.title,draft.text,draft.context_url,draft.source,draft.updated_at],
|
|
||||||
).map_err(sql_error)?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn set_status(&mut self, id: &str, expected_revision: i64, status: &str) -> Result<Draft> {
|
|
||||||
if !(self.rules.valid_identifier)(id)
|
|
||||||
|| !["active", "archived"].contains(&status)
|
|
||||||
|| expected_revision < 1
|
|
||||||
|| expected_revision >= 9_007_199_254_740_991
|
|
||||||
{
|
|
||||||
return Err("VALIDATION: invalid status update".into());
|
|
||||||
}
|
|
||||||
let tx = self
|
|
||||||
.connection
|
|
||||||
.transaction_with_behavior(TransactionBehavior::Immediate)
|
|
||||||
.map_err(sql_error)?;
|
|
||||||
let mut draft = tx
|
|
||||||
.query_row(&format!("{SELECT_DRAFT} WHERE id=?1"), [id], draft_row)
|
|
||||||
.optional()
|
|
||||||
.map_err(sql_error)?
|
|
||||||
.ok_or("CONFLICT: draft not found")?;
|
|
||||||
if draft.revision != expected_revision {
|
|
||||||
return Err("CONFLICT: draft changed before status update".into());
|
|
||||||
}
|
|
||||||
draft.status = status.into();
|
|
||||||
draft.revision += 1;
|
|
||||||
draft.updated_at = now();
|
|
||||||
tx.execute(
|
|
||||||
"UPDATE drafts SET status=?1,revision=?2,updated_at=?3 WHERE id=?4",
|
|
||||||
params![draft.status, draft.revision, draft.updated_at, id],
|
|
||||||
)
|
|
||||||
.map_err(sql_error)?;
|
|
||||||
Self::append_revision(&tx, &draft)?;
|
|
||||||
tx.commit().map_err(sql_error)?;
|
|
||||||
Ok(draft)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn revisions(&self, id: &str) -> Result<Vec<DraftRevision>> {
|
|
||||||
if !(self.rules.valid_identifier)(id) {
|
|
||||||
return Err("VALIDATION: invalid draft identifier".into());
|
|
||||||
}
|
|
||||||
let mut statement = self.connection.prepare("SELECT draft_id,revision,title,text,context_url,source,created_at FROM revisions WHERE draft_id=?1 ORDER BY revision DESC").map_err(sql_error)?;
|
|
||||||
let rows = statement.query_map([id], revision_row).map_err(sql_error)?;
|
|
||||||
rows.collect::<rusqlite::Result<_>>().map_err(sql_error)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn observations(&self) -> Result<Vec<Observation>> {
|
|
||||||
// No remote observation ingestion yet: account identity has not been verified.
|
|
||||||
let mut statement = self.connection.prepare("SELECT id,account_id,user_id,following,followed_by,observed_at,source FROM observations ORDER BY observed_at DESC,id").map_err(sql_error)?;
|
|
||||||
let rows = statement
|
|
||||||
.query_map([], |row| {
|
|
||||||
Ok(Observation {
|
|
||||||
id: row.get(0)?,
|
|
||||||
account_id: row.get(1)?,
|
|
||||||
user_id: row.get(2)?,
|
|
||||||
following: row.get(3)?,
|
|
||||||
followed_by: row.get(4)?,
|
|
||||||
observed_at: row.get(5)?,
|
|
||||||
source: row.get(6)?,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.map_err(sql_error)?;
|
|
||||||
rows.collect::<rusqlite::Result<_>>().map_err(sql_error)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn export(&mut self) -> Result<ExportData> {
|
|
||||||
// A deferred transaction gives all export tables one SQLite read snapshot.
|
|
||||||
self.connection
|
|
||||||
.execute_batch("BEGIN DEFERRED")
|
|
||||||
.map_err(sql_error)?;
|
|
||||||
let result = (|| {
|
|
||||||
let drafts = self.list_drafts()?;
|
|
||||||
let observations = self.observations()?;
|
|
||||||
let mut statement = self.connection.prepare("SELECT draft_id,revision,title,text,context_url,source,created_at FROM revisions ORDER BY draft_id,revision").map_err(sql_error)?;
|
|
||||||
let rows = statement.query_map([], revision_row).map_err(sql_error)?;
|
|
||||||
let revisions = rows
|
|
||||||
.collect::<rusqlite::Result<Vec<_>>>()
|
|
||||||
.map_err(sql_error)?;
|
|
||||||
Ok(ExportData {
|
|
||||||
version: 1,
|
|
||||||
exported_at: now(),
|
|
||||||
drafts,
|
|
||||||
revisions,
|
|
||||||
observations,
|
|
||||||
})
|
|
||||||
})();
|
|
||||||
match result {
|
|
||||||
Ok(data) => {
|
|
||||||
self.connection.execute_batch("COMMIT").map_err(sql_error)?;
|
|
||||||
Ok(data)
|
|
||||||
}
|
|
||||||
Err(error) => {
|
|
||||||
let _ = self.connection.execute_batch("ROLLBACK");
|
|
||||||
Err(error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
// A rule set that is nothing like X's: the rules really are parameters.
|
|
||||||
static NOTES: VaultRules = VaultRules {
|
|
||||||
kinds: &["note", "todo"],
|
|
||||||
sources: &["me", "sync"],
|
|
||||||
max_title_utf16: 10,
|
|
||||||
max_text_bytes: 100,
|
|
||||||
valid_identifier: |id| !id.is_empty() && id.len() <= 16 && id.bytes().all(|b| b.is_ascii_alphanumeric()),
|
|
||||||
validate_context: |context| if context.is_empty() { Ok(()) } else { Err("VALIDATION: no contexts here".into()) },
|
|
||||||
capture: CaptureRules { account: "syncaccount", source: "sync", budget_bytes: 600, budget_revisions: 2 },
|
|
||||||
};
|
|
||||||
|
|
||||||
fn input(id: &str, revision: i64, text: &str) -> SaveDraftInput {
|
|
||||||
SaveDraftInput { id: id.into(), account_id: "me1".into(), kind: "note".into(), title: "t".into(), text: text.into(), context_url: String::new(), expected_revision: revision, source: "me".into() }
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn the_rules_decide_kinds_sources_limits_and_the_schema() {
|
|
||||||
let mut vault = Vault::open(":memory:", &NOTES).unwrap();
|
|
||||||
assert!(vault.save_draft(&SaveDraftInput { kind: "post".into(), ..input("a", 0, "x") }).unwrap_err().starts_with("VALIDATION"));
|
|
||||||
assert!(vault.save_draft(&SaveDraftInput { source: "local".into(), ..input("a", 0, "x") }).unwrap_err().starts_with("VALIDATION"));
|
|
||||||
assert!(vault.save_draft(&input("a", 0, &"x".repeat(101))).unwrap_err().starts_with("VALIDATION"));
|
|
||||||
assert!(vault.save_draft(&SaveDraftInput { context_url: "https://x.example".into(), ..input("a", 0, "x") }).unwrap_err().starts_with("VALIDATION"));
|
|
||||||
assert!(vault.save_draft(&input("bad id", 0, "x")).is_err());
|
|
||||||
assert!(vault.list_drafts().unwrap().is_empty(), "refused writes leave nothing");
|
|
||||||
// The database itself refuses a kind the rules did not allow, even past the Rust check.
|
|
||||||
let sql: String = vault.connection.query_row("SELECT sql FROM sqlite_master WHERE name='drafts'", [], |row| row.get(0)).unwrap();
|
|
||||||
assert!(sql.contains("kind IN ('note','todo')") && sql.contains("source IN ('me','sync')"));
|
|
||||||
assert_eq!(vault.save_draft(&input("a", 0, "x")).unwrap().revision, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn a_stale_revision_is_refused_and_every_save_appends_a_revision() {
|
|
||||||
let mut vault = Vault::open(":memory:", &NOTES).unwrap();
|
|
||||||
let first = vault.save_draft(&input("a", 0, "one")).unwrap();
|
|
||||||
vault.save_draft(&input("a", first.revision, "two")).unwrap();
|
|
||||||
assert!(vault.save_draft(&input("a", first.revision, "stale")).unwrap_err().starts_with("CONFLICT"));
|
|
||||||
assert_eq!(vault.get_draft("a").unwrap().unwrap().text, "two");
|
|
||||||
let texts: Vec<_> = vault.revisions("a").unwrap().into_iter().map(|revision| revision.text).collect();
|
|
||||||
assert_eq!(texts, ["two", "one"]);
|
|
||||||
let archived = vault.set_status("a", 2, "archived").unwrap();
|
|
||||||
assert_eq!((archived.revision, archived.text.as_str()), (3, "two"));
|
|
||||||
assert_eq!(vault.export().unwrap().revisions.len(), 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn capture_belongs_to_the_rules_account_and_stops_at_the_budget() {
|
|
||||||
let mut vault = Vault::open(":memory:", &NOTES).unwrap();
|
|
||||||
let capture = |id: &str, revision: i64, text: &str| SaveDraftInput { account_id: "syncaccount".into(), source: "sync".into(), ..input(id, revision, text) };
|
|
||||||
assert!(vault.save_capture(&input("a", 0, "x")).unwrap_err().starts_with("FORBIDDEN"), "not the capture account");
|
|
||||||
let first = vault.save_capture(&capture("a", 0, "one")).unwrap();
|
|
||||||
vault.save_capture(&capture("a", first.revision, "two")).unwrap();
|
|
||||||
// Two revisions were allowed; the third is refused and the draft keeps its text.
|
|
||||||
assert!(vault.save_capture(&capture("a", 2, "three")).unwrap_err().starts_with("QUOTA"));
|
|
||||||
assert_eq!(vault.get_draft("a").unwrap().unwrap().text, "two");
|
|
||||||
assert_eq!(vault.revisions("a").unwrap().len(), 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,80 +0,0 @@
|
||||||
//! The drafts vault, native side, for every app that sets [`crate::app::AppConfig::vault`]: opens the
|
|
||||||
//! app's [`Vault`] in app data at launch and serves the shell-only `draft_list`, `draft_save`,
|
|
||||||
//! `draft_revisions`, `draft_status`, `observation_list` and `data_export` ([`crate::commands::VAULT`]).
|
|
||||||
//! A write is acknowledged only after its SQLite transaction committed. The app's own native code (its
|
|
||||||
//! capture, a popover that reads drafts, a backup import) takes the same vault through [`lock`]; what
|
|
||||||
//! it does with it is the app's.
|
|
||||||
|
|
||||||
use crate::app::config;
|
|
||||||
use crate::host::{data_file, shell_only};
|
|
||||||
use crate::vault::{Draft, DraftRevision, ExportData, Observation, SaveDraftInput, Vault, VaultRules};
|
|
||||||
use std::sync::{Mutex, MutexGuard};
|
|
||||||
use tauri::{AppHandle, Manager, Webview};
|
|
||||||
|
|
||||||
/// What an app declares about its vault: the database file in app data and its rules.
|
|
||||||
#[derive(Clone, Copy, Debug)]
|
|
||||||
pub struct VaultConfig {
|
|
||||||
pub file: &'static str,
|
|
||||||
pub rules: &'static VaultRules,
|
|
||||||
}
|
|
||||||
|
|
||||||
struct VaultState(Mutex<Vault>);
|
|
||||||
|
|
||||||
/// Opens the database. Does nothing unless the app set [`crate::app::AppConfig::vault`]. A database
|
|
||||||
/// that cannot be opened (a newer schema, a damaged file) stops the launch rather than starting empty.
|
|
||||||
pub(crate) fn init(app: &AppHandle) -> Result<(), Box<dyn std::error::Error>> {
|
|
||||||
let Some(vault) = config(app).vault else { return Ok(()) };
|
|
||||||
let path = data_file(app, vault.file).ok_or("STORAGE: no application data directory")?;
|
|
||||||
app.manage(VaultState(Mutex::new(Vault::open(path, vault.rules).map_err(std::io::Error::other)?)));
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The vault, locked. Hold it only for the call that needs it; never across a webview call.
|
|
||||||
pub fn lock(app: &AppHandle) -> Result<MutexGuard<'_, Vault>, String> {
|
|
||||||
app.try_state::<VaultState>()
|
|
||||||
.ok_or("DATABASE: vault unavailable; restart safely")?
|
|
||||||
.inner()
|
|
||||||
.0
|
|
||||||
.lock()
|
|
||||||
.map_err(|_| "DATABASE: workspace state unavailable; restart safely".into())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tauri::command]
|
|
||||||
pub(crate) async fn draft_list(webview: Webview, app: AppHandle) -> Result<Vec<Draft>, String> {
|
|
||||||
shell_only(&webview)?;
|
|
||||||
lock(&app)?.list_drafts()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tauri::command]
|
|
||||||
pub(crate) async fn draft_save(webview: Webview, app: AppHandle, input: SaveDraftInput) -> Result<Draft, String> {
|
|
||||||
shell_only(&webview)?;
|
|
||||||
lock(&app)?.save_draft(&input)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tauri::command]
|
|
||||||
pub(crate) async fn draft_revisions(webview: Webview, app: AppHandle, draft_id: String) -> Result<Vec<DraftRevision>, String> {
|
|
||||||
shell_only(&webview)?;
|
|
||||||
lock(&app)?.revisions(&draft_id)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tauri::command]
|
|
||||||
pub(crate) async fn draft_status(webview: Webview, app: AppHandle, id: String, expected_revision: i64, status: String) -> Result<Draft, String> {
|
|
||||||
shell_only(&webview)?;
|
|
||||||
lock(&app)?.set_status(&id, expected_revision, &status)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tauri::command]
|
|
||||||
pub(crate) async fn observation_list(webview: Webview, app: AppHandle) -> Result<Vec<Observation>, String> {
|
|
||||||
shell_only(&webview)?;
|
|
||||||
lock(&app)?.observations()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tauri::command]
|
|
||||||
pub(crate) async fn data_export(webview: Webview, app: AppHandle) -> Result<ExportData, String> {
|
|
||||||
shell_only(&webview)?;
|
|
||||||
lock(&app)?.export()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn handler() -> impl Fn(tauri::ipc::Invoke<tauri::Wry>) -> bool + Send + Sync + 'static {
|
|
||||||
tauri::generate_handler![draft_list, draft_save, draft_revisions, draft_status, observation_list, data_export]
|
|
||||||
}
|
|
||||||
|
|
@ -34,20 +34,16 @@ JSON Schema: `waybetter/store-catalog.schema.json` (npm package). The rules apps
|
||||||
| --- | --- |
|
| --- | --- |
|
||||||
| `format` | `2`. An app that reads another format says "update the app". Format 1 (before `apps`) is gone. |
|
| `format` | `2`. An app that reads another format says "update the app". Format 1 (before `apps`) is gone. |
|
||||||
| `apps` | 1–16 distinct app ids (`[a-z0-9-]{1,32}`), e.g. `"x"`; an item for several apps lists each. |
|
| `apps` | 1–16 distinct app ids (`[a-z0-9-]{1,32}`), e.g. `"x"`; an item for several apps lists each. |
|
||||||
| `kind`, `id` | `theme`, `plugin`, `strings` (a string pack, docs/STRING-PACKS.md), `icons` (an icon pack, `*.icons.json`: data, at most 120 KB, its own `id` is what it is installed under) or `builtin` (a feature that ships inside the app, below); `[a-z0-9-]{1,40}`, unique per app and kind. |
|
| `kind`, `id` | `theme`, `plugin` or `strings` (a string pack, docs/STRING-PACKS.md); `[a-z0-9-]{1,40}`, unique per app and kind. |
|
||||||
| `name`, `author`, `version`, `description`, `category`, `tags` | plain text (no control characters), ≤ 60 / 60 / 32 / 600 / 32 characters, ≤ 12 tags of ≤ 32. Known categories show in the reader's language (`wb.store.category.*`). |
|
| `name`, `author`, `version`, `description`, `category`, `tags` | plain text (no control characters), ≤ 60 / 60 / 32 / 600 / 32 characters, ≤ 12 tags of ≤ 32. Known categories show in the reader's language (`wb.store.category.*`). |
|
||||||
| `url`, `preview` | https; for the reading app's own items, on its download hosts (below). |
|
| `url`, `preview` | https; for the reading app's own items, on its download hosts (below). |
|
||||||
| `file` | plugins only: `name.plugin.js` (letters, digits, `-_. `), unique per app ignoring case. |
|
| `file` | plugins only: `name.plugin.js` (letters, digits, `-_. `), unique per app ignoring case. |
|
||||||
| `url`, `sha256`, `size` | of the exact file; size 1 byte … 2 MiB (icon packs 120 KB). Absent on a `builtin` item, which has nothing to download and must not carry them. |
|
| `sha256`, `size` | of the exact file; size 1 byte … 2 MiB. |
|
||||||
| `permissions` | plugins only: the header's `@permissions` (`null` = no line, legacy). |
|
| `permissions` | plugins only: the header's `@permissions` (`null` = no line, legacy). |
|
||||||
| `colors` | themes only: `#rrggbb` swatches for the card. |
|
| `colors` | themes only: `#rrggbb` swatches for the card. |
|
||||||
| `language` | string packs only, required: the pack's language tag. |
|
| `language` | string packs only, required: the pack's language tag. |
|
||||||
| `license`, `credits` | any kind, optional: its licence (≤ 60 characters, e.g. an SPDX id) and who made, translated or reviewed it (≤ 600). The install screen shows them. |
|
| `license`, `credits` | any kind, optional: its licence (≤ 60 characters, e.g. an SPDX id) and who made, translated or reviewed it (≤ 600). The install screen shows them. |
|
||||||
|
|
||||||
**Built-in items.** `builtin` lists something the app already has, such as one of its area plugins, so the Store can show it with the app's own switch (`StoreView`'s `areas` prop: whether the app has that id, whether it is on, turning it on or off). It has no `url`, `sha256`, `size`, `file`, `permissions`, `colors` or `language`; `Store::stage_*` refuses it, `verify_item` has nothing to verify, and an install link cannot name it. It is data for display only. An app that does not know the id just shows "Built in".
|
|
||||||
|
|
||||||
**Two files, one source.** An app from before a kind existed refuses the whole signed catalog that lists it (the Store shows as unreachable), so a new kind never goes into the file those apps read. `waybetter store build` writes both from the same items: `catalog.json` (format 2, only `theme`, `plugin` and `strings`; unchanged for old apps) and `catalog.v3.json` (format 3, every kind), each with its own `.sig`; `sign` and `verify` handle the pair. The rules refuse a format 2 file that lists a newer kind. `Store::fetch_catalog` reads `catalog.v3.json` first and falls back to `catalog.json` only when the newer file is not there (a newer file that is there and does not verify is an error, not a fallback). An item of a kind a version does not know is skipped rather than refusing the whole file, so the next new kind costs current apps nothing; every other rule is unchanged.
|
|
||||||
|
|
||||||
Also refused: unknown fields anywhere, more than 500 items, a catalog over 1 MiB, a signature file
|
Also refused: unknown fields anywhere, more than 500 items, a catalog over 1 MiB, a signature file
|
||||||
over 512 bytes. A malformed item for another app refuses the whole catalog (one file, one set of
|
over 512 bytes. A malformed item for another app refuses the whole catalog (one file, one set of
|
||||||
rules); another app's download hosts are not held to this app's list.
|
rules); another app's download hosts are not held to this app's list.
|
||||||
|
|
@ -99,12 +95,6 @@ end in `name.plugin.js`, the name it is saved under. A link only proposes an ins
|
||||||
for the shell (`install-link` event, `install_pending` for links that arrived before the shell
|
for the shell (`install-link` event, `install_pending` for links that arrived before the shell
|
||||||
listened) and nothing is downloaded until the shell asks.
|
listened) and nothing is downloaded until the shell asks.
|
||||||
|
|
||||||
## Open with, double-click
|
|
||||||
|
|
||||||
The OS can hand the app a file ("Open with", a double-click, a second launch while the app runs: single-instance forwards its arguments and working directory; macOS an open-URL event with a `file://` URL). `store_commands` keeps each existing file's path under a random id (`Store::receive_file`: a name that says what it is, `kind_for_file_name`, a regular file, within the kind's size cap; at most 8 kept, 15 minutes) and queues a `LinkEvent { opened: { id, name, kind } }` for the shell like a link. The shell asks for it with `install_stage_opened {id}`: native code reads that one file (once; size checked again while reading), validates it exactly as `stage_file` does and stages it, and the shell shows the same install screen as for a dropped file. The command takes an id only: the shell cannot name a path, and an id the OS did not hand over is refused. Nothing installs without the screen. File names: `.plugin.js` plugin, `.strings.json` string pack, `.icons.json` icon pack, any other `.json` a theme.
|
|
||||||
|
|
||||||
The app declares the types in `tauri.conf.json` (`bundle.fileAssociations`: `js` and `json`, role Viewer, rank Alternate). A plugin is `name.plugin.js` and Windows only knows the last part, so the framework's installer template (`windows/installer.nsi`) lists the app under "Open with" (`OpenWithProgids`) and never makes it the default program for `.js` or `.json` files, unlike Tauri's own association macro.
|
|
||||||
|
|
||||||
## Trust model
|
## Trust model
|
||||||
|
|
||||||
- Only the app's local shell webview may call the install commands; site tabs and web pages never
|
- Only the app's local shell webview may call the install commands; site tabs and web pages never
|
||||||
|
|
@ -138,7 +128,7 @@ pub static STORE: StoreConfig = StoreConfig {
|
||||||
|
|
||||||
Commands, each starting with `shell_only(&webview)?` and listed only in the shell's capability:
|
Commands, each starting with `shell_only(&webview)?` and listed only in the shell's capability:
|
||||||
`install_pending` → `take_pending`, `install_stage_link {kind,url}` → `stage_link`,
|
`install_pending` → `take_pending`, `install_stage_link {kind,url}` → `stage_link`,
|
||||||
`install_stage_file {name,text}` → `stage_file`, `install_stage_opened {id}` → `stage_opened` (a file the OS handed over, by its random id), `install_cancel {token}` → `cancel`,
|
`install_stage_file {name,text}` → `stage_file`, `install_cancel {token}` → `cancel`,
|
||||||
`install_commit {token,enable,themeId}` → `commit(…, run)` where `run` evaluates a plugin
|
`install_commit {token,enable,themeId}` → `commit(…, run)` where `run` evaluates a plugin
|
||||||
start/stop script in the site's tabs, `plugin_remove {file}` → `remove_plugin`, `install_records`
|
start/stop script in the site's tabs, `plugin_remove {file}` → `remove_plugin`, `install_records`
|
||||||
→ `records`, `install_forget {kind,name}` → `forget`, `store_catalog {refresh}` → `catalog`,
|
→ `records`, `install_forget {kind,name}` → `forget`, `store_catalog {refresh}` → `catalog`,
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,7 @@ A string pack replaces the wrapped site's own UI strings with data: it adds a la
|
||||||
does not offer, fixes its translation, or rewords it. The framework has the formats, the validator,
|
does not offer, fixes its translation, or rewords it. The framework has the formats, the validator,
|
||||||
the application engine, the hook interface, `waybetter strings check`, the Store kind `strings`
|
the application engine, the hook interface, `waybetter strings check`, the Store kind `strings`
|
||||||
with its install screen, the Languages section and translate mode. Sentences with element slots
|
with its install screen, the Languages section and translate mode. Sentences with element slots
|
||||||
(rich text) are replaced with `{e0}`, `{e1}` placeholders for the site's own elements. A pack can also
|
(rich text) cannot be replaced yet.
|
||||||
reword the site's own text by words (`rewrite`) and apply only while the site is in some languages
|
|
||||||
(`when`).
|
|
||||||
|
|
||||||
## Rules
|
## Rules
|
||||||
|
|
||||||
|
|
@ -41,16 +39,6 @@ reword the site's own text by words (`rewrite`) and apply only while the site is
|
||||||
- `language` is a BCP 47 tag; a private-use tag is fine. `base` is the language whose plural rules
|
- `language` is a BCP 47 tag; a private-use tag is fine. `base` is the language whose plural rules
|
||||||
the pack follows when the runtime does not know `language`; without either, every number takes
|
the pack follows when the runtime does not know `language`; without either, every number takes
|
||||||
the `other` form.
|
the `other` form.
|
||||||
- `when` (optional) is a condition: `{ "languages": ["en"] }` applies the pack only while the site
|
|
||||||
shows English (a tag matches itself and its regional forms: `en` matches `en-GB`; the match is
|
|
||||||
case-insensitive). The site's language is the one its catalog registers (`sink.matched`), so a
|
|
||||||
pack that rewords English never touches a Turkish page. Without `when` a pack always applies.
|
|
||||||
- `rewrite` (optional) rewords the site's own text instead of replacing keys:
|
|
||||||
`{ "words": { "Post": "Tweet", "posts": "tweets" } }`. Whole words only, case as written, 1 to 64
|
|
||||||
entries of plain letters and digits; applied to the text of every inventory key (plain strings, the
|
|
||||||
result of messages, the pieces of rich sentences) that no later pack replaced. A parameter's value
|
|
||||||
is never reworded (a user named "Post" stays "Post"). The pack carries none of the site's sentences,
|
|
||||||
so it keeps working when the site rewords a string, and `strings` may be empty.
|
|
||||||
- `strings` maps a key id to text. The ids are the inventory's; a pack never carries the site's own
|
- `strings` maps a key id to text. The ids are the inventory's; a pack never carries the site's own
|
||||||
text.
|
text.
|
||||||
|
|
||||||
|
|
@ -65,13 +53,7 @@ stays, when:
|
||||||
- it uses a number or date format, `selectordinal` or a plural offset;
|
- it uses a number or date format, `selectordinal` or a plural offset;
|
||||||
- it contains `<` or `>` (unless the inventory gives the key tag slots; then exactly those tags);
|
- it contains `<` or `>` (unless the inventory gives the key tag slots; then exactly those tags);
|
||||||
- it contains control or bidi-override characters, is empty or is longer than 2000 characters;
|
- it contains control or bidi-override characters, is empty or is longer than 2000 characters;
|
||||||
- the key's kind cannot be replaced by data yet (`format`, and `rich` entries the inventory gives no
|
- the key's kind cannot be replaced by data yet (`rich`, `format`).
|
||||||
`slots`).
|
|
||||||
|
|
||||||
A `rich` value (a sentence with a link or button inside) uses the original's element slots:
|
|
||||||
`{e0}` … `{e<slots-1>}` stand for the site's own elements, each exactly once (the last one may be
|
|
||||||
left out: the element after the final piece is not always there), in any order your sentence needs.
|
|
||||||
No plural, select, parameter or markup. A pack never carries HTML; the elements are the site's.
|
|
||||||
|
|
||||||
A parameter is inserted the way string concatenation would insert it (`String(value)`).
|
A parameter is inserted the way string concatenation would insert it (`String(value)`).
|
||||||
|
|
||||||
|
|
@ -83,7 +65,7 @@ A parameter is inserted the way string concatenation would insert it (`String(va
|
||||||
"entries": {
|
"entries": {
|
||||||
"a0000001": { "kind": "text", "hash": "0k3j…" },
|
"a0000001": { "kind": "text", "hash": "0k3j…" },
|
||||||
"b0000002": { "kind": "message", "params": ["count"], "plural": ["count"], "hash": "…" },
|
"b0000002": { "kind": "message", "params": ["count"], "plural": ["count"], "hash": "…" },
|
||||||
"c0000003": { "kind": "rich", "slots": 2, "group": "rich", "hash": "…" }
|
"c0000003": { "kind": "rich", "group": "rich", "hash": "…" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
@ -92,11 +74,10 @@ A parameter is inserted the way string concatenation would insert it (`String(va
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| `text` | a string | yes |
|
| `text` | a string | yes |
|
||||||
| `message` | a function of parameters that returns a string | yes |
|
| `message` | a function of parameters that returns a string | yes |
|
||||||
| `rich` | text with element slots (`slots`) | yes, when the inventory knows `slots` |
|
| `rich` | text with element slots | not yet |
|
||||||
| `format` | a compiled number, date or currency formatter | no |
|
| `format` | a compiled number, date or currency formatter | no |
|
||||||
|
|
||||||
`slots` (rich) is the number of element positions of the site's sentence: piece n is followed by the
|
`hash` is a hash of the base-language value (`hashText`), for the drift report; the inventory holds
|
||||||
caller's element n. `hash` is a hash of the base-language value (`hashText`), for the drift report; the inventory holds
|
|
||||||
no text of the site. `group` names the part of the catalog a key arrives with (default `main`).
|
no text of the site. `group` names the part of the catalog a key arrives with (default `main`).
|
||||||
|
|
||||||
`driftReport(inventory, observed, loadedGroups)` compares an inventory with a newer build: `added`,
|
`driftReport(inventory, observed, loadedGroups)` compares an inventory with a newer build: `added`,
|
||||||
|
|
@ -115,13 +96,8 @@ const engine = createStringEngine(inventory, [compilePack(packA, inventory), com
|
||||||
engine.resolve(id, siteValue); // packB's value, else packA's, else exactly siteValue
|
engine.resolve(id, siteValue); // packB's value, else packA's, else exactly siteValue
|
||||||
```
|
```
|
||||||
|
|
||||||
`resolve` returns a string for a `text` key, a function with the original's call shape for a
|
`resolve` returns a string for a `text` key and a function with the original's call shape for a
|
||||||
`message` key (closures over the parsed message; nothing is evaluated) and, for a `rich` key, a
|
`message` key (closures over the parsed message; nothing is evaluated). Feeding a value the engine
|
||||||
`RichTemplate` `{ pieces, order }`: piece n is shown, then the site's element `order[n]` (the shape
|
|
||||||
X's own sentence renderer reads; wiring it into a site's renderer is the adapter's part). A pack's
|
|
||||||
`rewrite` is applied to whichever value results, so a reworded message is a function again.
|
|
||||||
`engine.setLanguage(language)` tells the engine which language the site shows (the hook does it when
|
|
||||||
the adapter reports `matched`); conditional packs wait for it. Feeding a value the engine
|
|
||||||
produced back in returns the same value. It keeps the site's own value of every key it changed
|
produced back in returns the same value. It keeps the site's own value of every key it changed
|
||||||
(`engine.originals()`), which is what a restore needs; `applyPacks` and `restoreCatalog` do both
|
(`engine.originals()`), which is what a restore needs; `applyPacks` and `restoreCatalog` do both
|
||||||
for a whole catalog object without changing it. A live value whose kind differs from the
|
for a whole catalog object without changing it. A live value whose kind differs from the
|
||||||
|
|
@ -198,16 +174,6 @@ the site's scripts.
|
||||||
The Languages section of the panel (`createStringPacksSection({ inventory })`) lists the installed
|
The Languages section of the panel (`createStringPacksSection({ inventory })`) lists the installed
|
||||||
packs with their coverage, turns them on and off, orders and removes them.
|
packs with their coverage, turns them on and off, orders and removes them.
|
||||||
|
|
||||||
### Built-in packs
|
|
||||||
|
|
||||||
An app can ship packs of its own (`BuiltInPacks` in `panel/StringPacks.tsx`: a function returning pack
|
|
||||||
documents as text). They are delivered before the installed packs, so an installed pack wins where both
|
|
||||||
change a word, they follow the app's settings and they are not listed or removable. `syncStringPacks`
|
|
||||||
hands the tabs the delivery at start only when it differs from the one they were last given (every tab
|
|
||||||
reloads for a change). wayBetter for X's Twitter wording (Post -> Tweet, Repost -> Retweet) is one: a
|
|
||||||
`rewrite` pack for English that is delivered while its setting is on. A delivery with a rewording pack
|
|
||||||
carries the whole page inventory (the engine needs every key's shape), not a slice.
|
|
||||||
|
|
||||||
## Translate mode
|
## Translate mode
|
||||||
|
|
||||||
Switched on in the Languages section. The delivery then carries the whole inventory, packs or not,
|
Switched on in the Languages section. The delivery then carries the whole inventory, packs or not,
|
||||||
|
|
@ -216,7 +182,5 @@ and the page runtime marks every replaceable string with an invisible marker nam
|
||||||
with the key, the current text and its parameters. An edit is checked with the pack rules
|
with the key, the current text and its parameters. An edit is checked with the pack rules
|
||||||
(`checkEdit`) and kept in the tab's draft (`wayBetter.translateDraft`), which applies as the last
|
(`checkEdit`) and kept in the tab's draft (`wayBetter.translateDraft`), which applies as the last
|
||||||
pack after a reload. "Copy pack file" copies the draft as a pack document. "Leave" turns the mode
|
pack after a reload. "Copy pack file" copies the draft as a pack document. "Leave" turns the mode
|
||||||
off for that tab. The bar's and the editor's words are the app's own (`words` option of `installTranslateUi`, a function
|
off for that tab. The markers can reach places that compare text exactly (the window title), so the
|
||||||
that is asked again each time they are drawn, so a language switch shows at once); the English
|
|
||||||
defaults are `TRANSLATE_WORDS`. The markers can reach places that compare text exactly (the window title), so the
|
|
||||||
mode is for authors only and is never on by default.
|
mode is for authors only and is never on by default.
|
||||||
|
|
|
||||||
|
|
@ -151,9 +151,9 @@ const COMMANDS = {
|
||||||
*/
|
*/
|
||||||
export const HOST_COMMANDS = {
|
export const HOST_COMMANDS = {
|
||||||
shell: [
|
shell: [
|
||||||
'tabs_sync', 'tab_navigate', 'tab_action', 'tab_zoom', 'tab_find', 'menu_set', 'safe_mode_get', 'safe_mode_set', 'diag_get', 'diag_log', 'open_external_url', 'shell_focus', 'shell_ready', 'tab_still_ready', 'shell_raise', 'window_system_menu',
|
'tabs_sync', 'tab_navigate', 'tab_action', 'tab_zoom', 'tab_find', 'safe_mode_get', 'safe_mode_set', 'diag_get', 'diag_log', 'open_external_url', 'shell_focus', 'shell_ready', 'tab_still_ready', 'shell_raise', 'window_system_menu',
|
||||||
'profiles_get', 'profiles_set', 'i18n_get', 'i18n_set',
|
'profiles_get', 'profiles_set', 'i18n_get', 'i18n_set',
|
||||||
'plugins_list', 'plugin_set_enabled', 'plugins_open_folder', 'custom_css_get', 'custom_css_set', 'features_get', 'features_set', 'mode_get', 'mode_set', 'settings_get', 'settings_set', 'tab_run_command',
|
'plugins_list', 'plugin_set_enabled', 'plugins_open_folder', 'custom_css_get', 'custom_css_set', 'features_get', 'features_set', 'mode_get', 'mode_set', 'settings_get', 'settings_set',
|
||||||
],
|
],
|
||||||
tab: ['tab_shortcut', 'tab_link_drag'],
|
tab: ['tab_shortcut', 'tab_link_drag'],
|
||||||
site: ['open_panel'],
|
site: ['open_panel'],
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// A small JSON Schema (draft 2020-12) validator for the keywords theme.schema.json uses: type,
|
// A small JSON Schema (draft 2020-12) validator for the keywords theme.schema.json uses: type,
|
||||||
// required, properties, additionalProperties, enum, const, pattern, min/maxLength, minimum,
|
// required, properties, additionalProperties, enum, const, pattern, min/maxLength, minimum,
|
||||||
// maximum, items, minItems, maxItems, uniqueItems, allOf, oneOf, anyOf, not, if/then/else and local $ref (theme and
|
// maximum, items, minItems, maxItems, uniqueItems, allOf, oneOf, anyOf and local $ref (theme and
|
||||||
// store catalog schemas). Returns a list of error paths.
|
// store catalog schemas). Returns a list of error paths.
|
||||||
|
|
||||||
const typeOf = value => (value === null ? 'null' : Array.isArray(value) ? 'array' : typeof value);
|
const typeOf = value => (value === null ? 'null' : Array.isArray(value) ? 'array' : typeof value);
|
||||||
|
|
@ -50,10 +50,5 @@ export function validate(schema, value, root = schema, path = '$') {
|
||||||
if (passing !== 1) errors.push(`${path}: matches ${passing} of oneOf (needs exactly 1)`);
|
if (passing !== 1) errors.push(`${path}: matches ${passing} of oneOf (needs exactly 1)`);
|
||||||
}
|
}
|
||||||
if (schema.anyOf && !schema.anyOf.some(option => validate(option, value, root, path).length === 0)) errors.push(`${path}: matches none of anyOf`);
|
if (schema.anyOf && !schema.anyOf.some(option => validate(option, value, root, path).length === 0)) errors.push(`${path}: matches none of anyOf`);
|
||||||
if (schema.not && validate(schema.not, value, root, path).length === 0) errors.push(`${path}: matches a schema it must not match`);
|
|
||||||
if (schema.if) {
|
|
||||||
const branch = validate(schema.if, value, root, path).length === 0 ? schema.then : schema.else;
|
|
||||||
if (branch) errors.push(...validate(branch, value, root, path));
|
|
||||||
}
|
|
||||||
return errors;
|
return errors;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ export function installStringPacks(win: Window, setups: readonly CatalogSetup[],
|
||||||
refused.push(error instanceof Error ? error.message : String(error));
|
refused.push(error instanceof Error ? error.message : String(error));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const usable = packs.filter(pack => pack.values.size > 0 || pack.rewrite);
|
const usable = packs.filter(pack => pack.values.size > 0);
|
||||||
return {
|
return {
|
||||||
catalog: setup.adapter.catalog, adapter: setup.adapter, packs, refused, usable,
|
catalog: setup.adapter.catalog, adapter: setup.adapter, packs, refused, usable,
|
||||||
engine: usable.length || options.mark ? createStringEngine(setup.inventory, usable) : null,
|
engine: usable.length || options.mark ? createStringEngine(setup.inventory, usable) : null,
|
||||||
|
|
@ -134,7 +134,7 @@ export function installStringPacks(win: Window, setups: readonly CatalogSetup[],
|
||||||
if (!engine) continue;
|
if (!engine) continue;
|
||||||
const sink: CatalogSink = {
|
const sink: CatalogSink = {
|
||||||
seen(group = 'main') { state.seen[group] = (state.seen[group] ?? 0) + 1; },
|
seen(group = 'main') { state.seen[group] = (state.seen[group] ?? 0) + 1; },
|
||||||
matched(language) { state.languages.add(String(language)); engine.setLanguage(String(language)); },
|
matched(language) { state.languages.add(String(language)); },
|
||||||
resolve(id, original) {
|
resolve(id, original) {
|
||||||
try {
|
try {
|
||||||
state.keys += 1;
|
state.keys += 1;
|
||||||
|
|
|
||||||
|
|
@ -90,14 +90,14 @@ export function checkEdit(lookup: InventoryLookup, id: string, value: string): s
|
||||||
|
|
||||||
export type TranslateWords = {
|
export type TranslateWords = {
|
||||||
bar: string; hint: string; edits(count: number): string; exportPack: string; copied: string; exit: string; reload: string;
|
bar: string; hint: string; edits(count: number): string; exportPack: string; copied: string; exit: string; reload: string;
|
||||||
key: string; original: string; parameters: string; plural: string; save: string; cancel: string; remove: string; notTranslatable: string; choose: string;
|
key: string; original: string; parameters: string; save: string; cancel: string; remove: string; notTranslatable: string; choose: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** English defaults (the app passes its own words). */
|
/** English defaults (the app passes its own words). */
|
||||||
export const TRANSLATE_WORDS: TranslateWords = {
|
export const TRANSLATE_WORDS: TranslateWords = {
|
||||||
bar: 'Translate mode', hint: 'Click a word to change it.', edits: count => `${count} ${count === 1 ? 'edit' : 'edits'}`,
|
bar: 'Translate mode', hint: 'Click a word to change it.', edits: count => `${count} ${count === 1 ? 'edit' : 'edits'}`,
|
||||||
exportPack: 'Copy pack file', copied: 'Pack file copied', exit: 'Leave', reload: 'Reload to see it',
|
exportPack: 'Copy pack file', copied: 'Pack file copied', exit: 'Leave', reload: 'Reload to see it',
|
||||||
key: 'Key', original: 'Now', parameters: 'Parameters', plural: 'plural', save: 'Save', cancel: 'Cancel', remove: 'Remove edit',
|
key: 'Key', original: 'Now', parameters: 'Parameters', save: 'Save', cancel: 'Cancel', remove: 'Remove edit',
|
||||||
notTranslatable: 'This string cannot be changed by a pack yet.', choose: 'Which one?',
|
notTranslatable: 'This string cannot be changed by a pack yet.', choose: 'Which one?',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -106,8 +106,7 @@ export type TranslateUiOptions = {
|
||||||
marker: Marker;
|
marker: Marker;
|
||||||
site: string;
|
site: string;
|
||||||
catalog: string;
|
catalog: string;
|
||||||
/** The bar's and the editor's words; a function is asked again each time they are drawn (the app's language may change). */
|
words?: Partial<TranslateWords>;
|
||||||
words?: Partial<TranslateWords> | (() => Partial<TranslateWords>);
|
|
||||||
/** Leaves translate mode (the app drops the flag and reloads). */
|
/** Leaves translate mode (the app drops the flag and reloads). */
|
||||||
exit(): void;
|
exit(): void;
|
||||||
};
|
};
|
||||||
|
|
@ -133,7 +132,7 @@ button.primary { background: #2563eb; }
|
||||||
*/
|
*/
|
||||||
export function installTranslateUi(win: Window, options: TranslateUiOptions): { dispose(): void } {
|
export function installTranslateUi(win: Window, options: TranslateUiOptions): { dispose(): void } {
|
||||||
const doc = win.document;
|
const doc = win.document;
|
||||||
const currentWords = (): TranslateWords => ({ ...TRANSLATE_WORDS, ...(typeof options.words === 'function' ? options.words() : options.words) });
|
const words = { ...TRANSLATE_WORDS, ...options.words };
|
||||||
const lookup = inventoryLookup(options.inventory);
|
const lookup = inventoryLookup(options.inventory);
|
||||||
const storage = win.sessionStorage;
|
const storage = win.sessionStorage;
|
||||||
const draft = (): TranslateDraft => readDraft(storage) ?? { language: '', name: '', strings: {} };
|
const draft = (): TranslateDraft => readDraft(storage) ?? { language: '', name: '', strings: {} };
|
||||||
|
|
@ -158,7 +157,6 @@ export function installTranslateUi(win: Window, options: TranslateUiOptions): {
|
||||||
return el;
|
return el;
|
||||||
};
|
};
|
||||||
const renderBar = () => {
|
const renderBar = () => {
|
||||||
const words = currentWords();
|
|
||||||
bar.replaceChildren();
|
bar.replaceChildren();
|
||||||
const title = doc.createElement('b');
|
const title = doc.createElement('b');
|
||||||
title.textContent = words.bar;
|
title.textContent = words.bar;
|
||||||
|
|
@ -175,7 +173,6 @@ export function installTranslateUi(win: Window, options: TranslateUiOptions): {
|
||||||
const closePop = () => { pop?.remove(); pop = null; };
|
const closePop = () => { pop?.remove(); pop = null; };
|
||||||
|
|
||||||
const edit = (id: string, x: number, y: number, now: string) => {
|
const edit = (id: string, x: number, y: number, now: string) => {
|
||||||
const words = currentWords();
|
|
||||||
closePop();
|
closePop();
|
||||||
pop = doc.createElement('div');
|
pop = doc.createElement('div');
|
||||||
pop.className = 'pop';
|
pop.className = 'pop';
|
||||||
|
|
@ -199,7 +196,7 @@ export function installTranslateUi(win: Window, options: TranslateUiOptions): {
|
||||||
}
|
}
|
||||||
if (shape.params?.length) {
|
if (shape.params?.length) {
|
||||||
const params = doc.createElement('small');
|
const params = doc.createElement('small');
|
||||||
params.textContent = `${words.parameters}: ${shape.params.map(name => `{${name}}${shape.plural?.includes(name) ? ` (${words.plural})` : ''}`).join(', ')}`;
|
params.textContent = `${words.parameters}: ${shape.params.map(name => `{${name}}${shape.plural?.includes(name) ? ' (plural)' : ''}`).join(', ')}`;
|
||||||
pop.append(params);
|
pop.append(params);
|
||||||
}
|
}
|
||||||
const input = doc.createElement('textarea');
|
const input = doc.createElement('textarea');
|
||||||
|
|
@ -237,7 +234,6 @@ export function installTranslateUi(win: Window, options: TranslateUiOptions): {
|
||||||
return [];
|
return [];
|
||||||
};
|
};
|
||||||
const onClick = (event: MouseEvent) => {
|
const onClick = (event: MouseEvent) => {
|
||||||
const words = currentWords();
|
|
||||||
if (event.composedPath().includes(host)) return;
|
if (event.composedPath().includes(host)) return;
|
||||||
const found = keysAt(event.target as Element | null);
|
const found = keysAt(event.target as Element | null);
|
||||||
if (!found.length) return;
|
if (!found.length) return;
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,9 @@ type Parts = ReturnType<typeof parseMessage>;
|
||||||
* What the site's value for a key is:
|
* What the site's value for a key is:
|
||||||
* - `text`: a plain string;
|
* - `text`: a plain string;
|
||||||
* - `message`: a function of a parameter object that returns a string;
|
* - `message`: a function of a parameter object that returns a string;
|
||||||
* - `rich`: text with element slots (a link or a button inside a sentence). It can be replaced when
|
* - `rich`: text with element slots (not replaceable by data yet);
|
||||||
* the inventory knows its slot count (`slots`): the pack value then places the site's own
|
|
||||||
* elements with `{e0}`, `{e1}`, …, each exactly once (the last may be left out); the value itself is still plain text;
|
|
||||||
* - `format`: a compiled number/date/currency formatter (not text).
|
* - `format`: a compiled number/date/currency formatter (not text).
|
||||||
* Only `text`, `message` and `rich` with known `slots` can be replaced by a pack.
|
* Only `text` and `message` can be replaced by a pack.
|
||||||
*/
|
*/
|
||||||
export type StringKind = 'text' | 'message' | 'rich' | 'format';
|
export type StringKind = 'text' | 'message' | 'rich' | 'format';
|
||||||
|
|
||||||
|
|
@ -43,8 +41,6 @@ export type InventoryEntry = {
|
||||||
plural?: string[];
|
plural?: string[];
|
||||||
/** Parameters the site's value selects on. */
|
/** Parameters the site's value selects on. */
|
||||||
select?: string[];
|
select?: string[];
|
||||||
/** Element slots of a `rich` value (`{e0}` … `{e<slots-1>}` in a pack value; the last may be left out). Without it the key is closed. */
|
|
||||||
slots?: number;
|
|
||||||
/** Tag slot names, for catalogs whose values carry `<tag>…</tag>` slots. */
|
/** Tag slot names, for catalogs whose values carry `<tag>…</tag>` slots. */
|
||||||
tags?: string[];
|
tags?: string[];
|
||||||
/** Hash of the base-language value (`hashText`): drift detection; never the text itself. */
|
/** Hash of the base-language value (`hashText`): drift detection; never the text itself. */
|
||||||
|
|
@ -65,22 +61,6 @@ export type StringInventory = {
|
||||||
entries: Record<string, InventoryEntry>;
|
entries: Record<string, InventoryEntry>;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* When a pack applies. Without a condition it always does. `languages`: only while the site shows
|
|
||||||
* one of these languages (a tag matches itself and its regional forms: `en` matches `en-GB`), for
|
|
||||||
* example a rewording of English that must not touch a Turkish page.
|
|
||||||
*/
|
|
||||||
export type PackCondition = { languages?: string[] };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A pack's rewording rule: whole words replaced inside the site's own text, wherever it appears
|
|
||||||
* (`{ "Post": "Tweet", "posts": "tweets" }`). It carries none of the site's sentences, so it keeps
|
|
||||||
* working when the site words a string differently, and it applies to a value of the site (or of an
|
|
||||||
* earlier pack) that no later pack replaced. Words are matched exactly (case as written), never
|
|
||||||
* inside a longer word, and never in a parameter's value (a user named "Post" stays "Post").
|
|
||||||
*/
|
|
||||||
export type PackRewrite = { words: Record<string, string> };
|
|
||||||
|
|
||||||
/** A string pack document: metadata and `key id -> text`. */
|
/** A string pack document: metadata and `key id -> text`. */
|
||||||
export type StringPack = {
|
export type StringPack = {
|
||||||
format: 1;
|
format: 1;
|
||||||
|
|
@ -92,10 +72,6 @@ export type StringPack = {
|
||||||
authors: string[];
|
authors: string[];
|
||||||
/** A language whose plural rules the pack follows when the runtime does not know `language`. */
|
/** A language whose plural rules the pack follows when the runtime does not know `language`. */
|
||||||
base?: string;
|
base?: string;
|
||||||
/** The pack applies only when this holds (default: always). */
|
|
||||||
when?: PackCondition;
|
|
||||||
/** Rewords the site's text instead of (or besides) replacing keys. */
|
|
||||||
rewrite?: PackRewrite;
|
|
||||||
version?: string;
|
version?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
strings: Record<string, string>;
|
strings: Record<string, string>;
|
||||||
|
|
@ -107,23 +83,11 @@ export const MAIN_GROUP = 'main';
|
||||||
const TAG = /^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/;
|
const TAG = /^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$/;
|
||||||
const IDENT = /^[a-z][a-z0-9-]{0,31}$/;
|
const IDENT = /^[a-z][a-z0-9-]{0,31}$/;
|
||||||
const CONTROL = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f--]/;
|
const CONTROL = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f--]/;
|
||||||
const REWRITE_FROM = /^[\p{L}\p{N}]{1,40}$/u;
|
|
||||||
const REWRITE_TO = /^[\p{L}\p{N}][\p{L}\p{N}'’-]{0,39}$/u;
|
|
||||||
const MAX_REWRITES = 64;
|
|
||||||
const CATEGORIES = new Set(['zero', 'one', 'two', 'few', 'many', 'other']);
|
const CATEGORIES = new Set(['zero', 'one', 'two', 'few', 'many', 'other']);
|
||||||
|
|
||||||
/** Whether a pack can replace a value of this kind (a `rich` one only with known `slots`: pass the shape). */
|
/** Whether a pack can replace a value of this kind. */
|
||||||
export function translatable(kind: StringKind | Pick<EntryShape, 'kind' | 'slots'>): boolean {
|
export function translatable(kind: StringKind): boolean {
|
||||||
const { kind: k, slots } = typeof kind === 'string' ? { kind, slots: undefined } : kind;
|
return kind === 'text' || kind === 'message';
|
||||||
return k === 'text' || k === 'message' || (k === 'rich' && slots !== undefined);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Whether `language` (the site's) satisfies a pack's `when`. */
|
|
||||||
export function conditionHolds(when: PackCondition | undefined, language: string | undefined): boolean {
|
|
||||||
if (!when?.languages) return true;
|
|
||||||
if (!language) return false;
|
|
||||||
const have = language.toLowerCase();
|
|
||||||
return when.languages.some(tag => { const want = tag.toLowerCase(); return have === want || have.startsWith(`${want}-`); });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 53-bit hash of a text as 11 base-36 characters. Same result in every runtime. */
|
/** 53-bit hash of a text as 11 base-36 characters. Same result in every runtime. */
|
||||||
|
|
@ -144,7 +108,7 @@ export function hashText(text: string): string {
|
||||||
// Inventory lookup (the full inventory, or its compact page form)
|
// Inventory lookup (the full inventory, or its compact page form)
|
||||||
|
|
||||||
/** The facts the validator and the engine need about one key. */
|
/** The facts the validator and the engine need about one key. */
|
||||||
export type EntryShape = Pick<InventoryEntry, 'kind' | 'params' | 'plural' | 'select' | 'tags' | 'slots'>;
|
export type EntryShape = Pick<InventoryEntry, 'kind' | 'params' | 'plural' | 'select' | 'tags'>;
|
||||||
export type InventoryLookup = (id: string) => EntryShape | undefined;
|
export type InventoryLookup = (id: string) => EntryShape | undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -158,8 +122,6 @@ export type PageInventory = {
|
||||||
text: string;
|
text: string;
|
||||||
message: Record<string, string>;
|
message: Record<string, string>;
|
||||||
closed: string;
|
closed: string;
|
||||||
/** Rich entries a pack can replace: id -> slot count. */
|
|
||||||
rich?: Record<string, number>;
|
|
||||||
/** A slice: only the keys some pack names. A key missing from a slice is not a new key of the site. */
|
/** A slice: only the keys some pack names. A key missing from a slice is not a new key of the site. */
|
||||||
partial?: boolean;
|
partial?: boolean;
|
||||||
};
|
};
|
||||||
|
|
@ -168,15 +130,13 @@ function compact(site: string, catalog: string, shapes: Iterable<[string, EntryS
|
||||||
const text: string[] = [];
|
const text: string[] = [];
|
||||||
const closed: string[] = [];
|
const closed: string[] = [];
|
||||||
const message: Record<string, string> = {};
|
const message: Record<string, string> = {};
|
||||||
const rich: Record<string, number> = {};
|
|
||||||
for (const [id, entry] of shapes) {
|
for (const [id, entry] of shapes) {
|
||||||
if (entry.kind === 'rich' && entry.slots !== undefined && !entry.tags?.length) rich[id] = entry.slots;
|
if (entry.kind === 'text' && !entry.tags?.length) text.push(id);
|
||||||
else if (entry.kind === 'text' && !entry.tags?.length) text.push(id);
|
|
||||||
else if (entry.kind === 'message' && !entry.tags?.length) {
|
else if (entry.kind === 'message' && !entry.tags?.length) {
|
||||||
message[id] = (entry.params ?? []).map(name => `${name}${entry.plural?.includes(name) ? '*' : ''}${entry.select?.includes(name) ? '?' : ''}`).join(' ');
|
message[id] = (entry.params ?? []).map(name => `${name}${entry.plural?.includes(name) ? '*' : ''}${entry.select?.includes(name) ? '?' : ''}`).join(' ');
|
||||||
} else closed.push(id);
|
} else closed.push(id);
|
||||||
}
|
}
|
||||||
return { site, catalog, text: text.join(' '), message, closed: closed.join(' '), ...(Object.keys(rich).length ? { rich } : {}) };
|
return { site, catalog, text: text.join(' '), message, closed: closed.join(' ') };
|
||||||
}
|
}
|
||||||
|
|
||||||
export function packInventory(inventory: StringInventory): PageInventory {
|
export function packInventory(inventory: StringInventory): PageInventory {
|
||||||
|
|
@ -205,7 +165,6 @@ export function isPageInventory(input: unknown): input is PageInventory {
|
||||||
return typeof input.site === 'string' && IDENT.test(input.site) && typeof input.catalog === 'string' && IDENT.test(input.catalog)
|
return typeof input.site === 'string' && IDENT.test(input.site) && typeof input.catalog === 'string' && IDENT.test(input.catalog)
|
||||||
&& ids(input.text) && ids(input.closed) && isRecord(input.message)
|
&& ids(input.text) && ids(input.closed) && isRecord(input.message)
|
||||||
&& Object.entries(input.message).every(([id, names]) => /^[\w$.-]+$/.test(id) && typeof names === 'string' && /^[\w$*? ]*$/.test(names))
|
&& Object.entries(input.message).every(([id, names]) => /^[\w$.-]+$/.test(id) && typeof names === 'string' && /^[\w$*? ]*$/.test(names))
|
||||||
&& (input.rich === undefined || (isRecord(input.rich) && Object.entries(input.rich).every(([id, n]) => /^[\w$.-]+$/.test(id) && Number.isInteger(n) && (n as number) >= 0 && (n as number) <= 32)))
|
|
||||||
&& (input.partial === undefined || typeof input.partial === 'boolean');
|
&& (input.partial === undefined || typeof input.partial === 'boolean');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -223,7 +182,6 @@ export function inventoryLookup(inventory: StringInventory | PageInventory): Inv
|
||||||
const map = new Map<string, EntryShape>();
|
const map = new Map<string, EntryShape>();
|
||||||
if (inventory.text) for (const id of inventory.text.split(' ')) map.set(id, TEXT_SHAPE);
|
if (inventory.text) for (const id of inventory.text.split(' ')) map.set(id, TEXT_SHAPE);
|
||||||
if (inventory.closed) for (const id of inventory.closed.split(' ')) map.set(id, CLOSED_SHAPE);
|
if (inventory.closed) for (const id of inventory.closed.split(' ')) map.set(id, CLOSED_SHAPE);
|
||||||
if (inventory.rich) for (const [id, slots] of Object.entries(inventory.rich)) map.set(id, { kind: 'rich', slots });
|
|
||||||
for (const [id, spec] of Object.entries(inventory.message)) {
|
for (const [id, spec] of Object.entries(inventory.message)) {
|
||||||
const names = spec ? spec.split(' ') : [];
|
const names = spec ? spec.split(' ') : [];
|
||||||
map.set(id, {
|
map.set(id, {
|
||||||
|
|
@ -263,27 +221,13 @@ export function checkPackShape(input: unknown): PackIssue[] {
|
||||||
|| input.authors.some(author => typeof author !== 'string' || !author.trim() || author.length > STRING_PACK_LIMITS.name || CONTROL.test(author) || /[<>]/.test(author))) {
|
|| input.authors.some(author => typeof author !== 'string' || !author.trim() || author.length > STRING_PACK_LIMITS.name || CONTROL.test(author) || /[<>]/.test(author))) {
|
||||||
error(`"authors" must be a list of at most ${STRING_PACK_LIMITS.authors} plain-text names`);
|
error(`"authors" must be a list of at most ${STRING_PACK_LIMITS.authors} plain-text names`);
|
||||||
}
|
}
|
||||||
if (input.when !== undefined) {
|
|
||||||
const when = input.when;
|
|
||||||
if (!isRecord(when) || Object.keys(when).some(key => key !== 'languages')) error('"when" is an object with "languages"');
|
|
||||||
else if (when.languages !== undefined && (!Array.isArray(when.languages) || !when.languages.length || when.languages.length > 16
|
|
||||||
|| when.languages.some(tag => typeof tag !== 'string' || !TAG.test(tag)))) error('"when.languages" must be a list of 1 to 16 language tags');
|
|
||||||
}
|
|
||||||
if (input.rewrite !== undefined) {
|
|
||||||
const rewrite = input.rewrite;
|
|
||||||
const words = isRecord(rewrite) ? rewrite.words : undefined;
|
|
||||||
if (!isRecord(rewrite) || Object.keys(rewrite).some(key => key !== 'words') || !isRecord(words) || !Object.keys(words).length || Object.keys(words).length > MAX_REWRITES
|
|
||||||
|| Object.entries(words).some(([from, to]) => !REWRITE_FROM.test(from) || typeof to !== 'string' || !REWRITE_TO.test(to))) {
|
|
||||||
error(`"rewrite" is { "words": { "Word": "Replacement" } } with 1 to ${MAX_REWRITES} plain words`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (const field of ['version', 'description'] as const) {
|
for (const field of ['version', 'description'] as const) {
|
||||||
const value = input[field];
|
const value = input[field];
|
||||||
if (value !== undefined && (typeof value !== 'string' || value.length > 400 || CONTROL.test(value) || /[<>]/.test(value))) error(`"${field}" must be plain text`);
|
if (value !== undefined && (typeof value !== 'string' || value.length > 400 || CONTROL.test(value) || /[<>]/.test(value))) error(`"${field}" must be plain text`);
|
||||||
}
|
}
|
||||||
if (!isRecord(input.strings)) error('"strings" must be an object of key id -> text');
|
if (!isRecord(input.strings)) error('"strings" must be an object of key id -> text');
|
||||||
else if (Object.keys(input.strings).length > STRING_PACK_LIMITS.strings) error(`"strings" has more than ${STRING_PACK_LIMITS.strings} entries`);
|
else if (Object.keys(input.strings).length > STRING_PACK_LIMITS.strings) error(`"strings" has more than ${STRING_PACK_LIMITS.strings} entries`);
|
||||||
const known = new Set(['$schema', 'format', 'site', 'catalog', 'language', 'base', 'when', 'rewrite', 'name', 'authors', 'version', 'description', 'strings']);
|
const known = new Set(['$schema', 'format', 'site', 'catalog', 'language', 'base', 'name', 'authors', 'version', 'description', 'strings']);
|
||||||
for (const key of Object.keys(input)) if (!known.has(key)) issues.push({ level: 'warning', message: `unknown field "${key}" is ignored` });
|
for (const key of Object.keys(input)) if (!known.has(key)) issues.push({ level: 'warning', message: `unknown field "${key}" is ignored` });
|
||||||
return issues;
|
return issues;
|
||||||
}
|
}
|
||||||
|
|
@ -349,7 +293,7 @@ function checkParts(parts: Parts, shape: EntryShape): string | null {
|
||||||
* reason it is refused (the original then stays).
|
* reason it is refused (the original then stays).
|
||||||
*/
|
*/
|
||||||
export function validateString(shape: EntryShape, value: unknown): { parts: Parts } | { reason: string } {
|
export function validateString(shape: EntryShape, value: unknown): { parts: Parts } | { reason: string } {
|
||||||
if (!translatable(shape)) return { reason: `not translatable yet (${shape.kind})` };
|
if (!translatable(shape.kind)) return { reason: `not translatable yet (${shape.kind})` };
|
||||||
if (typeof value !== 'string') return { reason: 'the value must be text' };
|
if (typeof value !== 'string') return { reason: 'the value must be text' };
|
||||||
if (!value) return { reason: 'the value is empty' };
|
if (!value) return { reason: 'the value is empty' };
|
||||||
if (value.length > STRING_PACK_LIMITS.value) return { reason: `longer than ${STRING_PACK_LIMITS.value} characters` };
|
if (value.length > STRING_PACK_LIMITS.value) return { reason: `longer than ${STRING_PACK_LIMITS.value} characters` };
|
||||||
|
|
@ -362,20 +306,6 @@ export function validateString(shape: EntryShape, value: unknown): { parts: Part
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return { reason: `invalid message syntax: ${error instanceof Error ? error.message : String(error)}` };
|
return { reason: `invalid message syntax: ${error instanceof Error ? error.message : String(error)}` };
|
||||||
}
|
}
|
||||||
if (shape.kind === 'rich') {
|
|
||||||
// Element slots: `{e0}` … `{e<slots-1>}`, each exactly once (the last may be left out); no plural, select or other parameter.
|
|
||||||
const slots = Array.from({ length: shape.slots ?? 0 }, (_, index) => `e${index}`);
|
|
||||||
const bad = checkParts(parts, { kind: 'message', params: slots });
|
|
||||||
if (bad) return { reason: bad };
|
|
||||||
const used = parts.flatMap(part => (typeof part !== 'string' && part.kind === 'arg' ? [part.name] : []));
|
|
||||||
for (const name of slots) {
|
|
||||||
const count = used.filter(item => item === name).length;
|
|
||||||
// The element after the last piece is not always there: that one slot may be left out.
|
|
||||||
if (count === 0 && name === slots[slots.length - 1] && slots.length > 0) continue;
|
|
||||||
if (count !== 1) return { reason: count ? `{${name}} (the original's element) must appear once, not ${count} times` : `the original's element {${name}} is missing` };
|
|
||||||
}
|
|
||||||
return { parts };
|
|
||||||
}
|
|
||||||
const problem = checkParts(parts, shape.kind === 'message' ? shape : { kind: 'text' });
|
const problem = checkParts(parts, shape.kind === 'message' ? shape : { kind: 'text' });
|
||||||
return problem ? { reason: problem } : { parts };
|
return problem ? { reason: problem } : { parts };
|
||||||
}
|
}
|
||||||
|
|
@ -383,13 +313,7 @@ export function validateString(shape: EntryShape, value: unknown): { parts: Part
|
||||||
// -------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------
|
||||||
// Compiling a pack (validation against an inventory)
|
// Compiling a pack (validation against an inventory)
|
||||||
|
|
||||||
/**
|
export type CompiledValue = { text: string } | { parts: Parts };
|
||||||
* A replaced `rich` value in the shape X's own renderer reads: piece `n` is shown, then the site's
|
|
||||||
* element `order[n]` (the last piece has no element after it).
|
|
||||||
*/
|
|
||||||
export type RichTemplate = { readonly pieces: readonly string[]; readonly order: readonly number[] };
|
|
||||||
|
|
||||||
export type CompiledValue = { text: string } | { parts: Parts } | { rich: RichTemplate };
|
|
||||||
|
|
||||||
export type PackReport = {
|
export type PackReport = {
|
||||||
/** Entries in the pack. */
|
/** Entries in the pack. */
|
||||||
|
|
@ -406,9 +330,6 @@ export type CompiledPack = {
|
||||||
name: string;
|
name: string;
|
||||||
language: string;
|
language: string;
|
||||||
base?: string;
|
base?: string;
|
||||||
when?: PackCondition;
|
|
||||||
/** The pack's word rewriting, ready to apply to a text. */
|
|
||||||
rewrite?: (text: string) => string;
|
|
||||||
site: string;
|
site: string;
|
||||||
catalog: string;
|
catalog: string;
|
||||||
values: ReadonlyMap<string, CompiledValue>;
|
values: ReadonlyMap<string, CompiledValue>;
|
||||||
|
|
@ -420,28 +341,6 @@ function literal(parts: Parts): string {
|
||||||
return parts.map(part => (typeof part === 'string' ? part : '')).join('');
|
return parts.map(part => (typeof part === 'string' ? part : '')).join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The word-for-word rewriting of a validated `rewrite` rule. */
|
|
||||||
function compileRewrite(rule: PackRewrite): (text: string) => string {
|
|
||||||
const words = new Map(Object.entries(rule.words));
|
|
||||||
// Words are letters and digits only (checked), so they need no escaping.
|
|
||||||
const alternatives = [...words.keys()].sort((a, b) => b.length - a.length).join('|');
|
|
||||||
const pattern = new RegExp(String.raw`(?<![\p{L}\p{N}_])(?:${alternatives})(?![\p{L}\p{N}_])`, 'gu');
|
|
||||||
return text => text.replace(pattern, word => words.get(word) ?? word);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** A validated rich value as pieces and element order. */
|
|
||||||
function richTemplate(parts: Parts): RichTemplate {
|
|
||||||
const pieces: string[] = [];
|
|
||||||
const order: number[] = [];
|
|
||||||
let current = '';
|
|
||||||
for (const part of parts) {
|
|
||||||
if (typeof part === 'string') current += part;
|
|
||||||
else if (part.kind === 'arg') { pieces.push(current); order.push(Number(part.name.slice(1))); current = ''; }
|
|
||||||
}
|
|
||||||
pieces.push(current);
|
|
||||||
return Object.freeze({ pieces: Object.freeze(pieces), order: Object.freeze(order) });
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validates a pack against an inventory. Throws on a malformed envelope or a pack for another
|
* Validates a pack against an inventory. Throws on a malformed envelope or a pack for another
|
||||||
* site/catalog; every other problem is per key and lands in `report`.
|
* site/catalog; every other problem is per key and lands in `report`.
|
||||||
|
|
@ -462,10 +361,10 @@ export function compilePack(input: unknown, inventory: StringInventory | PageInv
|
||||||
if (!shape) { report.unknown.push(id); continue; }
|
if (!shape) { report.unknown.push(id); continue; }
|
||||||
const result = validateString(shape, value);
|
const result = validateString(shape, value);
|
||||||
if ('reason' in result) { report.rejected.push({ id, reason: result.reason }); continue; }
|
if ('reason' in result) { report.rejected.push({ id, reason: result.reason }); continue; }
|
||||||
values.set(id, shape.kind === 'text' ? { text: literal(result.parts) } : shape.kind === 'rich' ? { rich: richTemplate(result.parts) } : { parts: result.parts });
|
values.set(id, shape.kind === 'text' ? { text: literal(result.parts) } : { parts: result.parts });
|
||||||
report.valid += 1;
|
report.valid += 1;
|
||||||
}
|
}
|
||||||
return { name: pack.name, language: pack.language, base: pack.base, when: pack.when, rewrite: pack.rewrite ? compileRewrite(pack.rewrite) : undefined, site: pack.site, catalog: pack.catalog, values, report };
|
return { name: pack.name, language: pack.language, base: pack.base, site: pack.site, catalog: pack.catalog, values, report };
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------
|
||||||
|
|
@ -517,45 +416,6 @@ export function renderMessage(parts: Parts, params: Readonly<Record<string, unkn
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The site's (or a pack's) value of one key with `rewrite` applied; a message keeps its parameters' values as they are. */
|
|
||||||
function rewriteValue(shape: EntryShape, value: unknown, rewrite: (text: string) => string): unknown {
|
|
||||||
if (typeof value === 'string') return rewrite(value);
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
const mapped = value.map(piece => (typeof piece === 'string' ? rewrite(piece) : piece));
|
|
||||||
return mapped.some((piece, index) => piece !== value[index]) ? mapped : value;
|
|
||||||
}
|
|
||||||
if (typeof value === 'function') {
|
|
||||||
const message = value as (this: unknown, params?: unknown) => unknown;
|
|
||||||
const plural = new Set(shape.plural ?? []);
|
|
||||||
return function (this: unknown, params?: unknown) {
|
|
||||||
const input = isRecord(params) ? params : {};
|
|
||||||
// The parameters go through as private markers, so only the site's own words are reworded.
|
|
||||||
const forward: Record<string, unknown> = { ...input };
|
|
||||||
const held: [string, unknown][] = [];
|
|
||||||
for (const name of shape.params ?? []) {
|
|
||||||
if (plural.has(name) || !(name in input)) continue;
|
|
||||||
const marker = `\uE000${held.length}\uE001`;
|
|
||||||
held.push([marker, input[name]]);
|
|
||||||
forward[name] = marker;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const out = message.call(this, forward);
|
|
||||||
if (typeof out !== 'string') return message.call(this, params);
|
|
||||||
let text = rewrite(out);
|
|
||||||
for (const [marker, original] of held) text = text.split(marker).join(String(original));
|
|
||||||
return text;
|
|
||||||
} catch {
|
|
||||||
return message.call(this, params);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (typeof value === 'object' && value !== null && 'pieces' in value) {
|
|
||||||
const template = value as RichTemplate;
|
|
||||||
return Object.freeze({ pieces: Object.freeze(template.pieces.map(rewrite)), order: template.order });
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------
|
||||||
// The ordered application engine
|
// The ordered application engine
|
||||||
|
|
||||||
|
|
@ -576,11 +436,6 @@ export type StringEngine = {
|
||||||
* Feeding a value this engine produced back in returns the same value (idempotent).
|
* Feeding a value this engine produced back in returns the same value (idempotent).
|
||||||
*/
|
*/
|
||||||
resolve(id: string, original: unknown): unknown;
|
resolve(id: string, original: unknown): unknown;
|
||||||
/**
|
|
||||||
* The language the site shows (what packs with a `when.languages` condition are checked
|
|
||||||
* against). Set before the first `resolve`; until then conditional packs do not apply.
|
|
||||||
*/
|
|
||||||
setLanguage(language: string): void;
|
|
||||||
/** The site's own values of the keys a pack changed: what restoring needs. */
|
/** The site's own values of the keys a pack changed: what restoring needs. */
|
||||||
originals(): ReadonlyMap<string, unknown>;
|
originals(): ReadonlyMap<string, unknown>;
|
||||||
stats(): EngineStats;
|
stats(): EngineStats;
|
||||||
|
|
@ -599,13 +454,11 @@ export function createStringEngine(inventory: StringInventory | PageInventory |
|
||||||
const seen = new Set<string>();
|
const seen = new Set<string>();
|
||||||
const unlisted = new Set<string>();
|
const unlisted = new Set<string>();
|
||||||
const mismatched = new Set<string>();
|
const mismatched = new Set<string>();
|
||||||
let siteLanguage: string | undefined;
|
|
||||||
|
|
||||||
const winner = (id: string): { pack: CompiledPack; value: CompiledValue; index: number } | null => {
|
const winner = (id: string): { pack: CompiledPack; value: CompiledValue } | null => {
|
||||||
for (let index = packs.length - 1; index >= 0; index -= 1) {
|
for (let index = packs.length - 1; index >= 0; index -= 1) {
|
||||||
if (!conditionHolds(packs[index]!.when, siteLanguage)) continue;
|
|
||||||
const value = packs[index]!.values.get(id);
|
const value = packs[index]!.values.get(id);
|
||||||
if (value) return { pack: packs[index]!, value, index };
|
if (value) return { pack: packs[index]!, value };
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
@ -613,38 +466,31 @@ export function createStringEngine(inventory: StringInventory | PageInventory |
|
||||||
const resolve = (id: string, incoming: unknown): unknown => {
|
const resolve = (id: string, incoming: unknown): unknown => {
|
||||||
let original = incoming;
|
let original = incoming;
|
||||||
// A value of ours coming back in (a second application): work from the site's own value again.
|
// A value of ours coming back in (a second application): work from the site's own value again.
|
||||||
if ((typeof incoming === 'function' || (typeof incoming === 'object' && incoming !== null)) && produced.has(incoming)) original = produced.get(incoming);
|
if (typeof incoming === 'function' && produced.has(incoming)) original = produced.get(incoming);
|
||||||
else if (typeof incoming === 'string' && applied.has(id) && applied.get(id) === incoming) original = originals.get(id);
|
else if (typeof incoming === 'string' && applied.has(id) && applied.get(id) === incoming) original = originals.get(id);
|
||||||
seen.add(id);
|
seen.add(id);
|
||||||
const found = winner(id);
|
const found = winner(id);
|
||||||
// Word rewriting of the packs after the one whose text won (all of them when none did).
|
if (!found) {
|
||||||
const rewrites = packs.flatMap((pack, index) => (index > (found?.index ?? -1) && pack.rewrite && conditionHolds(pack.when, siteLanguage) ? [pack.rewrite] : []));
|
|
||||||
if (!found && !rewrites.length) {
|
|
||||||
if (whole && unlisted.size < MAX_LISTED && !lookup(id)) unlisted.add(id);
|
if (whole && unlisted.size < MAX_LISTED && !lookup(id)) unlisted.add(id);
|
||||||
return original;
|
return original;
|
||||||
}
|
}
|
||||||
const shape = lookup(id);
|
const shape = lookup(id);
|
||||||
if (!shape || shape.kind === 'format' || (found && !translatable(shape))) return original;
|
if (!shape || !translatable(shape.kind)) return original;
|
||||||
if (shape.kind === 'text' ? typeof original !== 'string' : shape.kind === 'rich' ? !Array.isArray(original) : typeof original !== 'function') {
|
if (shape.kind === 'text' ? typeof original !== 'string' : typeof original !== 'function') {
|
||||||
if (mismatched.size < MAX_LISTED) mismatched.add(id);
|
if (mismatched.size < MAX_LISTED) mismatched.add(id);
|
||||||
return original;
|
return original;
|
||||||
}
|
}
|
||||||
if (originals.has(id) && originals.get(id) === original) return applied.get(id);
|
if (originals.has(id) && originals.get(id) === original) return applied.get(id);
|
||||||
let next: unknown = original;
|
let next: unknown;
|
||||||
if (found) {
|
|
||||||
if ('text' in found.value) {
|
if ('text' in found.value) {
|
||||||
next = found.value.text;
|
next = found.value.text;
|
||||||
} else if ('rich' in found.value) {
|
|
||||||
next = found.value.rich;
|
|
||||||
} else {
|
} else {
|
||||||
const parts = found.value.parts;
|
const parts = found.value.parts;
|
||||||
const languages = [found.pack.language, found.pack.base];
|
const languages = [found.pack.language, found.pack.base];
|
||||||
next = (params?: unknown): string => renderMessage(parts, isRecord(params) ? params : {}, languages);
|
const message = (params?: unknown): string => renderMessage(parts, isRecord(params) ? params : {}, languages);
|
||||||
|
produced.set(message, original);
|
||||||
|
next = message;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
for (const rewrite of rewrites) next = rewriteValue(shape, next, rewrite);
|
|
||||||
if (next === original) return original;
|
|
||||||
if (typeof next === 'function' || typeof next === 'object') produced.set(next as object, original as object);
|
|
||||||
originals.set(id, original);
|
originals.set(id, original);
|
||||||
applied.set(id, next);
|
applied.set(id, next);
|
||||||
return next;
|
return next;
|
||||||
|
|
@ -652,7 +498,6 @@ export function createStringEngine(inventory: StringInventory | PageInventory |
|
||||||
|
|
||||||
return {
|
return {
|
||||||
resolve,
|
resolve,
|
||||||
setLanguage(language) { siteLanguage = language; },
|
|
||||||
originals: () => originals,
|
originals: () => originals,
|
||||||
stats: () => ({ seen: seen.size, applied: applied.size, unlisted: [...unlisted], mismatched: [...mismatched] }),
|
stats: () => ({ seen: seen.size, applied: applied.size, unlisted: [...unlisted], mismatched: [...mismatched] }),
|
||||||
};
|
};
|
||||||
|
|
@ -694,7 +539,7 @@ export function coverage(inventory: StringInventory, pack: Pick<CompiledPack, 'v
|
||||||
for (const [id, entry] of Object.entries(inventory.entries)) {
|
for (const [id, entry] of Object.entries(inventory.entries)) {
|
||||||
const group = (out[entry.group ?? MAIN_GROUP] ??= { translatable: 0, translated: 0, closed: 0 });
|
const group = (out[entry.group ?? MAIN_GROUP] ??= { translatable: 0, translated: 0, closed: 0 });
|
||||||
for (const bucket of [group, out.all!]) {
|
for (const bucket of [group, out.all!]) {
|
||||||
if (!translatable(entry)) { bucket.closed += 1; continue; }
|
if (!translatable(entry.kind)) { bucket.closed += 1; continue; }
|
||||||
bucket.translatable += 1;
|
bucket.translatable += 1;
|
||||||
if (pack.values.has(id)) bucket.translated += 1;
|
if (pack.values.has(id)) bucket.translated += 1;
|
||||||
}
|
}
|
||||||
|
|
@ -728,7 +573,7 @@ export function driftReport(inventory: StringInventory, observed: Readonly<Recor
|
||||||
for (const [id, now] of Object.entries(observed)) {
|
for (const [id, now] of Object.entries(observed)) {
|
||||||
const before = Object.prototype.hasOwnProperty.call(inventory.entries, id) ? inventory.entries[id] : undefined;
|
const before = Object.prototype.hasOwnProperty.call(inventory.entries, id) ? inventory.entries[id] : undefined;
|
||||||
if (!before) { report.added.push(id); continue; }
|
if (!before) { report.added.push(id); continue; }
|
||||||
if (before.kind !== now.kind || before.slots !== now.slots || !sameList(before.params, now.params) || !sameList(before.plural, now.plural) || !sameList(before.select, now.select) || !sameList(before.tags, now.tags)) {
|
if (before.kind !== now.kind || !sameList(before.params, now.params) || !sameList(before.plural, now.plural) || !sameList(before.select, now.select) || !sameList(before.tags, now.tags)) {
|
||||||
report.reshaped.push(id);
|
report.reshaped.push(id);
|
||||||
} else if (before.hash !== now.hash) {
|
} else if (before.hash !== now.hash) {
|
||||||
report.reworded.push(id);
|
report.reworded.push(id);
|
||||||
|
|
|
||||||
|
|
@ -116,9 +116,7 @@ export function compileDecor<Context extends { colors: RoleColors }>(decor: Them
|
||||||
if (decor.selection) {
|
if (decor.selection) {
|
||||||
const fill = colors[decor.selection.fill];
|
const fill = colors[decor.selection.fill];
|
||||||
const text = contrastRatio(colors[decor.selection.text], fill) >= 4.5 ? colors[decor.selection.text] : (contrastRatio('#ffffff', fill) >= contrastRatio('#000000', fill) ? '#ffffff' : '#000000');
|
const text = contrastRatio(colors[decor.selection.text], fill) >= 4.5 ? colors[decor.selection.text] : (contrastRatio('#ffffff', fill) >= contrastRatio('#000000', fill) ? '#ffffff' : '#000000');
|
||||||
// A bare ::selection: with an ancestor in front (`:root:root ::selection`) every node the site
|
out.push(`:root:root ::selection{background-color:${fill} !important;color:${text} !important}`);
|
||||||
// inserts costs the engine extra style recalculation (theme matrix: 4 elements per insertion, 2 without).
|
|
||||||
out.push(`::selection{background-color:${fill} !important;color:${text} !important}`);
|
|
||||||
}
|
}
|
||||||
if (decor.scrollbar) {
|
if (decor.scrollbar) {
|
||||||
const { width, thumb = 'border', track, style } = decor.scrollbar;
|
const { width, thumb = 'border', track, style } = decor.scrollbar;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,7 @@
|
||||||
// The theme doctor: advice, never a block. A theme may do anything its trust level allows; the doctor
|
// The theme doctor: advice, never a block. A theme may do anything its trust level allows; the doctor
|
||||||
// points at the lighter mechanism for what the theme does (a token before a component setting, a
|
// points at the lighter mechanism for what the theme does (a token before a component setting, a
|
||||||
// component setting before CSS, CSS before a script) and at performance, accessibility and contrast
|
// component setting before CSS, CSS before a script) and at performance, accessibility and contrast
|
||||||
// costs. Used by the import screen, the Theme Builder's full report and `waybetter store check`.
|
// costs. Used by the import screen, the Theme Builder's report and `waybetter store check`. Pure.
|
||||||
// Pure. Every finding says where it is (a token path or the CSS rule), what was found and how to fix
|
|
||||||
// it; the words are catalog keys (`wb.doctor.<id>.found` / `.fix`, English below), so a panel shows
|
|
||||||
// them in the owner's language and the CLI prints the English.
|
|
||||||
|
|
||||||
import { contrastRatio } from './themeApi.ts';
|
import { contrastRatio } from './themeApi.ts';
|
||||||
import { ensureContrast, type ThemeSpec } from './themeSpec.ts';
|
import { ensureContrast, type ThemeSpec } from './themeSpec.ts';
|
||||||
|
|
@ -12,120 +9,49 @@ import { ensureContrast, type ThemeSpec } from './themeSpec.ts';
|
||||||
export type DoctorAdvice = {
|
export type DoctorAdvice = {
|
||||||
/** `lighter`: a lighter mechanism would do; `performance`, `accessibility`, `contrast`: a cost. */
|
/** `lighter`: a lighter mechanism would do; `performance`, `accessibility`, `contrast`: a cost. */
|
||||||
kind: 'lighter' | 'performance' | 'accessibility' | 'contrast';
|
kind: 'lighter' | 'performance' | 'accessibility' | 'contrast';
|
||||||
/** Stable id of the finding, for tests (`css-radius`, `contrast-text`). */
|
/** Stable id, for tests and translations (`wb.doctor.<id>`). */
|
||||||
id: string;
|
id: string;
|
||||||
/** Its words in the catalog: `wb.doctor.<key>.found` and `wb.doctor.<key>.fix` (`css-radius`, `contrast`). */
|
/** English text (the panel translates by id when it has the words). */
|
||||||
key: string;
|
|
||||||
/** A token path of the theme (`colors.text`, `components.postText.fontSize`) or the CSS rule (`.card { border-radius }`). */
|
|
||||||
where: string;
|
|
||||||
/** Values for the `{name}` slots of the words. */
|
|
||||||
params: Record<string, string>;
|
|
||||||
/** English: what was found. */
|
|
||||||
text: string;
|
text: string;
|
||||||
/** English: how to fix it. */
|
|
||||||
fix: string;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** The doctor's words in English (the source of `wb.doctor.*` in the catalogs). */
|
type Rule = { id: string; kind: DoctorAdvice['kind']; test: RegExp; text: string };
|
||||||
export const DOCTOR_MESSAGES = {
|
|
||||||
'wb.doctor.css-radius.found': 'This rule sets corner radii in CSS.',
|
|
||||||
'wb.doctor.css-radius.fix': 'Set them with the radius of a part under components, or shape.radius for all of them: no CSS needed, and it keeps working when the site renames its classes.',
|
|
||||||
'wb.doctor.css-bevel.found': 'This rule draws a bevelled edge with stacked inset shadows.',
|
|
||||||
'wb.doctor.css-bevel.fix': 'Use borderStyle "bevel-out" or "bevel-in" on a part under components: it draws the bevel from the theme’s colors.',
|
|
||||||
'wb.doctor.css-hide.found': 'This rule hides something with display: none.',
|
|
||||||
'wb.doctor.css-hide.fix': 'Use visible on a part under components (avatars, counts, names) or a layout variant such as sidebar: hidden; the owner can then switch it back.',
|
|
||||||
'wb.doctor.css-color.found': 'This rule uses a literal color.',
|
|
||||||
'wb.doctor.css-color.fix': 'Name a role (text, muted, accent, surface…) in colors or in a component, so the contrast pass covers it.',
|
|
||||||
'wb.doctor.css-font.found': 'This rule sets a font family.',
|
|
||||||
'wb.doctor.css-font.fix': 'Use font.roles: it sets the post, heading, numbers and mono faces without CSS.',
|
|
||||||
'wb.doctor.css-has.found': 'This rule uses :has(), which is matched again on every change of the page.',
|
|
||||||
'wb.doctor.css-has.fix': 'Keep :has() off rules that repeat down a timeline, or anchor the rule on a part.',
|
|
||||||
'wb.doctor.css-universal.found': 'This rule uses a universal selector (*), matched against every element.',
|
|
||||||
'wb.doctor.css-universal.fix': 'Anchor the rule on a part instead.',
|
|
||||||
'wb.doctor.css-blur.found': 'This rule blurs what is behind it (backdrop-filter), which is costly on parts that repeat.',
|
|
||||||
'wb.doctor.css-blur.fix': 'Use the glass fill of bars and panels: it is the cheaper place for blur.',
|
|
||||||
'wb.doctor.css-outline-none.found': 'This rule removes the focus outline, so keyboard focus is no longer visible.',
|
|
||||||
'wb.doctor.css-outline-none.fix': 'Use decor.focusRing to draw a visible focus ring instead.',
|
|
||||||
'wb.doctor.css-motion.found': 'This rule animates without checking for reduced motion.',
|
|
||||||
'wb.doctor.css-motion.fix': 'Keep motion inside @media (prefers-reduced-motion: no-preference), or let decor.motion do it for you.',
|
|
||||||
'wb.doctor.css-size.found': 'The CSS is more than 20,000 characters long.',
|
|
||||||
'wb.doctor.css-size.fix': 'The site recalculates styles with every rule; tokens and component settings compile to fewer rules.',
|
|
||||||
'wb.doctor.contrast.found': 'The {token} color was adjusted to stay readable ({ratio}:1 on the background).',
|
|
||||||
'wb.doctor.contrast.fix': 'Pick a lighter or darker {token} color; until then the theme is shown with the adjusted one.',
|
|
||||||
'wb.doctor.glass-post.found': 'Glass is set on posts, but it is not drawn: blur on every post of a timeline is too costly.',
|
|
||||||
'wb.doctor.glass-post.fix': 'Use a solid or tinted fill for posts and keep glass for bars and panels.',
|
|
||||||
'wb.doctor.small-post-text.found': 'Post text is {size}px, which is hard to read for many people.',
|
|
||||||
'wb.doctor.small-post-text.fix': 'Use 14px or more for the post text size, or raise the text size of the whole theme.',
|
|
||||||
'wb.doctor.nav-moved.found': 'The navigation is moved to the {position}, which changes where people look for it.',
|
|
||||||
'wb.doctor.nav-moved.fix': 'It only applies on wide panes, and the owner can turn layout changes off. Keep the default position unless the layout needs it.',
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
const fill = (text: string, params: Record<string, string>) => text.replace(/\{(\w+)\}/g, (_, name: string) => params[name] ?? '');
|
|
||||||
|
|
||||||
type Rule = { id: string; kind: DoctorAdvice['kind']; test: RegExp; property: string };
|
|
||||||
/** What a theme's free-form CSS does that a v2 group does without CSS. */
|
/** What a theme's free-form CSS does that a v2 group does without CSS. */
|
||||||
const CSS_RULES: Rule[] = [
|
const CSS_RULES: Rule[] = [
|
||||||
{ id: 'css-radius', kind: 'lighter', test: /border-radius\s*:/gi, property: 'border-radius' },
|
{ id: 'css-radius', kind: 'lighter', test: /border-radius\s*:/i, text: 'Corner radii: components.<part>.radius (or shape.radius) sets them without CSS and keeps working when the site renames its classes.' },
|
||||||
{ id: 'css-bevel', kind: 'lighter', test: /box-shadow\s*:[^;{}]*inset[^;{}]*inset[^;{}]*inset/gi, property: 'box-shadow' },
|
{ id: 'css-bevel', kind: 'lighter', test: /box-shadow\s*:[^;{}]*inset[^;{}]*inset[^;{}]*inset/i, text: 'Bevelled edges: components.<part>.borderStyle "bevel-out" / "bevel-in" draws them from the theme\'s colors.' },
|
||||||
{ id: 'css-hide', kind: 'lighter', test: /display\s*:\s*none/gi, property: 'display' },
|
{ id: 'css-hide', kind: 'lighter', test: /display\s*:\s*none/i, text: 'Hiding a part: components.<part>.visible (avatars, counts, names) or a layout variant (sidebar: hidden) does it, and the owner can switch it back.' },
|
||||||
{ id: 'css-color', kind: 'lighter', test: /(?:^|[;{\s])(?:color|background(?:-color)?)\s*:\s*#[0-9a-f]{3,8}/gi, property: 'color' },
|
{ id: 'css-color', kind: 'lighter', test: /(?:^|[;{\s])(?:color|background(?:-color)?)\s*:\s*#[0-9a-f]{3,8}/i, text: 'Literal colors: name a role (text, muted, accent, surface…) in colors or in a component, so the contrast pass covers it.' },
|
||||||
{ id: 'css-font', kind: 'lighter', test: /font-family\s*:/gi, property: 'font-family' },
|
{ id: 'css-font', kind: 'lighter', test: /font-family\s*:/i, text: 'Fonts: font.roles sets the post, heading, numbers and mono faces without CSS.' },
|
||||||
{ id: 'css-has', kind: 'performance', test: /:has\(/gi, property: ':has()' },
|
{ id: 'css-has', kind: 'performance', test: /:has\(/i, text: ':has() is matched again on every change of the page; keep it off rules that repeat down a timeline.' },
|
||||||
{ id: 'css-universal', kind: 'performance', test: /(?:^|[\s,>+~])\*\s*(?:[,{>+~:[]|$)/gm, property: '*' },
|
{ id: 'css-universal', kind: 'performance', test: /(?:^|[\s,>+~])\*\s*(?:[,{>+~:\[]|$)/m, text: 'A universal selector (*) is matched against every element; anchor the rule on a part.' },
|
||||||
{ id: 'css-blur', kind: 'performance', test: /backdrop-filter\s*:/gi, property: 'backdrop-filter' },
|
{ id: 'css-blur', kind: 'performance', test: /backdrop-filter\s*:/i, text: 'Blur (backdrop-filter) is costly on parts that repeat; the glass fill of bars and panels is the cheaper place for it.' },
|
||||||
{ id: 'css-outline-none', kind: 'accessibility', test: /outline\s*:\s*(?:none|0)\b/gi, property: 'outline' },
|
{ id: 'css-outline-none', kind: 'accessibility', test: /outline\s*:\s*(?:none|0)\b/i, text: 'Removing the outline hides where keyboard focus is; decor.focusRing draws a visible one instead.' },
|
||||||
{ id: 'css-motion', kind: 'accessibility', test: /(?:animation|transition)\s*:/gi, property: 'transition' },
|
{ id: 'css-motion', kind: 'accessibility', test: /(?:animation|transition)\s*:/i, text: 'Motion should stay inside @media (prefers-reduced-motion: no-preference); decor.motion does that for you.' },
|
||||||
];
|
];
|
||||||
|
|
||||||
const MAX_PER_RULE = 25;
|
/** Advice for a theme document. Empty when there is nothing to say. */
|
||||||
|
|
||||||
/** The selector of the rule block a position of `css` is in (the text before its `{`), shortened. */
|
|
||||||
function selectorAt(css: string, index: number): string {
|
|
||||||
const open = css.lastIndexOf('{', index);
|
|
||||||
if (open < 0) return '';
|
|
||||||
const close = Math.max(css.lastIndexOf('}', open - 1), css.lastIndexOf(';', open - 1), css.lastIndexOf('{', open - 1));
|
|
||||||
const selector = css.slice(close + 1, open).replace(/\s+/g, ' ').trim();
|
|
||||||
return selector.length > 80 ? `${selector.slice(0, 79)}…` : selector;
|
|
||||||
}
|
|
||||||
|
|
||||||
function advice(id: string, kind: DoctorAdvice['kind'], where: string, params: Record<string, string> = {}, key = id): DoctorAdvice {
|
|
||||||
const words = DOCTOR_MESSAGES as Record<string, string>;
|
|
||||||
return { kind, id, key, where, params, text: fill(words[`wb.doctor.${key}.found`]!, params), fix: fill(words[`wb.doctor.${key}.fix`]!, params) };
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Advice for a theme document: every finding, with where it is. Empty when there is nothing to say. */
|
|
||||||
export function themeDoctor(theme: ThemeSpec): DoctorAdvice[] {
|
export function themeDoctor(theme: ThemeSpec): DoctorAdvice[] {
|
||||||
const out: DoctorAdvice[] = [];
|
const out: DoctorAdvice[] = [];
|
||||||
const css = theme.css ?? '';
|
const css = theme.css ?? '';
|
||||||
if (css.trim()) {
|
if (css.trim()) {
|
||||||
for (const rule of CSS_RULES) {
|
for (const rule of CSS_RULES) if (rule.test.test(css)) out.push({ kind: rule.kind, id: rule.id, text: rule.text });
|
||||||
const seen = new Set<string>();
|
if (css.length > 20_000) out.push({ kind: 'performance', id: 'css-size', text: 'More than 20,000 characters of CSS: the site recalculates styles with every rule; tokens and component settings compile to fewer rules.' });
|
||||||
for (const match of css.matchAll(rule.test)) {
|
|
||||||
const selector = selectorAt(css, match.index ?? 0) || 'css';
|
|
||||||
const where = rule.id === 'css-universal' || rule.id === 'css-has' ? selector : `${selector} { ${rule.property} }`;
|
|
||||||
if (seen.has(where)) continue;
|
|
||||||
seen.add(where);
|
|
||||||
out.push(advice(rule.id, rule.kind, where));
|
|
||||||
if (seen.size >= MAX_PER_RULE) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (css.length > 20_000) out.push(advice('css-size', 'performance', 'css'));
|
|
||||||
}
|
}
|
||||||
if (theme.colors) {
|
if (theme.colors) {
|
||||||
const fixed = ensureContrast(theme.colors);
|
const fixed = ensureContrast(theme.colors);
|
||||||
for (const role of ['text', 'muted', 'accent'] as const) {
|
for (const role of ['text', 'muted', 'accent'] as const) {
|
||||||
if (fixed[role] !== theme.colors[role]) {
|
if (fixed[role] !== theme.colors[role]) out.push({ kind: 'contrast', id: `contrast-${role}`, text: `The ${role} color was adjusted to stay readable (${contrastRatio(theme.colors[role], theme.colors.bg).toFixed(2)}:1 on the background).` });
|
||||||
out.push(advice(`contrast-${role}`, 'contrast', `colors.${role}`, { token: role, ratio: contrastRatio(theme.colors[role], theme.colors.bg).toFixed(2) }, 'contrast'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (theme.components) {
|
if (theme.components) {
|
||||||
if (theme.components.post?.fill === 'glass') out.push(advice('glass-post', 'performance', 'components.post.fill'));
|
const posts = theme.components.post;
|
||||||
const size = theme.components.postText?.fontSize;
|
if (posts?.fill === 'glass') out.push({ kind: 'performance', id: 'glass-post', text: 'Glass on posts is not drawn: blur on every post of a timeline is too costly.' });
|
||||||
if (size !== undefined && size < 14) out.push(advice('small-post-text', 'accessibility', 'components.postText.fontSize', { size: String(size) }));
|
const text = theme.components.postText?.fontSize;
|
||||||
|
if (text !== undefined && text < 14) out.push({ kind: 'accessibility', id: 'small-post-text', text: 'Post text under 14px is hard to read for many people.' });
|
||||||
}
|
}
|
||||||
if (theme.variants?.nav === 'top' || theme.variants?.nav === 'bottom') {
|
if (theme.variants?.nav === 'top' || theme.variants?.nav === 'bottom') {
|
||||||
out.push(advice('nav-moved', 'accessibility', 'variants.nav', { position: theme.variants.nav }));
|
out.push({ kind: 'accessibility', id: 'nav-moved', text: 'Moving the navigation changes where people look for it; it only applies on wide panes, and the owner can turn layout changes off.' });
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -216,11 +216,7 @@ export function glyphSvg(glyph: IconGlyph, style: IconStyle, colors: RoleColors
|
||||||
if (def) defs.push(def);
|
if (def) defs.push(def);
|
||||||
return `<path d="${esc(layer.d)}" fill="${attr}"${layer.opacity !== undefined ? ` opacity="${layer.opacity}"` : ''}${layer.rule ? ' fill-rule="evenodd"' : ''}/>`;
|
return `<path d="${esc(layer.d)}" fill="${attr}"${layer.opacity !== undefined ? ` opacity="${layer.opacity}"` : ''}${layer.rule ? ' fill-rule="evenodd"' : ''}/>`;
|
||||||
});
|
});
|
||||||
// Pixel art (every layer made of axis-aligned rectangles: M, h, v, z only) stays crisp when the
|
return `${open}${defs.length ? `<defs>${defs.join('')}</defs>` : ''}${paths.join('')}</svg>`;
|
||||||
// 24px box is drawn at a size that is not a whole multiple of its grid (X's rail draws 26px icons).
|
|
||||||
const pixel = glyph.layers.every(layer => /^[MmHhVvZz0-9eE\s,.+-]+$/.test(layer.d));
|
|
||||||
const svg = pixel ? open.replace('<svg ', '<svg shape-rendering="crispEdges" ') : open;
|
|
||||||
return `${svg}${defs.length ? `<defs>${defs.join('')}</defs>` : ''}${paths.join('')}</svg>`;
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -272,17 +268,14 @@ export function compileIcons(pack: IconPack | null, theme: ThemeIcons | null | u
|
||||||
const gate = ctx.gate ? `html[${ctx.gate}~="${matcher.group}"] ` : '';
|
const gate = ctx.gate ? `html[${ctx.gate}~="${matcher.group}"] ` : '';
|
||||||
const selectors = iconSelectors(matcher).map(one => `${gate}${one}`);
|
const selectors = iconSelectors(matcher).map(one => `${gate}${one}`);
|
||||||
if (!selectors.length) continue;
|
if (!selectors.length) continue;
|
||||||
// Drawn in the content box, whole (live 2026-10-01: X's search field icon is a 28x16 box with 12px of
|
const size = `${Math.round(style.scale * 100)}%`;
|
||||||
// padding, and `100%` of that width cut the top and bottom off a pixel glyph and moved it left);
|
|
||||||
// a scaled pack is sized by the box's height, the smaller side of every icon box X draws.
|
|
||||||
const size = style.scale === 1 ? 'contain' : `auto ${Math.round(style.scale * 100)}%`;
|
|
||||||
if ('png' in glyph) {
|
if ('png' in glyph) {
|
||||||
colored.push(`${selectors.join(',')}{background:url("${glyph.png}") center / ${size} no-repeat content-box !important;${glyph.pixel ? 'image-rendering:pixelated;' : ''}}`);
|
colored.push(`${selectors.join(',')}{background:url("${glyph.png}") center / ${size} no-repeat !important;${glyph.pixel ? 'image-rendering:pixelated;' : ''}}`);
|
||||||
} else {
|
} else {
|
||||||
const svg = glyphSvg(glyph, style, ctx.colors);
|
const svg = glyphSvg(glyph, style, ctx.colors);
|
||||||
if (!svg) continue;
|
if (!svg) continue;
|
||||||
if (isColored(glyph)) colored.push(`${selectors.join(',')}{background:${svgUrl(svg)} center / ${size} no-repeat content-box !important}`);
|
if (isColored(glyph)) colored.push(`${selectors.join(',')}{background:${svgUrl(svg)} center / ${size} no-repeat !important}`);
|
||||||
else masked.push(`${selectors.join(',')}{background-color:currentColor !important;-webkit-mask:${svgUrl(svg)} center / ${size} no-repeat content-box;mask:${svgUrl(svg)} center / ${size} no-repeat content-box}`);
|
else masked.push(`${selectors.join(',')}{background-color:currentColor !important;-webkit-mask:${svgUrl(svg)} center / ${size} no-repeat;mask:${svgUrl(svg)} center / ${size} no-repeat}`);
|
||||||
}
|
}
|
||||||
hidden.push(...selectors.map(one => `${one} > *`));
|
hidden.push(...selectors.map(one => `${one} > *`));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,143 +0,0 @@
|
||||||
import assert from 'node:assert/strict';
|
|
||||||
import { test } from 'node:test';
|
|
||||||
import {
|
|
||||||
compilePack, conditionHolds, coverage, createStringEngine, driftReport, inventoryLookup, packInventory, sliceInventory, validateString,
|
|
||||||
checkPackShape, isPageInventory, type StringInventory,
|
|
||||||
} from '../src/stringPacks.ts';
|
|
||||||
|
|
||||||
const INVENTORY: StringInventory = {
|
|
||||||
format: 1, site: 'demo', catalog: 'web', base: 'en',
|
|
||||||
entries: {
|
|
||||||
t1: { kind: 'text', hash: 'h1' },
|
|
||||||
r2: { kind: 'rich', slots: 2, hash: 'h2' },
|
|
||||||
r0: { kind: 'rich', slots: 0, hash: 'h3' },
|
|
||||||
rx: { kind: 'rich', hash: 'h4' },
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const pack = (strings: Record<string, string>, extra: object = {}) =>
|
|
||||||
({ format: 1, site: 'demo', catalog: 'web', language: 'eo', name: 'P', authors: ['a'], strings, ...extra });
|
|
||||||
|
|
||||||
test('rich values: element slots {e0}..{n-1}, each once, in any order; nothing else', () => {
|
|
||||||
const shape = inventoryLookup(INVENTORY)('r2')!;
|
|
||||||
assert.ok('parts' in validateString(shape, 'Legu {e1} antaŭ {e0}.'));
|
|
||||||
assert.ok('parts' in validateString(shape, 'Legu {e0}.'), 'the last slot may be left out');
|
|
||||||
assert.match((validateString(shape, 'Legu {e1}.') as { reason: string }).reason, /\{e0\}.*missing/);
|
|
||||||
assert.match((validateString(shape, '{e0} {e0} {e1}') as { reason: string }).reason, /once/);
|
|
||||||
assert.match((validateString(shape, '{e0} {e1} {e2}') as { reason: string }).reason, /not a parameter/);
|
|
||||||
assert.match((validateString(shape, '{e0} {e1, plural, other {x}}') as { reason: string }).reason, /not a plural/);
|
|
||||||
assert.match((validateString(shape, '<a>{e0}</a> {e1}') as { reason: string }).reason, /markup/);
|
|
||||||
assert.match((validateString(inventoryLookup(INVENTORY)('rx')!, 'x') as { reason: string }).reason, /not translatable yet/);
|
|
||||||
assert.ok('parts' in validateString(inventoryLookup(INVENTORY)('r0')!, 'Nur teksto'));
|
|
||||||
});
|
|
||||||
|
|
||||||
test('rich engine: pieces + element order, idempotent, original kept; a non-array original is left alone', () => {
|
|
||||||
const compiled = compilePack(pack({ r2: 'A {e1} B {e0} C', t1: 'Hejmo' }), INVENTORY);
|
|
||||||
assert.equal(compiled.report.valid, 2);
|
|
||||||
const engine = createStringEngine(INVENTORY, [compiled]);
|
|
||||||
const site = ['Read ', , ' now'];
|
|
||||||
const out = engine.resolve('r2', site) as { pieces: string[]; order: number[] };
|
|
||||||
assert.deepEqual(out, { pieces: ['A ', ' B ', ' C'], order: [1, 0] });
|
|
||||||
assert.equal(engine.resolve('r2', out), out, 'feeding the result back changes nothing');
|
|
||||||
assert.equal(engine.originals().get('r2'), site);
|
|
||||||
assert.equal(engine.resolve('r2', 'not an array'), 'not an array');
|
|
||||||
assert.deepEqual(engine.stats().mismatched, ['r2']);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('page inventory carries rich slots; closed rich stays closed; coverage counts replaceable rich', () => {
|
|
||||||
const page = packInventory(INVENTORY);
|
|
||||||
assert.deepEqual(page.rich, { r2: 2, r0: 0 });
|
|
||||||
assert.ok(isPageInventory(JSON.parse(JSON.stringify(page))));
|
|
||||||
assert.ok(!isPageInventory({ ...page, rich: { r2: -1 } }));
|
|
||||||
assert.equal(inventoryLookup(page)('r2')!.slots, 2);
|
|
||||||
assert.equal(inventoryLookup(page)('rx')!.kind, 'rich');
|
|
||||||
assert.equal(inventoryLookup(page)('rx')!.slots, undefined);
|
|
||||||
assert.deepEqual(sliceInventory(page, ['r2']).rich, { r2: 2 });
|
|
||||||
const cover = coverage(INVENTORY, compilePack(pack({ r2: '{e0}{e1}' }), INVENTORY));
|
|
||||||
assert.deepEqual(cover.all, { translatable: 3, translated: 1, closed: 1 });
|
|
||||||
const drift = driftReport(INVENTORY, { r2: { kind: 'rich', slots: 3, hash: 'h2' } }, ['main']);
|
|
||||||
assert.deepEqual(drift.reshaped, ['r2']);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('language condition: a pack with when.languages applies only on matching site languages', () => {
|
|
||||||
assert.equal(conditionHolds(undefined, undefined), true);
|
|
||||||
assert.equal(conditionHolds({ languages: ['en'] }, 'en'), true);
|
|
||||||
assert.equal(conditionHolds({ languages: ['en'] }, 'en-GB'), true);
|
|
||||||
assert.equal(conditionHolds({ languages: ['en'] }, 'EN-gb'), true);
|
|
||||||
assert.equal(conditionHolds({ languages: ['en'] }, 'tr'), false);
|
|
||||||
assert.equal(conditionHolds({ languages: ['en'] }, 'ent'), false);
|
|
||||||
assert.equal(conditionHolds({ languages: ['en'] }, undefined), false);
|
|
||||||
const compiled = compilePack(pack({ t1: 'Tweet' }, { when: { languages: ['en'] } }), INVENTORY);
|
|
||||||
const engine = createStringEngine(INVENTORY, [compiled]);
|
|
||||||
assert.equal(engine.resolve('t1', 'Post'), 'Post', 'no language yet: conditional pack waits');
|
|
||||||
engine.setLanguage('tr');
|
|
||||||
assert.equal(engine.resolve('t1', 'Gönderi'), 'Gönderi');
|
|
||||||
const english = createStringEngine(INVENTORY, [compiled]);
|
|
||||||
english.setLanguage('en-GB');
|
|
||||||
assert.equal(english.resolve('t1', 'Post'), 'Tweet');
|
|
||||||
assert.equal(english.resolve('t1', 'Tweet'), 'Tweet');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('when is checked as part of the envelope', () => {
|
|
||||||
const errors = (when: unknown) => checkPackShape(pack({ t1: 'x' }, { when })).filter(issue => issue.level === 'error').length;
|
|
||||||
assert.equal(errors({ languages: ['en', 'en-GB'] }), 0);
|
|
||||||
assert.equal(errors({ languages: [] }), 1);
|
|
||||||
assert.equal(errors({ languages: ['<b>'] }), 1);
|
|
||||||
assert.equal(errors({ code: 'x' }), 1);
|
|
||||||
assert.equal(errors('en'), 1);
|
|
||||||
});
|
|
||||||
|
|
||||||
const REWRITE_INVENTORY: StringInventory = {
|
|
||||||
format: 1, site: 'demo', catalog: 'web', base: 'en',
|
|
||||||
entries: {
|
|
||||||
t1: { kind: 'text', hash: 'h' },
|
|
||||||
m1: { kind: 'message', params: ['name', 'count'], plural: ['count'], hash: 'h' },
|
|
||||||
r1: { kind: 'rich', slots: 2, hash: 'h' },
|
|
||||||
f1: { kind: 'format', hash: 'h' },
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const WORDS = { Post: 'Tweet', Posts: 'Tweets', post: 'tweet', posts: 'tweets', Repost: 'Retweet' };
|
|
||||||
const wording = (extra: object = {}) => pack({}, { rewrite: { words: WORDS }, when: { languages: ['en'] }, ...extra });
|
|
||||||
|
|
||||||
test('rewrite: whole words in the own text of the site, carrying none of its sentences', () => {
|
|
||||||
const compiled = compilePack(wording(), REWRITE_INVENTORY);
|
|
||||||
assert.equal(compiled.values.size, 0);
|
|
||||||
const engine = createStringEngine(REWRITE_INVENTORY, [compiled]);
|
|
||||||
engine.setLanguage('en');
|
|
||||||
assert.equal(engine.resolve('t1', 'Post, Repost and Posts of the postal service; compost'), 'Tweet, Retweet and Tweets of the postal service; compost');
|
|
||||||
assert.equal(engine.resolve('t1', 'Nothing here'), 'Nothing here');
|
|
||||||
const site = (e: { name: string; count: number }) => `${e.name} has ${e.count} posts`;
|
|
||||||
const message = engine.resolve('m1', site) as (e: unknown) => string;
|
|
||||||
assert.equal(message({ name: 'Post Malone', count: 3 }), 'Post Malone has 3 tweets', 'a parameter value is never reworded');
|
|
||||||
assert.equal(message({ name: 'Ann', count: 1 }), 'Ann has 1 tweets');
|
|
||||||
assert.equal(engine.resolve('m1', message), message, 'feeding the result back changes nothing');
|
|
||||||
assert.equal(engine.originals().get('m1'), site);
|
|
||||||
const rich = engine.resolve('r1', ['Your post ', , ' was a Repost']) as unknown[];
|
|
||||||
assert.deepEqual(rich, ['Your tweet ', , ' was a Retweet']);
|
|
||||||
const same = ['No words'];
|
|
||||||
assert.equal(engine.resolve('r1', same), same, 'an unchanged value is the same object');
|
|
||||||
assert.equal(engine.resolve('f1', 'Post'), 'Post', 'formatters are never touched');
|
|
||||||
assert.equal(engine.resolve('zzz', 'Post'), 'Post', 'unknown keys are never touched');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('rewrite: language condition, order with replacing packs, and its own validation', () => {
|
|
||||||
const compiled = compilePack(wording(), REWRITE_INVENTORY);
|
|
||||||
const turkish = createStringEngine(REWRITE_INVENTORY, [compiled]);
|
|
||||||
turkish.setLanguage('tr');
|
|
||||||
assert.equal(turkish.resolve('t1', 'Post'), 'Post');
|
|
||||||
// A later pack's own text wins and is not reworded; an earlier pack's text is.
|
|
||||||
const later = compilePack(pack({ t1: 'Post office' }, { language: 'en-x-b' }), REWRITE_INVENTORY);
|
|
||||||
const earlier = compilePack(pack({ t1: 'Post office' }, { language: 'en-x-a' }), REWRITE_INVENTORY);
|
|
||||||
const a = createStringEngine(REWRITE_INVENTORY, [compiled, later]);
|
|
||||||
a.setLanguage('en');
|
|
||||||
assert.equal(a.resolve('t1', 'Post'), 'Post office');
|
|
||||||
const b = createStringEngine(REWRITE_INVENTORY, [earlier, compiled]);
|
|
||||||
b.setLanguage('en');
|
|
||||||
assert.equal(b.resolve('t1', 'Post'), 'Tweet office');
|
|
||||||
const bad = (rewrite: unknown) => checkPackShape(wording({ rewrite })).filter(issue => issue.level === 'error').length;
|
|
||||||
assert.equal(bad({ words: { Post: 'Tweet' } }), 0);
|
|
||||||
assert.equal(bad({ words: {} }), 1);
|
|
||||||
assert.equal(bad({ words: { Post: '<b>Tweet</b>' } }), 1);
|
|
||||||
assert.equal(bad({ words: { 'two words': 'x' } }), 1);
|
|
||||||
assert.equal(bad({ words: { Post: 'Tweet' }, code: 1 }), 1);
|
|
||||||
assert.equal(bad({ words: Object.fromEntries(Array.from({ length: 65 }, (_, i) => [`w${i}`, 'x'])) }), 1);
|
|
||||||
});
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import assert from 'node:assert/strict';
|
import assert from 'node:assert/strict';
|
||||||
import test from 'node:test';
|
import test from 'node:test';
|
||||||
import { DOCTOR_MESSAGES, themeDoctor } from '../src/themeDoctor.ts';
|
import { themeDoctor } from '../src/themeDoctor.ts';
|
||||||
import { sanitizeSpec } from '../src/themeSpec.ts';
|
import { sanitizeSpec } from '../src/themeSpec.ts';
|
||||||
|
|
||||||
const ids = (raw: unknown) => themeDoctor(sanitizeSpec(raw)).map(advice => advice.id);
|
const ids = (raw: unknown) => themeDoctor(sanitizeSpec(raw)).map(advice => advice.id);
|
||||||
|
|
@ -42,34 +42,3 @@ test('unreadable colors are named with their contrast', () => {
|
||||||
assert.equal(text.kind, 'contrast');
|
assert.equal(text.kind, 'contrast');
|
||||||
assert.match(text.text, /\d\.\d\d:1/);
|
assert.match(text.text, /\d\.\d\d:1/);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('every finding says where it is (token or selector), what it found and how to fix it', () => {
|
|
||||||
const css = '.card { border-radius: 4px; }\n.row { border-radius: 2px; }\n.row { border-radius: 3px; }\n@media (min-width: 1px) { .nav a { display: none; } }\n* { margin: 0 }';
|
|
||||||
const theme = sanitizeSpec({ name: 'Where', css, colors: { bg: '#000000', text: '#111111', accent: '#1d9bf0' }, components: { postText: { fontSize: 13 } }, variants: { nav: 'top' } });
|
|
||||||
const found = themeDoctor(theme);
|
|
||||||
const radius = found.filter(item => item.id === 'css-radius').map(item => item.where);
|
|
||||||
assert.deepEqual(radius, ['.card { border-radius }', '.row { border-radius }'], 'one finding per rule, not per property');
|
|
||||||
assert.ok(found.some(item => item.id === 'css-hide' && item.where === '.nav a { display }'), 'a rule inside @media names its own selector');
|
|
||||||
assert.ok(found.some(item => item.id === 'css-universal'));
|
|
||||||
const token = found.find(item => item.id === 'contrast-text')!;
|
|
||||||
assert.equal(token.where, 'colors.text');
|
|
||||||
assert.equal(token.key, 'contrast');
|
|
||||||
assert.deepEqual(Object.keys(token.params), ['token', 'ratio']);
|
|
||||||
assert.match(token.text, /^The text color was adjusted/);
|
|
||||||
assert.ok(found.some(item => item.where === 'components.postText.fontSize' && item.params.size === '13'));
|
|
||||||
assert.ok(found.some(item => item.where === 'variants.nav' && item.params.position === 'top'));
|
|
||||||
for (const item of found) {
|
|
||||||
assert.ok(item.fix.length > 10, `${item.id} has a fix hint`);
|
|
||||||
assert.ok(`wb.doctor.${item.key}.found` in DOCTOR_MESSAGES && `wb.doctor.${item.key}.fix` in DOCTOR_MESSAGES, `${item.key} has catalog words`);
|
|
||||||
assert.ok(!/\{\w+\}/.test(item.text + item.fix), `${item.id}: every slot is filled`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
test('the doctor\'s words are plain text with only the slots its findings fill', () => {
|
|
||||||
for (const [key, text] of Object.entries(DOCTOR_MESSAGES)) {
|
|
||||||
assert.ok(!/[<>]/.test(text), `${key} has no markup`);
|
|
||||||
for (const slot of text.matchAll(/\{(\w+)\}/g)) assert.ok(['token', 'ratio', 'size', 'position'].includes(slot[1]!), `${key}: {${slot[1]}}`);
|
|
||||||
}
|
|
||||||
const ids = new Set(Object.keys(DOCTOR_MESSAGES).map(key => key.replace(/\.(found|fix)$/, '')));
|
|
||||||
for (const id of ids) assert.ok(`${id}.found` in DOCTOR_MESSAGES && `${id}.fix` in DOCTOR_MESSAGES, id);
|
|
||||||
});
|
|
||||||
|
|
|
||||||
|
|
@ -223,13 +223,13 @@ test('icons are drawn as masks of the current color (colored glyphs as images),
|
||||||
const out = compileIcons(PACK, null, TABLE, { colors: COLORS, gate: 'data-wb-icons' });
|
const out = compileIcons(PACK, null, TABLE, { colors: COLORS, gate: 'data-wb-icons' });
|
||||||
assert.ok(out.startsWith('@media (forced-colors:none){@supports ((mask-image:url("")) or (-webkit-mask-image:url(""))){'));
|
assert.ok(out.startsWith('@media (forced-colors:none){@supports ((mask-image:url("")) or (-webkit-mask-image:url(""))){'));
|
||||||
const home = out.split('\n').find(line => line.startsWith('html[data-wb-icons~="nav"] [data-nav="home"] svg{'))!;
|
const home = out.split('\n').find(line => line.startsWith('html[data-wb-icons~="nav"] [data-nav="home"] svg{'))!;
|
||||||
assert.ok(home.includes('background-color:currentColor !important') && home.includes('-webkit-mask:url("data:image/svg+xml,') && home.includes('mask:url("data:image/svg+xml,') && home.includes('/ auto 90% no-repeat content-box'));
|
assert.ok(home.includes('background-color:currentColor !important') && home.includes('-webkit-mask:url("data:image/svg+xml,') && home.includes('mask:url("data:image/svg+xml,') && home.includes('/ 90% no-repeat'));
|
||||||
const svgOf = (line: string) => decodeURIComponent(/url\("data:image\/svg\+xml,([^"]*)"\)/.exec(line)![1]!);
|
const svgOf = (line: string) => decodeURIComponent(/url\("data:image\/svg\+xml,([^"]*)"\)/.exec(line)![1]!);
|
||||||
assert.ok(svgOf(home).includes('stroke-width="2" stroke-linecap="square" stroke-linejoin="miter"'), 'the pack\'s stroke style');
|
assert.ok(svgOf(home).includes('stroke-width="2" stroke-linecap="square" stroke-linejoin="miter"'), 'the pack\'s stroke style');
|
||||||
const reply = out.split('\n').find(line => line.startsWith('html[data-wb-icons~="actions"] [data-act="reply"] svg{'))!;
|
const reply = out.split('\n').find(line => line.startsWith('html[data-wb-icons~="actions"] [data-act="reply"] svg{'))!;
|
||||||
assert.ok(reply.includes('background:url("data:image/svg+xml,') && !reply.includes('mask'), 'layers carry their own colors');
|
assert.ok(reply.includes('background:url("data:image/svg+xml,') && !reply.includes('mask'), 'layers carry their own colors');
|
||||||
assert.ok(svgOf(reply).includes(`fill="${COLORS.accent}" opacity="0.8"`) && svgOf(reply).includes('<linearGradient id="g0"'));
|
assert.ok(svgOf(reply).includes(`fill="${COLORS.accent}" opacity="0.8"`) && svgOf(reply).includes('<linearGradient id="g0"'));
|
||||||
assert.ok(out.includes('svg:has(> g > path[d^="M12 2.59l5.7 5.7"]){background:url("data:image/png;base64,iVBORw0KGgo=") center / auto 90% no-repeat content-box !important;image-rendering:pixelated;}'));
|
assert.ok(out.includes('svg:has(> g > path[d^="M12 2.59l5.7 5.7"]){background:url("data:image/png;base64,iVBORw0KGgo=") center / 90% no-repeat !important;image-rendering:pixelated;}'));
|
||||||
assert.ok(out.includes('[data-act="unlike"] svg > *') && out.includes('{opacity:0 !important}'), 'the site\'s own paths are hidden, not removed');
|
assert.ok(out.includes('[data-act="unlike"] svg > *') && out.includes('{opacity:0 !important}'), 'the site\'s own paths are hidden, not removed');
|
||||||
assert.ok(!out.includes('explore') && !out.includes('script'), 'no glyph: the site\'s icon stays; a signature that is not path data is never written');
|
assert.ok(!out.includes('explore') && !out.includes('script'), 'no glyph: the site\'s icon stays; a signature that is not path data is never written');
|
||||||
// No encoded quote can end the url("…") early.
|
// No encoded quote can end the url("…") early.
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
import { useEffect, useRef, useState, useSyncExternalStore, type KeyboardEvent, type ReactNode } from 'react';
|
import { useEffect, useRef, useState, useSyncExternalStore, type KeyboardEvent, type ReactNode } from 'react';
|
||||||
import { createPortal } from 'react-dom';
|
import { createPortal } from 'react-dom';
|
||||||
import { GlyphPaths } from './frame/iconPack.tsx';
|
|
||||||
import type { InstallController, InstallRequest } from './installController.ts';
|
import type { InstallController, InstallRequest } from './installController.ts';
|
||||||
import type { StoreText } from './storeMessages.ts';
|
import type { StoreText } from './storeMessages.ts';
|
||||||
import { formatBytes, permissionBadges, previewLines, type InstallKind, type InstallPreview } from './storeModel.ts';
|
import { formatBytes, permissionBadges, previewLines, type InstallKind, type InstallPreview } from './storeModel.ts';
|
||||||
|
|
@ -58,7 +57,6 @@ const G = {
|
||||||
warn: 'M12 4l9 16H3zM12 10v4M12 17h.01',
|
warn: 'M12 4l9 16H3zM12 10v4M12 17h.01',
|
||||||
copy: 'M9 9h10v10H9zM5 15V5h10',
|
copy: 'M9 9h10v10H9zM5 15V5h10',
|
||||||
close: 'M6 6l12 12M18 6L6 18',
|
close: 'M6 6l12 12M18 6L6 18',
|
||||||
icons: 'M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM17 14v6M14 17h6',
|
|
||||||
strings: 'M4 5h9M8.5 3v2M11 5c-.8 3.8-3.4 6.6-7 8M6.5 8.5c1.1 1.6 2.7 3 4.5 3.8M13 21l4-9 4 9M14.4 18h5.2',
|
strings: 'M4 5h9M8.5 3v2M11 5c-.8 3.8-3.4 6.6-7 8M6.5 8.5c1.1 1.6 2.7 3 4.5 3.8M13 21l4-9 4 9M14.4 18h5.2',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -103,27 +101,25 @@ function Ready<Theme>({ request, props }: { request: Extract<InstallRequest<Them
|
||||||
const [armed, setArmed] = useState(false);
|
const [armed, setArmed] = useState(false);
|
||||||
// On by default only when it is from the signed store or declares its permissions and the code
|
// On by default only when it is from the signed store or declares its permissions and the code
|
||||||
// scan found nothing to point out; otherwise the owner turns it on deliberately.
|
// scan found nothing to point out; otherwise the owner turns it on deliberately.
|
||||||
const [enable, setEnable] = useState(preview.kind === 'theme' || preview.kind === 'strings' || preview.kind === 'icons' || (!preview.existing && (preview.source.signed || (preview.plugin?.permissions != null && preview.findings.length === 0))));
|
const [enable, setEnable] = useState(preview.kind === 'theme' || preview.kind === 'strings' || (!preview.existing && (preview.source.signed || (preview.plugin?.permissions != null && preview.findings.length === 0))));
|
||||||
const [copied, setCopied] = useState(false);
|
const [copied, setCopied] = useState(false);
|
||||||
useEffect(() => { const timer = setTimeout(() => setArmed(true), REVIEW_MS); return () => clearTimeout(timer); }, [preview.token]);
|
useEffect(() => { const timer = setTimeout(() => setArmed(true), REVIEW_MS); return () => clearTimeout(timer); }, [preview.token]);
|
||||||
const strings = preview.kind === 'strings' ? preview.strings ?? null : null;
|
const strings = preview.kind === 'strings' ? preview.strings ?? null : null;
|
||||||
const summary = strings ? props.stringsSummary?.(preview.text) ?? null : null;
|
const summary = strings ? props.stringsSummary?.(preview.text) ?? null : null;
|
||||||
const pack = preview.kind === 'icons' ? request.pack ?? null : null;
|
const name = plugin?.name ?? facts?.name ?? preview.theme?.name ?? strings?.name ?? t('wb.install.untitled');
|
||||||
const icons = preview.kind === 'icons' ? preview.icons ?? null : null;
|
const author = plugin?.author || facts?.author || preview.theme?.author || strings?.authors.join(', ') || '';
|
||||||
const name = plugin?.name ?? facts?.name ?? preview.theme?.name ?? strings?.name ?? pack?.name ?? icons?.name ?? t('wb.install.untitled');
|
|
||||||
const author = plugin?.author || facts?.author || preview.theme?.author || strings?.authors.join(', ') || pack?.author || icons?.author || '';
|
|
||||||
const version = preview.version || preview.store?.version || '';
|
const version = preview.version || preview.store?.version || '';
|
||||||
const updating = preview.existing && !preview.existing.same;
|
const updating = preview.existing && !preview.existing.same;
|
||||||
const verb = preview.existing?.same ? t('wb.install.reinstall') : updating || ready?.replaces ? t('wb.install.update') : t('wb.store.install');
|
const verb = preview.existing?.same ? t('wb.install.reinstall') : updating || ready?.replaces ? t('wb.install.update') : t('wb.store.install');
|
||||||
const step = preview.existing?.same ? 'reinstall' : updating || ready?.replaces ? 'update' : 'install';
|
const step = preview.existing?.same ? 'reinstall' : updating || ready?.replaces ? 'update' : 'install';
|
||||||
const eyebrow = preview.kind === 'strings' ? t(`wb.install.eyebrow.strings.${step}`) : preview.kind === 'icons' ? t(`wb.install.eyebrow.icons.${step}`) : t(`wb.install.eyebrow.${step}`, { kind: preview.kind });
|
const eyebrow = preview.kind === 'strings' ? t(`wb.install.eyebrow.strings.${step}`) : t(`wb.install.eyebrow.${step}`, { kind: preview.kind });
|
||||||
const badges = preview.kind === 'plugin' ? permissionBadges(plugin?.permissions, t, site) : [];
|
const badges = preview.kind === 'plugin' ? permissionBadges(plugin?.permissions, t, site) : [];
|
||||||
const installing = request.status === 'installing';
|
const installing = request.status === 'installing';
|
||||||
const description = plugin?.description || facts?.description || strings?.description || pack?.description;
|
const description = plugin?.description || facts?.description || strings?.description;
|
||||||
return <>
|
return <>
|
||||||
<header className="wbi-head">
|
<header className="wbi-head">
|
||||||
<div className={`wbi-tile is-${preview.kind}`} style={facts?.tile ? { background: facts.tile.background, color: facts.tile.color, boxShadow: `inset 0 0 0 1px ${facts.tile.border}` } : undefined}>
|
<div className={`wbi-tile is-${preview.kind}`} style={facts?.tile ? { background: facts.tile.background, color: facts.tile.color, boxShadow: `inset 0 0 0 1px ${facts.tile.border}` } : undefined}>
|
||||||
<Glyph d={preview.kind === 'plugin' ? G.plugin : preview.kind === 'strings' ? G.strings : preview.kind === 'icons' ? G.icons : G.theme} size={22}/>
|
<Glyph d={preview.kind === 'plugin' ? G.plugin : preview.kind === 'strings' ? G.strings : G.theme} size={22}/>
|
||||||
</div>
|
</div>
|
||||||
<div className="wbi-title">
|
<div className="wbi-title">
|
||||||
<span className="wbi-eyebrow">{eyebrow}</span>
|
<span className="wbi-eyebrow">{eyebrow}</span>
|
||||||
|
|
@ -188,27 +184,13 @@ function Ready<Theme>({ request, props }: { request: Extract<InstallRequest<Them
|
||||||
{summary && summary.sample.length > 0 && <div className="wbi-findings"><strong>{t('wb.install.strings.sample')}</strong>{summary.sample.map(text => <span key={text}>{text}</span>)}</div>}
|
{summary && summary.sample.length > 0 && <div className="wbi-findings"><strong>{t('wb.install.strings.sample')}</strong>{summary.sample.map(text => <span key={text}>{text}</span>)}</div>}
|
||||||
</section>}
|
</section>}
|
||||||
|
|
||||||
{pack && <section className="wbi-perms wbi-icons" aria-label={t('wb.store.iconsItem')}>
|
|
||||||
<p className="wbi-note is-ok"><Glyph d={G.check} size={14}/>{t('wb.install.icons.dataOnly')}</p>
|
|
||||||
<dl className="wbi-facts">
|
|
||||||
<Fact label={t('wb.install.icons.license')}>{pack.license}</Fact>
|
|
||||||
<Fact label={t('wb.install.icons.count')}>{t('wb.install.icons.countValue', { count: Object.keys(pack.glyphs).length })}</Fact>
|
|
||||||
{pack.source && <Fact label={t('wb.install.icons.source')} wide>{pack.source}</Fact>}
|
|
||||||
{pack.credits && <Fact label={t('wb.install.credits')} wide>{pack.credits}</Fact>}
|
|
||||||
</dl>
|
|
||||||
<div className="wbi-pack-grid" aria-hidden="true">
|
|
||||||
{(Object.keys(pack.glyphs) as Array<keyof typeof pack.glyphs>).map(glyph => <span key={glyph} title={glyph}><svg viewBox="0 0 24 24"><GlyphPaths glyph={pack.glyphs[glyph]!} pack={pack}/></svg></span>)}
|
|
||||||
</div>
|
|
||||||
{(ready?.warnings.length ?? 0) > 0 && <ul className="wbi-warnings">{ready!.warnings.map(warning => <li key={warning}>{warning}</li>)}</ul>}
|
|
||||||
</section>}
|
|
||||||
|
|
||||||
{theme !== null && <section className="wbi-theme">
|
{theme !== null && <section className="wbi-theme">
|
||||||
{props.renderThemePreview?.(theme)}
|
{props.renderThemePreview?.(theme)}
|
||||||
{(ready?.warnings.length ?? 0) > 0 && <ul className="wbi-warnings">{ready!.warnings.map(warning => <li key={warning}>{warning}</li>)}</ul>}
|
{(ready?.warnings.length ?? 0) > 0 && <ul className="wbi-warnings">{ready!.warnings.map(warning => <li key={warning}>{warning}</li>)}</ul>}
|
||||||
</section>}
|
</section>}
|
||||||
|
|
||||||
{facts?.css ? <CodePreview t={t} text={facts.css} label={t('wb.install.themeCss', { site })}/> : null}
|
{facts?.css ? <CodePreview t={t} text={facts.css} label={t('wb.install.themeCss', { site })}/> : null}
|
||||||
<CodePreview t={t} text={preview.text} label={preview.kind === 'plugin' ? t('wb.install.code') : preview.kind === 'strings' ? t('wb.install.strings.file') : preview.kind === 'icons' ? t('wb.install.icons.file') : t('wb.install.themeFile')}/>
|
<CodePreview t={t} text={preview.text} label={preview.kind === 'plugin' ? t('wb.install.code') : preview.kind === 'strings' ? t('wb.install.strings.file') : t('wb.install.themeFile')}/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer className="wbi-foot">
|
<footer className="wbi-foot">
|
||||||
|
|
@ -234,8 +216,6 @@ function Done<Theme>({ request, props }: { request: Extract<InstallRequest<Theme
|
||||||
? (request.enabled ? t('wb.install.done.pluginOn', { site }) : t('wb.install.done.pluginOff'))
|
? (request.enabled ? t('wb.install.done.pluginOn', { site }) : t('wb.install.done.pluginOff'))
|
||||||
: request.kind === 'strings'
|
: request.kind === 'strings'
|
||||||
? (request.enabled ? t('wb.install.done.stringsOn', { site }) : t('wb.install.done.stringsOff'))
|
? (request.enabled ? t('wb.install.done.stringsOn', { site }) : t('wb.install.done.stringsOff'))
|
||||||
: request.kind === 'icons'
|
|
||||||
? (request.enabled ? t('wb.install.done.iconsOn') : t('wb.install.done.iconsOff'))
|
|
||||||
: (request.enabled ? t('wb.install.done.themeOn') : t('wb.install.done.themeOff'))}</p>
|
: (request.enabled ? t('wb.install.done.themeOn') : t('wb.install.done.themeOff'))}</p>
|
||||||
{request.fonts.length > 0 && <p className="wbi-muted">{t('wb.install.done.fonts', { fonts: request.fonts.join(', ') })}</p>}
|
{request.fonts.length > 0 && <p className="wbi-muted">{t('wb.install.done.fonts', { fonts: request.fonts.join(', ') })}</p>}
|
||||||
<div className="wbi-state-actions">
|
<div className="wbi-state-actions">
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
import { useEffect, useMemo, useState, useSyncExternalStore, type ReactNode } from 'react';
|
import { useEffect, useMemo, useState, useSyncExternalStore, type ReactNode } from 'react';
|
||||||
import type { InstallController } from './installController.ts';
|
import type { InstallController } from './installController.ts';
|
||||||
import type { StoreText } from './storeMessages.ts';
|
import type { StoreText } from './storeMessages.ts';
|
||||||
import { categoryLabel, errorText, filterItems, itemState, permissionBadges, type ItemState, type StoreCatalogView, type StoreItem, type StoreKind } from './storeModel.ts';
|
import { categoryLabel, errorText, filterItems, itemState, permissionBadges, type ItemState, type StoreCatalogView, type StoreItem } from './storeModel.ts';
|
||||||
|
|
||||||
type ButtonProps = { children: ReactNode; onClick?(): void; tone?: 'plain' | 'primary' | 'ghost' | 'danger'; size?: 'sm' | 'md'; disabled?: boolean; title?: string };
|
type ButtonProps = { children: ReactNode; onClick?(): void; tone?: 'plain' | 'primary' | 'ghost' | 'danger'; size?: 'sm' | 'md'; disabled?: boolean; title?: string };
|
||||||
type Option<T extends string> = { value: T; label: string };
|
type Option<T extends string> = { value: T; label: string };
|
||||||
|
|
@ -46,14 +46,6 @@ export type StoreViewProps<Theme> = {
|
||||||
/** Theme ids that ship with the app, and the owner's own theme ids now. */
|
/** Theme ids that ship with the app, and the owner's own theme ids now. */
|
||||||
builtinThemes: readonly string[];
|
builtinThemes: readonly string[];
|
||||||
userThemes: readonly string[];
|
userThemes: readonly string[];
|
||||||
/** The owner's installed icon pack ids now (an icon pack the owner removed in Appearance shows as installable again). */
|
|
||||||
userIcons?: readonly string[];
|
|
||||||
/**
|
|
||||||
* The app's area plugins, for items of kind `builtin`: whether the app has one by this id, whether
|
|
||||||
* its switch is on, and turning it on or off. Without it (or for an id it does not have) a built-in
|
|
||||||
* item only says it is built in.
|
|
||||||
*/
|
|
||||||
areas?: { has(id: string): boolean; on(id: string): boolean; set(id: string, on: boolean): Promise<void> };
|
|
||||||
/** Removes an installed item (plugin file, or the owner's copy of a store theme); false: nothing to remove. */
|
/** Removes an installed item (plugin file, or the owner's copy of a store theme); false: nothing to remove. */
|
||||||
onRemove(item: StoreItem, view: StoreCatalogView): Promise<boolean>;
|
onRemove(item: StoreItem, view: StoreCatalogView): Promise<boolean>;
|
||||||
/** Makes a built-in theme the current one. */
|
/** Makes a built-in theme the current one. */
|
||||||
|
|
@ -78,18 +70,9 @@ function Preview({ item }: { item: StoreItem }) {
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Action({ item, state, busy, t, ui, areas, onInstall, onRemove, onUse, onArea }: { item: StoreItem; state: ItemState; busy: boolean; t: StoreText; ui: StoreControls; areas?: StoreViewProps<unknown>['areas']; onInstall(): void; onRemove(): void; onUse(): void; onArea(on: boolean): void }) {
|
function Action({ item, state, busy, t, ui, onInstall, onRemove, onUse }: { item: StoreItem; state: ItemState; busy: boolean; t: StoreText; ui: StoreControls; onInstall(): void; onRemove(): void; onUse(): void }) {
|
||||||
const { Button } = ui;
|
const { Button } = ui;
|
||||||
const [asking, setAsking] = useState(false);
|
const [asking, setAsking] = useState(false);
|
||||||
if (state.state === 'area') {
|
|
||||||
const known = areas?.has(item.id) ?? false;
|
|
||||||
const on = known && areas!.on(item.id);
|
|
||||||
return <div className="wbs-actions"><span className="wbs-state">{t('wb.store.builtinItem')}{known && ` · ${on ? t('wb.store.areaOn') : t('wb.store.areaOff')}`}</span>
|
|
||||||
{known && <label className="wbs-switch" title={t('wb.store.areaSwitch', { name: item.name })}>
|
|
||||||
<input type="checkbox" role="switch" checked={on} aria-label={t('wb.store.areaSwitch', { name: item.name })} onChange={event => onArea(event.target.checked)}/><span aria-hidden="true"/>
|
|
||||||
</label>}
|
|
||||||
</div>;
|
|
||||||
}
|
|
||||||
if (state.state === 'builtin') return <div className="wbs-actions"><span className="wbs-state">{t('wb.store.builtIn')}</span><Button size="sm" onClick={onUse}>{t('wb.store.use')}</Button></div>;
|
if (state.state === 'builtin') return <div className="wbs-actions"><span className="wbs-state">{t('wb.store.builtIn')}</span><Button size="sm" onClick={onUse}>{t('wb.store.use')}</Button></div>;
|
||||||
if (state.state === 'install') return <div className="wbs-actions"><Button size="sm" tone="primary" disabled={busy} onClick={onInstall}>{t('wb.store.install')}</Button></div>;
|
if (state.state === 'install') return <div className="wbs-actions"><Button size="sm" tone="primary" disabled={busy} onClick={onInstall}>{t('wb.store.install')}</Button></div>;
|
||||||
const remove = asking
|
const remove = asking
|
||||||
|
|
@ -107,7 +90,7 @@ export function StoreView<Theme>(props: StoreViewProps<Theme>) {
|
||||||
const [view, setView] = useState<StoreCatalogView | null>(null);
|
const [view, setView] = useState<StoreCatalogView | null>(null);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [query, setQuery] = useState('');
|
const [query, setQuery] = useState('');
|
||||||
const [kind, setKind] = useState<StoreKind | 'all'>('all');
|
const [kind, setKind] = useState<'all' | 'theme' | 'plugin' | 'strings'>('all');
|
||||||
const [category, setCategory] = useState<string>('all');
|
const [category, setCategory] = useState<string>('all');
|
||||||
const request = useSyncExternalStore(controller.subscribe, controller.current, controller.current);
|
const request = useSyncExternalStore(controller.subscribe, controller.current, controller.current);
|
||||||
|
|
||||||
|
|
@ -126,7 +109,7 @@ export function StoreView<Theme>(props: StoreViewProps<Theme>) {
|
||||||
useEffect(() => { if (request === null) void load(false); }, [request === null]);
|
useEffect(() => { if (request === null) void load(false); }, [request === null]);
|
||||||
|
|
||||||
const items = view?.catalog?.items ?? [];
|
const items = view?.catalog?.items ?? [];
|
||||||
const context = { plugins: view?.plugins ?? {}, records: view?.records.items ?? {}, builtinThemes: props.builtinThemes, userThemes: props.userThemes, userIcons: props.userIcons };
|
const context = { plugins: view?.plugins ?? {}, records: view?.records.items ?? {}, builtinThemes: props.builtinThemes, userThemes: props.userThemes };
|
||||||
const categories = useMemo(() => [...new Set(items.filter(item => kind === 'all' || item.kind === kind).map(item => item.category))].sort(), [items, kind]);
|
const categories = useMemo(() => [...new Set(items.filter(item => kind === 'all' || item.kind === kind).map(item => item.category))].sort(), [items, kind]);
|
||||||
const shown = filterItems(items, query, kind, category);
|
const shown = filterItems(items, query, kind, category);
|
||||||
const updates = items.filter(item => itemState(item, context).state === 'update');
|
const updates = items.filter(item => itemState(item, context).state === 'update');
|
||||||
|
|
@ -154,7 +137,7 @@ export function StoreView<Theme>(props: StoreViewProps<Theme>) {
|
||||||
<p className="wbs-intro">{t('wb.store.intro')}</p>
|
<p className="wbs-intro">{t('wb.store.intro')}</p>
|
||||||
<div className="wbs-toolbar">
|
<div className="wbs-toolbar">
|
||||||
<SearchField label={t('wb.store.search')} placeholder={t('wb.store.searchPlaceholder')} value={query} onChange={setQuery}/>
|
<SearchField label={t('wb.store.search')} placeholder={t('wb.store.searchPlaceholder')} value={query} onChange={setQuery}/>
|
||||||
<Segmented label={t('wb.store.kind')} size="sm" value={kind} onChange={next => { setKind(next); setCategory('all'); }} options={[{ value: 'all', label: t('wb.store.all') }, { value: 'theme', label: t('wb.store.themes') }, { value: 'plugin', label: t('wb.store.pluginsTab') }, ...(items.some(item => item.kind === 'icons') ? [{ value: 'icons' as const, label: t('wb.store.icons') }] : []), ...(items.some(item => item.kind === 'strings') ? [{ value: 'strings' as const, label: t('wb.store.strings') }] : []), ...(items.some(item => item.kind === 'builtin') ? [{ value: 'builtin' as const, label: t('wb.store.builtinTab') }] : [])]}/>
|
<Segmented label={t('wb.store.kind')} size="sm" value={kind} onChange={next => { setKind(next); setCategory('all'); }} options={[{ value: 'all', label: t('wb.store.all') }, { value: 'theme', label: t('wb.store.themes') }, { value: 'plugin', label: t('wb.store.pluginsTab') }, ...(items.some(item => item.kind === 'strings') ? [{ value: 'strings' as const, label: t('wb.store.strings') }] : [])]}/>
|
||||||
<Button size="sm" tone="ghost" disabled={loading} onClick={() => void load(true)}>{loading ? t('wb.store.checking') : t('wb.store.refresh')}</Button>
|
<Button size="sm" tone="ghost" disabled={loading} onClick={() => void load(true)}>{loading ? t('wb.store.checking') : t('wb.store.refresh')}</Button>
|
||||||
</div>
|
</div>
|
||||||
<div className="wbs-cats" role="group" aria-label={t('wb.store.categories')}>
|
<div className="wbs-cats" role="group" aria-label={t('wb.store.categories')}>
|
||||||
|
|
@ -176,15 +159,14 @@ export function StoreView<Theme>(props: StoreViewProps<Theme>) {
|
||||||
<div className="wbs-card-body">
|
<div className="wbs-card-body">
|
||||||
<header>
|
<header>
|
||||||
<h3>{item.name}</h3>
|
<h3>{item.name}</h3>
|
||||||
<Badge>{item.kind === 'theme' ? t('wb.store.theme') : item.kind === 'strings' ? t('wb.store.stringsItem') : item.kind === 'icons' ? t('wb.store.iconsItem') : item.kind === 'builtin' ? t('wb.store.builtinItem') : t('wb.store.plugin')}</Badge>
|
<Badge>{item.kind === 'theme' ? t('wb.store.theme') : item.kind === 'strings' ? t('wb.store.stringsItem') : t('wb.store.plugin')}</Badge>
|
||||||
</header>
|
</header>
|
||||||
<p className="wbs-meta">{item.author && `${t('wb.store.by', { author: item.author })} · `}v{item.version} · {item.kind === 'strings' && item.language ? item.language : categoryLabel(item.category, t)}{item.license ? ` · ${item.license}` : ''}</p>
|
<p className="wbs-meta">{item.author && `${t('wb.store.by', { author: item.author })} · `}v{item.version} · {item.kind === 'strings' && item.language ? item.language : categoryLabel(item.category, t)}{item.license ? ` · ${item.license}` : ''}</p>
|
||||||
<p className="wbs-desc">{item.description}</p>
|
<p className="wbs-desc">{item.description}</p>
|
||||||
{item.kind === 'plugin' && <ul className="wbs-perms" aria-label={t('wb.store.permissions')}>
|
{item.kind === 'plugin' && <ul className="wbs-perms" aria-label={t('wb.store.permissions')}>
|
||||||
{permissionBadges(item.permissions, t, site).map(badge => <li key={badge.id} className={`is-${badge.tone}`} title={badge.detail}>{badge.label}</li>)}
|
{permissionBadges(item.permissions, t, site).map(badge => <li key={badge.id} className={`is-${badge.tone}`} title={badge.detail}>{badge.label}</li>)}
|
||||||
</ul>}
|
</ul>}
|
||||||
<Action item={item} state={state} busy={request !== null} t={t} ui={ui} areas={props.areas}
|
<Action item={item} state={state} busy={request !== null} t={t} ui={ui}
|
||||||
onArea={on => void props.areas?.set(item.id, on).catch(error => notify(errorText(error), true))}
|
|
||||||
onInstall={() => void controller.requestStoreItem(item)}
|
onInstall={() => void controller.requestStoreItem(item)}
|
||||||
onRemove={() => void removeItem(item)}
|
onRemove={() => void removeItem(item)}
|
||||||
onUse={() => void props.onUse(item).then(() => notify(t('wb.store.themeNow', { name: item.name }))).catch(error => notify(errorText(error), true))}/>
|
onUse={() => void props.onUse(item).then(() => notify(t('wb.store.themeNow', { name: item.name }))).catch(error => notify(errorText(error), true))}/>
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,6 @@ export type AppMenuRequest = { anchor?: AppMenuTrigger; pane?: string; submenu?:
|
||||||
/** Opens the app menu (Alt+F / F10, the palette, the account menu's last row). */
|
/** Opens the app menu (Alt+F / F10, the palette, the account menu's last row). */
|
||||||
export const openAppMenu = (request: AppMenuRequest = {}) => window.dispatchEvent(new CustomEvent('bt-app-menu', { detail: request }));
|
export const openAppMenu = (request: AppMenuRequest = {}) => window.dispatchEvent(new CustomEvent('bt-app-menu', { detail: request }));
|
||||||
|
|
||||||
/** Opens the "Report a problem" summary (the native menu bar's Help item). */
|
|
||||||
export const openReport = () => window.dispatchEvent(new CustomEvent('bt-report'));
|
|
||||||
|
|
||||||
const mac = os === 'macos';
|
const mac = os === 'macos';
|
||||||
/** The keys that open the menu, as the button's tooltip and the account menu write them. */
|
/** The keys that open the menu, as the button's tooltip and the account menu write them. */
|
||||||
export const APP_MENU_KEYS = mac ? 'F10' : 'Alt+F';
|
export const APP_MENU_KEYS = mac ? 'F10' : 'Alt+F';
|
||||||
|
|
@ -227,12 +224,6 @@ export function AppMenu({ trigger }: { trigger?: AppMenuTrigger | boolean } = {}
|
||||||
return () => window.removeEventListener('bt-app-menu', onRequest);
|
return () => window.removeEventListener('bt-app-menu', onRequest);
|
||||||
}, [version]);
|
}, [version]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const show = () => setReporting(true);
|
|
||||||
window.addEventListener('bt-report', show);
|
|
||||||
return () => window.removeEventListener('bt-report', show);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!open) return;
|
if (!open) return;
|
||||||
// Native tab webviews would cover the menu.
|
// Native tab webviews would cover the menu.
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// pane's toolbar while it is open (so the page under it does not move and, in split view, the bar
|
// pane's toolbar while it is open (so the page under it does not move and, in split view, the bar
|
||||||
// is plainly the searched pane's). Native code does the searching (`tab_find`, shell-only): the
|
// is plainly the searched pane's). Native code does the searching (`tab_find`, shell-only): the
|
||||||
// engine's own find where the build can drive it (WebView2: highlights and a match count, which
|
// engine's own find where the build can drive it (WebView2: highlights and a match count, which
|
||||||
// arrive as `tab-find` events), else a Custom Highlight script evaluated by native code (next and
|
// arrive as `tab-find` events), else the engine's `window.find` evaluated by native code (next and
|
||||||
// previous work, no count). Only what the page has rendered can be found, as in a browser: a
|
// previous work, no count). Only what the page has rendered can be found, as in a browser: a
|
||||||
// virtualized list (X's timeline) holds the posts near the viewport, not the whole feed.
|
// virtualized list (X's timeline) holds the posts near the viewport, not the whole feed.
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -27,14 +27,12 @@ import { useProfiles, useT } from './hooks.ts';
|
||||||
import { t } from './i18n.ts';
|
import { t } from './i18n.ts';
|
||||||
import { Icon, type IconName } from './icons.tsx';
|
import { Icon, type IconName } from './icons.tsx';
|
||||||
import { MediaPanel } from './MediaPanel.tsx';
|
import { MediaPanel } from './MediaPanel.tsx';
|
||||||
import { isMediaShortcut } from './mediaModel.ts';
|
|
||||||
import { NewTabPage } from './NewTabPage.tsx';
|
import { NewTabPage } from './NewTabPage.tsx';
|
||||||
import type { PaletteAction, PaletteContext } from './paletteModel.ts';
|
import type { PaletteAction, PaletteContext } from './paletteModel.ts';
|
||||||
import { PaneThemeHost, openPaneTheme } from './PaneTheme.tsx';
|
import { PaneThemeHost, openPaneTheme } from './PaneTheme.tsx';
|
||||||
import { focusedCommands, installPluginCommands, notePanelActive, refreshPluginNames, runPluginCommand } from './pluginCommandStore.ts';
|
import { focusedCommands, installPluginCommands, notePanelActive, refreshPluginNames, runPluginCommand } from './pluginCommandStore.ts';
|
||||||
import { initDiag } from './diag.ts';
|
import { initDiag } from './diag.ts';
|
||||||
import { installSafeMode } from './safeStore.ts';
|
import { installSafeMode } from './safeStore.ts';
|
||||||
import { startNativeMenu } from './nativeMenu.ts';
|
|
||||||
import { hasFeature, site } from './site.ts';
|
import { hasFeature, site } from './site.ts';
|
||||||
import {
|
import {
|
||||||
flushLayer, flushSync, isWeb, loadLayout, newTabId, paneInfos, panelId, patchParams, resync, saveLayoutSoon, scheduleSync, setOverlay, setProfiles, shell, tabAction,
|
flushLayer, flushSync, isWeb, loadLayout, newTabId, paneInfos, panelId, patchParams, resync, saveLayoutSoon, scheduleSync, setOverlay, setProfiles, shell, tabAction,
|
||||||
|
|
@ -48,8 +46,6 @@ import { frameless, isTauri, onMaximizedChange, os } from './windowBinding.ts';
|
||||||
import { loadWorkspaces, restoreWorkspace, workspaceList, workspaces } from './workspaces.ts';
|
import { loadWorkspaces, restoreWorkspace, workspaceList, workspaces } from './workspaces.ts';
|
||||||
import { stepZoom, zoomTarget } from './zoomStore.ts';
|
import { stepZoom, zoomTarget } from './zoomStore.ts';
|
||||||
import './shell.css';
|
import './shell.css';
|
||||||
// After shell.css: a bevelled theme's edges (html[data-wb-edges]).
|
|
||||||
import './edges.css';
|
|
||||||
|
|
||||||
type Placement = { referencePanel: string; direction: 'within' | 'right' | 'below' };
|
type Placement = { referencePanel: string; direction: 'within' | 'right' | 'below' };
|
||||||
|
|
||||||
|
|
@ -374,6 +370,7 @@ function shortcutFor(event: KeyboardEvent): string | null {
|
||||||
if (key === 't') return event.shiftKey ? 'reopen-tab' : 'new-tab';
|
if (key === 't') return event.shiftKey ? 'reopen-tab' : 'new-tab';
|
||||||
if (key === 'w') return event.shiftKey ? 'open-panel' : 'close-tab';
|
if (key === 'w') return event.shiftKey ? 'open-panel' : 'close-tab';
|
||||||
if (key === 'l') return 'focus-address';
|
if (key === 'l') return 'focus-address';
|
||||||
|
if (key === 'g' && event.shiftKey) return 'media-panel';
|
||||||
if (key === 'k' && !event.shiftKey) return 'command-palette';
|
if (key === 'k' && !event.shiftKey) return 'command-palette';
|
||||||
if (key === 'f' && !event.shiftKey && hasFeature('find')) return 'find';
|
if (key === 'f' && !event.shiftKey && hasFeature('find')) return 'find';
|
||||||
if (key === 'tab') return event.shiftKey ? 'prev-tab' : 'next-tab';
|
if (key === 'tab') return event.shiftKey ? 'prev-tab' : 'next-tab';
|
||||||
|
|
@ -385,7 +382,6 @@ function shortcutFor(event: KeyboardEvent): string | null {
|
||||||
if (key === '0' || event.code === 'Numpad0') return 'zoom-reset';
|
if (key === '0' || event.code === 'Numpad0') return 'zoom-reset';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isMediaShortcut(event, os)) return 'media-panel';
|
|
||||||
if (event.key === 'F3' && !mod && !event.altKey) return event.shiftKey ? 'find-previous' : 'find-next';
|
if (event.key === 'F3' && !mod && !event.altKey) return event.shiftKey ? 'find-previous' : 'find-next';
|
||||||
// The app menu, like a browser's: F10, and Alt+F where Alt is not a typing key (not on macOS).
|
// The app menu, like a browser's: F10, and Alt+F where Alt is not a typing key (not on macOS).
|
||||||
if (event.key === 'F10' && !mod && !event.altKey && !event.shiftKey) return 'app-menu';
|
if (event.key === 'F10' && !mod && !event.altKey && !event.shiftKey) return 'app-menu';
|
||||||
|
|
@ -623,8 +619,6 @@ export default function Shell() {
|
||||||
|
|
||||||
// Safe mode for this run (the host's flag): the titlebar says so and the chrome drops its theme.
|
// Safe mode for this run (the host's flag): the titlebar says so and the chrome drops its theme.
|
||||||
useEffect(() => (hasFeature('safeMode') ? installSafeMode() : undefined), []);
|
useEffect(() => (hasFeature('safeMode') ? installSafeMode() : undefined), []);
|
||||||
// The native menu bar (macOS only; nativeMenu.ts): described from the state the in-app menu reads.
|
|
||||||
useEffect(() => startNativeMenu(), []);
|
|
||||||
|
|
||||||
// The site's own settings and events (e.g. X's Twitter/X wording).
|
// The site's own settings and events (e.g. X's Twitter/X wording).
|
||||||
useEffect(() => site().start?.(), []);
|
useEffect(() => site().start?.(), []);
|
||||||
|
|
|
||||||
|
|
@ -9,15 +9,15 @@
|
||||||
.bt-acct-head .bt-kbd { height: 16px; min-width: 0; font: 500 10.5px/1 var(--bt-ui); }
|
.bt-acct-head .bt-kbd { height: 16px; min-width: 0; font: 500 10.5px/1 var(--bt-ui); }
|
||||||
|
|
||||||
/* One account: the whole row is the main action; "…" sits at the right edge. */
|
/* One account: the whole row is the main action; "…" sits at the right edge. */
|
||||||
.bt-acct-row { position: relative; display: flex; flex-direction: column; border-radius: calc(10px * var(--bt-rs, 1)); }
|
.bt-acct-row { position: relative; display: flex; flex-direction: column; border-radius: 10px; }
|
||||||
.bt-acct-line { position: relative; display: flex; align-items: center; }
|
.bt-acct-line { position: relative; display: flex; align-items: center; }
|
||||||
.bt-acct-row.is-focused { background: rgb(var(--bt-accent-rgb) / .08); box-shadow: inset 0 0 0 1px rgb(var(--bt-accent-rgb) / .22); }
|
.bt-acct-row.is-focused { background: rgb(var(--bt-accent-rgb) / .08); box-shadow: inset 0 0 0 1px rgb(var(--bt-accent-rgb) / .22); }
|
||||||
.bt-acct-row.is-focused::before {
|
.bt-acct-row.is-focused::before {
|
||||||
content: ''; position: absolute; inset-inline-start: -5px; top: 12px; height: 24px; width: 3px; border-start-start-radius: 0; border-start-end-radius: calc(3px * var(--bt-rs, 1)); border-end-end-radius: calc(3px * var(--bt-rs, 1)); border-end-start-radius: 0; background: var(--bt-accent);
|
content: ''; position: absolute; inset-inline-start: -5px; top: 12px; height: 24px; width: 3px; border-start-start-radius: 0; border-start-end-radius: 3px; border-end-end-radius: 3px; border-end-start-radius: 0; background: var(--bt-accent);
|
||||||
}
|
}
|
||||||
.bt-acct-row.is-open { background: rgb(var(--bt-text-rgb) / .035); }
|
.bt-acct-row.is-open { background: rgb(var(--bt-text-rgb) / .035); }
|
||||||
|
|
||||||
.bt-menu .bt-acct-main { flex: 1; min-width: 0; height: auto; gap: 11px; padding-block: 8px; padding-inline: 8px 40px; border-radius: calc(10px * var(--bt-rs, 1)); }
|
.bt-menu .bt-acct-main { flex: 1; min-width: 0; height: auto; gap: 11px; padding-block: 8px; padding-inline: 8px 40px; border-radius: 10px; }
|
||||||
.bt-menu .bt-acct-main:focus-visible { box-shadow: var(--bt-ring); }
|
.bt-menu .bt-acct-main:focus-visible { box-shadow: var(--bt-ring); }
|
||||||
.bt-acct-avatar { position: relative; display: inline-grid; flex: none; }
|
.bt-acct-avatar { position: relative; display: inline-grid; flex: none; }
|
||||||
.bt-acct-avatar.is-signed-out .bt-avatar, .bt-acct-avatar.is-new .bt-avatar { filter: saturate(.35); opacity: .7; }
|
.bt-acct-avatar.is-signed-out .bt-avatar, .bt-acct-avatar.is-new .bt-avatar { filter: saturate(.35); opacity: .7; }
|
||||||
|
|
@ -29,10 +29,10 @@
|
||||||
.bt-acct-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
|
.bt-acct-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
|
||||||
.bt-acct-name { display: flex; align-items: center; gap: 6px; min-width: 0; font: 600 13.5px/1.15 var(--bt-ui); color: var(--bt-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
.bt-acct-name { display: flex; align-items: center; gap: 6px; min-width: 0; font: 600 13.5px/1.15 var(--bt-ui); color: var(--bt-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
.bt-acct-meta { font: 400 12px/1.2 var(--bt-ui); color: var(--bt-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
|
.bt-acct-meta { font: 400 12px/1.2 var(--bt-ui); color: var(--bt-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
|
||||||
.bt-acct-meta.is-signed-out, .bt-acct-meta.is-new { color: var(--bt-warn); }
|
.bt-acct-meta.is-signed-out, .bt-acct-meta.is-new { color: #f0b14a; }
|
||||||
.bt-acct-count { color: var(--bt-muted); }
|
.bt-acct-count { color: var(--bt-muted); }
|
||||||
.bt-acct-badge {
|
.bt-acct-badge {
|
||||||
flex: none; padding: 2px 6px; border-radius: calc(999px * var(--bt-rs, 1)); background: rgb(var(--bt-text-rgb) / .07); color: var(--bt-text-2);
|
flex: none; padding: 2px 6px; border-radius: 999px; background: rgb(var(--bt-text-rgb) / .07); color: var(--bt-text-2);
|
||||||
font: 500 10.5px/1.2 var(--bt-ui); letter-spacing: .01em;
|
font: 500 10.5px/1.2 var(--bt-ui); letter-spacing: .01em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -61,11 +61,11 @@
|
||||||
.bt-acct-sub .bt-menu-keys { font-size: 11px; }
|
.bt-acct-sub .bt-menu-keys { font-size: 11px; }
|
||||||
.bt-menu .bt-acct-sub button[aria-checked=true]:disabled { color: var(--bt-text-2); }
|
.bt-menu .bt-acct-sub button[aria-checked=true]:disabled { color: var(--bt-text-2); }
|
||||||
.bt-menu .bt-acct-sub button[aria-checked=true]:disabled > .bt-glyph { color: var(--bt-accent); opacity: 1; }
|
.bt-menu .bt-acct-sub button[aria-checked=true]:disabled > .bt-glyph { color: var(--bt-accent); opacity: 1; }
|
||||||
.bt-menu .bt-acct-danger { color: var(--bt-danger-ink); }
|
.bt-menu .bt-acct-danger { color: #ff8a80; }
|
||||||
.bt-menu .bt-acct-danger > .bt-glyph { color: var(--bt-danger-ink); }
|
.bt-menu .bt-acct-danger > .bt-glyph { color: #ff8a80; }
|
||||||
|
|
||||||
.bt-acct-confirm {
|
.bt-acct-confirm {
|
||||||
display: flex; flex-direction: column; gap: 10px; margin: 2px 6px 6px; padding: 10px 12px; border-radius: calc(9px * var(--bt-rs, 1));
|
display: flex; flex-direction: column; gap: 10px; margin: 2px 6px 6px; padding: 10px 12px; border-radius: 9px;
|
||||||
background: rgba(229, 72, 77, .08); box-shadow: inset 0 0 0 1px rgba(229, 72, 77, .25); color: var(--bt-text-2); font: 400 12.5px/1.45 var(--bt-ui);
|
background: rgba(229, 72, 77, .08); box-shadow: inset 0 0 0 1px rgba(229, 72, 77, .25); color: var(--bt-text-2); font: 400 12.5px/1.45 var(--bt-ui);
|
||||||
}
|
}
|
||||||
.bt-acct-confirm strong { color: var(--bt-text); font-weight: 600; }
|
.bt-acct-confirm strong { color: var(--bt-text); font-weight: 600; }
|
||||||
|
|
@ -75,14 +75,14 @@
|
||||||
.bt-menu .bt-acct-remove:hover:not(:disabled), .bt-menu .bt-acct-remove:focus-visible { background: #d93d42; }
|
.bt-menu .bt-acct-remove:hover:not(:disabled), .bt-menu .bt-acct-remove:focus-visible { background: #d93d42; }
|
||||||
.bt-menu .bt-acct-cancel { background: var(--bt-hover); }
|
.bt-menu .bt-acct-cancel { background: var(--bt-hover); }
|
||||||
|
|
||||||
.bt-menu .bt-acct-add { height: auto; gap: 11px; padding: 8px; border-radius: calc(10px * var(--bt-rs, 1)); }
|
.bt-menu .bt-acct-add { height: auto; gap: 11px; padding: 8px; border-radius: 10px; }
|
||||||
.bt-menu .bt-acct-add:focus-visible { box-shadow: var(--bt-ring); }
|
.bt-menu .bt-acct-add:focus-visible { box-shadow: var(--bt-ring); }
|
||||||
.bt-acct-add .bt-acct-name { color: var(--bt-text-2); }
|
.bt-acct-add .bt-acct-name { color: var(--bt-text-2); }
|
||||||
.bt-acct-add-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--bt-line-strong); color: var(--bt-muted); }
|
.bt-acct-add-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--bt-line-strong); color: var(--bt-muted); }
|
||||||
.bt-acct-add-icon .bt-glyph { width: 15px; height: 15px; }
|
.bt-acct-add-icon .bt-glyph { width: 15px; height: 15px; }
|
||||||
.bt-menu .bt-acct-add:hover .bt-acct-add-icon { box-shadow: inset 0 0 0 1px rgb(var(--bt-accent-rgb) / .6); color: var(--bt-accent-ink); }
|
.bt-menu .bt-acct-add:hover .bt-acct-add-icon { box-shadow: inset 0 0 0 1px rgb(var(--bt-accent-rgb) / .6); color: var(--bt-accent-ink); }
|
||||||
|
|
||||||
.bt-acct-error { padding: 6px 10px; color: var(--bt-danger-ink); font: 12px/1.4 var(--bt-ui); }
|
.bt-acct-error { padding: 6px 10px; color: #ff8a80; font: 12px/1.4 var(--bt-ui); }
|
||||||
|
|
||||||
/* Each pane's account, left of its address bar (same color as the tab's account dot). */
|
/* Each pane's account, left of its address bar (same color as the tab's account dot). */
|
||||||
.bt-pane-account {
|
.bt-pane-account {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
/* The button: the last thing before the caption buttons. */
|
/* The button: the last thing before the caption buttons. */
|
||||||
.bt-app-button {
|
.bt-app-button {
|
||||||
align-self: center; display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; margin-right: 8px; padding: 0; box-sizing: border-box; /* rtl-ok: titlebar */
|
align-self: center; display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; margin-right: 8px; padding: 0; box-sizing: border-box; /* rtl-ok: titlebar */
|
||||||
border: 1px solid transparent; border-radius: calc(15px * var(--bt-rs, 1)); background: transparent; color: var(--bt-text-2); cursor: pointer;
|
border: 1px solid transparent; border-radius: 15px; background: transparent; color: var(--bt-text-2); cursor: pointer;
|
||||||
transition: background-color var(--bt-t1) var(--bt-ease), border-color var(--bt-t1) var(--bt-ease), color var(--bt-t1) var(--bt-ease);
|
transition: background-color var(--bt-t1) var(--bt-ease), border-color var(--bt-t1) var(--bt-ease), color var(--bt-t1) var(--bt-ease);
|
||||||
}
|
}
|
||||||
.bt-app-button:hover { background: var(--bt-hover); border-color: var(--bt-line-soft); color: var(--bt-text); }
|
.bt-app-button:hover { background: var(--bt-hover); border-color: var(--bt-line-soft); color: var(--bt-text); }
|
||||||
|
|
@ -22,7 +22,7 @@ html:not(:has(.bt-app-button)) { --bt-tb-menu: 0px; }
|
||||||
img.bt-titlebar-logo { width: 20px; height: 20px; margin: 12px 14px 12px 16px; flex: 0 0 20px; -webkit-user-drag: none; } /* rtl-ok: titlebar */
|
img.bt-titlebar-logo { width: 20px; height: 20px; margin: 12px 14px 12px 16px; flex: 0 0 20px; -webkit-user-drag: none; } /* rtl-ok: titlebar */
|
||||||
button.bt-titlebar-logo {
|
button.bt-titlebar-logo {
|
||||||
align-self: center; display: inline-grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px; margin: 0 9px 0 11px; padding: 0; box-sizing: border-box; /* rtl-ok: titlebar */
|
align-self: center; display: inline-grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px; margin: 0 9px 0 11px; padding: 0; box-sizing: border-box; /* rtl-ok: titlebar */
|
||||||
border: 1px solid transparent; border-radius: calc(9px * var(--bt-rs, 1)); background: transparent; cursor: pointer; -webkit-user-drag: none;
|
border: 1px solid transparent; border-radius: 9px; background: transparent; cursor: pointer; -webkit-user-drag: none;
|
||||||
transition: background-color var(--bt-t1) var(--bt-ease), border-color var(--bt-t1) var(--bt-ease);
|
transition: background-color var(--bt-t1) var(--bt-ease), border-color var(--bt-t1) var(--bt-ease);
|
||||||
}
|
}
|
||||||
button.bt-titlebar-logo img { display: block; width: 20px; height: 20px; pointer-events: none; -webkit-user-drag: none; }
|
button.bt-titlebar-logo img { display: block; width: 20px; height: 20px; pointer-events: none; -webkit-user-drag: none; }
|
||||||
|
|
@ -76,14 +76,14 @@ button.bt-titlebar-logo:focus-visible { outline: 0; box-shadow: var(--bt-ring);
|
||||||
.bt-app-zoom { display: flex; align-items: center; gap: 10px; height: 36px; flex: none; padding-inline: 10px 3px; color: var(--bt-text); }
|
.bt-app-zoom { display: flex; align-items: center; gap: 10px; height: 36px; flex: none; padding-inline: 10px 3px; color: var(--bt-text); }
|
||||||
.bt-app-zoom > .bt-glyph { color: var(--bt-muted); }
|
.bt-app-zoom > .bt-glyph { color: var(--bt-muted); }
|
||||||
.bt-app-zoom.is-off > .bt-glyph, .bt-app-zoom.is-off .bt-menu-label, .bt-app-zoom.is-off .bt-app-zoom-value { color: var(--bt-faint); }
|
.bt-app-zoom.is-off > .bt-glyph, .bt-app-zoom.is-off .bt-menu-label, .bt-app-zoom.is-off .bt-app-zoom-value { color: var(--bt-faint); }
|
||||||
.bt-app-zoom-step { display: flex; align-items: center; flex: none; height: 28px; border-radius: calc(9px * var(--bt-rs, 1)); direction: ltr; background: rgb(var(--bt-text-rgb) / .04); box-shadow: inset 0 0 0 1px var(--bt-line); }
|
.bt-app-zoom-step { display: flex; align-items: center; flex: none; height: 28px; border-radius: 9px; direction: ltr; background: rgb(var(--bt-text-rgb) / .04); box-shadow: inset 0 0 0 1px var(--bt-line); }
|
||||||
.bt-app-menu .bt-app-zoom button { width: 30px; height: 28px; flex: none; padding: 0; justify-content: center; border-radius: calc(8px * var(--bt-rs, 1)); color: var(--bt-text-2); }
|
.bt-app-menu .bt-app-zoom button { width: 30px; height: 28px; flex: none; padding: 0; justify-content: center; border-radius: 8px; color: var(--bt-text-2); }
|
||||||
.bt-app-menu .bt-app-zoom button > .bt-glyph { width: 14px; height: 14px; color: inherit; }
|
.bt-app-menu .bt-app-zoom button > .bt-glyph { width: 14px; height: 14px; color: inherit; }
|
||||||
.bt-app-menu .bt-app-zoom button:focus { color: var(--bt-text); }
|
.bt-app-menu .bt-app-zoom button:focus { color: var(--bt-text); }
|
||||||
.bt-app-menu .bt-app-zoom button[aria-disabled=true] { color: var(--bt-faint); cursor: default; }
|
.bt-app-menu .bt-app-zoom button[aria-disabled=true] { color: var(--bt-faint); cursor: default; }
|
||||||
.bt-app-menu .bt-app-zoom button[aria-disabled=true]:active { background: var(--bt-hover); }
|
.bt-app-menu .bt-app-zoom button[aria-disabled=true]:active { background: var(--bt-hover); }
|
||||||
.bt-app-zoom-value { min-width: 50px; padding: 0 2px; text-align: center; color: var(--bt-text); font: 500 12px/1 var(--bt-mono); font-variant-numeric: tabular-nums; }
|
.bt-app-zoom-value { min-width: 50px; padding: 0 2px; text-align: center; color: var(--bt-text); font: 500 12px/1 var(--bt-mono); font-variant-numeric: tabular-nums; }
|
||||||
.bt-app-menu .bt-app-zoom .bt-app-zoom-reset { width: 28px; border-radius: calc(9px * var(--bt-rs, 1)); }
|
.bt-app-menu .bt-app-zoom .bt-app-zoom-reset { width: 28px; border-radius: 9px; }
|
||||||
|
|
||||||
/* Words that are not a choice: the mode question, an empty list, an error. */
|
/* Words that are not a choice: the mode question, an empty list, an error. */
|
||||||
.bt-app-note { display: flex; flex-direction: column; gap: 3px; max-width: 288px; padding: 8px 10px 7px; box-sizing: border-box; }
|
.bt-app-note { display: flex; flex-direction: column; gap: 3px; max-width: 288px; padding: 8px 10px 7px; box-sizing: border-box; }
|
||||||
|
|
@ -92,7 +92,7 @@ button.bt-titlebar-logo:focus-visible { outline: 0; box-shadow: var(--bt-ring);
|
||||||
.bt-app-note.is-error span { color: var(--bt-danger); }
|
.bt-app-note.is-error span { color: var(--bt-danger); }
|
||||||
|
|
||||||
/* The account menu's last row: the way here from where the account name is. */
|
/* The account menu's last row: the way here from where the account name is. */
|
||||||
.bt-menu .bt-acct-settings { flex: none; height: 34px; gap: 11px; padding: 0 8px; border-radius: calc(10px * var(--bt-rs, 1)); color: var(--bt-text-2); }
|
.bt-menu .bt-acct-settings { flex: none; height: 34px; gap: 11px; padding: 0 8px; border-radius: 10px; color: var(--bt-text-2); }
|
||||||
.bt-menu .bt-acct-settings > .bt-glyph { width: 32px; height: 15px; }
|
.bt-menu .bt-acct-settings > .bt-glyph { width: 32px; height: 15px; }
|
||||||
.bt-menu .bt-acct-settings:focus-visible { box-shadow: var(--bt-ring); }
|
.bt-menu .bt-acct-settings:focus-visible { box-shadow: var(--bt-ring); }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,6 @@ export function bootScript(options: { label?: string } = {}): string {
|
||||||
for (const [name, value] of Object.entries(vars)) {
|
for (const [name, value] of Object.entries(vars)) {
|
||||||
if (/^--wb-[a-z]-[a-z0-9-]+$/.test(name) && typeof value === 'string' && value.length < 400) root.style.setProperty(name, value);
|
if (/^--wb-[a-z]-[a-z0-9-]+$/.test(name) && typeof value === 'string' && value.length < 400) root.style.setProperty(name, value);
|
||||||
}
|
}
|
||||||
// The edge style (frame/edges.css) from the first frame too, like chromeEdges() in themeStore.
|
|
||||||
if (vars['--wb-c-edges'] === 'bevel') root.dataset.wbEdges = 'bevel';
|
|
||||||
// shell.css (loaded with the shell's modules) paints the same ground; this rule only covers
|
// shell.css (loaded with the shell's modules) paints the same ground; this rule only covers
|
||||||
// the frames before it, and \`html.bt-raised\` (more specific) still clears it.
|
// the frames before it, and \`html.bt-raised\` (more specific) still clears it.
|
||||||
const style = document.createElement('style');
|
const style = document.createElement('style');
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,7 @@ export const SHELL_MONO_FONT = "'Geist Mono Variable', ui-monospace, monospace";
|
||||||
|
|
||||||
/** A theme as the chrome needs it: seven colors (none: the site's own colors) and two font stacks. */
|
/** A theme as the chrome needs it: seven colors (none: the site's own colors) and two font stacks. */
|
||||||
export type ChromeTheme = {
|
export type ChromeTheme = {
|
||||||
/** `page`, `inverse` and `onInverse` are optional: a bevelled chrome builds its face and title bar from them. */
|
colors?: { bg: string; surface: string; elevated: string; border: string; text: string; muted: string; accent: string } | null;
|
||||||
colors?: { bg: string; surface: string; elevated: string; border: string; text: string; muted: string; accent: string; page?: string; inverse?: string; onInverse?: string } | null;
|
|
||||||
/** The theme's corner radius in px: every chrome radius scales by radius / 12 (0 to 1.5, `--wb-c-rs`). Absent: wayBetter's own. */
|
|
||||||
radius?: number | null;
|
|
||||||
/**
|
|
||||||
* How the chrome's edges are drawn. `bevel`: raised and sunken edges after 98.css (MIT, Jordan
|
|
||||||
* Scales), square corners, a face color under tabs, menus and dialogs, a title-bar gradient
|
|
||||||
* (frame/edges.css, keyed on `html[data-wb-edges]`). Absent: wayBetter's own soft edges.
|
|
||||||
*/
|
|
||||||
edges?: 'bevel' | null;
|
|
||||||
/** The chrome's font stack when the theme sets one other than SHELL_UI_FONT. */
|
/** The chrome's font stack when the theme sets one other than SHELL_UI_FONT. */
|
||||||
chromeFont?: string | null;
|
chromeFont?: string | null;
|
||||||
/** The mono font stack when the theme sets one. */
|
/** The mono font stack when the theme sets one. */
|
||||||
|
|
@ -55,8 +46,7 @@ function legible(color: string, surface: string, ratio: number): string {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CSS custom properties for the chrome in `theme`. A theme that keeps the site's colors changes
|
* CSS custom properties for the chrome in `theme`. A theme that keeps the site's colors changes
|
||||||
* only the fonts (and keeps wayBetter's own corners and edges); `own` keeps wayBetter's own style
|
* only the fonts; `own` keeps wayBetter's own style entirely (empty result).
|
||||||
* entirely (empty result).
|
|
||||||
*/
|
*/
|
||||||
export function chromeVars(theme: ChromeTheme, own = false): Record<string, string> {
|
export function chromeVars(theme: ChromeTheme, own = false): Record<string, string> {
|
||||||
if (own) return {};
|
if (own) return {};
|
||||||
|
|
@ -66,10 +56,6 @@ export function chromeVars(theme: ChromeTheme, own = false): Record<string, stri
|
||||||
if (theme.monoFont) vars['--wb-f-mono'] = theme.monoFont;
|
if (theme.monoFont) vars['--wb-f-mono'] = theme.monoFont;
|
||||||
const colors = theme.colors;
|
const colors = theme.colors;
|
||||||
if (!colors) return vars;
|
if (!colors) return vars;
|
||||||
// Radii follow the theme's own corners: square themes get a square chrome, round ones a rounder one.
|
|
||||||
if (typeof theme.radius === 'number' && Number.isFinite(theme.radius)) {
|
|
||||||
vars['--wb-c-rs'] = String(Math.round(Math.min(1.5, Math.max(0, theme.radius / 12)) * 100) / 100);
|
|
||||||
}
|
|
||||||
const { bg, surface, elevated, border, text, muted, accent } = colors;
|
const { bg, surface, elevated, border, text, muted, accent } = colors;
|
||||||
const dark = luminance(bg) < luminance(text);
|
const dark = luminance(bg) < luminance(text);
|
||||||
const ink = legible(mix(accent, text, 0.55), elevated, 4.5);
|
const ink = legible(mix(accent, text, 0.55), elevated, 4.5);
|
||||||
|
|
@ -78,15 +64,9 @@ export function chromeVars(theme: ChromeTheme, own = false): Record<string, stri
|
||||||
'--wb-c-ground': bg, '--wb-c-chrome': surface, '--wb-c-field': mix(surface, elevated, 0.45),
|
'--wb-c-ground': bg, '--wb-c-chrome': surface, '--wb-c-field': mix(surface, elevated, 0.45),
|
||||||
'--wb-c-raised': elevated, '--wb-c-raised-2': mix(elevated, border, 0.45),
|
'--wb-c-raised': elevated, '--wb-c-raised-2': mix(elevated, border, 0.45),
|
||||||
'--wb-c-line': border, '--wb-c-line-soft': mix(border, bg, 0.45), '--wb-c-line-strong': mix(border, text, 0.14),
|
'--wb-c-line': border, '--wb-c-line-soft': mix(border, bg, 0.45), '--wb-c-line-strong': mix(border, text, 0.14),
|
||||||
'--wb-c-text': text, '--wb-c-text-2': mix(text, muted, 0.4), '--wb-c-muted': legible(muted, elevated, 4.5),
|
'--wb-c-text': text, '--wb-c-text-2': mix(text, muted, 0.4), '--wb-c-muted': muted, '--wb-c-faint': mix(muted, bg, 0.38),
|
||||||
// Shortcut hints and section labels sit on the menus' raised surface: they keep 4.5:1 there (a 38% fade toward the ground read 2.1 to 3.6:1).
|
|
||||||
'--wb-c-faint': legible(mix(muted, bg, 0.38), elevated, 4.5),
|
|
||||||
'--wb-c-text-rgb': channels(text), '--wb-c-accent': accent, '--wb-c-accent-rgb': channels(accent), '--wb-c-accent-ink': ink,
|
'--wb-c-text-rgb': channels(text), '--wb-c-accent': accent, '--wb-c-accent-rgb': channels(accent), '--wb-c-accent-ink': ink,
|
||||||
'--wb-c-scheme': dark ? 'dark' : 'light',
|
'--wb-c-scheme': dark ? 'dark' : 'light',
|
||||||
// Status inks (a signed-out account, an error) readable on the menus' raised surface, whatever its shade.
|
|
||||||
'--wb-c-warn': legible(dark ? '#f0b14a' : '#9a5b00', elevated, 4.5), '--wb-c-danger-ink': legible(dark ? '#ff8a80' : '#b3261e', elevated, 4.5),
|
|
||||||
// The chrome's marks (active tab, palette edge) in the theme's accent instead of wayBetter's brush.
|
|
||||||
'--wb-c-brush': `linear-gradient(90deg, ${accent}, ${accent})`,
|
|
||||||
...(dark ? {} : { '--wb-c-shadow-pop': `0 18px 44px -14px rgba(${hexToRgb(mix(text, bg, 0.2)).join(', ')}, .28), 0 3px 10px rgba(0, 0, 0, .08)` }),
|
...(dark ? {} : { '--wb-c-shadow-pop': `0 18px 44px -14px rgba(${hexToRgb(mix(text, bg, 0.2)).join(', ')}, .28), 0 3px 10px rgba(0, 0, 0, .08)` }),
|
||||||
// Panel.
|
// Panel.
|
||||||
'--wb-p-ground': bg, '--wb-p-chrome': mix(bg, surface, 0.5), '--wb-p-card': surface, '--wb-p-field': mix(surface, elevated, 0.5), '--wb-p-raise': elevated,
|
'--wb-p-ground': bg, '--wb-p-chrome': mix(bg, surface, 0.5), '--wb-p-card': surface, '--wb-p-field': mix(surface, elevated, 0.5), '--wb-p-raise': elevated,
|
||||||
|
|
@ -96,41 +76,11 @@ export function chromeVars(theme: ChromeTheme, own = false): Record<string, stri
|
||||||
'--wb-p-text-rgb': channels(text), '--wb-p-popover': elevated, '--wb-p-thumb': `linear-gradient(180deg, ${mix(elevated, text, 0.08)}, ${elevated})`,
|
'--wb-p-text-rgb': channels(text), '--wb-p-popover': elevated, '--wb-p-thumb': `linear-gradient(180deg, ${mix(elevated, text, 0.08)}, ${elevated})`,
|
||||||
'--wb-p-track': mix(elevated, border, 0.5), '--wb-p-knob': mix(muted, text, 0.3),
|
'--wb-p-track': mix(elevated, border, 0.5), '--wb-p-knob': mix(muted, text, 0.3),
|
||||||
});
|
});
|
||||||
if (theme.edges === 'bevel') Object.assign(vars, bevelVars(colors));
|
|
||||||
return vars;
|
return vars;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* A bevelled chrome: the face every raised part is made of (the theme's `page`, else its raised
|
|
||||||
* surface), the four edge lines of 98.css derived from that face (white highlight, light, shadow,
|
|
||||||
* near-black), the field under text (the theme's background) and the active title bar (inverse to
|
|
||||||
* accent, its label readable on both ends).
|
|
||||||
*/
|
|
||||||
function bevelVars(colors: NonNullable<ChromeTheme['colors']>): Record<string, string> {
|
|
||||||
const face = colors.page ?? colors.elevated;
|
|
||||||
const from = colors.inverse ?? colors.accent;
|
|
||||||
const titleText = colors.onInverse && contrast(colors.onInverse, from) >= 4.5 && contrast(colors.onInverse, colors.accent) >= 3 ? colors.onInverse
|
|
||||||
: contrast('#ffffff', from) >= contrast('#000000', from) ? '#ffffff' : '#000000';
|
|
||||||
return {
|
|
||||||
'--wb-c-edges': 'bevel', '--wb-c-face': face, '--wb-c-face-text': legible(colors.text, face, 7),
|
|
||||||
'--wb-c-bevel-hi': mix(face, '#ffffff', 1), '--wb-c-bevel-lt': mix(face, '#ffffff', 0.49),
|
|
||||||
'--wb-c-bevel-sh': mix(face, '#000000', 0.335), '--wb-c-bevel-dk': mix(face, '#000000', 0.95),
|
|
||||||
'--wb-c-title-from': from, '--wb-c-title-to': colors.accent, '--wb-c-title-text': titleText,
|
|
||||||
// Selected rows (menus, lists): the title bar's own color, as in a 98 menu.
|
|
||||||
'--wb-c-select': from, '--wb-c-select-text': titleText,
|
|
||||||
// Menus are the face: status inks are measured on it.
|
|
||||||
'--wb-c-muted': legible(colors.muted, face, 4.5), '--wb-c-faint': legible(colors.muted, face, 4.5),
|
|
||||||
'--wb-c-warn': legible('#806000', face, 4.5), '--wb-c-danger-ink': legible('#a00000', face, 4.5),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Every variable chromeVars may set (to clear them when a pane returns to the global theme). */
|
/** Every variable chromeVars may set (to clear them when a pane returns to the global theme). */
|
||||||
export const CHROME_VAR_NAMES = Object.keys(chromeVars({
|
export const CHROME_VAR_NAMES = Object.keys(chromeVars({
|
||||||
colors: { bg: '#000000', surface: '#111111', elevated: '#222222', border: '#333333', text: '#ffffff', muted: '#999999', accent: '#1d9bf0' },
|
colors: { bg: '#000000', surface: '#111111', elevated: '#222222', border: '#333333', text: '#ffffff', muted: '#999999', accent: '#1d9bf0' },
|
||||||
chromeFont: 'A', monoFont: 'B', radius: 12, edges: 'bevel',
|
chromeFont: 'A', monoFont: 'B',
|
||||||
})).concat('--wb-c-shadow-pop');
|
})).concat('--wb-c-shadow-pop');
|
||||||
|
|
||||||
/** The edge style a set of chrome variables asks for (`html[data-wb-edges]`), or null. */
|
|
||||||
export function chromeEdges(vars: Record<string, string>): string | null {
|
|
||||||
return vars['--wb-c-edges'] === 'bevel' ? 'bevel' : null;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -6,25 +6,25 @@
|
||||||
.bt-deck { position: relative; height: 100%; display: flex; flex-direction: column; background: var(--bt-ground); color: var(--bt-text); overflow: hidden; }
|
.bt-deck { position: relative; height: 100%; display: flex; flex-direction: column; background: var(--bt-ground); color: var(--bt-text); overflow: hidden; }
|
||||||
|
|
||||||
/* The deck's dockview tab: unread total. */
|
/* The deck's dockview tab: unread total. */
|
||||||
.bt-tab-unread { flex: none; min-width: 16px; height: 16px; padding: 0 5px; box-sizing: border-box; border-radius: calc(999px * var(--bt-rs, 1)); background: var(--bt-accent); color: #fff; font: 700 10px/16px var(--bt-mono); text-align: center; }
|
.bt-tab-unread { flex: none; min-width: 16px; height: 16px; padding: 0 5px; box-sizing: border-box; border-radius: 999px; background: var(--bt-accent); color: #fff; font: 700 10px/16px var(--bt-mono); text-align: center; }
|
||||||
|
|
||||||
/* Deck bar ---------------------------------------------------------------------------------- */
|
/* Deck bar ---------------------------------------------------------------------------------- */
|
||||||
.bt-deck-bar { flex: none; display: flex; align-items: center; gap: 10px; height: 40px; padding-block: 0; padding-inline: 14px 10px; }
|
.bt-deck-bar { flex: none; display: flex; align-items: center; gap: 10px; height: 40px; padding-block: 0; padding-inline: 14px 10px; }
|
||||||
.bt-deck-mark { display: grid; place-items: center; width: 22px; height: 22px; border-radius: calc(7px * var(--bt-rs, 1)); background: linear-gradient(135deg, rgba(79, 107, 255, .28), rgba(34, 211, 238, .18)); box-shadow: inset 0 0 0 1px rgba(159, 211, 255, .18); color: #bfe0ff; }
|
.bt-deck-mark { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(135deg, rgba(79, 107, 255, .28), rgba(34, 211, 238, .18)); box-shadow: inset 0 0 0 1px rgba(159, 211, 255, .18); color: #bfe0ff; }
|
||||||
.bt-deck-mark .bt-glyph { width: 13px; height: 13px; }
|
.bt-deck-mark .bt-glyph { width: 13px; height: 13px; }
|
||||||
.bt-deck-name { font: 650 13.5px/1 var(--bt-ui); letter-spacing: -.01em; }
|
.bt-deck-name { font: 650 13.5px/1 var(--bt-ui); letter-spacing: -.01em; }
|
||||||
.bt-deck-count { color: var(--bt-faint); font: 500 11.5px/1 var(--bt-ui); }
|
.bt-deck-count { color: var(--bt-faint); font: 500 11.5px/1 var(--bt-ui); }
|
||||||
.bt-deck-total { padding: 4px 8px; border-radius: calc(999px * var(--bt-rs, 1)); background: var(--bt-accent-soft); color: var(--bt-accent-ink); font: 600 11px/1 var(--bt-mono); box-shadow: inset 0 0 0 1px rgba(29, 155, 240, .28); }
|
.bt-deck-total { padding: 4px 8px; border-radius: 999px; background: var(--bt-accent-soft); color: var(--bt-accent-ink); font: 600 11px/1 var(--bt-mono); box-shadow: inset 0 0 0 1px rgba(29, 155, 240, .28); }
|
||||||
.bt-deck-fill { flex: 1; }
|
.bt-deck-fill { flex: 1; }
|
||||||
.bt-deck-pager { display: flex; align-items: center; gap: 2px; padding: 2px; border-radius: calc(999px * var(--bt-rs, 1)); background: var(--bt-field); box-shadow: inset 0 0 0 1px var(--bt-line-soft); }
|
.bt-deck-pager { display: flex; align-items: center; gap: 2px; padding: 2px; border-radius: 999px; background: var(--bt-field); box-shadow: inset 0 0 0 1px var(--bt-line-soft); }
|
||||||
.bt-deck-pager .bt-icon { width: 24px; height: 24px; border-radius: calc(999px * var(--bt-rs, 1)); }
|
.bt-deck-pager .bt-icon { width: 24px; height: 24px; border-radius: 999px; }
|
||||||
.bt-deck-pager .bt-glyph { width: 13px; height: 13px; }
|
.bt-deck-pager .bt-glyph { width: 13px; height: 13px; }
|
||||||
.bt-deck-dot { width: 18px; height: 24px; padding: 0; border: 0; background: transparent; cursor: pointer; position: relative; }
|
.bt-deck-dot { width: 18px; height: 24px; padding: 0; border: 0; background: transparent; cursor: pointer; position: relative; }
|
||||||
.bt-deck-dot::after { content: ""; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: calc(999px * var(--bt-rs, 1)); background: var(--bt-line-strong); transition: width var(--bt-t2) var(--bt-ease-out), margin var(--bt-t2) var(--bt-ease-out), background-color var(--bt-t1) var(--bt-ease); }
|
.bt-deck-dot::after { content: ""; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 999px; background: var(--bt-line-strong); transition: width var(--bt-t2) var(--bt-ease-out), margin var(--bt-t2) var(--bt-ease-out), background-color var(--bt-t1) var(--bt-ease); }
|
||||||
.bt-deck-dot:hover::after { background: var(--bt-muted); }
|
.bt-deck-dot:hover::after { background: var(--bt-muted); }
|
||||||
.bt-deck-dot.is-on::after { width: 14px; margin-left: -7px; background: var(--bt-accent); } /* rtl-ok: centred with left: 50% */
|
.bt-deck-dot.is-on::after { width: 14px; margin-left: -7px; background: var(--bt-accent); } /* rtl-ok: centred with left: 50% */
|
||||||
.bt-deck-memory { color: var(--bt-muted); font: 500 11px/1 var(--bt-mono); padding: 5px 8px; border-radius: calc(7px * var(--bt-rs, 1)); background: rgba(238, 240, 247, .04); }
|
.bt-deck-memory { color: var(--bt-muted); font: 500 11px/1 var(--bt-mono); padding: 5px 8px; border-radius: 7px; background: rgba(238, 240, 247, .04); }
|
||||||
.bt-deck-action { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding-block: 0; padding-inline: 9px 11px; border: 0; border-radius: calc(8px * var(--bt-rs, 1)); background: rgba(238, 240, 247, .05); box-shadow: inset 0 0 0 1px rgba(238, 240, 247, .06); color: var(--bt-text-2); font: 550 12.5px/1 var(--bt-ui); cursor: pointer; transition: background-color var(--bt-t1) var(--bt-ease), color var(--bt-t1) var(--bt-ease); }
|
.bt-deck-action { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding-block: 0; padding-inline: 9px 11px; border: 0; border-radius: 8px; background: rgba(238, 240, 247, .05); box-shadow: inset 0 0 0 1px rgba(238, 240, 247, .06); color: var(--bt-text-2); font: 550 12.5px/1 var(--bt-ui); cursor: pointer; transition: background-color var(--bt-t1) var(--bt-ease), color var(--bt-t1) var(--bt-ease); }
|
||||||
.bt-deck-action .bt-glyph { width: 14px; height: 14px; }
|
.bt-deck-action .bt-glyph { width: 14px; height: 14px; }
|
||||||
.bt-deck-action:hover { background: rgba(238, 240, 247, .09); color: var(--bt-text); }
|
.bt-deck-action:hover { background: rgba(238, 240, 247, .09); color: var(--bt-text); }
|
||||||
.bt-deck-action.is-on { background: var(--bt-accent-soft); box-shadow: inset 0 0 0 1px rgba(29, 155, 240, .38); color: var(--bt-accent-ink); }
|
.bt-deck-action.is-on { background: var(--bt-accent-soft); box-shadow: inset 0 0 0 1px rgba(29, 155, 240, .38); color: var(--bt-accent-ink); }
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
.bt-deck-row { position: relative; flex: 1; min-height: 0; margin: 0 8px; }
|
.bt-deck-row { position: relative; flex: 1; min-height: 0; margin: 0 8px; }
|
||||||
.bt-col, .bt-compose {
|
.bt-col, .bt-compose {
|
||||||
position: absolute; top: 0; bottom: 0; display: flex; flex-direction: column; box-sizing: border-box;
|
position: absolute; top: 0; bottom: 0; display: flex; flex-direction: column; box-sizing: border-box;
|
||||||
border-radius: calc(12px * var(--bt-rs, 1)) calc(12px * var(--bt-rs, 1)) 0 0; background: var(--bt-chrome); box-shadow: inset 0 0 0 1px var(--bt-line-soft);
|
border-radius: 12px 12px 0 0; background: var(--bt-chrome); box-shadow: inset 0 0 0 1px var(--bt-line-soft);
|
||||||
--bt-col-account: var(--bt-accent);
|
--bt-col-account: var(--bt-accent);
|
||||||
}
|
}
|
||||||
/* Motion never transforms a column's body: the webview is placed on the body's rectangle, so only
|
/* Motion never transforms a column's body: the webview is placed on the body's rectangle, so only
|
||||||
|
|
@ -50,12 +50,12 @@
|
||||||
|
|
||||||
.bt-col-head, .bt-compose-head {
|
.bt-col-head, .bt-compose-head {
|
||||||
position: relative; flex: none; display: flex; align-items: center; gap: 8px; height: 46px; padding-block: 0; padding-inline: 8px 6px;
|
position: relative; flex: none; display: flex; align-items: center; gap: 8px; height: 46px; padding-block: 0; padding-inline: 8px 6px;
|
||||||
border-radius: calc(12px * var(--bt-rs, 1)) calc(12px * var(--bt-rs, 1)) 0 0; border-bottom: 1px solid var(--bt-line-soft);
|
border-radius: 12px 12px 0 0; border-bottom: 1px solid var(--bt-line-soft);
|
||||||
background: linear-gradient(180deg, rgba(238, 240, 247, .025), transparent);
|
background: linear-gradient(180deg, rgba(238, 240, 247, .025), transparent);
|
||||||
}
|
}
|
||||||
/* The focused column: an accent line on top and a lifted header. */
|
/* The focused column: an accent line on top and a lifted header. */
|
||||||
.bt-col-head::before, .bt-compose-head::before {
|
.bt-col-head::before, .bt-compose-head::before {
|
||||||
content: ""; position: absolute; left: 12px; right: 12px; top: 0; height: 2px; border-radius: 0 0 calc(2px * var(--bt-rs, 1)) calc(2px * var(--bt-rs, 1));
|
content: ""; position: absolute; left: 12px; right: 12px; top: 0; height: 2px; border-radius: 0 0 2px 2px;
|
||||||
background: var(--bt-brush); opacity: 0; transform: scaleX(.6); transition: opacity var(--bt-t2) var(--bt-ease), transform var(--bt-t3) var(--bt-ease-out);
|
background: var(--bt-brush); opacity: 0; transform: scaleX(.6); transition: opacity var(--bt-t2) var(--bt-ease), transform var(--bt-t3) var(--bt-ease-out);
|
||||||
}
|
}
|
||||||
.bt-col.is-focused .bt-col-head::before, .bt-compose-head::before { opacity: 1; transform: none; }
|
.bt-col.is-focused .bt-col-head::before, .bt-compose-head::before { opacity: 1; transform: none; }
|
||||||
|
|
@ -63,7 +63,7 @@
|
||||||
.bt-col.is-focused .bt-col-head { background: linear-gradient(180deg, rgba(29, 155, 240, .08), rgba(29, 155, 240, 0)); }
|
.bt-col.is-focused .bt-col-head { background: linear-gradient(180deg, rgba(29, 155, 240, .08), rgba(29, 155, 240, 0)); }
|
||||||
|
|
||||||
.bt-col-glyph {
|
.bt-col-glyph {
|
||||||
display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: calc(8px * var(--bt-rs, 1)); padding: 0; border: 0;
|
display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 8px; padding: 0; border: 0;
|
||||||
background: color-mix(in srgb, var(--bt-col-account) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bt-col-account) 30%, transparent);
|
background: color-mix(in srgb, var(--bt-col-account) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bt-col-account) 30%, transparent);
|
||||||
color: color-mix(in srgb, var(--bt-col-account) 55%, #ffffff);
|
color: color-mix(in srgb, var(--bt-col-account) 55%, #ffffff);
|
||||||
}
|
}
|
||||||
|
|
@ -75,15 +75,15 @@
|
||||||
.bt-col-titles span { color: var(--bt-muted); font: 450 11.5px/1.1 var(--bt-ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
.bt-col-titles span { color: var(--bt-muted); font: 450 11.5px/1.1 var(--bt-ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||||
.bt-col-fill { flex: 1; min-width: 4px; }
|
.bt-col-fill { flex: 1; min-width: 4px; }
|
||||||
.bt-col-unread {
|
.bt-col-unread {
|
||||||
flex: none; min-width: 22px; height: 20px; padding: 0 7px; box-sizing: border-box; border: 0; border-radius: calc(999px * var(--bt-rs, 1)); cursor: pointer;
|
flex: none; min-width: 22px; height: 20px; padding: 0 7px; box-sizing: border-box; border: 0; border-radius: 999px; cursor: pointer;
|
||||||
background: var(--bt-accent); color: #fff; font: 700 11px/20px var(--bt-mono); letter-spacing: -.02em;
|
background: var(--bt-accent); color: #fff; font: 700 11px/20px var(--bt-mono); letter-spacing: -.02em;
|
||||||
box-shadow: 0 0 0 3px rgba(29, 155, 240, .16), 0 4px 12px -4px rgba(29, 155, 240, .8);
|
box-shadow: 0 0 0 3px rgba(29, 155, 240, .16), 0 4px 12px -4px rgba(29, 155, 240, .8);
|
||||||
animation: bt-unread-in var(--bt-t3) var(--bt-ease-out);
|
animation: bt-unread-in var(--bt-t3) var(--bt-ease-out);
|
||||||
}
|
}
|
||||||
.bt-col-unread:hover { filter: brightness(1.12); }
|
.bt-col-unread:hover { filter: brightness(1.12); }
|
||||||
@keyframes bt-unread-in { from { transform: scale(.6); opacity: 0; } }
|
@keyframes bt-unread-in { from { transform: scale(.6); opacity: 0; } }
|
||||||
.bt-col-account { display: grid; place-items: center; flex: none; padding: 2px; border-radius: calc(999px * var(--bt-rs, 1)); box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--bt-col-account) 70%, transparent); }
|
.bt-col-account { display: grid; place-items: center; flex: none; padding: 2px; border-radius: 999px; box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--bt-col-account) 70%, transparent); }
|
||||||
.bt-col-btn { width: 28px; height: 28px; border-radius: calc(8px * var(--bt-rs, 1)); color: var(--bt-muted); }
|
.bt-col-btn { width: 28px; height: 28px; border-radius: 8px; color: var(--bt-muted); }
|
||||||
.bt-col-btn .bt-glyph { width: 15px; height: 15px; }
|
.bt-col-btn .bt-glyph { width: 15px; height: 15px; }
|
||||||
.bt-col-btn:hover { color: var(--bt-text); }
|
.bt-col-btn:hover { color: var(--bt-text); }
|
||||||
.bt-col-btn.is-active { color: var(--bt-accent-ink); background: var(--bt-accent-soft); }
|
.bt-col-btn.is-active { color: var(--bt-accent-ink); background: var(--bt-accent-soft); }
|
||||||
|
|
@ -99,8 +99,8 @@
|
||||||
.bt-compose { right: 0; animation: bt-fade-in var(--bt-t3) var(--bt-ease-out) both; box-shadow: inset 0 0 0 1px rgba(29, 155, 240, .28), -18px 0 40px -24px rgba(0, 0, 0, .8); }
|
.bt-compose { right: 0; animation: bt-fade-in var(--bt-t3) var(--bt-ease-out) both; box-shadow: inset 0 0 0 1px rgba(29, 155, 240, .28), -18px 0 40px -24px rgba(0, 0, 0, .8); }
|
||||||
.bt-compose > .bt-compose-head { animation: bt-slide-in var(--bt-t3) var(--bt-ease-out) both; }
|
.bt-compose > .bt-compose-head { animation: bt-slide-in var(--bt-t3) var(--bt-ease-out) both; }
|
||||||
.bt-compose-glyph { --bt-col-account: var(--bt-accent); }
|
.bt-compose-glyph { --bt-col-account: var(--bt-accent); }
|
||||||
.bt-compose-accounts { display: flex; gap: 2px; padding: 2px; border-radius: calc(999px * var(--bt-rs, 1)); background: var(--bt-field); }
|
.bt-compose-accounts { display: flex; gap: 2px; padding: 2px; border-radius: 999px; background: var(--bt-field); }
|
||||||
.bt-compose-accounts button { display: grid; place-items: center; padding: 2px; border: 0; border-radius: calc(999px * var(--bt-rs, 1)); background: transparent; cursor: pointer; opacity: .55; transition: opacity var(--bt-t1) var(--bt-ease); }
|
.bt-compose-accounts button { display: grid; place-items: center; padding: 2px; border: 0; border-radius: 999px; background: transparent; cursor: pointer; opacity: .55; transition: opacity var(--bt-t1) var(--bt-ease); }
|
||||||
.bt-compose-accounts button:hover { opacity: .9; }
|
.bt-compose-accounts button:hover { opacity: .9; }
|
||||||
.bt-compose-accounts button.is-on { opacity: 1; box-shadow: 0 0 0 1.5px var(--bt-accent); }
|
.bt-compose-accounts button.is-on { opacity: 1; box-shadow: 0 0 0 1.5px var(--bt-accent); }
|
||||||
|
|
||||||
|
|
@ -111,18 +111,18 @@
|
||||||
.bt-deck-pop-head strong { font: 650 13px/1 var(--bt-ui); }
|
.bt-deck-pop-head strong { font: 650 13px/1 var(--bt-ui); }
|
||||||
.bt-deck-pop-head span { margin-inline-start: auto; color: var(--bt-faint); font: 500 11.5px/1 var(--bt-ui); max-width: 55%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
.bt-deck-pop-head span { margin-inline-start: auto; color: var(--bt-faint); font: 500 11.5px/1 var(--bt-ui); max-width: 55%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||||
.bt-deck-terms { display: flex; flex-direction: column; gap: 8px; padding: 0 4px 6px; }
|
.bt-deck-terms { display: flex; flex-direction: column; gap: 8px; padding: 0 4px 6px; }
|
||||||
.bt-deck-input { height: 32px; padding: 0 10px; border: 0; border-radius: calc(8px * var(--bt-rs, 1)); background: var(--bt-field); box-shadow: inset 0 0 0 1px var(--bt-line); color: var(--bt-text); font: 450 12.5px/1 var(--bt-mono); outline: none; user-select: text; }
|
.bt-deck-input { height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: var(--bt-field); box-shadow: inset 0 0 0 1px var(--bt-line); color: var(--bt-text); font: 450 12.5px/1 var(--bt-mono); outline: none; user-select: text; }
|
||||||
.bt-deck-input:focus { box-shadow: var(--bt-ring); }
|
.bt-deck-input:focus { box-shadow: var(--bt-ring); }
|
||||||
.bt-deck-chips { display: flex; flex-wrap: wrap; gap: 5px; max-height: 120px; overflow-y: auto; scrollbar-width: thin; }
|
.bt-deck-chips { display: flex; flex-wrap: wrap; gap: 5px; max-height: 120px; overflow-y: auto; scrollbar-width: thin; }
|
||||||
.bt-deck-chip { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; height: 24px; padding-block: 0; padding-inline: 9px 2px; border-radius: calc(999px * var(--bt-rs, 1)); background: rgba(238, 240, 247, .06); box-shadow: inset 0 0 0 1px rgba(238, 240, 247, .07); font: 500 12px/1 var(--bt-ui); }
|
.bt-deck-chip { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; height: 24px; padding-block: 0; padding-inline: 9px 2px; border-radius: 999px; background: rgba(238, 240, 247, .06); box-shadow: inset 0 0 0 1px rgba(238, 240, 247, .07); font: 500 12px/1 var(--bt-ui); }
|
||||||
.bt-deck-chip > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
.bt-deck-chip > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||||
.bt-deck-chip.is-regex { font-family: var(--bt-mono); color: #d7c6ff; background: rgba(168, 85, 247, .12); box-shadow: inset 0 0 0 1px rgba(168, 85, 247, .25); }
|
.bt-deck-chip.is-regex { font-family: var(--bt-mono); color: #d7c6ff; background: rgba(168, 85, 247, .12); box-shadow: inset 0 0 0 1px rgba(168, 85, 247, .25); }
|
||||||
.bt-menu .bt-deck-chip button { width: 20px; height: 20px; padding: 0; justify-content: center; border-radius: calc(999px * var(--bt-rs, 1)); }
|
.bt-menu .bt-deck-chip button { width: 20px; height: 20px; padding: 0; justify-content: center; border-radius: 999px; }
|
||||||
.bt-deck-chip .bt-glyph { width: 11px; height: 11px; }
|
.bt-deck-chip .bt-glyph { width: 11px; height: 11px; }
|
||||||
.bt-deck-check { display: flex; align-items: flex-start; gap: 10px; padding: 7px 8px; border-radius: calc(8px * var(--bt-rs, 1)); cursor: pointer; }
|
.bt-deck-check { display: flex; align-items: flex-start; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
|
||||||
.bt-deck-check:hover { background: var(--bt-hover); }
|
.bt-deck-check:hover { background: var(--bt-hover); }
|
||||||
.bt-deck-check input { position: absolute; opacity: 0; pointer-events: none; }
|
.bt-deck-check input { position: absolute; opacity: 0; pointer-events: none; }
|
||||||
.bt-deck-check-box { display: grid; place-items: center; flex: none; width: 16px; height: 16px; margin-top: 1px; border-radius: calc(5px * var(--bt-rs, 1)); box-shadow: inset 0 0 0 1.5px var(--bt-line-strong); color: transparent; transition: background-color var(--bt-t1) var(--bt-ease); }
|
.bt-deck-check-box { display: grid; place-items: center; flex: none; width: 16px; height: 16px; margin-top: 1px; border-radius: 5px; box-shadow: inset 0 0 0 1.5px var(--bt-line-strong); color: transparent; transition: background-color var(--bt-t1) var(--bt-ease); }
|
||||||
.bt-deck-check-box .bt-glyph { width: 11px; height: 11px; stroke-width: 2.4; }
|
.bt-deck-check-box .bt-glyph { width: 11px; height: 11px; stroke-width: 2.4; }
|
||||||
.bt-deck-check input:checked + .bt-deck-check-box { background: var(--bt-accent); box-shadow: none; color: #fff; }
|
.bt-deck-check input:checked + .bt-deck-check-box { background: var(--bt-accent); box-shadow: none; color: #fff; }
|
||||||
.bt-deck-check input:focus-visible + .bt-deck-check-box { box-shadow: var(--bt-ring); }
|
.bt-deck-check input:focus-visible + .bt-deck-check-box { box-shadow: var(--bt-ring); }
|
||||||
|
|
@ -131,12 +131,12 @@
|
||||||
.bt-deck-check-text small { color: var(--bt-muted); font: 400 11.5px/1.2 var(--bt-ui); }
|
.bt-deck-check-text small { color: var(--bt-muted); font: 400 11.5px/1.2 var(--bt-ui); }
|
||||||
.bt-deck-widths { display: flex; align-items: center; gap: 2px; padding-block: 4px; padding-inline: 10px 6px; color: var(--bt-muted); font: 500 12px/1 var(--bt-ui); }
|
.bt-deck-widths { display: flex; align-items: center; gap: 2px; padding-block: 4px; padding-inline: 10px 6px; color: var(--bt-muted); font: 500 12px/1 var(--bt-ui); }
|
||||||
.bt-deck-widths > span { margin-inline-end: auto; }
|
.bt-deck-widths > span { margin-inline-end: auto; }
|
||||||
.bt-menu .bt-deck-widths button { height: 24px; padding: 0 6px; border-radius: calc(6px * var(--bt-rs, 1)); color: var(--bt-muted); font: 500 11px/1 var(--bt-mono); }
|
.bt-menu .bt-deck-widths button { height: 24px; padding: 0 6px; border-radius: 6px; color: var(--bt-muted); font: 500 11px/1 var(--bt-mono); }
|
||||||
.bt-menu .bt-deck-widths button.is-on { background: var(--bt-accent-soft); color: var(--bt-accent-ink); }
|
.bt-menu .bt-deck-widths button.is-on { background: var(--bt-accent-soft); color: var(--bt-accent-ink); }
|
||||||
|
|
||||||
/* Buttons ----------------------------------------------------------------------------------- */
|
/* Buttons ----------------------------------------------------------------------------------- */
|
||||||
.bt-deck-primary, .bt-deck-secondary {
|
.bt-deck-primary, .bt-deck-secondary {
|
||||||
display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px; border: 0; border-radius: calc(9px * var(--bt-rs, 1)); cursor: pointer;
|
display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px; border: 0; border-radius: 9px; cursor: pointer;
|
||||||
font: 600 13px/1 var(--bt-ui); transition: filter var(--bt-t1) var(--bt-ease), background-color var(--bt-t1) var(--bt-ease);
|
font: 600 13px/1 var(--bt-ui); transition: filter var(--bt-t1) var(--bt-ease), background-color var(--bt-t1) var(--bt-ease);
|
||||||
}
|
}
|
||||||
.bt-deck-primary { background: var(--bt-accent); color: #fff; box-shadow: 0 6px 18px -8px rgba(29, 155, 240, .9), inset 0 1px 0 rgba(255, 255, 255, .18); }
|
.bt-deck-primary { background: var(--bt-accent); color: #fff; box-shadow: 0 6px 18px -8px rgba(29, 155, 240, .9), inset 0 1px 0 rgba(255, 255, 255, .18); }
|
||||||
|
|
@ -155,7 +155,7 @@
|
||||||
.bt-deck-empty-keys { display: flex; align-items: center; gap: 6px 18px; flex-wrap: wrap; justify-content: center; margin-top: 10px !important; font-size: 12px !important; color: var(--bt-faint) !important; }
|
.bt-deck-empty-keys { display: flex; align-items: center; gap: 6px 18px; flex-wrap: wrap; justify-content: center; margin-top: 10px !important; font-size: 12px !important; color: var(--bt-faint) !important; }
|
||||||
.bt-deck-empty-keys > span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
|
.bt-deck-empty-keys > span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
|
||||||
.bt-deck-empty-art { display: flex; gap: 6px; height: 64px; align-items: flex-end; }
|
.bt-deck-empty-art { display: flex; gap: 6px; height: 64px; align-items: flex-end; }
|
||||||
.bt-deck-empty-art span { width: 30px; border-radius: calc(7px * var(--bt-rs, 1)) calc(7px * var(--bt-rs, 1)) calc(2px * var(--bt-rs, 1)) calc(2px * var(--bt-rs, 1)); background: linear-gradient(180deg, rgba(79, 107, 255, .5), rgba(34, 211, 238, .12)); box-shadow: inset 0 0 0 1px rgba(159, 211, 255, .2); animation: bt-rise var(--bt-t3) var(--bt-ease-out) both; }
|
.bt-deck-empty-art span { width: 30px; border-radius: 7px 7px 2px 2px; background: linear-gradient(180deg, rgba(79, 107, 255, .5), rgba(34, 211, 238, .12)); box-shadow: inset 0 0 0 1px rgba(159, 211, 255, .2); animation: bt-rise var(--bt-t3) var(--bt-ease-out) both; }
|
||||||
.bt-deck-empty-art span:nth-child(1) { height: 64px; }
|
.bt-deck-empty-art span:nth-child(1) { height: 64px; }
|
||||||
.bt-deck-empty-art span:nth-child(2) { height: 52px; }
|
.bt-deck-empty-art span:nth-child(2) { height: 52px; }
|
||||||
.bt-deck-empty-art span:nth-child(3) { height: 58px; }
|
.bt-deck-empty-art span:nth-child(3) { height: 58px; }
|
||||||
|
|
@ -169,7 +169,7 @@
|
||||||
.bt-addcol-head .bt-icon { margin-inline-start: auto; align-self: center; }
|
.bt-addcol-head .bt-icon { margin-inline-start: auto; align-self: center; }
|
||||||
.bt-addcol-types { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 10px 16px 6px; }
|
.bt-addcol-types { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 10px 16px 6px; }
|
||||||
.bt-addcol-type {
|
.bt-addcol-type {
|
||||||
display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-height: 96px; padding: 12px; border: 0; border-radius: calc(11px * var(--bt-rs, 1)); cursor: pointer; text-align: start;
|
display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-height: 96px; padding: 12px; border: 0; border-radius: 11px; cursor: pointer; text-align: start;
|
||||||
background: rgba(238, 240, 247, .035); box-shadow: inset 0 0 0 1px rgba(238, 240, 247, .06); color: var(--bt-text-2);
|
background: rgba(238, 240, 247, .035); box-shadow: inset 0 0 0 1px rgba(238, 240, 247, .06); color: var(--bt-text-2);
|
||||||
transition: background-color var(--bt-t1) var(--bt-ease), box-shadow var(--bt-t1) var(--bt-ease), transform var(--bt-t2) var(--bt-ease-out);
|
transition: background-color var(--bt-t1) var(--bt-ease), box-shadow var(--bt-t1) var(--bt-ease), transform var(--bt-t2) var(--bt-ease-out);
|
||||||
}
|
}
|
||||||
|
|
@ -178,24 +178,24 @@
|
||||||
.bt-addcol-type.is-on { background: var(--bt-accent-soft); box-shadow: inset 0 0 0 1.5px rgba(29, 155, 240, .6); color: var(--bt-text); }
|
.bt-addcol-type.is-on { background: var(--bt-accent-soft); box-shadow: inset 0 0 0 1.5px rgba(29, 155, 240, .6); color: var(--bt-text); }
|
||||||
.bt-addcol-type strong { font: 650 13.5px/1.1 var(--bt-ui); color: var(--bt-text); }
|
.bt-addcol-type strong { font: 650 13.5px/1.1 var(--bt-ui); color: var(--bt-text); }
|
||||||
.bt-addcol-type small { color: var(--bt-muted); font: 400 11.5px/1.35 var(--bt-ui); }
|
.bt-addcol-type small { color: var(--bt-muted); font: 400 11.5px/1.35 var(--bt-ui); }
|
||||||
.bt-addcol-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: calc(8px * var(--bt-rs, 1)); background: rgba(238, 240, 247, .06); color: var(--bt-muted); }
|
.bt-addcol-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: rgba(238, 240, 247, .06); color: var(--bt-muted); }
|
||||||
.bt-addcol-type.is-on .bt-addcol-icon { background: rgba(29, 155, 240, .22); color: #bfe0ff; }
|
.bt-addcol-type.is-on .bt-addcol-icon { background: rgba(29, 155, 240, .22); color: #bfe0ff; }
|
||||||
.bt-addcol-icon .bt-glyph { width: 15px; height: 15px; }
|
.bt-addcol-icon .bt-glyph { width: 15px; height: 15px; }
|
||||||
.bt-addcol-value { display: flex; flex-direction: column; gap: 8px; padding: 10px 16px 4px; }
|
.bt-addcol-value { display: flex; flex-direction: column; gap: 8px; padding: 10px 16px 4px; }
|
||||||
.bt-addcol-value label, .bt-addcol-label { color: var(--bt-faint); font: 600 10.5px/1 var(--bt-ui); letter-spacing: .08em; text-transform: uppercase; }
|
.bt-addcol-value label, .bt-addcol-label { color: var(--bt-faint); font: 600 10.5px/1 var(--bt-ui); letter-spacing: .08em; text-transform: uppercase; }
|
||||||
.bt-addcol-field { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 12px; border-radius: calc(10px * var(--bt-rs, 1)); background: var(--bt-field); box-shadow: inset 0 0 0 1px var(--bt-line); }
|
.bt-addcol-field { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 12px; border-radius: 10px; background: var(--bt-field); box-shadow: inset 0 0 0 1px var(--bt-line); }
|
||||||
.bt-addcol-field:focus-within { box-shadow: var(--bt-ring); }
|
.bt-addcol-field:focus-within { box-shadow: var(--bt-ring); }
|
||||||
.bt-addcol-field.is-bad { box-shadow: 0 0 0 1px rgba(229, 72, 77, .7); }
|
.bt-addcol-field.is-bad { box-shadow: 0 0 0 1px rgba(229, 72, 77, .7); }
|
||||||
.bt-addcol-field .bt-glyph { color: var(--bt-muted); }
|
.bt-addcol-field .bt-glyph { color: var(--bt-muted); }
|
||||||
.bt-addcol-field input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--bt-text); font: 500 14px/1 var(--bt-mono); outline: none; user-select: text; }
|
.bt-addcol-field input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--bt-text); font: 500 14px/1 var(--bt-mono); outline: none; user-select: text; }
|
||||||
.bt-addcol-field input::placeholder { color: var(--bt-faint); }
|
.bt-addcol-field input::placeholder { color: var(--bt-faint); }
|
||||||
.bt-addcol-chips { display: flex; flex-wrap: wrap; gap: 6px; }
|
.bt-addcol-chips { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||||
.bt-addcol-chips button { height: 26px; padding: 0 10px; border: 0; border-radius: calc(999px * var(--bt-rs, 1)); background: rgba(238, 240, 247, .06); box-shadow: inset 0 0 0 1px rgba(238, 240, 247, .08); color: var(--bt-text-2); font: 500 12px/1 var(--bt-mono); cursor: pointer; }
|
.bt-addcol-chips button { height: 26px; padding: 0 10px; border: 0; border-radius: 999px; background: rgba(238, 240, 247, .06); box-shadow: inset 0 0 0 1px rgba(238, 240, 247, .08); color: var(--bt-text-2); font: 500 12px/1 var(--bt-mono); cursor: pointer; }
|
||||||
.bt-addcol-chips button[aria-selected=true] { background: var(--bt-accent-soft); color: var(--bt-accent-ink); box-shadow: inset 0 0 0 1px rgba(29, 155, 240, .35); }
|
.bt-addcol-chips button[aria-selected=true] { background: var(--bt-accent-soft); color: var(--bt-accent-ink); box-shadow: inset 0 0 0 1px rgba(29, 155, 240, .35); }
|
||||||
.bt-addcol-error { margin: 0; color: #ff9a9e; font-size: 12px; }
|
.bt-addcol-error { margin: 0; color: #ff9a9e; font-size: 12px; }
|
||||||
.bt-addcol-accounts { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px 8px; }
|
.bt-addcol-accounts { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px 8px; }
|
||||||
.bt-addcol-accounts > div { display: flex; flex-wrap: wrap; gap: 6px; }
|
.bt-addcol-accounts > div { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||||
.bt-addcol-account { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding-block: 0; padding-inline: 6px 12px; border: 0; border-radius: calc(999px * var(--bt-rs, 1)); cursor: pointer; background: rgba(238, 240, 247, .04); box-shadow: inset 0 0 0 1px rgba(238, 240, 247, .07); color: var(--bt-text-2); font: 550 12.5px/1 var(--bt-ui); }
|
.bt-addcol-account { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding-block: 0; padding-inline: 6px 12px; border: 0; border-radius: 999px; cursor: pointer; background: rgba(238, 240, 247, .04); box-shadow: inset 0 0 0 1px rgba(238, 240, 247, .07); color: var(--bt-text-2); font: 550 12.5px/1 var(--bt-ui); }
|
||||||
.bt-addcol-account:hover { background: rgba(238, 240, 247, .08); }
|
.bt-addcol-account:hover { background: rgba(238, 240, 247, .08); }
|
||||||
.bt-addcol-account.is-on { box-shadow: inset 0 0 0 1.5px var(--bt-col-account); color: var(--bt-text); background: color-mix(in srgb, var(--bt-col-account) 12%, transparent); }
|
.bt-addcol-account.is-on { box-shadow: inset 0 0 0 1.5px var(--bt-col-account); color: var(--bt-text); background: color-mix(in srgb, var(--bt-col-account) 12%, transparent); }
|
||||||
.bt-addcol-account em { color: var(--bt-faint); font: italic 400 11px/1 var(--bt-ui); }
|
.bt-addcol-account em { color: var(--bt-faint); font: italic 400 11px/1 var(--bt-ui); }
|
||||||
|
|
|
||||||
|
|
@ -1,159 +0,0 @@
|
||||||
/*
|
|
||||||
* Bevelled chrome: the app's own window drawn like the theme it shows when that theme is built from
|
|
||||||
* raised and sunken edges (a Windows 98 theme). chromeVars() sets `--wb-c-edges: bevel` and the edge
|
|
||||||
* colors; themeStore (and boot.js on the first frame) mirror it on `html[data-wb-edges=bevel]`.
|
|
||||||
*
|
|
||||||
* The edges are 98.css's (MIT, (c) Jordan Scales, https://github.com/jdan/98.css): a raised part has a
|
|
||||||
* highlight and a light line on its top and left and a shadow and a near-black line on its bottom and
|
|
||||||
* right; a sunken field has the same four lines the other way round. Here they come from the theme's
|
|
||||||
* own face color (--wb-c-face, --wb-c-bevel-*), so any palette can be bevelled.
|
|
||||||
*
|
|
||||||
* Square corners come from the radius scale (the theme's radius 0 makes --bt-rs 0); this file only
|
|
||||||
* draws faces, edges, the title bar and selection. Two levels: the window (title bar, caption
|
|
||||||
* buttons, menus, palette, scrollbars) follows the global theme on `html[data-wb-edges]`; each pane
|
|
||||||
* (its tabs, toolbar, address field, settings panel) follows its own theme on `.dv-groupview.wb-bevel`,
|
|
||||||
* which themeStore sets on every dock group whose theme (the pane's own, else the global one) is
|
|
||||||
* bevelled. So a Windows 98 pane is bevelled inside a flat window, and a flat pane stays flat inside
|
|
||||||
* a Windows 98 window.
|
|
||||||
*/
|
|
||||||
html[data-wb-edges=bevel], .dv-groupview.wb-bevel {
|
|
||||||
--bt-bv-face: var(--wb-c-face, #c0c0c0); --bt-bv-text: var(--wb-c-face-text, #000000);
|
|
||||||
--bt-bv-hi: var(--wb-c-bevel-hi, #ffffff); --bt-bv-lt: var(--wb-c-bevel-lt, #dfdfdf); --bt-bv-sh: var(--wb-c-bevel-sh, #808080); --bt-bv-dk: var(--wb-c-bevel-dk, #0a0a0a);
|
|
||||||
--bt-bv-out: inset -1px -1px var(--bt-bv-dk), inset 1px 1px var(--bt-bv-hi), inset -2px -2px var(--bt-bv-sh), inset 2px 2px var(--bt-bv-lt);
|
|
||||||
--bt-bv-window: inset -1px -1px var(--bt-bv-dk), inset 1px 1px var(--bt-bv-lt), inset -2px -2px var(--bt-bv-sh), inset 2px 2px var(--bt-bv-hi);
|
|
||||||
--bt-bv-in: inset -1px -1px var(--bt-bv-hi), inset 1px 1px var(--bt-bv-sh), inset -2px -2px var(--bt-bv-lt), inset 2px 2px var(--bt-bv-dk);
|
|
||||||
--bt-bv-pressed: inset -1px -1px var(--bt-bv-hi), inset 1px 1px var(--bt-bv-dk), inset -2px -2px var(--bt-bv-lt), inset 2px 2px var(--bt-bv-sh);
|
|
||||||
--bt-bv-etched: inset -1px -1px var(--bt-bv-hi), inset 1px 1px var(--bt-bv-sh), inset -2px -2px var(--bt-bv-sh), inset 2px 2px var(--bt-bv-hi);
|
|
||||||
--bt-bv-title: linear-gradient(90deg, var(--wb-c-title-from, #000080), var(--wb-c-title-to, #1084d0));
|
|
||||||
--bt-bv-title-text: var(--wb-c-title-text, #ffffff);
|
|
||||||
--bt-bv-select: var(--wb-c-select, #000080); --bt-bv-select-text: var(--wb-c-select-text, #ffffff);
|
|
||||||
/* The shell's surfaces become the face; text fields stay the theme's background. */
|
|
||||||
--bt-ground: var(--bt-bv-face); --bt-chrome: var(--bt-bv-face); --bt-field: var(--wb-c-ground, #ffffff); --bt-raised: var(--bt-bv-face); --bt-raised-2: var(--bt-bv-face);
|
|
||||||
--bt-text: var(--bt-bv-text); --bt-text-2: var(--bt-bv-text);
|
|
||||||
--bt-hover: transparent; --bt-press: transparent; --bt-shadow-pop: var(--bt-bv-window);
|
|
||||||
--bt-ring: 0 0 0 1px var(--bt-bv-dk);
|
|
||||||
}
|
|
||||||
html[data-wb-edges=bevel] :where(.bt-shell, .bt-menu, .bt-palette, .bt-media, .btp) :focus-visible { outline: 1px dotted var(--bt-bv-text); outline-offset: -4px; }
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
|
||||||
* Title bar: the active window's gradient across the tab row; tabs are a tab control on its floor. */
|
|
||||||
html[data-wb-edges=bevel] .bt-shell { background: var(--bt-bv-title) top / 100% var(--bt-titlebar-h) no-repeat, var(--bt-bv-face); }
|
|
||||||
html[data-wb-edges=bevel] .bt-shell--empty .bt-titlebar { background: var(--bt-bv-title); }
|
|
||||||
.bt-shell .dv-groupview.wb-bevel.bt-group--in-titlebar > .dv-tabs-and-actions-container { background: transparent; }
|
|
||||||
.bt-shell .dv-groupview.wb-bevel .dv-tabs-and-actions-container { background: var(--bt-bv-face); }
|
|
||||||
.bt-shell .dv-groupview.wb-bevel .dv-tabs-container .dv-tab {
|
|
||||||
--bt-tab-bg: var(--bt-bv-face); --bt-tab-fg: var(--bt-bv-text);
|
|
||||||
height: 28px; margin: 8px 2px 0 0; box-shadow: inset -1px 0 var(--bt-bv-dk), inset 1px 1px var(--bt-bv-hi), inset -2px 0 var(--bt-bv-sh), inset 2px 2px var(--bt-bv-lt);
|
|
||||||
}
|
|
||||||
.bt-shell .dv-groupview.wb-bevel.bt-group--in-titlebar .dv-tabs-container .dv-tab { height: 30px; margin-top: 14px; }
|
|
||||||
.bt-shell .dv-groupview.wb-bevel .dv-tabs-container .dv-tab.dv-inactive-tab:hover { --bt-tab-bg: var(--bt-bv-face); --bt-tab-fg: var(--bt-bv-text); }
|
|
||||||
/* The selected tab stands 2px taller and runs into the toolbar under it, like a 98 tab control. */
|
|
||||||
.bt-shell .dv-groupview.wb-bevel .dv-tabs-container .dv-tab.dv-active-tab,
|
|
||||||
.bt-shell .dv-groupview.wb-bevel.dv-inactive-group .dv-tabs-container .dv-tab.dv-active-tab {
|
|
||||||
--bt-tab-bg: var(--bt-bv-face); --bt-tab-fg: var(--bt-bv-text); z-index: 1; font-weight: 700;
|
|
||||||
box-shadow: inset -1px 0 var(--bt-bv-dk), inset 1px 1px var(--bt-bv-hi), inset -2px 0 var(--bt-bv-sh), inset 2px 2px var(--bt-bv-lt);
|
|
||||||
}
|
|
||||||
.bt-shell .dv-groupview.wb-bevel.bt-group--in-titlebar .dv-tabs-container .dv-tab.dv-active-tab { height: 32px; margin-top: 12px; }
|
|
||||||
.bt-shell .dv-groupview.wb-bevel .dv-tabs-container .dv-tab.dv-active-tab::after { display: none; }
|
|
||||||
.bt-shell .dv-groupview.wb-bevel.dv-inactive-group .dv-tabs-container .dv-tab.dv-active-tab { font-weight: 400; }
|
|
||||||
.bt-shell .dv-groupview.wb-bevel .dv-tabs-container .dv-tab:has(.bt-tab--pinned) + .dv-tab:not(:has(.bt-tab--pinned))::before { background: var(--bt-bv-sh); }
|
|
||||||
.dv-groupview.wb-bevel .bt-tab-close { color: var(--bt-bv-text); }
|
|
||||||
.dv-groupview.wb-bevel .bt-tab-close:hover { background: transparent; box-shadow: var(--bt-bv-out); }
|
|
||||||
.dv-groupview.wb-bevel .bt-tab-close:active { box-shadow: var(--bt-bv-pressed); }
|
|
||||||
/* Things drawn straight on the title bar take its label color. */
|
|
||||||
html[data-wb-edges=bevel] .bt-group--in-titlebar .bt-group-actions .bt-icon,
|
|
||||||
html[data-wb-edges=bevel] .bt-shell .bt-group--in-titlebar .dv-tabs-overflow-dropdown-default { color: var(--bt-bv-title-text); }
|
|
||||||
html[data-wb-edges=bevel] .bt-group--in-titlebar .bt-group-actions .bt-icon:hover { color: var(--bt-bv-text); background: var(--bt-bv-face); box-shadow: var(--bt-bv-out); }
|
|
||||||
/* Caption buttons: three small raised buttons, the close one apart. */
|
|
||||||
html[data-wb-edges=bevel] .bt-captions { align-items: center; gap: 2px; padding-inline-end: 6px; }
|
|
||||||
html[data-wb-edges=bevel] .bt-caption { width: 22px; height: 20px; color: var(--bt-bv-text); background: var(--bt-bv-face); box-shadow: var(--bt-bv-out); }
|
|
||||||
html[data-wb-edges=bevel] .bt-caption:hover { background: var(--bt-bv-face); color: var(--bt-bv-text); }
|
|
||||||
html[data-wb-edges=bevel] .bt-caption:active { box-shadow: var(--bt-bv-pressed); }
|
|
||||||
html[data-wb-edges=bevel] .bt-caption--close { margin-inline-start: 2px; }
|
|
||||||
html[data-wb-edges=bevel] .bt-caption--close:hover, html[data-wb-edges=bevel] .bt-caption--close:active { background: var(--bt-bv-face); color: var(--bt-bv-text); }
|
|
||||||
html[data-wb-edges=bevel] .bt-shell .bt-caption svg { width: 8px; height: 8px; stroke-width: 2; }
|
|
||||||
/* Titlebar buttons (account switcher, update chip, workspaces) are raised buttons on the title bar. */
|
|
||||||
html[data-wb-edges=bevel] :is(.bt-profile-switcher, .bt-update-chip, .bt-ws-button) { border: 0; background: var(--bt-bv-face); color: var(--bt-bv-text); box-shadow: var(--bt-bv-out); }
|
|
||||||
html[data-wb-edges=bevel] :is(.bt-profile-switcher, .bt-update-chip, .bt-ws-button):hover { background: var(--bt-bv-face); }
|
|
||||||
html[data-wb-edges=bevel] :is(.bt-profile-switcher[aria-expanded=true], .bt-update-chip:active, .bt-ws-button[aria-expanded=true]) { box-shadow: var(--bt-bv-pressed); }
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
|
||||||
* Toolbar: flat buttons that rise under the pointer, a sunken address field, the wB button raised. */
|
|
||||||
.dv-groupview.wb-bevel .bt-addressbar { background: var(--bt-bv-face); border-bottom: 0; box-shadow: inset 0 -1px var(--bt-bv-sh), inset 0 -2px var(--bt-bv-hi); }
|
|
||||||
.dv-groupview.wb-bevel .bt-icon { color: var(--bt-bv-text); }
|
|
||||||
.dv-groupview.wb-bevel .bt-icon:hover:not(:disabled) { background: transparent; box-shadow: inset -1px -1px var(--bt-bv-sh), inset 1px 1px var(--bt-bv-hi); }
|
|
||||||
.dv-groupview.wb-bevel .bt-icon:active:not(:disabled) { box-shadow: inset -1px -1px var(--bt-bv-hi), inset 1px 1px var(--bt-bv-sh); }
|
|
||||||
.dv-groupview.wb-bevel .bt-icon:disabled { color: var(--bt-bv-sh); }
|
|
||||||
.dv-groupview.wb-bevel .bt-omni { border: 0; background: var(--bt-field); box-shadow: var(--bt-bv-in); padding-inline: 6px; }
|
|
||||||
.dv-groupview.wb-bevel .bt-omni:hover { box-shadow: var(--bt-bv-in); }
|
|
||||||
.dv-groupview.wb-bevel .bt-omni:focus-within, .dv-groupview.wb-bevel .bt-omni:focus-visible { box-shadow: var(--bt-bv-in); }
|
|
||||||
.dv-groupview.wb-bevel .bt-omni-progress { background: var(--bt-bv-select); }
|
|
||||||
.dv-groupview.wb-bevel .bt-brand-button { border: 0; background: var(--bt-bv-face); box-shadow: var(--bt-bv-out); }
|
|
||||||
.dv-groupview.wb-bevel .bt-brand-button:hover { border: 0; background: var(--bt-bv-face); }
|
|
||||||
.dv-groupview.wb-bevel .bt-brand-button:active, .dv-groupview.wb-bevel .bt-pane-menu[aria-expanded=true] { background: var(--bt-bv-face); box-shadow: var(--bt-bv-pressed); }
|
|
||||||
.dv-groupview.wb-bevel .bt-brand-button:hover .bt-wb { transform: none; }
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
|
||||||
* Menus, the palette, popovers: a window edge on the face; the row under the pointer is selected. */
|
|
||||||
html[data-wb-edges=bevel] :is(.bt-menu, .bt-palette) { border: 0; background: var(--bt-bv-face); box-shadow: var(--bt-bv-window); color: var(--bt-bv-text); }
|
|
||||||
html[data-wb-edges=bevel] .bt-menu { padding: 3px; }
|
|
||||||
html[data-wb-edges=bevel] .bt-menu button:hover:not(:disabled), html[data-wb-edges=bevel] .bt-menu button:focus-visible,
|
|
||||||
html[data-wb-edges=bevel] .bt-menu button[aria-expanded=true] { background: var(--bt-bv-select); color: var(--bt-bv-select-text); outline: 0; }
|
|
||||||
html[data-wb-edges=bevel] .bt-menu button:hover:not(:disabled) :is(.bt-glyph, .bt-menu-keys, small, svg),
|
|
||||||
html[data-wb-edges=bevel] .bt-menu button:focus-visible :is(.bt-glyph, .bt-menu-keys, small, svg),
|
|
||||||
html[data-wb-edges=bevel] .bt-menu button[aria-expanded=true] :is(.bt-glyph, .bt-menu-keys, small, svg) { color: var(--bt-bv-select-text); }
|
|
||||||
/* Every line of a selected row (a title and its subline, as in the workspaces and accounts menus) takes the selection's ink. */
|
|
||||||
html[data-wb-edges=bevel] .bt-menu button:is(:hover:not(:disabled), :focus-visible, [aria-expanded=true]) * { color: var(--bt-bv-select-text) !important; }
|
|
||||||
html[data-wb-edges=bevel] .bt-menu button > .bt-glyph { color: var(--bt-bv-text); }
|
|
||||||
html[data-wb-edges=bevel] .bt-menu button:disabled { color: var(--bt-bv-sh); text-shadow: 1px 1px var(--bt-bv-hi); }
|
|
||||||
html[data-wb-edges=bevel] .bt-menu-keys { color: var(--bt-bv-text); }
|
|
||||||
html[data-wb-edges=bevel] .bt-menu hr { border-top: 1px solid var(--bt-bv-sh); border-bottom: 1px solid var(--bt-bv-hi); margin: 3px 2px; }
|
|
||||||
html[data-wb-edges=bevel] .bt-palette::before { display: none; }
|
|
||||||
html[data-wb-edges=bevel] .bt-palette-field { border-bottom: 0; box-shadow: inset 0 -1px var(--bt-bv-sh), inset 0 -2px var(--bt-bv-hi); }
|
|
||||||
html[data-wb-edges=bevel] .bt-palette-backdrop { background: transparent; }
|
|
||||||
html[data-wb-edges=bevel] .bt-kbd { background: var(--bt-bv-face); box-shadow: var(--bt-bv-out); color: var(--bt-bv-text); }
|
|
||||||
/* Text fields and steppers inside menus are sunken. */
|
|
||||||
html[data-wb-edges=bevel] .bt-menu :is(input[type=text], input:not([type]), .bt-app-zoom-step, .bt-deck-input) { border: 0; background: var(--bt-field); box-shadow: var(--bt-bv-in); }
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
|
||||||
* The settings panel: a dialog face, etched group boxes, raised buttons, sunken fields, a selected
|
|
||||||
* section in the title bar's color. */
|
|
||||||
.dv-groupview.wb-bevel .btp {
|
|
||||||
--c-ground: var(--bt-bv-face); --c-chrome: var(--bt-bv-face); --c-card: var(--bt-bv-face); --c-raise: var(--bt-bv-face); --c-popover: var(--bt-bv-face);
|
|
||||||
--c-text: var(--bt-bv-text); --c-line: var(--bt-bv-sh); --c-line-soft: var(--bt-bv-sh); --c-line-strong: var(--bt-bv-dk);
|
|
||||||
--c-accent: var(--bt-bv-select); --c-accent-ink: var(--bt-bv-select-text); --c-brush: var(--bt-bv-title);
|
|
||||||
letter-spacing: 0; -webkit-font-smoothing: auto;
|
|
||||||
}
|
|
||||||
.dv-groupview.wb-bevel .btp-head { background: var(--bt-bv-face); }
|
|
||||||
.dv-groupview.wb-bevel .btp-head::after { opacity: 1; height: 2px; background: none; box-shadow: inset 0 1px var(--bt-bv-sh), inset 0 -1px var(--bt-bv-hi); }
|
|
||||||
.dv-groupview.wb-bevel .btp-nav { border-bottom: 0; box-shadow: inset 0 -1px var(--bt-bv-sh), inset 0 -2px var(--bt-bv-hi); }
|
|
||||||
.dv-groupview.wb-bevel .btp-nav button { color: var(--bt-bv-text); }
|
|
||||||
.dv-groupview.wb-bevel .btp-nav button:hover { background: transparent; box-shadow: inset -1px -1px var(--bt-bv-sh), inset 1px 1px var(--bt-bv-hi); }
|
|
||||||
.dv-groupview.wb-bevel .btp-nav button.is-on { background: var(--bt-bv-select); color: var(--bt-bv-select-text); box-shadow: none; }
|
|
||||||
.dv-groupview.wb-bevel .btp-nav button.is-on svg { color: var(--bt-bv-select-text); }
|
|
||||||
.dv-groupview.wb-bevel .btp .bt-card { border: 0; box-shadow: var(--bt-bv-etched); padding: 2px; }
|
|
||||||
.dv-groupview.wb-bevel .btp :is(.bt-btn, .bt-select-button, .bt-stepper button, .bt-inputrow button) { border: 0; background: var(--bt-bv-face); color: var(--bt-bv-text); box-shadow: var(--bt-bv-out); }
|
|
||||||
.dv-groupview.wb-bevel .btp :is(.bt-btn, .bt-select-button, .bt-stepper button, .bt-inputrow button):hover:not(:disabled) { border: 0; background: var(--bt-bv-face); }
|
|
||||||
.dv-groupview.wb-bevel .btp :is(.bt-btn, .bt-stepper button, .bt-inputrow button):active:not(:disabled) { transform: none; box-shadow: var(--bt-bv-pressed); }
|
|
||||||
/* The default button carries the extra dark frame of a 98 dialog's default button. */
|
|
||||||
.dv-groupview.wb-bevel .btp .bt-btn.is-primary { box-shadow: inset 0 0 0 1px var(--bt-bv-dk), inset -2px -2px var(--bt-bv-dk), inset 2px 2px var(--bt-bv-hi), inset -3px -3px var(--bt-bv-sh), inset 3px 3px var(--bt-bv-lt); }
|
|
||||||
.dv-groupview.wb-bevel .btp .bt-btn.is-ghost { box-shadow: none; }
|
|
||||||
.dv-groupview.wb-bevel .btp .bt-btn.is-ghost:hover:not(:disabled) { box-shadow: var(--bt-bv-out); }
|
|
||||||
.dv-groupview.wb-bevel .btp .bt-btn:disabled { opacity: 1; color: var(--bt-bv-sh); text-shadow: 1px 1px var(--bt-bv-hi); }
|
|
||||||
.dv-groupview.wb-bevel .btp .bt-btn.is-danger { background: var(--bt-bv-face); color: var(--c-danger); }
|
|
||||||
.dv-groupview.wb-bevel .btp :is(.bt-input, .btp-input, .bt-inputrow, .bt-search, .bt-hex, .bt-code, .wb-builder-name) { border: 0; background: var(--wb-c-ground, #ffffff); box-shadow: var(--bt-bv-in); }
|
|
||||||
.dv-groupview.wb-bevel .btp :is(.bt-input, .btp-input, .bt-inputrow, .bt-search):is(:focus, :focus-within) { box-shadow: var(--bt-bv-in); }
|
|
||||||
.dv-groupview.wb-bevel .btp .bt-seg { border: 0; background: var(--bt-bv-face); box-shadow: var(--bt-bv-in); }
|
|
||||||
.dv-groupview.wb-bevel .btp .bt-seg-thumb { background: var(--bt-bv-face); box-shadow: var(--bt-bv-out); }
|
|
||||||
.dv-groupview.wb-bevel .btp .bt-toggle { box-shadow: var(--bt-bv-in); }
|
|
||||||
.dv-groupview.wb-bevel .btp .bt-toggle-knob { box-shadow: var(--bt-bv-out); background: var(--bt-bv-face); }
|
|
||||||
.dv-groupview.wb-bevel .btp :is(.bt-select-list, .bt-popover) { border: 0; background: var(--bt-bv-face); box-shadow: var(--bt-bv-window); }
|
|
||||||
.dv-groupview.wb-bevel .btp .bt-select-list li.is-active { background: var(--bt-bv-select); color: var(--bt-bv-select-text); }
|
|
||||||
|
|
||||||
/* Classic scrollbars: a dithered track, raised thumb and arrows. */
|
|
||||||
html[data-wb-edges=bevel] :is(.bt-shell, .bt-menu, .bt-palette, .btp) * { scrollbar-width: auto; scrollbar-color: auto; }
|
|
||||||
html[data-wb-edges=bevel] ::-webkit-scrollbar { width: 16px; height: 16px; }
|
|
||||||
html[data-wb-edges=bevel] ::-webkit-scrollbar-track { background: repeating-conic-gradient(var(--bt-bv-face) 0 25%, var(--bt-bv-hi) 0 50%) 0 0 / 2px 2px; }
|
|
||||||
html[data-wb-edges=bevel] ::-webkit-scrollbar-thumb { background: var(--bt-bv-face); box-shadow: var(--bt-bv-out); border-radius: 0; }
|
|
||||||
html[data-wb-edges=bevel] ::-webkit-scrollbar-button:single-button { display: block; width: 16px; height: 16px; background: var(--bt-bv-face); box-shadow: var(--bt-bv-out); }
|
|
||||||
html[data-wb-edges=bevel] ::-webkit-scrollbar-corner { background: var(--bt-bv-face); }
|
|
||||||
|
|
@ -12,20 +12,6 @@ export type TabInfo = { id: string; url: string };
|
||||||
|
|
||||||
export const CLIP_MAX_LIMIT = 100;
|
export const CLIP_MAX_LIMIT = 100;
|
||||||
|
|
||||||
/**
|
|
||||||
* The Media panel's key: Ctrl+Shift+G on Windows and Linux; Cmd+Shift+M on macOS, where Cmd+Shift+G
|
|
||||||
* is the system's Find Previous (the native Edit menu owns it).
|
|
||||||
*/
|
|
||||||
export function isMediaShortcut(event: { key: string; shiftKey: boolean; ctrlKey: boolean; metaKey: boolean; altKey: boolean }, os: string): boolean {
|
|
||||||
if (!event.shiftKey || event.altKey) return false;
|
|
||||||
const key = event.key.toLowerCase();
|
|
||||||
if (os === 'macos') return event.metaKey && !event.ctrlKey && key === 'm';
|
|
||||||
return (event.ctrlKey || event.metaKey) && key === 'g';
|
|
||||||
}
|
|
||||||
|
|
||||||
/** The Media panel's key as shown in hints and lists. */
|
|
||||||
export const mediaShortcutLabel = (os: string): string => (os === 'macos' ? 'Cmd+Shift+M' : 'Ctrl+Shift+G');
|
|
||||||
|
|
||||||
/** The tab an attachment goes to: the active tab if it can take one, else the most recent one that can. */
|
/** The tab an attachment goes to: the active tab if it can take one, else the most recent one that can. */
|
||||||
export function attachTarget(tabs: TabInfo[], activeId: string | undefined, canAttach: (url: string) => boolean, recent: string[] = []): TabInfo | null {
|
export function attachTarget(tabs: TabInfo[], activeId: string | undefined, canAttach: (url: string) => boolean, recent: string[] = []): TabInfo | null {
|
||||||
const active = tabs.find(tab => tab.id === activeId);
|
const active = tabs.find(tab => tab.id === activeId);
|
||||||
|
|
|
||||||
|
|
@ -50,47 +50,5 @@
|
||||||
"wb.menu.reportLede": "This is everything the report contains: versions and what is switched on. No account, no address, nothing from the pages you have open. Copy it, then paste it into your report.",
|
"wb.menu.reportLede": "This is everything the report contains: versions and what is switched on. No account, no address, nothing from the pages you have open. Copy it, then paste it into your report.",
|
||||||
"wb.menu.reportOpen": "Open the issue page",
|
"wb.menu.reportOpen": "Open the issue page",
|
||||||
"wb.menu.reportNoPage": "This app has no public issue page yet. Copy the text and send it to the developer.",
|
"wb.menu.reportNoPage": "This app has no public issue page yet. Copy the text and send it to the developer.",
|
||||||
"wb.menu.strings": "Languages",
|
"wb.menu.strings": "Languages"
|
||||||
"wb.menu.barFile": "File",
|
|
||||||
"wb.menu.barEdit": "Edit",
|
|
||||||
"wb.menu.barView": "View",
|
|
||||||
"wb.menu.barAccount": "Account",
|
|
||||||
"wb.menu.barPlugins": "Plugins",
|
|
||||||
"wb.menu.barWindow": "Window",
|
|
||||||
"wb.menu.barHelp": "Help",
|
|
||||||
"wb.menu.appHide": "Hide {product}",
|
|
||||||
"wb.menu.appHideOthers": "Hide Others",
|
|
||||||
"wb.menu.appShowAll": "Show All",
|
|
||||||
"wb.menu.appQuit": "Quit {product}",
|
|
||||||
"wb.menu.appServices": "Services",
|
|
||||||
"wb.menu.appUpdates": "Check for Updates…",
|
|
||||||
"wb.menu.appSettings": "Settings…",
|
|
||||||
"wb.menu.appSafe": "Safe Mode",
|
|
||||||
"wb.menu.fileClose": "Close Tab",
|
|
||||||
"wb.menu.fileInstall": "Install from File…",
|
|
||||||
"wb.menu.fileShare": "Share My Setup…",
|
|
||||||
"wb.menu.editUndo": "Undo",
|
|
||||||
"wb.menu.editRedo": "Redo",
|
|
||||||
"wb.menu.editCut": "Cut",
|
|
||||||
"wb.menu.editCopy": "Copy",
|
|
||||||
"wb.menu.editPaste": "Paste",
|
|
||||||
"wb.menu.editSelectAll": "Select All",
|
|
||||||
"wb.menu.editFind": "Find…",
|
|
||||||
"wb.menu.editFindNext": "Find Next",
|
|
||||||
"wb.menu.editFindPrevious": "Find Previous",
|
|
||||||
"wb.menu.viewZoomIn": "Zoom In",
|
|
||||||
"wb.menu.viewZoomOut": "Zoom Out",
|
|
||||||
"wb.menu.viewActual": "Actual Size",
|
|
||||||
"wb.menu.viewIconPack": "Icon Pack",
|
|
||||||
"wb.menu.viewDeck": "Deck",
|
|
||||||
"wb.menu.viewFullScreen": "Enter Full Screen",
|
|
||||||
"wb.menu.acctNone": "No accounts yet",
|
|
||||||
"wb.menu.acctAdd": "Add Account…",
|
|
||||||
"wb.menu.plugStore": "Store…",
|
|
||||||
"wb.menu.plugFolder": "Open Plugins Folder…",
|
|
||||||
"wb.menu.winMinimize": "Minimize",
|
|
||||||
"wb.menu.winZoom": "Zoom",
|
|
||||||
"wb.menu.winWorkspaces": "Workspaces",
|
|
||||||
"wb.menu.helpDocs": "Docs",
|
|
||||||
"wb.menu.helpReport": "Report a Problem…"
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import type { UpdateStatus } from '../updateModel.ts';
|
||||||
import EN from './menuMessages.en.json' with { type: 'json' };
|
import EN from './menuMessages.en.json' with { type: 'json' };
|
||||||
import { tx, type Params } from './i18n.ts';
|
import { tx, type Params } from './i18n.ts';
|
||||||
import type { IconName } from './icons.tsx';
|
import type { IconName } from './icons.tsx';
|
||||||
import type { Choice } from './nativeMenuModel.ts';
|
|
||||||
|
|
||||||
/** The menu's English (`wb.menu.*`), for the catalogs. */
|
/** The menu's English (`wb.menu.*`), for the catalogs. */
|
||||||
export const MENU_MESSAGES: Readonly<Record<string, string>> = EN;
|
export const MENU_MESSAGES: Readonly<Record<string, string>> = EN;
|
||||||
|
|
@ -116,25 +115,6 @@ export function resolveTrigger(trigger: AppMenuTrigger | boolean | undefined, co
|
||||||
return trigger ?? configured ?? 'pane';
|
return trigger ?? configured ?? 'pane';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* What an app adds to the native menu bar (macOS; nativeMenu.ts): lists the frame cannot know, and the
|
|
||||||
* actions only the app can run. Whatever is omitted leaves its item out of the bar.
|
|
||||||
*/
|
|
||||||
export type NativeMenuApp = {
|
|
||||||
/** The Plugins menu's checked rows (the app's plugin or area switches) and what flipping one does. */
|
|
||||||
plugins?: { list(): Choice[] | Promise<Choice[]>; set(id: string, on: boolean): Promise<void> | void; subscribe?(listener: () => void): () => void };
|
|
||||||
/** View > Icon Pack: the packs and picking one. */
|
|
||||||
iconPacks?: { list(): Choice[]; set(id: string): Promise<void> | void; subscribe?(listener: () => void): () => void };
|
|
||||||
/** File > Install from File…: asks for a file and stages it on the normal install screen. */
|
|
||||||
installFromFile?(): void;
|
|
||||||
/** File > Share My Setup…. */
|
|
||||||
shareSetup?(): void;
|
|
||||||
/** Help > Docs. */
|
|
||||||
docs?(): void;
|
|
||||||
/** Help > the project's site: the label shown (a host name) and the https address opened in the browser. */
|
|
||||||
website?: { label: string; url: string };
|
|
||||||
};
|
|
||||||
|
|
||||||
/** `ShellSite.menu`: the app menu's rows and what the built-in ones need from the app. */
|
/** `ShellSite.menu`: the app menu's rows and what the built-in ones need from the app. */
|
||||||
export type ShellMenu = {
|
export type ShellMenu = {
|
||||||
/**
|
/**
|
||||||
|
|
@ -160,8 +140,6 @@ export type ShellMenu = {
|
||||||
report?: { issueUrl?: string; details?(): ReportDetails | Promise<ReportDetails> };
|
report?: { issueUrl?: string; details?(): ReportDetails | Promise<ReportDetails> };
|
||||||
/** Opens the app's shortcuts sheet ("Keyboard shortcuts…"); without one the row opens the command palette. */
|
/** Opens the app's shortcuts sheet ("Keyboard shortcuts…"); without one the row opens the command palette. */
|
||||||
shortcuts?(): void;
|
shortcuts?(): void;
|
||||||
/** The native menu bar (macOS): the app's lists and actions. */
|
|
||||||
native?: NativeMenuApp;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** The menu an app gets without saying anything: every built-in row it can serve. */
|
/** The menu an app gets without saying anything: every built-in row it can serve. */
|
||||||
|
|
|
||||||
|
|
@ -1,166 +0,0 @@
|
||||||
// The native menu bar (macOS): the shell describes it (`menu_set`, shell-only) from the same state the
|
|
||||||
// in-app menu reads, and runs what the system menu chooses (`native-menu`, an id). Every item goes
|
|
||||||
// through what already exists (`shell.shortcut`, `shell.run`, `shell.openPanelSection`, the theme store,
|
|
||||||
// the profile list, the safe-mode switch, the workspaces); nothing here is a new capability and tabs
|
|
||||||
// gain no command. Elsewhere (Windows, Linux) the in-app menu stays and this does nothing.
|
|
||||||
//
|
|
||||||
// The bar is described again whenever what it shows changes (a theme or mode picked, an account added,
|
|
||||||
// a pane focused, safe mode, workspaces, a plugin switched); equal descriptions are not sent twice.
|
|
||||||
|
|
||||||
import { parseUpdateStatus } from '../updateModel.ts';
|
|
||||||
import { addAccount, accountName } from './AccountSwitcher.tsx';
|
|
||||||
import { invoke, listen } from './bridge.ts';
|
|
||||||
import { subscribeText, t } from './i18n.ts';
|
|
||||||
import { menuText, type MenuWord } from './menuModel.ts';
|
|
||||||
import { planNativeMenu, runNativeMenu, type Choice, type NativeMenuActions, type NativeMenuState } from './nativeMenuModel.ts';
|
|
||||||
import { safe, setSafeMode } from './safeStore.ts';
|
|
||||||
import { hasFeature, site } from './site.ts';
|
|
||||||
import { isWeb, shell } from './state.ts';
|
|
||||||
import { openAppMenu, openReport } from './AppMenu.tsx';
|
|
||||||
import { isTauri, os } from './windowBinding.ts';
|
|
||||||
import { openWorkspaceSave } from './TitlebarExtras.tsx';
|
|
||||||
import { restoreWorkspace, workspaceList, workspaces } from './workspaces.ts';
|
|
||||||
|
|
||||||
/** Events (window) after which something the bar shows may have changed. */
|
|
||||||
const EVENTS = ['bt-zoom', 'bt-workspaces', 'bt-decks', 'bt-site', 'bt-safe', 'bt-profiles', 'bt-active-pane', 'bt-plugins-changed', 'bt-store-changed', 'wb-features-changed'];
|
|
||||||
|
|
||||||
const w = (name: string, params?: Record<string, string | number>) => menuText(name as MenuWord, params);
|
|
||||||
|
|
||||||
/** The state the bar shows now. Async parts (the mode in use, the app's plugin list) are awaited here. */
|
|
||||||
async function readState(): Promise<NativeMenuState> {
|
|
||||||
const config = site();
|
|
||||||
const menu = config.menu ?? {};
|
|
||||||
const native = menu.native ?? {};
|
|
||||||
const active = shell.api?.activePanel;
|
|
||||||
const themeState = config.themes?.current();
|
|
||||||
const themeId = config.themes && themeState ? config.themes.adapter.preset(themeState.choice) : '';
|
|
||||||
const themes: Choice[] | undefined = config.themes && themeState
|
|
||||||
? config.themes.allThemes(themeState.choice).map(theme => ({ id: theme.id, label: theme.name, checked: theme.id === themeId }))
|
|
||||||
: undefined;
|
|
||||||
let modes: Choice[] | undefined;
|
|
||||||
if (menu.modes) {
|
|
||||||
const current = await menu.modes.current().catch(() => null);
|
|
||||||
modes = menu.modes.list().map(entry => ({ id: entry.id, label: entry.label, checked: entry.id === current }));
|
|
||||||
}
|
|
||||||
const plugins = native.plugins ? await Promise.resolve(native.plugins.list()).catch(() => undefined) : undefined;
|
|
||||||
const list = workspaceList();
|
|
||||||
return {
|
|
||||||
product: config.product,
|
|
||||||
hasPanel: !!active,
|
|
||||||
canSplit: !!active && (isWeb(active) || active.group.panels.length > 1),
|
|
||||||
canFind: (shell.api?.panels ?? []).some(panel => isWeb(panel) && panel.api.isVisible),
|
|
||||||
safeActive: safe.active,
|
|
||||||
features: {
|
|
||||||
find: hasFeature('find'), zoom: hasFeature('zoom'), deck: !!config.deck, store: hasFeature('store'),
|
|
||||||
safeMode: hasFeature('safeMode'), workspaces: hasFeature('workspaces'), updates: hasFeature('updates'),
|
|
||||||
},
|
|
||||||
themes,
|
|
||||||
iconPacks: native.iconPacks?.list(),
|
|
||||||
modes,
|
|
||||||
accounts: shell.profiles.profiles.map(profile => ({ id: profile.id, label: accountName(profile), checked: profile.id === shell.profiles.active })),
|
|
||||||
plugins,
|
|
||||||
workspaces: hasFeature('workspaces') ? list.map(entry => ({ id: entry.id, label: entry.name, checked: entry.id === workspaces.active })) : undefined,
|
|
||||||
installFromFile: !!native.installFromFile,
|
|
||||||
shareSetup: !!native.shareSetup,
|
|
||||||
docs: !!native.docs,
|
|
||||||
website: native.website?.label,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function actions(): NativeMenuActions {
|
|
||||||
const menu = site().menu ?? {};
|
|
||||||
const native = menu.native ?? {};
|
|
||||||
const config = site();
|
|
||||||
return {
|
|
||||||
about: () => shell.openPanelSection('home'),
|
|
||||||
// A real check, then the panel's Updates section says what came of it.
|
|
||||||
checkUpdates: () => { void invoke('update_check').then(parseUpdateStatus).catch(() => {}); shell.openPanelSection('updates'); },
|
|
||||||
settings: () => shell.openPanelSection('settings'),
|
|
||||||
// Turning it on restarts every tab, so the in-app question (what it does, Cancel) asks first; turning it off is one step.
|
|
||||||
safeMode: () => { if (safe.active) void setSafeMode(false); else openAppMenu({ submenu: 'safe-mode', keyboard: true }); },
|
|
||||||
newTab: () => shell.shortcut('new-tab'),
|
|
||||||
splitRight: () => shell.shortcut('split-right'),
|
|
||||||
splitDown: () => shell.shortcut('split-down'),
|
|
||||||
closeTab: () => shell.shortcut('close-tab'),
|
|
||||||
installFromFile: () => native.installFromFile?.(),
|
|
||||||
shareSetup: () => native.shareSetup?.(),
|
|
||||||
find: () => shell.shortcut('find'),
|
|
||||||
findNext: () => shell.shortcut('find-next'),
|
|
||||||
findPrevious: () => shell.shortcut('find-previous'),
|
|
||||||
zoomIn: () => shell.shortcut('zoom-in'),
|
|
||||||
zoomOut: () => shell.shortcut('zoom-out'),
|
|
||||||
zoomReset: () => shell.shortcut('zoom-reset'),
|
|
||||||
deck: () => shell.shortcut('deck-toggle'),
|
|
||||||
// As Appearance does: a theme starts without the customizations made on another one.
|
|
||||||
theme: id => { const themes = config.themes; const choice = themes?.current().choice; if (themes && choice) void themes.setChoice(themes.adapter.choiceForId(choice, id)); },
|
|
||||||
iconPack: id => { void native.iconPacks?.set(id); },
|
|
||||||
// Switching asks about the owner's own changes first when there are any: that question is the in-app menu's.
|
|
||||||
mode: id => {
|
|
||||||
const modes = menu.modes;
|
|
||||||
if (!modes) return;
|
|
||||||
void modes.changes(id).then(changes => { if (changes > 0) openAppMenu({ submenu: 'mode', keyboard: true }); else return modes.apply(id, false); }).catch(() => {});
|
|
||||||
},
|
|
||||||
account: id => shell.openAccount(id),
|
|
||||||
addAccount: () => { void addAccount(shell.profiles).catch(() => {}); },
|
|
||||||
plugin: (id, on) => { void native.plugins?.set(id, on); },
|
|
||||||
store: () => shell.openPanelSection('store'),
|
|
||||||
pluginsFolder: () => { void invoke('plugins_open_folder').catch(() => {}); },
|
|
||||||
workspace: id => { void restoreWorkspace(id); },
|
|
||||||
saveWorkspace: () => openWorkspaceSave(),
|
|
||||||
docs: () => native.docs?.(),
|
|
||||||
report: () => openReport(),
|
|
||||||
website: () => { const url = native.website?.url; if (url) void invoke('open_external_url', { url }).catch(() => {}); },
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Starts the bar (once, after the shell is mounted). Returns a function that stops it.
|
|
||||||
* No-op where the system menu bar is not the app's (anything but macOS).
|
|
||||||
*/
|
|
||||||
export function startNativeMenu(): () => void {
|
|
||||||
if (os !== 'macos' || !isTauri) return () => {};
|
|
||||||
let last = '';
|
|
||||||
let latest: NativeMenuState | null = null;
|
|
||||||
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
||||||
let stopped = false;
|
|
||||||
|
|
||||||
const send = async () => {
|
|
||||||
try {
|
|
||||||
const state = await readState();
|
|
||||||
if (stopped) return;
|
|
||||||
latest = state;
|
|
||||||
const spec = planNativeMenu(state, w, key => t(key));
|
|
||||||
const text = JSON.stringify(spec);
|
|
||||||
if (text === last) return;
|
|
||||||
last = text;
|
|
||||||
await invoke('menu_set', { spec });
|
|
||||||
} catch (error) {
|
|
||||||
last = '';
|
|
||||||
console.error('[shell] menu_set', error);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const soon = () => { clearTimeout(timer); timer = setTimeout(() => void send(), 120); };
|
|
||||||
|
|
||||||
for (const event of EVENTS) window.addEventListener(event, soon);
|
|
||||||
const config = site();
|
|
||||||
const offs = [
|
|
||||||
config.themes?.subscribe(soon), config.menu?.languages?.subscribe(soon), subscribeText(soon),
|
|
||||||
config.menu?.native?.plugins?.subscribe?.(soon), config.menu?.native?.iconPacks?.subscribe?.(soon),
|
|
||||||
];
|
|
||||||
let unlisten: (() => void) | undefined;
|
|
||||||
void listen<string>('native-menu', event => {
|
|
||||||
if (typeof event.payload !== 'string' || !latest) return;
|
|
||||||
// Focus goes back to the shell first: a choice made in the system menu is the shell's action.
|
|
||||||
runNativeMenu(event.payload, latest, actions());
|
|
||||||
soon();
|
|
||||||
}).then(off => { if (stopped) off(); else unlisten = off; }).catch(() => {});
|
|
||||||
soon();
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
stopped = true;
|
|
||||||
clearTimeout(timer);
|
|
||||||
for (const event of EVENTS) window.removeEventListener(event, soon);
|
|
||||||
for (const off of offs) off?.();
|
|
||||||
unlisten?.();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,205 +0,0 @@
|
||||||
// Pure model of the native menu bar (macOS): what the shell describes to native code (`menu_set`,
|
|
||||||
// waybetter-host menu.rs) and which action each chosen id runs. No React, no Tauri: it is tested
|
|
||||||
// under node. Every item runs what the in-app menu, the palette or the keys already run; the bar
|
|
||||||
// adds no capability. Words are `wb.menu.*` (menuMessages.en.json) and the frame's own catalog keys.
|
|
||||||
|
|
||||||
/** One entry of a list the bar shows with a check (themes, modes, accounts, plugins, workspaces). */
|
|
||||||
export type Choice = { id: string; label: string; checked: boolean };
|
|
||||||
|
|
||||||
/** What the bar reflects right now. Absent lists leave their submenu out. */
|
|
||||||
export type NativeMenuState = {
|
|
||||||
product: string;
|
|
||||||
hasPanel: boolean;
|
|
||||||
canSplit: boolean;
|
|
||||||
canFind: boolean;
|
|
||||||
safeActive: boolean;
|
|
||||||
features: { find: boolean; zoom: boolean; deck: boolean; store: boolean; safeMode: boolean; workspaces: boolean; updates: boolean };
|
|
||||||
themes?: Choice[];
|
|
||||||
iconPacks?: Choice[];
|
|
||||||
modes?: Choice[];
|
|
||||||
accounts: Choice[];
|
|
||||||
plugins?: Choice[];
|
|
||||||
workspaces?: Choice[];
|
|
||||||
/** The app can install a file chosen from a dialog, share the setup, has docs and a website. */
|
|
||||||
installFromFile: boolean;
|
|
||||||
shareSetup: boolean;
|
|
||||||
docs: boolean;
|
|
||||||
website?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** What a chosen id does. The controller (nativeMenu.ts) wires these to the shell. */
|
|
||||||
export type NativeMenuActions = {
|
|
||||||
about(): void;
|
|
||||||
checkUpdates(): void;
|
|
||||||
settings(): void;
|
|
||||||
safeMode(): void;
|
|
||||||
newTab(): void;
|
|
||||||
splitRight(): void;
|
|
||||||
splitDown(): void;
|
|
||||||
closeTab(): void;
|
|
||||||
installFromFile(): void;
|
|
||||||
shareSetup(): void;
|
|
||||||
find(): void;
|
|
||||||
findNext(): void;
|
|
||||||
findPrevious(): void;
|
|
||||||
zoomIn(): void;
|
|
||||||
zoomOut(): void;
|
|
||||||
zoomReset(): void;
|
|
||||||
deck(): void;
|
|
||||||
theme(id: string): void;
|
|
||||||
iconPack(id: string): void;
|
|
||||||
mode(id: string): void;
|
|
||||||
account(id: string): void;
|
|
||||||
addAccount(): void;
|
|
||||||
plugin(id: string, on: boolean): void;
|
|
||||||
store(): void;
|
|
||||||
pluginsFolder(): void;
|
|
||||||
workspace(id: string): void;
|
|
||||||
saveWorkspace(): void;
|
|
||||||
docs(): void;
|
|
||||||
report(): void;
|
|
||||||
website(): void;
|
|
||||||
};
|
|
||||||
|
|
||||||
type Words = (name: string, params?: Record<string, string | number>) => string;
|
|
||||||
|
|
||||||
type Node =
|
|
||||||
| { kind: 'item'; id: string; label: string; accelerator?: string; checked?: boolean; enabled?: boolean }
|
|
||||||
| { kind: 'separator' }
|
|
||||||
| { kind: 'submenu'; label: string; items: Node[]; enabled?: boolean; role?: 'window' | 'help' }
|
|
||||||
| { kind: 'predefined'; role: string; label?: string };
|
|
||||||
|
|
||||||
/** The description `menu_set` takes. */
|
|
||||||
export type NativeMenuSpec = { menus: Node[] };
|
|
||||||
|
|
||||||
/** One line, at most 120 characters (what menu.rs accepts), never empty. */
|
|
||||||
const clean = (label: string, fallback = '-') => label.replace(/[\u0000-\u001f\u007f-\u009f]+/g, ' ').trim().slice(0, 120) || fallback;
|
|
||||||
/** Ids carry only their alphabet (menu.rs `valid_id`); an app's ids are folded into it. */
|
|
||||||
export const safeId = (id: string) => id.replace(/[^A-Za-z0-9_.-]/g, '_').slice(0, 60);
|
|
||||||
|
|
||||||
const item = (id: string, label: string, rest: { accelerator?: string; checked?: boolean; enabled?: boolean } = {}): Node => ({ kind: 'item', id, label: clean(label), ...rest });
|
|
||||||
const system = (role: string, label?: string): Node => ({ kind: 'predefined', role, ...(label ? { label: clean(label) } : {}) });
|
|
||||||
const sep: Node = { kind: 'separator' };
|
|
||||||
const submenu = (label: string, items: Node[], rest: { enabled?: boolean; role?: 'window' | 'help' } = {}): Node => ({ kind: 'submenu', label: clean(label), items, ...rest });
|
|
||||||
const choices = (prefix: string, list: readonly Choice[]): Node[] => list.map(choice => item(`${prefix}:${safeId(choice.id)}`, choice.label, { checked: choice.checked }));
|
|
||||||
|
|
||||||
/** Separates non-empty groups with rules. */
|
|
||||||
const groups = (...parts: Node[][]): Node[] => parts.filter(part => part.length).flatMap((part, index) => (index ? [sep, ...part] : part));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The whole bar: App, File, Edit, View, Account, Plugins, Window, Help. `w` reads a `wb.menu.*` word,
|
|
||||||
* `text` a catalog key of the frame (the labels the in-app menu already uses).
|
|
||||||
*/
|
|
||||||
export function planNativeMenu(state: NativeMenuState, w: Words, text: (key: string) => string): NativeMenuSpec {
|
|
||||||
const { product, features } = state;
|
|
||||||
const app = submenu(product, groups(
|
|
||||||
[item('app.about', w('about', { product }))],
|
|
||||||
[
|
|
||||||
...(features.updates ? [item('app.updates', w('appUpdates'))] : []),
|
|
||||||
item('app.settings', w('appSettings'), { accelerator: 'CmdOrCtrl+,' }),
|
|
||||||
...(features.safeMode ? [item('app.safe', w('appSafe'), { checked: state.safeActive })] : []),
|
|
||||||
],
|
|
||||||
[system('services', w('appServices'))],
|
|
||||||
[system('hide', w('appHide', { product })), system('hide_others', w('appHideOthers')), system('show_all', w('appShowAll'))],
|
|
||||||
[system('quit', w('appQuit', { product }))],
|
|
||||||
));
|
|
||||||
const file = submenu(w('barFile'), groups(
|
|
||||||
[item('file.new-tab', text('wb.shell.tab.new'), { accelerator: 'CmdOrCtrl+T' })],
|
|
||||||
[
|
|
||||||
item('file.split-right', text('wb.shell.menu.splitRight'), { accelerator: 'CmdOrCtrl+\\', enabled: state.canSplit }),
|
|
||||||
item('file.split-down', text('wb.shell.menu.splitDown'), { accelerator: 'CmdOrCtrl+Shift+\\', enabled: state.canSplit }),
|
|
||||||
],
|
|
||||||
[item('file.close', w('fileClose'), { accelerator: 'CmdOrCtrl+W', enabled: state.hasPanel })],
|
|
||||||
[...(state.installFromFile ? [item('file.install', w('fileInstall'))] : []), ...(state.shareSetup ? [item('file.share', w('fileShare'))] : [])],
|
|
||||||
));
|
|
||||||
const edit = submenu(w('barEdit'), groups(
|
|
||||||
[system('undo', w('editUndo')), system('redo', w('editRedo'))],
|
|
||||||
[system('cut', w('editCut')), system('copy', w('editCopy')), system('paste', w('editPaste')), system('select_all', w('editSelectAll'))],
|
|
||||||
features.find ? [
|
|
||||||
item('edit.find', w('editFind'), { accelerator: 'CmdOrCtrl+F', enabled: state.canFind }),
|
|
||||||
item('edit.find-next', w('editFindNext'), { accelerator: 'CmdOrCtrl+G', enabled: state.canFind }),
|
|
||||||
item('edit.find-previous', w('editFindPrevious'), { accelerator: 'CmdOrCtrl+Shift+G', enabled: state.canFind }),
|
|
||||||
] : [],
|
|
||||||
));
|
|
||||||
const view = submenu(w('barView'), groups(
|
|
||||||
features.zoom ? [
|
|
||||||
item('view.zoom-in', w('viewZoomIn'), { accelerator: 'CmdOrCtrl+=' }),
|
|
||||||
item('view.zoom-out', w('viewZoomOut'), { accelerator: 'CmdOrCtrl+-' }),
|
|
||||||
item('view.zoom-reset', w('viewActual'), { accelerator: 'CmdOrCtrl+0' }),
|
|
||||||
] : [],
|
|
||||||
[
|
|
||||||
...(state.themes?.length ? [submenu(w('theme'), choices('theme', state.themes))] : []),
|
|
||||||
...(state.iconPacks?.length ? [submenu(w('viewIconPack'), choices('icons', state.iconPacks))] : []),
|
|
||||||
...(state.modes?.length ? [submenu(text('wb.modes.section'), choices('mode', state.modes))] : []),
|
|
||||||
],
|
|
||||||
features.deck ? [item('view.deck', w('viewDeck'), { accelerator: 'CmdOrCtrl+Shift+D' })] : [],
|
|
||||||
[system('fullscreen', w('viewFullScreen'))],
|
|
||||||
));
|
|
||||||
const account = submenu(w('barAccount'), groups(
|
|
||||||
state.accounts.length ? choices('acct', state.accounts) : [item('acct.none', w('acctNone'), { enabled: false })],
|
|
||||||
[item('acct.add', w('acctAdd'))],
|
|
||||||
));
|
|
||||||
const plugins = submenu(w('barPlugins'), groups(
|
|
||||||
state.plugins?.length ? choices('plugin', state.plugins) : [],
|
|
||||||
[...(features.store ? [item('plugins.store', w('plugStore'))] : []), item('plugins.folder', w('plugFolder'))],
|
|
||||||
));
|
|
||||||
const window = submenu(w('barWindow'), groups(
|
|
||||||
[system('minimize', w('winMinimize')), system('maximize', w('winZoom'))],
|
|
||||||
features.workspaces ? [submenu(w('winWorkspaces'), groups(
|
|
||||||
state.workspaces?.length ? choices('ws', state.workspaces) : [item('ws.none', w('noWorkspaces'), { enabled: false })],
|
|
||||||
[item('ws.save', w('saveLayout'))],
|
|
||||||
))] : [],
|
|
||||||
), { role: 'window' });
|
|
||||||
const help = submenu(w('barHelp'), groups(
|
|
||||||
state.docs ? [item('help.docs', w('helpDocs'))] : [],
|
|
||||||
[item('help.report', w('helpReport'))],
|
|
||||||
state.website ? [item('help.website', state.website)] : [],
|
|
||||||
), { role: 'help' });
|
|
||||||
return { menus: [app, file, edit, view, account, plugins, window, help] };
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Runs what `id` (an id of [`planNativeMenu`]) stands for; false for an id it does not know. */
|
|
||||||
export function runNativeMenu(id: string, state: NativeMenuState, act: NativeMenuActions): boolean {
|
|
||||||
const colon = id.indexOf(':');
|
|
||||||
if (colon > 0) {
|
|
||||||
const prefix = id.slice(0, colon);
|
|
||||||
const rest = id.slice(colon + 1);
|
|
||||||
const find = (list?: readonly Choice[]) => list?.find(choice => safeId(choice.id) === rest);
|
|
||||||
switch (prefix) {
|
|
||||||
case 'theme': { const choice = find(state.themes); if (choice) { act.theme(choice.id); return true; } return false; }
|
|
||||||
case 'icons': { const choice = find(state.iconPacks); if (choice) { act.iconPack(choice.id); return true; } return false; }
|
|
||||||
case 'mode': { const choice = find(state.modes); if (choice) { act.mode(choice.id); return true; } return false; }
|
|
||||||
case 'acct': { const choice = find(state.accounts); if (choice) { act.account(choice.id); return true; } return false; }
|
|
||||||
case 'plugin': { const choice = find(state.plugins); if (choice) { act.plugin(choice.id, !choice.checked); return true; } return false; }
|
|
||||||
case 'ws': { const choice = find(state.workspaces); if (choice) { act.workspace(choice.id); return true; } return false; }
|
|
||||||
default: return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch (id) {
|
|
||||||
case 'app.about': act.about(); return true;
|
|
||||||
case 'app.updates': act.checkUpdates(); return true;
|
|
||||||
case 'app.settings': act.settings(); return true;
|
|
||||||
case 'app.safe': act.safeMode(); return true;
|
|
||||||
case 'file.new-tab': act.newTab(); return true;
|
|
||||||
case 'file.split-right': act.splitRight(); return true;
|
|
||||||
case 'file.split-down': act.splitDown(); return true;
|
|
||||||
case 'file.close': act.closeTab(); return true;
|
|
||||||
case 'file.install': act.installFromFile(); return true;
|
|
||||||
case 'file.share': act.shareSetup(); return true;
|
|
||||||
case 'edit.find': act.find(); return true;
|
|
||||||
case 'edit.find-next': act.findNext(); return true;
|
|
||||||
case 'edit.find-previous': act.findPrevious(); return true;
|
|
||||||
case 'view.zoom-in': act.zoomIn(); return true;
|
|
||||||
case 'view.zoom-out': act.zoomOut(); return true;
|
|
||||||
case 'view.zoom-reset': act.zoomReset(); return true;
|
|
||||||
case 'view.deck': act.deck(); return true;
|
|
||||||
case 'acct.add': act.addAccount(); return true;
|
|
||||||
case 'plugins.store': act.store(); return true;
|
|
||||||
case 'plugins.folder': act.pluginsFolder(); return true;
|
|
||||||
case 'ws.save': act.saveWorkspace(); return true;
|
|
||||||
case 'help.docs': act.docs(); return true;
|
|
||||||
case 'help.report': act.report(); return true;
|
|
||||||
case 'help.website': act.website(); return true;
|
|
||||||
default: return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -4,10 +4,8 @@
|
||||||
// pages and completions (`site.palette`). Nothing here performs an account action on the user's behalf.
|
// pages and completions (`site.palette`). Nothing here performs an account action on the user's behalf.
|
||||||
|
|
||||||
import { rankItems } from '../palette.ts';
|
import { rankItems } from '../palette.ts';
|
||||||
import { os } from '../windowControls.ts';
|
|
||||||
import { t } from './i18n.ts';
|
import { t } from './i18n.ts';
|
||||||
import type { IconName } from './icons.tsx';
|
import type { IconName } from './icons.tsx';
|
||||||
import { mediaShortcutLabel } from './mediaModel.ts';
|
|
||||||
import { menuText } from './menuModel.ts';
|
import { menuText } from './menuModel.ts';
|
||||||
import type { PaletteSite } from './site.ts';
|
import type { PaletteSite } from './site.ts';
|
||||||
|
|
||||||
|
|
@ -149,7 +147,7 @@ export function buildItems(context: PaletteContext, query: string, setup: Palett
|
||||||
for (const section of site.sections) {
|
for (const section of site.sections) {
|
||||||
items.push({ id: `panel:${section.id}`, group: setup.product, label: section.label(), keywords: section.keywords, icon: section.icon, action: { type: 'panel', section: section.id } });
|
items.push({ id: `panel:${section.id}`, group: setup.product, label: section.label(), keywords: section.keywords, icon: section.icon, action: { type: 'panel', section: section.id } });
|
||||||
}
|
}
|
||||||
if (setup.media) items.push({ id: 'media', group: setup.product, label: t('wb.palette.media'), hint: mediaShortcutLabel(os), keywords: 'photos images screenshots attach paste media', icon: 'image', action: { type: 'media' } });
|
if (setup.media) items.push({ id: 'media', group: setup.product, label: t('wb.palette.media'), hint: 'Ctrl+Shift+G', keywords: 'photos images screenshots attach paste media', icon: 'image', action: { type: 'media' } });
|
||||||
// Find in the page of the tab in front (the shell's find bar; nothing is sent anywhere).
|
// Find in the page of the tab in front (the shell's find bar; nothing is sent anywhere).
|
||||||
if (setup.find !== false) items.push({ id: 'find', group: setup.product, label: menuText('find'), hint: 'Ctrl+F', keywords: 'find search page text match', icon: 'search', action: { type: 'find' } });
|
if (setup.find !== false) items.push({ id: 'find', group: setup.product, label: menuText('find'), hint: 'Ctrl+F', keywords: 'find search page text match', icon: 'search', action: { type: 'find' } });
|
||||||
// The app menu (the titlebar's "Settings and more"): language, theme, mode, zoom and the rest.
|
// The app menu (the titlebar's "Settings and more"): language, theme, mode, zoom and the rest.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/* Theme swatches (page, text, accent) and the "Theme for this pane" menu. */
|
/* Theme swatches (page, text, accent) and the "Theme for this pane" menu. */
|
||||||
.wb-dots { display: inline-flex; align-items: center; gap: 3px; flex: none; height: 18px; padding: 0 5px; border-radius: calc(6px * var(--bt-rs, 1)); box-shadow: inset 0 0 0 1px rgb(127 127 127 / .28); }
|
.wb-dots { display: inline-flex; align-items: center; gap: 3px; flex: none; height: 18px; padding: 0 5px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgb(127 127 127 / .28); }
|
||||||
.wb-dots i { width: 7px; height: 7px; border-radius: 50%; }
|
.wb-dots i { width: 7px; height: 7px; border-radius: 50%; }
|
||||||
.wb-pane-menu { width: 272px; }
|
.wb-pane-menu { width: 272px; }
|
||||||
.wb-pane-menu-head { display: flex; align-items: center; gap: 8px; padding: 7px 10px 6px; color: var(--bt-muted); font: 600 11px/1 var(--bt-ui); letter-spacing: .04em; text-transform: uppercase; }
|
.wb-pane-menu-head { display: flex; align-items: center; gap: 8px; padding: 7px 10px 6px; color: var(--bt-muted); font: 600 11px/1 var(--bt-ui); letter-spacing: .04em; text-transform: uppercase; }
|
||||||
|
|
|
||||||
|
|
@ -12,27 +12,22 @@
|
||||||
:root, .wb-pane-theme {
|
:root, .wb-pane-theme {
|
||||||
--bt-ground: var(--wb-c-ground, #07080c); --bt-chrome: var(--wb-c-chrome, #0d1017); --bt-field: var(--wb-c-field, #11141c); --bt-raised: var(--wb-c-raised, #141823); --bt-raised-2: var(--wb-c-raised-2, #191e2b);
|
--bt-ground: var(--wb-c-ground, #07080c); --bt-chrome: var(--wb-c-chrome, #0d1017); --bt-field: var(--wb-c-field, #11141c); --bt-raised: var(--wb-c-raised, #141823); --bt-raised-2: var(--wb-c-raised-2, #191e2b);
|
||||||
--bt-line: var(--wb-c-line, #1e2333); --bt-line-soft: var(--wb-c-line-soft, #161a26); --bt-line-strong: var(--wb-c-line-strong, #2a3044);
|
--bt-line: var(--wb-c-line, #1e2333); --bt-line-soft: var(--wb-c-line-soft, #161a26); --bt-line-strong: var(--wb-c-line-strong, #2a3044);
|
||||||
--bt-text: var(--wb-c-text, #eef0f7); --bt-text-2: var(--wb-c-text-2, #c3c7d4); --bt-muted: var(--wb-c-muted, #8a90a6); --bt-faint: var(--wb-c-faint, #8a90a6);
|
--bt-text: var(--wb-c-text, #eef0f7); --bt-text-2: var(--wb-c-text-2, #c3c7d4); --bt-muted: var(--wb-c-muted, #8a90a6); --bt-faint: var(--wb-c-faint, #5d6379);
|
||||||
/* Space-separated channels for translucent tints: rgb(var(--bt-text-rgb) / .06). */
|
/* Space-separated channels for translucent tints: rgb(var(--bt-text-rgb) / .06). */
|
||||||
--bt-text-rgb: var(--wb-c-text-rgb, 238 240 247); --bt-accent-rgb: var(--wb-c-accent-rgb, 29 155 240);
|
--bt-text-rgb: var(--wb-c-text-rgb, 238 240 247); --bt-accent-rgb: var(--wb-c-accent-rgb, 29 155 240);
|
||||||
--bt-warn: var(--wb-c-warn, #f0b14a); --bt-danger-ink: var(--wb-c-danger-ink, #ff8a80);
|
|
||||||
--bt-accent: var(--wb-c-accent, #1d9bf0); --bt-accent-ink: var(--wb-c-accent-ink, #cfe6ff); --bt-accent-soft: rgb(var(--bt-accent-rgb) / .14);
|
--bt-accent: var(--wb-c-accent, #1d9bf0); --bt-accent-ink: var(--wb-c-accent-ink, #cfe6ff); --bt-accent-soft: rgb(var(--bt-accent-rgb) / .14);
|
||||||
--bt-hover: rgb(var(--bt-text-rgb) / .055); --bt-press: rgb(var(--bt-text-rgb) / .09);
|
--bt-hover: rgb(var(--bt-text-rgb) / .055); --bt-press: rgb(var(--bt-text-rgb) / .09);
|
||||||
--bt-ring: 0 0 0 1px rgb(var(--bt-accent-rgb) / .55), 0 0 0 4px rgb(var(--bt-accent-rgb) / .16);
|
--bt-ring: 0 0 0 1px rgb(var(--bt-accent-rgb) / .55), 0 0 0 4px rgb(var(--bt-accent-rgb) / .16);
|
||||||
--bt-shadow-pop: var(--wb-c-shadow-pop, 0 18px 44px -14px rgba(0, 0, 0, .75), 0 3px 10px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .035));
|
--bt-shadow-pop: var(--wb-c-shadow-pop, 0 18px 44px -14px rgba(0, 0, 0, .75), 0 3px 10px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .035));
|
||||||
--bt-ui: var(--wb-f-chrome, 'Geist Variable', system-ui, sans-serif); --bt-mono: var(--wb-f-mono, 'Geist Mono Variable', ui-monospace, monospace);
|
--bt-ui: var(--wb-f-chrome, 'Geist Variable', system-ui, sans-serif); --bt-mono: var(--wb-f-mono, 'Geist Mono Variable', ui-monospace, monospace);
|
||||||
/* Radii scale with the theme's corners (chromeVars: --wb-c-rs, the theme radius / 12): every px
|
|
||||||
radius in the chrome is calc(<px> * var(--bt-rs, 1)), so a square theme gets a square window. */
|
|
||||||
--bt-rs: var(--wb-c-rs, 1);
|
|
||||||
/* The active tab's mark and the palette's edge: wayBetter's brush, or the theme's own accent. */
|
|
||||||
--bt-brush: var(--wb-c-brush, linear-gradient(90deg, #4f6bff, #22d3ee 55%, #a855f7));
|
|
||||||
--bt-r1: calc(6px * var(--bt-rs)); --bt-r2: calc(8px * var(--bt-rs)); --bt-r3: calc(10px * var(--bt-rs)); --bt-r4: calc(12px * var(--bt-rs)); --bt-r5: calc(14px * var(--bt-rs));
|
|
||||||
color-scheme: var(--wb-c-scheme, dark);
|
color-scheme: var(--wb-c-scheme, dark);
|
||||||
}
|
}
|
||||||
.wb-pane-theme { --bt-bg: var(--bt-ground); --bt-surface: var(--bt-chrome); --bt-surface-2: var(--bt-field); }
|
.wb-pane-theme { --bt-bg: var(--bt-ground); --bt-surface: var(--bt-chrome); --bt-surface-2: var(--bt-field); }
|
||||||
:root {
|
:root {
|
||||||
--bt-danger: #e5484d;
|
--bt-danger: #e5484d;
|
||||||
|
--bt-brush: linear-gradient(90deg, #4f6bff, #22d3ee 55%, #a855f7);
|
||||||
--bt-s1: 4px; --bt-s2: 8px; --bt-s3: 12px; --bt-s4: 16px; --bt-s5: 24px; --bt-s6: 32px;
|
--bt-s1: 4px; --bt-s2: 8px; --bt-s3: 12px; --bt-s4: 16px; --bt-s5: 24px; --bt-s6: 32px;
|
||||||
|
--bt-r1: 6px; --bt-r2: 8px; --bt-r3: 10px; --bt-r4: 12px; --bt-r5: 14px;
|
||||||
--bt-ease: cubic-bezier(.2, .7, .2, 1); --bt-ease-out: cubic-bezier(.16, 1, .3, 1);
|
--bt-ease: cubic-bezier(.2, .7, .2, 1); --bt-ease-out: cubic-bezier(.16, 1, .3, 1);
|
||||||
--bt-t1: 120ms; --bt-t2: 180ms; --bt-t3: 320ms;
|
--bt-t1: 120ms; --bt-t2: 180ms; --bt-t3: 320ms;
|
||||||
--bt-titlebar-h: 44px; --bt-toolbar-h: 48px; --bt-resize-border: 5px;
|
--bt-titlebar-h: 44px; --bt-toolbar-h: 48px; --bt-resize-border: 5px;
|
||||||
|
|
@ -62,13 +57,13 @@ html, body, #root { height: 100%; margin: 0; overflow: hidden; background: var(-
|
||||||
:where(.bt-shell, .bt-menu, .bt-palette, .bt-media) :focus-visible { outline: 2px solid rgb(var(--bt-accent-rgb) / .8); outline-offset: 1px; }
|
:where(.bt-shell, .bt-menu, .bt-palette, .bt-media) :focus-visible { outline: 2px solid rgb(var(--bt-accent-rgb) / .8); outline-offset: 1px; }
|
||||||
:where(.bt-palette-list, .bt-profile-menu, .bt-start, .bt-media-body, .dv-tabs-overflow-container) { scrollbar-width: thin; scrollbar-color: var(--bt-line-strong) transparent; }
|
:where(.bt-palette-list, .bt-profile-menu, .bt-start, .bt-media-body, .dv-tabs-overflow-container) { scrollbar-width: thin; scrollbar-color: var(--bt-line-strong) transparent; }
|
||||||
|
|
||||||
.bt-kbd { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: calc(5px * var(--bt-rs, 1)); background: rgb(var(--bt-text-rgb) / .06); box-shadow: inset 0 0 0 1px rgb(var(--bt-text-rgb) / .07), inset 0 -1px 0 rgb(var(--bt-text-rgb) / .05); color: var(--bt-text-2); font: 500 10.5px/1 var(--bt-mono); }
|
.bt-kbd { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 5px; background: rgb(var(--bt-text-rgb) / .06); box-shadow: inset 0 0 0 1px rgb(var(--bt-text-rgb) / .07), inset 0 -1px 0 rgb(var(--bt-text-rgb) / .05); color: var(--bt-text-2); font: 500 10.5px/1 var(--bt-mono); }
|
||||||
.bt-kbd + .bt-kbd { margin-inline-start: 3px; }
|
.bt-kbd + .bt-kbd { margin-inline-start: 3px; }
|
||||||
|
|
||||||
.bt-avatar--image { overflow: hidden; position: relative; }
|
.bt-avatar--image { overflow: hidden; position: relative; }
|
||||||
.bt-avatar--image img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
|
.bt-avatar--image img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
|
||||||
.bt-avatar--image::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
|
.bt-avatar--image::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
|
||||||
.bt-profile-signin { margin-inline-start: auto; font: 600 12px/1 var(--bt-ui); color: var(--bt-accent); background: rgb(var(--bt-accent-rgb) / .12); border: 0; border-radius: calc(999px * var(--bt-rs, 1)); padding: 6px 10px; cursor: pointer; }
|
.bt-profile-signin { margin-inline-start: auto; font: 600 12px/1 var(--bt-ui); color: var(--bt-accent); background: rgb(var(--bt-accent-rgb) / .12); border: 0; border-radius: 999px; padding: 6px 10px; cursor: pointer; }
|
||||||
.bt-profile-signin:hover { background: rgb(var(--bt-accent-rgb) / .2); }
|
.bt-profile-signin:hover { background: rgb(var(--bt-accent-rgb) / .2); }
|
||||||
.bt-avatar { display: inline-grid; place-items: center; flex: none; border-radius: 50%; font-family: var(--bt-ui); font-weight: 650; line-height: 1; letter-spacing: 0; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), inset 0 -6px 10px -6px rgba(0, 0, 0, .25); user-select: none; }
|
.bt-avatar { display: inline-grid; place-items: center; flex: none; border-radius: 50%; font-family: var(--bt-ui); font-weight: 650; line-height: 1; letter-spacing: 0; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), inset 0 -6px 10px -6px rgba(0, 0, 0, .25); user-select: none; }
|
||||||
|
|
||||||
|
|
@ -116,7 +111,7 @@ html[data-update] { --bt-tb-right: calc(138px + 48px + 184px + 184px + var(--bt-
|
||||||
html[data-os=macos][data-update] { --bt-tb-right: calc(48px + 184px + 184px + var(--bt-tb-menu) + var(--bt-tb-extra, 0px)); }
|
html[data-os=macos][data-update] { --bt-tb-right: calc(48px + 184px + 184px + var(--bt-tb-menu) + var(--bt-tb-extra, 0px)); }
|
||||||
.bt-update-chip {
|
.bt-update-chip {
|
||||||
align-self: center; display: inline-flex; align-items: center; gap: 8px; height: 28px; margin-right: 8px; padding: 0 12px 0 10px; /* rtl-ok: titlebar */
|
align-self: center; display: inline-flex; align-items: center; gap: 8px; height: 28px; margin-right: 8px; padding: 0 12px 0 10px; /* rtl-ok: titlebar */
|
||||||
border: 1px solid transparent; border-radius: calc(14px * var(--bt-rs, 1)); color: var(--bt-text); font: 500 12px/1 var(--bt-ui); white-space: nowrap; cursor: pointer;
|
border: 1px solid transparent; border-radius: 14px; color: var(--bt-text); font: 500 12px/1 var(--bt-ui); white-space: nowrap; cursor: pointer;
|
||||||
background: linear-gradient(var(--bt-field), var(--bt-field)) padding-box, var(--bt-brush) border-box;
|
background: linear-gradient(var(--bt-field), var(--bt-field)) padding-box, var(--bt-brush) border-box;
|
||||||
transition: background var(--bt-t1) var(--bt-ease);
|
transition: background var(--bt-t1) var(--bt-ease);
|
||||||
}
|
}
|
||||||
|
|
@ -132,7 +127,7 @@ html[data-os=macos][data-update] { --bt-tb-right: calc(48px + 184px + 184px + va
|
||||||
/* Account switcher (titlebar). Width is reserved in --bt-tb-right. */
|
/* Account switcher (titlebar). Width is reserved in --bt-tb-right. */
|
||||||
.bt-profile-switcher {
|
.bt-profile-switcher {
|
||||||
align-self: center; display: inline-flex; align-items: center; gap: 8px; max-width: 176px; height: 30px; margin-right: 8px; padding: 0 9px 0 4px; box-sizing: border-box; /* rtl-ok: titlebar */
|
align-self: center; display: inline-flex; align-items: center; gap: 8px; max-width: 176px; height: 30px; margin-right: 8px; padding: 0 9px 0 4px; box-sizing: border-box; /* rtl-ok: titlebar */
|
||||||
border: 1px solid var(--bt-line-soft); border-radius: calc(15px * var(--bt-rs, 1)); background: rgb(var(--bt-text-rgb) / .035); color: var(--bt-text); font: 500 12.5px/1 var(--bt-ui); cursor: pointer;
|
border: 1px solid var(--bt-line-soft); border-radius: 15px; background: rgb(var(--bt-text-rgb) / .035); color: var(--bt-text); font: 500 12.5px/1 var(--bt-ui); cursor: pointer;
|
||||||
transition: background-color var(--bt-t1) var(--bt-ease), border-color var(--bt-t1) var(--bt-ease);
|
transition: background-color var(--bt-t1) var(--bt-ease), border-color var(--bt-t1) var(--bt-ease);
|
||||||
}
|
}
|
||||||
.bt-profile-switcher:hover { background: var(--bt-hover); border-color: var(--bt-line-strong); }
|
.bt-profile-switcher:hover { background: var(--bt-hover); border-color: var(--bt-line-strong); }
|
||||||
|
|
@ -196,7 +191,7 @@ html[data-os=macos][data-update] { --bt-tb-right: calc(48px + 184px + 184px + va
|
||||||
* Tabs: floating pills. They shrink to 52px (favicon only), then the strip scrolls and dockview adds its "N more" list. */
|
* Tabs: floating pills. They shrink to 52px (favicon only), then the strip scrolls and dockview adds its "N more" list. */
|
||||||
.bt-shell .dv-tabs-container .dv-tab {
|
.bt-shell .dv-tabs-container .dv-tab {
|
||||||
--bt-tab-bg: var(--bt-ground); --bt-tab-fg: var(--bt-muted);
|
--bt-tab-bg: var(--bt-ground); --bt-tab-fg: var(--bt-muted);
|
||||||
height: 30px; margin: 5px 2px 0 0; padding: 0; border-radius: calc(9px * var(--bt-rs, 1)); box-sizing: border-box;
|
height: 30px; margin: 5px 2px 0 0; padding: 0; border-radius: 9px; box-sizing: border-box;
|
||||||
width: 224px; min-width: 52px; flex: 0 1 auto;
|
width: 224px; min-width: 52px; flex: 0 1 auto;
|
||||||
/* Dockview colors tabs with higher-specificity rules; the pill states below only set these two variables. */
|
/* Dockview colors tabs with higher-specificity rules; the pill states below only set these two variables. */
|
||||||
color: var(--bt-tab-fg) !important; background-color: var(--bt-tab-bg) !important; box-shadow: none;
|
color: var(--bt-tab-fg) !important; background-color: var(--bt-tab-bg) !important; box-shadow: none;
|
||||||
|
|
@ -210,7 +205,7 @@ html[data-os=macos][data-update] { --bt-tb-right: calc(48px + 184px + 184px + va
|
||||||
}
|
}
|
||||||
/* The brush marks the focused pane's tab; other panes keep a plain raised pill. */
|
/* The brush marks the focused pane's tab; other panes keep a plain raised pill. */
|
||||||
.bt-shell .dv-tabs-container .dv-tab.dv-active-tab::after {
|
.bt-shell .dv-tabs-container .dv-tab.dv-active-tab::after {
|
||||||
content: ''; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; border-radius: calc(2px * var(--bt-rs, 1)) calc(2px * var(--bt-rs, 1)) 0 0;
|
content: ''; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; border-radius: 2px 2px 0 0;
|
||||||
background: var(--bt-brush); opacity: .95; pointer-events: none;
|
background: var(--bt-brush); opacity: .95; pointer-events: none;
|
||||||
}
|
}
|
||||||
.bt-shell .dv-groupview.dv-inactive-group .dv-tabs-container .dv-tab.dv-active-tab { --bt-tab-bg: var(--bt-field); --bt-tab-fg: var(--bt-text-2); }
|
.bt-shell .dv-groupview.dv-inactive-group .dv-tabs-container .dv-tab.dv-active-tab { --bt-tab-bg: var(--bt-field); --bt-tab-fg: var(--bt-text-2); }
|
||||||
|
|
@ -228,13 +223,13 @@ html[data-os=macos][data-update] { --bt-tb-right: calc(48px + 184px + 184px + va
|
||||||
.bt-tab { container-type: inline-size; height: 100%; width: 100%; box-sizing: border-box; display: flex; align-items: center; gap: 8px; padding-block: 0; padding-inline: 10px 5px; min-width: 0; user-select: none; font: 500 12.5px/1 var(--bt-ui); letter-spacing: .005em; }
|
.bt-tab { container-type: inline-size; height: 100%; width: 100%; box-sizing: border-box; display: flex; align-items: center; gap: 8px; padding-block: 0; padding-inline: 10px 5px; min-width: 0; user-select: none; font: 500 12.5px/1 var(--bt-ui); letter-spacing: .005em; }
|
||||||
.bt-tab--pinned { justify-content: center; padding: 0; }
|
.bt-tab--pinned { justify-content: center; padding: 0; }
|
||||||
.bt-tab-icon { position: relative; display: grid; place-items: center; width: 16px; height: 16px; flex: 0 0 16px; }
|
.bt-tab-icon { position: relative; display: grid; place-items: center; width: 16px; height: 16px; flex: 0 0 16px; }
|
||||||
.bt-favicon { width: 16px !important; height: 16px !important; flex: 0 0 16px; border-radius: calc(4px * var(--bt-rs, 1)); color: var(--bt-muted); }
|
.bt-favicon { width: 16px !important; height: 16px !important; flex: 0 0 16px; border-radius: 4px; color: var(--bt-muted); }
|
||||||
.bt-favicon--img { animation: bt-fade-in var(--bt-t2) var(--bt-ease); }
|
.bt-favicon--img { animation: bt-fade-in var(--bt-t2) var(--bt-ease); }
|
||||||
.bt-shell .bt-favicon--glyph { width: 15px !important; height: 15px !important; }
|
.bt-shell .bt-favicon--glyph { width: 15px !important; height: 15px !important; }
|
||||||
.bt-tab-account { position: absolute; inset-inline-end: -3px; bottom: -3px; width: 7px; height: 7px; border-radius: 50%; box-shadow: 0 0 0 2px var(--bt-tab-bg, var(--bt-raised)); transition: box-shadow var(--bt-t1) var(--bt-ease); }
|
.bt-tab-account { position: absolute; inset-inline-end: -3px; bottom: -3px; width: 7px; height: 7px; border-radius: 50%; box-shadow: 0 0 0 2px var(--bt-tab-bg, var(--bt-raised)); transition: box-shadow var(--bt-t1) var(--bt-ease); }
|
||||||
.bt-tab-title { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; line-height: 16px; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 18px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 18px), transparent); }
|
.bt-tab-title { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; line-height: 16px; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 18px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 18px), transparent); }
|
||||||
.bt-tab--loading .bt-tab-title { color: var(--bt-text-2); }
|
.bt-tab--loading .bt-tab-title { color: var(--bt-text-2); }
|
||||||
.bt-tab-close { flex: 0 0 20px; width: 20px; height: 20px; display: grid; place-items: center; padding: 0; border: 0; border-radius: calc(6px * var(--bt-rs, 1)); background: transparent; color: var(--bt-muted); cursor: pointer; opacity: 0; transition: opacity var(--bt-t1) var(--bt-ease), background-color var(--bt-t1) var(--bt-ease), color var(--bt-t1) var(--bt-ease); }
|
.bt-tab-close { flex: 0 0 20px; width: 20px; height: 20px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--bt-muted); cursor: pointer; opacity: 0; transition: opacity var(--bt-t1) var(--bt-ease), background-color var(--bt-t1) var(--bt-ease), color var(--bt-t1) var(--bt-ease); }
|
||||||
.bt-shell .bt-tab-close svg { width: 13px; height: 13px; stroke-width: 2; }
|
.bt-shell .bt-tab-close svg { width: 13px; height: 13px; stroke-width: 2; }
|
||||||
.dv-tab:hover .bt-tab-close, .dv-active-tab .bt-tab-close, .bt-tab-close:focus-visible { opacity: 1; }
|
.dv-tab:hover .bt-tab-close, .dv-active-tab .bt-tab-close, .bt-tab-close:focus-visible { opacity: 1; }
|
||||||
.dv-inactive-tab .bt-tab-close { color: var(--bt-faint); }
|
.dv-inactive-tab .bt-tab-close { color: var(--bt-faint); }
|
||||||
|
|
@ -258,7 +253,7 @@ html[data-os=macos][data-update] { --bt-tb-right: calc(48px + 184px + 184px + va
|
||||||
|
|
||||||
.bt-group-actions { height: 100%; display: flex; align-items: center; padding: 0 4px 0 2px; }
|
.bt-group-actions { height: 100%; display: flex; align-items: center; padding: 0 4px 0 2px; }
|
||||||
.bt-group--in-titlebar .bt-group-actions { padding-top: 0; }
|
.bt-group--in-titlebar .bt-group-actions { padding-top: 0; }
|
||||||
.bt-group-actions .bt-icon { width: 28px; height: 28px; flex-basis: 28px; border-radius: calc(8px * var(--bt-rs, 1)); }
|
.bt-group-actions .bt-icon { width: 28px; height: 28px; flex-basis: 28px; border-radius: 8px; }
|
||||||
.bt-group--in-titlebar .bt-group-actions .bt-icon { margin-top: 0; }
|
.bt-group--in-titlebar .bt-group-actions .bt-icon { margin-top: 0; }
|
||||||
.bt-shell .bt-newtab svg { width: 15px; height: 15px; }
|
.bt-shell .bt-newtab svg { width: 15px; height: 15px; }
|
||||||
|
|
||||||
|
|
@ -268,7 +263,7 @@ html[data-os=macos][data-update] { --bt-tb-right: calc(48px + 184px + 184px + va
|
||||||
}
|
}
|
||||||
.bt-shell .dv-tabs-overflow-dropdown-root { display: flex; align-items: center; height: 100%; }
|
.bt-shell .dv-tabs-overflow-dropdown-root { display: flex; align-items: center; height: 100%; }
|
||||||
.bt-shell .dv-tabs-overflow-dropdown-default {
|
.bt-shell .dv-tabs-overflow-dropdown-default {
|
||||||
height: 26px; margin: 0 2px 0 4px; padding: 0 8px 0 6px; gap: 2px; box-sizing: border-box; border-radius: calc(8px * var(--bt-rs, 1));
|
height: 26px; margin: 0 2px 0 4px; padding: 0 8px 0 6px; gap: 2px; box-sizing: border-box; border-radius: 8px;
|
||||||
background: rgb(var(--bt-text-rgb) / .04); box-shadow: inset 0 0 0 1px var(--bt-line); color: var(--bt-text-2);
|
background: rgb(var(--bt-text-rgb) / .04); box-shadow: inset 0 0 0 1px var(--bt-line); color: var(--bt-text-2);
|
||||||
font: 500 11.5px/1 var(--bt-mono); font-variant-numeric: tabular-nums; transition: background-color var(--bt-t1) var(--bt-ease);
|
font: 500 11.5px/1 var(--bt-mono); font-variant-numeric: tabular-nums; transition: background-color var(--bt-t1) var(--bt-ease);
|
||||||
}
|
}
|
||||||
|
|
@ -311,14 +306,14 @@ html[data-os=macos][data-update] { --bt-tb-right: calc(48px + 184px + 184px + va
|
||||||
.bt-omni--edit { padding-inline-start: 10px; gap: 8px; }
|
.bt-omni--edit { padding-inline-start: 10px; gap: 8px; }
|
||||||
.bt-shell .bt-omni-lead { width: 15px; height: 15px; color: var(--bt-muted); }
|
.bt-shell .bt-omni-lead { width: 15px; height: 15px; color: var(--bt-muted); }
|
||||||
.bt-chip-site {
|
.bt-chip-site {
|
||||||
display: inline-flex; align-items: center; gap: 6px; height: 24px; padding-block: 0; padding-inline: 6px 8px; margin-inline-end: 2px; flex: 0 0 auto; border: 0; border-radius: calc(7px * var(--bt-rs, 1));
|
display: inline-flex; align-items: center; gap: 6px; height: 24px; padding-block: 0; padding-inline: 6px 8px; margin-inline-end: 2px; flex: 0 0 auto; border: 0; border-radius: 7px;
|
||||||
background: var(--bt-accent-soft); color: var(--bt-accent-ink); font: 600 12.5px/1 var(--bt-ui); letter-spacing: .005em; cursor: pointer;
|
background: var(--bt-accent-soft); color: var(--bt-accent-ink); font: 600 12.5px/1 var(--bt-ui); letter-spacing: .005em; cursor: pointer;
|
||||||
transition: background-color var(--bt-t1) var(--bt-ease);
|
transition: background-color var(--bt-t1) var(--bt-ease);
|
||||||
}
|
}
|
||||||
.bt-chip-site:hover { background: rgb(var(--bt-accent-rgb) / .22); }
|
.bt-chip-site:hover { background: rgb(var(--bt-accent-rgb) / .22); }
|
||||||
.bt-chip-site img { width: 14px; height: 14px; border-radius: calc(3px * var(--bt-rs, 1)); }
|
.bt-chip-site img { width: 14px; height: 14px; border-radius: 3px; }
|
||||||
.bt-chip-insecure { display: inline-flex; align-items: center; flex: 0 0 auto; height: 22px; margin-inline-end: 2px; padding: 0 8px; border-radius: calc(6px * var(--bt-rs, 1)); background: rgba(245, 158, 11, .12); color: #fbbf24; font: 600 11.5px/1 var(--bt-ui); }
|
.bt-chip-insecure { display: inline-flex; align-items: center; flex: 0 0 auto; height: 22px; margin-inline-end: 2px; padding: 0 8px; border-radius: 6px; background: rgba(245, 158, 11, .12); color: #fbbf24; font: 600 11.5px/1 var(--bt-ui); }
|
||||||
.bt-seg { display: inline-flex; align-items: center; height: 24px; padding: 0 6px; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; border-radius: calc(6px * var(--bt-rs, 1)); border: 0; background: transparent; color: var(--bt-text-2); font: 500 13px/1 var(--bt-ui); white-space: nowrap; cursor: pointer; transition: background-color var(--bt-t1) var(--bt-ease), color var(--bt-t1) var(--bt-ease); }
|
.bt-seg { display: inline-flex; align-items: center; height: 24px; padding: 0 6px; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; border-radius: 6px; border: 0; background: transparent; color: var(--bt-text-2); font: 500 13px/1 var(--bt-ui); white-space: nowrap; cursor: pointer; transition: background-color var(--bt-t1) var(--bt-ease), color var(--bt-t1) var(--bt-ease); }
|
||||||
.bt-seg:hover { background: var(--bt-hover); color: var(--bt-text); }
|
.bt-seg:hover { background: var(--bt-hover); color: var(--bt-text); }
|
||||||
.bt-seg[aria-current] { cursor: text; background: none; color: var(--bt-text); font-weight: 600; }
|
.bt-seg[aria-current] { cursor: text; background: none; color: var(--bt-text); font-weight: 600; }
|
||||||
.bt-seg--mono { font: 500 12.5px/1 var(--bt-mono); color: var(--bt-text-2); }
|
.bt-seg--mono { font: 500 12.5px/1 var(--bt-mono); color: var(--bt-text-2); }
|
||||||
|
|
@ -326,7 +321,7 @@ html[data-os=macos][data-update] { --bt-tb-right: calc(48px + 184px + 184px + va
|
||||||
.bt-sep { flex: 0 0 auto; color: var(--bt-faint); font: 400 14px/1 var(--bt-ui); padding: 0 1px; opacity: .8; }
|
.bt-sep { flex: 0 0 auto; color: var(--bt-faint); font: 400 14px/1 var(--bt-ui); padding: 0 1px; opacity: .8; }
|
||||||
.bt-omni-raw { flex: 1; min-width: 0; padding-inline-start: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 400 12.5px var(--bt-mono); color: var(--bt-muted); }
|
.bt-omni-raw { flex: 1; min-width: 0; padding-inline-start: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 400 12.5px var(--bt-mono); color: var(--bt-muted); }
|
||||||
.bt-omni-fill { flex: 1; min-width: 8px; align-self: stretch; }
|
.bt-omni-fill { flex: 1; min-width: 8px; align-self: stretch; }
|
||||||
.bt-omni-action { width: 26px; height: 26px; flex: 0 0 26px; display: grid; place-items: center; padding: 0; border: 0; border-radius: calc(7px * var(--bt-rs, 1)); background: transparent; color: var(--bt-faint); cursor: pointer; transition: background-color var(--bt-t1) var(--bt-ease), color var(--bt-t1) var(--bt-ease); }
|
.bt-omni-action { width: 26px; height: 26px; flex: 0 0 26px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--bt-faint); cursor: pointer; transition: background-color var(--bt-t1) var(--bt-ease), color var(--bt-t1) var(--bt-ease); }
|
||||||
.bt-omni:hover .bt-omni-action { color: var(--bt-muted); }
|
.bt-omni:hover .bt-omni-action { color: var(--bt-muted); }
|
||||||
.bt-omni-action:hover { background: var(--bt-hover); color: var(--bt-text) !important; }
|
.bt-omni-action:hover { background: var(--bt-hover); color: var(--bt-text) !important; }
|
||||||
.bt-shell .bt-omni-action svg { width: 14px; height: 14px; }
|
.bt-shell .bt-omni-action svg { width: 14px; height: 14px; }
|
||||||
|
|
@ -334,22 +329,22 @@ html[data-os=macos][data-update] { --bt-tb-right: calc(48px + 184px + 184px + va
|
||||||
.bt-omni input:focus-visible { outline: 0; }
|
.bt-omni input:focus-visible { outline: 0; }
|
||||||
.bt-omni input::selection { background: rgb(var(--bt-accent-rgb) / .35); }
|
.bt-omni input::selection { background: rgb(var(--bt-accent-rgb) / .35); }
|
||||||
.bt-omni-ops { display: flex; gap: 4px; flex: 0 1 auto; min-width: 0; overflow: hidden; }
|
.bt-omni-ops { display: flex; gap: 4px; flex: 0 1 auto; min-width: 0; overflow: hidden; }
|
||||||
.bt-omni-op { flex: 0 0 auto; height: 22px; padding: 0 8px; border: 1px solid var(--bt-line); border-radius: calc(6px * var(--bt-rs, 1)); background: var(--bt-chrome); color: var(--bt-muted); font: 500 11.5px var(--bt-mono); cursor: pointer; }
|
.bt-omni-op { flex: 0 0 auto; height: 22px; padding: 0 8px; border: 1px solid var(--bt-line); border-radius: 6px; background: var(--bt-chrome); color: var(--bt-muted); font: 500 11.5px var(--bt-mono); cursor: pointer; }
|
||||||
.bt-omni-op[aria-selected=true] { color: var(--bt-accent-ink); border-color: rgb(var(--bt-accent-rgb) / .5); background: var(--bt-accent-soft); }
|
.bt-omni-op[aria-selected=true] { color: var(--bt-accent-ink); border-color: rgb(var(--bt-accent-rgb) / .5); background: var(--bt-accent-soft); }
|
||||||
.bt-omni-op:hover { color: var(--bt-text); border-color: var(--bt-accent); }
|
.bt-omni-op:hover { color: var(--bt-text); border-color: var(--bt-accent); }
|
||||||
.bt-omni-progress { position: absolute; left: 8px; right: 8px; bottom: 0; height: 2px; border-radius: calc(2px * var(--bt-rs, 1)); background: var(--bt-brush); transform-origin: left; animation: bt-load 1.2s ease-in-out infinite; pointer-events: none; }
|
.bt-omni-progress { position: absolute; left: 8px; right: 8px; bottom: 0; height: 2px; border-radius: 2px; background: var(--bt-brush); transform-origin: left; animation: bt-load 1.2s ease-in-out infinite; pointer-events: none; }
|
||||||
@keyframes bt-load { 0% { transform: scaleX(.05); } 60% { transform: scaleX(.7); } 100% { transform: scaleX(.95); opacity: .3; } }
|
@keyframes bt-load { 0% { transform: scaleX(.05); } 60% { transform: scaleX(.7); } 100% { transform: scaleX(.95); opacity: .3; } }
|
||||||
@media (prefers-reduced-motion: reduce) { .bt-omni-progress { animation: none; transform: scaleX(.6); } }
|
@media (prefers-reduced-motion: reduce) { .bt-omni-progress { animation: none; transform: scaleX(.6); } }
|
||||||
|
|
||||||
/* split + wayBetter buttons */
|
/* split + wayBetter buttons */
|
||||||
.bt-split { position: relative; display: flex; align-items: center; }
|
.bt-split { position: relative; display: flex; align-items: center; }
|
||||||
.bt-split .bt-split-main { border-start-start-radius: calc(8px * var(--bt-rs, 1)); border-start-end-radius: 0; border-end-end-radius: 0; border-end-start-radius: calc(8px * var(--bt-rs, 1)); }
|
.bt-split .bt-split-main { border-start-start-radius: 8px; border-start-end-radius: 0; border-end-end-radius: 0; border-end-start-radius: 8px; }
|
||||||
.bt-split .bt-split-more { width: 18px; flex-basis: 18px; border-start-start-radius: 0; border-start-end-radius: calc(8px * var(--bt-rs, 1)); border-end-end-radius: calc(8px * var(--bt-rs, 1)); border-end-start-radius: 0; }
|
.bt-split .bt-split-more { width: 18px; flex-basis: 18px; border-start-start-radius: 0; border-start-end-radius: 8px; border-end-end-radius: 8px; border-end-start-radius: 0; }
|
||||||
.bt-shell .bt-split-more svg { width: 12px; height: 12px; }
|
.bt-shell .bt-split-more svg { width: 12px; height: 12px; }
|
||||||
.bt-menu.bt-split-menu { position: absolute; top: 40px; inset-inline-end: 0; z-index: 20; min-width: 200px; }
|
.bt-menu.bt-split-menu { position: absolute; top: 40px; inset-inline-end: 0; z-index: 20; min-width: 200px; }
|
||||||
.bt-brand-button {
|
.bt-brand-button {
|
||||||
display: inline-flex; align-items: center; gap: 7px; height: 32px; margin-inline-start: 6px; padding-block: 0; padding-inline: 9px 12px; flex: 0 0 auto;
|
display: inline-flex; align-items: center; gap: 7px; height: 32px; margin-inline-start: 6px; padding-block: 0; padding-inline: 9px 12px; flex: 0 0 auto;
|
||||||
border: 1px solid var(--bt-line); border-radius: calc(9px * var(--bt-rs, 1)); background: rgb(var(--bt-text-rgb) / .02); color: var(--bt-text); font: 600 12.5px/1 var(--bt-ui); cursor: pointer;
|
border: 1px solid var(--bt-line); border-radius: 9px; background: rgb(var(--bt-text-rgb) / .02); color: var(--bt-text); font: 600 12.5px/1 var(--bt-ui); cursor: pointer;
|
||||||
transition: background-color var(--bt-t1) var(--bt-ease), border-color var(--bt-t1) var(--bt-ease);
|
transition: background-color var(--bt-t1) var(--bt-ease), border-color var(--bt-t1) var(--bt-ease);
|
||||||
}
|
}
|
||||||
.bt-brand-button:hover { background: var(--bt-hover); border-color: var(--bt-line-strong); }
|
.bt-brand-button:hover { background: var(--bt-hover); border-color: var(--bt-line-strong); }
|
||||||
|
|
@ -362,7 +357,7 @@ html[data-os=macos][data-update] { --bt-tb-right: calc(48px + 184px + 184px + va
|
||||||
@container pane (max-width: 640px) {
|
@container pane (max-width: 640px) {
|
||||||
.bt-brand-button { padding: 0; width: 36px; min-width: 36px; }
|
.bt-brand-button { padding: 0; width: 36px; min-width: 36px; }
|
||||||
.bt-split .bt-split-more { display: none; }
|
.bt-split .bt-split-more { display: none; }
|
||||||
.bt-split .bt-split-main { border-radius: calc(8px * var(--bt-rs, 1)); }
|
.bt-split .bt-split-main { border-radius: 8px; }
|
||||||
}
|
}
|
||||||
@container pane (max-width: 420px) {
|
@container pane (max-width: 420px) {
|
||||||
.bt-addressbar > .bt-icon[aria-label=Forward], .bt-split { display: none; }
|
.bt-addressbar > .bt-icon[aria-label=Forward], .bt-split { display: none; }
|
||||||
|
|
@ -410,7 +405,7 @@ html.bt-raised .bt-deck :is(.bt-col-head, .bt-compose-head) { background-color:
|
||||||
border-radius: var(--bt-r4); background: var(--bt-raised); border: 1px solid var(--bt-line-strong); box-shadow: var(--bt-shadow-pop);
|
border-radius: var(--bt-r4); background: var(--bt-raised); border: 1px solid var(--bt-line-strong); box-shadow: var(--bt-shadow-pop);
|
||||||
color: var(--bt-text); font: 500 13px/1.3 var(--bt-ui); user-select: none;
|
color: var(--bt-text); font: 500 13px/1.3 var(--bt-ui); user-select: none;
|
||||||
}
|
}
|
||||||
.bt-menu button { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border: 0; border-radius: calc(7px * var(--bt-rs, 1)); background: transparent; color: var(--bt-text); font: inherit; text-align: start; cursor: pointer; transition: background-color 80ms var(--bt-ease); }
|
.bt-menu button { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--bt-text); font: inherit; text-align: start; cursor: pointer; transition: background-color 80ms var(--bt-ease); }
|
||||||
.bt-menu button:hover:not(:disabled), .bt-menu button:focus-visible { background: var(--bt-hover); outline: 0; }
|
.bt-menu button:hover:not(:disabled), .bt-menu button:focus-visible { background: var(--bt-hover); outline: 0; }
|
||||||
.bt-menu button:active:not(:disabled) { background: var(--bt-press); }
|
.bt-menu button:active:not(:disabled) { background: var(--bt-press); }
|
||||||
.bt-menu button:disabled { color: var(--bt-faint); cursor: default; }
|
.bt-menu button:disabled { color: var(--bt-faint); cursor: default; }
|
||||||
|
|
@ -426,9 +421,9 @@ html.bt-raised .bt-deck :is(.bt-col-head, .bt-compose-head) { background-color:
|
||||||
.bt-profile-menu-head { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px 10px; }
|
.bt-profile-menu-head { display: flex; flex-direction: column; gap: 3px; padding: 8px 10px 10px; }
|
||||||
.bt-profile-menu-head strong { font: 600 13px/1.2 var(--bt-ui); color: var(--bt-text); }
|
.bt-profile-menu-head strong { font: 600 13px/1.2 var(--bt-ui); color: var(--bt-text); }
|
||||||
.bt-profile-menu-head span { font: 400 12px/1.3 var(--bt-ui); color: var(--bt-muted); }
|
.bt-profile-menu-head span { font: 400 12px/1.3 var(--bt-ui); color: var(--bt-muted); }
|
||||||
.bt-profile-row { position: relative; display: flex; align-items: center; border-radius: calc(9px * var(--bt-rs, 1)); }
|
.bt-profile-row { position: relative; display: flex; align-items: center; border-radius: 9px; }
|
||||||
.bt-profile-row.is-active { background: rgb(var(--bt-text-rgb) / .035); }
|
.bt-profile-row.is-active { background: rgb(var(--bt-text-rgb) / .035); }
|
||||||
.bt-menu .bt-profile-pick { flex: 1; min-width: 0; height: auto; gap: 11px; padding: 7px 8px; border-radius: calc(9px * var(--bt-rs, 1)); }
|
.bt-menu .bt-profile-pick { flex: 1; min-width: 0; height: auto; gap: 11px; padding: 7px 8px; border-radius: 9px; }
|
||||||
.bt-profile-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
|
.bt-profile-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
|
||||||
.bt-profile-name { font: 600 13.5px/1.15 var(--bt-ui); color: var(--bt-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
.bt-profile-name { font: 600 13.5px/1.15 var(--bt-ui); color: var(--bt-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
.bt-profile-meta { font: 400 12px/1.2 var(--bt-ui); color: var(--bt-muted); font-variant-numeric: tabular-nums; }
|
.bt-profile-meta { font: 400 12px/1.2 var(--bt-ui); color: var(--bt-muted); font-variant-numeric: tabular-nums; }
|
||||||
|
|
@ -442,9 +437,9 @@ html.bt-raised .bt-deck :is(.bt-col-head, .bt-compose-head) { background-color:
|
||||||
.bt-menu .bt-profile-action { width: 28px; height: 28px; padding: 0; justify-content: center; color: var(--bt-muted); }
|
.bt-menu .bt-profile-action { width: 28px; height: 28px; padding: 0; justify-content: center; color: var(--bt-muted); }
|
||||||
.bt-menu .bt-profile-action:hover:not(:disabled) { color: var(--bt-text); background: var(--bt-press); }
|
.bt-menu .bt-profile-action:hover:not(:disabled) { color: var(--bt-text); background: var(--bt-press); }
|
||||||
.bt-profile-action .bt-glyph { width: 15px; height: 15px; }
|
.bt-profile-action .bt-glyph { width: 15px; height: 15px; }
|
||||||
.bt-profile-edit { display: flex; flex-direction: column; gap: 10px; padding: 7px 8px 9px; border-radius: calc(9px * var(--bt-rs, 1)); background: rgb(var(--bt-text-rgb) / .035); }
|
.bt-profile-edit { display: flex; flex-direction: column; gap: 10px; padding: 7px 8px 9px; border-radius: 9px; background: rgb(var(--bt-text-rgb) / .035); }
|
||||||
.bt-profile-edit-row { display: flex; align-items: center; gap: 11px; }
|
.bt-profile-edit-row { display: flex; align-items: center; gap: 11px; }
|
||||||
.bt-profile-name-input { flex: 1; min-width: 0; height: 32px; padding: 0 10px; box-sizing: border-box; border: 0; border-radius: calc(8px * var(--bt-rs, 1)); background: var(--bt-field); box-shadow: var(--bt-ring); color: var(--bt-text); font: 500 13.5px/1 var(--bt-ui); outline: none; user-select: text; }
|
.bt-profile-name-input { flex: 1; min-width: 0; height: 32px; padding: 0 10px; box-sizing: border-box; border: 0; border-radius: 8px; background: var(--bt-field); box-shadow: var(--bt-ring); color: var(--bt-text); font: 500 13.5px/1 var(--bt-ui); outline: none; user-select: text; }
|
||||||
.bt-profile-swatches { display: flex; flex-wrap: wrap; gap: 8px; padding-inline-start: 41px; }
|
.bt-profile-swatches { display: flex; flex-wrap: wrap; gap: 8px; padding-inline-start: 41px; }
|
||||||
.bt-menu .bt-profile-swatch { width: 18px; height: 18px; padding: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); transition: transform var(--bt-t1) var(--bt-ease); }
|
.bt-menu .bt-profile-swatch { width: 18px; height: 18px; padding: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); transition: transform var(--bt-t1) var(--bt-ease); }
|
||||||
.bt-menu .bt-profile-swatch:hover { transform: scale(1.12); background-color: revert; }
|
.bt-menu .bt-profile-swatch:hover { transform: scale(1.12); background-color: revert; }
|
||||||
|
|
@ -454,14 +449,14 @@ html.bt-raised .bt-deck :is(.bt-col-head, .bt-compose-head) { background-color:
|
||||||
.bt-profile-add-icon .bt-glyph { width: 14px; height: 14px; }
|
.bt-profile-add-icon .bt-glyph { width: 14px; height: 14px; }
|
||||||
.bt-menu .bt-profile-add:hover .bt-profile-add-icon { box-shadow: inset 0 0 0 1px rgb(var(--bt-accent-rgb) / .6); color: var(--bt-accent-ink); }
|
.bt-menu .bt-profile-add:hover .bt-profile-add-icon { box-shadow: inset 0 0 0 1px rgb(var(--bt-accent-rgb) / .6); color: var(--bt-accent-ink); }
|
||||||
.bt-profile-foot { margin: 2px 10px 6px; color: var(--bt-faint); font: 400 11.5px/1.4 var(--bt-ui); }
|
.bt-profile-foot { margin: 2px 10px 6px; color: var(--bt-faint); font: 400 11.5px/1.4 var(--bt-ui); }
|
||||||
.bt-profile-confirm { display: flex; flex-direction: column; gap: 10px; margin: 1px 0; padding: 10px 12px; border-radius: calc(9px * var(--bt-rs, 1)); background: rgba(229, 72, 77, .08); box-shadow: inset 0 0 0 1px rgba(229, 72, 77, .25); color: var(--bt-text-2); font: 400 12.5px/1.45 var(--bt-ui); }
|
.bt-profile-confirm { display: flex; flex-direction: column; gap: 10px; margin: 1px 0; padding: 10px 12px; border-radius: 9px; background: rgba(229, 72, 77, .08); box-shadow: inset 0 0 0 1px rgba(229, 72, 77, .25); color: var(--bt-text-2); font: 400 12.5px/1.45 var(--bt-ui); }
|
||||||
.bt-profile-confirm strong { color: var(--bt-text); font-weight: 600; }
|
.bt-profile-confirm strong { color: var(--bt-text); font-weight: 600; }
|
||||||
.bt-profile-confirm div { display: flex; gap: 6px; }
|
.bt-profile-confirm div { display: flex; gap: 6px; }
|
||||||
.bt-menu .bt-profile-confirm button { height: 28px; padding: 0 12px; font-weight: 600; font-size: 12.5px; }
|
.bt-menu .bt-profile-confirm button { height: 28px; padding: 0 12px; font-weight: 600; font-size: 12.5px; }
|
||||||
.bt-menu .bt-profile-danger { background: var(--bt-danger); color: #fff; }
|
.bt-menu .bt-profile-danger { background: var(--bt-danger); color: #fff; }
|
||||||
.bt-menu .bt-profile-danger:hover:not(:disabled) { background: #d93d42; }
|
.bt-menu .bt-profile-danger:hover:not(:disabled) { background: #d93d42; }
|
||||||
.bt-menu .bt-profile-cancel { background: var(--bt-hover); }
|
.bt-menu .bt-profile-cancel { background: var(--bt-hover); }
|
||||||
.bt-profile-error { padding: 6px 10px; color: var(--bt-danger-ink); font: 12px/1.4 var(--bt-ui); }
|
.bt-profile-error { padding: 6px 10px; color: #ff8a80; font: 12px/1.4 var(--bt-ui); }
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Command palette (Ctrl+K) and the composer drafts picker, which reuses it. */
|
* Command palette (Ctrl+K) and the composer drafts picker, which reuses it. */
|
||||||
|
|
@ -480,15 +475,15 @@ html.bt-raised .bt-deck :is(.bt-col-head, .bt-compose-head) { background-color:
|
||||||
.bt-palette-list { flex: 1; overflow-y: auto; padding: 6px; }
|
.bt-palette-list { flex: 1; overflow-y: auto; padding: 6px; }
|
||||||
.bt-palette-group { padding: 12px 10px 6px; color: var(--bt-faint); font: 600 10.5px/1 var(--bt-ui); letter-spacing: .08em; text-transform: uppercase; }
|
.bt-palette-group { padding: 12px 10px 6px; color: var(--bt-faint); font: 600 10.5px/1 var(--bt-ui); letter-spacing: .08em; text-transform: uppercase; }
|
||||||
.bt-palette-group:first-child { padding-top: 6px; }
|
.bt-palette-group:first-child { padding-top: 6px; }
|
||||||
.bt-palette-item { display: flex; align-items: center; gap: 11px; min-height: 38px; padding: 0 10px; box-sizing: border-box; border-radius: calc(9px * var(--bt-rs, 1)); cursor: pointer; color: var(--bt-text-2); }
|
.bt-palette-item { display: flex; align-items: center; gap: 11px; min-height: 38px; padding: 0 10px; box-sizing: border-box; border-radius: 9px; cursor: pointer; color: var(--bt-text-2); }
|
||||||
.bt-palette-item[aria-selected=true] { background: rgb(var(--bt-text-rgb) / .055); color: var(--bt-text); }
|
.bt-palette-item[aria-selected=true] { background: rgb(var(--bt-text-rgb) / .055); color: var(--bt-text); }
|
||||||
.bt-palette-icon { display: grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: calc(7px * var(--bt-rs, 1)); background: rgb(var(--bt-text-rgb) / .04); box-shadow: inset 0 0 0 1px rgb(var(--bt-text-rgb) / .05); color: var(--bt-muted); transition: background-color var(--bt-t1) var(--bt-ease), color var(--bt-t1) var(--bt-ease); }
|
.bt-palette-icon { display: grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: 7px; background: rgb(var(--bt-text-rgb) / .04); box-shadow: inset 0 0 0 1px rgb(var(--bt-text-rgb) / .05); color: var(--bt-muted); transition: background-color var(--bt-t1) var(--bt-ease), color var(--bt-t1) var(--bt-ease); }
|
||||||
.bt-palette-icon img { width: 16px; height: 16px; border-radius: calc(4px * var(--bt-rs, 1)); }
|
.bt-palette-icon img { width: 16px; height: 16px; border-radius: 4px; }
|
||||||
.bt-palette-icon .bt-glyph { width: 15px; height: 15px; }
|
.bt-palette-icon .bt-glyph { width: 15px; height: 15px; }
|
||||||
.bt-palette-item[aria-selected=true] .bt-palette-icon { background: var(--bt-accent-soft); box-shadow: inset 0 0 0 1px rgb(var(--bt-accent-rgb) / .3); color: var(--bt-accent-ink); }
|
.bt-palette-item[aria-selected=true] .bt-palette-icon { background: var(--bt-accent-soft); box-shadow: inset 0 0 0 1px rgb(var(--bt-accent-rgb) / .3); color: var(--bt-accent-ink); }
|
||||||
.bt-palette-label { font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
|
.bt-palette-label { font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
|
||||||
.bt-palette-hint { margin-inline-start: auto; color: var(--bt-faint); font: 400 11.5px/1.2 var(--bt-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42%; flex-shrink: 0; }
|
.bt-palette-hint { margin-inline-start: auto; color: var(--bt-faint); font: 400 11.5px/1.2 var(--bt-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42%; flex-shrink: 0; }
|
||||||
.bt-palette-hint--tag { padding: 3px 7px; border-radius: calc(6px * var(--bt-rs, 1)); background: rgb(var(--bt-text-rgb) / .06); color: var(--bt-muted); font: 500 11px/1.2 var(--bt-ui); }
|
.bt-palette-hint--tag { padding: 3px 7px; border-radius: 6px; background: rgb(var(--bt-text-rgb) / .06); color: var(--bt-muted); font: 500 11px/1.2 var(--bt-ui); }
|
||||||
.bt-palette-hint--tag.is-match { background: var(--bt-accent-soft); color: var(--bt-accent-ink); }
|
.bt-palette-hint--tag.is-match { background: var(--bt-accent-soft); color: var(--bt-accent-ink); }
|
||||||
.bt-palette-enter { width: 14px; flex: none; color: var(--bt-muted); font: 500 12px/1 var(--bt-mono); opacity: 0; }
|
.bt-palette-enter { width: 14px; flex: none; color: var(--bt-muted); font: 500 12px/1 var(--bt-mono); opacity: 0; }
|
||||||
.bt-palette-item[aria-selected=true] .bt-palette-enter { opacity: .8; }
|
.bt-palette-item[aria-selected=true] .bt-palette-enter { opacity: .8; }
|
||||||
|
|
@ -508,11 +503,11 @@ html.bt-raised .bt-deck :is(.bt-col-head, .bt-compose-head) { background-color:
|
||||||
var(--bt-ground);
|
var(--bt-ground);
|
||||||
}
|
}
|
||||||
.bt-start-inner { max-width: 660px; margin: 0 auto; padding: clamp(40px, 13vh, 132px) 20px 40px; display: flex; flex-direction: column; align-items: center; gap: 24px; }
|
.bt-start-inner { max-width: 660px; margin: 0 auto; padding: clamp(40px, 13vh, 132px) 20px 40px; display: flex; flex-direction: column; align-items: center; gap: 24px; }
|
||||||
.bt-start-mark { display: grid; place-items: center; width: 60px; height: 60px; border-radius: calc(18px * var(--bt-rs, 1)); background: linear-gradient(180deg, var(--bt-raised-2), var(--bt-chrome)); box-shadow: inset 0 0 0 1px rgb(var(--bt-text-rgb) / .07), inset 0 1px 0 rgb(var(--bt-text-rgb) / .06), 0 24px 60px -24px rgba(79, 107, 255, .65); }
|
.bt-start-mark { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; background: linear-gradient(180deg, var(--bt-raised-2), var(--bt-chrome)); box-shadow: inset 0 0 0 1px rgb(var(--bt-text-rgb) / .07), inset 0 1px 0 rgb(var(--bt-text-rgb) / .06), 0 24px 60px -24px rgba(79, 107, 255, .65); }
|
||||||
.bt-start-mark img { border-radius: calc(9px * var(--bt-rs, 1)); -webkit-user-drag: none; }
|
.bt-start-mark img { border-radius: 9px; -webkit-user-drag: none; }
|
||||||
.bt-start-search {
|
.bt-start-search {
|
||||||
width: 100%; height: 52px; display: flex; align-items: center; gap: 12px; padding-block: 0; padding-inline: 17px 12px; box-sizing: border-box;
|
width: 100%; height: 52px; display: flex; align-items: center; gap: 12px; padding-block: 0; padding-inline: 17px 12px; box-sizing: border-box;
|
||||||
border-radius: calc(14px * var(--bt-rs, 1)); background: var(--bt-chrome); border: 1px solid var(--bt-line); box-shadow: 0 10px 30px -18px rgba(0, 0, 0, .9);
|
border-radius: 14px; background: var(--bt-chrome); border: 1px solid var(--bt-line); box-shadow: 0 10px 30px -18px rgba(0, 0, 0, .9);
|
||||||
transition: border-color var(--bt-t1) var(--bt-ease), box-shadow var(--bt-t2) var(--bt-ease);
|
transition: border-color var(--bt-t1) var(--bt-ease), box-shadow var(--bt-t2) var(--bt-ease);
|
||||||
}
|
}
|
||||||
.bt-start-search:hover { border-color: var(--bt-line-strong); }
|
.bt-start-search:hover { border-color: var(--bt-line-strong); }
|
||||||
|
|
@ -528,7 +523,7 @@ html.bt-raised .bt-deck :is(.bt-col-head, .bt-compose-head) { background-color:
|
||||||
.bt-start-accounts .bt-start-label { margin-inline-end: 6px; }
|
.bt-start-accounts .bt-start-label { margin-inline-end: 6px; }
|
||||||
.bt-start-account {
|
.bt-start-account {
|
||||||
display: inline-flex; align-items: center; gap: 7px; height: 30px; padding-block: 0; padding-inline: 5px 12px; box-sizing: border-box;
|
display: inline-flex; align-items: center; gap: 7px; height: 30px; padding-block: 0; padding-inline: 5px 12px; box-sizing: border-box;
|
||||||
border: 1px solid var(--bt-line-soft); border-radius: calc(15px * var(--bt-rs, 1)); background: transparent; color: var(--bt-muted); font: 500 12.5px/1 var(--bt-ui); cursor: pointer;
|
border: 1px solid var(--bt-line-soft); border-radius: 15px; background: transparent; color: var(--bt-muted); font: 500 12.5px/1 var(--bt-ui); cursor: pointer;
|
||||||
transition: background-color var(--bt-t1) var(--bt-ease), border-color var(--bt-t1) var(--bt-ease), color var(--bt-t1) var(--bt-ease);
|
transition: background-color var(--bt-t1) var(--bt-ease), border-color var(--bt-t1) var(--bt-ease), color var(--bt-t1) var(--bt-ease);
|
||||||
}
|
}
|
||||||
.bt-start-account:hover { background: var(--bt-hover); color: var(--bt-text-2); }
|
.bt-start-account:hover { background: var(--bt-hover); color: var(--bt-text-2); }
|
||||||
|
|
@ -542,16 +537,16 @@ html.bt-raised .bt-deck :is(.bt-col-head, .bt-compose-head) { background-color:
|
||||||
border: 1px solid var(--bt-line-soft); border-radius: var(--bt-r4); background: rgb(var(--bt-text-rgb) / .02); color: var(--bt-text-2); font: 500 12.5px/1 var(--bt-ui); cursor: pointer;
|
border: 1px solid var(--bt-line-soft); border-radius: var(--bt-r4); background: rgb(var(--bt-text-rgb) / .02); color: var(--bt-text-2); font: 500 12.5px/1 var(--bt-ui); cursor: pointer;
|
||||||
transition: background-color var(--bt-t1) var(--bt-ease), border-color var(--bt-t1) var(--bt-ease), color var(--bt-t1) var(--bt-ease), transform var(--bt-t2) var(--bt-ease-out);
|
transition: background-color var(--bt-t1) var(--bt-ease), border-color var(--bt-t1) var(--bt-ease), color var(--bt-t1) var(--bt-ease), transform var(--bt-t2) var(--bt-ease-out);
|
||||||
}
|
}
|
||||||
.bt-start-link-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: calc(11px * var(--bt-rs, 1)); background: var(--bt-field); box-shadow: inset 0 0 0 1px rgb(var(--bt-text-rgb) / .05); color: var(--bt-muted); transition: background-color var(--bt-t1) var(--bt-ease), color var(--bt-t1) var(--bt-ease); }
|
.bt-start-link-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--bt-field); box-shadow: inset 0 0 0 1px rgb(var(--bt-text-rgb) / .05); color: var(--bt-muted); transition: background-color var(--bt-t1) var(--bt-ease), color var(--bt-t1) var(--bt-ease); }
|
||||||
.bt-start-link-icon .bt-glyph { width: 18px; height: 18px; }
|
.bt-start-link-icon .bt-glyph { width: 18px; height: 18px; }
|
||||||
.bt-start-link-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
.bt-start-link-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
.bt-start-link:hover { background: rgb(var(--bt-text-rgb) / .045); border-color: var(--bt-line); color: var(--bt-text); transform: translateY(-1px); }
|
.bt-start-link:hover { background: rgb(var(--bt-text-rgb) / .045); border-color: var(--bt-line); color: var(--bt-text); transform: translateY(-1px); }
|
||||||
.bt-start-link:hover .bt-start-link-icon { background: var(--bt-accent-soft); color: var(--bt-accent-ink); }
|
.bt-start-link:hover .bt-start-link-icon { background: var(--bt-accent-soft); color: var(--bt-accent-ink); }
|
||||||
.bt-start-link:active { transform: translateY(0) scale(.985); }
|
.bt-start-link:active { transform: translateY(0) scale(.985); }
|
||||||
.bt-start-recent { list-style: none; margin: 0; padding: 4px; border: 1px solid var(--bt-line-soft); border-radius: var(--bt-r4); background: rgb(var(--bt-text-rgb) / .015); }
|
.bt-start-recent { list-style: none; margin: 0; padding: 4px; border: 1px solid var(--bt-line-soft); border-radius: var(--bt-r4); background: rgb(var(--bt-text-rgb) / .015); }
|
||||||
.bt-start-row { display: flex; align-items: center; gap: 11px; width: 100%; height: 38px; padding: 0 10px; box-sizing: border-box; border: 0; border-radius: calc(8px * var(--bt-rs, 1)); background: transparent; color: var(--bt-text-2); font: 500 13px/1 var(--bt-ui); text-align: start; cursor: pointer; transition: background-color 80ms var(--bt-ease), color 80ms var(--bt-ease); }
|
.bt-start-row { display: flex; align-items: center; gap: 11px; width: 100%; height: 38px; padding: 0 10px; box-sizing: border-box; border: 0; border-radius: 8px; background: transparent; color: var(--bt-text-2); font: 500 13px/1 var(--bt-ui); text-align: start; cursor: pointer; transition: background-color 80ms var(--bt-ease), color 80ms var(--bt-ease); }
|
||||||
.bt-start-row:hover { background: var(--bt-hover); color: var(--bt-text); }
|
.bt-start-row:hover { background: var(--bt-hover); color: var(--bt-text); }
|
||||||
.bt-start-row-icon { display: grid; place-items: center; width: 16px; height: 16px; flex: none; border-radius: calc(4px * var(--bt-rs, 1)); color: var(--bt-muted); }
|
.bt-start-row-icon { display: grid; place-items: center; width: 16px; height: 16px; flex: none; border-radius: 4px; color: var(--bt-muted); }
|
||||||
.bt-start-row-icon .bt-glyph { width: 15px; height: 15px; }
|
.bt-start-row-icon .bt-glyph { width: 15px; height: 15px; }
|
||||||
.bt-start-row-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
.bt-start-row-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
.bt-start-row-host { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--bt-faint); font: 400 11.5px/1 var(--bt-mono); }
|
.bt-start-row-host { flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--bt-faint); font: 400 11.5px/1 var(--bt-mono); }
|
||||||
|
|
@ -566,8 +561,8 @@ html.bt-raised .bt-deck :is(.bt-col-head, .bt-compose-head) { background-color:
|
||||||
.bt-media { width: min(380px, 100%); height: 100%; display: flex; flex-direction: column; background: var(--bt-raised); border-inline-start: 1px solid var(--bt-line); box-shadow: -24px 0 60px rgba(0, 0, 0, .45); font: 14px/1.3 var(--bt-ui); color: var(--bt-text); animation: bt-slide-in var(--bt-t2) var(--bt-ease-out); }
|
.bt-media { width: min(380px, 100%); height: 100%; display: flex; flex-direction: column; background: var(--bt-raised); border-inline-start: 1px solid var(--bt-line); box-shadow: -24px 0 60px rgba(0, 0, 0, .45); font: 14px/1.3 var(--bt-ui); color: var(--bt-text); animation: bt-slide-in var(--bt-t2) var(--bt-ease-out); }
|
||||||
[dir="rtl"] .bt-media { box-shadow: 24px 0 60px rgba(0, 0, 0, .45); animation-name: bt-slide-in-rtl; }
|
[dir="rtl"] .bt-media { box-shadow: 24px 0 60px rgba(0, 0, 0, .45); animation-name: bt-slide-in-rtl; }
|
||||||
.bt-media-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 52px; padding-block: 0; padding-inline: 12px 10px; box-sizing: border-box; border-bottom: 1px solid var(--bt-line); }
|
.bt-media-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 52px; padding-block: 0; padding-inline: 12px 10px; box-sizing: border-box; border-bottom: 1px solid var(--bt-line); }
|
||||||
.bt-media-tabs { display: flex; gap: 2px; padding: 3px; border-radius: calc(10px * var(--bt-rs, 1)); background: rgb(var(--bt-text-rgb) / .045); }
|
.bt-media-tabs { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: rgb(var(--bt-text-rgb) / .045); }
|
||||||
.bt-media-tabs button { height: 28px; padding: 0 12px; border: 0; border-radius: calc(7px * var(--bt-rs, 1)); background: transparent; color: var(--bt-muted); font: 500 12.5px/1 var(--bt-ui); cursor: pointer; transition: background-color var(--bt-t1) var(--bt-ease), color var(--bt-t1) var(--bt-ease); }
|
.bt-media-tabs button { height: 28px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--bt-muted); font: 500 12.5px/1 var(--bt-ui); cursor: pointer; transition: background-color var(--bt-t1) var(--bt-ease), color var(--bt-t1) var(--bt-ease); }
|
||||||
.bt-media-tabs button:hover { color: var(--bt-text-2); }
|
.bt-media-tabs button:hover { color: var(--bt-text-2); }
|
||||||
.bt-media-tabs button.active { color: var(--bt-text); background: var(--bt-raised-2); box-shadow: inset 0 0 0 1px rgb(var(--bt-text-rgb) / .07), 0 1px 2px rgba(0, 0, 0, .4); }
|
.bt-media-tabs button.active { color: var(--bt-text); background: var(--bt-raised-2); box-shadow: inset 0 0 0 1px rgb(var(--bt-text-rgb) / .07), 0 1px 2px rgba(0, 0, 0, .4); }
|
||||||
.bt-media .bt-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; }
|
.bt-media .bt-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; }
|
||||||
|
|
@ -576,33 +571,33 @@ html.bt-raised .bt-deck :is(.bt-col-head, .bt-compose-head) { background-color:
|
||||||
.bt-media-empty { color: var(--bt-muted); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding: 12px 2px; }
|
.bt-media-empty { color: var(--bt-muted); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding: 12px 2px; }
|
||||||
.bt-media-empty p { margin: 0; }
|
.bt-media-empty p { margin: 0; }
|
||||||
.bt-media-folders { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
|
.bt-media-folders { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
|
||||||
.bt-media-link { border: 0; background: transparent; color: var(--bt-muted); cursor: pointer; font: 600 12px/1 var(--bt-ui); padding: 4px 6px; border-radius: calc(6px * var(--bt-rs, 1)); }
|
.bt-media-link { border: 0; background: transparent; color: var(--bt-muted); cursor: pointer; font: 600 12px/1 var(--bt-ui); padding: 4px 6px; border-radius: 6px; }
|
||||||
.bt-media-link:hover { color: var(--bt-text); background: var(--bt-hover); }
|
.bt-media-link:hover { color: var(--bt-text); background: var(--bt-hover); }
|
||||||
.bt-media-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
|
.bt-media-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
|
||||||
.bt-media-tile { position: relative; aspect-ratio: 1; padding: 0; border: 1px solid var(--bt-line-soft); border-radius: var(--bt-r2); overflow: hidden; background: rgb(var(--bt-text-rgb) / .03); cursor: pointer; transition: border-color var(--bt-t1) var(--bt-ease), transform var(--bt-t2) var(--bt-ease-out); }
|
.bt-media-tile { position: relative; aspect-ratio: 1; padding: 0; border: 1px solid var(--bt-line-soft); border-radius: var(--bt-r2); overflow: hidden; background: rgb(var(--bt-text-rgb) / .03); cursor: pointer; transition: border-color var(--bt-t1) var(--bt-ease), transform var(--bt-t2) var(--bt-ease-out); }
|
||||||
.bt-media-tile:hover, .bt-media-tile:focus-visible { border-color: rgb(var(--bt-text-rgb) / .5); outline: none; transform: scale(1.02); }
|
.bt-media-tile:hover, .bt-media-tile:focus-visible { border-color: rgb(var(--bt-text-rgb) / .5); outline: none; transform: scale(1.02); }
|
||||||
.bt-media-tile img, .bt-media-clip-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
|
.bt-media-tile img, .bt-media-clip-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
|
||||||
.bt-media-thumb-empty { display: block; width: 100%; height: 100%; }
|
.bt-media-thumb-empty { display: block; width: 100%; height: 100%; }
|
||||||
.bt-media-caption { position: absolute; inset-inline-end: 4px; bottom: 4px; padding: 2px 5px; border-radius: calc(5px * var(--bt-rs, 1)); background: rgba(0, 0, 0, .62); color: #fff; font: 500 10.5px/1.3 var(--bt-mono); }
|
.bt-media-caption { position: absolute; inset-inline-end: 4px; bottom: 4px; padding: 2px 5px; border-radius: 5px; background: rgba(0, 0, 0, .62); color: #fff; font: 500 10.5px/1.3 var(--bt-mono); }
|
||||||
.bt-media-clips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
|
.bt-media-clips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
|
||||||
.bt-media-clip { display: flex; align-items: center; gap: 4px; }
|
.bt-media-clip { display: flex; align-items: center; gap: 4px; }
|
||||||
.bt-media-clip-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; border-radius: var(--bt-r2); background: transparent; color: var(--bt-text); text-align: start; cursor: pointer; font: inherit; font-size: 13px; }
|
.bt-media-clip-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; border-radius: var(--bt-r2); background: transparent; color: var(--bt-text); text-align: start; cursor: pointer; font: inherit; font-size: 13px; }
|
||||||
.bt-media-clip-main:hover, .bt-media-clip-main:focus-visible { background: var(--bt-hover); outline: none; }
|
.bt-media-clip-main:hover, .bt-media-clip-main:focus-visible { background: var(--bt-hover); outline: none; }
|
||||||
.bt-media-clip-main small { margin-inline-start: auto; color: var(--bt-faint); font: 500 11px/1 var(--bt-mono); }
|
.bt-media-clip-main small { margin-inline-start: auto; color: var(--bt-faint); font: 500 11px/1 var(--bt-mono); }
|
||||||
.bt-media-clip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
.bt-media-clip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
.bt-media-clip-thumb { width: 48px; height: 48px; flex: none; border-radius: calc(7px * var(--bt-rs, 1)); overflow: hidden; }
|
.bt-media-clip-thumb { width: 48px; height: 48px; flex: none; border-radius: 7px; overflow: hidden; }
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------------------------
|
/* ------------------------------------------------------------------------------------------------
|
||||||
* Link drag (a link dragged out of a tab, or in from another app): drop zones with labels. */
|
* Link drag (a link dragged out of a tab, or in from another app): drop zones with labels. */
|
||||||
.bt-shell--link-drag .dv-drop-target > .dv-drop-target-dropzone > .dv-drop-target-selection,
|
.bt-shell--link-drag .dv-drop-target > .dv-drop-target-dropzone > .dv-drop-target-selection,
|
||||||
.bt-shell--link-drag .dv-drop-target-container .dv-drop-target-anchor {
|
.bt-shell--link-drag .dv-drop-target-container .dv-drop-target-anchor {
|
||||||
display: grid; place-items: center; overflow: hidden; box-sizing: border-box;
|
display: grid; place-items: center; overflow: hidden; box-sizing: border-box;
|
||||||
background: rgb(var(--bt-accent-rgb) / .1); border: 1.5px solid rgb(var(--bt-accent-rgb) / .85); border-radius: calc(12px * var(--bt-rs, 1));
|
background: rgb(var(--bt-accent-rgb) / .1); border: 1.5px solid rgb(var(--bt-accent-rgb) / .85); border-radius: 12px;
|
||||||
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04), inset 0 0 60px rgb(var(--bt-accent-rgb) / .12);
|
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04), inset 0 0 60px rgb(var(--bt-accent-rgb) / .12);
|
||||||
}
|
}
|
||||||
.bt-shell--link-drag .dv-drop-target-selection::after,
|
.bt-shell--link-drag .dv-drop-target-selection::after,
|
||||||
.bt-shell--link-drag .dv-drop-target-anchor::after {
|
.bt-shell--link-drag .dv-drop-target-anchor::after {
|
||||||
content: 'Open as tab'; padding: 8px 13px; border-radius: calc(999px * var(--bt-rs, 1)); background: var(--bt-raised); color: var(--bt-text);
|
content: 'Open as tab'; padding: 8px 13px; border-radius: 999px; background: var(--bt-raised); color: var(--bt-text);
|
||||||
font: 600 12px/1 var(--bt-ui); letter-spacing: .01em; white-space: nowrap;
|
font: 600 12px/1 var(--bt-ui); letter-spacing: .01em; white-space: nowrap;
|
||||||
box-shadow: inset 0 0 0 1px var(--bt-line-strong), 0 10px 30px -10px rgba(0, 0, 0, .8);
|
box-shadow: inset 0 0 0 1px var(--bt-line-strong), 0 10px 30px -10px rgba(0, 0, 0, .8);
|
||||||
animation: bt-pop-in var(--bt-t2) var(--bt-ease-out);
|
animation: bt-pop-in var(--bt-t2) var(--bt-ease-out);
|
||||||
|
|
@ -612,7 +607,7 @@ html.bt-raised .bt-deck :is(.bt-col-head, .bt-compose-head) { background-color:
|
||||||
.bt-shell--link-drag .dv-drop-target-selection.dv-drop-target-top::after, .bt-shell--link-drag .dv-drop-target-anchor.dv-drop-target-top::after { content: '\2191 Split up'; }
|
.bt-shell--link-drag .dv-drop-target-selection.dv-drop-target-top::after, .bt-shell--link-drag .dv-drop-target-anchor.dv-drop-target-top::after { content: '\2191 Split up'; }
|
||||||
.bt-shell--link-drag .dv-drop-target-selection.dv-drop-target-bottom::after, .bt-shell--link-drag .dv-drop-target-anchor.dv-drop-target-bottom::after { content: '\2193 Split down'; }
|
.bt-shell--link-drag .dv-drop-target-selection.dv-drop-target-bottom::after, .bt-shell--link-drag .dv-drop-target-anchor.dv-drop-target-bottom::after { content: '\2193 Split down'; }
|
||||||
/* Tab strip and the empty titlebar part of it: a new tab in that group. */
|
/* Tab strip and the empty titlebar part of it: a new tab in that group. */
|
||||||
.bt-shell--link-drag .dv-tabs-and-actions-container .dv-drop-target-selection { border-radius: calc(8px * var(--bt-rs, 1)); }
|
.bt-shell--link-drag .dv-tabs-and-actions-container .dv-drop-target-selection { border-radius: 8px; }
|
||||||
.bt-shell--link-drag .dv-tabs-and-actions-container .dv-drop-target-selection::after { content: '+ New tab'; padding: 4px 9px; font-size: 11px; }
|
.bt-shell--link-drag .dv-tabs-and-actions-container .dv-drop-target-selection::after { content: '+ New tab'; padding: 4px 9px; font-size: 11px; }
|
||||||
.bt-shell--link-drag .dv-drop-target-small-vertical::after,
|
.bt-shell--link-drag .dv-drop-target-small-vertical::after,
|
||||||
.bt-shell--link-drag .dv-drop-target-small-horizontal::after { content: none; }
|
.bt-shell--link-drag .dv-drop-target-small-horizontal::after { content: none; }
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import { setChromeIconPack } from './iconPack.tsx';
|
||||||
import type { DockviewApi } from 'dockview';
|
import type { DockviewApi } from 'dockview';
|
||||||
import { BOOT_CACHE_KEY } from './boot.ts';
|
import { BOOT_CACHE_KEY } from './boot.ts';
|
||||||
import { invoke } from './bridge.ts';
|
import { invoke } from './bridge.ts';
|
||||||
import { CHROME_VAR_NAMES, chromeEdges, chromeVars, type ChromeTheme } from './chromeTheme.ts';
|
import { CHROME_VAR_NAMES, chromeVars, type ChromeTheme } from './chromeTheme.ts';
|
||||||
import { SCOPES_DEFAULT, normalizeScopes, prunePanes, themeIdFor, type ScopeSource, type ThemeScopes } from './themeScopes.ts';
|
import { SCOPES_DEFAULT, normalizeScopes, prunePanes, themeIdFor, type ScopeSource, type ThemeScopes } from './themeScopes.ts';
|
||||||
import { safe } from './safeStore.ts';
|
import { safe } from './safeStore.ts';
|
||||||
import { shell, type TabParams } from './state.ts';
|
import { shell, type TabParams } from './state.ts';
|
||||||
|
|
@ -192,12 +192,6 @@ export function createThemeStore<Choice, Spec extends ThemeDoc>(adapter: ThemeAd
|
||||||
for (const [name, value] of Object.entries(vars)) element.style.setProperty(name, value);
|
for (const [name, value] of Object.entries(vars)) element.style.setProperty(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The window's edge style (frame/edges.css). Global only: a pane theme brings its colors, fonts and radii, not its edges. */
|
|
||||||
function setEdges(edges: string | null) {
|
|
||||||
if (edges) document.documentElement.dataset.wbEdges = edges;
|
|
||||||
else delete document.documentElement.dataset.wbEdges;
|
|
||||||
}
|
|
||||||
|
|
||||||
function chromeFontsFor(theme: Spec) {
|
function chromeFontsFor(theme: Spec) {
|
||||||
for (const family of adapter.googleFonts(theme, ['chrome', 'mono'])) if (isInstalled(family)) void ensureShellFont(family);
|
for (const family of adapter.googleFonts(theme, ['chrome', 'mono'])) if (isInstalled(family)) void ensureShellFont(family);
|
||||||
}
|
}
|
||||||
|
|
@ -207,14 +201,13 @@ export function createThemeStore<Choice, Spec extends ThemeDoc>(adapter: ThemeAd
|
||||||
if (typeof document === 'undefined') return;
|
if (typeof document === 'undefined') return;
|
||||||
// Safe mode: the frame's own look, whatever the theme (a theme may be what broke the chrome). The
|
// Safe mode: the frame's own look, whatever the theme (a theme may be what broke the chrome). The
|
||||||
// first-frame cache is left alone, so the next normal start paints the owner's theme again.
|
// first-frame cache is left alone, so the next normal start paints the owner's theme again.
|
||||||
if (safe.active) { setVars(document.documentElement, {}); setEdges(null); syncGroups(); return; }
|
if (safe.active) { setVars(document.documentElement, {}); syncGroups(); return; }
|
||||||
if (!state.ready) return;
|
if (!state.ready) return;
|
||||||
const own = state.scopes.chrome === 'own';
|
const own = state.scopes.chrome === 'own';
|
||||||
const global = state.preview ?? adapter.resolve(state.choice);
|
const global = state.preview ?? adapter.resolve(state.choice);
|
||||||
chromeFontsFor(global);
|
chromeFontsFor(global);
|
||||||
const vars = chromeVars(adapter.chrome(global), own);
|
const vars = chromeVars(adapter.chrome(global), own);
|
||||||
setVars(document.documentElement, vars);
|
setVars(document.documentElement, vars);
|
||||||
setEdges(chromeEdges(vars));
|
|
||||||
try { setChromeIconPack(own ? null : adapter.iconPack?.(global, state.choice) ?? null); } catch { setChromeIconPack(null); }
|
try { setChromeIconPack(own ? null : adapter.iconPack?.(global, state.choice) ?? null); } catch { setChromeIconPack(null); }
|
||||||
// The next start paints these from its first frame (boot.ts); an editor's draft is not kept.
|
// The next start paints these from its first frame (boot.ts); an editor's draft is not kept.
|
||||||
if (!state.preview) { try { localStorage.setItem(BOOT_CACHE_KEY, JSON.stringify(vars)); } catch { /* Best effort. */ } }
|
if (!state.preview) { try { localStorage.setItem(BOOT_CACHE_KEY, JSON.stringify(vars)); } catch { /* Best effort. */ } }
|
||||||
|
|
@ -235,19 +228,13 @@ export function createThemeStore<Choice, Spec extends ThemeDoc>(adapter: ThemeAd
|
||||||
if (scoped && scoped.source !== 'global') {
|
if (scoped && scoped.source !== 'global') {
|
||||||
chromeFontsFor(scoped.theme);
|
chromeFontsFor(scoped.theme);
|
||||||
element.classList.add('wb-pane-theme');
|
element.classList.add('wb-pane-theme');
|
||||||
const vars = chromeVars(adapter.chrome(scoped.theme));
|
setVars(element, chromeVars(adapter.chrome(scoped.theme)));
|
||||||
setVars(element, vars);
|
|
||||||
element.dataset.wbTheme = scoped.id;
|
element.dataset.wbTheme = scoped.id;
|
||||||
// A pane's edges are its own theme's (edges.css: `.dv-groupview.wb-bevel`).
|
} else if (element.classList.contains('wb-pane-theme')) {
|
||||||
element.classList.toggle('wb-bevel', chromeEdges(vars) === 'bevel');
|
|
||||||
} else {
|
|
||||||
if (element.classList.contains('wb-pane-theme')) {
|
|
||||||
element.classList.remove('wb-pane-theme');
|
element.classList.remove('wb-pane-theme');
|
||||||
setVars(element, {});
|
setVars(element, {});
|
||||||
delete element.dataset.wbTheme;
|
delete element.dataset.wbTheme;
|
||||||
}
|
}
|
||||||
element.classList.toggle('wb-bevel', !own && !safe.active && document.documentElement.dataset.wbEdges === 'bevel');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
.bt-ws-button {
|
.bt-ws-button {
|
||||||
display: inline-flex; align-items: center; gap: 7px; height: 30px; max-width: 170px; padding-block: 0; padding-inline: 8px 10px; box-sizing: border-box;
|
display: inline-flex; align-items: center; gap: 7px; height: 30px; max-width: 170px; padding-block: 0; padding-inline: 8px 10px; box-sizing: border-box;
|
||||||
border: 1px solid var(--bt-line-soft); border-radius: calc(15px * var(--bt-rs, 1)); background: rgb(var(--bt-text-rgb) / .035); color: var(--bt-text-2);
|
border: 1px solid var(--bt-line-soft); border-radius: 15px; background: rgb(var(--bt-text-rgb) / .035); color: var(--bt-text-2);
|
||||||
font: 500 12.5px/1 var(--bt-ui); cursor: pointer; transition: background-color var(--bt-t1) var(--bt-ease), border-color var(--bt-t1) var(--bt-ease), color var(--bt-t1) var(--bt-ease);
|
font: 500 12.5px/1 var(--bt-ui); cursor: pointer; transition: background-color var(--bt-t1) var(--bt-ease), border-color var(--bt-t1) var(--bt-ease), color var(--bt-t1) var(--bt-ease);
|
||||||
}
|
}
|
||||||
.bt-ws-button:not(:has(.bt-ws-button-name)) { width: 30px; padding: 0; justify-content: center; }
|
.bt-ws-button:not(:has(.bt-ws-button-name)) { width: 30px; padding: 0; justify-content: center; }
|
||||||
|
|
@ -19,16 +19,16 @@
|
||||||
.bt-ws-head { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; }
|
.bt-ws-head { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; }
|
||||||
.bt-ws-head strong { font: 600 13px/1.2 var(--bt-ui); color: var(--bt-text); }
|
.bt-ws-head strong { font: 600 13px/1.2 var(--bt-ui); color: var(--bt-text); }
|
||||||
.bt-ws-head span { font: 400 12px/1.35 var(--bt-ui); color: var(--bt-muted); }
|
.bt-ws-head span { font: 400 12px/1.35 var(--bt-ui); color: var(--bt-muted); }
|
||||||
.bt-ws-empty { margin: 2px 6px 6px; padding: 10px 12px; border-radius: calc(9px * var(--bt-rs, 1)); background: rgb(var(--bt-text-rgb) / .035); color: var(--bt-muted); font: 400 12.5px/1.45 var(--bt-ui); }
|
.bt-ws-empty { margin: 2px 6px 6px; padding: 10px 12px; border-radius: 9px; background: rgb(var(--bt-text-rgb) / .035); color: var(--bt-muted); font: 400 12.5px/1.45 var(--bt-ui); }
|
||||||
|
|
||||||
.bt-ws-row { position: relative; display: flex; align-items: center; border-radius: calc(10px * var(--bt-rs, 1)); }
|
.bt-ws-row { position: relative; display: flex; align-items: center; border-radius: 10px; }
|
||||||
.bt-ws-row.is-active { background: rgb(var(--bt-accent-rgb) / .08); box-shadow: inset 0 0 0 1px rgb(var(--bt-accent-rgb) / .22); }
|
.bt-ws-row.is-active { background: rgb(var(--bt-accent-rgb) / .08); box-shadow: inset 0 0 0 1px rgb(var(--bt-accent-rgb) / .22); }
|
||||||
.bt-ws-row.is-active::before { content: ''; position: absolute; inset-inline-start: -5px; top: 10px; height: 22px; width: 3px; border-start-start-radius: 0; border-start-end-radius: calc(3px * var(--bt-rs, 1)); border-end-end-radius: calc(3px * var(--bt-rs, 1)); border-end-start-radius: 0; background: var(--bt-accent); }
|
.bt-ws-row.is-active::before { content: ''; position: absolute; inset-inline-start: -5px; top: 10px; height: 22px; width: 3px; border-start-start-radius: 0; border-start-end-radius: 3px; border-end-end-radius: 3px; border-end-start-radius: 0; background: var(--bt-accent); }
|
||||||
.bt-menu .bt-ws-main { flex: 1; min-width: 0; height: auto; flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px 10px; border-radius: calc(10px * var(--bt-rs, 1)); }
|
.bt-menu .bt-ws-main { flex: 1; min-width: 0; height: auto; flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px 10px; border-radius: 10px; }
|
||||||
.bt-menu .bt-ws-main:focus-visible, .bt-menu .bt-ws-save:focus-visible { box-shadow: var(--bt-ring); }
|
.bt-menu .bt-ws-main:focus-visible, .bt-menu .bt-ws-save:focus-visible { box-shadow: var(--bt-ring); }
|
||||||
.bt-ws-name { display: flex; align-items: center; gap: 6px; max-width: 100%; font: 600 13.5px/1.15 var(--bt-ui); color: var(--bt-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
.bt-ws-name { display: flex; align-items: center; gap: 6px; max-width: 100%; font: 600 13.5px/1.15 var(--bt-ui); color: var(--bt-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
.bt-ws-meta { font: 400 12px/1.2 var(--bt-ui); color: var(--bt-muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
|
.bt-ws-meta { font: 400 12px/1.2 var(--bt-ui); color: var(--bt-muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
|
||||||
.bt-ws-badge { flex: none; padding: 2px 6px; border-radius: calc(999px * var(--bt-rs, 1)); background: rgb(var(--bt-accent-rgb) / .14); color: var(--bt-accent-ink); font: 500 10.5px/1.2 var(--bt-ui); }
|
.bt-ws-badge { flex: none; padding: 2px 6px; border-radius: 999px; background: rgb(var(--bt-accent-rgb) / .14); color: var(--bt-accent-ink); font: 500 10.5px/1.2 var(--bt-ui); }
|
||||||
|
|
||||||
.bt-ws-actions { display: flex; gap: 1px; padding-inline-end: 4px; opacity: 0; transition: opacity var(--bt-t1) var(--bt-ease); }
|
.bt-ws-actions { display: flex; gap: 1px; padding-inline-end: 4px; opacity: 0; transition: opacity var(--bt-t1) var(--bt-ease); }
|
||||||
.bt-ws-row:hover .bt-ws-actions, .bt-ws-row:focus-within .bt-ws-actions, .bt-ws-row.is-active .bt-ws-actions { opacity: 1; }
|
.bt-ws-row:hover .bt-ws-actions, .bt-ws-row:focus-within .bt-ws-actions, .bt-ws-row.is-active .bt-ws-actions { opacity: 1; }
|
||||||
|
|
@ -36,8 +36,8 @@
|
||||||
.bt-menu .bt-ws-icon .bt-glyph { width: 14px; height: 14px; }
|
.bt-menu .bt-ws-icon .bt-glyph { width: 14px; height: 14px; }
|
||||||
.bt-menu .bt-ws-icon[aria-pressed=true] { color: var(--bt-accent-ink); }
|
.bt-menu .bt-ws-icon[aria-pressed=true] { color: var(--bt-accent-ink); }
|
||||||
|
|
||||||
.bt-menu .bt-ws-save { height: auto; gap: 11px; padding: 8px; border-radius: calc(10px * var(--bt-rs, 1)); }
|
.bt-menu .bt-ws-save { height: auto; gap: 11px; padding: 8px; border-radius: 10px; }
|
||||||
.bt-ws-save-icon { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: calc(9px * var(--bt-rs, 1)); box-shadow: inset 0 0 0 1px var(--bt-line-strong); color: var(--bt-muted); }
|
.bt-ws-save-icon { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 9px; box-shadow: inset 0 0 0 1px var(--bt-line-strong); color: var(--bt-muted); }
|
||||||
.bt-ws-save-icon .bt-glyph { width: 15px; height: 15px; }
|
.bt-ws-save-icon .bt-glyph { width: 15px; height: 15px; }
|
||||||
.bt-menu .bt-ws-save:hover .bt-ws-save-icon { box-shadow: inset 0 0 0 1px rgb(var(--bt-accent-rgb) / .6); color: var(--bt-accent-ink); }
|
.bt-menu .bt-ws-save:hover .bt-ws-save-icon { box-shadow: inset 0 0 0 1px rgb(var(--bt-accent-rgb) / .6); color: var(--bt-accent-ink); }
|
||||||
.bt-ws-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
|
.bt-ws-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
|
||||||
|
|
@ -45,7 +45,7 @@
|
||||||
|
|
||||||
.bt-ws-form { display: flex; gap: 6px; padding: 6px; }
|
.bt-ws-form { display: flex; gap: 6px; padding: 6px; }
|
||||||
.bt-ws-input {
|
.bt-ws-input {
|
||||||
flex: 1; min-width: 0; height: 30px; padding: 0 10px; box-sizing: border-box; border: 1px solid var(--bt-line-strong); border-radius: calc(8px * var(--bt-rs, 1));
|
flex: 1; min-width: 0; height: 30px; padding: 0 10px; box-sizing: border-box; border: 1px solid var(--bt-line-strong); border-radius: 8px;
|
||||||
background: var(--bt-field); color: var(--bt-text); font: 500 13px/1 var(--bt-ui); outline: 0;
|
background: var(--bt-field); color: var(--bt-text); font: 500 13px/1 var(--bt-ui); outline: 0;
|
||||||
}
|
}
|
||||||
.bt-ws-input:focus { border-color: rgb(var(--bt-accent-rgb) / .6); box-shadow: 0 0 0 3px rgb(var(--bt-accent-rgb) / .14); }
|
.bt-ws-input:focus { border-color: rgb(var(--bt-accent-rgb) / .6); box-shadow: 0 0 0 3px rgb(var(--bt-accent-rgb) / .14); }
|
||||||
|
|
@ -54,7 +54,7 @@
|
||||||
.bt-menu .bt-ws-primary:disabled { background: var(--bt-hover); color: var(--bt-faint); }
|
.bt-menu .bt-ws-primary:disabled { background: var(--bt-hover); color: var(--bt-faint); }
|
||||||
|
|
||||||
.bt-ws-confirm {
|
.bt-ws-confirm {
|
||||||
display: flex; flex-direction: column; gap: 10px; margin: 2px 6px 6px; padding: 10px 12px; border-radius: calc(9px * var(--bt-rs, 1));
|
display: flex; flex-direction: column; gap: 10px; margin: 2px 6px 6px; padding: 10px 12px; border-radius: 9px;
|
||||||
background: rgba(229, 72, 77, .08); box-shadow: inset 0 0 0 1px rgba(229, 72, 77, .25); color: var(--bt-text-2); font: 400 12.5px/1.45 var(--bt-ui);
|
background: rgba(229, 72, 77, .08); box-shadow: inset 0 0 0 1px rgba(229, 72, 77, .25); color: var(--bt-text-2); font: 400 12.5px/1.45 var(--bt-ui);
|
||||||
}
|
}
|
||||||
.bt-ws-confirm strong { color: var(--bt-text); font-weight: 600; }
|
.bt-ws-confirm strong { color: var(--bt-text); font-weight: 600; }
|
||||||
|
|
@ -63,12 +63,12 @@
|
||||||
.bt-menu .bt-ws-danger { background: var(--bt-danger); color: #fff; }
|
.bt-menu .bt-ws-danger { background: var(--bt-danger); color: #fff; }
|
||||||
.bt-menu .bt-ws-danger:hover:not(:disabled) { background: #d93d42; }
|
.bt-menu .bt-ws-danger:hover:not(:disabled) { background: #d93d42; }
|
||||||
.bt-menu .bt-ws-cancel { background: var(--bt-hover); }
|
.bt-menu .bt-ws-cancel { background: var(--bt-hover); }
|
||||||
.bt-ws-error { padding: 6px 10px; color: var(--bt-danger-ink); font: 12px/1.4 var(--bt-ui); }
|
.bt-ws-error { padding: 6px 10px; color: #ff8a80; font: 12px/1.4 var(--bt-ui); }
|
||||||
|
|
||||||
/* Quiet chips: only while there is something to say. */
|
/* Quiet chips: only while there is something to say. */
|
||||||
.bt-tb-chip {
|
.bt-tb-chip {
|
||||||
display: inline-flex; align-items: center; gap: 7px; height: 28px; max-width: 220px; padding-block: 0; padding-inline: 9px 11px; box-sizing: border-box;
|
display: inline-flex; align-items: center; gap: 7px; height: 28px; max-width: 220px; padding-block: 0; padding-inline: 9px 11px; box-sizing: border-box;
|
||||||
border: 1px solid var(--bt-line-soft); border-radius: calc(14px * var(--bt-rs, 1)); background: rgb(var(--bt-text-rgb) / .035); color: var(--bt-text-2);
|
border: 1px solid var(--bt-line-soft); border-radius: 14px; background: rgb(var(--bt-text-rgb) / .035); color: var(--bt-text-2);
|
||||||
font: 500 12px/1 var(--bt-ui); white-space: nowrap; cursor: pointer; transition: background-color var(--bt-t1) var(--bt-ease), border-color var(--bt-t1) var(--bt-ease);
|
font: 500 12px/1 var(--bt-ui); white-space: nowrap; cursor: pointer; transition: background-color var(--bt-t1) var(--bt-ease), border-color var(--bt-t1) var(--bt-ease);
|
||||||
}
|
}
|
||||||
.bt-tb-chip:hover { background: var(--bt-hover); border-color: var(--bt-line-strong); color: var(--bt-text); }
|
.bt-tb-chip:hover { background: var(--bt-hover); border-color: var(--bt-line-strong); color: var(--bt-text); }
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
// The install screen's state machine, shared by every wayBetter app. Requests come from
|
// The install screen's state machine, shared by every wayBetter app. Requests come from
|
||||||
// `waybetter://install` links (the native `install-link` event, plus links that arrived before the
|
// `waybetter://install` links (the native `install-link` event, plus links that arrived before the
|
||||||
// shell listened), files dropped on the window, files the OS handed over ("Open with") and the Store view. Each request is staged natively
|
// shell listened), files dropped on the window and the Store view. Each request is staged natively
|
||||||
// (downloaded/validated, hashed) and shown on the install screen; nothing is written until the owner
|
// (downloaded/validated, hashed) and shown on the install screen; nothing is written until the owner
|
||||||
// presses Install there. The app supplies how it talks to native code (Tauri `invoke`/`listen`) and
|
// presses Install there. The app supplies how it talks to native code (Tauri `invoke`/`listen`) and
|
||||||
// how its themes are parsed and saved; plugins need nothing app-specific.
|
// how its themes are parsed and saved; plugins need nothing app-specific.
|
||||||
|
|
||||||
import { parseIconPackJson, type IconPack } from '../../runtime/src/themeIcons.ts';
|
import { freeThemeId, installedThemeId, kindForFile, MAX_FILE_BYTES, errorText, type InstallKind, type InstallPreview, type InstallRecord, type LinkEvent, type StoreItem } from './storeModel.ts';
|
||||||
import { freeThemeId, installedThemeId, kindForFile, MAX_FILE_BYTES, errorText, type InstallKind, type InstallPreview, type InstallRecord, type LinkEvent, type OpenedFile, type StoreItem } from './storeModel.ts';
|
|
||||||
import type { StoreText } from './storeMessages.ts';
|
import type { StoreText } from './storeMessages.ts';
|
||||||
|
|
||||||
/** How the controller reaches native code (the app passes Tauri's `invoke` and `listen`). */
|
/** How the controller reaches native code (the app passes Tauri's `invoke` and `listen`). */
|
||||||
|
|
@ -47,8 +46,8 @@ export type ThemeAdapter<Theme> = {
|
||||||
|
|
||||||
export type InstallRequest<Theme> =
|
export type InstallRequest<Theme> =
|
||||||
| { status: 'loading'; title: string; detail: string }
|
| { status: 'loading'; title: string; detail: string }
|
||||||
| { status: 'ready'; preview: InstallPreview; theme: Theme | null; warnings: string[]; replaces: string | null; pack?: IconPack | null }
|
| { status: 'ready'; preview: InstallPreview; theme: Theme | null; warnings: string[]; replaces: string | null }
|
||||||
| { status: 'installing'; preview: InstallPreview; theme: Theme | null; pack?: IconPack | null }
|
| { status: 'installing'; preview: InstallPreview; theme: Theme | null }
|
||||||
| { status: 'done'; kind: InstallKind; name: string; themeId?: string; fonts: string[]; enabled: boolean }
|
| { status: 'done'; kind: InstallKind; name: string; themeId?: string; fonts: string[]; enabled: boolean }
|
||||||
| { status: 'error'; title: string; message: string };
|
| { status: 'error'; title: string; message: string };
|
||||||
|
|
||||||
|
|
@ -63,12 +62,6 @@ export type InstallControllerOptions<Theme> = {
|
||||||
onPluginsChanged?(): void;
|
onPluginsChanged?(): void;
|
||||||
/** A theme was installed (the app refreshes its store/theme views). */
|
/** A theme was installed (the app refreshes its store/theme views). */
|
||||||
onThemesChanged?(): void;
|
onThemesChanged?(): void;
|
||||||
/**
|
|
||||||
* Adds the icon pack the owner confirmed (already sanitized) to the app's icon packs, replacing
|
|
||||||
* one with the same id, and makes it the current pack when `enable`. Absent: icon packs cannot
|
|
||||||
* be installed (the screen says so).
|
|
||||||
*/
|
|
||||||
icons?: { save(pack: IconPack, options: { enable: boolean }): Promise<void> };
|
|
||||||
/** A string pack was installed (the app hands the site tabs the packs that are on). */
|
/** A string pack was installed (the app hands the site tabs the packs that are on). */
|
||||||
onStringsChanged?(): void | Promise<void>;
|
onStringsChanged?(): void | Promise<void>;
|
||||||
/**
|
/**
|
||||||
|
|
@ -85,8 +78,6 @@ export type InstallController<Theme> = {
|
||||||
requestLink(link: { kind: InstallKind; url: string }): Promise<void>;
|
requestLink(link: { kind: InstallKind; url: string }): Promise<void>;
|
||||||
/** A file dropped on the window. */
|
/** A file dropped on the window. */
|
||||||
requestFile(file: { name: string; size: number; text(): Promise<string> }): Promise<void>;
|
requestFile(file: { name: string; size: number; text(): Promise<string> }): Promise<void>;
|
||||||
/** A file the OS handed to the app ("Open with", double-click), asked for by its id: staged natively like a dropped file. */
|
|
||||||
requestOpened(file: OpenedFile): Promise<void>;
|
|
||||||
/** A store item: downloaded natively and checked against the signed catalog. */
|
/** A store item: downloaded natively and checked against the signed catalog. */
|
||||||
requestStoreItem(item: StoreItem): Promise<void>;
|
requestStoreItem(item: StoreItem): Promise<void>;
|
||||||
linkRejected(error: string): void;
|
linkRejected(error: string): void;
|
||||||
|
|
@ -115,12 +106,6 @@ export function createInstallController<Theme>(options: InstallControllerOptions
|
||||||
/** Parses a staged theme the way the app's import does, and finds the theme it would update. */
|
/** Parses a staged theme the way the app's import does, and finds the theme it would update. */
|
||||||
async function prepared(preview: InstallPreview): Promise<InstallRequest<Theme>> {
|
async function prepared(preview: InstallPreview): Promise<InstallRequest<Theme>> {
|
||||||
if (preview.kind === 'plugin' || preview.kind === 'strings') return { status: 'ready', preview, theme: null, warnings: [], replaces: null };
|
if (preview.kind === 'plugin' || preview.kind === 'strings') return { status: 'ready', preview, theme: null, warnings: [], replaces: null };
|
||||||
if (preview.kind === 'icons') {
|
|
||||||
if (!options.icons) return { status: 'error', title: t('wb.install.err.icons'), message: t('wb.install.err.iconsNone', { site: options.site }) };
|
|
||||||
const parsed = parseIconPackJson(preview.text);
|
|
||||||
if ('error' in parsed) return { status: 'error', title: t('wb.install.err.icons'), message: parsed.error };
|
|
||||||
return { status: 'ready', preview, theme: null, warnings: parsed.warnings, replaces: null, pack: parsed.pack };
|
|
||||||
}
|
|
||||||
const parsed = themes.parse(preview.text);
|
const parsed = themes.parse(preview.text);
|
||||||
if ('error' in parsed) return { status: 'error', title: t('wb.install.err.theme'), message: parsed.error };
|
if ('error' in parsed) return { status: 'error', title: t('wb.install.err.theme'), message: parsed.error };
|
||||||
const userThemes = await themes.userThemes();
|
const userThemes = await themes.userThemes();
|
||||||
|
|
@ -157,20 +142,16 @@ export function createInstallController<Theme>(options: InstallControllerOptions
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (file.size > MAX_FILE_BYTES[kind]) {
|
if (file.size > MAX_FILE_BYTES[kind]) {
|
||||||
set({ status: 'error', title: t('wb.install.err.large', { file: file.name }), message: kind === 'strings' ? t('wb.install.err.stringsLarge') : kind === 'icons' ? t('wb.install.err.iconsLarge') : t('wb.install.err.largeHint', { kind }) });
|
set({ status: 'error', title: t('wb.install.err.large', { file: file.name }), message: kind === 'strings' ? t('wb.install.err.stringsLarge') : t('wb.install.err.largeHint', { kind }) });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await stage(t('wb.install.stage.named', { name: file.name }), t('wb.install.stage.fileDetail'), async () => backend.invoke<InstallPreview>('install_stage_file', { name: file.name, text: await file.text() }));
|
await stage(t('wb.install.stage.named', { name: file.name }), t('wb.install.stage.fileDetail'), async () => backend.invoke<InstallPreview>('install_stage_file', { name: file.name, text: await file.text() }));
|
||||||
},
|
},
|
||||||
requestOpened(file) {
|
|
||||||
return stage(t('wb.install.stage.named', { name: file.name }), t('wb.install.stage.fileDetail'), () => backend.invoke<InstallPreview>('install_stage_opened', { id: file.id }));
|
|
||||||
},
|
|
||||||
requestStoreItem(item) {
|
requestStoreItem(item) {
|
||||||
return stage(t('wb.install.stage.named', { name: item.name }), t('wb.install.stage.storeDetail'), () => backend.invoke<InstallPreview>('store_stage', { item: { kind: item.kind, id: item.id } }));
|
return stage(t('wb.install.stage.named', { name: item.name }), t('wb.install.stage.storeDetail'), () => backend.invoke<InstallPreview>('store_stage', { item: { kind: item.kind, id: item.id } }));
|
||||||
},
|
},
|
||||||
linkRejected(error) {
|
linkRejected(error) {
|
||||||
// `FILE:` errors are about a file the OS handed over, `LINK:` ones about a link.
|
set({ status: 'error', title: t('wb.install.err.link'), message: error.replace(/^LINK: /, '') });
|
||||||
set({ status: 'error', title: error.startsWith('FILE: ') ? t('wb.install.err.opened') : t('wb.install.err.link'), message: error.replace(/^(LINK|FILE): /, '') });
|
|
||||||
},
|
},
|
||||||
async cancel() {
|
async cancel() {
|
||||||
const request = current;
|
const request = current;
|
||||||
|
|
@ -182,18 +163,8 @@ export function createInstallController<Theme>(options: InstallControllerOptions
|
||||||
const request = current;
|
const request = current;
|
||||||
if (!request || request.status !== 'ready') return;
|
if (!request || request.status !== 'ready') return;
|
||||||
const { preview } = request;
|
const { preview } = request;
|
||||||
set({ status: 'installing', preview, theme: request.theme, pack: request.pack });
|
set({ status: 'installing', preview, theme: request.theme });
|
||||||
try {
|
try {
|
||||||
if (preview.kind === 'icons') {
|
|
||||||
const outcome = await backend.invoke<{ iconsText: string | null }>('install_commit', { token: preview.token, enable, themeId: null });
|
|
||||||
// The exact bytes native code staged and hashed; parsed and sanitized again here.
|
|
||||||
const parsed = parseIconPackJson(outcome.iconsText ?? '');
|
|
||||||
if ('error' in parsed) throw new Error(parsed.error);
|
|
||||||
await options.icons!.save(parsed.pack, { enable });
|
|
||||||
options.onThemesChanged?.();
|
|
||||||
set({ status: 'done', kind: 'icons', name: parsed.pack.name, fonts: [], enabled: enable });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (preview.kind === 'plugin') {
|
if (preview.kind === 'plugin') {
|
||||||
await backend.invoke('install_commit', { token: preview.token, enable, themeId: null });
|
await backend.invoke('install_commit', { token: preview.token, enable, themeId: null });
|
||||||
options.onPluginsChanged?.();
|
options.onPluginsChanged?.();
|
||||||
|
|
@ -218,7 +189,7 @@ export function createInstallController<Theme>(options: InstallControllerOptions
|
||||||
options.onThemesChanged?.();
|
options.onThemesChanged?.();
|
||||||
set({ status: 'done', kind: 'theme', name: themes.facts(parsed.theme).name, themeId: id, fonts: saved.fonts, enabled: saved.enabled });
|
set({ status: 'done', kind: 'theme', name: themes.facts(parsed.theme).name, themeId: id, fonts: saved.fonts, enabled: saved.enabled });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
set({ status: 'error', title: preview.kind === 'strings' ? t('wb.install.err.stringsNotInstalled') : preview.kind === 'icons' ? t('wb.install.err.iconsNotInstalled') : t('wb.install.err.notInstalled', { kind: preview.kind }), message: errorText(error) });
|
set({ status: 'error', title: preview.kind === 'strings' ? t('wb.install.err.stringsNotInstalled') : t('wb.install.err.notInstalled', { kind: preview.kind }), message: errorText(error) });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
start() {
|
start() {
|
||||||
|
|
@ -227,7 +198,6 @@ export function createInstallController<Theme>(options: InstallControllerOptions
|
||||||
const handle = (event: LinkEvent) => {
|
const handle = (event: LinkEvent) => {
|
||||||
if (event.setup) options.onSetupLink?.(event.setup);
|
if (event.setup) options.onSetupLink?.(event.setup);
|
||||||
else if (event.link) void controller.requestLink(event.link);
|
else if (event.link) void controller.requestLink(event.link);
|
||||||
else if (event.opened) void controller.requestOpened(event.opened);
|
|
||||||
else if (event.error) controller.linkRejected(event.error);
|
else if (event.error) controller.linkRejected(event.error);
|
||||||
};
|
};
|
||||||
// Native code queues every link and also emits it; a handled event clears the queue so a
|
// Native code queues every link and also emits it; a handled event clears the queue so a
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,10 @@ import { ThemeDots } from '../frame/PaneTheme.tsx';
|
||||||
import { shell, type WebParams } from '../frame/state.ts';
|
import { shell, type WebParams } from '../frame/state.ts';
|
||||||
import { assign } from '../frame/themeScopes.ts';
|
import { assign } from '../frame/themeScopes.ts';
|
||||||
import { tabProfile } from '../profileModel.ts';
|
import { tabProfile } from '../profileModel.ts';
|
||||||
import { Badge, Button, ColorField, Row, Section, Segmented, Select, Slider, Toggle, useSettingsQuery, type Option } from './controls.tsx';
|
import { Button, ColorField, Row, Section, Segmented, Select, Slider, Toggle, useSettingsQuery, type Option } from './controls.tsx';
|
||||||
import { IconPackImport, IconPackReview } from './IconPackInstall.tsx';
|
import { IconPackImport, IconPackReview } from './IconPackInstall.tsx';
|
||||||
import type { IconPack } from '../../../runtime/src/themeIcons.ts';
|
import type { IconPack } from '../../../runtime/src/themeIcons.ts';
|
||||||
import { themeDoctor, type DoctorAdvice } from '../../../runtime/src/themeDoctor.ts';
|
import { themeDoctor } from '../../../runtime/src/themeDoctor.ts';
|
||||||
import { bytesLabel, defaultWeights, loadCatalog, weightsLabel } from './fonts/catalog.ts';
|
import { bytesLabel, defaultWeights, loadCatalog, weightsLabel } from './fonts/catalog.ts';
|
||||||
import { FontRoles } from './fonts/FontRoles.tsx';
|
import { FontRoles } from './fonts/FontRoles.tsx';
|
||||||
import { CustomCssEditor } from './Plugins.tsx';
|
import { CustomCssEditor } from './Plugins.tsx';
|
||||||
|
|
@ -283,8 +283,6 @@ export function Appearance({ notify }: { notify: Notify }) {
|
||||||
<ThemeCssEditor key={choice.preset} css={effective.css} onApply={text => { void override({ css: { text } }); notify(t('wb.appearance.cssApplied', { name: base.name })); }}/>
|
<ThemeCssEditor key={choice.preset} css={effective.css} onApply={text => { void override({ css: { text } }); notify(t('wb.appearance.cssApplied', { name: base.name })); }}/>
|
||||||
</Section>
|
</Section>
|
||||||
|
|
||||||
<DoctorReport theme={effective}/>
|
|
||||||
|
|
||||||
<Section title={t('wb.appearance.scopes')} id="theme-scopes" hint={searching ? undefined : t('wb.appearance.scopesHint')}>
|
<Section title={t('wb.appearance.scopes')} id="theme-scopes" hint={searching ? undefined : t('wb.appearance.scopesHint')}>
|
||||||
<Row label={t('wb.appearance.chrome')} hint={t('wb.appearance.chromeHint')}
|
<Row label={t('wb.appearance.chrome')} hint={t('wb.appearance.chromeHint')}
|
||||||
keywords="chrome window tabs titlebar panel colors own style">
|
keywords="chrome window tabs titlebar panel colors own style">
|
||||||
|
|
@ -301,24 +299,6 @@ export function Appearance({ notify }: { notify: Notify }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Theme choices for a scope row: follow (the level above) plus every theme with its swatch. */
|
/** Theme choices for a scope row: follow (the level above) plus every theme with its swatch. */
|
||||||
/** The theme doctor's full report on the theme as it is now: every finding, where it is, what it found, how to fix it. Advice only. */
|
|
||||||
function DoctorReport({ theme }: { theme: ThemeSpec }) {
|
|
||||||
const t = useT();
|
|
||||||
const advice = themeDoctor(theme);
|
|
||||||
const words = (item: DoctorAdvice, part: 'found' | 'fix') => t(`wb.doctor.${item.key}.${part}`, item.params);
|
|
||||||
return <Section title={t('wb.doctor.title')} id="theme-doctor" hint={t('wb.doctor.hint')} action={<Badge tone={advice.length ? undefined : 'ok'}>{t('wb.doctor.count', { count: advice.length })}</Badge>}>
|
|
||||||
{advice.length === 0
|
|
||||||
? <p className="btp-hint">{t('wb.doctor.empty')}</p>
|
|
||||||
: <ul className="bt-doctor" aria-label={t('wb.doctor.title')}>
|
|
||||||
{advice.map((item, index) => <li key={`${item.id}:${item.where}:${index}`} className={`bt-doctor-item is-${item.kind}`}>
|
|
||||||
<span className="bt-doctor-head"><Badge>{t(`wb.doctor.kind.${item.kind}`)}</Badge><strong>{words(item, 'found')}</strong></span>
|
|
||||||
<small className="bt-doctor-line">{t('wb.doctor.where')}: <code>{item.where}</code></small>
|
|
||||||
<small className="bt-doctor-line">{t('wb.doctor.fix')}: {words(item, 'fix')}</small>
|
|
||||||
</li>)}
|
|
||||||
</ul>}
|
|
||||||
</Section>;
|
|
||||||
}
|
|
||||||
|
|
||||||
function scopeOptions(follow: string): Array<Option<string>> {
|
function scopeOptions(follow: string): Array<Option<string>> {
|
||||||
// Called during render of components that use useT(), so the labels follow the language.
|
// Called during render of components that use useT(), so the labels follow the language.
|
||||||
return [{ value: '', label: follow }, ...panelThemes().store.allThemes().map(theme => ({ value: theme.id, label: theme.name, icon: <ThemeDots theme={theme}/> }))];
|
return [{ value: '', label: follow }, ...panelThemes().store.allThemes().map(theme => ({ value: theme.id, label: theme.name, icon: <ThemeDots theme={theme}/> }))];
|
||||||
|
|
@ -428,7 +408,7 @@ function ImportPanel({ onImport, onCancel }: { onImport(theme: ThemeSpec, warnin
|
||||||
if ('error' in parsed) { setError(parsed.error); return; }
|
if ('error' in parsed) { setError(parsed.error); return; }
|
||||||
// The theme doctor: advice only (never a block); contrast is already in the warnings.
|
// The theme doctor: advice only (never a block); contrast is already in the warnings.
|
||||||
const hints = themeDoctor(parsed.theme).filter(advice => advice.kind !== 'contrast');
|
const hints = themeDoctor(parsed.theme).filter(advice => advice.kind !== 'contrast');
|
||||||
onImport(parsed.theme, hints.length ? [...parsed.warnings, t('wb.appearance.doctorHints', { count: hints.length, hint: t(`wb.doctor.${hints[0]!.key}.found`, hints[0]!.params) })] : parsed.warnings);
|
onImport(parsed.theme, hints.length ? [...parsed.warnings, t('wb.appearance.doctorHints', { count: hints.length, hint: hints[0]!.text })] : parsed.warnings);
|
||||||
};
|
};
|
||||||
return <div className="bt-import">
|
return <div className="bt-import">
|
||||||
<div className="bt-import-drop" onDragOver={event => event.preventDefault()}
|
<div className="bt-import-drop" onDragOver={event => event.preventDefault()}
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,8 @@
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { invoke } from '../frame/bridge.ts';
|
import { invoke } from '../frame/bridge.ts';
|
||||||
import { useT } from '../frame/hooks.ts';
|
import { useT } from '../frame/hooks.ts';
|
||||||
import { CLIP_MAX_LIMIT, clampClipMax, folderLabel, mediaShortcutLabel, withoutFolder, type MediaSettings } from '../frame/mediaModel.ts';
|
import { CLIP_MAX_LIMIT, clampClipMax, folderLabel, withoutFolder, type MediaSettings } from '../frame/mediaModel.ts';
|
||||||
import { site } from '../frame/site.ts';
|
import { site } from '../frame/site.ts';
|
||||||
import { os } from '../windowControls.ts';
|
|
||||||
import { ChipList, Button, InputRow, Row, Section, Segmented, Stepper, Toggle } from './controls.tsx';
|
import { ChipList, Button, InputRow, Row, Section, Segmented, Stepper, Toggle } from './controls.tsx';
|
||||||
import { panelSite, type Notify } from './site.ts';
|
import { panelSite, type Notify } from './site.ts';
|
||||||
|
|
||||||
|
|
@ -107,7 +106,7 @@ export function AlertSettings({ notify }: { notify: Notify }) {
|
||||||
</Section>;
|
</Section>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gallery folders and the opt-in clipboard history for the Media panel. Native only. */
|
/** Gallery folders and the opt-in clipboard history for the Media panel (Ctrl+Shift+G). Native only. */
|
||||||
export function MediaSettingsRows({ notify }: { notify: Notify }) {
|
export function MediaSettingsRows({ notify }: { notify: Notify }) {
|
||||||
const t = useT();
|
const t = useT();
|
||||||
const [settings, setSettings] = useState<MediaSettings | null>(null);
|
const [settings, setSettings] = useState<MediaSettings | null>(null);
|
||||||
|
|
@ -129,7 +128,7 @@ export function MediaSettingsRows({ notify }: { notify: Notify }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!settings) return null;
|
if (!settings) return null;
|
||||||
return <Section title={t('wb.settings.media.title')} hint={t('wb.settings.media.hint', { shortcut: mediaShortcutLabel(os) })}>
|
return <Section title={t('wb.settings.media.title')} hint={t('wb.settings.media.hint')}>
|
||||||
<Row label={t('wb.settings.media.folders')} hint={t('wb.settings.media.foldersHint')} keywords="images pictures screenshots" wide>
|
<Row label={t('wb.settings.media.folders')} hint={t('wb.settings.media.foldersHint')} keywords="images pictures screenshots" wide>
|
||||||
<div className="bt-stack">
|
<div className="bt-stack">
|
||||||
<ChipList items={settings.folders} icon={FOLDER_ICON} render={folderLabel} empty={t('wb.settings.media.noFolders')}
|
<ChipList items={settings.folders} icon={FOLDER_ICON} render={folderLabel} empty={t('wb.settings.media.noFolders')}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
// app's built-in and own themes, and removal of installed items. Native code verifies the catalog's
|
// app's built-in and own themes, and removal of installed items. Native code verifies the catalog's
|
||||||
// Ed25519 signature, keeps the app's items, then checks each download's sha256. Installing always
|
// Ed25519 signature, keeps the app's items, then checks each download's sha256. Installing always
|
||||||
// goes through the shell's install screen (InstallDialog), never straight from here.
|
// goes through the shell's install screen (InstallDialog), never straight from here.
|
||||||
import { areaFlag, type FeatureTable } from '../../../runtime/src/featureTable.ts';
|
|
||||||
import { invoke } from '../frame/bridge.ts';
|
import { invoke } from '../frame/bridge.ts';
|
||||||
import { useT } from '../frame/hooks.ts';
|
import { useT } from '../frame/hooks.ts';
|
||||||
import { relativeTime } from '../frame/i18n.ts';
|
import { relativeTime } from '../frame/i18n.ts';
|
||||||
|
|
@ -11,7 +10,6 @@ import type { StoreCatalogView, StoreItem } from '../storeModel.ts';
|
||||||
import { StoreView, type StoreControls } from '../StoreView.tsx';
|
import { StoreView, type StoreControls } from '../StoreView.tsx';
|
||||||
import '../store.css';
|
import '../store.css';
|
||||||
import { Badge, Button, EmptyState, SearchField, Segmented, useSettingsQuery } from './controls.tsx';
|
import { Badge, Button, EmptyState, SearchField, Segmented, useSettingsQuery } from './controls.tsx';
|
||||||
import { featureTable, flagsChanged, useFlags } from './PluginFeatures.tsx';
|
|
||||||
import { panelSite, panelThemes, type Notify } from './site.ts';
|
import { panelSite, panelThemes, type Notify } from './site.ts';
|
||||||
import { useThemeState } from './themes.ts';
|
import { useThemeState } from './themes.ts';
|
||||||
import './plugins.css';
|
import './plugins.css';
|
||||||
|
|
@ -19,44 +17,15 @@ import './plugins.css';
|
||||||
const CONTROLS: Partial<StoreControls> = { Button, SearchField, Segmented, EmptyState, Badge };
|
const CONTROLS: Partial<StoreControls> = { Button, SearchField, Segmented, EmptyState, Badge };
|
||||||
const RELOAD_ON = ['bt-plugins-changed', 'bt-store-changed', 'bt-strings-changed'];
|
const RELOAD_ON = ['bt-plugins-changed', 'bt-store-changed', 'bt-strings-changed'];
|
||||||
|
|
||||||
type Areas = NonNullable<Parameters<typeof StoreView>[0]['areas']>;
|
|
||||||
|
|
||||||
/** The Store with the app's area plugins as switches for its built-in items (an app without a feature table has none). */
|
|
||||||
export function StoreSection({ notify }: { notify: Notify }) {
|
export function StoreSection({ notify }: { notify: Notify }) {
|
||||||
const table = featureTable();
|
|
||||||
return table ? <WithAreas table={table} notify={notify}/> : <Store notify={notify}/>;
|
|
||||||
}
|
|
||||||
|
|
||||||
function WithAreas({ table, notify }: { table: FeatureTable; notify: Notify }) {
|
|
||||||
const [flags, choose] = useFlags(table, notify);
|
|
||||||
const areas: Areas = {
|
|
||||||
has: id => table.areas.some(area => area.id === id),
|
|
||||||
on: id => flags?.[areaFlag(id)] ?? false,
|
|
||||||
set: async (id, on) => { if (await choose({ [areaFlag(id)]: on })) flagsChanged(); },
|
|
||||||
};
|
|
||||||
return <Store notify={notify} areas={flags ? areas : undefined}/>;
|
|
||||||
}
|
|
||||||
|
|
||||||
function Store({ notify, areas }: { notify: Notify; areas?: Areas }) {
|
|
||||||
const t = useT();
|
const t = useT();
|
||||||
const { store, catalog } = panelThemes();
|
const { store, catalog } = panelThemes();
|
||||||
const themes = useThemeState();
|
const themes = useThemeState();
|
||||||
const settingsQuery = useSettingsQuery();
|
const settingsQuery = useSettingsQuery();
|
||||||
if (settingsQuery) return null;
|
if (settingsQuery) return null;
|
||||||
const userThemes = themes.choice.themes.map(theme => theme.id);
|
const userThemes = themes.choice.themes.map(theme => theme.id);
|
||||||
const userIcons = (themes.choice.packs ?? []).map(pack => pack.id);
|
|
||||||
|
|
||||||
async function remove(item: StoreItem, view: StoreCatalogView): Promise<boolean> {
|
async function remove(item: StoreItem, view: StoreCatalogView): Promise<boolean> {
|
||||||
if (item.kind === 'builtin') return false;
|
|
||||||
if (item.kind === 'icons') {
|
|
||||||
const found = Object.entries(view.records.items).find(([key, value]) => key.startsWith('icons:') && value.storeId === item.id && userIcons.includes(key.slice(6)));
|
|
||||||
const id = found?.[0].slice(6);
|
|
||||||
if (!id) return false;
|
|
||||||
const choice = themes.choice;
|
|
||||||
await store.setChoice({ ...choice, packs: (choice.packs ?? []).filter(pack => pack.id !== id), ...(choice.icons === id ? { icons: undefined } : {}) });
|
|
||||||
await invoke('install_forget', { kind: 'icons', name: id });
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (item.kind === 'strings') {
|
if (item.kind === 'strings') {
|
||||||
await invoke('strings_remove', { id: item.id });
|
await invoke('strings_remove', { id: item.id });
|
||||||
window.dispatchEvent(new CustomEvent('bt-strings-changed'));
|
window.dispatchEvent(new CustomEvent('bt-strings-changed'));
|
||||||
|
|
@ -83,8 +52,6 @@ function Store({ notify, areas }: { notify: Notify; areas?: Areas }) {
|
||||||
controller={panelSite().store!.controller}
|
controller={panelSite().store!.controller}
|
||||||
builtinThemes={catalog.builtins.map(theme => theme.id)}
|
builtinThemes={catalog.builtins.map(theme => theme.id)}
|
||||||
userThemes={userThemes}
|
userThemes={userThemes}
|
||||||
userIcons={userIcons}
|
|
||||||
areas={areas}
|
|
||||||
onRemove={remove}
|
onRemove={remove}
|
||||||
onUse={item => store.setChoice({ ...themes.choice, preset: item.id, overrides: {}, accent: null })}
|
onUse={item => store.setChoice({ ...themes.choice, preset: item.id, overrides: {}, accent: null })}
|
||||||
notify={notify}
|
notify={notify}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
// site tabs the new delivery (`strings_apply`: the packs that are on, in order, with the inventory
|
// site tabs the new delivery (`strings_apply`: the packs that are on, in order, with the inventory
|
||||||
// slice their keys need); the tabs reload to show it. Packs are data only: nothing here runs code.
|
// slice their keys need); the tabs reload to show it. Packs are data only: nothing here runs code.
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { hashText, type PageInventory } from '../../../runtime/src/stringPacks.ts';
|
import type { PageInventory } from '../../../runtime/src/stringPacks.ts';
|
||||||
import { invoke } from '../frame/bridge.ts';
|
import { invoke } from '../frame/bridge.ts';
|
||||||
import { useT } from '../frame/hooks.ts';
|
import { useT } from '../frame/hooks.ts';
|
||||||
import { t as translate } from '../frame/i18n.ts';
|
import { t as translate } from '../frame/i18n.ts';
|
||||||
|
|
@ -20,41 +20,16 @@ const ICON = 'M2.5 3.5h7M6 2v1.5M8 3.5c-.6 2.9-2.6 5-5.4 6.1M4.6 6.2c.8 1.2 2 2.
|
||||||
|
|
||||||
type Row = InstalledStrings & { summary: StringsSummary | null };
|
type Row = InstalledStrings & { summary: StringsSummary | null };
|
||||||
|
|
||||||
/**
|
/** Hands the site tabs the packs that are on (in `packs` order). */
|
||||||
* Packs the app itself provides (pack documents as text), applied before the installed ones, so an
|
export async function applyStringPacks(inventory: PageInventory, packs?: InstalledStrings[]): Promise<void> {
|
||||||
* installed pack wins where both change a word. They follow the app's own settings (the Twitter
|
|
||||||
* wording is a pack that is only here while its setting is on); they are not listed or removable.
|
|
||||||
*/
|
|
||||||
export type BuiltInPacks = () => string[] | Promise<string[]>;
|
|
||||||
|
|
||||||
const DELIVERED_KEY = 'wayBetter.stringsDelivered';
|
|
||||||
/** What the tabs were last handed ("none" for no delivery), so a start-up check can skip a reload. */
|
|
||||||
const delivered = () => { try { return localStorage.getItem(DELIVERED_KEY) ?? 'none'; } catch { return 'none'; } };
|
|
||||||
|
|
||||||
async function deliveryOf(inventory: PageInventory, packs: InstalledStrings[] | undefined, builtIn: BuiltInPacks | undefined): Promise<string | null> {
|
|
||||||
const list = packs ?? (await invoke<{ packs: InstalledStrings[] }>('strings_list')).packs;
|
const list = packs ?? (await invoke<{ packs: InstalledStrings[] }>('strings_list')).packs;
|
||||||
const texts: string[] = [...(await builtIn?.() ?? [])];
|
const texts: string[] = [];
|
||||||
for (const pack of list) if (pack.enabled) texts.push(await invoke<string>('strings_read', { id: pack.id }));
|
for (const pack of list) if (pack.enabled) texts.push(await invoke<string>('strings_read', { id: pack.id }));
|
||||||
return buildDelivery(texts, inventory, { translate: translating() });
|
await invoke('strings_apply', { delivery: buildDelivery(texts, inventory, { translate: translating() }) });
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Hands the site tabs the packs that are on (built-in ones first, then `packs` in order). */
|
export function createStringPacksSection(options: { inventory: PageInventory; id?: string; icon?: string }): PanelSection {
|
||||||
export async function applyStringPacks(inventory: PageInventory, packs?: InstalledStrings[], builtIn?: BuiltInPacks): Promise<void> {
|
const { inventory } = options;
|
||||||
const delivery = await deliveryOf(inventory, packs, builtIn);
|
|
||||||
await invoke('strings_apply', { delivery });
|
|
||||||
try { localStorage.setItem(DELIVERED_KEY, delivery === null ? 'none' : hashText(delivery)); } catch { /* the next start-up check applies again */ }
|
|
||||||
}
|
|
||||||
|
|
||||||
/** At start: hands the tabs the delivery only when it differs from the one they were last given (a tab reloads for each). */
|
|
||||||
export async function syncStringPacks(inventory: PageInventory, builtIn?: BuiltInPacks): Promise<boolean> {
|
|
||||||
const delivery = await deliveryOf(inventory, undefined, builtIn);
|
|
||||||
if ((delivery === null ? 'none' : hashText(delivery)) === delivered()) return false;
|
|
||||||
await applyStringPacks(inventory, undefined, builtIn);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createStringPacksSection(options: { inventory: PageInventory; builtIn?: BuiltInPacks; id?: string; icon?: string }): PanelSection {
|
|
||||||
const { inventory, builtIn } = options;
|
|
||||||
|
|
||||||
function StringPacks({ notify, openSection }: SectionProps) {
|
function StringPacks({ notify, openSection }: SectionProps) {
|
||||||
const t = useT();
|
const t = useT();
|
||||||
|
|
@ -85,7 +60,7 @@ export function createStringPacksSection(options: { inventory: PageInventory; bu
|
||||||
setBusy(true);
|
setBusy(true);
|
||||||
try {
|
try {
|
||||||
const { packs } = await invoke<{ packs: InstalledStrings[] }>('strings_set', { order: next.map(row => row.id), enabled: next.filter(row => row.enabled).map(row => row.id) });
|
const { packs } = await invoke<{ packs: InstalledStrings[] }>('strings_set', { order: next.map(row => row.id), enabled: next.filter(row => row.enabled).map(row => row.id) });
|
||||||
await applyStringPacks(inventory, packs, builtIn);
|
await applyStringPacks(inventory, packs);
|
||||||
setRows(packs.map(pack => ({ ...pack, summary: next.find(row => row.id === pack.id)?.summary ?? null })));
|
setRows(packs.map(pack => ({ ...pack, summary: next.find(row => row.id === pack.id)?.summary ?? null })));
|
||||||
notify(t('wb.strings.applied', { site: name }));
|
notify(t('wb.strings.applied', { site: name }));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
@ -125,7 +100,7 @@ export function createStringPacksSection(options: { inventory: PageInventory; bu
|
||||||
<Button size="sm" tone="danger" disabled={busy} onClick={() => {
|
<Button size="sm" tone="danger" disabled={busy} onClick={() => {
|
||||||
setBusy(true);
|
setBusy(true);
|
||||||
void invoke<{ packs: InstalledStrings[] }>('strings_remove', { id: row.id })
|
void invoke<{ packs: InstalledStrings[] }>('strings_remove', { id: row.id })
|
||||||
.then(async ({ packs }) => { await applyStringPacks(inventory, packs, builtIn); notify(t('wb.strings.removed', { name: row.name })); await load(); })
|
.then(async ({ packs }) => { await applyStringPacks(inventory, packs); notify(t('wb.strings.removed', { name: row.name })); await load(); })
|
||||||
.catch(error => notify(String(error), true))
|
.catch(error => notify(String(error), true))
|
||||||
.finally(() => setBusy(false));
|
.finally(() => setBusy(false));
|
||||||
}}>{t('wb.strings.remove')}</Button>
|
}}>{t('wb.strings.remove')}</Button>
|
||||||
|
|
@ -137,7 +112,7 @@ export function createStringPacksSection(options: { inventory: PageInventory; bu
|
||||||
try { localStorage.setItem(TRANSLATE_KEY, checked ? '1' : '0'); } catch { /* it still applies once */ }
|
try { localStorage.setItem(TRANSLATE_KEY, checked ? '1' : '0'); } catch { /* it still applies once */ }
|
||||||
setTranslate(checked);
|
setTranslate(checked);
|
||||||
setBusy(true);
|
setBusy(true);
|
||||||
void applyStringPacks(inventory, undefined, builtIn).then(() => notify(t('wb.strings.applied', { site: name }))).catch(error => notify(String(error), true)).finally(() => setBusy(false));
|
void applyStringPacks(inventory).then(() => notify(t('wb.strings.applied', { site: name }))).catch(error => notify(String(error), true)).finally(() => setBusy(false));
|
||||||
}}/>
|
}}/>
|
||||||
<div className="btp-strings-text"><strong>{t('wb.strings.translate')}</strong><small>{t('wb.strings.translateHint', { site: name })}</small></div>
|
<div className="btp-strings-text"><strong>{t('wb.strings.translate')}</strong><small>{t('wb.strings.translateHint', { site: name })}</small></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
.btb-pass .bt-input { width: 200px; }
|
.btb-pass .bt-input { width: 200px; }
|
||||||
.btb-error { color: #ff8a80; font-size: 12px; }
|
.btb-error { color: #ff8a80; font-size: 12px; }
|
||||||
.btb-snapshots { display: flex; flex-direction: column; gap: 6px; width: 100%; }
|
.btb-snapshots { display: flex; flex-direction: column; gap: 6px; width: 100%; }
|
||||||
.btb-snapshot { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: calc(9px * var(--bt-rs, 1)); background: rgba(127, 127, 127, .06); }
|
.btb-snapshot { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; background: rgba(127, 127, 127, .06); }
|
||||||
.btb-snapshot.is-fresh { background: rgb(var(--c-accent-rgb) / .1); box-shadow: inset 0 0 0 1px rgb(var(--c-accent-rgb) / .3); }
|
.btb-snapshot.is-fresh { background: rgb(var(--c-accent-rgb) / .1); box-shadow: inset 0 0 0 1px rgb(var(--c-accent-rgb) / .3); }
|
||||||
.btb-snapshot-device { font-weight: 600; font-size: 12.5px; }
|
.btb-snapshot-device { font-weight: 600; font-size: 12.5px; }
|
||||||
.btb-snapshot-when { flex: 1; color: var(--c-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
|
.btb-snapshot-when { flex: 1; color: var(--c-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
|
||||||
|
|
|
||||||
|
|
@ -8,16 +8,16 @@
|
||||||
.btp-page:has(.wb-builder) { max-width: 1320px; }
|
.btp-page:has(.wb-builder) { max-width: 1320px; }
|
||||||
.wb-builder-bar {
|
.wb-builder-bar {
|
||||||
position: sticky; top: -18px; z-index: 12; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
|
position: sticky; top: -18px; z-index: 12; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
|
||||||
margin: 0 -4px; padding: 10px 12px; border: 1px solid var(--c-line); border-radius: calc(14px * var(--bt-rs, 1));
|
margin: 0 -4px; padding: 10px 12px; border: 1px solid var(--c-line); border-radius: 14px;
|
||||||
background: color-mix(in srgb, var(--c-card) 88%, transparent); backdrop-filter: blur(14px) saturate(1.2);
|
background: color-mix(in srgb, var(--c-card) 88%, transparent); backdrop-filter: blur(14px) saturate(1.2);
|
||||||
box-shadow: 0 10px 30px -18px rgba(0, 0, 0, .6);
|
box-shadow: 0 10px 30px -18px rgba(0, 0, 0, .6);
|
||||||
}
|
}
|
||||||
.wb-builder-name { flex: 1 1 200px; min-width: 0; height: 34px; padding: 0 10px; border: 1px solid transparent; border-radius: calc(9px * var(--bt-rs, 1)); background: transparent; color: var(--c-text); font: 650 17px/1 var(--f-ui); letter-spacing: -.02em; }
|
.wb-builder-name { flex: 1 1 200px; min-width: 0; height: 34px; padding: 0 10px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--c-text); font: 650 17px/1 var(--f-ui); letter-spacing: -.02em; }
|
||||||
.wb-builder-name:hover { border-color: var(--c-line); }
|
.wb-builder-name:hover { border-color: var(--c-line); }
|
||||||
.wb-builder-name:focus { outline: none; border-color: var(--c-accent); background: var(--c-field); }
|
.wb-builder-name:focus { outline: none; border-color: var(--c-accent); background: var(--c-field); }
|
||||||
.wb-builder-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
|
.wb-builder-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
|
||||||
.wb-divider { width: 1px; height: 20px; margin: 0 4px; background: var(--c-line); }
|
.wb-divider { width: 1px; height: 20px; margin: 0 4px; background: var(--c-line); }
|
||||||
.wb-icon-button { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--c-line); border-radius: calc(9px * var(--bt-rs, 1)); background: var(--c-field); color: var(--c-text); cursor: pointer; transition: background-color .15s, border-color .15s; }
|
.wb-icon-button { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--c-line); border-radius: 9px; background: var(--c-field); color: var(--c-text); cursor: pointer; transition: background-color .15s, border-color .15s; }
|
||||||
.wb-icon-button:hover:not(:disabled) { border-color: var(--c-line-strong); background: var(--c-raise); }
|
.wb-icon-button:hover:not(:disabled) { border-color: var(--c-line-strong); background: var(--c-raise); }
|
||||||
.wb-icon-button:disabled { opacity: .38; cursor: default; }
|
.wb-icon-button:disabled { opacity: .38; cursor: default; }
|
||||||
.wb-live { display: inline-flex; align-items: center; gap: 8px; margin-inline-end: 4px; color: var(--c-muted); font-size: 12px; font-weight: 520; }
|
.wb-live { display: inline-flex; align-items: center; gap: 8px; margin-inline-end: 4px; color: var(--c-muted); font-size: 12px; font-weight: 520; }
|
||||||
|
|
@ -30,11 +30,11 @@
|
||||||
.wb-builder-preview { order: 0; position: sticky; top: 52px; }
|
.wb-builder-preview { order: 0; position: sticky; top: 52px; }
|
||||||
}
|
}
|
||||||
|
|
||||||
.wb-card { padding: 16px 16px 14px; border: 1px solid var(--c-line-soft); border-radius: calc(14px * var(--bt-rs, 1)); background: var(--c-card); }
|
.wb-card { padding: 16px 16px 14px; border: 1px solid var(--c-line-soft); border-radius: 14px; background: var(--c-card); }
|
||||||
.wb-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
|
.wb-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
|
||||||
.wb-card h3 { margin: 0; font-size: 14px; font-weight: 640; letter-spacing: -.01em; }
|
.wb-card h3 { margin: 0; font-size: 14px; font-weight: 640; letter-spacing: -.01em; }
|
||||||
.wb-card header p { margin: 3px 0 0; max-width: 62ch; color: var(--c-muted); font-size: 12px; line-height: 1.45; }
|
.wb-card header p { margin: 3px 0 0; max-width: 62ch; color: var(--c-muted); font-size: 12px; line-height: 1.45; }
|
||||||
.wb-ok { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: calc(999px * var(--bt-rs, 1)); background: color-mix(in srgb, var(--c-ok) 14%, transparent); color: var(--c-ok); font-size: 12px; font-weight: 600; white-space: nowrap; }
|
.wb-ok { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; background: color-mix(in srgb, var(--c-ok) 14%, transparent); color: var(--c-ok); font-size: 12px; font-weight: 600; white-space: nowrap; }
|
||||||
|
|
||||||
.wb-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px 18px; margin-top: 14px; }
|
.wb-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px 18px; margin-top: 14px; }
|
||||||
.wb-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
|
.wb-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
|
||||||
|
|
@ -43,37 +43,37 @@
|
||||||
|
|
||||||
/* Base colors */
|
/* Base colors */
|
||||||
.wb-base { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
|
.wb-base { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
|
||||||
.wb-base-item { display: flex; flex-direction: column; gap: 9px; padding: 10px; border: 1px solid var(--c-line-soft); border-radius: calc(12px * var(--bt-rs, 1)); background: var(--c-ground); }
|
.wb-base-item { display: flex; flex-direction: column; gap: 9px; padding: 10px; border: 1px solid var(--c-line-soft); border-radius: 12px; background: var(--c-ground); }
|
||||||
.wb-base-swatch { position: relative; display: flex; align-items: flex-end; justify-content: space-between; height: 62px; padding: 10px 11px; border-radius: calc(9px * var(--bt-rs, 1)); box-shadow: inset 0 0 0 1px rgb(127 127 127 / .22); }
|
.wb-base-swatch { position: relative; display: flex; align-items: flex-end; justify-content: space-between; height: 62px; padding: 10px 11px; border-radius: 9px; box-shadow: inset 0 0 0 1px rgb(127 127 127 / .22); }
|
||||||
.wb-base-swatch span { font-size: 13px; font-weight: 650; letter-spacing: -.01em; }
|
.wb-base-swatch span { font-size: 13px; font-weight: 650; letter-spacing: -.01em; }
|
||||||
.wb-base-swatch code { padding: 2px 6px; border: 0; border-radius: calc(6px * var(--bt-rs, 1)); background: rgb(0 0 0 / .32); color: #fff; font: 500 11px/1.4 var(--f-mono); }
|
.wb-base-swatch code { padding: 2px 6px; border: 0; border-radius: 6px; background: rgb(0 0 0 / .32); color: #fff; font: 500 11px/1.4 var(--f-mono); }
|
||||||
.wb-base-item .bt-color { flex-wrap: wrap; gap: 6px; }
|
.wb-base-item .bt-color { flex-wrap: wrap; gap: 6px; }
|
||||||
.wb-base-item .bt-swatch { width: 22px; height: 22px; }
|
.wb-base-item .bt-swatch { width: 22px; height: 22px; }
|
||||||
|
|
||||||
/* Derived palette */
|
/* Derived palette */
|
||||||
.wb-palette { margin-top: 12px; }
|
.wb-palette { margin-top: 12px; }
|
||||||
.wb-palette-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
|
.wb-palette-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
|
||||||
.wb-chip { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 7px 9px; border: 1px solid var(--c-line-soft); border-radius: calc(10px * var(--bt-rs, 1)); background: var(--c-ground); color: var(--c-text); text-align: start; cursor: pointer; transition: border-color .15s, background-color .15s; }
|
.wb-chip { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 7px 9px; border: 1px solid var(--c-line-soft); border-radius: 10px; background: var(--c-ground); color: var(--c-text); text-align: start; cursor: pointer; transition: border-color .15s, background-color .15s; }
|
||||||
.wb-chip:hover { border-color: var(--c-line-strong); }
|
.wb-chip:hover { border-color: var(--c-line-strong); }
|
||||||
.wb-chip.is-on { border-color: var(--c-accent); box-shadow: 0 0 0 1px var(--c-accent); }
|
.wb-chip.is-on { border-color: var(--c-accent); box-shadow: 0 0 0 1px var(--c-accent); }
|
||||||
.wb-chip-swatch { flex: none; width: 22px; height: 22px; border-radius: calc(6px * var(--bt-rs, 1)); box-shadow: inset 0 0 0 1px rgb(127 127 127 / .3); }
|
.wb-chip-swatch { flex: none; width: 22px; height: 22px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgb(127 127 127 / .3); }
|
||||||
.wb-chip-copy { display: flex; flex-direction: column; min-width: 0; }
|
.wb-chip-copy { display: flex; flex-direction: column; min-width: 0; }
|
||||||
.wb-chip-copy b { font-size: 12px; font-weight: 600; }
|
.wb-chip-copy b { font-size: 12px; font-weight: 600; }
|
||||||
.wb-chip-copy small { overflow: hidden; color: var(--c-muted); font: 10.5px/1.4 var(--f-mono); white-space: nowrap; text-overflow: ellipsis; }
|
.wb-chip-copy small { overflow: hidden; color: var(--c-muted); font: 10.5px/1.4 var(--f-mono); white-space: nowrap; text-overflow: ellipsis; }
|
||||||
.wb-palette-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; padding: 10px; border-radius: calc(10px * var(--bt-rs, 1)); background: var(--c-field); }
|
.wb-palette-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; padding: 10px; border-radius: 10px; background: var(--c-field); }
|
||||||
.wb-palette-edit > span { font-size: 12px; font-weight: 600; }
|
.wb-palette-edit > span { font-size: 12px; font-weight: 600; }
|
||||||
|
|
||||||
/* Contrast */
|
/* Contrast */
|
||||||
.wb-contrast { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
|
.wb-contrast { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
|
||||||
.wb-contrast li { display: grid; grid-template-columns: 40px 1fr auto auto 76px; align-items: center; gap: 12px; padding: 6px 8px; border-radius: calc(9px * var(--bt-rs, 1)); }
|
.wb-contrast li { display: grid; grid-template-columns: 40px 1fr auto auto 76px; align-items: center; gap: 12px; padding: 6px 8px; border-radius: 9px; }
|
||||||
.wb-contrast li:hover { background: var(--c-field); }
|
.wb-contrast li:hover { background: var(--c-field); }
|
||||||
.wb-contrast li.is-fail { background: color-mix(in srgb, var(--c-danger) 7%, transparent); }
|
.wb-contrast li.is-fail { background: color-mix(in srgb, var(--c-danger) 7%, transparent); }
|
||||||
.wb-contrast-sample { display: grid; place-items: center; width: 40px; height: 28px; border-radius: calc(7px * var(--bt-rs, 1)); box-shadow: inset 0 0 0 1px rgb(127 127 127 / .25); font-size: 14px; font-weight: 700; }
|
.wb-contrast-sample { display: grid; place-items: center; width: 40px; height: 28px; border-radius: 7px; box-shadow: inset 0 0 0 1px rgb(127 127 127 / .25); font-size: 14px; font-weight: 700; }
|
||||||
.wb-contrast-label { font-size: 12.5px; }
|
.wb-contrast-label { font-size: 12.5px; }
|
||||||
.wb-contrast-ratio { font: 12px/1 var(--f-mono); color: var(--c-muted); }
|
.wb-contrast-ratio { font: 12px/1 var(--f-mono); color: var(--c-muted); }
|
||||||
.wb-contrast-ratio b { color: var(--c-text); font-weight: 600; }
|
.wb-contrast-ratio b { color: var(--c-text); font-weight: 600; }
|
||||||
.wb-contrast-need { color: var(--c-faint); font-size: 11.5px; }
|
.wb-contrast-need { color: var(--c-faint); font-size: 11.5px; }
|
||||||
.wb-contrast-badge { justify-self: end; padding: 3px 7px; border-radius: calc(6px * var(--bt-rs, 1)); font: 600 10.5px/1.2 var(--f-mono); text-align: center; }
|
.wb-contrast-badge { justify-self: end; padding: 3px 7px; border-radius: 6px; font: 600 10.5px/1.2 var(--f-mono); text-align: center; }
|
||||||
.wb-contrast-badge.is-pass { background: color-mix(in srgb, var(--c-ok) 14%, transparent); color: var(--c-ok); }
|
.wb-contrast-badge.is-pass { background: color-mix(in srgb, var(--c-ok) 14%, transparent); color: var(--c-ok); }
|
||||||
.wb-contrast-badge.is-fail { background: color-mix(in srgb, var(--c-danger) 16%, transparent); color: var(--c-danger); }
|
.wb-contrast-badge.is-fail { background: color-mix(in srgb, var(--c-danger) 16%, transparent); color: var(--c-danger); }
|
||||||
@container panel (max-width: 560px) {
|
@container panel (max-width: 560px) {
|
||||||
|
|
@ -85,48 +85,48 @@
|
||||||
.wb-bg .bt-seg { margin-bottom: 2px; }
|
.wb-bg .bt-seg { margin-bottom: 2px; }
|
||||||
|
|
||||||
/* Preview column */
|
/* Preview column */
|
||||||
.wb-preview-frame { overflow: hidden; border: 1px solid var(--c-line); border-radius: calc(14px * var(--bt-rs, 1)); background: var(--c-ground); box-shadow: 0 24px 60px -30px rgba(0, 0, 0, .7); }
|
.wb-preview-frame { overflow: hidden; border: 1px solid var(--c-line); border-radius: 14px; background: var(--c-ground); box-shadow: 0 24px 60px -30px rgba(0, 0, 0, .7); }
|
||||||
.wb-preview-frame .tp { border-radius: 0; }
|
.wb-preview-frame .tp { border-radius: 0; }
|
||||||
.wb-preview-note { display: flex; align-items: center; gap: 8px; margin: 0 2px; color: var(--c-muted); font-size: 12px; line-height: 1.4; }
|
.wb-preview-note { display: flex; align-items: center; gap: 8px; margin: 0 2px; color: var(--c-muted); font-size: 12px; line-height: 1.4; }
|
||||||
.wb-live-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c-ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-ok) 22%, transparent); animation: wb-pulse 2.4s ease-in-out infinite; }
|
.wb-live-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c-ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-ok) 22%, transparent); animation: wb-pulse 2.4s ease-in-out infinite; }
|
||||||
@keyframes wb-pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--c-ok) 0%, transparent); } }
|
@keyframes wb-pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--c-ok) 0%, transparent); } }
|
||||||
@media (prefers-reduced-motion: reduce) { .wb-live-dot { animation: none; } }
|
@media (prefers-reduced-motion: reduce) { .wb-live-dot { animation: none; } }
|
||||||
.wb-meta { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--c-line-soft); border-radius: calc(12px * var(--bt-rs, 1)); background: var(--c-card); }
|
.wb-meta { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--c-line-soft); border-radius: 12px; background: var(--c-card); }
|
||||||
.wb-meta label { display: flex; flex-direction: column; gap: 5px; }
|
.wb-meta label { display: flex; flex-direction: column; gap: 5px; }
|
||||||
.wb-meta span { color: var(--c-muted); font-size: 11.5px; font-weight: 560; }
|
.wb-meta span { color: var(--c-muted); font-size: 11.5px; font-weight: 560; }
|
||||||
.wb-meta input, .wb-meta textarea { padding: 7px 9px; border: 1px solid var(--c-line); border-radius: calc(8px * var(--bt-rs, 1)); background: var(--c-field); color: var(--c-text); font: 13px/1.4 var(--f-ui); resize: vertical; }
|
.wb-meta input, .wb-meta textarea { padding: 7px 9px; border: 1px solid var(--c-line); border-radius: 8px; background: var(--c-field); color: var(--c-text); font: 13px/1.4 var(--f-ui); resize: vertical; }
|
||||||
.wb-meta input:focus, .wb-meta textarea:focus { outline: none; border-color: var(--c-accent); }
|
.wb-meta input:focus, .wb-meta textarea:focus { outline: none; border-color: var(--c-accent); }
|
||||||
|
|
||||||
/* The chrome in the draft (tokens straight from chromeVars, Night Ink fallbacks). */
|
/* The chrome in the draft (tokens straight from chromeVars, Night Ink fallbacks). */
|
||||||
.wb-chrome-preview { --bt-rs: var(--wb-c-rs, 1); padding: 7px 8px 0; background: var(--wb-c-ground, #07080c); font-family: var(--wb-f-chrome, 'Geist Variable', system-ui, sans-serif); }
|
.wb-chrome-preview { padding: 7px 8px 0; background: var(--wb-c-ground, #07080c); font-family: var(--wb-f-chrome, 'Geist Variable', system-ui, sans-serif); }
|
||||||
.wb-cp-tabs { display: flex; gap: 4px; }
|
.wb-cp-tabs { display: flex; gap: 4px; }
|
||||||
.wb-cp-tab { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 12px; border-radius: calc(8px * var(--bt-rs, 1)) calc(8px * var(--bt-rs, 1)) 0 0; color: var(--wb-c-muted, #8a90a6); font-size: 11.5px; font-weight: 520; }
|
.wb-cp-tab { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 12px; border-radius: 8px 8px 0 0; color: var(--wb-c-muted, #8a90a6); font-size: 11.5px; font-weight: 520; }
|
||||||
.wb-cp-tab i { width: 10px; height: 10px; border-radius: calc(3px * var(--bt-rs, 1)); background: var(--wb-c-line-strong, #2a3044); }
|
.wb-cp-tab i { width: 10px; height: 10px; border-radius: 3px; background: var(--wb-c-line-strong, #2a3044); }
|
||||||
.wb-cp-tab.is-on { background: var(--wb-c-chrome, #0d1017); color: var(--wb-c-text, #eef0f7); }
|
.wb-cp-tab.is-on { background: var(--wb-c-chrome, #0d1017); color: var(--wb-c-text, #eef0f7); }
|
||||||
.wb-cp-tab.is-on i { background: var(--wb-c-accent, #1d9bf0); }
|
.wb-cp-tab.is-on i { background: var(--wb-c-accent, #1d9bf0); }
|
||||||
.wb-cp-bar { display: flex; align-items: center; gap: 8px; margin: 0 -8px; padding: 7px 10px; background: var(--wb-c-chrome, #0d1017); border-bottom: 1px solid var(--wb-c-line-soft, #161a26); }
|
.wb-cp-bar { display: flex; align-items: center; gap: 8px; margin: 0 -8px; padding: 7px 10px; background: var(--wb-c-chrome, #0d1017); border-bottom: 1px solid var(--wb-c-line-soft, #161a26); }
|
||||||
.wb-cp-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--wb-c-raised, #141823); }
|
.wb-cp-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--wb-c-raised, #141823); }
|
||||||
.wb-cp-omni { flex: 1; display: flex; align-items: center; gap: 7px; height: 24px; padding: 0 9px; border-radius: calc(7px * var(--bt-rs, 1)); background: var(--wb-c-field, #11141c); color: var(--wb-c-text, #eef0f7); font-size: 11.5px; }
|
.wb-cp-omni { flex: 1; display: flex; align-items: center; gap: 7px; height: 24px; padding: 0 9px; border-radius: 7px; background: var(--wb-c-field, #11141c); color: var(--wb-c-text, #eef0f7); font-size: 11.5px; }
|
||||||
.wb-cp-omni b { padding: 2px 7px; border-radius: calc(5px * var(--bt-rs, 1)); background: rgb(var(--wb-c-accent-rgb, 29 155 240) / .16); color: var(--wb-c-accent-ink, #cfe6ff); font-weight: 600; }
|
.wb-cp-omni b { padding: 2px 7px; border-radius: 5px; background: rgb(var(--wb-c-accent-rgb, 29 155 240) / .16); color: var(--wb-c-accent-ink, #cfe6ff); font-weight: 600; }
|
||||||
.wb-cp-omni em { color: var(--wb-c-faint, #5d6379); font-style: normal; }
|
.wb-cp-omni em { color: var(--wb-c-faint, #5d6379); font-style: normal; }
|
||||||
.wb-cp-brand { width: 26px; height: 16px; border-radius: calc(5px * var(--bt-rs, 1)); background: linear-gradient(90deg, #4f6bff, #22d3ee 55%, #a855f7); opacity: .85; }
|
.wb-cp-brand { width: 26px; height: 16px; border-radius: 5px; background: linear-gradient(90deg, #4f6bff, #22d3ee 55%, #a855f7); opacity: .85; }
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------
|
/* ---------------------------------------------------------------------------------------------
|
||||||
* Font roles */
|
* Font roles */
|
||||||
.wb-roles { display: flex; flex-direction: column; border: 1px solid var(--c-line-soft); border-radius: calc(12px * var(--bt-rs, 1)); overflow: hidden; }
|
.wb-roles { display: flex; flex-direction: column; border: 1px solid var(--c-line-soft); border-radius: 12px; overflow: hidden; }
|
||||||
.wb-role + .wb-role { border-top: 1px solid var(--c-line-soft); }
|
.wb-role + .wb-role { border-top: 1px solid var(--c-line-soft); }
|
||||||
.wb-role-main { display: grid; grid-template-columns: minmax(130px, .8fr) minmax(0, 1.4fr) auto; align-items: center; gap: 12px; padding-block: 9px; padding-inline: 14px 10px; }
|
.wb-role-main { display: grid; grid-template-columns: minmax(130px, .8fr) minmax(0, 1.4fr) auto; align-items: center; gap: 12px; padding-block: 9px; padding-inline: 14px 10px; }
|
||||||
.wb-role-copy { display: flex; flex-direction: column; min-width: 0; }
|
.wb-role-copy { display: flex; flex-direction: column; min-width: 0; }
|
||||||
.wb-role-copy strong { font-size: 13px; font-weight: 600; }
|
.wb-role-copy strong { font-size: 13px; font-weight: 600; }
|
||||||
.wb-role-copy small { color: var(--c-muted); font-size: 11.5px; line-height: 1.35; }
|
.wb-role-copy small { color: var(--c-muted); font-size: 11.5px; line-height: 1.35; }
|
||||||
.wb-role-font { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; padding: 7px 11px; border: 1px solid var(--c-line); border-radius: calc(10px * var(--bt-rs, 1)); background: var(--c-field); color: var(--c-text); text-align: start; cursor: pointer; transition: border-color .15s, background-color .15s; }
|
.wb-role-font { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; padding: 7px 11px; border: 1px solid var(--c-line); border-radius: 10px; background: var(--c-field); color: var(--c-text); text-align: start; cursor: pointer; transition: border-color .15s, background-color .15s; }
|
||||||
.wb-role-font:hover { border-color: var(--c-line-strong); background: var(--c-raise); }
|
.wb-role-font:hover { border-color: var(--c-line-strong); background: var(--c-raise); }
|
||||||
.wb-role-font.is-inherited { border-style: dashed; background: transparent; }
|
.wb-role-font.is-inherited { border-style: dashed; background: transparent; }
|
||||||
.wb-role-sample { max-width: 100%; overflow: hidden; font-size: 17px; line-height: 1.25; white-space: nowrap; text-overflow: ellipsis; }
|
.wb-role-sample { max-width: 100%; overflow: hidden; font-size: 17px; line-height: 1.25; white-space: nowrap; text-overflow: ellipsis; }
|
||||||
.wb-role-name { display: inline-flex; align-items: center; gap: 6px; color: var(--c-muted); font-size: 11px; }
|
.wb-role-name { display: inline-flex; align-items: center; gap: 6px; color: var(--c-muted); font-size: 11px; }
|
||||||
.wb-role-name em { padding: 1px 5px; border-radius: calc(4px * var(--bt-rs, 1)); background: var(--c-accent-soft); color: var(--c-accent); font: 600 9.5px/1.3 var(--f-mono); font-style: normal; letter-spacing: .02em; text-transform: uppercase; }
|
.wb-role-name em { padding: 1px 5px; border-radius: 4px; background: var(--c-accent-soft); color: var(--c-accent); font: 600 9.5px/1.3 var(--f-mono); font-style: normal; letter-spacing: .02em; text-transform: uppercase; }
|
||||||
.wb-role-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; min-width: 96px; }
|
.wb-role-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; min-width: 96px; }
|
||||||
.wb-role-tune { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid transparent; border-radius: calc(8px * var(--bt-rs, 1)); background: transparent; color: var(--c-muted); cursor: pointer; }
|
.wb-role-tune { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--c-muted); cursor: pointer; }
|
||||||
.wb-role-tune:hover, .wb-role-tune[aria-expanded=true] { border-color: var(--c-line); background: var(--c-field); color: var(--c-text); }
|
.wb-role-tune:hover, .wb-role-tune[aria-expanded=true] { border-color: var(--c-line); background: var(--c-field); color: var(--c-text); }
|
||||||
.wb-role-tune.is-tuned { color: var(--c-accent); }
|
.wb-role-tune.is-tuned { color: var(--c-accent); }
|
||||||
.wb-role-tuning { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 18px; padding: 4px 14px 14px; }
|
.wb-role-tuning { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 18px; padding: 4px 14px 14px; }
|
||||||
|
|
@ -142,21 +142,21 @@
|
||||||
/* ---------------------------------------------------------------------------------------------
|
/* ---------------------------------------------------------------------------------------------
|
||||||
* Sheets (font browser): cover the panel, not the window (X panes are native webviews). */
|
* Sheets (font browser): cover the panel, not the window (X panes are native webviews). */
|
||||||
.wb-sheet-backdrop { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; padding: 18px; background: rgb(0 0 0 / .5); backdrop-filter: blur(4px); animation: bt-pop .16s var(--ease); }
|
.wb-sheet-backdrop { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; padding: 18px; background: rgb(0 0 0 / .5); backdrop-filter: blur(4px); animation: bt-pop .16s var(--ease); }
|
||||||
.wb-sheet { display: flex; flex-direction: column; width: min(1040px, 100%); height: min(720px, 100%); overflow: hidden; border: 1px solid var(--c-line-strong); border-radius: calc(16px * var(--bt-rs, 1)); background: var(--c-card); box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .8), 0 0 0 1px rgb(0 0 0 / .3); }
|
.wb-sheet { display: flex; flex-direction: column; width: min(1040px, 100%); height: min(720px, 100%); overflow: hidden; border: 1px solid var(--c-line-strong); border-radius: 16px; background: var(--c-card); box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .8), 0 0 0 1px rgb(0 0 0 / .3); }
|
||||||
.wb-sheet-head { display: flex; align-items: center; gap: 14px; padding-block: 16px 12px; padding-inline: 20px 16px; border-bottom: 1px solid var(--c-line-soft); }
|
.wb-sheet-head { display: flex; align-items: center; gap: 14px; padding-block: 16px 12px; padding-inline: 20px 16px; border-bottom: 1px solid var(--c-line-soft); }
|
||||||
.wb-sheet-head > div:first-child { flex: 1; min-width: 0; }
|
.wb-sheet-head > div:first-child { flex: 1; min-width: 0; }
|
||||||
.wb-sheet-head .bt-seg { flex: none; }
|
.wb-sheet-head .bt-seg { flex: none; }
|
||||||
.wb-sheet-head h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.02em; }
|
.wb-sheet-head h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.02em; }
|
||||||
.wb-sheet-head h2 span { color: var(--c-muted); font-weight: 450; }
|
.wb-sheet-head h2 span { color: var(--c-muted); font-weight: 450; }
|
||||||
.wb-sheet-head p { margin: 3px 0 0; color: var(--c-muted); font-size: 12px; }
|
.wb-sheet-head p { margin: 3px 0 0; color: var(--c-muted); font-size: 12px; }
|
||||||
.wb-sheet-close { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--c-line); border-radius: calc(9px * var(--bt-rs, 1)); background: var(--c-field); color: var(--c-muted); cursor: pointer; }
|
.wb-sheet-close { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid var(--c-line); border-radius: 9px; background: var(--c-field); color: var(--c-muted); cursor: pointer; }
|
||||||
.wb-sheet-close:hover { color: var(--c-text); border-color: var(--c-line-strong); }
|
.wb-sheet-close:hover { color: var(--c-text); border-color: var(--c-line-strong); }
|
||||||
.wb-sheet-foot { padding: 10px 20px 12px; border-top: 1px solid var(--c-line-soft); color: var(--c-faint); font-size: 11px; line-height: 1.5; }
|
.wb-sheet-foot { padding: 10px 20px 12px; border-top: 1px solid var(--c-line-soft); color: var(--c-faint); font-size: 11px; line-height: 1.5; }
|
||||||
|
|
||||||
.wb-fb-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 20px; }
|
.wb-fb-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 20px; }
|
||||||
.wb-fb-search { flex: 1 1 260px; }
|
.wb-fb-search { flex: 1 1 260px; }
|
||||||
.wb-fb-cats { display: flex; flex-wrap: wrap; gap: 4px; }
|
.wb-fb-cats { display: flex; flex-wrap: wrap; gap: 4px; }
|
||||||
.wb-fb-cats button { height: 28px; padding: 0 11px; border: 1px solid var(--c-line); border-radius: calc(999px * var(--bt-rs, 1)); background: transparent; color: var(--c-muted); font-size: 12px; font-weight: 540; cursor: pointer; transition: color .15s, background-color .15s, border-color .15s; }
|
.wb-fb-cats button { height: 28px; padding: 0 11px; border: 1px solid var(--c-line); border-radius: 999px; background: transparent; color: var(--c-muted); font-size: 12px; font-weight: 540; cursor: pointer; transition: color .15s, background-color .15s, border-color .15s; }
|
||||||
.wb-fb-cats button:hover { color: var(--c-text); border-color: var(--c-line-strong); }
|
.wb-fb-cats button:hover { color: var(--c-text); border-color: var(--c-line-strong); }
|
||||||
.wb-fb-cats button.is-on { background: var(--c-text); border-color: var(--c-text); color: var(--c-ground); }
|
.wb-fb-cats button.is-on { background: var(--c-text); border-color: var(--c-text); color: var(--c-ground); }
|
||||||
.wb-fb-cats .wb-fb-installed { margin-inline-start: 6px; }
|
.wb-fb-cats .wb-fb-installed { margin-inline-start: 6px; }
|
||||||
|
|
@ -166,13 +166,13 @@
|
||||||
@container panel (max-width: 760px) { .wb-fb-body { grid-template-columns: 1fr; grid-template-rows: 1fr auto; } .wb-fb-detail { max-height: 50%; border-inline-start: 0 !important; border-top: 1px solid var(--c-line-soft); } }
|
@container panel (max-width: 760px) { .wb-fb-body { grid-template-columns: 1fr; grid-template-rows: 1fr auto; } .wb-fb-detail { max-height: 50%; border-inline-start: 0 !important; border-top: 1px solid var(--c-line-soft); } }
|
||||||
.wb-fb-list { margin: 0; padding: 6px; overflow-y: auto; list-style: none; scrollbar-width: thin; scrollbar-color: var(--c-line) transparent; outline: none; }
|
.wb-fb-list { margin: 0; padding: 6px; overflow-y: auto; list-style: none; scrollbar-width: thin; scrollbar-color: var(--c-line) transparent; outline: none; }
|
||||||
.wb-fb-list:focus-visible { box-shadow: inset 0 0 0 2px var(--c-accent); }
|
.wb-fb-list:focus-visible { box-shadow: inset 0 0 0 2px var(--c-accent); }
|
||||||
.wb-fb-list li[role=option] { display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'name tags' 'meta tags'; align-items: center; column-gap: 10px; padding: 8px 12px; border-radius: calc(10px * var(--bt-rs, 1)); cursor: pointer; }
|
.wb-fb-list li[role=option] { display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'name tags' 'meta tags'; align-items: center; column-gap: 10px; padding: 8px 12px; border-radius: 10px; cursor: pointer; }
|
||||||
.wb-fb-list li.is-active { background: var(--c-field); }
|
.wb-fb-list li.is-active { background: var(--c-field); }
|
||||||
.wb-fb-list li.is-on { background: var(--c-accent-soft); box-shadow: inset 0 0 0 1px rgb(var(--c-accent-rgb) / .45); }
|
.wb-fb-list li.is-on { background: var(--c-accent-soft); box-shadow: inset 0 0 0 1px rgb(var(--c-accent-rgb) / .45); }
|
||||||
.wb-fb-name { grid-area: name; overflow: hidden; font-size: 21px; line-height: 1.3; white-space: nowrap; text-overflow: ellipsis; transition: opacity .2s; }
|
.wb-fb-name { grid-area: name; overflow: hidden; font-size: 21px; line-height: 1.3; white-space: nowrap; text-overflow: ellipsis; transition: opacity .2s; }
|
||||||
.wb-fb-name.is-loading { opacity: .45; }
|
.wb-fb-name.is-loading { opacity: .45; }
|
||||||
.wb-fb-meta { grid-area: meta; color: var(--c-muted); font-size: 11px; }
|
.wb-fb-meta { grid-area: meta; color: var(--c-muted); font-size: 11px; }
|
||||||
.wb-fb-tag { grid-area: tags; justify-self: end; padding: 2px 7px; border-radius: calc(6px * var(--bt-rs, 1)); background: var(--c-field); color: var(--c-muted); font: 600 10px/1.4 var(--f-mono); letter-spacing: .02em; }
|
.wb-fb-tag { grid-area: tags; justify-self: end; padding: 2px 7px; border-radius: 6px; background: var(--c-field); color: var(--c-muted); font: 600 10px/1.4 var(--f-mono); letter-spacing: .02em; }
|
||||||
.wb-fb-tag.is-accent { background: var(--c-accent-soft); color: var(--c-accent); }
|
.wb-fb-tag.is-accent { background: var(--c-accent-soft); color: var(--c-accent); }
|
||||||
.wb-fb-tag + .wb-fb-tag { grid-row: 2; }
|
.wb-fb-tag + .wb-fb-tag { grid-row: 2; }
|
||||||
.wb-fb-empty { padding: 30px 14px; color: var(--c-muted); text-align: center; }
|
.wb-fb-empty { padding: 30px 14px; color: var(--c-muted); text-align: center; }
|
||||||
|
|
@ -183,34 +183,34 @@
|
||||||
.wb-fb-hero { display: flex; flex-direction: column; gap: 4px; }
|
.wb-fb-hero { display: flex; flex-direction: column; gap: 4px; }
|
||||||
.wb-fb-hero-name { font-size: 40px; line-height: 1.1; letter-spacing: -.01em; overflow-wrap: anywhere; }
|
.wb-fb-hero-name { font-size: 40px; line-height: 1.1; letter-spacing: -.01em; overflow-wrap: anywhere; }
|
||||||
.wb-fb-hero-meta { color: var(--c-muted); font-size: 12px; }
|
.wb-fb-hero-meta { color: var(--c-muted); font-size: 12px; }
|
||||||
.wb-fb-sample { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--c-line-soft); border-radius: calc(12px * var(--bt-rs, 1)); background: var(--c-card); }
|
.wb-fb-sample { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--c-line-soft); border-radius: 12px; background: var(--c-card); }
|
||||||
.wb-fb-sample-text { min-height: 2.6em; font-size: 24px; line-height: 1.3; overflow-wrap: anywhere; }
|
.wb-fb-sample-text { min-height: 2.6em; font-size: 24px; line-height: 1.3; overflow-wrap: anywhere; }
|
||||||
.wb-fb-sample textarea { width: 100%; padding: 7px 9px; border: 1px solid var(--c-line); border-radius: calc(8px * var(--bt-rs, 1)); background: var(--c-field); color: var(--c-text); font: 12.5px/1.45 var(--f-ui); resize: none; }
|
.wb-fb-sample textarea { width: 100%; padding: 7px 9px; border: 1px solid var(--c-line); border-radius: 8px; background: var(--c-field); color: var(--c-text); font: 12.5px/1.45 var(--f-ui); resize: none; }
|
||||||
.wb-fb-sample textarea:focus { outline: none; border-color: var(--c-accent); }
|
.wb-fb-sample textarea:focus { outline: none; border-color: var(--c-accent); }
|
||||||
.wb-fb-samples { display: flex; flex-wrap: wrap; gap: 4px; }
|
.wb-fb-samples { display: flex; flex-wrap: wrap; gap: 4px; }
|
||||||
.wb-fb-samples button { height: 24px; padding: 0 9px; border: 1px solid var(--c-line); border-radius: calc(999px * var(--bt-rs, 1)); background: transparent; color: var(--c-muted); font-size: 11px; cursor: pointer; }
|
.wb-fb-samples button { height: 24px; padding: 0 9px; border: 1px solid var(--c-line); border-radius: 999px; background: transparent; color: var(--c-muted); font-size: 11px; cursor: pointer; }
|
||||||
.wb-fb-samples button.is-on, .wb-fb-samples button:hover { color: var(--c-text); border-color: var(--c-line-strong); }
|
.wb-fb-samples button.is-on, .wb-fb-samples button:hover { color: var(--c-text); border-color: var(--c-line-strong); }
|
||||||
.wb-fb-field { display: flex; flex-direction: column; gap: 8px; }
|
.wb-fb-field { display: flex; flex-direction: column; gap: 8px; }
|
||||||
.wb-fb-field > span { color: var(--c-muted); font-size: 11.5px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
|
.wb-fb-field > span { color: var(--c-muted); font-size: 11.5px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
|
||||||
.wb-fb-field > small { color: var(--c-faint); font-size: 11.5px; line-height: 1.45; }
|
.wb-fb-field > small { color: var(--c-faint); font-size: 11.5px; line-height: 1.45; }
|
||||||
.wb-fb-range { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
|
.wb-fb-range { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
|
||||||
.wb-fb-weights { display: flex; flex-wrap: wrap; gap: 4px; }
|
.wb-fb-weights { display: flex; flex-wrap: wrap; gap: 4px; }
|
||||||
.wb-fb-weights button { min-width: 44px; height: 28px; padding: 0 9px; border: 1px solid var(--c-line); border-radius: calc(8px * var(--bt-rs, 1)); background: var(--c-field); color: var(--c-muted); font: 500 11.5px/1 var(--f-mono); cursor: pointer; }
|
.wb-fb-weights button { min-width: 44px; height: 28px; padding: 0 9px; border: 1px solid var(--c-line); border-radius: 8px; background: var(--c-field); color: var(--c-muted); font: 500 11.5px/1 var(--f-mono); cursor: pointer; }
|
||||||
.wb-fb-weights button.is-on { border-color: var(--c-accent); background: var(--c-accent-soft); color: var(--c-text); }
|
.wb-fb-weights button.is-on { border-color: var(--c-accent); background: var(--c-accent-soft); color: var(--c-text); }
|
||||||
.wb-fb-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 4px; }
|
.wb-fb-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 4px; }
|
||||||
.wb-fb-error { margin: 0; padding: 8px 10px; border-radius: calc(8px * var(--bt-rs, 1)); background: color-mix(in srgb, var(--c-danger) 12%, transparent); color: var(--c-danger); font-size: 12px; }
|
.wb-fb-error { margin: 0; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--c-danger) 12%, transparent); color: var(--c-danger); font-size: 12px; }
|
||||||
|
|
||||||
.wb-fb-system { flex: 1; overflow-y: auto; padding: 16px 20px; }
|
.wb-fb-system { flex: 1; overflow-y: auto; padding: 16px 20px; }
|
||||||
.wb-fb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 0 0 18px; padding: 0; list-style: none; }
|
.wb-fb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 0 0 18px; padding: 0; list-style: none; }
|
||||||
.wb-fb-grid button { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 14px; border: 1px solid var(--c-line-soft); border-radius: calc(12px * var(--bt-rs, 1)); background: var(--c-ground); color: var(--c-text); text-align: start; cursor: pointer; }
|
.wb-fb-grid button { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 14px; border: 1px solid var(--c-line-soft); border-radius: 12px; background: var(--c-ground); color: var(--c-text); text-align: start; cursor: pointer; }
|
||||||
.wb-fb-grid button:hover { border-color: var(--c-line-strong); }
|
.wb-fb-grid button:hover { border-color: var(--c-line-strong); }
|
||||||
.wb-fb-grid button.is-on { border-color: var(--c-accent); box-shadow: 0 0 0 1px var(--c-accent); }
|
.wb-fb-grid button.is-on { border-color: var(--c-accent); box-shadow: 0 0 0 1px var(--c-accent); }
|
||||||
.wb-fb-grid span { font-size: 18px; }
|
.wb-fb-grid span { font-size: 18px; }
|
||||||
.wb-fb-grid small { color: var(--c-muted); font-size: 12px; }
|
.wb-fb-grid small { color: var(--c-muted); font-size: 12px; }
|
||||||
.wb-fb-custom { display: flex; align-items: flex-end; gap: 10px; padding: 14px; border: 1px dashed var(--c-line-strong); border-radius: calc(12px * var(--bt-rs, 1)); }
|
.wb-fb-custom { display: flex; align-items: flex-end; gap: 10px; padding: 14px; border: 1px dashed var(--c-line-strong); border-radius: 12px; }
|
||||||
.wb-fb-custom label { flex: 1; display: flex; flex-direction: column; gap: 6px; }
|
.wb-fb-custom label { flex: 1; display: flex; flex-direction: column; gap: 6px; }
|
||||||
.wb-fb-custom label span { color: var(--c-muted); font-size: 12px; }
|
.wb-fb-custom label span { color: var(--c-muted); font-size: 12px; }
|
||||||
.wb-fb-custom input { height: 34px; padding: 0 10px; border: 1px solid var(--c-line); border-radius: calc(9px * var(--bt-rs, 1)); background: var(--c-field); color: var(--c-text); font-size: 15px; }
|
.wb-fb-custom input { height: 34px; padding: 0 10px; border: 1px solid var(--c-line); border-radius: 9px; background: var(--c-field); color: var(--c-text); font-size: 15px; }
|
||||||
.wb-fb-custom input:focus { outline: none; border-color: var(--c-accent); }
|
.wb-fb-custom input:focus { outline: none; border-color: var(--c-accent); }
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------------------------
|
/* ---------------------------------------------------------------------------------------------
|
||||||
|
|
@ -230,11 +230,3 @@
|
||||||
.wb-fontlist b { font-size: 17px; font-weight: 450; }
|
.wb-fontlist b { font-size: 17px; font-weight: 450; }
|
||||||
.wb-fontlist small { color: var(--c-muted); font: 11px/1.4 var(--f-mono); }
|
.wb-fontlist small { color: var(--c-muted); font: 11px/1.4 var(--f-mono); }
|
||||||
.wb-fontlist ul { margin: 0; padding: 0; list-style: none; }
|
.wb-fontlist ul { margin: 0; padding: 0; list-style: none; }
|
||||||
|
|
||||||
/* The theme doctor's full report (advice only). */
|
|
||||||
.bt-doctor { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
|
|
||||||
.bt-doctor-item { display: grid; gap: 3px; padding: 9px 2px; }
|
|
||||||
.bt-doctor-item + .bt-doctor-item { border-block-start: 1px solid var(--c-line-soft); }
|
|
||||||
.bt-doctor-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
|
||||||
.bt-doctor-line { color: var(--c-muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
|
|
||||||
.bt-doctor-line code { font: 11.5px/1.4 var(--f-mono); color: var(--c-text); }
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
.bmk-intro p { margin: 0 0 10px; max-width: 70ch; line-height: 1.55; }
|
.bmk-intro p { margin: 0 0 10px; max-width: 70ch; line-height: 1.55; }
|
||||||
.bmk-muted, .bmk-intro .bmk-muted { color: var(--c-muted); font-size: 12px; }
|
.bmk-muted, .bmk-intro .bmk-muted { color: var(--c-muted); font-size: 12px; }
|
||||||
.bmk-commands { display: grid; gap: 6px; margin: 0 0 10px; padding: 0; list-style: none; }
|
.bmk-commands { display: grid; gap: 6px; margin: 0 0 10px; padding: 0; list-style: none; }
|
||||||
.bmk-commands li { display: grid; grid-template-columns: minmax(120px, 190px) 1fr auto; align-items: center; gap: 10px; padding-block: 6px; padding-inline: 12px 6px; border: 1px solid var(--c-line-soft); border-radius: calc(10px * var(--bt-rs, 1)); background: var(--c-card); }
|
.bmk-commands li { display: grid; grid-template-columns: minmax(120px, 190px) 1fr auto; align-items: center; gap: 10px; padding-block: 6px; padding-inline: 12px 6px; border: 1px solid var(--c-line-soft); border-radius: 10px; background: var(--c-card); }
|
||||||
.bmk-commands li > span { color: var(--c-muted); font-size: 12px; }
|
.bmk-commands li > span { color: var(--c-muted); font-size: 12px; }
|
||||||
.bmk-commands li > code { overflow-x: auto; white-space: nowrap; background: transparent; border: 0; padding: 0; color: var(--c-text); scrollbar-width: none; }
|
.bmk-commands li > code { overflow-x: auto; white-space: nowrap; background: transparent; border: 0; padding: 0; color: var(--c-text); scrollbar-width: none; }
|
||||||
@container panel (max-width: 560px) { .bmk-commands li { grid-template-columns: 1fr auto; } .bmk-commands li > span { grid-column: 1 / -1; } }
|
@container panel (max-width: 560px) { .bmk-commands li { grid-template-columns: 1fr auto; } .bmk-commands li > span { grid-column: 1 / -1; } }
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
/* Example picker + editor */
|
/* Example picker + editor */
|
||||||
.bmk-examples { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; padding: 10px; }
|
.bmk-examples { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; padding: 10px; }
|
||||||
.bmk-example { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--c-line-soft); border-radius: calc(10px * var(--bt-rs, 1)); background: var(--c-field); text-align: start; cursor: pointer; transition: border-color .15s, background-color .15s; }
|
.bmk-example { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid var(--c-line-soft); border-radius: 10px; background: var(--c-field); text-align: start; cursor: pointer; transition: border-color .15s, background-color .15s; }
|
||||||
.bmk-example strong { font-size: 12.5px; font-weight: 620; }
|
.bmk-example strong { font-size: 12.5px; font-weight: 620; }
|
||||||
.bmk-example span { color: var(--c-muted); font-size: 11.5px; line-height: 1.45; }
|
.bmk-example span { color: var(--c-muted); font-size: 11.5px; line-height: 1.45; }
|
||||||
.bmk-example:hover { border-color: var(--c-line-strong); }
|
.bmk-example:hover { border-color: var(--c-line-strong); }
|
||||||
|
|
@ -40,9 +40,9 @@
|
||||||
.bmk-facts { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 12px 14px; color: var(--c-text-2); font: 11.5px var(--f-mono); }
|
.bmk-facts { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 12px 14px; color: var(--c-text-2); font: 11.5px var(--f-mono); }
|
||||||
.bmk-facts b { color: var(--c-muted); font-weight: 500; margin-inline-end: 4px; }
|
.bmk-facts b { color: var(--c-muted); font-weight: 500; margin-inline-end: 4px; }
|
||||||
.bmk-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; padding: 0 10px 12px; }
|
.bmk-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; padding: 0 10px 12px; }
|
||||||
.bmk-swatch { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border: 1px solid var(--c-line-soft); border-radius: calc(10px * var(--bt-rs, 1)); background: var(--c-field); text-align: start; cursor: copy; }
|
.bmk-swatch { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border: 1px solid var(--c-line-soft); border-radius: 10px; background: var(--c-field); text-align: start; cursor: copy; }
|
||||||
.bmk-swatch:hover { border-color: var(--c-line-strong); }
|
.bmk-swatch:hover { border-color: var(--c-line-strong); }
|
||||||
.bmk-chip { flex: 0 0 30px; height: 30px; border-radius: calc(8px * var(--bt-rs, 1)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12), 0 0 0 1px rgba(0, 0, 0, .25); }
|
.bmk-chip { flex: 0 0 30px; height: 30px; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12), 0 0 0 1px rgba(0, 0, 0, .25); }
|
||||||
.bmk-swatch-text { display: flex; flex-direction: column; min-width: 0; }
|
.bmk-swatch-text { display: flex; flex-direction: column; min-width: 0; }
|
||||||
.bmk-swatch-text b { font-size: 12px; font-weight: 600; }
|
.bmk-swatch-text b { font-size: 12px; font-weight: 600; }
|
||||||
.bmk-swatch-text code { align-self: flex-start; margin: 2px 0; }
|
.bmk-swatch-text code { align-self: flex-start; margin: 2px 0; }
|
||||||
|
|
@ -66,7 +66,7 @@
|
||||||
.bmk-doc ul, .bmk-doc ol { padding-inline-start: 20px; }
|
.bmk-doc ul, .bmk-doc ol { padding-inline-start: 20px; }
|
||||||
.bmk-doc li + li { margin-top: 4px; }
|
.bmk-doc li + li { margin-top: 4px; }
|
||||||
.bmk-doc .bt-snippet { margin: 8px 0 14px; }
|
.bmk-doc .bt-snippet { margin: 8px 0 14px; }
|
||||||
.bmk-doc-table { overflow-x: auto; margin: 6px 0 14px; border: 1px solid var(--c-line-soft); border-radius: calc(10px * var(--bt-rs, 1)); }
|
.bmk-doc-table { overflow-x: auto; margin: 6px 0 14px; border: 1px solid var(--c-line-soft); border-radius: 10px; }
|
||||||
.bmk-doc table { width: 100%; border-collapse: collapse; font-size: 12px; }
|
.bmk-doc table { width: 100%; border-collapse: collapse; font-size: 12px; }
|
||||||
.bmk-doc th, .bmk-doc td { padding: 7px 10px; text-align: start; vertical-align: top; border-top: 1px solid var(--c-line-soft); }
|
.bmk-doc th, .bmk-doc td { padding: 7px 10px; text-align: start; vertical-align: top; border-top: 1px solid var(--c-line-soft); }
|
||||||
.bmk-doc th { border-top: 0; background: var(--c-chrome); color: var(--c-text); font-weight: 600; }
|
.bmk-doc th { border-top: 0; background: var(--c-chrome); color: var(--c-text); font-weight: 600; }
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@
|
||||||
.btp-root { position: absolute; inset: 0; container-type: inline-size; container-name: panel; }
|
.btp-root { position: absolute; inset: 0; container-type: inline-size; container-name: panel; }
|
||||||
.btp *, .btp *::before, .btp *::after { box-sizing: border-box; }
|
.btp *, .btp *::before, .btp *::after { box-sizing: border-box; }
|
||||||
.btp button { font: inherit; color: inherit; }
|
.btp button { font: inherit; color: inherit; }
|
||||||
.btp code { padding: 1px 5px; border-radius: calc(5px * var(--bt-rs, 1)); background: var(--c-field); border: 1px solid var(--c-line-soft); font: 11.5px var(--f-mono); color: var(--c-text-2); }
|
.btp code { padding: 1px 5px; border-radius: 5px; background: var(--c-field); border: 1px solid var(--c-line-soft); font: 11.5px var(--f-mono); color: var(--c-text-2); }
|
||||||
.btp mark { background: var(--c-accent-soft); color: var(--c-text); border-radius: calc(3px * var(--bt-rs, 1)); box-shadow: 0 0 0 1px rgb(var(--c-accent-rgb) / .35); }
|
.btp mark { background: var(--c-accent-soft); color: var(--c-text); border-radius: 3px; box-shadow: 0 0 0 1px rgb(var(--c-accent-rgb) / .35); }
|
||||||
.btp :focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
|
.btp :focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
|
||||||
.btp :is(.bt-search, .bt-inputrow) input:focus-visible, .btp .bt-hex:focus-visible, .btp .bt-code textarea:focus-visible, .btp .btp-input:focus-visible, .btp .bt-input:focus-visible { outline: none; }
|
.btp :is(.bt-search, .bt-inputrow) input:focus-visible, .btp .bt-hex:focus-visible, .btp .bt-code textarea:focus-visible, .btp .btp-input:focus-visible, .btp .bt-input:focus-visible { outline: none; }
|
||||||
|
|
||||||
|
|
@ -28,14 +28,14 @@
|
||||||
.btp-head { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
|
.btp-head { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
|
||||||
.btp-head::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--c-brush); opacity: .38; }
|
.btp-head::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--c-brush); opacity: .38; }
|
||||||
.btp-brand { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
|
.btp-brand { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
|
||||||
.btp-brand img { border-radius: calc(6px * var(--bt-rs, 1)); box-shadow: 0 0 0 1px rgba(255, 255, 255, .06); }
|
.btp-brand img { border-radius: 6px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .06); }
|
||||||
.btp-brand strong { font-size: 13.5px; font-weight: 650; letter-spacing: -.015em; }
|
.btp-brand strong { font-size: 13.5px; font-weight: 650; letter-spacing: -.015em; }
|
||||||
.btp-head .bt-search { margin-inline-start: auto; width: min(320px, 100%); }
|
.btp-head .bt-search { margin-inline-start: auto; width: min(320px, 100%); }
|
||||||
|
|
||||||
/* Section nav: a scrolling strip in a narrow pane, a rail in a wide one */
|
/* Section nav: a scrolling strip in a narrow pane, a rail in a wide one */
|
||||||
.btp-nav { display: flex; gap: 2px; padding: 8px 10px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--c-line-soft); background: var(--c-chrome); }
|
.btp-nav { display: flex; gap: 2px; padding: 8px 10px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--c-line-soft); background: var(--c-chrome); }
|
||||||
.btp-nav::-webkit-scrollbar { display: none; }
|
.btp-nav::-webkit-scrollbar { display: none; }
|
||||||
.btp-nav button { position: relative; flex: 0 0 auto; display: flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px; border: 0; border-radius: calc(8px * var(--bt-rs, 1)); background: transparent; color: var(--c-muted); font-weight: 520; cursor: pointer; transition: color .15s, background-color .15s; }
|
.btp-nav button { position: relative; flex: 0 0 auto; display: flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--c-muted); font-weight: 520; cursor: pointer; transition: color .15s, background-color .15s; }
|
||||||
.btp-nav button svg { flex: none; opacity: .8; }
|
.btp-nav button svg { flex: none; opacity: .8; }
|
||||||
.btp-nav button:hover { color: var(--c-text); background: var(--c-field); }
|
.btp-nav button:hover { color: var(--c-text); background: var(--c-field); }
|
||||||
.btp-nav button.is-on { color: var(--c-text); background: var(--c-raise); }
|
.btp-nav button.is-on { color: var(--c-text); background: var(--c-raise); }
|
||||||
|
|
@ -51,7 +51,7 @@
|
||||||
.btp-head { grid-column: 1 / -1; padding: 12px 20px; }
|
.btp-head { grid-column: 1 / -1; padding: 12px 20px; }
|
||||||
.btp-nav { flex-direction: column; gap: 1px; padding: 14px 10px; border-bottom: 0; border-inline-end: 1px solid var(--c-line-soft); overflow: visible; }
|
.btp-nav { flex-direction: column; gap: 1px; padding: 14px 10px; border-bottom: 0; border-inline-end: 1px solid var(--c-line-soft); overflow: visible; }
|
||||||
.btp-nav button { height: auto; min-height: 32px; padding: 6px 10px; text-align: start; line-height: 1.25; }
|
.btp-nav button { height: auto; min-height: 32px; padding: 6px 10px; text-align: start; line-height: 1.25; }
|
||||||
.btp-nav button.is-on::before { content: ''; position: absolute; inset-inline-start: -10px; top: 8px; bottom: 8px; width: 2px; border-start-start-radius: 0; border-start-end-radius: calc(2px * var(--bt-rs, 1)); border-end-end-radius: calc(2px * var(--bt-rs, 1)); border-end-start-radius: 0; background: var(--c-accent); }
|
.btp-nav button.is-on::before { content: ''; position: absolute; inset-inline-start: -10px; top: 8px; bottom: 8px; width: 2px; border-start-start-radius: 0; border-start-end-radius: 2px; border-end-end-radius: 2px; border-end-start-radius: 0; background: var(--c-accent); }
|
||||||
.btp-page { padding: 26px 32px 72px; }
|
.btp-page { padding: 26px 32px 72px; }
|
||||||
.btp-title { font-size: 22px; margin-bottom: 18px; }
|
.btp-title { font-size: 22px; margin-bottom: 18px; }
|
||||||
}
|
}
|
||||||
|
|
@ -63,7 +63,7 @@
|
||||||
.bt-section-head h2 { margin: 0; font-size: 13px; font-weight: 620; letter-spacing: -.005em; }
|
.bt-section-head h2 { margin: 0; font-size: 13px; font-weight: 620; letter-spacing: -.005em; }
|
||||||
.bt-section-head p { margin: 2px 0 0; color: var(--c-muted); font-size: 12px; line-height: 1.45; max-width: 62ch; }
|
.bt-section-head p { margin: 2px 0 0; color: var(--c-muted); font-size: 12px; line-height: 1.45; max-width: 62ch; }
|
||||||
.bt-section-action { flex: 0 0 auto; }
|
.bt-section-action { flex: 0 0 auto; }
|
||||||
.bt-card { border: 1px solid var(--c-line-soft); border-radius: calc(12px * var(--bt-rs, 1)); background: var(--c-card); box-shadow: 0 1px 0 rgba(255, 255, 255, .02) inset; }
|
.bt-card { border: 1px solid var(--c-line-soft); border-radius: 12px; background: var(--c-card); box-shadow: 0 1px 0 rgba(255, 255, 255, .02) inset; }
|
||||||
.bt-card:empty { display: none; }
|
.bt-card:empty { display: none; }
|
||||||
.bt-card > .bt-gallery, .bt-card > .bt-import { padding: 12px; }
|
.bt-card > .bt-gallery, .bt-card > .bt-import { padding: 12px; }
|
||||||
|
|
||||||
|
|
@ -85,15 +85,15 @@
|
||||||
|
|
||||||
.bt-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
.bt-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
||||||
.bt-stack { display: flex; flex-direction: column; gap: 10px; width: 100%; }
|
.bt-stack { display: flex; flex-direction: column; gap: 10px; width: 100%; }
|
||||||
.bt-badge { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: calc(5px * var(--bt-rs, 1)); background: var(--c-field); border: 1px solid var(--c-line-soft); color: var(--c-muted); font: 500 10.5px/1 var(--f-mono); letter-spacing: 0; }
|
.bt-badge { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 5px; background: var(--c-field); border: 1px solid var(--c-line-soft); color: var(--c-muted); font: 500 10.5px/1 var(--f-mono); letter-spacing: 0; }
|
||||||
.bt-badge.is-accent { color: var(--c-accent); border-color: rgb(var(--c-accent-rgb) / .3); background: var(--c-accent-soft); }
|
.bt-badge.is-accent { color: var(--c-accent); border-color: rgb(var(--c-accent-rgb) / .3); background: var(--c-accent-soft); }
|
||||||
.bt-status { color: var(--c-muted); font: 11.5px var(--f-mono); }
|
.bt-status { color: var(--c-muted); font: 11.5px var(--f-mono); }
|
||||||
.bt-status.is-warn { color: var(--c-warn); }
|
.bt-status.is-warn { color: var(--c-warn); }
|
||||||
.bt-alert { margin: 12px; padding: 10px 12px; border: 1px solid rgba(255, 92, 108, .35); border-radius: calc(10px * var(--bt-rs, 1)); background: rgba(255, 92, 108, .08); font-size: 12px; }
|
.bt-alert { margin: 12px; padding: 10px 12px; border: 1px solid rgba(255, 92, 108, .35); border-radius: 10px; background: rgba(255, 92, 108, .08); font-size: 12px; }
|
||||||
|
|
||||||
/* Buttons */
|
/* Buttons */
|
||||||
.bt-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 13px; border: 1px solid var(--c-line); border-radius: calc(9px * var(--bt-rs, 1)); background: var(--c-field); color: var(--c-text); font-weight: 540; white-space: nowrap; cursor: pointer; transition: background-color .15s, border-color .15s, transform .1s; }
|
.bt-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 13px; border: 1px solid var(--c-line); border-radius: 9px; background: var(--c-field); color: var(--c-text); font-weight: 540; white-space: nowrap; cursor: pointer; transition: background-color .15s, border-color .15s, transform .1s; }
|
||||||
.bt-btn.is-sm { height: 28px; padding: 0 11px; font-size: 12.5px; border-radius: calc(8px * var(--bt-rs, 1)); }
|
.bt-btn.is-sm { height: 28px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
|
||||||
.bt-btn:hover:not(:disabled) { border-color: var(--c-line-strong); background: var(--c-raise); }
|
.bt-btn:hover:not(:disabled) { border-color: var(--c-line-strong); background: var(--c-raise); }
|
||||||
.bt-btn:active:not(:disabled) { transform: translateY(.5px); }
|
.bt-btn:active:not(:disabled) { transform: translateY(.5px); }
|
||||||
.bt-btn:disabled { opacity: .42; cursor: default; }
|
.bt-btn:disabled { opacity: .42; cursor: default; }
|
||||||
|
|
@ -104,16 +104,16 @@
|
||||||
.bt-btn.is-danger { background: var(--c-danger); border-color: var(--c-danger); color: #fff; }
|
.bt-btn.is-danger { background: var(--c-danger); border-color: var(--c-danger); color: #fff; }
|
||||||
|
|
||||||
/* Toggle */
|
/* Toggle */
|
||||||
.bt-toggle { position: relative; flex: 0 0 auto; width: 36px; height: 21px; padding: 0; border: 1px solid var(--c-line-strong); border-radius: calc(999px * var(--bt-rs, 1)); background: var(--c-track); cursor: pointer; transition: background-color .18s var(--ease), border-color .18s; }
|
.bt-toggle { position: relative; flex: 0 0 auto; width: 36px; height: 21px; padding: 0; border: 1px solid var(--c-line-strong); border-radius: 999px; background: var(--c-track); cursor: pointer; transition: background-color .18s var(--ease), border-color .18s; }
|
||||||
.bt-toggle-knob { position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: var(--c-knob); box-shadow: 0 1px 2px rgba(0, 0, 0, .4); transition: transform .2s var(--ease), background-color .18s; }
|
.bt-toggle-knob { position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: var(--c-knob); box-shadow: 0 1px 2px rgba(0, 0, 0, .4); transition: transform .2s var(--ease), background-color .18s; }
|
||||||
.bt-toggle.is-on { background: var(--c-accent); border-color: var(--c-accent); }
|
.bt-toggle.is-on { background: var(--c-accent); border-color: var(--c-accent); }
|
||||||
.bt-toggle.is-on .bt-toggle-knob { transform: translateX(15px); background: #fff; }
|
.bt-toggle.is-on .bt-toggle-knob { transform: translateX(15px); background: #fff; }
|
||||||
.bt-toggle:disabled { opacity: .45; cursor: default; }
|
.bt-toggle:disabled { opacity: .45; cursor: default; }
|
||||||
|
|
||||||
/* Segmented */
|
/* Segmented */
|
||||||
.bt-seg { position: relative; display: inline-flex; flex-wrap: nowrap; max-width: 100%; padding: 3px; border: 1px solid var(--c-line); border-radius: calc(10px * var(--bt-rs, 1)); background: var(--c-ground); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35); isolation: isolate; }
|
.bt-seg { position: relative; display: inline-flex; flex-wrap: nowrap; max-width: 100%; padding: 3px; border: 1px solid var(--c-line); border-radius: 10px; background: var(--c-ground); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35); isolation: isolate; }
|
||||||
.bt-seg-thumb { position: absolute; z-index: -1; top: 3px; bottom: 3px; left: 3px; border-radius: calc(7px * var(--bt-rs, 1)); background: var(--c-thumb); box-shadow: 0 0 0 1px var(--c-line-strong), 0 2px 6px rgba(0, 0, 0, .35); transition: transform .22s var(--ease), width .22s var(--ease), opacity .15s; }
|
.bt-seg-thumb { position: absolute; z-index: -1; top: 3px; bottom: 3px; left: 3px; border-radius: 7px; background: var(--c-thumb); box-shadow: 0 0 0 1px var(--c-line-strong), 0 2px 6px rgba(0, 0, 0, .35); transition: transform .22s var(--ease), width .22s var(--ease), opacity .15s; }
|
||||||
.bt-seg button { position: relative; display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 12px; border: 0; border-radius: calc(7px * var(--bt-rs, 1)); background: transparent; color: var(--c-muted); font-weight: 520; white-space: nowrap; cursor: pointer; transition: color .15s; }
|
.bt-seg button { position: relative; display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--c-muted); font-weight: 520; white-space: nowrap; cursor: pointer; transition: color .15s; }
|
||||||
.bt-seg.is-sm button { padding: 0 10px; font-size: 12.5px; }
|
.bt-seg.is-sm button { padding: 0 10px; font-size: 12.5px; }
|
||||||
.bt-seg button:hover { color: var(--c-text); }
|
.bt-seg button:hover { color: var(--c-text); }
|
||||||
.bt-seg button.is-on { color: var(--c-text); }
|
.bt-seg button.is-on { color: var(--c-text); }
|
||||||
|
|
@ -121,13 +121,13 @@
|
||||||
|
|
||||||
/* Select */
|
/* Select */
|
||||||
.bt-select { position: relative; min-width: 150px; }
|
.bt-select { position: relative; min-width: 150px; }
|
||||||
.bt-select-button { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; height: 32px; padding-block: 0; padding-inline: 11px 10px; border: 1px solid var(--c-line); border-radius: calc(9px * var(--bt-rs, 1)); background: var(--c-field); text-align: start; cursor: pointer; transition: border-color .15s; }
|
.bt-select-button { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; height: 32px; padding-block: 0; padding-inline: 11px 10px; border: 1px solid var(--c-line); border-radius: 9px; background: var(--c-field); text-align: start; cursor: pointer; transition: border-color .15s; }
|
||||||
.bt-select-button:hover, .bt-select.is-open .bt-select-button { border-color: var(--c-line-strong); }
|
.bt-select-button:hover, .bt-select.is-open .bt-select-button { border-color: var(--c-line-strong); }
|
||||||
.bt-select-button svg { flex: 0 0 auto; color: var(--c-muted); transition: transform .18s var(--ease); }
|
.bt-select-button svg { flex: 0 0 auto; color: var(--c-muted); transition: transform .18s var(--ease); }
|
||||||
.bt-select.is-open .bt-select-button svg { transform: rotate(180deg); }
|
.bt-select.is-open .bt-select-button svg { transform: rotate(180deg); }
|
||||||
.bt-select-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
.bt-select-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
.bt-select-list { position: absolute; z-index: 30; top: calc(100% + 6px); inset-inline-end: 0; min-width: 100%; width: max-content; max-width: 300px; max-height: 300px; margin: 0; padding: 5px; overflow-y: auto; list-style: none; border: 1px solid var(--c-line-strong); border-radius: calc(11px * var(--bt-rs, 1)); background: var(--c-popover); box-shadow: 0 18px 50px rgba(0, 0, 0, .6), 0 0 0 1px rgba(0, 0, 0, .4); animation: bt-pop .14s var(--ease); scrollbar-width: thin; }
|
.bt-select-list { position: absolute; z-index: 30; top: calc(100% + 6px); inset-inline-end: 0; min-width: 100%; width: max-content; max-width: 300px; max-height: 300px; margin: 0; padding: 5px; overflow-y: auto; list-style: none; border: 1px solid var(--c-line-strong); border-radius: 11px; background: var(--c-popover); box-shadow: 0 18px 50px rgba(0, 0, 0, .6), 0 0 0 1px rgba(0, 0, 0, .4); animation: bt-pop .14s var(--ease); scrollbar-width: thin; }
|
||||||
.bt-select-list li { position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 32px; padding-block: 5px; padding-inline: 9px 28px; border-radius: calc(7px * var(--bt-rs, 1)); cursor: pointer; }
|
.bt-select-list li { position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 32px; padding-block: 5px; padding-inline: 9px 28px; border-radius: 7px; cursor: pointer; }
|
||||||
.bt-select-list li.bt-select-group { min-height: 0; margin-top: 4px; padding-block: 7px 3px; color: var(--c-muted); font-size: 11px; font-weight: 600; cursor: default; pointer-events: none; }
|
.bt-select-list li.bt-select-group { min-height: 0; margin-top: 4px; padding-block: 7px 3px; color: var(--c-muted); font-size: 11px; font-weight: 600; cursor: default; pointer-events: none; }
|
||||||
.bt-select-list li.bt-select-group:first-child { margin-top: 0; }
|
.bt-select-list li.bt-select-group:first-child { margin-top: 0; }
|
||||||
.bt-select-list li.is-active { background: var(--c-raise); }
|
.bt-select-list li.is-active { background: var(--c-raise); }
|
||||||
|
|
@ -140,32 +140,32 @@
|
||||||
/* Slider */
|
/* Slider */
|
||||||
.bt-slider { display: flex; align-items: center; gap: 12px; width: min(260px, 100%); }
|
.bt-slider { display: flex; align-items: center; gap: 12px; width: min(260px, 100%); }
|
||||||
.bt-slider input { --pct: 50%; flex: 1; min-width: 0; height: 20px; margin: 0; background: transparent; appearance: none; -webkit-appearance: none; cursor: pointer; }
|
.bt-slider input { --pct: 50%; flex: 1; min-width: 0; height: 20px; margin: 0; background: transparent; appearance: none; -webkit-appearance: none; cursor: pointer; }
|
||||||
.bt-slider input::-webkit-slider-runnable-track { height: 4px; border-radius: calc(4px * var(--bt-rs, 1)); background: linear-gradient(90deg, var(--c-accent) var(--pct), var(--c-line) var(--pct)); }
|
.bt-slider input::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--c-accent) var(--pct), var(--c-line) var(--pct)); }
|
||||||
.bt-slider input::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgb(var(--c-accent-rgb) / .22), 0 1px 3px rgba(0, 0, 0, .5); transition: box-shadow .15s; }
|
.bt-slider input::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgb(var(--c-accent-rgb) / .22), 0 1px 3px rgba(0, 0, 0, .5); transition: box-shadow .15s; }
|
||||||
.bt-slider input:hover::-webkit-slider-thumb { box-shadow: 0 0 0 6px rgb(var(--c-accent-rgb) / .25), 0 1px 3px rgba(0, 0, 0, .5); }
|
.bt-slider input:hover::-webkit-slider-thumb { box-shadow: 0 0 0 6px rgb(var(--c-accent-rgb) / .25), 0 1px 3px rgba(0, 0, 0, .5); }
|
||||||
.bt-slider input::-moz-range-track { height: 4px; border-radius: calc(4px * var(--bt-rs, 1)); background: var(--c-line); }
|
.bt-slider input::-moz-range-track { height: 4px; border-radius: 4px; background: var(--c-line); }
|
||||||
.bt-slider input::-moz-range-progress { height: 4px; border-radius: calc(4px * var(--bt-rs, 1)); background: var(--c-accent); }
|
.bt-slider input::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--c-accent); }
|
||||||
.bt-slider input::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #fff; }
|
.bt-slider input::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #fff; }
|
||||||
.bt-slider output { flex: 0 0 auto; min-width: 54px; padding: 3px 6px; border: 1px solid var(--c-line-soft); border-radius: calc(6px * var(--bt-rs, 1)); background: var(--c-chrome); color: var(--c-text); font: 500 11.5px var(--f-mono); text-align: center; }
|
.bt-slider output { flex: 0 0 auto; min-width: 54px; padding: 3px 6px; border: 1px solid var(--c-line-soft); border-radius: 6px; background: var(--c-chrome); color: var(--c-text); font: 500 11.5px var(--f-mono); text-align: center; }
|
||||||
|
|
||||||
/* Color */
|
/* Color */
|
||||||
.bt-color { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
|
.bt-color { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
|
||||||
.bt-swatch { position: relative; flex: 0 0 auto; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: var(--sw, transparent); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); cursor: pointer; transition: transform .15s var(--ease), box-shadow .15s; }
|
.bt-swatch { position: relative; flex: 0 0 auto; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: var(--sw, transparent); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); cursor: pointer; transition: transform .15s var(--ease), box-shadow .15s; }
|
||||||
.bt-swatch:hover { transform: scale(1.08); }
|
.bt-swatch:hover { transform: scale(1.08); }
|
||||||
.bt-swatch.is-on { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), 0 0 0 2px var(--c-card), 0 0 0 4px var(--c-text); }
|
.bt-swatch.is-on { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), 0 0 0 2px var(--c-card), 0 0 0 4px var(--c-text); }
|
||||||
.bt-swatch.is-auto { width: auto; height: 26px; padding: 0 11px; border-radius: calc(999px * var(--bt-rs, 1)); background: var(--c-field); box-shadow: inset 0 0 0 1px var(--c-line); color: var(--c-muted); font-size: 12px; font-weight: 540; }
|
.bt-swatch.is-auto { width: auto; height: 26px; padding: 0 11px; border-radius: 999px; background: var(--c-field); box-shadow: inset 0 0 0 1px var(--c-line); color: var(--c-muted); font-size: 12px; font-weight: 540; }
|
||||||
.bt-swatch.is-auto.is-on { color: var(--c-text); box-shadow: inset 0 0 0 1px var(--c-line-strong), 0 0 0 2px var(--c-card), 0 0 0 4px var(--c-text); }
|
.bt-swatch.is-auto.is-on { color: var(--c-text); box-shadow: inset 0 0 0 1px var(--c-line-strong), 0 0 0 2px var(--c-card), 0 0 0 4px var(--c-text); }
|
||||||
.bt-swatch.is-picker { display: inline-grid; place-items: center; overflow: hidden; background: conic-gradient(from 90deg, #ff5f6d, #ffd400, #3ddc97, #1d9bf0, #7856ff, #f91880, #ff5f6d); }
|
.bt-swatch.is-picker { display: inline-grid; place-items: center; overflow: hidden; background: conic-gradient(from 90deg, #ff5f6d, #ffd400, #3ddc97, #1d9bf0, #7856ff, #f91880, #ff5f6d); }
|
||||||
.bt-swatch.is-picker.is-on { background: var(--sw); }
|
.bt-swatch.is-picker.is-on { background: var(--sw); }
|
||||||
.bt-swatch.is-picker input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
|
.bt-swatch.is-picker input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
|
||||||
.bt-hex { width: 84px; height: 28px; margin-inline-start: 2px; padding: 0 8px; border: 1px solid var(--c-line); border-radius: calc(7px * var(--bt-rs, 1)); background: var(--c-field); color: var(--c-text); font: 12px var(--f-mono); outline: none; }
|
.bt-hex { width: 84px; height: 28px; margin-inline-start: 2px; padding: 0 8px; border: 1px solid var(--c-line); border-radius: 7px; background: var(--c-field); color: var(--c-text); font: 12px var(--f-mono); outline: none; }
|
||||||
.bt-hex:focus { border-color: var(--c-accent); }
|
.bt-hex:focus { border-color: var(--c-accent); }
|
||||||
|
|
||||||
/* Inputs */
|
/* Inputs */
|
||||||
.bt-input, .btp-input { width: 100%; height: 32px; padding: 0 11px; border: 1px solid var(--c-line); border-radius: calc(9px * var(--bt-rs, 1)); background: var(--c-field); color: var(--c-text); font: inherit; outline: none; transition: border-color .15s, box-shadow .15s; }
|
.bt-input, .btp-input { width: 100%; height: 32px; padding: 0 11px; border: 1px solid var(--c-line); border-radius: 9px; background: var(--c-field); color: var(--c-text); font: inherit; outline: none; transition: border-color .15s, box-shadow .15s; }
|
||||||
.bt-input.is-mono { font-family: var(--f-mono); font-size: 12px; }
|
.bt-input.is-mono { font-family: var(--f-mono); font-size: 12px; }
|
||||||
.bt-input:focus, .btp-input:focus { border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-soft); }
|
.bt-input:focus, .btp-input:focus { border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-soft); }
|
||||||
.bt-inputrow { display: flex; width: min(420px, 100%); border: 1px solid var(--c-line); border-radius: calc(9px * var(--bt-rs, 1)); background: var(--c-field); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
|
.bt-inputrow { display: flex; width: min(420px, 100%); border: 1px solid var(--c-line); border-radius: 9px; background: var(--c-field); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
|
||||||
.bt-inputrow:focus-within { border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-soft); }
|
.bt-inputrow:focus-within { border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-soft); }
|
||||||
.bt-inputrow input { flex: 1; min-width: 0; height: 32px; padding: 0 11px; border: 0; background: transparent; color: var(--c-text); font: inherit; outline: none; }
|
.bt-inputrow input { flex: 1; min-width: 0; height: 32px; padding: 0 11px; border: 0; background: transparent; color: var(--c-text); font: inherit; outline: none; }
|
||||||
.bt-inputrow input.is-mono { font: 12px var(--f-mono); }
|
.bt-inputrow input.is-mono { font: 12px var(--f-mono); }
|
||||||
|
|
@ -173,23 +173,23 @@
|
||||||
.bt-inputrow button:hover:not(:disabled) { background: var(--c-raise); }
|
.bt-inputrow button:hover:not(:disabled) { background: var(--c-raise); }
|
||||||
.bt-inputrow button:disabled { color: var(--c-faint); cursor: default; }
|
.bt-inputrow button:disabled { color: var(--c-faint); cursor: default; }
|
||||||
|
|
||||||
.bt-search { position: relative; display: flex; align-items: center; height: 30px; padding-block: 0; padding-inline: 10px 8px; gap: 7px; border: 1px solid var(--c-line); border-radius: calc(9px * var(--bt-rs, 1)); background: var(--c-field); color: var(--c-muted); transition: border-color .15s, box-shadow .15s; }
|
.bt-search { position: relative; display: flex; align-items: center; height: 30px; padding-block: 0; padding-inline: 10px 8px; gap: 7px; border: 1px solid var(--c-line); border-radius: 9px; background: var(--c-field); color: var(--c-muted); transition: border-color .15s, box-shadow .15s; }
|
||||||
.bt-search:focus-within { border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-soft); color: var(--c-text); }
|
.bt-search:focus-within { border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-soft); color: var(--c-text); }
|
||||||
.bt-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: var(--c-text); font: inherit; outline: none; }
|
.bt-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: var(--c-text); font: inherit; outline: none; }
|
||||||
.bt-search input::-webkit-search-cancel-button { display: none; }
|
.bt-search input::-webkit-search-cancel-button { display: none; }
|
||||||
.bt-search input::placeholder { color: var(--c-faint); }
|
.bt-search input::placeholder { color: var(--c-faint); }
|
||||||
.bt-search button { width: 20px; height: 20px; padding: 0; border: 0; border-radius: calc(5px * var(--bt-rs, 1)); background: var(--c-raise); color: var(--c-muted); line-height: 1; cursor: pointer; }
|
.bt-search button { width: 20px; height: 20px; padding: 0; border: 0; border-radius: 5px; background: var(--c-raise); color: var(--c-muted); line-height: 1; cursor: pointer; }
|
||||||
|
|
||||||
/* Chips */
|
/* Chips */
|
||||||
.bt-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
|
.bt-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
|
||||||
.bt-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; max-width: 100%; padding-block: 0; padding-inline: 10px 4px; border: 1px solid var(--c-line); border-radius: calc(999px * var(--bt-rs, 1)); background: var(--c-field); font-size: 12.5px; animation: bt-pop .16s var(--ease); }
|
.bt-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; max-width: 100%; padding-block: 0; padding-inline: 10px 4px; border: 1px solid var(--c-line); border-radius: 999px; background: var(--c-field); font-size: 12.5px; animation: bt-pop .16s var(--ease); }
|
||||||
.bt-chip > svg { flex: 0 0 auto; color: var(--c-muted); }
|
.bt-chip > svg { flex: 0 0 auto; color: var(--c-muted); }
|
||||||
.bt-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
.bt-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
.bt-chip button { display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--c-muted); cursor: pointer; }
|
.bt-chip button { display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--c-muted); cursor: pointer; }
|
||||||
.bt-chip button:hover { background: rgba(255, 92, 108, .16); color: var(--c-danger); }
|
.bt-chip button:hover { background: rgba(255, 92, 108, .16); color: var(--c-danger); }
|
||||||
.bt-chips-empty { margin: 0; color: var(--c-faint); font-size: 12px; }
|
.bt-chips-empty { margin: 0; color: var(--c-faint); font-size: 12px; }
|
||||||
|
|
||||||
.bt-stepper { display: inline-flex; align-items: center; height: 30px; border: 1px solid var(--c-line); border-radius: calc(9px * var(--bt-rs, 1)); background: var(--c-field); overflow: hidden; }
|
.bt-stepper { display: inline-flex; align-items: center; height: 30px; border: 1px solid var(--c-line); border-radius: 9px; background: var(--c-field); overflow: hidden; }
|
||||||
.bt-stepper button { width: 30px; height: 100%; border: 0; background: transparent; color: var(--c-muted); font-size: 15px; cursor: pointer; }
|
.bt-stepper button { width: 30px; height: 100%; border: 0; background: transparent; color: var(--c-muted); font-size: 15px; cursor: pointer; }
|
||||||
.bt-stepper button:hover:not(:disabled) { background: var(--c-raise); color: var(--c-text); }
|
.bt-stepper button:hover:not(:disabled) { background: var(--c-raise); color: var(--c-text); }
|
||||||
.bt-stepper button:disabled { opacity: .35; cursor: default; }
|
.bt-stepper button:disabled { opacity: .35; cursor: default; }
|
||||||
|
|
@ -198,25 +198,25 @@
|
||||||
|
|
||||||
/* Empty state */
|
/* Empty state */
|
||||||
.bt-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 30px 20px 28px; text-align: center; }
|
.bt-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 30px 20px 28px; text-align: center; }
|
||||||
.bt-empty-icon { display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 6px; border: 1px solid var(--c-line); border-radius: calc(13px * var(--bt-rs, 1)); background: linear-gradient(180deg, var(--c-raise), var(--c-field)); color: var(--c-muted); }
|
.bt-empty-icon { display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 6px; border: 1px solid var(--c-line); border-radius: 13px; background: linear-gradient(180deg, var(--c-raise), var(--c-field)); color: var(--c-muted); }
|
||||||
.bt-empty strong { font-size: 13.5px; font-weight: 600; }
|
.bt-empty strong { font-size: 13.5px; font-weight: 600; }
|
||||||
.bt-empty p { max-width: 44ch; margin: 0; color: var(--c-muted); font-size: 12.5px; line-height: 1.5; }
|
.bt-empty p { max-width: 44ch; margin: 0; color: var(--c-muted); font-size: 12.5px; line-height: 1.5; }
|
||||||
.bt-empty-action { margin-top: 10px; }
|
.bt-empty-action { margin-top: 10px; }
|
||||||
.bt-snippet { margin: 8px 0 2px; padding: 10px 14px; border: 1px solid var(--c-line-soft); border-radius: calc(9px * var(--bt-rs, 1)); background: var(--c-ground); color: var(--c-text-2); font: 11.5px/1.6 var(--f-mono); text-align: start; white-space: pre; overflow-x: auto; max-width: 100%; }
|
.bt-snippet { margin: 8px 0 2px; padding: 10px 14px; border: 1px solid var(--c-line-soft); border-radius: 9px; background: var(--c-ground); color: var(--c-text-2); font: 11.5px/1.6 var(--f-mono); text-align: start; white-space: pre; overflow-x: auto; max-width: 100%; }
|
||||||
|
|
||||||
/* Code editor (Custom CSS, theme JSON) */
|
/* Code editor (Custom CSS, theme JSON) */
|
||||||
.bt-code { display: flex; flex-direction: column; }
|
.bt-code { display: flex; flex-direction: column; }
|
||||||
.bt-code textarea { width: 100%; min-height: 200px; padding: 14px 16px; border: 0; border-radius: calc(12px * var(--bt-rs, 1)) calc(12px * var(--bt-rs, 1)) 0 0; background: transparent; color: var(--c-text-2); font: 12px/1.65 var(--f-mono); resize: vertical; outline: none; tab-size: 2; }
|
.bt-code textarea { width: 100%; min-height: 200px; padding: 14px 16px; border: 0; border-radius: 12px 12px 0 0; background: transparent; color: var(--c-text-2); font: 12px/1.65 var(--f-mono); resize: vertical; outline: none; tab-size: 2; }
|
||||||
.bt-code.is-compact textarea { min-height: 110px; border: 1px solid var(--c-line); border-bottom: 0; background: var(--c-chrome); }
|
.bt-code.is-compact textarea { min-height: 110px; border: 1px solid var(--c-line); border-bottom: 0; background: var(--c-chrome); }
|
||||||
.bt-code-bar { display: flex; align-items: center; gap: 8px; padding-block: 8px; padding-inline: 16px 10px; border-top: 1px solid var(--c-line-soft); }
|
.bt-code-bar { display: flex; align-items: center; gap: 8px; padding-block: 8px; padding-inline: 16px 10px; border-top: 1px solid var(--c-line-soft); }
|
||||||
.bt-code.is-compact .bt-code-bar { border: 1px solid var(--c-line); border-radius: 0 0 calc(10px * var(--bt-rs, 1)) calc(10px * var(--bt-rs, 1)); background: var(--c-chrome); }
|
.bt-code.is-compact .bt-code-bar { border: 1px solid var(--c-line); border-radius: 0 0 10px 10px; background: var(--c-chrome); }
|
||||||
.bt-code-bar small { margin-inline-end: auto; color: var(--c-faint); font-size: 11.5px; }
|
.bt-code-bar small { margin-inline-end: auto; color: var(--c-faint); font-size: 11.5px; }
|
||||||
.bt-code-bar small.is-error { color: var(--c-danger); font-family: var(--f-ui); font-size: 12px; }
|
.bt-code-bar small.is-error { color: var(--c-danger); font-family: var(--f-ui); font-size: 12px; }
|
||||||
|
|
||||||
/* Theme gallery */
|
/* Theme gallery */
|
||||||
.bt-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
|
.bt-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
|
||||||
.bt-theme { position: relative; }
|
.bt-theme { position: relative; }
|
||||||
.bt-theme-hit { display: flex; flex-direction: column; width: 100%; padding: 0; overflow: hidden; border: 1px solid var(--c-line); border-radius: calc(13px * var(--bt-rs, 1)); background: var(--c-chrome); text-align: start; cursor: pointer; transition: border-color .18s, box-shadow .18s, transform .18s var(--ease); }
|
.bt-theme-hit { display: flex; flex-direction: column; width: 100%; padding: 0; overflow: hidden; border: 1px solid var(--c-line); border-radius: 13px; background: var(--c-chrome); text-align: start; cursor: pointer; transition: border-color .18s, box-shadow .18s, transform .18s var(--ease); }
|
||||||
.bt-theme-hit:hover { border-color: var(--c-line-strong); transform: translateY(-1px); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
|
.bt-theme-hit:hover { border-color: var(--c-line-strong); transform: translateY(-1px); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
|
||||||
.bt-theme.is-on .bt-theme-hit { border-color: var(--c-accent); box-shadow: 0 0 0 1px var(--c-accent), 0 12px 36px rgba(59, 90, 200, .22); }
|
.bt-theme.is-on .bt-theme-hit { border-color: var(--c-accent); box-shadow: 0 0 0 1px var(--c-accent), 0 12px 36px rgba(59, 90, 200, .22); }
|
||||||
.bt-theme-hit .tp { border-bottom: 1px solid var(--c-line-soft); }
|
.bt-theme-hit .tp { border-bottom: 1px solid var(--c-line-soft); }
|
||||||
|
|
@ -226,14 +226,14 @@
|
||||||
.bt-theme-check { display: grid; place-items: center; width: 18px; height: 18px; margin-inline-start: auto; border-radius: 50%; background: var(--c-accent); color: var(--c-accent-ink); }
|
.bt-theme-check { display: grid; place-items: center; width: 18px; height: 18px; margin-inline-start: auto; border-radius: 50%; background: var(--c-accent); color: var(--c-accent-ink); }
|
||||||
.bt-theme-info small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--c-muted); font-size: 12px; line-height: 1.4; }
|
.bt-theme-info small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--c-muted); font-size: 12px; line-height: 1.4; }
|
||||||
.bt-theme-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
|
.bt-theme-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
|
||||||
.bt-theme-tags em { padding: 1px 6px; border-radius: calc(5px * var(--bt-rs, 1)); background: var(--c-field); color: var(--c-muted); font: normal 500 10.5px/16px var(--f-mono); }
|
.bt-theme-tags em { padding: 1px 6px; border-radius: 5px; background: var(--c-field); color: var(--c-muted); font: normal 500 10.5px/16px var(--f-mono); }
|
||||||
.bt-theme-tags em.is-accent { color: var(--c-accent); background: var(--c-accent-soft); }
|
.bt-theme-tags em.is-accent { color: var(--c-accent); background: var(--c-accent-soft); }
|
||||||
.bt-theme-remove { position: absolute; top: 8px; inset-inline-end: 8px; display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 1px solid rgba(255, 255, 255, .12); border-radius: calc(8px * var(--bt-rs, 1)); background: rgba(7, 8, 12, .72); color: #fff; backdrop-filter: blur(6px); opacity: 0; cursor: pointer; transition: opacity .15s; }
|
.bt-theme-remove { position: absolute; top: 8px; inset-inline-end: 8px; display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 1px solid rgba(255, 255, 255, .12); border-radius: 8px; background: rgba(7, 8, 12, .72); color: #fff; backdrop-filter: blur(6px); opacity: 0; cursor: pointer; transition: opacity .15s; }
|
||||||
.bt-theme:hover .bt-theme-remove, .bt-theme-remove:focus-visible { opacity: 1; }
|
.bt-theme:hover .bt-theme-remove, .bt-theme-remove:focus-visible { opacity: 1; }
|
||||||
.bt-theme-remove:hover { background: var(--c-danger); border-color: var(--c-danger); }
|
.bt-theme-remove:hover { background: var(--c-danger); border-color: var(--c-danger); }
|
||||||
|
|
||||||
.bt-import { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; border-bottom: 1px solid var(--c-line-soft); }
|
.bt-import { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; border-bottom: 1px solid var(--c-line-soft); }
|
||||||
.bt-import-drop { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px dashed var(--c-line-strong); border-radius: calc(11px * var(--bt-rs, 1)); background: repeating-linear-gradient(135deg, rgba(123, 156, 255, .03) 0 8px, transparent 8px 16px); }
|
.bt-import-drop { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px dashed var(--c-line-strong); border-radius: 11px; background: repeating-linear-gradient(135deg, rgba(123, 156, 255, .03) 0 8px, transparent 8px 16px); }
|
||||||
.bt-import-drop strong { font-size: 13px; font-weight: 600; }
|
.bt-import-drop strong { font-size: 13px; font-weight: 600; }
|
||||||
.bt-import-drop p { margin: 0 0 6px; color: var(--c-muted); font-size: 12px; line-height: 1.5; }
|
.bt-import-drop p { margin: 0 0 6px; color: var(--c-muted); font-size: 12px; line-height: 1.5; }
|
||||||
@container panel (min-width: 620px) { .bt-import { grid-template-columns: 1fr 1fr; } }
|
@container panel (min-width: 620px) { .bt-import { grid-template-columns: 1fr 1fr; } }
|
||||||
|
|
@ -253,7 +253,7 @@
|
||||||
.tp-tabs { display: flex; margin-top: 10px; }
|
.tp-tabs { display: flex; margin-top: 10px; }
|
||||||
.tp-tabs span { flex: 1; padding: 12px 0 14px; color: var(--tp-muted); text-align: center; font-weight: 500; }
|
.tp-tabs span { flex: 1; padding: 12px 0 14px; color: var(--tp-muted); text-align: center; font-weight: 500; }
|
||||||
.tp-tabs span.is-on { position: relative; color: var(--tp-text); font-weight: var(--tp-bold); }
|
.tp-tabs span.is-on { position: relative; color: var(--tp-text); font-weight: var(--tp-bold); }
|
||||||
.tp-tabs span.is-on::after { content: ''; position: absolute; left: 50%; bottom: 0; width: 56px; height: 4px; margin-left: -28px; border-radius: calc(4px * var(--bt-rs, 1)); background: var(--tp-accent); } /* rtl-ok: centred with left: 50% */
|
.tp-tabs span.is-on::after { content: ''; position: absolute; left: 50%; bottom: 0; width: 56px; height: 4px; margin-left: -28px; border-radius: 4px; background: var(--tp-accent); } /* rtl-ok: centred with left: 50% */
|
||||||
.tp-feed.is-cards { padding: 6px 0; }
|
.tp-feed.is-cards { padding: 6px 0; }
|
||||||
.tp-post { display: flex; gap: 12px; padding: var(--tp-pad) 16px; border-bottom: 1px solid var(--tp-border); }
|
.tp-post { display: flex; gap: 12px; padding: var(--tp-pad) 16px; border-bottom: 1px solid var(--tp-border); }
|
||||||
.tp-feed.is-cards .tp-post { margin: calc(var(--tp-pad) / 2 + 2px) 12px; border: 1px solid var(--tp-border); border-radius: var(--tp-r); background: var(--tp-surface); }
|
.tp-feed.is-cards .tp-post { margin: calc(var(--tp-pad) / 2 + 2px) 12px; border: 1px solid var(--tp-border); border-radius: var(--tp-r); background: var(--tp-surface); }
|
||||||
|
|
@ -285,7 +285,7 @@
|
||||||
.btp-results .bt-section:first-child { margin-top: 0; }
|
.btp-results .bt-section:first-child { margin-top: 0; }
|
||||||
|
|
||||||
/* Toast */
|
/* Toast */
|
||||||
.btp-toast { position: absolute; left: 50%; bottom: 18px; z-index: 40; max-width: min(520px, calc(100% - 32px)); padding: 10px 14px; border: 1px solid var(--c-line-strong); border-radius: calc(11px * var(--bt-rs, 1)); background: #141824; box-shadow: 0 16px 40px rgba(0, 0, 0, .55); font-size: 12.5px; cursor: pointer; transform: translateX(-50%); animation: bt-toast .22s var(--ease); }
|
.btp-toast { position: absolute; left: 50%; bottom: 18px; z-index: 40; max-width: min(520px, calc(100% - 32px)); padding: 10px 14px; border: 1px solid var(--c-line-strong); border-radius: 11px; background: #141824; box-shadow: 0 16px 40px rgba(0, 0, 0, .55); font-size: 12.5px; cursor: pointer; transform: translateX(-50%); animation: bt-toast .22s var(--ease); }
|
||||||
.btp-toast.is-error { border-color: rgba(255, 92, 108, .55); background: color-mix(in srgb, var(--c-danger) 12%, var(--c-card)); }
|
.btp-toast.is-error { border-color: rgba(255, 92, 108, .55); background: color-mix(in srgb, var(--c-danger) 12%, var(--c-card)); }
|
||||||
@keyframes bt-toast { from { opacity: 0; transform: translate(-50%, 8px); } }
|
@keyframes bt-toast { from { opacity: 0; transform: translate(-50%, 8px); } }
|
||||||
|
|
||||||
|
|
@ -298,25 +298,25 @@
|
||||||
.btp-group-head h2 { margin: 0; font-size: 13px; font-weight: 620; }
|
.btp-group-head h2 { margin: 0; font-size: 13px; font-weight: 620; }
|
||||||
.btp-group-head p { margin: 2px 0 0; color: var(--c-muted); font-size: 12px; }
|
.btp-group-head p { margin: 2px 0 0; color: var(--c-muted); font-size: 12px; }
|
||||||
.btp-muted { color: var(--c-muted); font-size: 12px; margin-inline-end: auto; }
|
.btp-muted { color: var(--c-muted); font-size: 12px; margin-inline-end: auto; }
|
||||||
.btp-btn { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border: 1px solid var(--c-line); border-radius: calc(8px * var(--bt-rs, 1)); background: var(--c-field); cursor: pointer; font-weight: 540; white-space: nowrap; transition: border-color .15s, background-color .15s; }
|
.btp-btn { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border: 1px solid var(--c-line); border-radius: 8px; background: var(--c-field); cursor: pointer; font-weight: 540; white-space: nowrap; transition: border-color .15s, background-color .15s; }
|
||||||
.btp-btn:hover:not(:disabled) { border-color: var(--c-line-strong); background: var(--c-raise); }
|
.btp-btn:hover:not(:disabled) { border-color: var(--c-line-strong); background: var(--c-raise); }
|
||||||
.btp-btn:disabled { opacity: .42; cursor: default; }
|
.btp-btn:disabled { opacity: .42; cursor: default; }
|
||||||
.btp-btn.is-primary { background: var(--c-text); border-color: var(--c-text); color: var(--c-ground); }
|
.btp-btn.is-primary { background: var(--c-text); border-color: var(--c-text); color: var(--c-ground); }
|
||||||
.btp-btn.is-danger { background: var(--c-danger); border-color: var(--c-danger); color: #fff; }
|
.btp-btn.is-danger { background: var(--c-danger); border-color: var(--c-danger); color: #fff; }
|
||||||
.btp-link { border: 0; background: none; padding: 6px 0; color: var(--c-accent); cursor: pointer; font-weight: 540; }
|
.btp-link { border: 0; background: none; padding: 6px 0; color: var(--c-accent); cursor: pointer; font-weight: 540; }
|
||||||
.btp-row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
|
.btp-row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
|
||||||
.btp-alert { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; padding: 10px 12px; border: 1px solid rgba(255, 92, 108, .35); border-radius: calc(10px * var(--bt-rs, 1)); background: rgba(255, 92, 108, .08); font-size: 12px; }
|
.btp-alert { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; padding: 10px 12px; border: 1px solid rgba(255, 92, 108, .35); border-radius: 10px; background: rgba(255, 92, 108, .08); font-size: 12px; }
|
||||||
.btp-alert .btp-btn { margin-inline-start: auto; }
|
.btp-alert .btp-btn { margin-inline-start: auto; }
|
||||||
.btp-toolbar { display: flex; gap: 8px; }
|
.btp-toolbar { display: flex; gap: 8px; }
|
||||||
.btp-seg { display: inline-flex; gap: 2px; margin: 12px 0 8px; padding: 3px; border: 1px solid var(--c-line); border-radius: calc(10px * var(--bt-rs, 1)); background: var(--c-chrome); }
|
.btp-seg { display: inline-flex; gap: 2px; margin: 12px 0 8px; padding: 3px; border: 1px solid var(--c-line); border-radius: 10px; background: var(--c-chrome); }
|
||||||
.btp-seg button { height: 26px; padding: 0 11px; border: 0; border-radius: calc(7px * var(--bt-rs, 1)); background: none; color: var(--c-muted); cursor: pointer; font-weight: 520; }
|
.btp-seg button { height: 26px; padding: 0 11px; border: 0; border-radius: 7px; background: none; color: var(--c-muted); cursor: pointer; font-weight: 520; }
|
||||||
.btp-seg button.is-on { background: var(--c-raise); color: var(--c-text); box-shadow: 0 0 0 1px var(--c-line-strong); }
|
.btp-seg button.is-on { background: var(--c-raise); color: var(--c-text); box-shadow: 0 0 0 1px var(--c-line-strong); }
|
||||||
.btp-seg span { margin-inline-start: 5px; font: 11px var(--f-mono); opacity: .7; }
|
.btp-seg span { margin-inline-start: 5px; font: 11px var(--f-mono); opacity: .7; }
|
||||||
.btp-list { display: flex; flex-direction: column; gap: 6px; }
|
.btp-list { display: flex; flex-direction: column; gap: 6px; }
|
||||||
.btp-list-head { margin: 16px 2px 4px; color: var(--c-muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
|
.btp-list-head { margin: 16px 2px 4px; color: var(--c-muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
|
||||||
.btp-list-head span { font-family: var(--f-mono); }
|
.btp-list-head span { font-family: var(--f-mono); }
|
||||||
.btp-empty { margin: 0; padding: 26px 16px; border: 1px dashed var(--c-line); border-radius: calc(12px * var(--bt-rs, 1)); color: var(--c-muted); font-size: 12.5px; text-align: center; }
|
.btp-empty { margin: 0; padding: 26px 16px; border: 1px dashed var(--c-line); border-radius: 12px; color: var(--c-muted); font-size: 12.5px; text-align: center; }
|
||||||
.btp-item { display: flex; flex-direction: column; gap: 3px; width: 100%; padding: 11px 13px; border: 1px solid var(--c-line-soft); border-radius: calc(11px * var(--bt-rs, 1)); background: var(--c-card); text-align: start; cursor: pointer; transition: border-color .15s, background-color .15s; }
|
.btp-item { display: flex; flex-direction: column; gap: 3px; width: 100%; padding: 11px 13px; border: 1px solid var(--c-line-soft); border-radius: 11px; background: var(--c-card); text-align: start; cursor: pointer; transition: border-color .15s, background-color .15s; }
|
||||||
.btp-item:hover { border-color: var(--c-line); background: var(--c-field); }
|
.btp-item:hover { border-color: var(--c-line); background: var(--c-field); }
|
||||||
.btp-item.is-on { border-color: var(--c-accent); }
|
.btp-item.is-on { border-color: var(--c-accent); }
|
||||||
.btp-item-top { display: flex; align-items: baseline; gap: 8px; }
|
.btp-item-top { display: flex; align-items: baseline; gap: 8px; }
|
||||||
|
|
@ -324,7 +324,7 @@
|
||||||
.btp-item-top small { flex: 0 0 auto; color: var(--c-muted); font: 11px var(--f-mono); }
|
.btp-item-top small { flex: 0 0 auto; color: var(--c-muted); font: 11px var(--f-mono); }
|
||||||
.btp-item-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--c-muted); font-size: 12px; white-space: pre-wrap; }
|
.btp-item-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--c-muted); font-size: 12px; white-space: pre-wrap; }
|
||||||
.btp-item-meta { display: flex; gap: 6px; margin-top: 3px; }
|
.btp-item-meta { display: flex; gap: 6px; margin-top: 3px; }
|
||||||
.btp-item-meta em { padding: 0 6px; border-radius: calc(5px * var(--bt-rs, 1)); background: var(--c-field); color: var(--c-muted); font: normal 10.5px/17px var(--f-mono); }
|
.btp-item-meta em { padding: 0 6px; border-radius: 5px; background: var(--c-field); color: var(--c-muted); font: normal 10.5px/17px var(--f-mono); }
|
||||||
.btp-item-meta em.is-warn { color: var(--c-warn); }
|
.btp-item-meta em.is-warn { color: var(--c-warn); }
|
||||||
.btp-draft { padding-top: 2px; }
|
.btp-draft { padding-top: 2px; }
|
||||||
.btp-draft-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
|
.btp-draft-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
|
||||||
|
|
@ -333,11 +333,11 @@
|
||||||
.btp-save.is-error, .btp-save.is-conflict { color: var(--c-danger); }
|
.btp-save.is-error, .btp-save.is-conflict { color: var(--c-danger); }
|
||||||
.btp-draft-title { margin-bottom: 8px; font-weight: 600; }
|
.btp-draft-title { margin-bottom: 8px; font-weight: 600; }
|
||||||
.btp-draft-text { height: auto; min-height: 200px; padding: 12px; resize: vertical; line-height: 1.55; }
|
.btp-draft-text { height: auto; min-height: 200px; padding: 12px; resize: vertical; line-height: 1.55; }
|
||||||
.btp-diff pre { margin: 6px 0 0; padding: 8px 10px; max-height: 180px; overflow: auto; border: 1px solid var(--c-line-soft); border-radius: calc(9px * var(--bt-rs, 1)); background: var(--c-card); font: 11.5px/1.5 var(--f-mono); white-space: pre-wrap; }
|
.btp-diff pre { margin: 6px 0 0; padding: 8px 10px; max-height: 180px; overflow: auto; border: 1px solid var(--c-line-soft); border-radius: 9px; background: var(--c-card); font: 11.5px/1.5 var(--f-mono); white-space: pre-wrap; }
|
||||||
.btp-diff pre span { display: block; }
|
.btp-diff pre span { display: block; }
|
||||||
.btp-diff .is-del { background: rgba(255, 92, 108, .14); }
|
.btp-diff .is-del { background: rgba(255, 92, 108, .14); }
|
||||||
.btp-diff .is-add { background: rgba(61, 220, 151, .14); }
|
.btp-diff .is-add { background: rgba(61, 220, 151, .14); }
|
||||||
.btp-account { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--c-line-soft); border-radius: calc(11px * var(--bt-rs, 1)); background: var(--c-card); }
|
.btp-account { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--c-line-soft); border-radius: 11px; background: var(--c-card); }
|
||||||
.btp-account.is-on { border-color: var(--c-line-strong); }
|
.btp-account.is-on { border-color: var(--c-line-strong); }
|
||||||
.btp-account .btp-input { flex: 1; }
|
.btp-account .btp-input { flex: 1; }
|
||||||
.btp-dot { flex: 0 0 auto; width: 14px; height: 14px; padding: 0; border: 0; border-radius: 50%; cursor: pointer; box-shadow: 0 0 0 3px var(--c-card), 0 0 0 4px var(--c-line); }
|
.btp-dot { flex: 0 0 auto; width: 14px; height: 14px; padding: 0; border: 0; border-radius: 50%; cursor: pointer; box-shadow: 0 0 0 3px var(--c-card), 0 0 0 4px var(--c-line); }
|
||||||
|
|
@ -345,36 +345,36 @@
|
||||||
.btp-account-name strong { font-weight: 600; }
|
.btp-account-name strong { font-weight: 600; }
|
||||||
.btp-account-name small { color: var(--c-muted); font-size: 11.5px; }
|
.btp-account-name small { color: var(--c-muted); font-size: 11.5px; }
|
||||||
.btp-account.is-on .btp-account-name small { color: var(--c-accent); }
|
.btp-account.is-on .btp-account-name small { color: var(--c-accent); }
|
||||||
.btp-card { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--c-line-soft); border-radius: calc(12px * var(--bt-rs, 1)); background: var(--c-card); }
|
.btp-card { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--c-line-soft); border-radius: 12px; background: var(--c-card); }
|
||||||
.btp-card > div { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 2px; }
|
.btp-card > div { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 2px; }
|
||||||
.btp-card small { color: var(--c-muted); font-size: 12px; }
|
.btp-card small { color: var(--c-muted); font-size: 12px; }
|
||||||
.btp-notes { margin: 6px 0 0; color: var(--c-muted); font-size: 12px; white-space: pre-wrap; }
|
.btp-notes { margin: 6px 0 0; color: var(--c-muted); font-size: 12px; white-space: pre-wrap; }
|
||||||
|
|
||||||
/* Home: the wayBetter hero, highlights and About */
|
/* Home: the wayBetter hero, highlights and About */
|
||||||
.btp-hero { position: relative; overflow: hidden; isolation: isolate; padding: 30px 24px 26px; border: 1px solid var(--c-line); border-radius: calc(18px * var(--bt-rs, 1)); background: radial-gradient(120% 90% at 0% 0%, rgba(79, 107, 255, .16), transparent 60%), radial-gradient(90% 80% at 100% 10%, rgba(168, 85, 247, .14), transparent 60%), var(--c-card); }
|
.btp-hero { position: relative; overflow: hidden; isolation: isolate; padding: 30px 24px 26px; border: 1px solid var(--c-line); border-radius: 18px; background: radial-gradient(120% 90% at 0% 0%, rgba(79, 107, 255, .16), transparent 60%), radial-gradient(90% 80% at 100% 10%, rgba(168, 85, 247, .14), transparent 60%), var(--c-card); }
|
||||||
.btp-hero::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--c-brush); opacity: .9; }
|
.btp-hero::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--c-brush); opacity: .9; }
|
||||||
.btp-hero-glow { position: absolute; z-index: -1; inset-inline-end: -60px; bottom: -90px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(34, 211, 238, .16), transparent 70%); filter: blur(8px); }
|
.btp-hero-glow { position: absolute; z-index: -1; inset-inline-end: -60px; bottom: -90px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(34, 211, 238, .16), transparent 70%); filter: blur(8px); }
|
||||||
.btp-hero-mark { display: inline-grid; place-items: center; width: 76px; height: 76px; margin-bottom: 18px; border-radius: calc(20px * var(--bt-rs, 1)); background: linear-gradient(160deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .02)); box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 18px 40px -12px rgba(79, 107, 255, .55); }
|
.btp-hero-mark { display: inline-grid; place-items: center; width: 76px; height: 76px; margin-bottom: 18px; border-radius: 20px; background: linear-gradient(160deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .02)); box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 18px 40px -12px rgba(79, 107, 255, .55); }
|
||||||
.btp-hero-mark img { border-radius: calc(14px * var(--bt-rs, 1)); }
|
.btp-hero-mark img { border-radius: 14px; }
|
||||||
.btp-hero-kicker { margin: 0 0 6px; color: var(--c-muted); font-size: 12.5px; font-weight: 560; letter-spacing: .01em; }
|
.btp-hero-kicker { margin: 0 0 6px; color: var(--c-muted); font-size: 12.5px; font-weight: 560; letter-spacing: .01em; }
|
||||||
.btp-hero-name { background: var(--c-brush); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 720; }
|
.btp-hero-name { background: var(--c-brush); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 720; }
|
||||||
.btp-hero-title { margin: 0; font-size: clamp(24px, 6cqi, 34px); line-height: 1.08; font-weight: 700; letter-spacing: -.035em; }
|
.btp-hero-title { margin: 0; font-size: clamp(24px, 6cqi, 34px); line-height: 1.08; font-weight: 700; letter-spacing: -.035em; }
|
||||||
.btp-hero-title em { font-style: normal; background: var(--c-brush); -webkit-background-clip: text; background-clip: text; color: transparent; }
|
.btp-hero-title em { font-style: normal; background: var(--c-brush); -webkit-background-clip: text; background-clip: text; color: transparent; }
|
||||||
.btp-hero-lede { max-width: 54ch; margin: 12px 0 0; color: var(--c-muted); font-size: 13.5px; line-height: 1.55; }
|
.btp-hero-lede { max-width: 54ch; margin: 12px 0 0; color: var(--c-muted); font-size: 13.5px; line-height: 1.55; }
|
||||||
.btp-hero-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
|
.btp-hero-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
|
||||||
.btp-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border: 1px solid var(--c-line-strong); border-radius: calc(999px * var(--bt-rs, 1)); background: rgba(255, 255, 255, .03); color: var(--c-text); font-size: 11.5px; font-weight: 560; font-variant-numeric: tabular-nums; }
|
.btp-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border: 1px solid var(--c-line-strong); border-radius: 999px; background: rgba(255, 255, 255, .03); color: var(--c-text); font-size: 11.5px; font-weight: 560; font-variant-numeric: tabular-nums; }
|
||||||
.btp-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
|
.btp-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
|
||||||
.btp-hero-actions .btp-btn { height: 34px; padding: 0 16px; border-radius: calc(10px * var(--bt-rs, 1)); }
|
.btp-hero-actions .btp-btn { height: 34px; padding: 0 16px; border-radius: 10px; }
|
||||||
|
|
||||||
.btp-highlights { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; margin: 12px 0 26px; }
|
.btp-highlights { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; margin: 12px 0 26px; }
|
||||||
.btp-highlight { display: grid; grid-template-columns: auto 1fr; column-gap: 9px; row-gap: 3px; align-items: center; padding: 13px 14px; border: 1px solid var(--c-line-soft); border-radius: calc(12px * var(--bt-rs, 1)); background: var(--c-card); color: var(--c-text); text-align: start; cursor: pointer; transition: border-color .15s, background-color .15s, transform .15s; }
|
.btp-highlight { display: grid; grid-template-columns: auto 1fr; column-gap: 9px; row-gap: 3px; align-items: center; padding: 13px 14px; border: 1px solid var(--c-line-soft); border-radius: 12px; background: var(--c-card); color: var(--c-text); text-align: start; cursor: pointer; transition: border-color .15s, background-color .15s, transform .15s; }
|
||||||
.btp-highlight:hover { border-color: var(--c-line-strong); background: var(--c-field); transform: translateY(-1px); }
|
.btp-highlight:hover { border-color: var(--c-line-strong); background: var(--c-field); transform: translateY(-1px); }
|
||||||
.btp-highlight svg { color: var(--c-accent); }
|
.btp-highlight svg { color: var(--c-accent); }
|
||||||
.btp-highlight strong { font-size: 13px; font-weight: 640; }
|
.btp-highlight strong { font-size: 13px; font-weight: 640; }
|
||||||
.btp-highlight span { grid-column: 1 / -1; color: var(--c-muted); font-size: 12px; line-height: 1.45; }
|
.btp-highlight span { grid-column: 1 / -1; color: var(--c-muted); font-size: 12px; line-height: 1.45; }
|
||||||
|
|
||||||
.btp-about .btp-group-head p { max-width: 64ch; line-height: 1.55; font-size: 12.5px; margin-top: 4px; }
|
.btp-about .btp-group-head p { max-width: 64ch; line-height: 1.55; font-size: 12.5px; margin-top: 4px; }
|
||||||
.btp-layers { display: grid; gap: 1px; margin: 12px 0 0; padding: 0; list-style: none; border: 1px solid var(--c-line-soft); border-radius: calc(12px * var(--bt-rs, 1)); overflow: hidden; background: var(--c-line-soft); }
|
.btp-layers { display: grid; gap: 1px; margin: 12px 0 0; padding: 0; list-style: none; border: 1px solid var(--c-line-soft); border-radius: 12px; overflow: hidden; background: var(--c-line-soft); }
|
||||||
.btp-layers li { display: flex; gap: 14px; align-items: baseline; padding: 13px 16px; background: var(--c-card); }
|
.btp-layers li { display: flex; gap: 14px; align-items: baseline; padding: 13px 16px; background: var(--c-card); }
|
||||||
.btp-layers li div { display: grid; gap: 2px; }
|
.btp-layers li div { display: grid; gap: 2px; }
|
||||||
.btp-layers strong { font-size: 13px; font-weight: 640; }
|
.btp-layers strong { font-size: 13px; font-weight: 640; }
|
||||||
|
|
@ -393,7 +393,7 @@
|
||||||
.wb-pack-facts dt { color: var(--c-text-2, inherit); opacity: .75; }
|
.wb-pack-facts dt { color: var(--c-text-2, inherit); opacity: .75; }
|
||||||
.wb-pack-facts dd { margin: 0; overflow-wrap: anywhere; }
|
.wb-pack-facts dd { margin: 0; overflow-wrap: anywhere; }
|
||||||
.wb-pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(32px, 1fr)); gap: 6px; padding: 8px 0; }
|
.wb-pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(32px, 1fr)); gap: 6px; padding: 8px 0; }
|
||||||
.wb-pack-grid span { display: grid; place-items: center; height: 32px; border-radius: calc(8px * var(--bt-rs, 1)); background: rgba(127, 127, 127, .08); }
|
.wb-pack-grid span { display: grid; place-items: center; height: 32px; border-radius: 8px; background: rgba(127, 127, 127, .08); }
|
||||||
.wb-pack-grid .bt-glyph { width: 20px; height: 20px; }
|
.wb-pack-grid .bt-glyph { width: 20px; height: 20px; }
|
||||||
.wb-pack-warning { color: var(--c-warn, #d9a441); font-size: 12px; }
|
.wb-pack-warning { color: var(--c-warn, #d9a441); font-size: 12px; }
|
||||||
.wb-pack-list { flex-wrap: wrap; margin-top: 6px; }
|
.wb-pack-list { flex-wrap: wrap; margin-top: 6px; }
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@
|
||||||
// are counts, names and paths. The panel reads the translations through the app's i18n instance
|
// are counts, names and paths. The panel reads the translations through the app's i18n instance
|
||||||
// (setShellI18n); tests/panel.test.ts checks that every key the panel uses is here.
|
// (setShellI18n); tests/panel.test.ts checks that every key the panel uses is here.
|
||||||
|
|
||||||
import { DOCTOR_MESSAGES } from '../../../runtime/src/themeDoctor.ts';
|
|
||||||
|
|
||||||
export const PANEL_MESSAGES = {
|
export const PANEL_MESSAGES = {
|
||||||
'wb.appearance.accent': 'Accent',
|
'wb.appearance.accent': 'Accent',
|
||||||
'wb.appearance.accentColor': 'Accent color',
|
'wb.appearance.accentColor': 'Accent color',
|
||||||
|
|
@ -700,7 +698,7 @@ export const PANEL_MESSAGES = {
|
||||||
'wb.settings.media.folderRemoved': 'Folder removed.',
|
'wb.settings.media.folderRemoved': 'Folder removed.',
|
||||||
'wb.settings.media.folders': 'Gallery folders',
|
'wb.settings.media.folders': 'Gallery folders',
|
||||||
'wb.settings.media.foldersHint': 'The newest images from these folders. Only files directly inside them are read.',
|
'wb.settings.media.foldersHint': 'The newest images from these folders. Only files directly inside them are read.',
|
||||||
'wb.settings.media.hint': 'The Media panel ({shortcut}) beside {site}.',
|
'wb.settings.media.hint': 'The Media panel (Ctrl+Shift+G) beside {site}.',
|
||||||
'wb.settings.media.keep': 'Items to keep',
|
'wb.settings.media.keep': 'Items to keep',
|
||||||
'wb.settings.media.keepHint': 'Older items drop off the end.',
|
'wb.settings.media.keepHint': 'Older items drop off the end.',
|
||||||
'wb.settings.media.noFolders': 'No folders yet. Add one to see its images in the Media panel.',
|
'wb.settings.media.noFolders': 'No folders yet. Add one to see its images in the Media panel.',
|
||||||
|
|
@ -766,17 +764,6 @@ export const PANEL_MESSAGES = {
|
||||||
'wb.ui.select.placeholder': 'Choose…',
|
'wb.ui.select.placeholder': 'Choose…',
|
||||||
'wb.ui.stepper.decrease': 'Decrease {label}',
|
'wb.ui.stepper.decrease': 'Decrease {label}',
|
||||||
'wb.ui.stepper.increase': 'Increase {label}',
|
'wb.ui.stepper.increase': 'Increase {label}',
|
||||||
'wb.doctor.title': 'Theme doctor',
|
|
||||||
'wb.doctor.hint': 'Advice about this theme: lighter ways to do the same, costs and contrast. It only advises; nothing is blocked or changed.',
|
|
||||||
'wb.doctor.empty': 'Nothing to report: the theme uses tokens and component settings, and nothing in it is costly.',
|
|
||||||
'wb.doctor.count': '{count, plural, one {# finding} other {# findings}}',
|
|
||||||
'wb.doctor.kind.lighter': 'A lighter way',
|
|
||||||
'wb.doctor.kind.performance': 'Performance',
|
|
||||||
'wb.doctor.kind.accessibility': 'Accessibility',
|
|
||||||
'wb.doctor.kind.contrast': 'Contrast',
|
|
||||||
'wb.doctor.where': 'Where',
|
|
||||||
'wb.doctor.fix': 'Fix',
|
|
||||||
...DOCTOR_MESSAGES,
|
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export type PanelKey = keyof typeof PANEL_MESSAGES;
|
export type PanelKey = keyof typeof PANEL_MESSAGES;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
/* Plugins list: permission and source badges (Extensions.tsx). */
|
/* Plugins list: permission and source badges (Extensions.tsx). */
|
||||||
.wbx-perms { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-inline-start: 6px; vertical-align: middle; }
|
.wbx-perms { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-inline-start: 6px; vertical-align: middle; }
|
||||||
.wbx-perms span { padding: 0 6px; height: 18px; display: inline-flex; align-items: center; border-radius: calc(5px * var(--bt-rs, 1)); font: 500 10.5px/1 var(--f-mono, ui-monospace, monospace); color: var(--c-muted); background: var(--c-field); border: 1px solid var(--c-line-soft); }
|
.wbx-perms span { padding: 0 6px; height: 18px; display: inline-flex; align-items: center; border-radius: 5px; font: 500 10.5px/1 var(--f-mono, ui-monospace, monospace); color: var(--c-muted); background: var(--c-field); border: 1px solid var(--c-line-soft); }
|
||||||
.wbx-perms span.is-warn { color: var(--c-warn); border-color: color-mix(in srgb, var(--c-warn) 35%, transparent); }
|
.wbx-perms span.is-warn { color: var(--c-warn); border-color: color-mix(in srgb, var(--c-warn) 35%, transparent); }
|
||||||
.wbx-perms span.is-ok { color: var(--c-ok); border-color: color-mix(in srgb, var(--c-ok) 30%, transparent); }
|
.wbx-perms span.is-ok { color: var(--c-ok); border-color: color-mix(in srgb, var(--c-ok) 30%, transparent); }
|
||||||
.wbx-perms span.is-source { color: var(--c-accent); border-color: rgb(var(--c-accent-rgb) / .3); }
|
.wbx-perms span.is-source { color: var(--c-accent); border-color: rgb(var(--c-accent-rgb) / .3); }
|
||||||
|
|
@ -20,12 +20,12 @@
|
||||||
/* Area plugins (PluginFeatures.tsx): one card per area, its features inside. */
|
/* Area plugins (PluginFeatures.tsx): one card per area, its features inside. */
|
||||||
.wbf-area + .wbf-area { border-top: 1px solid var(--c-line-soft); }
|
.wbf-area + .wbf-area { border-top: 1px solid var(--c-line-soft); }
|
||||||
.wbf-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 60px; }
|
.wbf-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 60px; }
|
||||||
.wbf-icon { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: calc(9px * var(--bt-rs, 1)); background: var(--c-accent-soft); color: var(--c-accent); }
|
.wbf-icon { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--c-accent-soft); color: var(--c-accent); }
|
||||||
.wbf-area.is-off .wbf-icon { background: var(--c-field); color: var(--c-muted); }
|
.wbf-area.is-off .wbf-icon { background: var(--c-field); color: var(--c-muted); }
|
||||||
.wbf-title { flex: 1; min-width: 0; display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 8px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
|
.wbf-title { flex: 1; min-width: 0; display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 8px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
|
||||||
.wbf-title strong { font-size: 14px; font-weight: 620; }
|
.wbf-title strong { font-size: 14px; font-weight: 620; }
|
||||||
.wbf-title small { grid-column: 1 / -1; margin-top: 2px; color: var(--c-muted); font-size: 12px; line-height: 1.45; }
|
.wbf-title small { grid-column: 1 / -1; margin-top: 2px; color: var(--c-muted); font-size: 12px; line-height: 1.45; }
|
||||||
.wbf-title:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 4px; border-radius: calc(6px * var(--bt-rs, 1)); }
|
.wbf-title:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 4px; border-radius: 6px; }
|
||||||
.wbf-title:disabled { cursor: default; }
|
.wbf-title:disabled { cursor: default; }
|
||||||
.wbf-caret { flex: none; display: grid; color: var(--c-muted); transition: transform .14s var(--ease, ease); }
|
.wbf-caret { flex: none; display: grid; color: var(--c-muted); transition: transform .14s var(--ease, ease); }
|
||||||
.wbf-caret.is-open { transform: rotate(180deg); }
|
.wbf-caret.is-open { transform: rotate(180deg); }
|
||||||
|
|
@ -45,13 +45,13 @@
|
||||||
.wbm-onboarding h1 { margin: 8px 0 0; font-size: 24px; font-weight: 680; letter-spacing: -.01em; text-wrap: balance; }
|
.wbm-onboarding h1 { margin: 8px 0 0; font-size: 24px; font-weight: 680; letter-spacing: -.01em; text-wrap: balance; }
|
||||||
.wbm-onboarding > p { margin: 0; max-width: 58ch; color: var(--c-muted); font-size: 13px; line-height: 1.5; }
|
.wbm-onboarding > p { margin: 0; max-width: 58ch; color: var(--c-muted); font-size: 13px; line-height: 1.5; }
|
||||||
.wbm-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; width: 100%; margin: 18px 0 6px; }
|
.wbm-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; width: 100%; margin: 18px 0 6px; }
|
||||||
.wbm-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 1px solid var(--c-line-soft); border-radius: calc(14px * var(--bt-rs, 1)); background: var(--c-card); color: inherit; font: inherit; text-align: start; cursor: pointer; transition: border-color .12s var(--ease, ease), box-shadow .12s var(--ease, ease); }
|
.wbm-card { display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 1px solid var(--c-line-soft); border-radius: 14px; background: var(--c-card); color: inherit; font: inherit; text-align: start; cursor: pointer; transition: border-color .12s var(--ease, ease), box-shadow .12s var(--ease, ease); }
|
||||||
.wbm-card:hover { border-color: var(--c-line-strong); }
|
.wbm-card:hover { border-color: var(--c-line-strong); }
|
||||||
.wbm-card.is-on { border-color: var(--c-accent); box-shadow: 0 0 0 1px var(--c-accent); }
|
.wbm-card.is-on { border-color: var(--c-accent); box-shadow: 0 0 0 1px var(--c-accent); }
|
||||||
.wbm-card:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 3px; }
|
.wbm-card:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 3px; }
|
||||||
.wbm-card strong { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 15px; font-weight: 640; }
|
.wbm-card strong { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 15px; font-weight: 640; }
|
||||||
.wbm-card > span:last-child { color: var(--c-muted); font-size: 12.5px; line-height: 1.5; }
|
.wbm-card > span:last-child { color: var(--c-muted); font-size: 12.5px; line-height: 1.5; }
|
||||||
.wbm-art { display: grid; place-items: center; height: 72px; border-radius: calc(10px * var(--bt-rs, 1)); background: var(--c-field); color: var(--c-muted); }
|
.wbm-art { display: grid; place-items: center; height: 72px; border-radius: 10px; background: var(--c-field); color: var(--c-muted); }
|
||||||
.wbm-card.is-on .wbm-art { color: var(--c-accent); }
|
.wbm-card.is-on .wbm-art { color: var(--c-accent); }
|
||||||
/* The shell's base glyph rule (16px icons) must not shrink a card's picture to a few dots. */
|
/* The shell's base glyph rule (16px icons) must not shrink a card's picture to a few dots. */
|
||||||
.wbm-art svg { width: 96px; height: 40px; }
|
.wbm-art svg { width: 96px; height: 40px; }
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/* The Languages section (StringPacks.tsx): one row per installed string pack. */
|
/* The Languages section (StringPacks.tsx): one row per installed string pack. */
|
||||||
.btp-strings { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
|
.btp-strings { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
|
||||||
.btp-strings-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: calc(10px * var(--bt-rs, 1)); background: var(--c-surface-2, var(--c-surface)); }
|
.btp-strings-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--c-surface-2, var(--c-surface)); }
|
||||||
.btp-strings-row.is-on { box-shadow: inset 0 0 0 1px var(--c-accent); }
|
.btp-strings-row.is-on { box-shadow: inset 0 0 0 1px var(--c-accent); }
|
||||||
.btp-strings-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
|
.btp-strings-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
|
||||||
.btp-strings-text small { color: var(--c-text-2, var(--c-muted)); overflow-wrap: anywhere; }
|
.btp-strings-text small { color: var(--c-text-2, var(--c-muted)); overflow-wrap: anywhere; }
|
||||||
|
|
|
||||||
|
|
@ -228,19 +228,3 @@
|
||||||
|
|
||||||
/* String packs on the install screen: what is ignored or cannot be replaced yet. */
|
/* String packs on the install screen: what is ignored or cannot be replaced yet. */
|
||||||
.wbi-strings-notes { margin: 6px 0 0; padding-left: 18px; color: var(--wb-muted, inherit); font-size: 12.5px; }
|
.wbi-strings-notes { margin: 6px 0 0; padding-left: 18px; color: var(--wb-muted, inherit); font-size: 12.5px; }
|
||||||
|
|
||||||
/* Icon packs on the install screen: every drawing of the pack, as the shell will draw it. */
|
|
||||||
.wbi-pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(32px, 1fr)); gap: 6px; padding: 8px 0 0; }
|
|
||||||
.wbi-pack-grid span { display: grid; place-items: center; height: 32px; border-radius: 8px; background: rgb(var(--wb-text-rgb) / .06); color: var(--wb-text); }
|
|
||||||
.wbi-pack-grid svg { width: 20px; height: 20px; }
|
|
||||||
|
|
||||||
/* The switch of a built-in (area plugin) item in the Store. */
|
|
||||||
.wbs-switch { position: relative; display: inline-block; width: 34px; height: 20px; flex: none; cursor: pointer; }
|
|
||||||
.wbs-switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
|
|
||||||
.wbs-switch span { position: absolute; inset: 0; border-radius: 999px; background: rgb(var(--wb-text-rgb) / .22); transition: background .15s; pointer-events: none; }
|
|
||||||
.wbs-switch span::after { content: ''; position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
|
|
||||||
.wbs-switch input:checked + span { background: var(--wb-accent, #1d9bf0); }
|
|
||||||
.wbs-switch input:checked + span::after { transform: translateX(14px); }
|
|
||||||
.wbs-switch input:focus-visible + span { outline: 2px solid var(--wb-accent, #1d9bf0); outline-offset: 2px; }
|
|
||||||
[dir="rtl"] .wbs-switch input:checked + span::after { transform: translateX(-14px); }
|
|
||||||
@media (prefers-reduced-motion: reduce) { .wbs-switch span, .wbs-switch span::after { transition: none; } }
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ export const STORE_MESSAGES = {
|
||||||
'wb.store.category.tools': 'Tools',
|
'wb.store.category.tools': 'Tools',
|
||||||
'wb.store.category.dark': 'Dark',
|
'wb.store.category.dark': 'Dark',
|
||||||
'wb.store.category.light': 'Light',
|
'wb.store.category.light': 'Light',
|
||||||
'wb.store.category.icons': 'Icons',
|
|
||||||
'wb.store.builtIn': 'Built in',
|
'wb.store.builtIn': 'Built in',
|
||||||
'wb.store.use': 'Use',
|
'wb.store.use': 'Use',
|
||||||
'wb.store.install': 'Install',
|
'wb.store.install': 'Install',
|
||||||
|
|
@ -123,29 +122,6 @@ export const STORE_MESSAGES = {
|
||||||
'wb.install.openStrings': 'Open Languages',
|
'wb.install.openStrings': 'Open Languages',
|
||||||
'wb.store.strings': 'Languages',
|
'wb.store.strings': 'Languages',
|
||||||
'wb.store.stringsItem': 'String pack',
|
'wb.store.stringsItem': 'String pack',
|
||||||
'wb.install.eyebrow.icons.install': 'Install icon pack',
|
|
||||||
'wb.install.eyebrow.icons.update': 'Update icon pack',
|
|
||||||
'wb.install.eyebrow.icons.reinstall': 'Reinstall icon pack',
|
|
||||||
'wb.install.err.icons': 'This icon pack cannot be installed',
|
|
||||||
'wb.install.err.iconsNone': '{site} cannot install icon packs here.',
|
|
||||||
'wb.install.err.iconsLarge': 'Icon packs are limited to 120 KB.',
|
|
||||||
'wb.install.err.iconsNotInstalled': 'The icon pack was not installed',
|
|
||||||
'wb.install.err.opened': 'This file cannot be installed',
|
|
||||||
'wb.install.icons.dataOnly': 'Data only: drawings as path data and small pictures. No code and no styles; nothing in it runs.',
|
|
||||||
'wb.install.icons.license': 'License',
|
|
||||||
'wb.install.icons.source': 'Drawings from',
|
|
||||||
'wb.install.icons.count': 'Icons',
|
|
||||||
'wb.install.icons.countValue': '{count, plural, one {# icon} other {# icons}}',
|
|
||||||
'wb.install.icons.file': 'The pack file',
|
|
||||||
'wb.install.done.iconsOn': 'It is your icon pack now. Switch back any time in Appearance.',
|
|
||||||
'wb.install.done.iconsOff': 'It is in your icon packs in Appearance.',
|
|
||||||
'wb.store.icons': 'Icons',
|
|
||||||
'wb.store.iconsItem': 'Icon pack',
|
|
||||||
'wb.store.builtinTab': 'Built in',
|
|
||||||
'wb.store.builtinItem': 'Built in',
|
|
||||||
'wb.store.areaSwitch': 'Turn {name} on or off',
|
|
||||||
'wb.store.areaOn': 'On',
|
|
||||||
'wb.store.areaOff': 'Off',
|
|
||||||
'wb.strings.section': 'Languages',
|
'wb.strings.section': 'Languages',
|
||||||
'wb.strings.title': 'String packs',
|
'wb.strings.title': 'String packs',
|
||||||
'wb.strings.intro': 'A string pack replaces {site}’s own words with text: a language {site} does not offer, a better translation, or your own wording. Packs apply in this order; a later one wins where two change the same word. Words no pack changes stay exactly as {site} shows them.',
|
'wb.strings.intro': 'A string pack replaces {site}’s own words with text: a language {site} does not offer, a better translation, or your own wording. Packs apply in this order; a later one wins where two change the same word. Words no pack changes stay exactly as {site} shows them.',
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,7 @@
|
||||||
import { STORE_MESSAGES, type StoreKey, type StoreText } from './storeMessages.ts';
|
import { STORE_MESSAGES, type StoreKey, type StoreText } from './storeMessages.ts';
|
||||||
import type { StringsInfo } from './stringPacksModel.ts';
|
import type { StringsInfo } from './stringPacksModel.ts';
|
||||||
|
|
||||||
export type InstallKind = 'theme' | 'plugin' | 'strings' | 'icons';
|
export type InstallKind = 'theme' | 'plugin' | 'strings';
|
||||||
/** What a catalog item can be: anything installable, or a feature that ships inside the app (`builtin`, shown with its switch). */
|
|
||||||
export type StoreKind = InstallKind | 'builtin';
|
|
||||||
export type SourceKind = 'store' | 'link' | 'file';
|
export type SourceKind = 'store' | 'link' | 'file';
|
||||||
export type PermissionTone = 'plain' | 'warn' | 'ok';
|
export type PermissionTone = 'plain' | 'warn' | 'ok';
|
||||||
export type PermissionBadge = { id: string; label: string; detail: string; tone: PermissionTone };
|
export type PermissionBadge = { id: string; label: string; detail: string; tone: PermissionTone };
|
||||||
|
|
@ -17,9 +15,8 @@ export type PermissionBadge = { id: string; label: string; detail: string; tone:
|
||||||
export type StoreItem = {
|
export type StoreItem = {
|
||||||
/** The wayBetter apps it is for; native code only hands an app its own items. */
|
/** The wayBetter apps it is for; native code only hands an app its own items. */
|
||||||
apps?: string[];
|
apps?: string[];
|
||||||
kind: StoreKind; id: string; name: string; author: string; version: string; description: string;
|
kind: InstallKind; id: string; name: string; author: string; version: string; description: string;
|
||||||
/** `url`, `sha256` and `size` are absent on a built-in item (nothing to download). */
|
category: string; tags: string[]; url: string; file?: string; sha256: string; size: number;
|
||||||
category: string; tags: string[]; url?: string; file?: string; sha256?: string; size?: number;
|
|
||||||
preview?: string; permissions?: string[] | null; colors?: { bg: string; surface?: string; text: string; accent: string } | null;
|
preview?: string; permissions?: string[] | null; colors?: { bg: string; surface?: string; text: string; accent: string } | null;
|
||||||
/** String packs: the pack's language tag. */
|
/** String packs: the pack's language tag. */
|
||||||
language?: string;
|
language?: string;
|
||||||
|
|
@ -56,8 +53,6 @@ export type InstallPreview = {
|
||||||
version: string;
|
version: string;
|
||||||
plugin: ScriptPluginMeta | null;
|
plugin: ScriptPluginMeta | null;
|
||||||
theme: { name: string; author: string; description: string; cssChars: number } | null;
|
theme: { name: string; author: string; description: string; cssChars: number } | null;
|
||||||
/** Icon packs: what the pack says about itself (the shell parses and draws the rest). */
|
|
||||||
icons?: { id: string; name: string; author: string; license: string; glyphs: number } | null;
|
|
||||||
/** String packs: what the pack says about itself (coverage comes from the site's inventory). */
|
/** String packs: what the pack says about itself (coverage comes from the site's inventory). */
|
||||||
strings?: StringsInfo | null;
|
strings?: StringsInfo | null;
|
||||||
findings: string[];
|
findings: string[];
|
||||||
|
|
@ -66,10 +61,7 @@ export type InstallPreview = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** The `install-link` event and `install_pending` entries (waybetter-host `LinkEvent`). */
|
/** The `install-link` event and `install_pending` entries (waybetter-host `LinkEvent`). */
|
||||||
export type LinkEvent = { link?: { kind: InstallKind; url: string }; opened?: OpenedFile; error?: string; setup?: string };
|
export type LinkEvent = { link?: { kind: InstallKind; url: string }; error?: string; setup?: string };
|
||||||
|
|
||||||
/** A file the OS handed to the app ("Open with", double-click): its random id (`install_stage_opened`), name and what it would be. The path never reaches the shell. */
|
|
||||||
export type OpenedFile = { id: string; name: string; kind: InstallKind };
|
|
||||||
|
|
||||||
/** Plugin permissions (waybetter-host `PERMISSIONS`, runtime `permissions.ts`) and how much they allow. */
|
/** Plugin permissions (waybetter-host `PERMISSIONS`, runtime `permissions.ts`) and how much they allow. */
|
||||||
export const PERMISSION_TONES: Readonly<Record<string, PermissionTone>> = {
|
export const PERMISSION_TONES: Readonly<Record<string, PermissionTone>> = {
|
||||||
|
|
@ -105,18 +97,17 @@ export function categoryLabel(id: string, t: StoreText): string {
|
||||||
return lookup(t, `wb.store.category.${id}`, undefined, id);
|
return lookup(t, `wb.store.category.${id}`, undefined, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** What a dropped file is, by name: `.plugin.js` → plugin, `.strings.json` → string pack, `.icons.json` → icon pack, `.json` → theme, else nothing. */
|
/** What a dropped file is, by name: `.plugin.js` → plugin, `.strings.json` → string pack, `.json` → theme, else nothing. */
|
||||||
export function kindForFile(name: string): InstallKind | null {
|
export function kindForFile(name: string): InstallKind | null {
|
||||||
const lower = name.toLowerCase();
|
const lower = name.toLowerCase();
|
||||||
if (lower.endsWith('.plugin.js')) return 'plugin';
|
if (lower.endsWith('.plugin.js')) return 'plugin';
|
||||||
if (lower.endsWith('.strings.json')) return 'strings';
|
if (lower.endsWith('.strings.json')) return 'strings';
|
||||||
if (lower.endsWith('.icons.json')) return 'icons';
|
|
||||||
if (lower.endsWith('.json')) return 'theme';
|
if (lower.endsWith('.json')) return 'theme';
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Largest file the shell reads before handing it to native validation (same caps as native). */
|
/** Largest file the shell reads before handing it to native validation (same caps as native). */
|
||||||
export const MAX_FILE_BYTES: Readonly<Record<InstallKind, number>> = { theme: 2 * 1024 * 1024, plugin: 2 * 1024 * 1024, strings: 2 * 1024 * 1024, icons: 120_000 };
|
export const MAX_FILE_BYTES: Readonly<Record<InstallKind, number>> = { theme: 2 * 1024 * 1024, plugin: 2 * 1024 * 1024, strings: 2 * 1024 * 1024 };
|
||||||
|
|
||||||
/** A free theme id: `wanted`, else `wanted-2`, `-3`, … (the way an import names copies). */
|
/** A free theme id: `wanted`, else `wanted-2`, `-3`, … (the way an import names copies). */
|
||||||
export function freeThemeId(wanted: string, taken: Iterable<string>): string {
|
export function freeThemeId(wanted: string, taken: Iterable<string>): string {
|
||||||
|
|
@ -142,8 +133,6 @@ export function newerVersion(a: string, b: string): boolean {
|
||||||
export type ItemState =
|
export type ItemState =
|
||||||
| { state: 'install' }
|
| { state: 'install' }
|
||||||
| { state: 'builtin' }
|
| { state: 'builtin' }
|
||||||
/** A feature that ships inside the app (an area plugin); the Store shows its switch. */
|
|
||||||
| { state: 'area' }
|
|
||||||
| { state: 'installed'; version: string; enabled?: boolean }
|
| { state: 'installed'; version: string; enabled?: boolean }
|
||||||
| { state: 'update'; version: string; enabled?: boolean }
|
| { state: 'update'; version: string; enabled?: boolean }
|
||||||
/** Installed but changed locally (edited file, or a copy from somewhere else): the store leaves it alone unless asked. */
|
/** Installed but changed locally (edited file, or a copy from somewhere else): the store leaves it alone unless asked. */
|
||||||
|
|
@ -156,8 +145,6 @@ export type ItemContext = {
|
||||||
builtinThemes: readonly string[];
|
builtinThemes: readonly string[];
|
||||||
/** The owner's own theme ids right now. */
|
/** The owner's own theme ids right now. */
|
||||||
userThemes: readonly string[];
|
userThemes: readonly string[];
|
||||||
/** The owner's installed icon pack ids right now (absent: trust the install records). */
|
|
||||||
userIcons?: readonly string[];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -174,14 +161,6 @@ export function itemState(item: StoreItem, context: ItemContext): ItemState {
|
||||||
if (newerVersion(item.version, installed.version)) return { state: 'update', ...base };
|
if (newerVersion(item.version, installed.version)) return { state: 'update', ...base };
|
||||||
return { state: 'modified', ...base };
|
return { state: 'modified', ...base };
|
||||||
}
|
}
|
||||||
if (item.kind === 'builtin') return { state: 'area' };
|
|
||||||
if (item.kind === 'icons') {
|
|
||||||
const found = Object.entries(context.records).find(([key, value]) => key.startsWith('icons:') && value.storeId === item.id && (context.userIcons?.includes(key.slice(6)) ?? true));
|
|
||||||
if (!found) return { state: 'install' };
|
|
||||||
const [, value] = found;
|
|
||||||
if (value.sha256 === item.sha256) return { state: 'installed', version: value.version };
|
|
||||||
return newerVersion(item.version, value.version) ? { state: 'update', version: value.version } : { state: 'installed', version: value.version };
|
|
||||||
}
|
|
||||||
if (item.kind === 'strings') {
|
if (item.kind === 'strings') {
|
||||||
const record = context.records[`strings:${item.id}`];
|
const record = context.records[`strings:${item.id}`];
|
||||||
if (!record) return { state: 'install' };
|
if (!record) return { state: 'install' };
|
||||||
|
|
@ -205,7 +184,7 @@ export function installedThemeId(item: StoreItem, records: Record<string, Instal
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Search and category filter for the store list. */
|
/** Search and category filter for the store list. */
|
||||||
export function filterItems(items: readonly StoreItem[], query: string, kind: StoreKind | 'all', category: string | 'all'): StoreItem[] {
|
export function filterItems(items: readonly StoreItem[], query: string, kind: InstallKind | 'all', category: string | 'all'): StoreItem[] {
|
||||||
const words = query.toLowerCase().split(/\s+/).filter(Boolean);
|
const words = query.toLowerCase().split(/\s+/).filter(Boolean);
|
||||||
return items.filter(item => (kind === 'all' || item.kind === kind) && (category === 'all' || item.category === category)
|
return items.filter(item => (kind === 'all' || item.kind === kind) && (category === 'all' || item.category === category)
|
||||||
&& words.every(word => [item.name, item.description, item.author, item.category, item.language ?? '', ...item.tags, ...(item.permissions ?? [])].join(' ').toLowerCase().includes(word)));
|
&& words.every(word => [item.name, item.description, item.author, item.category, item.language ?? '', ...item.tags, ...(item.permissions ?? [])].join(' ').toLowerCase().includes(word)));
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,6 @@ export function packSummary(text: string, inventory: PageInventory): StringsSumm
|
||||||
// The page inventory lists every key once, in its groups: count what a pack can replace.
|
// The page inventory lists every key once, in its groups: count what a pack can replace.
|
||||||
for (const ids of [inventory.text, inventory.closed]) if (ids) for (const id of ids.split(' ')) { if (lookup(id) && translatable(lookup(id)!.kind)) translatableCount += 1; else closed += 1; }
|
for (const ids of [inventory.text, inventory.closed]) if (ids) for (const id of ids.split(' ')) { if (lookup(id) && translatable(lookup(id)!.kind)) translatableCount += 1; else closed += 1; }
|
||||||
translatableCount += Object.keys(inventory.message).length;
|
translatableCount += Object.keys(inventory.message).length;
|
||||||
translatableCount += Object.keys(inventory.rich ?? {}).length;
|
|
||||||
if (record.catalog !== inventory.catalog) {
|
if (record.catalog !== inventory.catalog) {
|
||||||
return { language, translated: 0, translatable: translatableCount, closed, unknown: Object.keys(record.strings).length, refused: 0, sample: [], otherCatalog: true };
|
return { language, translated: 0, translatable: translatableCount, closed, unknown: Object.keys(record.strings).length, refused: 0, sample: [], otherCatalog: true };
|
||||||
}
|
}
|
||||||
|
|
@ -74,15 +73,12 @@ export const coveragePercent = (summary: Pick<StringsSummary, 'translated' | 'tr
|
||||||
export function buildDelivery(texts: readonly string[], inventory: PageInventory, options: { translate?: boolean } = {}): string | null {
|
export function buildDelivery(texts: readonly string[], inventory: PageInventory, options: { translate?: boolean } = {}): string | null {
|
||||||
const packs: unknown[] = [];
|
const packs: unknown[] = [];
|
||||||
const ids = new Set<string>();
|
const ids = new Set<string>();
|
||||||
// A pack that rewords the site's own text needs the shape of every key, not a slice.
|
|
||||||
let rewording = false;
|
|
||||||
for (const text of texts) {
|
for (const text of texts) {
|
||||||
let pack: unknown;
|
let pack: unknown;
|
||||||
try { pack = JSON.parse(text); } catch { continue; }
|
try { pack = JSON.parse(text); } catch { continue; }
|
||||||
let compiled;
|
let compiled;
|
||||||
try { compiled = compilePack(pack, inventory); } catch { continue; }
|
try { compiled = compilePack(pack, inventory); } catch { continue; }
|
||||||
if (!compiled.values.size && !compiled.rewrite) continue;
|
if (!compiled.values.size) continue;
|
||||||
if (compiled.rewrite) rewording = true;
|
|
||||||
packs.push(pack);
|
packs.push(pack);
|
||||||
for (const id of compiled.values.keys()) ids.add(id);
|
for (const id of compiled.values.keys()) ids.add(id);
|
||||||
if (packs.length >= 8) break;
|
if (packs.length >= 8) break;
|
||||||
|
|
@ -90,5 +86,5 @@ export function buildDelivery(texts: readonly string[], inventory: PageInventory
|
||||||
// Translate mode: the whole inventory (the author may change any string), packs or not.
|
// Translate mode: the whole inventory (the author may change any string), packs or not.
|
||||||
if (options.translate) return JSON.stringify({ inventory, packs, translate: true });
|
if (options.translate) return JSON.stringify({ inventory, packs, translate: true });
|
||||||
if (!packs.length) return null;
|
if (!packs.length) return null;
|
||||||
return JSON.stringify({ inventory: rewording ? inventory : sliceInventory(inventory, ids), packs });
|
return JSON.stringify({ inventory: sliceInventory(inventory, ids), packs });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,10 @@ import test from 'node:test';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { accountAction, accountStartUrl, tabsByAccount, type PaneInfo } from '../src/frame/accountModel.ts';
|
import { accountAction, accountStartUrl, tabsByAccount, type PaneInfo } from '../src/frame/accountModel.ts';
|
||||||
import { BOOT_CACHE_KEY, bootScript } from '../src/frame/boot.ts';
|
import { BOOT_CACHE_KEY, bootScript } from '../src/frame/boot.ts';
|
||||||
import { CHROME_VAR_NAMES, chromeEdges, chromeVars } from '../src/frame/chromeTheme.ts';
|
import { CHROME_VAR_NAMES, chromeVars } from '../src/frame/chromeTheme.ts';
|
||||||
import { defaultDeckSettings, normalizeDeckSettings } from '../src/frame/deckStore.ts';
|
import { defaultDeckSettings, normalizeDeckSettings } from '../src/frame/deckStore.ts';
|
||||||
import { FRAME_MESSAGES } from '../src/frame/frameMessages.ts';
|
import { FRAME_MESSAGES } from '../src/frame/frameMessages.ts';
|
||||||
import { os } from '../src/windowControls.ts';
|
import { attachTarget } from '../src/frame/mediaModel.ts';
|
||||||
import { attachTarget, isMediaShortcut, mediaShortcutLabel } from '../src/frame/mediaModel.ts';
|
|
||||||
import { buildItems, type PaletteContext } from '../src/frame/paletteModel.ts';
|
import { buildItems, type PaletteContext } from '../src/frame/paletteModel.ts';
|
||||||
import { toUrl } from '../src/frame/searchInput.ts';
|
import { toUrl } from '../src/frame/searchInput.ts';
|
||||||
import { configureSite, type ShellSite } from '../src/frame/site.ts';
|
import { configureSite, type ShellSite } from '../src/frame/site.ts';
|
||||||
|
|
@ -67,21 +66,6 @@ const context: PaletteContext = {
|
||||||
};
|
};
|
||||||
const setup = { site: site.palette, product: site.product, decks: true, media: false };
|
const setup = { site: site.palette, product: site.product, decks: true, media: false };
|
||||||
|
|
||||||
test('Media panel key: Ctrl+Shift+G on Windows/Linux, Cmd+Shift+M on macOS (Cmd+Shift+G is Find Previous there)', () => {
|
|
||||||
const key = (over: Partial<Parameters<typeof isMediaShortcut>[0]>) => ({ key: '', shiftKey: true, ctrlKey: false, metaKey: false, altKey: false, ...over });
|
|
||||||
assert.equal(isMediaShortcut(key({ key: 'G', ctrlKey: true }), 'windows'), true);
|
|
||||||
assert.equal(isMediaShortcut(key({ key: 'g', ctrlKey: true, shiftKey: false }), 'windows'), false, 'Ctrl+G alone is not it');
|
|
||||||
assert.equal(isMediaShortcut(key({ key: 'M', ctrlKey: true }), 'windows'), false, 'Windows/Linux keep one key');
|
|
||||||
assert.equal(isMediaShortcut(key({ key: 'G', metaKey: true }), 'macos'), false, 'Cmd+Shift+G is Find Previous');
|
|
||||||
assert.equal(isMediaShortcut(key({ key: 'M', metaKey: true }), 'macos'), true);
|
|
||||||
assert.equal(isMediaShortcut(key({ key: 'm', metaKey: true, shiftKey: false }), 'macos'), false);
|
|
||||||
assert.equal(isMediaShortcut(key({ key: 'M', ctrlKey: true }), 'macos'), false);
|
|
||||||
assert.equal(mediaShortcutLabel('macos'), 'Cmd+Shift+M');
|
|
||||||
assert.equal(mediaShortcutLabel('windows'), 'Ctrl+Shift+G');
|
|
||||||
const item = () => buildItems(context, 'media', { ...setup, media: true }).find(entry => entry.id === 'media')?.hint;
|
|
||||||
assert.equal(item(), mediaShortcutLabel(os), 'the palette hint follows the platform');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('palette: frame groups, then the app, plugins and the site; the literal search stays last', () => {
|
test('palette: frame groups, then the app, plugins and the site; the literal search stays last', () => {
|
||||||
const empty = buildItems(context, '', setup);
|
const empty = buildItems(context, '', setup);
|
||||||
assert.deepEqual([...new Set(empty.map(item => item.group))], ['Tabs', 'Deck', 'Workspaces', 'Profiles', 'wayBetter for Example', 'Example']);
|
assert.deepEqual([...new Set(empty.map(item => item.group))], ['Tabs', 'Deck', 'Workspaces', 'Profiles', 'wayBetter for Example', 'Example']);
|
||||||
|
|
@ -127,42 +111,6 @@ test('chrome variables: none for the own style, fonts only without colors, every
|
||||||
for (const name of Object.keys(vars)) assert.ok(CHROME_VAR_NAMES.includes(name), name);
|
for (const name of Object.keys(vars)) assert.ok(CHROME_VAR_NAMES.includes(name), name);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('chrome variables: hints and status inks keep 4.5:1 on the menus of light, dark and bevelled themes', async () => {
|
|
||||||
const { contrast } = await import('../src/frame/chromeTheme.ts');
|
|
||||||
const light = { bg: '#fdf6e3', surface: '#f5efdc', elevated: '#eee8d5', border: '#d6cfb8', text: '#073642', muted: '#657b83', accent: '#268bd2' };
|
|
||||||
const dark = { bg: '#1a1b26', surface: '#1f2130', elevated: '#24283b', border: '#2f3549', text: '#c0caf5', muted: '#9099c4', accent: '#7aa2f7' };
|
|
||||||
for (const colors of [light, dark]) {
|
|
||||||
const vars = chromeVars({ colors });
|
|
||||||
for (const name of ['--wb-c-faint', '--wb-c-muted', '--wb-c-warn', '--wb-c-danger-ink']) assert.ok(contrast(vars[name]!, colors.elevated) >= 4.5, `${name} on ${colors.elevated}`);
|
|
||||||
}
|
|
||||||
const bevel = chromeVars({ colors: { ...light, page: '#c0c0c0', elevated: '#dfdfdf' }, edges: 'bevel' });
|
|
||||||
for (const name of ['--wb-c-faint', '--wb-c-muted', '--wb-c-warn', '--wb-c-danger-ink']) assert.ok(contrast(bevel[name]!, '#c0c0c0') >= 4.5, `${name} on the face`);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('chrome variables: radii scale with the theme, a bevelled theme gets 98-style edges from its own face', () => {
|
|
||||||
const colors = { bg: '#ffffff', surface: '#f4f4f4', elevated: '#dfdfdf', border: '#808080', text: '#000000', muted: '#3c3c3c', accent: '#0000a8', page: '#c0c0c0', inverse: '#000080', onInverse: '#ffffff' };
|
|
||||||
assert.equal(chromeVars({ colors, radius: 0 })['--wb-c-rs'], '0');
|
|
||||||
assert.equal(chromeVars({ colors, radius: 12 })['--wb-c-rs'], '1');
|
|
||||||
assert.equal(chromeVars({ colors, radius: 40 })['--wb-c-rs'], '1.5');
|
|
||||||
// A theme that keeps the site's colors keeps wayBetter's own corners and edges.
|
|
||||||
assert.deepEqual(chromeVars({ colors: null, radius: 0, edges: 'bevel' }), {});
|
|
||||||
const flat = chromeVars({ colors, radius: 0 });
|
|
||||||
assert.equal(chromeEdges(flat), null);
|
|
||||||
assert.equal(flat['--wb-c-face'], undefined);
|
|
||||||
const bevel = chromeVars({ colors, radius: 0, edges: 'bevel' });
|
|
||||||
assert.equal(chromeEdges(bevel), 'bevel');
|
|
||||||
// 98.css's four edge lines, from the theme's silver.
|
|
||||||
assert.equal(bevel['--wb-c-face'], '#c0c0c0');
|
|
||||||
assert.equal(bevel['--wb-c-bevel-hi'], '#ffffff');
|
|
||||||
assert.equal(bevel['--wb-c-bevel-sh'], '#808080');
|
|
||||||
assert.equal(bevel['--wb-c-bevel-dk'], '#0a0a0a');
|
|
||||||
assert.equal(bevel['--wb-c-title-from'], '#000080');
|
|
||||||
assert.equal(bevel['--wb-c-title-text'], '#ffffff');
|
|
||||||
for (const name of Object.keys(bevel)) assert.ok(CHROME_VAR_NAMES.includes(name), name);
|
|
||||||
// The first frame paints the edges too.
|
|
||||||
assert.ok(bootScript().includes("root.dataset.wbEdges = 'bevel'"));
|
|
||||||
});
|
|
||||||
|
|
||||||
test('account switcher: a visible pane on the site first, else the feed or sign-in beside', () => {
|
test('account switcher: a visible pane on the site first, else the feed or sign-in beside', () => {
|
||||||
const settings = normalizeProfiles({ active: 'default', profiles: [
|
const settings = normalizeProfiles({ active: 'default', profiles: [
|
||||||
{ id: 'default', name: 'Main', color: '#1d9bf0', account: { handle: 'me', name: 'Me', signedIn: true } },
|
{ id: 'default', name: 'Main', color: '#1d9bf0', account: { handle: 'me', name: 'Me', signedIn: true } },
|
||||||
|
|
|
||||||
|
|
@ -232,8 +232,6 @@ test("the menu's words: English from menuMessages.en.json until a catalog has th
|
||||||
for (const file of ['AppMenu.tsx', 'TitlebarExtras.tsx', 'AccountSwitcher.tsx', 'paletteModel.ts', 'FindBar.tsx', 'menuModel.ts', 'ReportDialog.tsx']) {
|
for (const file of ['AppMenu.tsx', 'TitlebarExtras.tsx', 'AccountSwitcher.tsx', 'paletteModel.ts', 'FindBar.tsx', 'menuModel.ts', 'ReportDialog.tsx']) {
|
||||||
for (const match of readFileSync(join(here, '../src/frame', file), 'utf8').matchAll(/menuText\('([A-Za-z]+)'/g)) used.add(`wb.menu.${match[1]}`);
|
for (const match of readFileSync(join(here, '../src/frame', file), 'utf8').matchAll(/menuText\('([A-Za-z]+)'/g)) used.add(`wb.menu.${match[1]}`);
|
||||||
}
|
}
|
||||||
// The native menu bar reads its words through `w('name')` (nativeMenuModel.ts).
|
|
||||||
for (const match of readFileSync(join(here, '../src/frame/nativeMenuModel.ts'), 'utf8').matchAll(/w\('([A-Za-z]+)'/g)) used.add(`wb.menu.${match[1]}`);
|
|
||||||
for (const key of used) assert.ok(key in MENU_MESSAGES, `${key} has English`);
|
for (const key of used) assert.ok(key in MENU_MESSAGES, `${key} has English`);
|
||||||
for (const key of Object.keys(MENU_MESSAGES)) assert.ok(used.has(key), `${key} is used`);
|
for (const key of Object.keys(MENU_MESSAGES)) assert.ok(used.has(key), `${key} is used`);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,78 +0,0 @@
|
||||||
import assert from 'node:assert/strict';
|
|
||||||
import { test } from 'node:test';
|
|
||||||
import { planNativeMenu, runNativeMenu, safeId, type NativeMenuActions, type NativeMenuState } from '../src/frame/nativeMenuModel.ts';
|
|
||||||
import { MENU_MESSAGES } from '../src/frame/menuModel.ts';
|
|
||||||
|
|
||||||
const words = (name: string, params: Record<string, string | number> = {}) =>
|
|
||||||
(MENU_MESSAGES[`wb.menu.${name}`] ?? name).replace(/\{(\w+)\}/g, (_, key) => String(params[key] ?? ''));
|
|
||||||
const text = (key: string) => key.split('.').pop() ?? key;
|
|
||||||
|
|
||||||
const state: NativeMenuState = {
|
|
||||||
product: 'wayBetter for X', hasPanel: true, canSplit: true, canFind: true, safeActive: false,
|
|
||||||
features: { find: true, zoom: true, deck: true, store: true, safeMode: true, workspaces: true, updates: true },
|
|
||||||
themes: [{ id: 'dark', label: 'Dark', checked: true }, { id: 'my theme!', label: 'Mine', checked: false }],
|
|
||||||
iconPacks: [{ id: 'theme', label: 'Follow theme', checked: true }],
|
|
||||||
modes: [{ id: 'basic', label: 'Basic', checked: true }, { id: 'power', label: 'Power User', checked: false }],
|
|
||||||
accounts: [{ id: 'default', label: '@one', checked: true }],
|
|
||||||
plugins: [{ id: 'chat', label: 'Chat+', checked: true }, { id: 'media', label: 'Media+', checked: false }],
|
|
||||||
workspaces: [{ id: 'w1', label: 'Work', checked: false }],
|
|
||||||
installFromFile: true, shareSetup: true, docs: true, website: 'waybetter.fyi',
|
|
||||||
};
|
|
||||||
|
|
||||||
/** Every node of the description, flattened. */
|
|
||||||
type AnyNode = { kind: string; id?: string; label?: string; items?: AnyNode[]; accelerator?: string };
|
|
||||||
const walk = (nodes: AnyNode[]): AnyNode[] => nodes.flatMap(node => [node, ...walk(node.items ?? [])]);
|
|
||||||
|
|
||||||
test('the bar has the eight menus and every item in the owner\'s list', () => {
|
|
||||||
const spec = planNativeMenu(state, words, text);
|
|
||||||
assert.deepEqual(spec.menus.map(menu => (menu as AnyNode).label), ['wayBetter for X', 'File', 'Edit', 'View', 'Account', 'Plugins', 'Window', 'Help']);
|
|
||||||
const ids = walk(spec.menus as AnyNode[]).filter(node => node.kind === 'item').map(node => node.id);
|
|
||||||
for (const id of ['app.about', 'app.updates', 'app.settings', 'app.safe', 'file.new-tab', 'file.split-right', 'file.split-down', 'file.close', 'file.install', 'file.share',
|
|
||||||
'edit.find', 'edit.find-next', 'edit.find-previous', 'view.zoom-in', 'view.zoom-out', 'view.zoom-reset', 'view.deck', 'acct.add', 'plugins.store', 'plugins.folder', 'ws.save', 'help.docs', 'help.report', 'help.website']) {
|
|
||||||
assert.ok(ids.includes(id), id);
|
|
||||||
}
|
|
||||||
assert.ok(ids.includes('theme:dark') && ids.includes('mode:power') && ids.includes('icons:theme') && ids.includes('acct:default') && ids.includes('plugin:chat') && ids.includes('ws:w1'));
|
|
||||||
const roles = walk(spec.menus as AnyNode[]).filter(node => node.kind === 'predefined').map(node => (node as unknown as { role: string }).role);
|
|
||||||
for (const role of ['services', 'hide', 'quit', 'undo', 'cut', 'copy', 'paste', 'select_all', 'minimize', 'fullscreen']) assert.ok(roles.includes(role), role);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('what native code accepts: ids and labels', () => {
|
|
||||||
const spec = planNativeMenu(state, words, text);
|
|
||||||
for (const node of walk(spec.menus as AnyNode[])) {
|
|
||||||
if (node.kind === 'item') assert.match(node.id!, /^[A-Za-z0-9_.:/-]{1,96}$/, node.id);
|
|
||||||
if (node.label !== undefined) assert.ok(node.label.length > 0 && node.label.length <= 120 && !/[\u0000-\u001f]/.test(node.label), node.label);
|
|
||||||
}
|
|
||||||
assert.equal(safeId('my theme!'), 'my_theme_');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('shortcuts follow the standard places', () => {
|
|
||||||
const items = new Map(walk(planNativeMenu(state, words, text).menus as AnyNode[]).filter(node => node.kind === 'item').map(node => [node.id, node.accelerator]));
|
|
||||||
assert.equal(items.get('app.settings'), 'CmdOrCtrl+,');
|
|
||||||
assert.equal(items.get('file.new-tab'), 'CmdOrCtrl+T');
|
|
||||||
assert.equal(items.get('file.close'), 'CmdOrCtrl+W');
|
|
||||||
assert.equal(items.get('edit.find'), 'CmdOrCtrl+F');
|
|
||||||
assert.equal(items.get('edit.find-next'), 'CmdOrCtrl+G');
|
|
||||||
assert.equal(items.get('edit.find-previous'), 'CmdOrCtrl+Shift+G');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('what the app does not serve leaves its items out; nothing is empty', () => {
|
|
||||||
const bare: NativeMenuState = { ...state, themes: undefined, iconPacks: undefined, modes: undefined, plugins: undefined, workspaces: undefined, accounts: [],
|
|
||||||
features: { find: false, zoom: false, deck: false, store: false, safeMode: false, workspaces: false, updates: false }, installFromFile: false, shareSetup: false, docs: false, website: undefined };
|
|
||||||
const ids = walk(planNativeMenu(bare, words, text).menus as AnyNode[]).filter(node => node.kind === 'item').map(node => node.id);
|
|
||||||
for (const gone of ['app.safe', 'app.updates', 'edit.find', 'view.zoom-in', 'view.deck', 'plugins.store', 'file.install', 'help.docs', 'help.website']) assert.ok(!ids.includes(gone), gone);
|
|
||||||
assert.ok(ids.includes('acct.none') && ids.includes('acct.add'));
|
|
||||||
assert.ok(!ids.some(id => id?.startsWith('theme:')));
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a chosen id runs exactly its action; unknown ids run nothing', () => {
|
|
||||||
const calls: string[] = [];
|
|
||||||
const act = new Proxy({}, { get: (_target, name: string) => (...args: unknown[]) => { calls.push(`${name}(${args.join(',')})`); } }) as NativeMenuActions;
|
|
||||||
const run = (id: string) => runNativeMenu(id, state, act);
|
|
||||||
assert.ok(run('file.new-tab') && run('edit.find-previous') && run('theme:my_theme_') && run('mode:power') && run('acct:default') && run('plugin:media') && run('plugin:chat') && run('ws:w1') && run('icons:theme'));
|
|
||||||
assert.deepEqual(calls, ['newTab()', 'findPrevious()', 'theme(my theme!)', 'mode(power)', 'account(default)', 'plugin(media,true)', 'plugin(chat,false)', 'workspace(w1)', 'iconPack(theme)']);
|
|
||||||
calls.length = 0;
|
|
||||||
assert.equal(run('theme:nope'), false);
|
|
||||||
assert.equal(run('evil:thing'), false);
|
|
||||||
assert.equal(run('app.unknown'), false);
|
|
||||||
assert.deepEqual(calls, []);
|
|
||||||
});
|
|
||||||
|
|
@ -1,144 +0,0 @@
|
||||||
import assert from 'node:assert/strict';
|
|
||||||
import test from 'node:test';
|
|
||||||
import { formatMessage } from '../../runtime/src/i18n.ts';
|
|
||||||
import type { IconPack } from '../../runtime/src/themeIcons.ts';
|
|
||||||
import { createInstallController, type StoreBackend, type ThemeAdapter } from '../src/installController.ts';
|
|
||||||
import { STORE_MESSAGES, type StoreText } from '../src/storeMessages.ts';
|
|
||||||
import { filterItems, itemState, kindForFile, MAX_FILE_BYTES, type InstallKind, type InstallPreview, type StoreItem } from '../src/storeModel.ts';
|
|
||||||
|
|
||||||
const t: StoreText = (key, params) => formatMessage(STORE_MESSAGES[key], params);
|
|
||||||
const settle = () => new Promise(resolve => setTimeout(resolve, 0));
|
|
||||||
|
|
||||||
const THEME = '{"name":"Nord","id":"nord"}';
|
|
||||||
const ICONS = '{"id":"line-2","name":"Line 2","author":"me","license":"CC0-1.0","glyphs":{"home":{"d":"M3 3h18v18H3z"}}}';
|
|
||||||
|
|
||||||
type Theme = { id: string; name: string };
|
|
||||||
|
|
||||||
function harness(options: { pending?: unknown[]; withIcons?: boolean } = {}) {
|
|
||||||
const calls: Array<[string, Record<string, unknown> | undefined]> = [];
|
|
||||||
const listeners = new Map<string, (payload: unknown) => void>();
|
|
||||||
const preview = (kind: InstallKind, text: string): InstallPreview => ({
|
|
||||||
token: `tok-${calls.length}`, kind, source: { kind: 'file', url: null, label: 'A file you dropped', signed: false },
|
|
||||||
sha256: 'f'.repeat(64), size: text.length, file: null, text, version: '', plugin: null, theme: null, findings: [], existing: null, store: null,
|
|
||||||
icons: kind === 'icons' ? { id: 'line-2', name: 'Line 2', author: 'me', license: 'CC0-1.0', glyphs: 1 } : null,
|
|
||||||
});
|
|
||||||
const backend: StoreBackend = {
|
|
||||||
async invoke<T>(command: string, args?: Record<string, unknown>) {
|
|
||||||
calls.push([command, args]);
|
|
||||||
if (command === 'install_records') return { items: {} } as T;
|
|
||||||
if (command === 'install_pending') return (options.pending ?? []) as T;
|
|
||||||
if (command === 'install_stage_opened') return preview(args!.id === 'icons-id' ? 'icons' : 'theme', args!.id === 'icons-id' ? ICONS : THEME) as T;
|
|
||||||
if (command === 'install_stage_file') return preview(String(args!.name).endsWith('.icons.json') ? 'icons' : 'theme', String(args!.name).endsWith('.icons.json') ? ICONS : THEME) as T;
|
|
||||||
if (command === 'install_commit') return { themeText: args!.themeId ? THEME : null, iconsText: args!.themeId ? null : ICONS } as T;
|
|
||||||
return undefined as T;
|
|
||||||
},
|
|
||||||
async listen<T>(event: string, handler: (payload: T) => void) {
|
|
||||||
listeners.set(event, handler as (payload: unknown) => void);
|
|
||||||
return () => { listeners.delete(event); };
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const savedThemes: string[] = [];
|
|
||||||
const themes: ThemeAdapter<Theme> = {
|
|
||||||
parse: text => { try { const value = JSON.parse(text) as Theme; return value.name ? { theme: value, warnings: [] } : { error: 'no name' }; } catch { return { error: 'not JSON' }; } },
|
|
||||||
userThemes: async () => [],
|
|
||||||
builtinThemes: ['x'],
|
|
||||||
idOf: theme => theme.id,
|
|
||||||
facts: theme => ({ name: theme.name }),
|
|
||||||
save: async (_theme, id, opts) => { savedThemes.push(id); return { enabled: opts.enable, fonts: [] }; },
|
|
||||||
};
|
|
||||||
const savedPacks: Array<[IconPack, { enable: boolean }]> = [];
|
|
||||||
const controller = createInstallController({
|
|
||||||
backend, t, site: 'X', theme: themes,
|
|
||||||
...(options.withIcons === false ? {} : { icons: { save: async (pack: IconPack, opts: { enable: boolean }) => { savedPacks.push([pack, opts]); } } }),
|
|
||||||
});
|
|
||||||
return { controller, calls, listeners, savedThemes, savedPacks };
|
|
||||||
}
|
|
||||||
|
|
||||||
test('a file the OS handed over is staged by its id and installs only after the screen is confirmed', async () => {
|
|
||||||
const h = harness();
|
|
||||||
const stop = h.controller.start();
|
|
||||||
await settle();
|
|
||||||
h.listeners.get('install-link')!({ opened: { id: 'abc123', name: 'nord.json', kind: 'theme' } });
|
|
||||||
await settle();
|
|
||||||
const stage = h.calls.find(c => c[0] === 'install_stage_opened')!;
|
|
||||||
assert.deepEqual(stage[1], { id: 'abc123' }, 'only the id goes to native code; the shell has no path');
|
|
||||||
assert.equal(h.controller.current()?.status, 'ready', 'the same install screen as a dropped file');
|
|
||||||
assert.ok(!h.calls.some(c => c[0] === 'install_commit') && h.savedThemes.length === 0, 'nothing is written before Install');
|
|
||||||
await h.controller.confirm(true);
|
|
||||||
assert.deepEqual(h.savedThemes, ['nord']);
|
|
||||||
assert.equal(h.controller.current()?.status, 'done');
|
|
||||||
stop();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a file opened before the shell listened is shown from the pending queue', async () => {
|
|
||||||
const h = harness({ pending: [{ opened: { id: 'abc123', name: 'nord.json', kind: 'theme' } }] });
|
|
||||||
const stop = h.controller.start();
|
|
||||||
await settle();
|
|
||||||
assert.equal(h.calls.filter(c => c[0] === 'install_stage_opened').length, 1);
|
|
||||||
assert.equal(h.controller.current()?.status, 'ready');
|
|
||||||
stop();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a file the OS handed over that is refused says why, in the words for a file', async () => {
|
|
||||||
const h = harness();
|
|
||||||
const stop = h.controller.start();
|
|
||||||
await settle();
|
|
||||||
h.listeners.get('install-link')!({ error: 'FILE: only a theme (.json), a plugin (.plugin.js), a string pack (.strings.json) or an icon pack (.icons.json) can be opened here' });
|
|
||||||
await settle();
|
|
||||||
const state = h.controller.current();
|
|
||||||
assert.equal(state?.status, 'error');
|
|
||||||
assert.deepEqual(state && state.status === 'error' ? [state.title, state.message.startsWith('only a theme')] : null, ['This file cannot be installed', true]);
|
|
||||||
assert.ok(!h.calls.some(c => c[0] === 'install_stage_opened'));
|
|
||||||
stop();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('icon packs: told apart from themes by name, staged like any file, parsed again from the committed bytes', async () => {
|
|
||||||
assert.equal(kindForFile('line-2.icons.json'), 'icons');
|
|
||||||
assert.equal(kindForFile('nord.json'), 'theme');
|
|
||||||
assert.equal(MAX_FILE_BYTES.icons, 120_000);
|
|
||||||
const h = harness();
|
|
||||||
const stop = h.controller.start();
|
|
||||||
await settle();
|
|
||||||
await h.controller.requestFile({ name: 'line-2.icons.json', size: ICONS.length, text: async () => ICONS });
|
|
||||||
const ready = h.controller.current();
|
|
||||||
assert.equal(ready?.status, 'ready');
|
|
||||||
assert.equal(ready?.status === 'ready' ? ready.pack?.name : null, 'Line 2', 'the screen can draw the pack');
|
|
||||||
assert.ok(!h.calls.some(c => c[0] === 'install_commit') && h.savedPacks.length === 0, 'nothing is written before Install');
|
|
||||||
await h.controller.confirm(true);
|
|
||||||
assert.deepEqual(h.calls.find(c => c[0] === 'install_commit')![1], { token: (ready as { preview: InstallPreview }).preview.token, enable: true, themeId: null });
|
|
||||||
assert.deepEqual(h.savedPacks.map(([pack, opts]) => [pack.id, Object.keys(pack.glyphs), opts.enable]), [['line-2', ['home'], true]]);
|
|
||||||
assert.deepEqual(h.controller.current(), { status: 'done', kind: 'icons', name: 'Line 2', fonts: [], enabled: true });
|
|
||||||
assert.equal(h.savedThemes.length, 0, 'an icon pack is not a theme');
|
|
||||||
stop();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('icon packs: too large, not installable without the app\'s support,', async () => {
|
|
||||||
const h = harness();
|
|
||||||
await h.controller.requestFile({ name: 'big.icons.json', size: MAX_FILE_BYTES.icons + 1, text: async () => ICONS });
|
|
||||||
const state = h.controller.current();
|
|
||||||
assert.equal(state?.status === 'error' ? state.message : '', 'Icon packs are limited to 120 KB.');
|
|
||||||
const bare = harness({ withIcons: false });
|
|
||||||
await bare.controller.requestFile({ name: 'line-2.icons.json', size: ICONS.length, text: async () => ICONS });
|
|
||||||
assert.equal(bare.controller.current()?.status, 'error');
|
|
||||||
assert.ok(!bare.calls.some(c => c[0] === 'install_commit'));
|
|
||||||
});
|
|
||||||
|
|
||||||
const item = (patch: Partial<StoreItem>): StoreItem => ({
|
|
||||||
apps: ['x'], kind: 'icons', id: 'line-2', name: 'Line 2', author: 'me', version: '1.1.0', description: 'Thin lines', category: 'icons', tags: [],
|
|
||||||
url: 'https://waybetter.fyi/store/icons/line-2.icons.json', sha256: 'a'.repeat(64), size: 100, ...patch,
|
|
||||||
});
|
|
||||||
|
|
||||||
test('the Store: icon packs follow their install records and the packs the owner still has; built-in items are areas', () => {
|
|
||||||
const base = { plugins: {}, records: {}, builtinThemes: [], userThemes: [] as string[] };
|
|
||||||
assert.equal(itemState(item({}), base).state, 'install');
|
|
||||||
const records = { 'icons:line-2-copy': { kind: 'icons' as const, source: 'store' as const, storeId: 'line-2', version: '1.0.0', sha256: 'b'.repeat(64), installedAt: '' } };
|
|
||||||
assert.equal(itemState(item({}), { ...base, records }).state, 'update', 'no list of packs: the records decide');
|
|
||||||
assert.equal(itemState(item({}), { ...base, records, userIcons: ['line-2-copy'] }).state, 'update');
|
|
||||||
assert.equal(itemState(item({}), { ...base, records, userIcons: [] }).state, 'install', 'a pack the owner removed in Appearance is not installed');
|
|
||||||
assert.equal(itemState(item({ sha256: 'b'.repeat(64) }), { ...base, records, userIcons: ['line-2-copy'] }).state, 'installed');
|
|
||||||
const area = item({ kind: 'builtin', id: 'compose', name: 'Compose+', url: undefined, sha256: undefined, size: undefined, category: 'writing' });
|
|
||||||
assert.equal(itemState(area, base).state, 'area');
|
|
||||||
const all = [item({}), area];
|
|
||||||
assert.deepEqual(filterItems(all, '', 'builtin', 'all').map(i => i.id), ['compose']);
|
|
||||||
assert.deepEqual(filterItems(all, '', 'icons', 'all').map(i => i.id), ['line-2']);
|
|
||||||
});
|
|
||||||
|
|
@ -39,17 +39,3 @@ test('store model: string packs by file name and by install record', () => {
|
||||||
assert.deepEqual(itemState(item, { ...context, records: { 'strings:esperanto': record } as never }), { state: 'update', version: '1.0.0' });
|
assert.deepEqual(itemState(item, { ...context, records: { 'strings:esperanto': record } as never }), { state: 'update', version: '1.0.0' });
|
||||||
assert.deepEqual(itemState(item, { ...context, records: { 'strings:esperanto': { ...record, sha256: 'b'.repeat(64) } } as never }), { state: 'installed', version: '1.0.0' });
|
assert.deepEqual(itemState(item, { ...context, records: { 'strings:esperanto': { ...record, sha256: 'b'.repeat(64) } } as never }), { state: 'installed', version: '1.0.0' });
|
||||||
});
|
});
|
||||||
|
|
||||||
test('delivery: a rewording pack counts as usable and brings the whole inventory; rich keys with slots are translatable', () => {
|
|
||||||
const rich: PageInventory = { ...INVENTORY, rich: { d0000001: 2 } };
|
|
||||||
const wording = pack({}, { name: 'Wording', language: 'en-x-twitter', when: { languages: ['en'] }, rewrite: { words: { Post: 'Tweet' } } });
|
|
||||||
const delivery = JSON.parse(buildDelivery([wording, pack({ a0000001: 'Hejmo' })], rich)!);
|
|
||||||
assert.deepEqual(delivery.inventory, rich, 'the whole inventory, not a slice');
|
|
||||||
assert.deepEqual(delivery.packs.map((p: { name: string }) => p.name), ['Wording', 'Esperanto']);
|
|
||||||
assert.equal(buildDelivery([wording], rich) !== null, true);
|
|
||||||
assert.equal(buildDelivery([pack({})], rich), null, 'a pack with neither strings nor a rule changes nothing');
|
|
||||||
const summary = packSummary(pack({ d0000001: 'Legu {e1} antaŭ {e0}.', a0000001: 'Hejmo' }), rich)!;
|
|
||||||
assert.equal(summary.translatable, 5, 'the rich key with slots is counted as translatable');
|
|
||||||
assert.equal(summary.translated, 2);
|
|
||||||
assert.equal(summary.refused, 0);
|
|
||||||
});
|
|
||||||
|
|
|
||||||
|
|
@ -15,19 +15,7 @@ import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node
|
||||||
import { dirname, isAbsolute, join, relative, resolve } from 'node:path';
|
import { dirname, isAbsolute, join, relative, resolve } from 'node:path';
|
||||||
import { pathToFileURL } from 'node:url';
|
import { pathToFileURL } from 'node:url';
|
||||||
|
|
||||||
/**
|
|
||||||
* Two catalog files, one source. `catalog.json` is format 2 and lists only the kinds every app
|
|
||||||
* since the first release knows (theme, plugin, strings): an app from before a kind existed refuses
|
|
||||||
* a whole catalog that lists it. `catalog.v3.json` is format 3, lists everything (icons, builtin, ...)
|
|
||||||
* and is read first by apps that know it; they fall back to `catalog.json` when it is not published.
|
|
||||||
* `waybetter store build` writes both from the same items; `sign` and `verify` handle both.
|
|
||||||
*/
|
|
||||||
export const CATALOG_FORMAT = 2;
|
export const CATALOG_FORMAT = 2;
|
||||||
export const CATALOG_FORMAT_NEXT = 3;
|
|
||||||
export const CATALOG_FILE = 'catalog.json';
|
|
||||||
export const CATALOG_FILE_NEXT = 'catalog.v3.json';
|
|
||||||
/** The kinds format 2 may list; a newer kind is format 3 only. */
|
|
||||||
export const LEGACY_KINDS = ['theme', 'plugin', 'strings'];
|
|
||||||
export const DEFAULT_BASE = 'https://waybetter.fyi/store/';
|
export const DEFAULT_BASE = 'https://waybetter.fyi/store/';
|
||||||
/** The framework's download hosts (waybetter-host `DEFAULT_HOSTS`). */
|
/** The framework's download hosts (waybetter-host `DEFAULT_HOSTS`). */
|
||||||
export const DEFAULT_HOSTS = [
|
export const DEFAULT_HOSTS = [
|
||||||
|
|
@ -37,9 +25,6 @@ export const DEFAULT_HOSTS = [
|
||||||
];
|
];
|
||||||
export const PERMISSIONS = ['storage', 'ui', 'clipboard', 'account', 'users', 'commands', 'network', 'network:none'];
|
export const PERMISSIONS = ['storage', 'ui', 'clipboard', 'account', 'users', 'commands', 'network', 'network:none'];
|
||||||
const MAX_BYTES = 2 * 1024 * 1024;
|
const MAX_BYTES = 2 * 1024 * 1024;
|
||||||
/** An icon pack file (the runtime's `ICON_LIMITS.packBytes`). */
|
|
||||||
const MAX_ICONS_BYTES = 120_000;
|
|
||||||
const KINDS = ['theme', 'plugin', 'strings', 'icons', 'builtin'];
|
|
||||||
const MAX_ITEMS = 500;
|
const MAX_ITEMS = 500;
|
||||||
const MAX_CATALOG_BYTES = 1024 * 1024;
|
const MAX_CATALOG_BYTES = 1024 * 1024;
|
||||||
// SPKI DER prefix of an Ed25519 public key; the raw 32 bytes follow it.
|
// SPKI DER prefix of an Ed25519 public key; the raw 32 bytes follow it.
|
||||||
|
|
@ -99,7 +84,7 @@ export function itemProblems(item, hosts) {
|
||||||
if (!item || typeof item !== 'object' || Array.isArray(item)) return ['not an object'];
|
if (!item || typeof item !== 'object' || Array.isArray(item)) return ['not an object'];
|
||||||
for (const key of Object.keys(item)) if (!ITEM_FIELDS.has(key)) bad.push(`unknown field ${key}`);
|
for (const key of Object.keys(item)) if (!ITEM_FIELDS.has(key)) bad.push(`unknown field ${key}`);
|
||||||
if (!Array.isArray(item.apps) || !item.apps.length || item.apps.length > 16 || !item.apps.every(validAppId) || new Set(item.apps).size !== item.apps.length) bad.push('apps');
|
if (!Array.isArray(item.apps) || !item.apps.length || item.apps.length > 16 || !item.apps.every(validAppId) || new Set(item.apps).size !== item.apps.length) bad.push('apps');
|
||||||
if (!KINDS.includes(item.kind)) bad.push('kind');
|
if (item.kind !== 'theme' && item.kind !== 'plugin' && item.kind !== 'strings') bad.push('kind');
|
||||||
// Any item may name its licence and credit its authors; only a string pack has a language.
|
// Any item may name its licence and credit its authors; only a string pack has a language.
|
||||||
if ((item.license !== undefined && (!text(item.license, 60) || !String(item.license).trim())) || (item.credits !== undefined && !text(item.credits, 600))) bad.push('license or credits');
|
if ((item.license !== undefined && (!text(item.license, 60) || !String(item.license).trim())) || (item.credits !== undefined && !text(item.credits, 600))) bad.push('license or credits');
|
||||||
if (item.kind !== 'strings' && item.language !== undefined) bad.push('language');
|
if (item.kind !== 'strings' && item.language !== undefined) bad.push('language');
|
||||||
|
|
@ -107,18 +92,10 @@ export function itemProblems(item, hosts) {
|
||||||
if (!text(item.name, 60) || !String(item.name).trim() || !text(item.author ?? '', 60) || !text(item.description ?? '', 600)) bad.push('name, author or description');
|
if (!text(item.name, 60) || !String(item.name).trim() || !text(item.author ?? '', 60) || !text(item.description ?? '', 600)) bad.push('name, author or description');
|
||||||
if (!text(item.version, 32) || !item.version || !text(item.category ?? '', 32)) bad.push('version or category');
|
if (!text(item.version, 32) || !item.version || !text(item.category ?? '', 32)) bad.push('version or category');
|
||||||
if (item.tags !== undefined && (!Array.isArray(item.tags) || item.tags.length > 12 || !item.tags.every(tag => text(tag, 32)))) bad.push('tags');
|
if (item.tags !== undefined && (!Array.isArray(item.tags) || item.tags.length > 12 || !item.tags.every(tag => text(tag, 32)))) bad.push('tags');
|
||||||
if (item.kind === 'builtin') {
|
|
||||||
// A feature that ships inside the app (an area plugin): nothing to download, so nothing to point at or hash.
|
|
||||||
for (const key of ['url', 'sha256', 'size', 'file', 'permissions', 'colors', 'language']) if (item[key] !== undefined) bad.push('built-in item fields');
|
|
||||||
} else {
|
|
||||||
if (typeof item.url !== 'string' || !item.url.startsWith('https://') || (hosts && !allowedUrl(item.url, hosts))) bad.push('url (host not allowed)');
|
if (typeof item.url !== 'string' || !item.url.startsWith('https://') || (hosts && !allowedUrl(item.url, hosts))) bad.push('url (host not allowed)');
|
||||||
}
|
|
||||||
if (item.preview !== undefined && (typeof item.preview !== 'string' || !item.preview.startsWith('https://') || (hosts && !allowedUrl(item.preview, hosts)))) bad.push('preview');
|
if (item.preview !== undefined && (typeof item.preview !== 'string' || !item.preview.startsWith('https://') || (hosts && !allowedUrl(item.preview, hosts)))) bad.push('preview');
|
||||||
if (item.kind !== 'builtin') {
|
|
||||||
if (typeof item.sha256 !== 'string' || !/^[0-9a-f]{64}$/.test(item.sha256)) bad.push('sha256');
|
if (typeof item.sha256 !== 'string' || !/^[0-9a-f]{64}$/.test(item.sha256)) bad.push('sha256');
|
||||||
if (!Number.isInteger(item.size) || item.size <= 0 || item.size > (item.kind === 'icons' ? MAX_ICONS_BYTES : MAX_BYTES)) bad.push('size');
|
if (!Number.isInteger(item.size) || item.size <= 0 || item.size > MAX_BYTES) bad.push('size');
|
||||||
}
|
|
||||||
if (item.kind === 'icons' && (item.file !== undefined || item.permissions !== undefined || item.colors !== undefined)) bad.push('icon pack fields');
|
|
||||||
if (item.kind === 'plugin') {
|
if (item.kind === 'plugin') {
|
||||||
if (!validFileName(item.file) || item.colors != null) bad.push('plugin file');
|
if (!validFileName(item.file) || item.colors != null) bad.push('plugin file');
|
||||||
const p = item.permissions;
|
const p = item.permissions;
|
||||||
|
|
@ -141,7 +118,7 @@ export function catalogProblems(catalog, { app, hosts = DEFAULT_HOSTS } = {}) {
|
||||||
const out = [];
|
const out = [];
|
||||||
if (!catalog || typeof catalog !== 'object') return ['catalog: not an object'];
|
if (!catalog || typeof catalog !== 'object') return ['catalog: not an object'];
|
||||||
for (const key of Object.keys(catalog)) if (!['format', 'name', 'generatedAt', 'items'].includes(key)) out.push(`catalog: unknown field ${key}`);
|
for (const key of Object.keys(catalog)) if (!['format', 'name', 'generatedAt', 'items'].includes(key)) out.push(`catalog: unknown field ${key}`);
|
||||||
if (catalog.format !== CATALOG_FORMAT && catalog.format !== CATALOG_FORMAT_NEXT) out.push(`catalog: format must be ${CATALOG_FORMAT} or ${CATALOG_FORMAT_NEXT}`);
|
if (catalog.format !== CATALOG_FORMAT) out.push(`catalog: format must be ${CATALOG_FORMAT}`);
|
||||||
if (typeof catalog.name !== 'string' || typeof catalog.generatedAt !== 'string') out.push('catalog: name and generatedAt are strings');
|
if (typeof catalog.name !== 'string' || typeof catalog.generatedAt !== 'string') out.push('catalog: name and generatedAt are strings');
|
||||||
if (!Array.isArray(catalog.items)) return [...out, 'catalog: items must be a list'];
|
if (!Array.isArray(catalog.items)) return [...out, 'catalog: items must be a list'];
|
||||||
if (catalog.items.length > MAX_ITEMS) out.push(`catalog: more than ${MAX_ITEMS} items`);
|
if (catalog.items.length > MAX_ITEMS) out.push(`catalog: more than ${MAX_ITEMS} items`);
|
||||||
|
|
@ -150,7 +127,6 @@ export function catalogProblems(catalog, { app, hosts = DEFAULT_HOSTS } = {}) {
|
||||||
for (const item of catalog.items) {
|
for (const item of catalog.items) {
|
||||||
const where = `item ${item?.kind}:${item?.id}`;
|
const where = `item ${item?.kind}:${item?.id}`;
|
||||||
for (const problem of itemProblems(item, app && item?.apps?.includes(app) ? hosts : undefined)) out.push(`${where}: invalid ${problem}`);
|
for (const problem of itemProblems(item, app && item?.apps?.includes(app) ? hosts : undefined)) out.push(`${where}: invalid ${problem}`);
|
||||||
if (catalog.format === CATALOG_FORMAT && !LEGACY_KINDS.includes(item?.kind)) out.push(`${where}: a format ${CATALOG_FORMAT} catalog lists only ${LEGACY_KINDS.join(', ')} (older apps refuse the whole file otherwise); this kind belongs in ${CATALOG_FILE_NEXT}`);
|
|
||||||
for (const a of Array.isArray(item?.apps) ? item.apps : []) {
|
for (const a of Array.isArray(item?.apps) ? item.apps : []) {
|
||||||
const id = `${a}/${item.kind}/${item.id}`;
|
const id = `${a}/${item.kind}/${item.id}`;
|
||||||
if (ids.has(id)) out.push(`${where}: duplicate for app ${a}`);
|
if (ids.has(id)) out.push(`${where}: duplicate for app ${a}`);
|
||||||
|
|
@ -170,15 +146,12 @@ export function catalogProblems(catalog, { app, hosts = DEFAULT_HOSTS } = {}) {
|
||||||
/**
|
/**
|
||||||
* Builds `config.app`'s part of the shared catalog in `out`: writes the files the config returns,
|
* Builds `config.app`'s part of the shared catalog in `out`: writes the files the config returns,
|
||||||
* replaces the app's items (other apps' items stay as they are), removes files only the app's old
|
* replaces the app's items (other apps' items stay as they are), removes files only the app's old
|
||||||
* items used, validates the whole catalog and writes `catalog.v3.json` (every item) and `catalog.json`
|
* items used, validates the whole catalog and writes `catalog.json` (sign it afterwards).
|
||||||
* (the kinds older apps know), sign both afterwards.
|
|
||||||
*
|
*
|
||||||
* config: { app, name?, base?, out?, hosts?, items(context) → [{ kind, id, name, author, version,
|
* config: { app, name?, base?, out?, hosts?, items(context) → [{ kind, id, name, author, version,
|
||||||
* description, category, tags, file (plugins), permissions (plugins), colors (themes), language
|
* description, category, tags, file (plugins), permissions (plugins), colors (themes), language
|
||||||
* (string packs), license, credits,
|
* (string packs), license, credits,
|
||||||
* path ('plugins/x.plugin.js'), bytes (Buffer|string), preview?: { path, bytes } }] }
|
* path ('plugins/x.plugin.js'), bytes (Buffer|string), preview?: { path, bytes } }] }
|
||||||
* Kinds: theme, plugin, strings, icons (an icon pack, `icons/<id>.icons.json`) and builtin (a
|
|
||||||
* feature that ships inside the app, shown in the Store as built in: no path or bytes).
|
|
||||||
*/
|
*/
|
||||||
export async function buildStore(config, options = {}) {
|
export async function buildStore(config, options = {}) {
|
||||||
const app = config.app;
|
const app = config.app;
|
||||||
|
|
@ -187,14 +160,11 @@ export async function buildStore(config, options = {}) {
|
||||||
if (!/^https:\/\/[^/]+\/(.*\/)?$/.test(base)) throw new Error('base must be an https URL ending in /');
|
if (!/^https:\/\/[^/]+\/(.*\/)?$/.test(base)) throw new Error('base must be an https URL ending in /');
|
||||||
const out = resolve(options.out ?? config.out ?? '.');
|
const out = resolve(options.out ?? config.out ?? '.');
|
||||||
const hosts = config.hosts ?? DEFAULT_HOSTS;
|
const hosts = config.hosts ?? DEFAULT_HOSTS;
|
||||||
const catalogPath = join(out, CATALOG_FILE);
|
const catalogPath = join(out, 'catalog.json');
|
||||||
const nextPath = join(out, CATALOG_FILE_NEXT);
|
const previous = existsSync(catalogPath) ? JSON.parse(readFileSync(catalogPath, 'utf8')) : null;
|
||||||
// The full list (format 3) is what to start from: it has every app's items of every kind.
|
|
||||||
const source = existsSync(nextPath) ? nextPath : catalogPath;
|
|
||||||
const previous = existsSync(source) ? JSON.parse(readFileSync(source, 'utf8')) : null;
|
|
||||||
const kept = [];
|
const kept = [];
|
||||||
const oldFiles = new Set();
|
const oldFiles = new Set();
|
||||||
for (const item of previous?.format === CATALOG_FORMAT || previous?.format === CATALOG_FORMAT_NEXT ? previous.items : []) {
|
for (const item of previous?.format === CATALOG_FORMAT ? previous.items : []) {
|
||||||
if (!item.apps?.includes(app)) { kept.push(item); continue; }
|
if (!item.apps?.includes(app)) { kept.push(item); continue; }
|
||||||
for (const url of [item.url, item.preview]) if (url?.startsWith(base)) oldFiles.add(url.slice(base.length));
|
for (const url of [item.url, item.preview]) if (url?.startsWith(base)) oldFiles.add(url.slice(base.length));
|
||||||
const others = item.apps.filter(a => a !== app);
|
const others = item.apps.filter(a => a !== app);
|
||||||
|
|
@ -211,16 +181,12 @@ export async function buildStore(config, options = {}) {
|
||||||
const files = new Map();
|
const files = new Map();
|
||||||
const toBytes = value => (Buffer.isBuffer(value) ? value : Buffer.from(String(value), 'utf8'));
|
const toBytes = value => (Buffer.isBuffer(value) ? value : Buffer.from(String(value), 'utf8'));
|
||||||
for (const entry of entries) {
|
for (const entry of entries) {
|
||||||
const item = { apps: [app], kind: entry.kind, id: entry.id, name: entry.name, author: entry.author ?? '', version: entry.version, description: entry.description ?? '', category: entry.category ?? '', tags: entry.tags ?? [] };
|
|
||||||
// A built-in item has no file: the app already has it.
|
|
||||||
if (entry.kind !== 'builtin') {
|
|
||||||
const bytes = toBytes(entry.bytes);
|
const bytes = toBytes(entry.bytes);
|
||||||
files.set(entry.path, { target: inside(entry.path), bytes });
|
files.set(entry.path, { target: inside(entry.path), bytes });
|
||||||
item.url = `${base}${entry.path}`;
|
const item = { apps: [app], kind: entry.kind, id: entry.id, name: entry.name, author: entry.author ?? '', version: entry.version, description: entry.description ?? '', category: entry.category ?? '', tags: entry.tags ?? [], url: `${base}${entry.path}` };
|
||||||
if (entry.kind === 'plugin') item.file = entry.file;
|
if (entry.kind === 'plugin') item.file = entry.file;
|
||||||
item.sha256 = sha256(bytes);
|
item.sha256 = sha256(bytes);
|
||||||
item.size = bytes.length;
|
item.size = bytes.length;
|
||||||
}
|
|
||||||
if (entry.preview) {
|
if (entry.preview) {
|
||||||
files.set(entry.preview.path, { target: inside(entry.preview.path), bytes: toBytes(entry.preview.bytes) });
|
files.set(entry.preview.path, { target: inside(entry.preview.path), bytes: toBytes(entry.preview.bytes) });
|
||||||
item.preview = `${base}${entry.preview.path}`;
|
item.preview = `${base}${entry.preview.path}`;
|
||||||
|
|
@ -233,27 +199,23 @@ export async function buildStore(config, options = {}) {
|
||||||
items.push(item);
|
items.push(item);
|
||||||
}
|
}
|
||||||
const catalog = {
|
const catalog = {
|
||||||
format: CATALOG_FORMAT_NEXT,
|
format: CATALOG_FORMAT,
|
||||||
name: config.name ?? previous?.name ?? 'wayBetter Store',
|
name: config.name ?? previous?.name ?? 'wayBetter Store',
|
||||||
generatedAt: new Date().toISOString().replace(/\.\d+Z$/, 'Z'),
|
generatedAt: new Date().toISOString().replace(/\.\d+Z$/, 'Z'),
|
||||||
items: [...kept, ...items],
|
items: [...kept, ...items],
|
||||||
};
|
};
|
||||||
// Nothing is written unless the whole catalog is valid.
|
// Nothing is written unless the whole catalog is valid.
|
||||||
// The same items twice: everything for apps that know the newer kinds, and what every app knows.
|
const problems = catalogProblems(catalog, { app, hosts });
|
||||||
const legacy = { ...catalog, format: CATALOG_FORMAT, items: catalog.items.filter(item => LEGACY_KINDS.includes(item.kind)) };
|
|
||||||
const problems = [...catalogProblems(catalog, { app, hosts }), ...catalogProblems(legacy, { app, hosts })];
|
|
||||||
if (problems.length) throw new Error(`the catalog would be invalid:\n ${problems.join('\n ')}`);
|
if (problems.length) throw new Error(`the catalog would be invalid:\n ${problems.join('\n ')}`);
|
||||||
const json = `${JSON.stringify(catalog, null, 2)}\n`;
|
const json = `${JSON.stringify(catalog, null, 2)}\n`;
|
||||||
const legacyJson = `${JSON.stringify(legacy, null, 2)}\n`;
|
|
||||||
if (Buffer.byteLength(json) > MAX_CATALOG_BYTES) throw new Error('the catalog is larger than apps accept (1 MiB)');
|
if (Buffer.byteLength(json) > MAX_CATALOG_BYTES) throw new Error('the catalog is larger than apps accept (1 MiB)');
|
||||||
for (const { target, bytes } of files.values()) { mkdirSync(dirname(target), { recursive: true }); writeFileSync(target, bytes); }
|
for (const { target, bytes } of files.values()) { mkdirSync(dirname(target), { recursive: true }); writeFileSync(target, bytes); }
|
||||||
// Files this app's previous build wrote and no item uses any more (never another app's files).
|
// Files this app's previous build wrote and no item uses any more (never another app's files).
|
||||||
const stillUsed = new Set(kept.flatMap(item => [item.url, item.preview]).filter(url => url?.startsWith(base)).map(url => url.slice(base.length)));
|
const stillUsed = new Set(kept.flatMap(item => [item.url, item.preview]).filter(url => url?.startsWith(base)).map(url => url.slice(base.length)));
|
||||||
for (const path of oldFiles) if (!files.has(path) && !stillUsed.has(path)) rmSync(inside(path), { force: true });
|
for (const path of oldFiles) if (!files.has(path) && !stillUsed.has(path)) rmSync(inside(path), { force: true });
|
||||||
mkdirSync(out, { recursive: true });
|
mkdirSync(out, { recursive: true });
|
||||||
writeFileSync(nextPath, json);
|
writeFileSync(catalogPath, json);
|
||||||
writeFileSync(catalogPath, legacyJson);
|
return { catalog, path: catalogPath, items };
|
||||||
return { catalog, legacy, path: catalogPath, nextPath, items };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- Keys and signatures ----------------------------------------------------------------------
|
// ---- Keys and signatures ----------------------------------------------------------------------
|
||||||
|
|
@ -324,12 +286,6 @@ function parse(argv) {
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** `catalog.json` and, next to it, `catalog.v3.json` when it exists (one source, two files); any other file alone. */
|
|
||||||
export function catalogFiles(file) {
|
|
||||||
const next = join(dirname(file), CATALOG_FILE_NEXT);
|
|
||||||
return file.endsWith(CATALOG_FILE) && !file.endsWith(CATALOG_FILE_NEXT) && existsSync(next) ? [file, next] : [file];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Runs `waybetter store …`; returns the lines to print. Throws on errors. */
|
/** Runs `waybetter store …`; returns the lines to print. Throws on errors. */
|
||||||
export async function storeCommand(argv) {
|
export async function storeCommand(argv) {
|
||||||
const [command, ...rest] = argv;
|
const [command, ...rest] = argv;
|
||||||
|
|
@ -341,7 +297,7 @@ export async function storeCommand(argv) {
|
||||||
const config = (await import(pathToFileURL(resolve(options.config)).href)).default;
|
const config = (await import(pathToFileURL(resolve(options.config)).href)).default;
|
||||||
const { path, items } = await buildStore(config, { out: options.out, base: options.base });
|
const { path, items } = await buildStore(config, { out: options.out, base: options.base });
|
||||||
const count = kind => items.filter(item => item.kind === kind).length;
|
const count = kind => items.filter(item => item.kind === kind).length;
|
||||||
return [`store: ${config.app}: ${count('plugin')} plugins, ${count('theme')} themes, ${count('icons')} icon packs, ${count('builtin')} built-in → ${path} and ${CATALOG_FILE_NEXT}`, 'Now sign both: waybetter store sign <catalog.json> --key <private key>'];
|
return [`store: ${config.app}: ${count('plugin')} plugins, ${count('theme')} themes → ${path}`, 'Now sign it: waybetter store sign <catalog.json> --key <private key>'];
|
||||||
}
|
}
|
||||||
if (command === 'sign') {
|
if (command === 'sign') {
|
||||||
if (!key) throw new Error('sign needs --key (or WAYBETTER_STORE_KEY)');
|
if (!key) throw new Error('sign needs --key (or WAYBETTER_STORE_KEY)');
|
||||||
|
|
@ -351,26 +307,18 @@ export async function storeCommand(argv) {
|
||||||
return [`${created ? 'Created the store key' : 'Store key already exists'}; public key ${publicKey} → ${options.pub[0]}`];
|
return [`${created ? 'Created the store key' : 'Store key already exists'}; public key ${publicKey} → ${options.pub[0]}`];
|
||||||
}
|
}
|
||||||
if (!existsSync(key)) throw new Error(`no store key at ${key} (create it once with --init)`);
|
if (!existsSync(key)) throw new Error(`no store key at ${key} (create it once with --init)`);
|
||||||
const lines = [];
|
const publicKey = signFile(catalog, key);
|
||||||
for (const file of catalogFiles(catalog)) {
|
const keys = options.pub.length ? options.pub.map(file => readFileSync(file, 'utf8').trim()) : [publicKey];
|
||||||
const publicKey = signFile(file, key);
|
if (!verifyFile(catalog, keys)) throw new Error(`signature of ${catalog} does NOT verify with ${options.pub.join(', ') || 'the key'}`);
|
||||||
const keys = options.pub.length ? options.pub.map(pub => readFileSync(pub, 'utf8').trim()) : [publicKey];
|
return [`Signed and verified ${catalog}.sig`];
|
||||||
if (!verifyFile(file, keys)) throw new Error(`signature of ${file} does NOT verify with ${options.pub.join(', ') || 'the key'}`);
|
|
||||||
lines.push(`Signed and verified ${file}.sig`);
|
|
||||||
}
|
|
||||||
return lines;
|
|
||||||
}
|
}
|
||||||
if (command === 'verify') {
|
if (command === 'verify') {
|
||||||
if (!options.pub.length) throw new Error('verify needs --pub');
|
if (!options.pub.length) throw new Error('verify needs --pub');
|
||||||
const keys = options.pub.map(file => readFileSync(file, 'utf8').trim());
|
const keys = options.pub.map(file => readFileSync(file, 'utf8').trim());
|
||||||
const lines = [];
|
if (!verifyFile(catalog, keys)) throw new Error(`signature of ${catalog} does NOT verify with ${options.pub.join(', ')}`);
|
||||||
for (const file of catalogFiles(catalog)) {
|
const problems = catalogProblems(JSON.parse(readFileSync(catalog, 'utf8')), { app: options.app });
|
||||||
if (!existsSync(`${file}.sig`) || !verifyFile(file, keys)) throw new Error(`signature of ${file} does NOT verify with ${options.pub.join(', ')}`);
|
if (problems.length) throw new Error(`${catalog} is signed but invalid:\n ${problems.join('\n ')}`);
|
||||||
const problems = catalogProblems(JSON.parse(readFileSync(file, 'utf8')), { app: options.app });
|
return [`Verified ${catalog}.sig`];
|
||||||
if (problems.length) throw new Error(`${file} is signed but invalid:\n ${problems.join('\n ')}`);
|
|
||||||
lines.push(`Verified ${file}.sig`);
|
|
||||||
}
|
|
||||||
return lines;
|
|
||||||
}
|
}
|
||||||
throw new Error(USAGE);
|
throw new Error(USAGE);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,8 +77,6 @@ export async function checkPack(packFile, inventories, { verbose = false } = {})
|
||||||
const coverage = rules.coverage(match.inventory, compiled);
|
const coverage = rules.coverage(match.inventory, compiled);
|
||||||
lines.push(`${pack.name} (${pack.language}) for ${pack.site}/${pack.catalog}, inventory build ${match.inventory.build ?? 'unknown'}`);
|
lines.push(`${pack.name} (${pack.language}) for ${pack.site}/${pack.catalog}, inventory build ${match.inventory.build ?? 'unknown'}`);
|
||||||
lines.push(`${report.total} strings: ${report.valid} valid, ${report.rejected.length} refused, ${report.unknown.length} unknown`);
|
lines.push(`${report.total} strings: ${report.valid} valid, ${report.rejected.length} refused, ${report.unknown.length} unknown`);
|
||||||
if (pack.when?.languages) lines.push(`Applies only while the site shows: ${pack.when.languages.join(', ')}`);
|
|
||||||
if (pack.rewrite) lines.push(`Rewords ${Object.keys(pack.rewrite.words).length} words inside the site's own text: ${Object.keys(pack.rewrite.words).slice(0, 6).join(', ')}${Object.keys(pack.rewrite.words).length > 6 ? ', …' : ''}`);
|
|
||||||
const list = (items, render) => {
|
const list = (items, render) => {
|
||||||
for (const item of verbose ? items : items.slice(0, LISTED)) lines.push(` ${render(item)}`);
|
for (const item of verbose ? items : items.slice(0, LISTED)) lines.push(` ${render(item)}`);
|
||||||
if (!verbose && items.length > LISTED) lines.push(` … ${items.length - LISTED} more (--verbose lists all)`);
|
if (!verbose && items.length > LISTED) lines.push(` … ${items.length - LISTED} more (--verbose lists all)`);
|
||||||
|
|
|
||||||
|
|
@ -999,7 +999,7 @@
|
||||||
"wb.settings.media.folderRemoved": "تمت إزالة المجلد.",
|
"wb.settings.media.folderRemoved": "تمت إزالة المجلد.",
|
||||||
"wb.settings.media.folders": "مجلدات المعرض",
|
"wb.settings.media.folders": "مجلدات المعرض",
|
||||||
"wb.settings.media.foldersHint": "أحدث الصور من هذه المجلدات. تتم قراءة الملفات الموجودة مباشرة داخلها فقط.",
|
"wb.settings.media.foldersHint": "أحدث الصور من هذه المجلدات. تتم قراءة الملفات الموجودة مباشرة داخلها فقط.",
|
||||||
"wb.settings.media.hint": "لوحة الوسائط ({shortcut}) بجانب {site}.",
|
"wb.settings.media.hint": "لوحة الوسائط (Ctrl+Shift+G) بجانب {site}.",
|
||||||
"wb.settings.media.keep": "عدد العناصر المحتفظ بها",
|
"wb.settings.media.keep": "عدد العناصر المحتفظ بها",
|
||||||
"wb.settings.media.keepHint": "تُحذف العناصر الأقدم تلقائيًا.",
|
"wb.settings.media.keepHint": "تُحذف العناصر الأقدم تلقائيًا.",
|
||||||
"wb.settings.media.noFolders": "لا توجد مجلدات بعد. أضف مجلدًا لعرض صوره في لوحة الوسائط.",
|
"wb.settings.media.noFolders": "لا توجد مجلدات بعد. أضف مجلدًا لعرض صوره في لوحة الوسائط.",
|
||||||
|
|
@ -1244,46 +1244,6 @@
|
||||||
"wb.appearance.icons.remove": "إزالة {name}",
|
"wb.appearance.icons.remove": "إزالة {name}",
|
||||||
"wb.appearance.icons.removed": "أُزيلت حزمة الأيقونات «{name}».",
|
"wb.appearance.icons.removed": "أُزيلت حزمة الأيقونات «{name}».",
|
||||||
"wb.appearance.icons.imported": "حزم الأيقونات المستوردة",
|
"wb.appearance.icons.imported": "حزم الأيقونات المستوردة",
|
||||||
"wb.doctor.title": "طبيب السمة",
|
|
||||||
"wb.doctor.hint": "نصائح حول هذه السمة: طرق أخف لفعل الشيء نفسه، والتكاليف، والتباين. هو يقدّم النصح فقط؛ لا يُحظر شيء ولا يتغيّر شيء.",
|
|
||||||
"wb.doctor.empty": "لا شيء للإبلاغ عنه: السمة تستخدم الرموز وإعدادات المكوّنات، ولا شيء فيها مكلف.",
|
|
||||||
"wb.doctor.count": "{count, plural, zero {لا نتائج} one {نتيجة واحدة} two {نتيجتان} few {# نتائج} many {# نتيجة} other {# نتيجة}}",
|
|
||||||
"wb.doctor.kind.lighter": "طريقة أخف",
|
|
||||||
"wb.doctor.kind.performance": "الأداء",
|
|
||||||
"wb.doctor.kind.accessibility": "إمكانية الوصول",
|
|
||||||
"wb.doctor.kind.contrast": "التباين",
|
|
||||||
"wb.doctor.where": "أين",
|
|
||||||
"wb.doctor.fix": "الإصلاح",
|
|
||||||
"wb.doctor.css-radius.found": "تضبط هذه القاعدة أنصاف أقطار الزوايا في CSS.",
|
|
||||||
"wb.doctor.css-radius.fix": "اضبطها عبر radius لجزء ضمن components، أو shape.radius لها جميعًا: لا حاجة إلى CSS، ويستمر العمل حتى لو غيّر الموقع أسماء فئاته.",
|
|
||||||
"wb.doctor.css-bevel.found": "ترسم هذه القاعدة حافة مشطوفة بظلال داخلية متراكبة.",
|
|
||||||
"wb.doctor.css-bevel.fix": "استخدم borderStyle \"bevel-out\" أو \"bevel-in\" على جزء ضمن components: فهو يرسم الحافة المشطوفة من ألوان السمة.",
|
|
||||||
"wb.doctor.css-hide.found": "تخفي هذه القاعدة شيئًا باستخدام display: none.",
|
|
||||||
"wb.doctor.css-hide.fix": "استخدم visible على جزء ضمن components (الصور الرمزية، العدّادات، الأسماء) أو نمط تخطيط مثل sidebar: hidden؛ وبذلك يمكن للمالك إعادته.",
|
|
||||||
"wb.doctor.css-color.found": "تستخدم هذه القاعدة لونًا حرفيًا.",
|
|
||||||
"wb.doctor.css-color.fix": "سمِّ دورًا (text وmuted وaccent وsurface…) في colors أو في مكوّن، ليشمله فحص التباين.",
|
|
||||||
"wb.doctor.css-font.found": "تضبط هذه القاعدة عائلة خطوط.",
|
|
||||||
"wb.doctor.css-font.fix": "استخدم font.roles: فهو يضبط خطوط المنشورات والعناوين والأرقام والخط أحادي المسافة دون CSS.",
|
|
||||||
"wb.doctor.css-has.found": "تستخدم هذه القاعدة :has()، ويُعاد مطابقتها عند كل تغيير في الصفحة.",
|
|
||||||
"wb.doctor.css-has.fix": "تجنّب :has() في القواعد المتكررة على امتداد الخلاصة، أو اربط القاعدة بجزء.",
|
|
||||||
"wb.doctor.css-universal.found": "تستخدم هذه القاعدة محدِّدًا شاملًا (*) تتم مطابقته مع كل عنصر.",
|
|
||||||
"wb.doctor.css-universal.fix": "اربط القاعدة بجزء بدلًا من ذلك.",
|
|
||||||
"wb.doctor.css-blur.found": "تطمس هذه القاعدة ما خلفها (backdrop-filter)، وهو مكلف في الأجزاء المتكررة.",
|
|
||||||
"wb.doctor.css-blur.fix": "استخدم تعبئة الزجاج في الأشرطة واللوحات: فهي المكان الأرخص للطمس.",
|
|
||||||
"wb.doctor.css-outline-none.found": "تزيل هذه القاعدة مخطط التركيز، فلا يعود تركيز لوحة المفاتيح مرئيًا.",
|
|
||||||
"wb.doctor.css-outline-none.fix": "استخدم decor.focusRing لرسم حلقة تركيز مرئية بدلًا من ذلك.",
|
|
||||||
"wb.doctor.css-motion.found": "تحرّك هذه القاعدة العناصر دون التحقق من تفضيل تقليل الحركة.",
|
|
||||||
"wb.doctor.css-motion.fix": "أبقِ الحركة داخل @media (prefers-reduced-motion: no-preference)، أو دع decor.motion يتولى ذلك عنك.",
|
|
||||||
"wb.doctor.css-size.found": "يزيد طول CSS على 20,000 حرف.",
|
|
||||||
"wb.doctor.css-size.fix": "يعيد الموقع حساب الأنماط مع كل قاعدة؛ والرموز وإعدادات المكوّنات تُترجم إلى قواعد أقل.",
|
|
||||||
"wb.doctor.contrast.found": "تم تعديل لون {token} ليبقى مقروءًا ({ratio}:1 على الخلفية).",
|
|
||||||
"wb.doctor.contrast.fix": "اختر لون {token} أفتح أو أغمق؛ وإلى ذلك الحين تُعرض السمة باللون المعدَّل.",
|
|
||||||
"wb.doctor.glass-post.found": "تم ضبط الزجاج على المنشورات، لكنه لا يُرسم: الطمس على كل منشور في الخلاصة مكلف جدًا.",
|
|
||||||
"wb.doctor.glass-post.fix": "استخدم تعبئة صلبة أو ملوّنة للمنشورات، واحتفظ بالزجاج للأشرطة واللوحات.",
|
|
||||||
"wb.doctor.small-post-text.found": "حجم نص المنشور {size}px، وهو صعب القراءة على كثيرين.",
|
|
||||||
"wb.doctor.small-post-text.fix": "استخدم 14px أو أكثر لحجم نص المنشور، أو كبّر حجم النص في السمة كلها.",
|
|
||||||
"wb.doctor.nav-moved.found": "نُقل التنقل إلى {position}، مما يغيّر المكان الذي يبحث عنه الناس.",
|
|
||||||
"wb.doctor.nav-moved.fix": "ينطبق ذلك فقط على الأجزاء العريضة، ويمكن للمالك إيقاف تغييرات التخطيط. أبقِ الموضع الافتراضي ما لم يتطلب التخطيط غير ذلك.",
|
|
||||||
"wb.setup.title": "مشاركة إعدادي",
|
"wb.setup.title": "مشاركة إعدادي",
|
||||||
"wb.setup.hint": "سمتك وأيقوناتك ووضعك والميزات المفعّلة، في رابط واحد أو ملف صغير. يمكن لأي شخص استخدامه ليبدأ مما لديك.",
|
"wb.setup.hint": "سمتك وأيقوناتك ووضعك والميزات المفعّلة، في رابط واحد أو ملف صغير. يمكن لأي شخص استخدامه ليبدأ مما لديك.",
|
||||||
"wb.setup.shareLabel": "إعدادك",
|
"wb.setup.shareLabel": "إعدادك",
|
||||||
|
|
@ -1316,73 +1276,6 @@
|
||||||
"wb.setup.err.size": "هذا أكبر من أن يكون إعدادًا.",
|
"wb.setup.err.size": "هذا أكبر من أن يكون إعدادًا.",
|
||||||
"wb.strings.translate": "وضع الترجمة",
|
"wb.strings.translate": "وضع الترجمة",
|
||||||
"wb.strings.translateHint": "يعرض كل تبويب {site} شريطًا: انقر على كلمة لتغييرها. تسري تعديلاتك في ذلك التبويب بعد إعادة التحميل، ويمنحك «نسخ ملف الحزمة» حزمة لمشاركتها. ما دام مفعّلًا، تحمل الكلمات علامات غير مرئية.",
|
"wb.strings.translateHint": "يعرض كل تبويب {site} شريطًا: انقر على كلمة لتغييرها. تسري تعديلاتك في ذلك التبويب بعد إعادة التحميل، ويمنحك «نسخ ملف الحزمة» حزمة لمشاركتها. ما دام مفعّلًا، تحمل الكلمات علامات غير مرئية.",
|
||||||
"wb.menu.strings": "اللغات",
|
"wb.menu.strings": "اللغات"
|
||||||
"wb.menu.barFile": "ملف",
|
|
||||||
"wb.menu.barEdit": "تحرير",
|
|
||||||
"wb.menu.barView": "عرض",
|
|
||||||
"wb.menu.barAccount": "الحساب",
|
|
||||||
"wb.menu.barPlugins": "الإضافات",
|
|
||||||
"wb.menu.barWindow": "نافذة",
|
|
||||||
"wb.menu.barHelp": "مساعدة",
|
|
||||||
"wb.menu.appHide": "إخفاء {product}",
|
|
||||||
"wb.menu.appHideOthers": "إخفاء الآخرين",
|
|
||||||
"wb.menu.appShowAll": "إظهار الكل",
|
|
||||||
"wb.menu.appQuit": "إنهاء {product}",
|
|
||||||
"wb.menu.appServices": "الخدمات",
|
|
||||||
"wb.menu.appUpdates": "التحقق من وجود تحديثات…",
|
|
||||||
"wb.menu.appSettings": "الإعدادات…",
|
|
||||||
"wb.menu.appSafe": "الوضع الآمن",
|
|
||||||
"wb.menu.fileClose": "إغلاق علامة التبويب",
|
|
||||||
"wb.menu.fileInstall": "تثبيت من ملف…",
|
|
||||||
"wb.menu.fileShare": "مشاركة إعداداتي…",
|
|
||||||
"wb.menu.editUndo": "تراجع",
|
|
||||||
"wb.menu.editRedo": "إعادة",
|
|
||||||
"wb.menu.editCut": "قص",
|
|
||||||
"wb.menu.editCopy": "نسخ",
|
|
||||||
"wb.menu.editPaste": "لصق",
|
|
||||||
"wb.menu.editSelectAll": "تحديد الكل",
|
|
||||||
"wb.menu.editFind": "بحث…",
|
|
||||||
"wb.menu.editFindNext": "بحث عن التالي",
|
|
||||||
"wb.menu.editFindPrevious": "بحث عن السابق",
|
|
||||||
"wb.menu.viewZoomIn": "تكبير",
|
|
||||||
"wb.menu.viewZoomOut": "تصغير",
|
|
||||||
"wb.menu.viewActual": "الحجم الفعلي",
|
|
||||||
"wb.menu.viewIconPack": "حزمة الأيقونات",
|
|
||||||
"wb.menu.viewDeck": "اللوحة",
|
|
||||||
"wb.menu.viewFullScreen": "الدخول إلى وضع ملء الشاشة",
|
|
||||||
"wb.menu.acctNone": "لا توجد حسابات بعد",
|
|
||||||
"wb.menu.acctAdd": "إضافة حساب…",
|
|
||||||
"wb.menu.plugStore": "المتجر…",
|
|
||||||
"wb.menu.plugFolder": "فتح مجلد الإضافات…",
|
|
||||||
"wb.menu.winMinimize": "تصغير",
|
|
||||||
"wb.menu.winZoom": "تقريب/تبعيد",
|
|
||||||
"wb.menu.winWorkspaces": "مساحات العمل",
|
|
||||||
"wb.menu.helpDocs": "التوثيق",
|
|
||||||
"wb.menu.helpReport": "الإبلاغ عن مشكلة…",
|
|
||||||
"wb.store.category.icons": "الأيقونات",
|
|
||||||
"wb.appearance.doctorHints": "{count, plural, zero {لا تلميحات من طبيب السمة:} one {لدى طبيب السمة تلميح:} two {لدى طبيب السمة تلميحان، الأول:} few {لدى طبيب السمة # تلميحات، الأول:} many {لدى طبيب السمة # تلميحًا، الأول:} other {لدى طبيب السمة # تلميح، الأول:}} {hint}",
|
|
||||||
"wb.install.eyebrow.icons.install": "تثبيت حزمة أيقونات",
|
|
||||||
"wb.install.eyebrow.icons.update": "تحديث حزمة الأيقونات",
|
|
||||||
"wb.install.eyebrow.icons.reinstall": "إعادة تثبيت حزمة الأيقونات",
|
|
||||||
"wb.install.err.icons": "لا يمكن تثبيت حزمة الأيقونات هذه",
|
|
||||||
"wb.install.err.iconsNone": "لا يمكن لـ {site} تثبيت حزم الأيقونات هنا.",
|
|
||||||
"wb.install.err.iconsLarge": "الحد الأقصى لحجم حزم الأيقونات 120 كيلوبايت.",
|
|
||||||
"wb.install.err.iconsNotInstalled": "لم تُثبَّت حزمة الأيقونات",
|
|
||||||
"wb.install.err.opened": "لا يمكن تثبيت هذا الملف",
|
|
||||||
"wb.install.icons.dataOnly": "بيانات فقط: رسومات على شكل بيانات مسارات وصور صغيرة. بلا أي شيفرة وبلا أنماط؛ لا شيء فيها يعمل.",
|
|
||||||
"wb.install.icons.license": "الترخيص",
|
|
||||||
"wb.install.icons.source": "الرسومات من",
|
|
||||||
"wb.install.icons.count": "الأيقونات",
|
|
||||||
"wb.install.icons.countValue": "{count, plural, zero {لا أيقونات} one {أيقونة واحدة} two {أيقونتان} few {# أيقونات} many {# أيقونة} other {# أيقونة}}",
|
|
||||||
"wb.install.icons.file": "ملف الحزمة",
|
|
||||||
"wb.install.done.iconsOn": "أصبحت حزمة أيقوناتك الآن. يمكنك العودة في أي وقت من المظهر.",
|
|
||||||
"wb.install.done.iconsOff": "أُضيفت إلى حزم الأيقونات لديك في المظهر.",
|
|
||||||
"wb.store.icons": "الأيقونات",
|
|
||||||
"wb.store.iconsItem": "حزمة أيقونات",
|
|
||||||
"wb.store.builtinTab": "مدمجة",
|
|
||||||
"wb.store.builtinItem": "مدمجة",
|
|
||||||
"wb.store.areaSwitch": "تشغيل {name} أو إيقافه",
|
|
||||||
"wb.store.areaOn": "مفعَّل",
|
|
||||||
"wb.store.areaOff": "متوقف"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -998,7 +998,7 @@
|
||||||
"wb.settings.media.folderRemoved": "Папката е премахната.",
|
"wb.settings.media.folderRemoved": "Папката е премахната.",
|
||||||
"wb.settings.media.folders": "Папки на галерията",
|
"wb.settings.media.folders": "Папки на галерията",
|
||||||
"wb.settings.media.foldersHint": "Най-новите изображения от тези папки. Четат се само файловете, намиращи се директно в тях.",
|
"wb.settings.media.foldersHint": "Най-новите изображения от тези папки. Четат се само файловете, намиращи се директно в тях.",
|
||||||
"wb.settings.media.hint": "Панелът за медия ({shortcut}) до {site}.",
|
"wb.settings.media.hint": "Панелът за медия (Ctrl+Shift+G) до {site}.",
|
||||||
"wb.settings.media.keep": "Елементи за пазене",
|
"wb.settings.media.keep": "Елементи за пазене",
|
||||||
"wb.settings.media.keepHint": "По-старите елементи отпадат от края.",
|
"wb.settings.media.keepHint": "По-старите елементи отпадат от края.",
|
||||||
"wb.settings.media.noFolders": "Още няма папки. Добави една, за да видиш изображенията ѝ в панела за медия.",
|
"wb.settings.media.noFolders": "Още няма папки. Добави една, за да видиш изображенията ѝ в панела за медия.",
|
||||||
|
|
@ -1275,113 +1275,6 @@
|
||||||
"wb.setup.err.size": "Това е твърде голямо, за да е настройка.",
|
"wb.setup.err.size": "Това е твърде голямо, за да е настройка.",
|
||||||
"wb.strings.translate": "Режим на превод",
|
"wb.strings.translate": "Режим на превод",
|
||||||
"wb.strings.translateHint": "Всеки раздел на {site} показва лента: щракнете върху дума, за да я промените. Промените ви важат в този раздел след презареждане, а „Копиране на файла на пакета“ ви дава пакет за споделяне. Докато е включен, думите носят невидими маркери.",
|
"wb.strings.translateHint": "Всеки раздел на {site} показва лента: щракнете върху дума, за да я промените. Промените ви важат в този раздел след презареждане, а „Копиране на файла на пакета“ ви дава пакет за споделяне. Докато е включен, думите носят невидими маркери.",
|
||||||
"wb.menu.strings": "Езици",
|
"wb.menu.strings": "Езици"
|
||||||
"wb.menu.barFile": "Файл",
|
|
||||||
"wb.menu.barEdit": "Редакция",
|
|
||||||
"wb.menu.barView": "Изглед",
|
|
||||||
"wb.menu.barAccount": "Акаунт",
|
|
||||||
"wb.menu.barPlugins": "Добавки",
|
|
||||||
"wb.menu.barWindow": "Прозорец",
|
|
||||||
"wb.menu.barHelp": "Помощ",
|
|
||||||
"wb.menu.appHide": "Скриване на {product}",
|
|
||||||
"wb.menu.appHideOthers": "Скриване на другите",
|
|
||||||
"wb.menu.appShowAll": "Показване на всички",
|
|
||||||
"wb.menu.appQuit": "Изход от {product}",
|
|
||||||
"wb.menu.appServices": "Услуги",
|
|
||||||
"wb.menu.appUpdates": "Проверка за актуализации…",
|
|
||||||
"wb.menu.appSettings": "Настройки…",
|
|
||||||
"wb.menu.appSafe": "Безопасен режим",
|
|
||||||
"wb.menu.fileClose": "Затваряне на раздела",
|
|
||||||
"wb.menu.fileInstall": "Инсталиране от файл…",
|
|
||||||
"wb.menu.fileShare": "Споделяне на моите настройки…",
|
|
||||||
"wb.menu.editUndo": "Отмяна",
|
|
||||||
"wb.menu.editRedo": "Повторение",
|
|
||||||
"wb.menu.editCut": "Изрязване",
|
|
||||||
"wb.menu.editCopy": "Копиране",
|
|
||||||
"wb.menu.editPaste": "Поставяне",
|
|
||||||
"wb.menu.editSelectAll": "Избор на всички",
|
|
||||||
"wb.menu.editFind": "Търсене…",
|
|
||||||
"wb.menu.editFindNext": "Търсене на следващото",
|
|
||||||
"wb.menu.editFindPrevious": "Търсене на предишното",
|
|
||||||
"wb.menu.viewZoomIn": "Увеличаване",
|
|
||||||
"wb.menu.viewZoomOut": "Намаляване",
|
|
||||||
"wb.menu.viewActual": "Действителен размер",
|
|
||||||
"wb.menu.viewIconPack": "Пакет с икони",
|
|
||||||
"wb.menu.viewDeck": "Колони",
|
|
||||||
"wb.menu.viewFullScreen": "Преминаване на цял екран",
|
|
||||||
"wb.menu.acctNone": "Все още няма акаунти",
|
|
||||||
"wb.menu.acctAdd": "Добавяне на акаунт…",
|
|
||||||
"wb.menu.plugStore": "Магазин…",
|
|
||||||
"wb.menu.plugFolder": "Отваряне на папката с добавки…",
|
|
||||||
"wb.menu.winMinimize": "Минимизиране",
|
|
||||||
"wb.menu.winZoom": "Мащаб",
|
|
||||||
"wb.menu.winWorkspaces": "Работни пространства",
|
|
||||||
"wb.menu.helpDocs": "Документация",
|
|
||||||
"wb.menu.helpReport": "Докладване на проблем…",
|
|
||||||
"wb.store.category.icons": "Икони",
|
|
||||||
"wb.appearance.doctorHints": "{count, plural, one {Докторът на темата има съвет:} other {Докторът на темата има # съвета, първият:}} {hint}",
|
|
||||||
"wb.doctor.title": "Доктор на темата",
|
|
||||||
"wb.doctor.hint": "Съвети за тази тема: по-леки начини да постигнеш същото, разходи и контраст. Само съветва; нищо не се блокира и не се променя.",
|
|
||||||
"wb.doctor.empty": "Няма какво да се отбележи: темата използва токени и настройки на компоненти и нищо в нея не е скъпо.",
|
|
||||||
"wb.doctor.count": "{count, plural, one {# находка} other {# находки}}",
|
|
||||||
"wb.doctor.kind.lighter": "По-лек начин",
|
|
||||||
"wb.doctor.kind.performance": "Производителност",
|
|
||||||
"wb.doctor.kind.accessibility": "Достъпност",
|
|
||||||
"wb.doctor.kind.contrast": "Контраст",
|
|
||||||
"wb.doctor.where": "Къде",
|
|
||||||
"wb.doctor.fix": "Поправка",
|
|
||||||
"wb.doctor.css-radius.found": "Това правило задава радиуси на ъглите в CSS.",
|
|
||||||
"wb.doctor.css-radius.fix": "Задай ги с радиуса на част под components или с shape.radius за всички: без CSS, и продължава да работи, когато сайтът преименува класовете си.",
|
|
||||||
"wb.doctor.css-bevel.found": "Това правило рисува скосен ръб с наредени вътрешни сенки.",
|
|
||||||
"wb.doctor.css-bevel.fix": "Използвай borderStyle \"bevel-out\" или \"bevel-in\" на част под components: скосяването се рисува от цветовете на темата.",
|
|
||||||
"wb.doctor.css-hide.found": "Това правило скрива нещо с display: none.",
|
|
||||||
"wb.doctor.css-hide.fix": "Използвай visible на част под components (аватари, броячи, имена) или вариант на оформлението като sidebar: hidden; така собственикът може да го върне.",
|
|
||||||
"wb.doctor.css-color.found": "Това правило използва конкретен цвят.",
|
|
||||||
"wb.doctor.css-color.fix": "Посочи роля (text, muted, accent, surface…) в colors или в компонент, за да обхване и нея проверката на контраста.",
|
|
||||||
"wb.doctor.css-font.found": "Това правило задава шрифт.",
|
|
||||||
"wb.doctor.css-font.fix": "Използвай font.roles: задава шрифтовете за публикации, заглавия, числа и моноширинния без CSS.",
|
|
||||||
"wb.doctor.css-has.found": "Това правило използва :has(), което се оценява наново при всяка промяна на страницата.",
|
|
||||||
"wb.doctor.css-has.fix": "Не използвай :has() в правила, които се повтарят по цялата емисия, или закотви правилото към част.",
|
|
||||||
"wb.doctor.css-universal.found": "Това правило използва универсален селектор (*), който се проверява за всеки елемент.",
|
|
||||||
"wb.doctor.css-universal.fix": "Закотви правилото към част вместо това.",
|
|
||||||
"wb.doctor.css-blur.found": "Това правило замъглява онова зад него (backdrop-filter), което е скъпо при части, които се повтарят.",
|
|
||||||
"wb.doctor.css-blur.fix": "Използвай стъкления фон на лентите и панелите: там замъгляването е по-евтино.",
|
|
||||||
"wb.doctor.css-outline-none.found": "Това правило премахва контура на фокуса, така че фокусът от клавиатурата не се вижда.",
|
|
||||||
"wb.doctor.css-outline-none.fix": "Използвай decor.focusRing, за да нарисуваш видим пръстен на фокуса.",
|
|
||||||
"wb.doctor.css-motion.found": "Това правило анимира, без да проверява за намалено движение.",
|
|
||||||
"wb.doctor.css-motion.fix": "Дръж движението в @media (prefers-reduced-motion: no-preference) или остави decor.motion да го направи вместо теб.",
|
|
||||||
"wb.doctor.css-size.found": "CSS-ът е над 20,000 знака.",
|
|
||||||
"wb.doctor.css-size.fix": "Сайтът преизчислява стиловете при всяко правило; токените и настройките на компонентите се компилират в по-малко правила.",
|
|
||||||
"wb.doctor.contrast.found": "Цветът {token} беше коригиран, за да остане четим ({ratio}:1 спрямо фона).",
|
|
||||||
"wb.doctor.contrast.fix": "Избери по-светъл или по-тъмен цвят за {token}; дотогава темата се показва с коригирания.",
|
|
||||||
"wb.doctor.glass-post.found": "Стъклото е зададено за публикации, но не се рисува: замъгляването на всяка публикация в емисия е твърде скъпо.",
|
|
||||||
"wb.doctor.glass-post.fix": "Използвай плътен или оцветен фон за публикациите и остави стъклото за лентите и панелите.",
|
|
||||||
"wb.doctor.small-post-text.found": "Текстът на публикациите е {size}px, което е трудно за четене за много хора.",
|
|
||||||
"wb.doctor.small-post-text.fix": "Използвай 14px или повече за размера на текста на публикациите или увеличи текста на цялата тема.",
|
|
||||||
"wb.doctor.nav-moved.found": "Навигацията е преместена на позиция {position}, което променя къде хората я търсят.",
|
|
||||||
"wb.doctor.nav-moved.fix": "Важи само за широки панели, а собственикът може да изключи промените в оформлението. Запази позицията по подразбиране, освен ако оформлението не го изисква.",
|
|
||||||
"wb.install.eyebrow.icons.install": "Инсталиране на пакет с икони",
|
|
||||||
"wb.install.eyebrow.icons.update": "Обновяване на пакета с икони",
|
|
||||||
"wb.install.eyebrow.icons.reinstall": "Преинсталиране на пакета с икони",
|
|
||||||
"wb.install.err.icons": "Този пакет с икони не може да се инсталира",
|
|
||||||
"wb.install.err.iconsNone": "{site} не може да инсталира пакети с икони тук.",
|
|
||||||
"wb.install.err.iconsLarge": "Пакетите с икони са ограничени до 120 KB.",
|
|
||||||
"wb.install.err.iconsNotInstalled": "Пакетът с икони не беше инсталиран",
|
|
||||||
"wb.install.err.opened": "Този файл не може да се инсталира",
|
|
||||||
"wb.install.icons.dataOnly": "Само данни: рисунки като данни за пътища и малки картинки. Без код и без стилове; нищо в него не се изпълнява.",
|
|
||||||
"wb.install.icons.license": "Лиценз",
|
|
||||||
"wb.install.icons.source": "Рисунки от",
|
|
||||||
"wb.install.icons.count": "Икони",
|
|
||||||
"wb.install.icons.countValue": "{count, plural, one {# икона} other {# икони}}",
|
|
||||||
"wb.install.icons.file": "Файлът на пакета",
|
|
||||||
"wb.install.done.iconsOn": "Вече е твоят пакет с икони. Върни се към друг по всяко време във Външен вид.",
|
|
||||||
"wb.install.done.iconsOff": "Намира се в твоите пакети с икони във Външен вид.",
|
|
||||||
"wb.store.icons": "Икони",
|
|
||||||
"wb.store.iconsItem": "Пакет с икони",
|
|
||||||
"wb.store.builtinTab": "Вградени",
|
|
||||||
"wb.store.builtinItem": "Вграден",
|
|
||||||
"wb.store.areaSwitch": "Включване или изключване на {name}",
|
|
||||||
"wb.store.areaOn": "Включено",
|
|
||||||
"wb.store.areaOff": "Изключено"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -998,7 +998,7 @@
|
||||||
"wb.settings.media.folderRemoved": "ফোল্ডার সরানো হয়েছে।",
|
"wb.settings.media.folderRemoved": "ফোল্ডার সরানো হয়েছে।",
|
||||||
"wb.settings.media.folders": "গ্যালারি ফোল্ডার",
|
"wb.settings.media.folders": "গ্যালারি ফোল্ডার",
|
||||||
"wb.settings.media.foldersHint": "এই ফোল্ডারগুলোর সবচেয়ে নতুন ছবি। শুধু সরাসরি ভেতরের ফাইল পড়া হয়।",
|
"wb.settings.media.foldersHint": "এই ফোল্ডারগুলোর সবচেয়ে নতুন ছবি। শুধু সরাসরি ভেতরের ফাইল পড়া হয়।",
|
||||||
"wb.settings.media.hint": "{site}-এর পাশে মিডিয়া প্যানেল ({shortcut})।",
|
"wb.settings.media.hint": "{site}-এর পাশে মিডিয়া প্যানেল (Ctrl+Shift+G)।",
|
||||||
"wb.settings.media.keep": "রাখার আইটেম",
|
"wb.settings.media.keep": "রাখার আইটেম",
|
||||||
"wb.settings.media.keepHint": "পুরনো আইটেম শেষ থেকে বাদ পড়ে।",
|
"wb.settings.media.keepHint": "পুরনো আইটেম শেষ থেকে বাদ পড়ে।",
|
||||||
"wb.settings.media.noFolders": "এখনো কোনো ফোল্ডার নেই। মিডিয়া প্যানেলে ছবি দেখতে একটি যোগ করুন।",
|
"wb.settings.media.noFolders": "এখনো কোনো ফোল্ডার নেই। মিডিয়া প্যানেলে ছবি দেখতে একটি যোগ করুন।",
|
||||||
|
|
@ -1275,113 +1275,6 @@
|
||||||
"wb.setup.err.size": "এটি সেটআপ হওয়ার জন্য অনেক বড়।",
|
"wb.setup.err.size": "এটি সেটআপ হওয়ার জন্য অনেক বড়।",
|
||||||
"wb.strings.translate": "অনুবাদ মোড",
|
"wb.strings.translate": "অনুবাদ মোড",
|
||||||
"wb.strings.translateHint": "প্রতিটি {site} ট্যাবে একটি বার দেখা যায়: কোনো শব্দ বদলাতে সেটিতে ক্লিক করুন। রিলোডের পর সেই ট্যাবে আপনার সম্পাদনা কার্যকর হয়, আর “প্যাক ফাইল কপি করুন” আপনাকে শেয়ার করার মতো একটি প্যাক দেয়। এটি চালু থাকলে শব্দগুলোতে অদৃশ্য চিহ্ন থাকে।",
|
"wb.strings.translateHint": "প্রতিটি {site} ট্যাবে একটি বার দেখা যায়: কোনো শব্দ বদলাতে সেটিতে ক্লিক করুন। রিলোডের পর সেই ট্যাবে আপনার সম্পাদনা কার্যকর হয়, আর “প্যাক ফাইল কপি করুন” আপনাকে শেয়ার করার মতো একটি প্যাক দেয়। এটি চালু থাকলে শব্দগুলোতে অদৃশ্য চিহ্ন থাকে।",
|
||||||
"wb.menu.strings": "ভাষা",
|
"wb.menu.strings": "ভাষা"
|
||||||
"wb.menu.barFile": "ফাইল",
|
|
||||||
"wb.menu.barEdit": "সম্পাদনা",
|
|
||||||
"wb.menu.barView": "দেখুন",
|
|
||||||
"wb.menu.barAccount": "অ্যাকাউন্ট",
|
|
||||||
"wb.menu.barPlugins": "প্লাগইন",
|
|
||||||
"wb.menu.barWindow": "উইন্ডো",
|
|
||||||
"wb.menu.barHelp": "সহায়তা",
|
|
||||||
"wb.menu.appHide": "{product} লুকান",
|
|
||||||
"wb.menu.appHideOthers": "অন্যগুলো লুকান",
|
|
||||||
"wb.menu.appShowAll": "সব দেখান",
|
|
||||||
"wb.menu.appQuit": "{product} থেকে বের হন",
|
|
||||||
"wb.menu.appServices": "পরিষেবা",
|
|
||||||
"wb.menu.appUpdates": "আপডেট আছে কিনা দেখুন…",
|
|
||||||
"wb.menu.appSettings": "সেটিংস…",
|
|
||||||
"wb.menu.appSafe": "নিরাপদ মোড",
|
|
||||||
"wb.menu.fileClose": "ট্যাব বন্ধ করুন",
|
|
||||||
"wb.menu.fileInstall": "ফাইল থেকে ইনস্টল করুন…",
|
|
||||||
"wb.menu.fileShare": "আমার সেটআপ শেয়ার করুন…",
|
|
||||||
"wb.menu.editUndo": "পূর্বাবস্থায়",
|
|
||||||
"wb.menu.editRedo": "আবার করুন",
|
|
||||||
"wb.menu.editCut": "কাট",
|
|
||||||
"wb.menu.editCopy": "কপি",
|
|
||||||
"wb.menu.editPaste": "পেস্ট",
|
|
||||||
"wb.menu.editSelectAll": "সব নির্বাচন করুন",
|
|
||||||
"wb.menu.editFind": "খুঁজুন…",
|
|
||||||
"wb.menu.editFindNext": "পরেরটি খুঁজুন",
|
|
||||||
"wb.menu.editFindPrevious": "আগেরটি খুঁজুন",
|
|
||||||
"wb.menu.viewZoomIn": "বড় করুন",
|
|
||||||
"wb.menu.viewZoomOut": "ছোট করুন",
|
|
||||||
"wb.menu.viewActual": "প্রকৃত আকার",
|
|
||||||
"wb.menu.viewIconPack": "আইকন প্যাক",
|
|
||||||
"wb.menu.viewDeck": "ডেক",
|
|
||||||
"wb.menu.viewFullScreen": "পূর্ণ পর্দায় যান",
|
|
||||||
"wb.menu.acctNone": "এখনও কোনো অ্যাকাউন্ট নেই",
|
|
||||||
"wb.menu.acctAdd": "অ্যাকাউন্ট যোগ করুন…",
|
|
||||||
"wb.menu.plugStore": "স্টোর…",
|
|
||||||
"wb.menu.plugFolder": "প্লাগইন ফোল্ডার খুলুন…",
|
|
||||||
"wb.menu.winMinimize": "ছোট করুন",
|
|
||||||
"wb.menu.winZoom": "জুম",
|
|
||||||
"wb.menu.winWorkspaces": "ওয়ার্কস্পেস",
|
|
||||||
"wb.menu.helpDocs": "ডকুমেন্টেশন",
|
|
||||||
"wb.menu.helpReport": "সমস্যা জানান…",
|
|
||||||
"wb.store.category.icons": "আইকন",
|
|
||||||
"wb.appearance.doctorHints": "{count, plural, one {থিম ডক্টরের একটি পরামর্শ আছে:} other {থিম ডক্টরের #টি পরামর্শ আছে, প্রথমটি:}} {hint}",
|
|
||||||
"wb.doctor.title": "থিম ডক্টর",
|
|
||||||
"wb.doctor.hint": "এই থিম নিয়ে পরামর্শ: একই কাজ করার হালকা উপায়, খরচ ও কনট্রাস্ট। এটি শুধু পরামর্শ দেয়; কিছু আটকানো বা বদলানো হয় না।",
|
|
||||||
"wb.doctor.empty": "জানানোর মতো কিছু নেই: থিমটি টোকেন ও কম্পোনেন্ট সেটিং ব্যবহার করে, আর এতে ব্যয়বহুল কিছু নেই।",
|
|
||||||
"wb.doctor.count": "{count, plural, one {#টি পর্যবেক্ষণ} other {#টি পর্যবেক্ষণ}}",
|
|
||||||
"wb.doctor.kind.lighter": "হালকা উপায়",
|
|
||||||
"wb.doctor.kind.performance": "পারফরম্যান্স",
|
|
||||||
"wb.doctor.kind.accessibility": "অ্যাক্সেসিবিলিটি",
|
|
||||||
"wb.doctor.kind.contrast": "কনট্রাস্ট",
|
|
||||||
"wb.doctor.where": "কোথায়",
|
|
||||||
"wb.doctor.fix": "সমাধান",
|
|
||||||
"wb.doctor.css-radius.found": "এই রুলটি CSS-এ কোণের রেডিয়াস ঠিক করে।",
|
|
||||||
"wb.doctor.css-radius.fix": "components-এর অধীনে কোনো অংশের radius দিয়ে, অথবা সবকটির জন্য shape.radius দিয়ে সেট করুন: CSS লাগে না, আর সাইট ক্লাসের নাম বদলালেও কাজ করে।",
|
|
||||||
"wb.doctor.css-bevel.found": "এই রুলটি সাজানো ইনসেট শ্যাডো দিয়ে ঢালু কিনারা আঁকে।",
|
|
||||||
"wb.doctor.css-bevel.fix": "components-এর অধীনে কোনো অংশে borderStyle \"bevel-out\" বা \"bevel-in\" ব্যবহার করুন: এটি থিমের রং থেকে ঢালু কিনারা আঁকে।",
|
|
||||||
"wb.doctor.css-hide.found": "এই রুলটি display: none দিয়ে কিছু লুকায়।",
|
|
||||||
"wb.doctor.css-hide.fix": "components-এর অধীনে কোনো অংশে (অ্যাভাটার, সংখ্যা, নাম) visible ব্যবহার করুন, বা sidebar: hidden-এর মতো লেআউট ভ্যারিয়েন্ট; তখন মালিক চাইলে আবার চালু করতে পারবেন।",
|
|
||||||
"wb.doctor.css-color.found": "এই রুলটি সরাসরি একটি রং ব্যবহার করে।",
|
|
||||||
"wb.doctor.css-color.fix": "colors-এ বা কোনো কম্পোনেন্টে একটি ভূমিকার নাম দিন (text, muted, accent, surface…), যাতে কনট্রাস্ট যাচাই এটিও ধরে।",
|
|
||||||
"wb.doctor.css-font.found": "এই রুলটি একটি ফন্ট ফ্যামিলি সেট করে।",
|
|
||||||
"wb.doctor.css-font.fix": "font.roles ব্যবহার করুন: এটি CSS ছাড়াই পোস্ট, শিরোনাম, সংখ্যা ও মনো ফন্ট ঠিক করে।",
|
|
||||||
"wb.doctor.css-has.found": "এই রুলটি :has() ব্যবহার করে, যা পেজের প্রতিটি পরিবর্তনে আবার মেলানো হয়।",
|
|
||||||
"wb.doctor.css-has.fix": "টাইমলাইন জুড়ে পুনরাবৃত্ত হওয়া রুলে :has() রাখবেন না, অথবা রুলটি কোনো অংশে আটকে দিন।",
|
|
||||||
"wb.doctor.css-universal.found": "এই রুলটি একটি ইউনিভার্সাল সিলেক্টর (*) ব্যবহার করে, যা প্রতিটি এলিমেন্টের সঙ্গে মেলানো হয়।",
|
|
||||||
"wb.doctor.css-universal.fix": "এর বদলে রুলটি কোনো অংশে আটকে দিন।",
|
|
||||||
"wb.doctor.css-blur.found": "এই রুলটি পেছনের অংশ ঝাপসা করে (backdrop-filter), যা পুনরাবৃত্ত অংশে ব্যয়বহুল।",
|
|
||||||
"wb.doctor.css-blur.fix": "বার ও প্যানেলের glass ফিল ব্যবহার করুন: ঝাপসা করার জন্য সেটিই সস্তা জায়গা।",
|
|
||||||
"wb.doctor.css-outline-none.found": "এই রুলটি ফোকাস আউটলাইন সরিয়ে দেয়, ফলে কীবোর্ড ফোকাস আর দেখা যায় না।",
|
|
||||||
"wb.doctor.css-outline-none.fix": "এর বদলে decor.focusRing ব্যবহার করে দৃশ্যমান ফোকাস রিং আঁকুন।",
|
|
||||||
"wb.doctor.css-motion.found": "এই রুলটি কমানো মোশনের কথা না ভেবেই অ্যানিমেট করে।",
|
|
||||||
"wb.doctor.css-motion.fix": "মোশন @media (prefers-reduced-motion: no-preference)-এর ভেতরে রাখুন, অথবা decor.motion-কে এটি সামলাতে দিন।",
|
|
||||||
"wb.doctor.css-size.found": "CSS ২০,০০০ অক্ষরের বেশি লম্বা।",
|
|
||||||
"wb.doctor.css-size.fix": "সাইট প্রতিটি রুলের জন্য স্টাইল নতুন করে হিসাব করে; টোকেন ও কম্পোনেন্ট সেটিং কম রুলে কম্পাইল হয়।",
|
|
||||||
"wb.doctor.contrast.found": "{token} রংটি পড়ার যোগ্য রাখতে বদলানো হয়েছে (ব্যাকগ্রাউন্ডে {ratio}:1)।",
|
|
||||||
"wb.doctor.contrast.fix": "{token}-এর জন্য আরও হালকা বা গাঢ় রং বেছে নিন; ততক্ষণ থিমটি বদলানো রংসহ দেখানো হবে।",
|
|
||||||
"wb.doctor.glass-post.found": "পোস্টে glass সেট করা আছে, কিন্তু আঁকা হচ্ছে না: টাইমলাইনের প্রতিটি পোস্টে ঝাপসা করা খুবই ব্যয়বহুল।",
|
|
||||||
"wb.doctor.glass-post.fix": "পোস্টে সলিড বা টিন্টেড ফিল ব্যবহার করুন, আর glass রাখুন বার ও প্যানেলের জন্য।",
|
|
||||||
"wb.doctor.small-post-text.found": "পোস্টের লেখা {size}px, যা অনেকের পক্ষে পড়া কঠিন।",
|
|
||||||
"wb.doctor.small-post-text.fix": "পোস্টের লেখার আকারে 14px বা তার বেশি ব্যবহার করুন, অথবা পুরো থিমের লেখার আকার বাড়ান।",
|
|
||||||
"wb.doctor.nav-moved.found": "নেভিগেশন {position}-এ সরানো হয়েছে, ফলে মানুষ যেখানে এটি খোঁজে তা বদলে যায়।",
|
|
||||||
"wb.doctor.nav-moved.fix": "এটি শুধু চওড়া প্যানে প্রযোজ্য, আর মালিক লেআউট পরিবর্তন বন্ধ করতে পারেন। লেআউটের দরকার না হলে ডিফল্ট অবস্থান রাখুন।",
|
|
||||||
"wb.install.eyebrow.icons.install": "আইকন প্যাক ইনস্টল করুন",
|
|
||||||
"wb.install.eyebrow.icons.update": "আইকন প্যাক আপডেট করুন",
|
|
||||||
"wb.install.eyebrow.icons.reinstall": "আইকন প্যাক আবার ইনস্টল করুন",
|
|
||||||
"wb.install.err.icons": "এই আইকন প্যাক ইনস্টল করা যাবে না",
|
|
||||||
"wb.install.err.iconsNone": "{site} এখানে আইকন প্যাক ইনস্টল করতে পারে না।",
|
|
||||||
"wb.install.err.iconsLarge": "আইকন প্যাকের সীমা 120 KB।",
|
|
||||||
"wb.install.err.iconsNotInstalled": "আইকন প্যাকটি ইনস্টল হয়নি",
|
|
||||||
"wb.install.err.opened": "এই ফাইল ইনস্টল করা যাবে না",
|
|
||||||
"wb.install.icons.dataOnly": "শুধু ডেটা: পাথ ডেটা হিসেবে আঁকা ছবি ও ছোট ছবি। কোনো কোড নেই, কোনো স্টাইল নেই; এর কিছুই চলে না।",
|
|
||||||
"wb.install.icons.license": "লাইসেন্স",
|
|
||||||
"wb.install.icons.source": "আঁকা ছবির উৎস",
|
|
||||||
"wb.install.icons.count": "আইকন",
|
|
||||||
"wb.install.icons.countValue": "{count, plural, one {#টি আইকন} other {#টি আইকন}}",
|
|
||||||
"wb.install.icons.file": "প্যাক ফাইল",
|
|
||||||
"wb.install.done.iconsOn": "এটি এখন আপনার আইকন প্যাক। যেকোনো সময় অ্যাপিয়ারেন্সে গিয়ে বদলান।",
|
|
||||||
"wb.install.done.iconsOff": "এটি অ্যাপিয়ারেন্সে আপনার আইকন প্যাকের তালিকায় আছে।",
|
|
||||||
"wb.store.icons": "আইকন",
|
|
||||||
"wb.store.iconsItem": "আইকন প্যাক",
|
|
||||||
"wb.store.builtinTab": "বিল্ট-ইন",
|
|
||||||
"wb.store.builtinItem": "বিল্ট-ইন",
|
|
||||||
"wb.store.areaSwitch": "{name} চালু বা বন্ধ করুন",
|
|
||||||
"wb.store.areaOn": "চালু",
|
|
||||||
"wb.store.areaOff": "বন্ধ"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -998,7 +998,7 @@
|
||||||
"wb.settings.media.folderRemoved": "Carpeta eliminada.",
|
"wb.settings.media.folderRemoved": "Carpeta eliminada.",
|
||||||
"wb.settings.media.folders": "Carpetes de la galeria",
|
"wb.settings.media.folders": "Carpetes de la galeria",
|
||||||
"wb.settings.media.foldersHint": "Les imatges més noves d’aquestes carpetes. Només es llegeixen els fitxers que hi ha directament a dins.",
|
"wb.settings.media.foldersHint": "Les imatges més noves d’aquestes carpetes. Només es llegeixen els fitxers que hi ha directament a dins.",
|
||||||
"wb.settings.media.hint": "El tauler de Contingut ({shortcut}) al costat de {site}.",
|
"wb.settings.media.hint": "El tauler de Contingut (Ctrl+Shift+G) al costat de {site}.",
|
||||||
"wb.settings.media.keep": "Elements a conservar",
|
"wb.settings.media.keep": "Elements a conservar",
|
||||||
"wb.settings.media.keepHint": "Els elements més antics es descarten pel final.",
|
"wb.settings.media.keepHint": "Els elements més antics es descarten pel final.",
|
||||||
"wb.settings.media.noFolders": "Encara no hi ha carpetes. Afegeix-ne una per veure’n les imatges al tauler de Contingut.",
|
"wb.settings.media.noFolders": "Encara no hi ha carpetes. Afegeix-ne una per veure’n les imatges al tauler de Contingut.",
|
||||||
|
|
@ -1275,113 +1275,6 @@
|
||||||
"wb.setup.err.size": "És massa gran per ser una configuració.",
|
"wb.setup.err.size": "És massa gran per ser una configuració.",
|
||||||
"wb.strings.translate": "Mode de traducció",
|
"wb.strings.translate": "Mode de traducció",
|
||||||
"wb.strings.translateHint": "Cada pestanya de {site} mostra una barra: feu clic en una paraula per canviar-la. Els canvis s'apliquen en aquella pestanya després de recarregar, i «Copia el fitxer del paquet» us dona un paquet per compartir. Mentre és actiu, les paraules porten marques invisibles.",
|
"wb.strings.translateHint": "Cada pestanya de {site} mostra una barra: feu clic en una paraula per canviar-la. Els canvis s'apliquen en aquella pestanya després de recarregar, i «Copia el fitxer del paquet» us dona un paquet per compartir. Mentre és actiu, les paraules porten marques invisibles.",
|
||||||
"wb.menu.strings": "Idiomes",
|
"wb.menu.strings": "Idiomes"
|
||||||
"wb.menu.barFile": "Arxiu",
|
|
||||||
"wb.menu.barEdit": "Edita",
|
|
||||||
"wb.menu.barView": "Visualitza",
|
|
||||||
"wb.menu.barAccount": "Compte",
|
|
||||||
"wb.menu.barPlugins": "Connectors",
|
|
||||||
"wb.menu.barWindow": "Finestra",
|
|
||||||
"wb.menu.barHelp": "Ajuda",
|
|
||||||
"wb.menu.appHide": "Amaga {product}",
|
|
||||||
"wb.menu.appHideOthers": "Amaga els altres",
|
|
||||||
"wb.menu.appShowAll": "Mostra-ho tot",
|
|
||||||
"wb.menu.appQuit": "Surt de {product}",
|
|
||||||
"wb.menu.appServices": "Serveis",
|
|
||||||
"wb.menu.appUpdates": "Cerca actualitzacions…",
|
|
||||||
"wb.menu.appSettings": "Configuració…",
|
|
||||||
"wb.menu.appSafe": "Mode segur",
|
|
||||||
"wb.menu.fileClose": "Tanca la pestanya",
|
|
||||||
"wb.menu.fileInstall": "Instal·la des d’un arxiu…",
|
|
||||||
"wb.menu.fileShare": "Comparteix la meva configuració…",
|
|
||||||
"wb.menu.editUndo": "Desfés",
|
|
||||||
"wb.menu.editRedo": "Refés",
|
|
||||||
"wb.menu.editCut": "Retalla",
|
|
||||||
"wb.menu.editCopy": "Copia",
|
|
||||||
"wb.menu.editPaste": "Enganxa",
|
|
||||||
"wb.menu.editSelectAll": "Selecciona-ho tot",
|
|
||||||
"wb.menu.editFind": "Cerca…",
|
|
||||||
"wb.menu.editFindNext": "Cerca el següent",
|
|
||||||
"wb.menu.editFindPrevious": "Cerca l’anterior",
|
|
||||||
"wb.menu.viewZoomIn": "Amplia",
|
|
||||||
"wb.menu.viewZoomOut": "Redueix",
|
|
||||||
"wb.menu.viewActual": "Mida real",
|
|
||||||
"wb.menu.viewIconPack": "Paquet d’icones",
|
|
||||||
"wb.menu.viewDeck": "Deck",
|
|
||||||
"wb.menu.viewFullScreen": "Entra a pantalla completa",
|
|
||||||
"wb.menu.acctNone": "Encara no hi ha comptes",
|
|
||||||
"wb.menu.acctAdd": "Afegeix un compte…",
|
|
||||||
"wb.menu.plugStore": "Botiga…",
|
|
||||||
"wb.menu.plugFolder": "Obre la carpeta de connectors…",
|
|
||||||
"wb.menu.winMinimize": "Minimitza",
|
|
||||||
"wb.menu.winZoom": "Zoom",
|
|
||||||
"wb.menu.winWorkspaces": "Espais de treball",
|
|
||||||
"wb.menu.helpDocs": "Documentació",
|
|
||||||
"wb.menu.helpReport": "Informa d’un problema…",
|
|
||||||
"wb.store.category.icons": "Icones",
|
|
||||||
"wb.appearance.doctorHints": "{count, plural, one {El doctor de temes té un suggeriment:} other {El doctor de temes té # suggeriments, el primer:}} {hint}",
|
|
||||||
"wb.doctor.title": "Doctor de temes",
|
|
||||||
"wb.doctor.hint": "Consells sobre aquest tema: maneres més lleugeres de fer el mateix, costos i contrast. Només aconsella; no es bloqueja ni es canvia res.",
|
|
||||||
"wb.doctor.empty": "Res a informar: el tema fa servir tokens i ajustos de components, i res no és costós.",
|
|
||||||
"wb.doctor.count": "{count, plural, one {# troballa} other {# troballes}}",
|
|
||||||
"wb.doctor.kind.lighter": "Una manera més lleugera",
|
|
||||||
"wb.doctor.kind.performance": "Rendiment",
|
|
||||||
"wb.doctor.kind.accessibility": "Accessibilitat",
|
|
||||||
"wb.doctor.kind.contrast": "Contrast",
|
|
||||||
"wb.doctor.where": "On",
|
|
||||||
"wb.doctor.fix": "Solució",
|
|
||||||
"wb.doctor.css-radius.found": "Aquesta regla defineix els radis de les cantonades en CSS.",
|
|
||||||
"wb.doctor.css-radius.fix": "Defineix-los amb el radius d'una part sota components, o shape.radius per a totes: sense CSS, i continua funcionant quan el lloc canvia el nom de les classes.",
|
|
||||||
"wb.doctor.css-bevel.found": "Aquesta regla dibuixa una vora bisellada amb ombres interiors apilades.",
|
|
||||||
"wb.doctor.css-bevel.fix": "Fes servir borderStyle \"bevel-out\" o \"bevel-in\" en una part sota components: dibuixa el bisell a partir dels colors del tema.",
|
|
||||||
"wb.doctor.css-hide.found": "Aquesta regla amaga alguna cosa amb display: none.",
|
|
||||||
"wb.doctor.css-hide.fix": "Fes servir visible en una part sota components (avatars, comptadors, noms) o una variant de disposició com sidebar: hidden; així el propietari ho pot tornar a activar.",
|
|
||||||
"wb.doctor.css-color.found": "Aquesta regla fa servir un color literal.",
|
|
||||||
"wb.doctor.css-color.fix": "Posa nom a un rol (text, muted, accent, surface…) a colors o en un component, perquè la revisió de contrast també el cobreixi.",
|
|
||||||
"wb.doctor.css-font.found": "Aquesta regla defineix una família de tipus de lletra.",
|
|
||||||
"wb.doctor.css-font.fix": "Fes servir font.roles: defineix les lletres de les publicacions, els títols, els números i la monoespaiada sense CSS.",
|
|
||||||
"wb.doctor.css-has.found": "Aquesta regla fa servir :has(), que es torna a avaluar a cada canvi de la pàgina.",
|
|
||||||
"wb.doctor.css-has.fix": "No facis servir :has() en regles que es repeteixen al llarg d'una línia de temps, o ancora la regla a una part.",
|
|
||||||
"wb.doctor.css-universal.found": "Aquesta regla fa servir un selector universal (*), que s'avalua amb cada element.",
|
|
||||||
"wb.doctor.css-universal.fix": "Ancora la regla a una part.",
|
|
||||||
"wb.doctor.css-blur.found": "Aquesta regla difumina el que hi ha al darrere (backdrop-filter), cosa costosa en parts que es repeteixen.",
|
|
||||||
"wb.doctor.css-blur.fix": "Fes servir el farciment glass de les barres i els panells: és el lloc més barat per al difuminat.",
|
|
||||||
"wb.doctor.css-outline-none.found": "Aquesta regla elimina el contorn de focus, de manera que el focus del teclat ja no es veu.",
|
|
||||||
"wb.doctor.css-outline-none.fix": "Fes servir decor.focusRing per dibuixar un anell de focus visible.",
|
|
||||||
"wb.doctor.css-motion.found": "Aquesta regla anima sense comprovar si s'ha demanat reduir el moviment.",
|
|
||||||
"wb.doctor.css-motion.fix": "Mantén el moviment dins de @media (prefers-reduced-motion: no-preference), o deixa que decor.motion ho faci per tu.",
|
|
||||||
"wb.doctor.css-size.found": "El CSS té més de 20.000 caràcters.",
|
|
||||||
"wb.doctor.css-size.fix": "El lloc recalcula els estils amb cada regla; els tokens i els ajustos de components es compilen en menys regles.",
|
|
||||||
"wb.doctor.contrast.found": "El color {token} s'ha ajustat perquè continuï sent llegible ({ratio}:1 sobre el fons).",
|
|
||||||
"wb.doctor.contrast.fix": "Tria un color {token} més clar o més fosc; fins aleshores el tema es mostra amb l'ajustat.",
|
|
||||||
"wb.doctor.glass-post.found": "S'ha definit glass a les publicacions, però no es dibuixa: difuminar cada publicació d'una línia de temps és massa costós.",
|
|
||||||
"wb.doctor.glass-post.fix": "Fes servir un farciment sòlid o tintat per a les publicacions i reserva glass per a barres i panells.",
|
|
||||||
"wb.doctor.small-post-text.found": "El text de les publicacions és de {size}px, cosa difícil de llegir per a molta gent.",
|
|
||||||
"wb.doctor.small-post-text.fix": "Fes servir 14px o més per a la mida del text de les publicacions, o augmenta la mida del text de tot el tema.",
|
|
||||||
"wb.doctor.nav-moved.found": "La navegació s'ha mogut a la posició {position}, cosa que canvia on la busca la gent.",
|
|
||||||
"wb.doctor.nav-moved.fix": "Només s'aplica en panells amplis, i el propietari pot desactivar els canvis de disposició. Mantén la posició per defecte tret que la disposició ho necessiti.",
|
|
||||||
"wb.install.eyebrow.icons.install": "Instal·la el paquet d'icones",
|
|
||||||
"wb.install.eyebrow.icons.update": "Actualitza el paquet d'icones",
|
|
||||||
"wb.install.eyebrow.icons.reinstall": "Reinstal·la el paquet d'icones",
|
|
||||||
"wb.install.err.icons": "Aquest paquet d'icones no es pot instal·lar",
|
|
||||||
"wb.install.err.iconsNone": "{site} no pot instal·lar paquets d'icones aquí.",
|
|
||||||
"wb.install.err.iconsLarge": "Els paquets d'icones tenen un límit de 120 KB.",
|
|
||||||
"wb.install.err.iconsNotInstalled": "El paquet d'icones no s'ha instal·lat",
|
|
||||||
"wb.install.err.opened": "Aquest fitxer no es pot instal·lar",
|
|
||||||
"wb.install.icons.dataOnly": "Només dades: dibuixos com a dades de traç i imatges petites. Sense codi ni estils; res no s'hi executa.",
|
|
||||||
"wb.install.icons.license": "Llicència",
|
|
||||||
"wb.install.icons.source": "Dibuixos de",
|
|
||||||
"wb.install.icons.count": "Icones",
|
|
||||||
"wb.install.icons.countValue": "{count, plural, one {# icona} other {# icones}}",
|
|
||||||
"wb.install.icons.file": "El fitxer del paquet",
|
|
||||||
"wb.install.done.iconsOn": "Ara és el teu paquet d'icones. Pots tornar enrere en qualsevol moment a Aparença.",
|
|
||||||
"wb.install.done.iconsOff": "És als teus paquets d'icones a Aparença.",
|
|
||||||
"wb.store.icons": "Icones",
|
|
||||||
"wb.store.iconsItem": "Paquet d'icones",
|
|
||||||
"wb.store.builtinTab": "Integrats",
|
|
||||||
"wb.store.builtinItem": "Integrat",
|
|
||||||
"wb.store.areaSwitch": "Activa o desactiva {name}",
|
|
||||||
"wb.store.areaOn": "Activat",
|
|
||||||
"wb.store.areaOff": "Desactivat"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -998,7 +998,7 @@
|
||||||
"wb.settings.media.folderRemoved": "Složka odebrána.",
|
"wb.settings.media.folderRemoved": "Složka odebrána.",
|
||||||
"wb.settings.media.folders": "Složky galerie",
|
"wb.settings.media.folders": "Složky galerie",
|
||||||
"wb.settings.media.foldersHint": "Nejnovější obrázky z těchto složek. Čtou se jen soubory přímo v nich.",
|
"wb.settings.media.foldersHint": "Nejnovější obrázky z těchto složek. Čtou se jen soubory přímo v nich.",
|
||||||
"wb.settings.media.hint": "Panel Média ({shortcut}) vedle {site}.",
|
"wb.settings.media.hint": "Panel Média (Ctrl+Shift+G) vedle {site}.",
|
||||||
"wb.settings.media.keep": "Počet položek k uchování",
|
"wb.settings.media.keep": "Počet položek k uchování",
|
||||||
"wb.settings.media.keepHint": "Starší položky se odstraní z konce.",
|
"wb.settings.media.keepHint": "Starší položky se odstraní z konce.",
|
||||||
"wb.settings.media.noFolders": "Zatím žádné složky. Přidejte jednu a její obrázky uvidíte v panelu Média.",
|
"wb.settings.media.noFolders": "Zatím žádné složky. Přidejte jednu a její obrázky uvidíte v panelu Média.",
|
||||||
|
|
@ -1275,113 +1275,6 @@
|
||||||
"wb.setup.err.size": "Na nastavení je to příliš velké.",
|
"wb.setup.err.size": "Na nastavení je to příliš velké.",
|
||||||
"wb.strings.translate": "Režim překladu",
|
"wb.strings.translate": "Režim překladu",
|
||||||
"wb.strings.translateHint": "Každá karta {site} ukazuje lištu: kliknutím na slovo ho změníte. Úpravy platí v té kartě po znovunačtení a „Kopírovat soubor balíčku“ vám dá balíček ke sdílení. Dokud je zapnutý, slova nesou neviditelné značky.",
|
"wb.strings.translateHint": "Každá karta {site} ukazuje lištu: kliknutím na slovo ho změníte. Úpravy platí v té kartě po znovunačtení a „Kopírovat soubor balíčku“ vám dá balíček ke sdílení. Dokud je zapnutý, slova nesou neviditelné značky.",
|
||||||
"wb.menu.strings": "Jazyky",
|
"wb.menu.strings": "Jazyky"
|
||||||
"wb.menu.barFile": "Soubor",
|
|
||||||
"wb.menu.barEdit": "Úpravy",
|
|
||||||
"wb.menu.barView": "Zobrazení",
|
|
||||||
"wb.menu.barAccount": "Účet",
|
|
||||||
"wb.menu.barPlugins": "Pluginy",
|
|
||||||
"wb.menu.barWindow": "Okno",
|
|
||||||
"wb.menu.barHelp": "Nápověda",
|
|
||||||
"wb.menu.appHide": "Skrýt {product}",
|
|
||||||
"wb.menu.appHideOthers": "Skrýt ostatní",
|
|
||||||
"wb.menu.appShowAll": "Zobrazit vše",
|
|
||||||
"wb.menu.appQuit": "Ukončit {product}",
|
|
||||||
"wb.menu.appServices": "Služby",
|
|
||||||
"wb.menu.appUpdates": "Zkontrolovat aktualizace…",
|
|
||||||
"wb.menu.appSettings": "Nastavení…",
|
|
||||||
"wb.menu.appSafe": "Nouzový režim",
|
|
||||||
"wb.menu.fileClose": "Zavřít kartu",
|
|
||||||
"wb.menu.fileInstall": "Instalovat ze souboru…",
|
|
||||||
"wb.menu.fileShare": "Sdílet moje nastavení…",
|
|
||||||
"wb.menu.editUndo": "Zpět",
|
|
||||||
"wb.menu.editRedo": "Znovu",
|
|
||||||
"wb.menu.editCut": "Vyjmout",
|
|
||||||
"wb.menu.editCopy": "Kopírovat",
|
|
||||||
"wb.menu.editPaste": "Vložit",
|
|
||||||
"wb.menu.editSelectAll": "Vybrat vše",
|
|
||||||
"wb.menu.editFind": "Najít…",
|
|
||||||
"wb.menu.editFindNext": "Najít další",
|
|
||||||
"wb.menu.editFindPrevious": "Najít předchozí",
|
|
||||||
"wb.menu.viewZoomIn": "Přiblížit",
|
|
||||||
"wb.menu.viewZoomOut": "Oddálit",
|
|
||||||
"wb.menu.viewActual": "Skutečná velikost",
|
|
||||||
"wb.menu.viewIconPack": "Balíček ikon",
|
|
||||||
"wb.menu.viewDeck": "Deck",
|
|
||||||
"wb.menu.viewFullScreen": "Přejít na celou obrazovku",
|
|
||||||
"wb.menu.acctNone": "Zatím žádné účty",
|
|
||||||
"wb.menu.acctAdd": "Přidat účet…",
|
|
||||||
"wb.menu.plugStore": "Obchod…",
|
|
||||||
"wb.menu.plugFolder": "Otevřít složku pluginů…",
|
|
||||||
"wb.menu.winMinimize": "Minimalizovat",
|
|
||||||
"wb.menu.winZoom": "Lupa",
|
|
||||||
"wb.menu.winWorkspaces": "Pracovní prostory",
|
|
||||||
"wb.menu.helpDocs": "Dokumentace",
|
|
||||||
"wb.menu.helpReport": "Nahlásit problém…",
|
|
||||||
"wb.store.category.icons": "Ikony",
|
|
||||||
"wb.appearance.doctorHints": "{count, plural, one {Doktor motivů má radu:} few {Doktor motivů má # rady, první:} many {Doktor motivů má # rady, první:} other {Doktor motivů má # rad, první:}} {hint}",
|
|
||||||
"wb.doctor.title": "Doktor motivů",
|
|
||||||
"wb.doctor.hint": "Rady k tomuto motivu: lehčí cesty k témuž, náklady a kontrast. Pouze radí; nic se neblokuje ani nemění.",
|
|
||||||
"wb.doctor.empty": "Není co hlásit: motiv používá tokeny a nastavení komponent a nic v něm není nákladné.",
|
|
||||||
"wb.doctor.count": "{count, plural, one {# nález} few {# nálezy} many {# nálezu} other {# nálezů}}",
|
|
||||||
"wb.doctor.kind.lighter": "Lehčí cesta",
|
|
||||||
"wb.doctor.kind.performance": "Výkon",
|
|
||||||
"wb.doctor.kind.accessibility": "Přístupnost",
|
|
||||||
"wb.doctor.kind.contrast": "Kontrast",
|
|
||||||
"wb.doctor.where": "Kde",
|
|
||||||
"wb.doctor.fix": "Oprava",
|
|
||||||
"wb.doctor.css-radius.found": "Toto pravidlo nastavuje zaoblení rohů v CSS.",
|
|
||||||
"wb.doctor.css-radius.fix": "Nastavte je přes radius části v components nebo přes shape.radius pro všechny: bez CSS a funguje to dál, i když web přejmenuje své třídy.",
|
|
||||||
"wb.doctor.css-bevel.found": "Toto pravidlo kreslí zkosenou hranu pomocí naskládaných vnitřních stínů.",
|
|
||||||
"wb.doctor.css-bevel.fix": "Použijte borderStyle \"bevel-out\" nebo \"bevel-in\" u části v components: zkosení se vykreslí z barev motivu.",
|
|
||||||
"wb.doctor.css-hide.found": "Toto pravidlo něco skrývá pomocí display: none.",
|
|
||||||
"wb.doctor.css-hide.fix": "Použijte visible u části v components (avatary, počty, jména) nebo variantu rozvržení, například sidebar: hidden; majitel to pak může vrátit zpět.",
|
|
||||||
"wb.doctor.css-color.found": "Toto pravidlo používá pevně zadanou barvu.",
|
|
||||||
"wb.doctor.css-color.fix": "Pojmenujte roli (text, muted, accent, surface…) v colors nebo v komponentě, aby ji kontrola kontrastu zahrnula.",
|
|
||||||
"wb.doctor.css-font.found": "Toto pravidlo nastavuje rodinu písma.",
|
|
||||||
"wb.doctor.css-font.fix": "Použijte font.roles: nastaví písma příspěvků, nadpisů, čísel a neproporcionální písmo bez CSS.",
|
|
||||||
"wb.doctor.css-has.found": "Toto pravidlo používá :has(), které se vyhodnocuje znovu při každé změně stránky.",
|
|
||||||
"wb.doctor.css-has.fix": "Nepoužívejte :has() v pravidlech, která se opakují v celé časové ose, nebo pravidlo ukotvěte na část.",
|
|
||||||
"wb.doctor.css-universal.found": "Toto pravidlo používá univerzální selektor (*), který se porovnává s každým prvkem.",
|
|
||||||
"wb.doctor.css-universal.fix": "Ukotvěte pravidlo raději na část.",
|
|
||||||
"wb.doctor.css-blur.found": "Toto pravidlo rozmazává, co je za ním (backdrop-filter), což je nákladné u opakujících se částí.",
|
|
||||||
"wb.doctor.css-blur.fix": "Použijte výplň glass u lišt a panelů: tam je rozmazání levnější.",
|
|
||||||
"wb.doctor.css-outline-none.found": "Toto pravidlo odstraňuje obrys fokusu, takže fokus z klávesnice není vidět.",
|
|
||||||
"wb.doctor.css-outline-none.fix": "Použijte decor.focusRing a nakreslete viditelný kroužek fokusu.",
|
|
||||||
"wb.doctor.css-motion.found": "Toto pravidlo animuje, aniž by kontrolovalo omezení pohybu.",
|
|
||||||
"wb.doctor.css-motion.fix": "Držte pohyb uvnitř @media (prefers-reduced-motion: no-preference), nebo to nechte na decor.motion.",
|
|
||||||
"wb.doctor.css-size.found": "CSS má více než 20 000 znaků.",
|
|
||||||
"wb.doctor.css-size.fix": "Web přepočítává styly s každým pravidlem; tokeny a nastavení komponent se zkompilují do méně pravidel.",
|
|
||||||
"wb.doctor.contrast.found": "Barva {token} byla upravena, aby zůstala čitelná ({ratio}:1 na pozadí).",
|
|
||||||
"wb.doctor.contrast.fix": "Zvolte světlejší nebo tmavší barvu {token}; do té doby se motiv zobrazuje s upravenou.",
|
|
||||||
"wb.doctor.glass-post.found": "Glass je nastaveno u příspěvků, ale nevykresluje se: rozmazání každého příspěvku v časové ose je příliš nákladné.",
|
|
||||||
"wb.doctor.glass-post.fix": "U příspěvků použijte plnou nebo tónovanou výplň a glass nechte pro lišty a panely.",
|
|
||||||
"wb.doctor.small-post-text.found": "Text příspěvků má {size}px, což je pro mnoho lidí špatně čitelné.",
|
|
||||||
"wb.doctor.small-post-text.fix": "Použijte pro velikost textu příspěvků 14px nebo více, nebo zvětšete text celého motivu.",
|
|
||||||
"wb.doctor.nav-moved.found": "Navigace je přesunuta na pozici {position}, což mění, kde ji lidé hledají.",
|
|
||||||
"wb.doctor.nav-moved.fix": "Platí jen na širokých panelech a majitel může změny rozvržení vypnout. Ponechte výchozí pozici, pokud ji rozvržení nevyžaduje.",
|
|
||||||
"wb.install.eyebrow.icons.install": "Nainstalovat balíček ikon",
|
|
||||||
"wb.install.eyebrow.icons.update": "Aktualizovat balíček ikon",
|
|
||||||
"wb.install.eyebrow.icons.reinstall": "Přeinstalovat balíček ikon",
|
|
||||||
"wb.install.err.icons": "Tento balíček ikon nelze nainstalovat",
|
|
||||||
"wb.install.err.iconsNone": "{site} zde nemůže instalovat balíčky ikon.",
|
|
||||||
"wb.install.err.iconsLarge": "Balíčky ikon jsou omezeny na 120 KB.",
|
|
||||||
"wb.install.err.iconsNotInstalled": "Balíček ikon nebyl nainstalován",
|
|
||||||
"wb.install.err.opened": "Tento soubor nelze nainstalovat",
|
|
||||||
"wb.install.icons.dataOnly": "Pouze data: kresby jako data cest a malé obrázky. Žádný kód ani styly; nic z toho se nespouští.",
|
|
||||||
"wb.install.icons.license": "Licence",
|
|
||||||
"wb.install.icons.source": "Kresby z",
|
|
||||||
"wb.install.icons.count": "Ikony",
|
|
||||||
"wb.install.icons.countValue": "{count, plural, one {# ikona} few {# ikony} many {# ikony} other {# ikon}}",
|
|
||||||
"wb.install.icons.file": "Soubor balíčku",
|
|
||||||
"wb.install.done.iconsOn": "Nyní je to váš balíček ikon. Kdykoli se můžete vrátit ve Vzhledu.",
|
|
||||||
"wb.install.done.iconsOff": "Je mezi vašimi balíčky ikon ve Vzhledu.",
|
|
||||||
"wb.store.icons": "Ikony",
|
|
||||||
"wb.store.iconsItem": "Balíček ikon",
|
|
||||||
"wb.store.builtinTab": "Vestavěné",
|
|
||||||
"wb.store.builtinItem": "Vestavěné",
|
|
||||||
"wb.store.areaSwitch": "Zapnout nebo vypnout {name}",
|
|
||||||
"wb.store.areaOn": "Zapnuto",
|
|
||||||
"wb.store.areaOff": "Vypnuto"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -998,7 +998,7 @@
|
||||||
"wb.settings.media.folderRemoved": "Mappen er fjernet.",
|
"wb.settings.media.folderRemoved": "Mappen er fjernet.",
|
||||||
"wb.settings.media.folders": "Galleri-mapper",
|
"wb.settings.media.folders": "Galleri-mapper",
|
||||||
"wb.settings.media.foldersHint": "De nyeste billeder fra disse mapper. Kun filer direkte i dem læses.",
|
"wb.settings.media.foldersHint": "De nyeste billeder fra disse mapper. Kun filer direkte i dem læses.",
|
||||||
"wb.settings.media.hint": "Medie-panelet ({shortcut}) ved siden af {site}.",
|
"wb.settings.media.hint": "Medie-panelet (Ctrl+Shift+G) ved siden af {site}.",
|
||||||
"wb.settings.media.keep": "Antal elementer at beholde",
|
"wb.settings.media.keep": "Antal elementer at beholde",
|
||||||
"wb.settings.media.keepHint": "Ældre elementer falder af i enden.",
|
"wb.settings.media.keepHint": "Ældre elementer falder af i enden.",
|
||||||
"wb.settings.media.noFolders": "Ingen mapper endnu. Tilføj en for at se dens billeder i Medie-panelet.",
|
"wb.settings.media.noFolders": "Ingen mapper endnu. Tilføj en for at se dens billeder i Medie-panelet.",
|
||||||
|
|
@ -1275,113 +1275,6 @@
|
||||||
"wb.setup.err.size": "Det er for stort til at være en opsætning.",
|
"wb.setup.err.size": "Det er for stort til at være en opsætning.",
|
||||||
"wb.strings.translate": "Oversættelsestilstand",
|
"wb.strings.translate": "Oversættelsestilstand",
|
||||||
"wb.strings.translateHint": "Hver {site}-fane viser en bjælke: klik på et ord for at ændre det. Dine rettelser gælder i den fane efter en genindlæsning, og \"Kopiér pakkefil\" giver dig en pakke at dele. Mens den er slået til, bærer ord usynlige markører.",
|
"wb.strings.translateHint": "Hver {site}-fane viser en bjælke: klik på et ord for at ændre det. Dine rettelser gælder i den fane efter en genindlæsning, og \"Kopiér pakkefil\" giver dig en pakke at dele. Mens den er slået til, bærer ord usynlige markører.",
|
||||||
"wb.menu.strings": "Sprog",
|
"wb.menu.strings": "Sprog"
|
||||||
"wb.menu.barFile": "Arkiv",
|
|
||||||
"wb.menu.barEdit": "Rediger",
|
|
||||||
"wb.menu.barView": "Vis",
|
|
||||||
"wb.menu.barAccount": "Konto",
|
|
||||||
"wb.menu.barPlugins": "Udvidelser",
|
|
||||||
"wb.menu.barWindow": "Vindue",
|
|
||||||
"wb.menu.barHelp": "Hjælp",
|
|
||||||
"wb.menu.appHide": "Skjul {product}",
|
|
||||||
"wb.menu.appHideOthers": "Skjul andre",
|
|
||||||
"wb.menu.appShowAll": "Vis alle",
|
|
||||||
"wb.menu.appQuit": "Afslut {product}",
|
|
||||||
"wb.menu.appServices": "Tjenester",
|
|
||||||
"wb.menu.appUpdates": "Søg efter opdateringer …",
|
|
||||||
"wb.menu.appSettings": "Indstillinger …",
|
|
||||||
"wb.menu.appSafe": "Sikker tilstand",
|
|
||||||
"wb.menu.fileClose": "Luk fane",
|
|
||||||
"wb.menu.fileInstall": "Installer fra fil …",
|
|
||||||
"wb.menu.fileShare": "Del min opsætning …",
|
|
||||||
"wb.menu.editUndo": "Fortryd",
|
|
||||||
"wb.menu.editRedo": "Gentag",
|
|
||||||
"wb.menu.editCut": "Klip",
|
|
||||||
"wb.menu.editCopy": "Kopiér",
|
|
||||||
"wb.menu.editPaste": "Indsæt",
|
|
||||||
"wb.menu.editSelectAll": "Markér alt",
|
|
||||||
"wb.menu.editFind": "Søg …",
|
|
||||||
"wb.menu.editFindNext": "Søg efter næste",
|
|
||||||
"wb.menu.editFindPrevious": "Søg efter forrige",
|
|
||||||
"wb.menu.viewZoomIn": "Zoom ind",
|
|
||||||
"wb.menu.viewZoomOut": "Zoom ud",
|
|
||||||
"wb.menu.viewActual": "Faktisk størrelse",
|
|
||||||
"wb.menu.viewIconPack": "Ikonpakke",
|
|
||||||
"wb.menu.viewDeck": "Deck",
|
|
||||||
"wb.menu.viewFullScreen": "Gå til fuld skærm",
|
|
||||||
"wb.menu.acctNone": "Ingen konti endnu",
|
|
||||||
"wb.menu.acctAdd": "Tilføj konto …",
|
|
||||||
"wb.menu.plugStore": "Butik …",
|
|
||||||
"wb.menu.plugFolder": "Åbn mappen med udvidelser …",
|
|
||||||
"wb.menu.winMinimize": "Minimér",
|
|
||||||
"wb.menu.winZoom": "Zoom",
|
|
||||||
"wb.menu.winWorkspaces": "Arbejdsområder",
|
|
||||||
"wb.menu.helpDocs": "Dokumentation",
|
|
||||||
"wb.menu.helpReport": "Rapportér et problem …",
|
|
||||||
"wb.store.category.icons": "Ikoner",
|
|
||||||
"wb.appearance.doctorHints": "{count, plural, one {Temadoktoren har et tip:} other {Temadoktoren har # tip, det første:}} {hint}",
|
|
||||||
"wb.doctor.title": "Temadoktor",
|
|
||||||
"wb.doctor.hint": "Råd om dette tema: lettere måder at gøre det samme på, omkostninger og kontrast. Den rådgiver kun; intet blokeres eller ændres.",
|
|
||||||
"wb.doctor.empty": "Intet at rapportere: temaet bruger tokens og komponentindstillinger, og intet i det er dyrt.",
|
|
||||||
"wb.doctor.count": "{count, plural, one {# fund} other {# fund}}",
|
|
||||||
"wb.doctor.kind.lighter": "En lettere måde",
|
|
||||||
"wb.doctor.kind.performance": "Ydeevne",
|
|
||||||
"wb.doctor.kind.accessibility": "Tilgængelighed",
|
|
||||||
"wb.doctor.kind.contrast": "Kontrast",
|
|
||||||
"wb.doctor.where": "Hvor",
|
|
||||||
"wb.doctor.fix": "Løsning",
|
|
||||||
"wb.doctor.css-radius.found": "Denne regel angiver hjørneradier i CSS.",
|
|
||||||
"wb.doctor.css-radius.fix": "Angiv dem med radius på en del under components, eller shape.radius for alle: ingen CSS, og det bliver ved med at virke, når sitet omdøber sine klasser.",
|
|
||||||
"wb.doctor.css-bevel.found": "Denne regel tegner en affaset kant med stablede indre skygger.",
|
|
||||||
"wb.doctor.css-bevel.fix": "Brug borderStyle \"bevel-out\" eller \"bevel-in\" på en del under components: den tegner affasningen ud fra temaets farver.",
|
|
||||||
"wb.doctor.css-hide.found": "Denne regel skjuler noget med display: none.",
|
|
||||||
"wb.doctor.css-hide.fix": "Brug visible på en del under components (avatarer, tællere, navne) eller en layoutvariant som sidebar: hidden; så kan ejeren slå det til igen.",
|
|
||||||
"wb.doctor.css-color.found": "Denne regel bruger en fast farve.",
|
|
||||||
"wb.doctor.css-color.fix": "Angiv en rolle (text, muted, accent, surface…) i colors eller i en komponent, så kontrastkontrollen også dækker den.",
|
|
||||||
"wb.doctor.css-font.found": "Denne regel angiver en skrifttypefamilie.",
|
|
||||||
"wb.doctor.css-font.fix": "Brug font.roles: den angiver skrifttyperne til opslag, overskrifter, tal og mono uden CSS.",
|
|
||||||
"wb.doctor.css-has.found": "Denne regel bruger :has(), som matches igen ved hver ændring af siden.",
|
|
||||||
"wb.doctor.css-has.fix": "Undgå :has() i regler, der gentages nedad en tidslinje, eller forankr reglen i en del.",
|
|
||||||
"wb.doctor.css-universal.found": "Denne regel bruger en universalvælger (*), som matches mod alle elementer.",
|
|
||||||
"wb.doctor.css-universal.fix": "Forankr i stedet reglen i en del.",
|
|
||||||
"wb.doctor.css-blur.found": "Denne regel slører det, der er bagved (backdrop-filter), hvilket er dyrt på dele, der gentages.",
|
|
||||||
"wb.doctor.css-blur.fix": "Brug glass-udfyldningen til bjælker og paneler: det er det billigere sted at sløre.",
|
|
||||||
"wb.doctor.css-outline-none.found": "Denne regel fjerner fokusomridset, så tastaturfokus ikke længere er synligt.",
|
|
||||||
"wb.doctor.css-outline-none.fix": "Brug decor.focusRing til at tegne en synlig fokusring i stedet.",
|
|
||||||
"wb.doctor.css-motion.found": "Denne regel animerer uden at tage højde for reduceret bevægelse.",
|
|
||||||
"wb.doctor.css-motion.fix": "Hold bevægelse inde i @media (prefers-reduced-motion: no-preference), eller lad decor.motion klare det for dig.",
|
|
||||||
"wb.doctor.css-size.found": "CSS'en er på mere end 20.000 tegn.",
|
|
||||||
"wb.doctor.css-size.fix": "Sitet genberegner typografier for hver regel; tokens og komponentindstillinger kompileres til færre regler.",
|
|
||||||
"wb.doctor.contrast.found": "Farven {token} blev justeret, så den forbliver læsbar ({ratio}:1 på baggrunden).",
|
|
||||||
"wb.doctor.contrast.fix": "Vælg en lysere eller mørkere {token}-farve; indtil da vises temaet med den justerede.",
|
|
||||||
"wb.doctor.glass-post.found": "Glass er angivet på opslag, men tegnes ikke: sløring af hvert opslag på en tidslinje er for dyrt.",
|
|
||||||
"wb.doctor.glass-post.fix": "Brug en ensfarvet eller tonet udfyldning til opslag, og gem glass til bjælker og paneler.",
|
|
||||||
"wb.doctor.small-post-text.found": "Opslagstekst er {size}px, hvilket er svært at læse for mange.",
|
|
||||||
"wb.doctor.small-post-text.fix": "Brug 14px eller mere til opslagstekstens størrelse, eller øg tekststørrelsen for hele temaet.",
|
|
||||||
"wb.doctor.nav-moved.found": "Navigationen er flyttet til {position}, hvilket ændrer, hvor folk leder efter den.",
|
|
||||||
"wb.doctor.nav-moved.fix": "Det gælder kun på brede paneler, og ejeren kan slå layoutændringer fra. Behold standardpositionen, medmindre layoutet kræver andet.",
|
|
||||||
"wb.install.eyebrow.icons.install": "Installér ikonpakke",
|
|
||||||
"wb.install.eyebrow.icons.update": "Opdatér ikonpakke",
|
|
||||||
"wb.install.eyebrow.icons.reinstall": "Geninstallér ikonpakke",
|
|
||||||
"wb.install.err.icons": "Denne ikonpakke kan ikke installeres",
|
|
||||||
"wb.install.err.iconsNone": "{site} kan ikke installere ikonpakker her.",
|
|
||||||
"wb.install.err.iconsLarge": "Ikonpakker er begrænset til 120 KB.",
|
|
||||||
"wb.install.err.iconsNotInstalled": "Ikonpakken blev ikke installeret",
|
|
||||||
"wb.install.err.opened": "Denne fil kan ikke installeres",
|
|
||||||
"wb.install.icons.dataOnly": "Kun data: tegninger som stidata og små billeder. Ingen kode og ingen typografier; intet i den kører.",
|
|
||||||
"wb.install.icons.license": "Licens",
|
|
||||||
"wb.install.icons.source": "Tegninger fra",
|
|
||||||
"wb.install.icons.count": "Ikoner",
|
|
||||||
"wb.install.icons.countValue": "{count, plural, one {# ikon} other {# ikoner}}",
|
|
||||||
"wb.install.icons.file": "Pakkefilen",
|
|
||||||
"wb.install.done.iconsOn": "Det er nu din ikonpakke. Skift tilbage når som helst under Udseende.",
|
|
||||||
"wb.install.done.iconsOff": "Den ligger blandt dine ikonpakker under Udseende.",
|
|
||||||
"wb.store.icons": "Ikoner",
|
|
||||||
"wb.store.iconsItem": "Ikonpakke",
|
|
||||||
"wb.store.builtinTab": "Indbygget",
|
|
||||||
"wb.store.builtinItem": "Indbygget",
|
|
||||||
"wb.store.areaSwitch": "Slå {name} til eller fra",
|
|
||||||
"wb.store.areaOn": "Til",
|
|
||||||
"wb.store.areaOff": "Fra"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -998,7 +998,7 @@
|
||||||
"wb.settings.media.folderRemoved": "Ordner entfernt.",
|
"wb.settings.media.folderRemoved": "Ordner entfernt.",
|
||||||
"wb.settings.media.folders": "Galerie-Ordner",
|
"wb.settings.media.folders": "Galerie-Ordner",
|
||||||
"wb.settings.media.foldersHint": "Die neuesten Bilder aus diesen Ordnern. Es werden nur Dateien direkt in den Ordnern gelesen.",
|
"wb.settings.media.foldersHint": "Die neuesten Bilder aus diesen Ordnern. Es werden nur Dateien direkt in den Ordnern gelesen.",
|
||||||
"wb.settings.media.hint": "Das Medien-Panel ({shortcut}) neben {site}.",
|
"wb.settings.media.hint": "Das Medien-Panel (Ctrl+Shift+G) neben {site}.",
|
||||||
"wb.settings.media.keep": "Einträge behalten",
|
"wb.settings.media.keep": "Einträge behalten",
|
||||||
"wb.settings.media.keepHint": "Ältere Einträge fallen am Ende heraus.",
|
"wb.settings.media.keepHint": "Ältere Einträge fallen am Ende heraus.",
|
||||||
"wb.settings.media.noFolders": "Noch keine Ordner. Füge einen hinzu, um seine Bilder im Medien-Panel zu sehen.",
|
"wb.settings.media.noFolders": "Noch keine Ordner. Füge einen hinzu, um seine Bilder im Medien-Panel zu sehen.",
|
||||||
|
|
@ -1243,46 +1243,6 @@
|
||||||
"wb.appearance.icons.remove": "{name} entfernen",
|
"wb.appearance.icons.remove": "{name} entfernen",
|
||||||
"wb.appearance.icons.removed": "Das Symbolpaket „{name}“ ist entfernt.",
|
"wb.appearance.icons.removed": "Das Symbolpaket „{name}“ ist entfernt.",
|
||||||
"wb.appearance.icons.imported": "Importierte Symbolpakete",
|
"wb.appearance.icons.imported": "Importierte Symbolpakete",
|
||||||
"wb.doctor.title": "Theme-Doktor",
|
|
||||||
"wb.doctor.hint": "Hinweise zu diesem Theme: leichtere Wege zum selben Ergebnis, Kosten und Kontrast. Er rät nur; nichts wird blockiert oder geändert.",
|
|
||||||
"wb.doctor.empty": "Nichts zu melden: Das Theme nutzt Tokens und Komponenteneinstellungen, und nichts darin ist aufwendig.",
|
|
||||||
"wb.doctor.count": "{count, plural, one {# Befund} other {# Befunde}}",
|
|
||||||
"wb.doctor.kind.lighter": "Ein leichterer Weg",
|
|
||||||
"wb.doctor.kind.performance": "Leistung",
|
|
||||||
"wb.doctor.kind.accessibility": "Barrierefreiheit",
|
|
||||||
"wb.doctor.kind.contrast": "Kontrast",
|
|
||||||
"wb.doctor.where": "Wo",
|
|
||||||
"wb.doctor.fix": "Lösung",
|
|
||||||
"wb.doctor.css-radius.found": "Diese Regel legt Eckenradien in CSS fest.",
|
|
||||||
"wb.doctor.css-radius.fix": "Lege sie mit dem radius eines Teils unter components fest oder mit shape.radius für alle: Kein CSS nötig, und es funktioniert weiter, wenn die Seite ihre Klassen umbenennt.",
|
|
||||||
"wb.doctor.css-bevel.found": "Diese Regel zeichnet eine abgeschrägte Kante mit gestapelten inneren Schatten.",
|
|
||||||
"wb.doctor.css-bevel.fix": "Verwende borderStyle \"bevel-out\" oder \"bevel-in\" bei einem Teil unter components: Die Schräge wird aus den Farben des Themes gezeichnet.",
|
|
||||||
"wb.doctor.css-hide.found": "Diese Regel blendet etwas mit display: none aus.",
|
|
||||||
"wb.doctor.css-hide.fix": "Verwende visible bei einem Teil unter components (Avatare, Zähler, Namen) oder eine Layout-Variante wie sidebar: hidden; so kann der Besitzer es wieder einblenden.",
|
|
||||||
"wb.doctor.css-color.found": "Diese Regel verwendet eine feste Farbe.",
|
|
||||||
"wb.doctor.css-color.fix": "Nenne in colors oder in einer Komponente eine Rolle (text, muted, accent, surface …), damit die Kontrastprüfung sie erfasst.",
|
|
||||||
"wb.doctor.css-font.found": "Diese Regel legt eine Schriftfamilie fest.",
|
|
||||||
"wb.doctor.css-font.fix": "Verwende font.roles: Damit legst du die Schriften für Posts, Überschriften, Zahlen und Monospace ohne CSS fest.",
|
|
||||||
"wb.doctor.css-has.found": "Diese Regel verwendet :has(), das bei jeder Änderung der Seite erneut geprüft wird.",
|
|
||||||
"wb.doctor.css-has.fix": "Verwende :has() nicht in Regeln, die sich in einer Timeline wiederholen, oder verankere die Regel an einem Teil.",
|
|
||||||
"wb.doctor.css-universal.found": "Diese Regel verwendet einen Universalselektor (*), der mit jedem Element abgeglichen wird.",
|
|
||||||
"wb.doctor.css-universal.fix": "Verankere die Regel stattdessen an einem Teil.",
|
|
||||||
"wb.doctor.css-blur.found": "Diese Regel weichzeichnet, was dahinter liegt (backdrop-filter), was bei sich wiederholenden Teilen aufwendig ist.",
|
|
||||||
"wb.doctor.css-blur.fix": "Nutze die Glasfüllung von Leisten und Panels: Dort ist Weichzeichnen günstiger.",
|
|
||||||
"wb.doctor.css-outline-none.found": "Diese Regel entfernt den Fokusrahmen, sodass der Tastaturfokus nicht mehr sichtbar ist.",
|
|
||||||
"wb.doctor.css-outline-none.fix": "Verwende stattdessen decor.focusRing, um einen sichtbaren Fokusring zu zeichnen.",
|
|
||||||
"wb.doctor.css-motion.found": "Diese Regel animiert, ohne auf reduzierte Bewegung zu achten.",
|
|
||||||
"wb.doctor.css-motion.fix": "Halte Bewegung innerhalb von @media (prefers-reduced-motion: no-preference) oder lass decor.motion das für dich erledigen.",
|
|
||||||
"wb.doctor.css-size.found": "Das CSS ist länger als 20.000 Zeichen.",
|
|
||||||
"wb.doctor.css-size.fix": "Die Seite berechnet Stile für jede Regel neu; Tokens und Komponenteneinstellungen werden zu weniger Regeln kompiliert.",
|
|
||||||
"wb.doctor.contrast.found": "Die Farbe {token} wurde angepasst, damit sie lesbar bleibt ({ratio}:1 auf dem Hintergrund).",
|
|
||||||
"wb.doctor.contrast.fix": "Wähle eine hellere oder dunklere Farbe für {token}; bis dahin wird das Theme mit der angepassten angezeigt.",
|
|
||||||
"wb.doctor.glass-post.found": "Glas ist bei Posts gesetzt, wird aber nicht gezeichnet: Weichzeichnen bei jedem Post einer Timeline ist zu aufwendig.",
|
|
||||||
"wb.doctor.glass-post.fix": "Verwende für Posts eine einfarbige oder getönte Füllung und spare Glas für Leisten und Panels auf.",
|
|
||||||
"wb.doctor.small-post-text.found": "Der Posttext ist {size}px groß, was für viele schwer lesbar ist.",
|
|
||||||
"wb.doctor.small-post-text.fix": "Verwende für die Posttextgröße 14px oder mehr oder erhöhe die Textgröße des gesamten Themes.",
|
|
||||||
"wb.doctor.nav-moved.found": "Die Navigation wurde nach {position} verschoben, was ändert, wo man sie sucht.",
|
|
||||||
"wb.doctor.nav-moved.fix": "Das gilt nur bei breiten Bereichen, und der Besitzer kann Layoutänderungen abschalten. Behalte die Standardposition bei, außer das Layout braucht es anders.",
|
|
||||||
"wb.setup.title": "Mein Setup teilen",
|
"wb.setup.title": "Mein Setup teilen",
|
||||||
"wb.setup.hint": "Dein Theme, deine Symbole, dein Modus und welche Funktionen an sind, als ein Link oder eine kleine Datei. Jeder kann damit dort anfangen, wo du bist.",
|
"wb.setup.hint": "Dein Theme, deine Symbole, dein Modus und welche Funktionen an sind, als ein Link oder eine kleine Datei. Jeder kann damit dort anfangen, wo du bist.",
|
||||||
"wb.setup.shareLabel": "Dein Setup",
|
"wb.setup.shareLabel": "Dein Setup",
|
||||||
|
|
@ -1315,73 +1275,6 @@
|
||||||
"wb.setup.err.size": "Das ist zu groß für ein Setup.",
|
"wb.setup.err.size": "Das ist zu groß für ein Setup.",
|
||||||
"wb.strings.translate": "Übersetzungsmodus",
|
"wb.strings.translate": "Übersetzungsmodus",
|
||||||
"wb.strings.translateHint": "Jeder {site}-Tab zeigt eine Leiste: Klick auf ein Wort, um es zu ändern. Deine Änderungen gelten in diesem Tab nach dem Neuladen, und „Paketdatei kopieren“ gibt dir ein Paket zum Teilen. Solange er an ist, tragen Wörter unsichtbare Markierungen.",
|
"wb.strings.translateHint": "Jeder {site}-Tab zeigt eine Leiste: Klick auf ein Wort, um es zu ändern. Deine Änderungen gelten in diesem Tab nach dem Neuladen, und „Paketdatei kopieren“ gibt dir ein Paket zum Teilen. Solange er an ist, tragen Wörter unsichtbare Markierungen.",
|
||||||
"wb.menu.strings": "Sprachen",
|
"wb.menu.strings": "Sprachen"
|
||||||
"wb.menu.barFile": "Ablage",
|
|
||||||
"wb.menu.barEdit": "Bearbeiten",
|
|
||||||
"wb.menu.barView": "Darstellung",
|
|
||||||
"wb.menu.barAccount": "Account",
|
|
||||||
"wb.menu.barPlugins": "Plug-ins",
|
|
||||||
"wb.menu.barWindow": "Fenster",
|
|
||||||
"wb.menu.barHelp": "Hilfe",
|
|
||||||
"wb.menu.appHide": "{product} ausblenden",
|
|
||||||
"wb.menu.appHideOthers": "Andere ausblenden",
|
|
||||||
"wb.menu.appShowAll": "Alle einblenden",
|
|
||||||
"wb.menu.appQuit": "{product} beenden",
|
|
||||||
"wb.menu.appServices": "Dienste",
|
|
||||||
"wb.menu.appUpdates": "Nach Updates suchen …",
|
|
||||||
"wb.menu.appSettings": "Einstellungen …",
|
|
||||||
"wb.menu.appSafe": "Sicherer Modus",
|
|
||||||
"wb.menu.fileClose": "Tab schließen",
|
|
||||||
"wb.menu.fileInstall": "Aus Datei installieren …",
|
|
||||||
"wb.menu.fileShare": "Meine Einrichtung teilen …",
|
|
||||||
"wb.menu.editUndo": "Widerrufen",
|
|
||||||
"wb.menu.editRedo": "Wiederholen",
|
|
||||||
"wb.menu.editCut": "Ausschneiden",
|
|
||||||
"wb.menu.editCopy": "Kopieren",
|
|
||||||
"wb.menu.editPaste": "Einsetzen",
|
|
||||||
"wb.menu.editSelectAll": "Alles auswählen",
|
|
||||||
"wb.menu.editFind": "Suchen …",
|
|
||||||
"wb.menu.editFindNext": "Weitersuchen",
|
|
||||||
"wb.menu.editFindPrevious": "Rückwärts suchen",
|
|
||||||
"wb.menu.viewZoomIn": "Vergrößern",
|
|
||||||
"wb.menu.viewZoomOut": "Verkleinern",
|
|
||||||
"wb.menu.viewActual": "Tatsächliche Größe",
|
|
||||||
"wb.menu.viewIconPack": "Symbolpaket",
|
|
||||||
"wb.menu.viewDeck": "Deck",
|
|
||||||
"wb.menu.viewFullScreen": "Vollbildmodus aktivieren",
|
|
||||||
"wb.menu.acctNone": "Noch keine Accounts",
|
|
||||||
"wb.menu.acctAdd": "Account hinzufügen …",
|
|
||||||
"wb.menu.plugStore": "Store …",
|
|
||||||
"wb.menu.plugFolder": "Plug-in-Ordner öffnen …",
|
|
||||||
"wb.menu.winMinimize": "Im Dock ablegen",
|
|
||||||
"wb.menu.winZoom": "Zoomen",
|
|
||||||
"wb.menu.winWorkspaces": "Arbeitsbereiche",
|
|
||||||
"wb.menu.helpDocs": "Dokumentation",
|
|
||||||
"wb.menu.helpReport": "Problem melden …",
|
|
||||||
"wb.store.category.icons": "Symbole",
|
|
||||||
"wb.appearance.doctorHints": "{count, plural, one {Der Theme-Doktor hat einen Hinweis:} other {Der Theme-Doktor hat # Hinweise, der erste:}} {hint}",
|
|
||||||
"wb.install.eyebrow.icons.install": "Symbolpaket installieren",
|
|
||||||
"wb.install.eyebrow.icons.update": "Symbolpaket aktualisieren",
|
|
||||||
"wb.install.eyebrow.icons.reinstall": "Symbolpaket neu installieren",
|
|
||||||
"wb.install.err.icons": "Dieses Symbolpaket kann nicht installiert werden",
|
|
||||||
"wb.install.err.iconsNone": "{site} kann hier keine Symbolpakete installieren.",
|
|
||||||
"wb.install.err.iconsLarge": "Symbolpakete sind auf 120 KB begrenzt.",
|
|
||||||
"wb.install.err.iconsNotInstalled": "Das Symbolpaket wurde nicht installiert",
|
|
||||||
"wb.install.err.opened": "Diese Datei kann nicht installiert werden",
|
|
||||||
"wb.install.icons.dataOnly": "Nur Daten: Zeichnungen als Pfaddaten und kleine Bilder. Kein Code und keine Stile; nichts darin wird ausgeführt.",
|
|
||||||
"wb.install.icons.license": "Lizenz",
|
|
||||||
"wb.install.icons.source": "Zeichnungen von",
|
|
||||||
"wb.install.icons.count": "Symbole",
|
|
||||||
"wb.install.icons.countValue": "{count, plural, one {# Symbol} other {# Symbole}}",
|
|
||||||
"wb.install.icons.file": "Die Paketdatei",
|
|
||||||
"wb.install.done.iconsOn": "Es ist jetzt dein Symbolpaket. Wechsle jederzeit unter Darstellung zurück.",
|
|
||||||
"wb.install.done.iconsOff": "Es befindet sich in deinen Symbolpaketen unter Darstellung.",
|
|
||||||
"wb.store.icons": "Symbole",
|
|
||||||
"wb.store.iconsItem": "Symbolpaket",
|
|
||||||
"wb.store.builtinTab": "Integriert",
|
|
||||||
"wb.store.builtinItem": "Integriert",
|
|
||||||
"wb.store.areaSwitch": "{name} ein- oder ausschalten",
|
|
||||||
"wb.store.areaOn": "An",
|
|
||||||
"wb.store.areaOff": "Aus"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -998,7 +998,7 @@
|
||||||
"wb.settings.media.folderRemoved": "Ο φάκελος αφαιρέθηκε.",
|
"wb.settings.media.folderRemoved": "Ο φάκελος αφαιρέθηκε.",
|
||||||
"wb.settings.media.folders": "Φάκελοι συλλογής",
|
"wb.settings.media.folders": "Φάκελοι συλλογής",
|
||||||
"wb.settings.media.foldersHint": "Οι πιο πρόσφατες εικόνες από αυτούς τους φακέλους. Διαβάζονται μόνο τα αρχεία που βρίσκονται απευθείας μέσα σε αυτούς.",
|
"wb.settings.media.foldersHint": "Οι πιο πρόσφατες εικόνες από αυτούς τους φακέλους. Διαβάζονται μόνο τα αρχεία που βρίσκονται απευθείας μέσα σε αυτούς.",
|
||||||
"wb.settings.media.hint": "Το πλαίσιο Πολυμέσων ({shortcut}) δίπλα στο {site}.",
|
"wb.settings.media.hint": "Το πλαίσιο Πολυμέσων (Ctrl+Shift+G) δίπλα στο {site}.",
|
||||||
"wb.settings.media.keep": "Στοιχεία προς διατήρηση",
|
"wb.settings.media.keep": "Στοιχεία προς διατήρηση",
|
||||||
"wb.settings.media.keepHint": "Τα παλαιότερα στοιχεία αφαιρούνται από το τέλος.",
|
"wb.settings.media.keepHint": "Τα παλαιότερα στοιχεία αφαιρούνται από το τέλος.",
|
||||||
"wb.settings.media.noFolders": "Δεν υπάρχουν φάκελοι ακόμη. Προσθέστε έναν για να δείτε τις εικόνες του στο πλαίσιο Πολυμέσων.",
|
"wb.settings.media.noFolders": "Δεν υπάρχουν φάκελοι ακόμη. Προσθέστε έναν για να δείτε τις εικόνες του στο πλαίσιο Πολυμέσων.",
|
||||||
|
|
@ -1275,113 +1275,6 @@
|
||||||
"wb.setup.err.size": "Είναι πολύ μεγάλο για να είναι ρυθμίσεις.",
|
"wb.setup.err.size": "Είναι πολύ μεγάλο για να είναι ρυθμίσεις.",
|
||||||
"wb.strings.translate": "Λειτουργία μετάφρασης",
|
"wb.strings.translate": "Λειτουργία μετάφρασης",
|
||||||
"wb.strings.translateHint": "Κάθε καρτέλα {site} δείχνει μια γραμμή: κάντε κλικ σε μια λέξη για να την αλλάξετε. Οι αλλαγές σας ισχύουν σε εκείνη την καρτέλα μετά από επαναφόρτωση, και το «Αντιγραφή αρχείου πακέτου» σάς δίνει ένα πακέτο για κοινοποίηση. Όσο είναι ενεργή, οι λέξεις φέρουν αόρατους δείκτες.",
|
"wb.strings.translateHint": "Κάθε καρτέλα {site} δείχνει μια γραμμή: κάντε κλικ σε μια λέξη για να την αλλάξετε. Οι αλλαγές σας ισχύουν σε εκείνη την καρτέλα μετά από επαναφόρτωση, και το «Αντιγραφή αρχείου πακέτου» σάς δίνει ένα πακέτο για κοινοποίηση. Όσο είναι ενεργή, οι λέξεις φέρουν αόρατους δείκτες.",
|
||||||
"wb.menu.strings": "Γλώσσες",
|
"wb.menu.strings": "Γλώσσες"
|
||||||
"wb.menu.barFile": "Αρχείο",
|
|
||||||
"wb.menu.barEdit": "Επεξεργασία",
|
|
||||||
"wb.menu.barView": "Προβολή",
|
|
||||||
"wb.menu.barAccount": "Λογαριασμός",
|
|
||||||
"wb.menu.barPlugins": "Πρόσθετα",
|
|
||||||
"wb.menu.barWindow": "Παράθυρο",
|
|
||||||
"wb.menu.barHelp": "Βοήθεια",
|
|
||||||
"wb.menu.appHide": "Απόκρυψη του {product}",
|
|
||||||
"wb.menu.appHideOthers": "Απόκρυψη των υπολοίπων",
|
|
||||||
"wb.menu.appShowAll": "Εμφάνιση όλων",
|
|
||||||
"wb.menu.appQuit": "Έξοδος από το {product}",
|
|
||||||
"wb.menu.appServices": "Υπηρεσίες",
|
|
||||||
"wb.menu.appUpdates": "Έλεγχος για ενημερώσεις…",
|
|
||||||
"wb.menu.appSettings": "Ρυθμίσεις…",
|
|
||||||
"wb.menu.appSafe": "Ασφαλής λειτουργία",
|
|
||||||
"wb.menu.fileClose": "Κλείσιμο καρτέλας",
|
|
||||||
"wb.menu.fileInstall": "Εγκατάσταση από αρχείο…",
|
|
||||||
"wb.menu.fileShare": "Κοινή χρήση των ρυθμίσεών μου…",
|
|
||||||
"wb.menu.editUndo": "Αναίρεση",
|
|
||||||
"wb.menu.editRedo": "Επανάληψη",
|
|
||||||
"wb.menu.editCut": "Αποκοπή",
|
|
||||||
"wb.menu.editCopy": "Αντιγραφή",
|
|
||||||
"wb.menu.editPaste": "Επικόλληση",
|
|
||||||
"wb.menu.editSelectAll": "Επιλογή όλων",
|
|
||||||
"wb.menu.editFind": "Εύρεση…",
|
|
||||||
"wb.menu.editFindNext": "Εύρεση επόμενου",
|
|
||||||
"wb.menu.editFindPrevious": "Εύρεση προηγούμενου",
|
|
||||||
"wb.menu.viewZoomIn": "Μεγέθυνση",
|
|
||||||
"wb.menu.viewZoomOut": "Σμίκρυνση",
|
|
||||||
"wb.menu.viewActual": "Πραγματικό μέγεθος",
|
|
||||||
"wb.menu.viewIconPack": "Πακέτο εικονιδίων",
|
|
||||||
"wb.menu.viewDeck": "Deck",
|
|
||||||
"wb.menu.viewFullScreen": "Είσοδος σε πλήρη οθόνη",
|
|
||||||
"wb.menu.acctNone": "Δεν υπάρχουν λογαριασμοί ακόμα",
|
|
||||||
"wb.menu.acctAdd": "Προσθήκη λογαριασμού…",
|
|
||||||
"wb.menu.plugStore": "Κατάστημα…",
|
|
||||||
"wb.menu.plugFolder": "Άνοιγμα φακέλου προσθέτων…",
|
|
||||||
"wb.menu.winMinimize": "Ελαχιστοποίηση",
|
|
||||||
"wb.menu.winZoom": "Ζουμ",
|
|
||||||
"wb.menu.winWorkspaces": "Χώροι εργασίας",
|
|
||||||
"wb.menu.helpDocs": "Τεκμηρίωση",
|
|
||||||
"wb.menu.helpReport": "Αναφορά προβλήματος…",
|
|
||||||
"wb.store.category.icons": "Εικονίδια",
|
|
||||||
"wb.appearance.doctorHints": "{count, plural, one {Ο γιατρός θεμάτων έχει μια υπόδειξη:} other {Ο γιατρός θεμάτων έχει # υποδείξεις, η πρώτη:}} {hint}",
|
|
||||||
"wb.doctor.title": "Γιατρός θεμάτων",
|
|
||||||
"wb.doctor.hint": "Συμβουλές για αυτό το θέμα: ελαφρύτεροι τρόποι για το ίδιο αποτέλεσμα, κόστος και αντίθεση. Απλώς συμβουλεύει· τίποτα δεν μπλοκάρεται ή αλλάζει.",
|
|
||||||
"wb.doctor.empty": "Δεν υπάρχει τίποτα να αναφερθεί: το θέμα χρησιμοποιεί tokens και ρυθμίσεις στοιχείων και τίποτα σε αυτό δεν είναι δαπανηρό.",
|
|
||||||
"wb.doctor.count": "{count, plural, one {# εύρημα} other {# ευρήματα}}",
|
|
||||||
"wb.doctor.kind.lighter": "Ελαφρύτερος τρόπος",
|
|
||||||
"wb.doctor.kind.performance": "Απόδοση",
|
|
||||||
"wb.doctor.kind.accessibility": "Προσβασιμότητα",
|
|
||||||
"wb.doctor.kind.contrast": "Αντίθεση",
|
|
||||||
"wb.doctor.where": "Πού",
|
|
||||||
"wb.doctor.fix": "Διόρθωση",
|
|
||||||
"wb.doctor.css-radius.found": "Αυτός ο κανόνας ορίζει ακτίνες γωνιών στο CSS.",
|
|
||||||
"wb.doctor.css-radius.fix": "Ορίστε τες με το radius ενός τμήματος κάτω από το components, ή με το shape.radius για όλα: χωρίς CSS, και συνεχίζει να λειτουργεί όταν ο ιστότοπος μετονομάσει τις κλάσεις του.",
|
|
||||||
"wb.doctor.css-bevel.found": "Αυτός ο κανόνας σχεδιάζει λοξοτμημένη ακμή με στοιβαγμένες εσωτερικές σκιές.",
|
|
||||||
"wb.doctor.css-bevel.fix": "Χρησιμοποιήστε borderStyle \"bevel-out\" ή \"bevel-in\" σε ένα τμήμα κάτω από το components: σχεδιάζει την ακμή από τα χρώματα του θέματος.",
|
|
||||||
"wb.doctor.css-hide.found": "Αυτός ο κανόνας κρύβει κάτι με display: none.",
|
|
||||||
"wb.doctor.css-hide.fix": "Χρησιμοποιήστε visible σε ένα τμήμα κάτω από το components (avatars, μετρητές, ονόματα) ή μια παραλλαγή διάταξης όπως sidebar: hidden· έτσι ο ιδιοκτήτης μπορεί να το ενεργοποιήσει ξανά.",
|
|
||||||
"wb.doctor.css-color.found": "Αυτός ο κανόνας χρησιμοποιεί κυριολεκτικό χρώμα.",
|
|
||||||
"wb.doctor.css-color.fix": "Ονομάστε έναν ρόλο (text, muted, accent, surface…) στο colors ή σε ένα στοιχείο, ώστε να τον καλύπτει ο έλεγχος αντίθεσης.",
|
|
||||||
"wb.doctor.css-font.found": "Αυτός ο κανόνας ορίζει οικογένεια γραμματοσειράς.",
|
|
||||||
"wb.doctor.css-font.fix": "Χρησιμοποιήστε το font.roles: ορίζει τις γραμματοσειρές για αναρτήσεις, επικεφαλίδες, αριθμούς και monospace χωρίς CSS.",
|
|
||||||
"wb.doctor.css-has.found": "Αυτός ο κανόνας χρησιμοποιεί :has(), το οποίο αξιολογείται ξανά σε κάθε αλλαγή της σελίδας.",
|
|
||||||
"wb.doctor.css-has.fix": "Αποφύγετε το :has() σε κανόνες που επαναλαμβάνονται σε όλο το χρονολόγιο, ή αγκυρώστε τον κανόνα σε ένα τμήμα.",
|
|
||||||
"wb.doctor.css-universal.found": "Αυτός ο κανόνας χρησιμοποιεί καθολικό επιλογέα (*), που ελέγχεται σε κάθε στοιχείο.",
|
|
||||||
"wb.doctor.css-universal.fix": "Αγκυρώστε αντί γι' αυτό τον κανόνα σε ένα τμήμα.",
|
|
||||||
"wb.doctor.css-blur.found": "Αυτός ο κανόνας θολώνει ό,τι βρίσκεται πίσω του (backdrop-filter), κάτι δαπανηρό σε τμήματα που επαναλαμβάνονται.",
|
|
||||||
"wb.doctor.css-blur.fix": "Χρησιμοποιήστε το γέμισμα glass σε γραμμές και πάνελ: είναι το φθηνότερο σημείο για θόλωμα.",
|
|
||||||
"wb.doctor.css-outline-none.found": "Αυτός ο κανόνας αφαιρεί το περίγραμμα εστίασης, οπότε η εστίαση πληκτρολογίου δεν φαίνεται πια.",
|
|
||||||
"wb.doctor.css-outline-none.fix": "Χρησιμοποιήστε το decor.focusRing για να σχεδιάσετε ορατό δακτύλιο εστίασης.",
|
|
||||||
"wb.doctor.css-motion.found": "Αυτός ο κανόνας κάνει κινούμενα σχέδια χωρίς να ελέγχει για μειωμένη κίνηση.",
|
|
||||||
"wb.doctor.css-motion.fix": "Κρατήστε την κίνηση μέσα στο @media (prefers-reduced-motion: no-preference), ή αφήστε το decor.motion να το κάνει για εσάς.",
|
|
||||||
"wb.doctor.css-size.found": "Το CSS έχει πάνω από 20.000 χαρακτήρες.",
|
|
||||||
"wb.doctor.css-size.fix": "Ο ιστότοπος υπολογίζει ξανά τα στυλ με κάθε κανόνα· τα tokens και οι ρυθμίσεις στοιχείων μεταγλωττίζονται σε λιγότερους κανόνες.",
|
|
||||||
"wb.doctor.contrast.found": "Το χρώμα {token} προσαρμόστηκε ώστε να παραμένει ευανάγνωστο ({ratio}:1 στο φόντο).",
|
|
||||||
"wb.doctor.contrast.fix": "Επιλέξτε πιο ανοιχτό ή πιο σκούρο χρώμα {token}· μέχρι τότε το θέμα εμφανίζεται με το προσαρμοσμένο.",
|
|
||||||
"wb.doctor.glass-post.found": "Το glass έχει οριστεί στις αναρτήσεις, αλλά δεν σχεδιάζεται: το θόλωμα σε κάθε ανάρτηση ενός χρονολογίου είναι υπερβολικά δαπανηρό.",
|
|
||||||
"wb.doctor.glass-post.fix": "Χρησιμοποιήστε συμπαγές ή χρωματισμένο γέμισμα για τις αναρτήσεις και κρατήστε το glass για γραμμές και πάνελ.",
|
|
||||||
"wb.doctor.small-post-text.found": "Το κείμενο των αναρτήσεων είναι {size}px, κάτι δυσανάγνωστο για πολλούς ανθρώπους.",
|
|
||||||
"wb.doctor.small-post-text.fix": "Χρησιμοποιήστε 14px ή περισσότερα για το μέγεθος κειμένου των αναρτήσεων, ή αυξήστε το μέγεθος κειμένου ολόκληρου του θέματος.",
|
|
||||||
"wb.doctor.nav-moved.found": "Η πλοήγηση έχει μετακινηθεί στη θέση {position}, κάτι που αλλάζει το πού την αναζητούν οι χρήστες.",
|
|
||||||
"wb.doctor.nav-moved.fix": "Ισχύει μόνο σε πλατιά πάνελ και ο ιδιοκτήτης μπορεί να απενεργοποιήσει τις αλλαγές διάταξης. Κρατήστε την προεπιλεγμένη θέση εκτός αν το απαιτεί η διάταξη.",
|
|
||||||
"wb.install.eyebrow.icons.install": "Εγκατάσταση πακέτου εικονιδίων",
|
|
||||||
"wb.install.eyebrow.icons.update": "Ενημέρωση πακέτου εικονιδίων",
|
|
||||||
"wb.install.eyebrow.icons.reinstall": "Επανεγκατάσταση πακέτου εικονιδίων",
|
|
||||||
"wb.install.err.icons": "Αυτό το πακέτο εικονιδίων δεν μπορεί να εγκατασταθεί",
|
|
||||||
"wb.install.err.iconsNone": "Το {site} δεν μπορεί να εγκαταστήσει πακέτα εικονιδίων εδώ.",
|
|
||||||
"wb.install.err.iconsLarge": "Τα πακέτα εικονιδίων περιορίζονται στα 120 KB.",
|
|
||||||
"wb.install.err.iconsNotInstalled": "Το πακέτο εικονιδίων δεν εγκαταστάθηκε",
|
|
||||||
"wb.install.err.opened": "Αυτό το αρχείο δεν μπορεί να εγκατασταθεί",
|
|
||||||
"wb.install.icons.dataOnly": "Μόνο δεδομένα: σχέδια ως δεδομένα διαδρομών και μικρές εικόνες. Χωρίς κώδικα και χωρίς στυλ· τίποτα σε αυτό δεν εκτελείται.",
|
|
||||||
"wb.install.icons.license": "Άδεια",
|
|
||||||
"wb.install.icons.source": "Σχέδια από",
|
|
||||||
"wb.install.icons.count": "Εικονίδια",
|
|
||||||
"wb.install.icons.countValue": "{count, plural, one {# εικονίδιο} other {# εικονίδια}}",
|
|
||||||
"wb.install.icons.file": "Το αρχείο του πακέτου",
|
|
||||||
"wb.install.done.iconsOn": "Είναι πλέον το πακέτο εικονιδίων σας. Επιστρέψτε οποιαδήποτε στιγμή στην Εμφάνιση.",
|
|
||||||
"wb.install.done.iconsOff": "Βρίσκεται στα πακέτα εικονιδίων σας στην Εμφάνιση.",
|
|
||||||
"wb.store.icons": "Εικονίδια",
|
|
||||||
"wb.store.iconsItem": "Πακέτο εικονιδίων",
|
|
||||||
"wb.store.builtinTab": "Ενσωματωμένα",
|
|
||||||
"wb.store.builtinItem": "Ενσωματωμένο",
|
|
||||||
"wb.store.areaSwitch": "Ενεργοποίηση ή απενεργοποίηση του {name}",
|
|
||||||
"wb.store.areaOn": "Ενεργό",
|
|
||||||
"wb.store.areaOff": "Ανενεργό"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,6 @@
|
||||||
"wb.store.category.tools": "Tools",
|
"wb.store.category.tools": "Tools",
|
||||||
"wb.store.category.dark": "Dark",
|
"wb.store.category.dark": "Dark",
|
||||||
"wb.store.category.light": "Light",
|
"wb.store.category.light": "Light",
|
||||||
"wb.store.category.icons": "Icons",
|
|
||||||
"wb.store.builtIn": "Built in",
|
"wb.store.builtIn": "Built in",
|
||||||
"wb.store.use": "Use",
|
"wb.store.use": "Use",
|
||||||
"wb.store.install": "Install",
|
"wb.store.install": "Install",
|
||||||
|
|
@ -420,46 +419,6 @@
|
||||||
"wb.appearance.icons.removed": "Removed the icon pack “{name}”.",
|
"wb.appearance.icons.removed": "Removed the icon pack “{name}”.",
|
||||||
"wb.appearance.icons.imported": "Imported icon packs",
|
"wb.appearance.icons.imported": "Imported icon packs",
|
||||||
"wb.appearance.doctorHints": "{count, plural, one {The theme doctor has a hint:} other {The theme doctor has # hints, the first:}} {hint}",
|
"wb.appearance.doctorHints": "{count, plural, one {The theme doctor has a hint:} other {The theme doctor has # hints, the first:}} {hint}",
|
||||||
"wb.doctor.title": "Theme doctor",
|
|
||||||
"wb.doctor.hint": "Advice about this theme: lighter ways to do the same, costs and contrast. It only advises; nothing is blocked or changed.",
|
|
||||||
"wb.doctor.empty": "Nothing to report: the theme uses tokens and component settings, and nothing in it is costly.",
|
|
||||||
"wb.doctor.count": "{count, plural, one {# finding} other {# findings}}",
|
|
||||||
"wb.doctor.kind.lighter": "A lighter way",
|
|
||||||
"wb.doctor.kind.performance": "Performance",
|
|
||||||
"wb.doctor.kind.accessibility": "Accessibility",
|
|
||||||
"wb.doctor.kind.contrast": "Contrast",
|
|
||||||
"wb.doctor.where": "Where",
|
|
||||||
"wb.doctor.fix": "Fix",
|
|
||||||
"wb.doctor.css-radius.found": "This rule sets corner radii in CSS.",
|
|
||||||
"wb.doctor.css-radius.fix": "Set them with the radius of a part under components, or shape.radius for all of them: no CSS needed, and it keeps working when the site renames its classes.",
|
|
||||||
"wb.doctor.css-bevel.found": "This rule draws a bevelled edge with stacked inset shadows.",
|
|
||||||
"wb.doctor.css-bevel.fix": "Use borderStyle \"bevel-out\" or \"bevel-in\" on a part under components: it draws the bevel from the theme’s colors.",
|
|
||||||
"wb.doctor.css-hide.found": "This rule hides something with display: none.",
|
|
||||||
"wb.doctor.css-hide.fix": "Use visible on a part under components (avatars, counts, names) or a layout variant such as sidebar: hidden; the owner can then switch it back.",
|
|
||||||
"wb.doctor.css-color.found": "This rule uses a literal color.",
|
|
||||||
"wb.doctor.css-color.fix": "Name a role (text, muted, accent, surface…) in colors or in a component, so the contrast pass covers it.",
|
|
||||||
"wb.doctor.css-font.found": "This rule sets a font family.",
|
|
||||||
"wb.doctor.css-font.fix": "Use font.roles: it sets the post, heading, numbers and mono faces without CSS.",
|
|
||||||
"wb.doctor.css-has.found": "This rule uses :has(), which is matched again on every change of the page.",
|
|
||||||
"wb.doctor.css-has.fix": "Keep :has() off rules that repeat down a timeline, or anchor the rule on a part.",
|
|
||||||
"wb.doctor.css-universal.found": "This rule uses a universal selector (*), matched against every element.",
|
|
||||||
"wb.doctor.css-universal.fix": "Anchor the rule on a part instead.",
|
|
||||||
"wb.doctor.css-blur.found": "This rule blurs what is behind it (backdrop-filter), which is costly on parts that repeat.",
|
|
||||||
"wb.doctor.css-blur.fix": "Use the glass fill of bars and panels: it is the cheaper place for blur.",
|
|
||||||
"wb.doctor.css-outline-none.found": "This rule removes the focus outline, so keyboard focus is no longer visible.",
|
|
||||||
"wb.doctor.css-outline-none.fix": "Use decor.focusRing to draw a visible focus ring instead.",
|
|
||||||
"wb.doctor.css-motion.found": "This rule animates without checking for reduced motion.",
|
|
||||||
"wb.doctor.css-motion.fix": "Keep motion inside @media (prefers-reduced-motion: no-preference), or let decor.motion do it for you.",
|
|
||||||
"wb.doctor.css-size.found": "The CSS is more than 20,000 characters long.",
|
|
||||||
"wb.doctor.css-size.fix": "The site recalculates styles with every rule; tokens and component settings compile to fewer rules.",
|
|
||||||
"wb.doctor.contrast.found": "The {token} color was adjusted to stay readable ({ratio}:1 on the background).",
|
|
||||||
"wb.doctor.contrast.fix": "Pick a lighter or darker {token} color; until then the theme is shown with the adjusted one.",
|
|
||||||
"wb.doctor.glass-post.found": "Glass is set on posts, but it is not drawn: blur on every post of a timeline is too costly.",
|
|
||||||
"wb.doctor.glass-post.fix": "Use a solid or tinted fill for posts and keep glass for bars and panels.",
|
|
||||||
"wb.doctor.small-post-text.found": "Post text is {size}px, which is hard to read for many people.",
|
|
||||||
"wb.doctor.small-post-text.fix": "Use 14px or more for the post text size, or raise the text size of the whole theme.",
|
|
||||||
"wb.doctor.nav-moved.found": "The navigation is moved to the {position}, which changes where people look for it.",
|
|
||||||
"wb.doctor.nav-moved.fix": "It only applies on wide panes, and the owner can turn layout changes off. Keep the default position unless the layout needs it.",
|
|
||||||
"wb.appearance.icons.site": "The site's own icons",
|
"wb.appearance.icons.site": "The site's own icons",
|
||||||
"wb.appearance.accountTheme": "Account theme · {name}",
|
"wb.appearance.accountTheme": "Account theme · {name}",
|
||||||
"wb.appearance.accountsHint": "Every pane of an account shows its theme unless the pane has its own.",
|
"wb.appearance.accountsHint": "Every pane of an account shows its theme unless the pane has its own.",
|
||||||
|
|
@ -1064,7 +1023,7 @@
|
||||||
"wb.settings.media.folderRemoved": "Folder removed.",
|
"wb.settings.media.folderRemoved": "Folder removed.",
|
||||||
"wb.settings.media.folders": "Gallery folders",
|
"wb.settings.media.folders": "Gallery folders",
|
||||||
"wb.settings.media.foldersHint": "The newest images from these folders. Only files directly inside them are read.",
|
"wb.settings.media.foldersHint": "The newest images from these folders. Only files directly inside them are read.",
|
||||||
"wb.settings.media.hint": "The Media panel ({shortcut}) beside {site}.",
|
"wb.settings.media.hint": "The Media panel (Ctrl+Shift+G) beside {site}.",
|
||||||
"wb.settings.media.keep": "Items to keep",
|
"wb.settings.media.keep": "Items to keep",
|
||||||
"wb.settings.media.keepHint": "Older items drop off the end.",
|
"wb.settings.media.keepHint": "Older items drop off the end.",
|
||||||
"wb.settings.media.noFolders": "No folders yet. Add one to see its images in the Media panel.",
|
"wb.settings.media.noFolders": "No folders yet. Add one to see its images in the Media panel.",
|
||||||
|
|
@ -1294,29 +1253,6 @@
|
||||||
"wb.install.openStrings": "Open Languages",
|
"wb.install.openStrings": "Open Languages",
|
||||||
"wb.store.strings": "Languages",
|
"wb.store.strings": "Languages",
|
||||||
"wb.store.stringsItem": "String pack",
|
"wb.store.stringsItem": "String pack",
|
||||||
"wb.install.eyebrow.icons.install": "Install icon pack",
|
|
||||||
"wb.install.eyebrow.icons.update": "Update icon pack",
|
|
||||||
"wb.install.eyebrow.icons.reinstall": "Reinstall icon pack",
|
|
||||||
"wb.install.err.icons": "This icon pack cannot be installed",
|
|
||||||
"wb.install.err.iconsNone": "{site} cannot install icon packs here.",
|
|
||||||
"wb.install.err.iconsLarge": "Icon packs are limited to 120 KB.",
|
|
||||||
"wb.install.err.iconsNotInstalled": "The icon pack was not installed",
|
|
||||||
"wb.install.err.opened": "This file cannot be installed",
|
|
||||||
"wb.install.icons.dataOnly": "Data only: drawings as path data and small pictures. No code and no styles; nothing in it runs.",
|
|
||||||
"wb.install.icons.license": "License",
|
|
||||||
"wb.install.icons.source": "Drawings from",
|
|
||||||
"wb.install.icons.count": "Icons",
|
|
||||||
"wb.install.icons.countValue": "{count, plural, one {# icon} other {# icons}}",
|
|
||||||
"wb.install.icons.file": "The pack file",
|
|
||||||
"wb.install.done.iconsOn": "It is your icon pack now. Switch back any time in Appearance.",
|
|
||||||
"wb.install.done.iconsOff": "It is in your icon packs in Appearance.",
|
|
||||||
"wb.store.icons": "Icons",
|
|
||||||
"wb.store.iconsItem": "Icon pack",
|
|
||||||
"wb.store.builtinTab": "Built in",
|
|
||||||
"wb.store.builtinItem": "Built in",
|
|
||||||
"wb.store.areaSwitch": "Turn {name} on or off",
|
|
||||||
"wb.store.areaOn": "On",
|
|
||||||
"wb.store.areaOff": "Off",
|
|
||||||
"wb.strings.section": "Languages",
|
"wb.strings.section": "Languages",
|
||||||
"wb.strings.title": "String packs",
|
"wb.strings.title": "String packs",
|
||||||
"wb.strings.intro": "A string pack replaces {site}’s own words with text: a language {site} does not offer, a better translation, or your own wording. Packs apply in this order; a later one wins where two change the same word. Words no pack changes stay exactly as {site} shows them.",
|
"wb.strings.intro": "A string pack replaces {site}’s own words with text: a language {site} does not offer, a better translation, or your own wording. Packs apply in this order; a later one wins where two change the same word. Words no pack changes stay exactly as {site} shows them.",
|
||||||
|
|
@ -1339,48 +1275,6 @@
|
||||||
"wb.install.err.stringsNotInstalled": "The string pack was not installed",
|
"wb.install.err.stringsNotInstalled": "The string pack was not installed",
|
||||||
"wb.strings.translate": "Translate mode",
|
"wb.strings.translate": "Translate mode",
|
||||||
"wb.strings.translateHint": "Every {site} tab shows a bar: click a word to change it. Your edits apply in that tab after a reload, and “Copy pack file” gives you a pack to share. While it is on, words carry invisible markers.",
|
"wb.strings.translateHint": "Every {site} tab shows a bar: click a word to change it. Your edits apply in that tab after a reload, and “Copy pack file” gives you a pack to share. While it is on, words carry invisible markers.",
|
||||||
"wb.menu.strings": "Languages",
|
"wb.menu.strings": "Languages"
|
||||||
"wb.menu.barFile": "File",
|
|
||||||
"wb.menu.barEdit": "Edit",
|
|
||||||
"wb.menu.barView": "View",
|
|
||||||
"wb.menu.barAccount": "Account",
|
|
||||||
"wb.menu.barPlugins": "Plugins",
|
|
||||||
"wb.menu.barWindow": "Window",
|
|
||||||
"wb.menu.barHelp": "Help",
|
|
||||||
"wb.menu.appHide": "Hide {product}",
|
|
||||||
"wb.menu.appHideOthers": "Hide Others",
|
|
||||||
"wb.menu.appShowAll": "Show All",
|
|
||||||
"wb.menu.appQuit": "Quit {product}",
|
|
||||||
"wb.menu.appServices": "Services",
|
|
||||||
"wb.menu.appUpdates": "Check for Updates…",
|
|
||||||
"wb.menu.appSettings": "Settings…",
|
|
||||||
"wb.menu.appSafe": "Safe Mode",
|
|
||||||
"wb.menu.fileClose": "Close Tab",
|
|
||||||
"wb.menu.fileInstall": "Install from File…",
|
|
||||||
"wb.menu.fileShare": "Share My Setup…",
|
|
||||||
"wb.menu.editUndo": "Undo",
|
|
||||||
"wb.menu.editRedo": "Redo",
|
|
||||||
"wb.menu.editCut": "Cut",
|
|
||||||
"wb.menu.editCopy": "Copy",
|
|
||||||
"wb.menu.editPaste": "Paste",
|
|
||||||
"wb.menu.editSelectAll": "Select All",
|
|
||||||
"wb.menu.editFind": "Find…",
|
|
||||||
"wb.menu.editFindNext": "Find Next",
|
|
||||||
"wb.menu.editFindPrevious": "Find Previous",
|
|
||||||
"wb.menu.viewZoomIn": "Zoom In",
|
|
||||||
"wb.menu.viewZoomOut": "Zoom Out",
|
|
||||||
"wb.menu.viewActual": "Actual Size",
|
|
||||||
"wb.menu.viewIconPack": "Icon Pack",
|
|
||||||
"wb.menu.viewDeck": "Deck",
|
|
||||||
"wb.menu.viewFullScreen": "Enter Full Screen",
|
|
||||||
"wb.menu.acctNone": "No accounts yet",
|
|
||||||
"wb.menu.acctAdd": "Add Account…",
|
|
||||||
"wb.menu.plugStore": "Store…",
|
|
||||||
"wb.menu.plugFolder": "Open Plugins Folder…",
|
|
||||||
"wb.menu.winMinimize": "Minimize",
|
|
||||||
"wb.menu.winZoom": "Zoom",
|
|
||||||
"wb.menu.winWorkspaces": "Workspaces",
|
|
||||||
"wb.menu.helpDocs": "Docs",
|
|
||||||
"wb.menu.helpReport": "Report a Problem…"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -998,7 +998,7 @@
|
||||||
"wb.settings.media.folderRemoved": "Carpeta quitada.",
|
"wb.settings.media.folderRemoved": "Carpeta quitada.",
|
||||||
"wb.settings.media.folders": "Carpetas de la galería",
|
"wb.settings.media.folders": "Carpetas de la galería",
|
||||||
"wb.settings.media.foldersHint": "Las imágenes más recientes de estas carpetas. Solo se leen los archivos que están directamente dentro.",
|
"wb.settings.media.foldersHint": "Las imágenes más recientes de estas carpetas. Solo se leen los archivos que están directamente dentro.",
|
||||||
"wb.settings.media.hint": "El panel Multimedia ({shortcut}) junto a {site}.",
|
"wb.settings.media.hint": "El panel Multimedia (Ctrl+Shift+G) junto a {site}.",
|
||||||
"wb.settings.media.keep": "Elementos a conservar",
|
"wb.settings.media.keep": "Elementos a conservar",
|
||||||
"wb.settings.media.keepHint": "Los elementos más antiguos se descartan al final.",
|
"wb.settings.media.keepHint": "Los elementos más antiguos se descartan al final.",
|
||||||
"wb.settings.media.noFolders": "Aún no hay carpetas. Añade una para ver sus imágenes en el panel Multimedia.",
|
"wb.settings.media.noFolders": "Aún no hay carpetas. Añade una para ver sus imágenes en el panel Multimedia.",
|
||||||
|
|
@ -1243,46 +1243,6 @@
|
||||||
"wb.appearance.icons.remove": "Quitar {name}",
|
"wb.appearance.icons.remove": "Quitar {name}",
|
||||||
"wb.appearance.icons.removed": "Paquete de iconos «{name}» quitado.",
|
"wb.appearance.icons.removed": "Paquete de iconos «{name}» quitado.",
|
||||||
"wb.appearance.icons.imported": "Paquetes de iconos importados",
|
"wb.appearance.icons.imported": "Paquetes de iconos importados",
|
||||||
"wb.doctor.title": "Doctor del tema",
|
|
||||||
"wb.doctor.hint": "Consejos sobre este tema: formas más ligeras de hacer lo mismo, costes y contraste. Solo aconseja; no bloquea ni cambia nada.",
|
|
||||||
"wb.doctor.empty": "Nada que informar: el tema usa tokens y ajustes de componentes, y nada en él es costoso.",
|
|
||||||
"wb.doctor.count": "{count, plural, one {# hallazgo} other {# hallazgos}}",
|
|
||||||
"wb.doctor.kind.lighter": "Una forma más ligera",
|
|
||||||
"wb.doctor.kind.performance": "Rendimiento",
|
|
||||||
"wb.doctor.kind.accessibility": "Accesibilidad",
|
|
||||||
"wb.doctor.kind.contrast": "Contraste",
|
|
||||||
"wb.doctor.where": "Dónde",
|
|
||||||
"wb.doctor.fix": "Solución",
|
|
||||||
"wb.doctor.css-radius.found": "Esta regla define radios de esquina en CSS.",
|
|
||||||
"wb.doctor.css-radius.fix": "Defínelos con el radius de una parte en components, o con shape.radius para todas: no hace falta CSS y sigue funcionando cuando el sitio cambia los nombres de sus clases.",
|
|
||||||
"wb.doctor.css-bevel.found": "Esta regla dibuja un borde biselado con sombras interiores apiladas.",
|
|
||||||
"wb.doctor.css-bevel.fix": "Usa borderStyle \"bevel-out\" o \"bevel-in\" en una parte de components: dibuja el bisel con los colores del tema.",
|
|
||||||
"wb.doctor.css-hide.found": "Esta regla oculta algo con display: none.",
|
|
||||||
"wb.doctor.css-hide.fix": "Usa visible en una parte de components (avatares, contadores, nombres) o una variante de diseño como sidebar: hidden; así el propietario puede volver a activarlo.",
|
|
||||||
"wb.doctor.css-color.found": "Esta regla usa un color literal.",
|
|
||||||
"wb.doctor.css-color.fix": "Indica un rol (text, muted, accent, surface…) en colors o en un componente, para que la revisión de contraste lo cubra.",
|
|
||||||
"wb.doctor.css-font.found": "Esta regla define una familia de fuentes.",
|
|
||||||
"wb.doctor.css-font.fix": "Usa font.roles: define las tipografías de publicaciones, títulos, números y monoespaciada sin CSS.",
|
|
||||||
"wb.doctor.css-has.found": "Esta regla usa :has(), que se vuelve a evaluar con cada cambio de la página.",
|
|
||||||
"wb.doctor.css-has.fix": "No uses :has() en reglas que se repiten a lo largo de una cronología, o ancla la regla a una parte.",
|
|
||||||
"wb.doctor.css-universal.found": "Esta regla usa un selector universal (*), que se compara con todos los elementos.",
|
|
||||||
"wb.doctor.css-universal.fix": "Ancla la regla a una parte en su lugar.",
|
|
||||||
"wb.doctor.css-blur.found": "Esta regla desenfoca lo que hay detrás (backdrop-filter), lo cual es costoso en partes que se repiten.",
|
|
||||||
"wb.doctor.css-blur.fix": "Usa el relleno de cristal de barras y paneles: es el lugar más económico para el desenfoque.",
|
|
||||||
"wb.doctor.css-outline-none.found": "Esta regla quita el contorno de enfoque, así que el foco del teclado deja de verse.",
|
|
||||||
"wb.doctor.css-outline-none.fix": "Usa decor.focusRing para dibujar un anillo de enfoque visible.",
|
|
||||||
"wb.doctor.css-motion.found": "Esta regla anima sin comprobar si se pidió reducir el movimiento.",
|
|
||||||
"wb.doctor.css-motion.fix": "Mantén el movimiento dentro de @media (prefers-reduced-motion: no-preference), o deja que decor.motion lo haga por ti.",
|
|
||||||
"wb.doctor.css-size.found": "El CSS tiene más de 20.000 caracteres.",
|
|
||||||
"wb.doctor.css-size.fix": "El sitio recalcula los estilos con cada regla; los tokens y los ajustes de componentes se compilan en menos reglas.",
|
|
||||||
"wb.doctor.contrast.found": "El color {token} se ajustó para que siga siendo legible ({ratio}:1 sobre el fondo).",
|
|
||||||
"wb.doctor.contrast.fix": "Elige un color {token} más claro u oscuro; hasta entonces el tema se muestra con el ajustado.",
|
|
||||||
"wb.doctor.glass-post.found": "Se definió cristal en las publicaciones, pero no se dibuja: el desenfoque en cada publicación de una cronología es demasiado costoso.",
|
|
||||||
"wb.doctor.glass-post.fix": "Usa un relleno sólido o teñido para las publicaciones y reserva el cristal para barras y paneles.",
|
|
||||||
"wb.doctor.small-post-text.found": "El texto de las publicaciones es de {size}px, difícil de leer para mucha gente.",
|
|
||||||
"wb.doctor.small-post-text.fix": "Usa 14px o más para el tamaño del texto de las publicaciones, o aumenta el tamaño del texto de todo el tema.",
|
|
||||||
"wb.doctor.nav-moved.found": "La navegación se movió a la posición {position}, lo que cambia dónde la busca la gente.",
|
|
||||||
"wb.doctor.nav-moved.fix": "Solo se aplica en paneles anchos, y el propietario puede desactivar los cambios de diseño. Mantén la posición predeterminada salvo que el diseño lo necesite.",
|
|
||||||
"wb.setup.title": "Compartir mi configuración",
|
"wb.setup.title": "Compartir mi configuración",
|
||||||
"wb.setup.hint": "Tu tema, tus iconos, tu modo y qué funciones están activas, en un enlace o un archivo pequeño. Cualquiera puede usarlo para empezar desde lo que tienes.",
|
"wb.setup.hint": "Tu tema, tus iconos, tu modo y qué funciones están activas, en un enlace o un archivo pequeño. Cualquiera puede usarlo para empezar desde lo que tienes.",
|
||||||
"wb.setup.shareLabel": "Tu configuración",
|
"wb.setup.shareLabel": "Tu configuración",
|
||||||
|
|
@ -1315,73 +1275,6 @@
|
||||||
"wb.setup.err.size": "Es demasiado grande para ser una configuración.",
|
"wb.setup.err.size": "Es demasiado grande para ser una configuración.",
|
||||||
"wb.strings.translate": "Modo traducción",
|
"wb.strings.translate": "Modo traducción",
|
||||||
"wb.strings.translateHint": "Cada pestaña de {site} muestra una barra: haz clic en una palabra para cambiarla. Tus cambios se aplican en esa pestaña tras recargar, y «Copiar archivo del paquete» te da un paquete para compartir. Mientras está activo, las palabras llevan marcas invisibles.",
|
"wb.strings.translateHint": "Cada pestaña de {site} muestra una barra: haz clic en una palabra para cambiarla. Tus cambios se aplican en esa pestaña tras recargar, y «Copiar archivo del paquete» te da un paquete para compartir. Mientras está activo, las palabras llevan marcas invisibles.",
|
||||||
"wb.menu.strings": "Idiomas",
|
"wb.menu.strings": "Idiomas"
|
||||||
"wb.menu.barFile": "Archivo",
|
|
||||||
"wb.menu.barEdit": "Edición",
|
|
||||||
"wb.menu.barView": "Visualización",
|
|
||||||
"wb.menu.barAccount": "Cuenta",
|
|
||||||
"wb.menu.barPlugins": "Complementos",
|
|
||||||
"wb.menu.barWindow": "Ventana",
|
|
||||||
"wb.menu.barHelp": "Ayuda",
|
|
||||||
"wb.menu.appHide": "Ocultar {product}",
|
|
||||||
"wb.menu.appHideOthers": "Ocultar otros",
|
|
||||||
"wb.menu.appShowAll": "Mostrar todo",
|
|
||||||
"wb.menu.appQuit": "Salir de {product}",
|
|
||||||
"wb.menu.appServices": "Servicios",
|
|
||||||
"wb.menu.appUpdates": "Buscar actualizaciones…",
|
|
||||||
"wb.menu.appSettings": "Ajustes…",
|
|
||||||
"wb.menu.appSafe": "Modo seguro",
|
|
||||||
"wb.menu.fileClose": "Cerrar pestaña",
|
|
||||||
"wb.menu.fileInstall": "Instalar desde archivo…",
|
|
||||||
"wb.menu.fileShare": "Compartir mi configuración…",
|
|
||||||
"wb.menu.editUndo": "Deshacer",
|
|
||||||
"wb.menu.editRedo": "Rehacer",
|
|
||||||
"wb.menu.editCut": "Cortar",
|
|
||||||
"wb.menu.editCopy": "Copiar",
|
|
||||||
"wb.menu.editPaste": "Pegar",
|
|
||||||
"wb.menu.editSelectAll": "Seleccionar todo",
|
|
||||||
"wb.menu.editFind": "Buscar…",
|
|
||||||
"wb.menu.editFindNext": "Buscar siguiente",
|
|
||||||
"wb.menu.editFindPrevious": "Buscar anterior",
|
|
||||||
"wb.menu.viewZoomIn": "Ampliar",
|
|
||||||
"wb.menu.viewZoomOut": "Reducir",
|
|
||||||
"wb.menu.viewActual": "Tamaño real",
|
|
||||||
"wb.menu.viewIconPack": "Paquete de iconos",
|
|
||||||
"wb.menu.viewDeck": "Deck",
|
|
||||||
"wb.menu.viewFullScreen": "Entrar en pantalla completa",
|
|
||||||
"wb.menu.acctNone": "Aún no hay cuentas",
|
|
||||||
"wb.menu.acctAdd": "Añadir cuenta…",
|
|
||||||
"wb.menu.plugStore": "Tienda…",
|
|
||||||
"wb.menu.plugFolder": "Abrir la carpeta de complementos…",
|
|
||||||
"wb.menu.winMinimize": "Minimizar",
|
|
||||||
"wb.menu.winZoom": "Zoom",
|
|
||||||
"wb.menu.winWorkspaces": "Espacios de trabajo",
|
|
||||||
"wb.menu.helpDocs": "Documentación",
|
|
||||||
"wb.menu.helpReport": "Informar de un problema…",
|
|
||||||
"wb.store.category.icons": "Iconos",
|
|
||||||
"wb.appearance.doctorHints": "{count, plural, one {El doctor de temas tiene una sugerencia:} many {El doctor de temas tiene # de sugerencias, la primera:} other {El doctor de temas tiene # sugerencias, la primera:}} {hint}",
|
|
||||||
"wb.install.eyebrow.icons.install": "Instalar paquete de iconos",
|
|
||||||
"wb.install.eyebrow.icons.update": "Actualizar paquete de iconos",
|
|
||||||
"wb.install.eyebrow.icons.reinstall": "Reinstalar paquete de iconos",
|
|
||||||
"wb.install.err.icons": "Este paquete de iconos no se puede instalar",
|
|
||||||
"wb.install.err.iconsNone": "{site} no puede instalar paquetes de iconos aquí.",
|
|
||||||
"wb.install.err.iconsLarge": "Los paquetes de iconos están limitados a 120 KB.",
|
|
||||||
"wb.install.err.iconsNotInstalled": "El paquete de iconos no se instaló",
|
|
||||||
"wb.install.err.opened": "Este archivo no se puede instalar",
|
|
||||||
"wb.install.icons.dataOnly": "Solo datos: dibujos como datos de trazado e imágenes pequeñas. Sin código ni estilos; nada de lo que contiene se ejecuta.",
|
|
||||||
"wb.install.icons.license": "Licencia",
|
|
||||||
"wb.install.icons.source": "Dibujos de",
|
|
||||||
"wb.install.icons.count": "Iconos",
|
|
||||||
"wb.install.icons.countValue": "{count, plural, one {# icono} many {# de iconos} other {# iconos}}",
|
|
||||||
"wb.install.icons.file": "El archivo del paquete",
|
|
||||||
"wb.install.done.iconsOn": "Ya es tu paquete de iconos. Vuelve al anterior cuando quieras en Apariencia.",
|
|
||||||
"wb.install.done.iconsOff": "Está entre tus paquetes de iconos en Apariencia.",
|
|
||||||
"wb.store.icons": "Iconos",
|
|
||||||
"wb.store.iconsItem": "Paquete de iconos",
|
|
||||||
"wb.store.builtinTab": "Integrados",
|
|
||||||
"wb.store.builtinItem": "Integrado",
|
|
||||||
"wb.store.areaSwitch": "Activar o desactivar {name}",
|
|
||||||
"wb.store.areaOn": "Activado",
|
|
||||||
"wb.store.areaOff": "Desactivado"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue