Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c5fd47779 | ||
|
|
42e18b4620 | ||
|
|
190e5bf1bc | ||
|
|
61976191d0 | ||
|
|
d19bb6a1f0 | ||
|
|
a4a8eaf4d2 | ||
|
|
4408dfce5c | ||
|
|
f37d48fe7a | ||
|
|
bfb549fd02 | ||
|
|
2b28707ba0 | ||
|
|
cbdaa12c84 | ||
|
|
012b65bced | ||
|
|
18031e34e4 | ||
|
|
0ab7fe0c64 | ||
|
|
5557443ed1 |
@@ -5,7 +5,7 @@ A Tauri 2 host in Rust (`src-tauri/`) serves a Svelte 5 and TypeScript interface
|
|||||||
Git, Background, Terminal, PDF Viewer, and Project Management are native features with an off switch in Settings → Features (`src/lib/features/`). They do not use the plugin API.
|
Git, Background, Terminal, PDF Viewer, and Project Management are native features with an off switch in Settings → Features (`src/lib/features/`). They do not use the plugin API.
|
||||||
Other optional features are plugins. Each plugin is a separate repository beside this one, for example `../RuneStone_CSV_Viewer`.
|
Other optional features are plugins. Each plugin is a separate repository beside this one, for example `../RuneStone_CSV_Viewer`.
|
||||||
The [development guide](docs/development.md#architecture) maps the source folders.
|
The [development guide](docs/development.md#architecture) maps the source folders.
|
||||||
The public repository is `https://github.com/KnottyWyvern-GH/RuneStone`. Its releases page holds the installers, the browser engine ZIPs, and the SDK packages.
|
The public repository is `https://github.com/kwyvern-gh/RuneStone`. Its releases page holds the installers, the browser engine ZIPs, and the SDK packages.
|
||||||
|
|
||||||
## Skills
|
## Skills
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ RuneStone is a desktop workspace for Markdown notes, code, and project work that
|
|||||||
|
|
||||||
On Windows 10 or 11 (x64):
|
On Windows 10 or 11 (x64):
|
||||||
|
|
||||||
1. Download [RuneStone_1.0.0_x64-setup.exe](https://github.com/KnottyWyvern-GH/RuneStone/releases/download/v1.0.0/RuneStone_1.0.0_x64-setup.exe).
|
1. Download [RuneStone_1.0.0_x64-setup.exe](https://github.com/kwyvern-gh/RuneStone/releases/download/v1.0.0/RuneStone_1.0.0_x64-setup.exe).
|
||||||
2. Open the installer and complete setup.
|
2. Open the installer and complete setup.
|
||||||
3. Open RuneStone from the Start menu.
|
3. Open RuneStone from the Start menu.
|
||||||
|
|
||||||
@@ -49,4 +49,4 @@ RuneStone uses the [Apache License 2.0](LICENSE). See also [NOTICE](NOTICE) and
|
|||||||
|
|
||||||
## Maintainer
|
## Maintainer
|
||||||
|
|
||||||
[KnottyWyvern-GH](https://github.com/KnottyWyvern-GH)
|
[kwyvern-gh](https://github.com/kwyvern-gh)
|
||||||
|
|||||||
@@ -20,4 +20,4 @@ Build procedure: frozen pnpm install; Browser npm ci, checks, tests, engine test
|
|||||||
|
|
||||||
Artifact: `releases/0.1.44/RuneStone_0.1.44_aarch64.dmg`. Logs and packaging scripts remain under `output/macos-installer-0.1.44/`.
|
Artifact: `releases/0.1.44/RuneStone_0.1.44_aarch64.dmg`. Logs and packaging scripts remain under `output/macos-installer-0.1.44/`.
|
||||||
|
|
||||||
Published alongside the existing Windows installer in the Gitea 0.1.44 release, with `macos-release-notes.md` as a separate attachment. The existing release tag was retained.
|
Published alongside the existing Windows installer in the [Gitea 0.1.44 release](https://git.knottywyvern.com/kwyvern/RuneStone/releases/tag/v0.1.44), with `macos-release-notes.md` as a separate attachment. The existing release tag was retained.
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
72b17356fdb42a58051a84961e36fdd893ff26e210e7f855b8a96cde69ce946e RuneStone_1.0.0_x64-setup.exe
|
66d20b7321e1cdfb001e606d2cff2e174589e70eaf736edb6fbbf655e5591876 RuneStone_1.0.0_x64-setup.exe
|
||||||
|
|||||||
@@ -1163,14 +1163,12 @@ Update 2026-10-29: The native Terminal feature keeps the 65% cap on `--rs-select
|
|||||||
- Status: Implemented for user review
|
- Status: Implemented for user review
|
||||||
- Decision source: Card 565874b2 reports that split view shows only the same document side by side. The user expects different documents side by side, also with a web browser.
|
- Decision source: Card 565874b2 reports that split view shows only the same document side by side. The user expects different documents side by side, also with a web browser.
|
||||||
- Previous rule: [UI-021](#ui-021--workspace-links-in-document-panes). Only a file tree item or a workspace link opened a document to the right. Document panes held only documents. A plugin tab, for example a browser tab, covered the whole document area. The **Split** toggle showed Read beside the editor of the same document.
|
- Previous rule: [UI-021](#ui-021--workspace-links-in-document-panes). Only a file tree item or a workspace link opened a document to the right. Document panes held only documents. A plugin tab, for example a browser tab, covered the whole document area. The **Split** toggle showed Read beside the editor of the same document.
|
||||||
- New rule: Each tab menu has **Open to the right**. It shows the tab in a new pane to the right of the active pane. A pane shows a document or a plugin tab. A tab shows in one pane at most, so the item is unavailable for a visible tab. A tab that the user selects, or a file that the user opens, replaces the content of the active pane. The replaced tab stays open. A plugin tab that covers the area moves to the active pane when a tab opens beside it. When one pane is left, its plugin tab covers the area again. A plugin pane has a bar with its title and **Close split**. A document pane beside other panes shows the full path in its bar. The **Split** toggle is now **Read beside**. The file tree menu also has **Open to the right**, also for PDF files and boards. A divider between two panes changes their sizes, with the pointer or the keyboard. A double-click gives the panes equal sizes. A tab that the user drags from the tab bar to a pane replaces the content of that pane. A drop on the left, right, or bottom part of a pane opens a new pane there (left: card 156758f1). A hint shows the place of the drop. The tab that a pane shows can also go to the left, right, or bottom part of its own pane (card e0dc8473). The tab moves to the new pane. The old pane then shows the nearest tab that no pane shows: first the tabs after it, then the tabs before it. Below a plugin tab that covers the area, the old pane shows its document. Without such a tab, the drag shows no hint.
|
- New rule: Each tab menu has **Open to the right**. It shows the tab in a new pane to the right of the active pane. A pane shows a document or a plugin tab. A tab shows in one pane at most, so the item is unavailable for a visible tab. A tab that the user selects, or a file that the user opens, replaces the content of the active pane. The replaced tab stays open. A plugin tab that covers the area moves to the active pane when a tab opens beside it. When one pane is left, its plugin tab covers the area again. A plugin pane has a bar with its title and **Close split**. A document pane beside other panes shows the full path in its bar. The **Split** toggle is now **Read beside**. The file tree menu also has **Open to the right**, also for PDF files and boards. A divider between two panes changes their sizes, with the pointer or the keyboard. A double-click gives the panes equal sizes. A tab that the user drags from the tab bar to a pane replaces the content of that pane. A drop on the right or bottom part of a pane opens a new pane there. A hint shows the place of the drop.
|
||||||
- Reason: "Split" named two different things. Users compare a note with a different note, with a web page, or with a PDF file. Equal pane sizes did not fit a web page or a PDF page beside a note.
|
- Reason: "Split" named two different things. Users compare a note with a different note, with a web page, or with a PDF file. Equal pane sizes did not fit a web page or a PDF page beside a note.
|
||||||
- Scope: Document panes, plugin editor tabs, the tab menu, the tab bar, the file tree menu, and the view control.
|
- Scope: Document panes, plugin editor tabs, the tab menu, the tab bar, the file tree menu, and the view control.
|
||||||
- Shared implementation: `src/lib/workspace/documentPanes.ts`, `src/lib/workspace/splitLayout.ts` (`stackLayout`, `splitSibling`, `splitDividers`, `setSplitRatio`), `src/lib/layout/DocumentArea.svelte`, `src/lib/layout/TabBar.svelte` (`onDragAt`, `onDropAt`), and `src/lib/layout/Workbench.svelte`. A plugin view stays in the plugin layer above the panes, so a move between panes does not mount it again.
|
- Shared implementation: `src/lib/workspace/documentPanes.ts`, `src/lib/workspace/splitLayout.ts` (`stackLayout`, `splitSibling`, `splitDividers`, `setSplitRatio`), `src/lib/layout/DocumentArea.svelte`, `src/lib/layout/TabBar.svelte` (`onDragAt`, `onDropAt`), and `src/lib/layout/Workbench.svelte`. A plugin view stays in the plugin layer above the panes, so a move between panes does not mount it again.
|
||||||
- Exceptions: In the menu of a browser tab, **New tab to the right** and **New tab below** open a new browser tab with the home page in a pane beside the tab. These items replace **Split right** and **Split down**, which opened a copy of the page in a split of plugin views only. The separate browser window keeps its own plugin split.
|
- Exceptions: In the menu of a browser tab, **New tab to the right** and **New tab below** open a new browser tab with the home page in a pane beside the tab. These items replace **Split right** and **Split down**, which opened a copy of the page in a split of plugin views only. The separate browser window keeps its own plugin split.
|
||||||
- Narrow layout: An area of 640 pixels or less shows the panes one above the other, in the same order and with the same ratios. The area does not scroll. Each pane keeps its own scroll bar. A tab drop opens a new pane only below.
|
- Narrow layout: An area of 640 pixels or less shows the panes one above the other, in the same order and with the same ratios. The area does not scroll. Each pane keeps its own scroll bar. A tab drop opens a new pane only below.
|
||||||
- Evidence: `tests/smoke/layout/mixedSplits.smoke.mjs`, `tests/smoke/layout/visibleTabDrag.smoke.mjs` (real mouse input), `tests/smoke/layout/pdfBesideNote.smoke.mjs`, `tests/smoke/layout/splits.smoke.mjs`, and `tests/unit/layout/documentPanes.spec.ts`.
|
- Evidence: `tests/smoke/layout/mixedSplits.smoke.mjs`, `tests/smoke/layout/pdfBesideNote.smoke.mjs`, `tests/smoke/layout/splits.smoke.mjs`, and `tests/unit/layout/documentPanes.spec.ts`.
|
||||||
- Replaces / replaced by: The document-only panes of [UI-021](#ui-021--workspace-links-in-document-panes), and the name **Split** of [UI-049](#ui-049--one-view-control-and-one-file-name).
|
- Replaces / replaced by: The document-only panes of [UI-021](#ui-021--workspace-links-in-document-panes), and the name **Split** of [UI-049](#ui-049--one-view-control-and-one-file-name).
|
||||||
- Limits: A tab from a different window opens in the tab bar, not in a pane. Browser checks use desktop service mocks. Native desktop acceptance remains open.
|
- Limits: A tab from a different window opens in the tab bar, not in a pane. Browser checks use desktop service mocks. Native desktop acceptance remains open.
|
||||||
|
|
||||||
Update 2026-11-16: The user did not find a way to close a split without closing the tab. The **Close split** button showed only a close icon, so it looked like the close button of a tab. Now the button shows a split icon and its name (`src/lib/layout/CloseSplitButton.svelte`). In a pane of 420 pixels or less, it shows only the icon, and a tooltip gives the name. The tab menu also has **Close split** for a tab in a pane beside other panes. The tab stays open. Evidence: `tests/smoke/layout/visibleTabDrag.smoke.mjs`.
|
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ This guide is for developers who change RuneStone's source code. To use the app,
|
|||||||
|
|
||||||
### First run
|
### First run
|
||||||
|
|
||||||
1. Clone the repository: `https://github.com/KnottyWyvern-GH/RuneStone.git`.
|
1. Clone the repository: `https://github.com/kwyvern-gh/RuneStone.git`.
|
||||||
2. In the repository folder, run `pnpm install --frozen-lockfile`.
|
2. In the repository folder, run `pnpm install --frozen-lockfile`.
|
||||||
3. Prepare the browser runtime. See [Built-in browser runtime](#built-in-browser-runtime).
|
3. Prepare the browser runtime. See [Built-in browser runtime](#built-in-browser-runtime).
|
||||||
4. Run `pnpm tauri dev`.
|
4. Run `pnpm tauri dev`.
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ This guide installs, updates, or reinstalls RuneStone from a release file or fro
|
|||||||
|
|
||||||
| Platform | Release file | Notes |
|
| Platform | Release file | Notes |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| Windows 10 or 11, x64 | [RuneStone_1.0.0_x64-setup.exe](https://github.com/KnottyWyvern-GH/RuneStone/releases/download/v1.0.0/RuneStone_1.0.0_x64-setup.exe) | Installs for the current Windows account |
|
| Windows 10 or 11, x64 | [RuneStone_1.0.0_x64-setup.exe](https://github.com/kwyvern-gh/RuneStone/releases/download/v1.0.0/RuneStone_1.0.0_x64-setup.exe) | Installs for the current Windows account |
|
||||||
| macOS, Apple silicon | None | Build the app from source. See [macOS packages](builds.md#macos-packages). Intel Macs are not supported. |
|
| macOS, Apple silicon | None | Build the app from source. See [macOS packages](builds.md#macos-packages). Intel Macs are not supported. |
|
||||||
| Linux, amd64 | None | Build a Debian package from source. See [Build Linux packages](builds.md#build-linux-packages). |
|
| Linux, amd64 | None | Build a Debian package from source. See [Build Linux packages](builds.md#build-linux-packages). |
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ The built-in browser needs a separate engine download. See [Use the built-in bro
|
|||||||
|
|
||||||
## Install on Windows
|
## Install on Windows
|
||||||
|
|
||||||
1. Save `RuneStone_1.0.0_x64-setup.exe` and [windows-SHA256SUMS](https://github.com/KnottyWyvern-GH/RuneStone/raw/master/docs/checksums/1.0.0/windows-SHA256SUMS) to Downloads.
|
1. Save `RuneStone_1.0.0_x64-setup.exe` and [windows-SHA256SUMS](https://github.com/kwyvern-gh/RuneStone/raw/master/docs/checksums/1.0.0/windows-SHA256SUMS) to Downloads.
|
||||||
2. Open PowerShell in Downloads.
|
2. Open PowerShell in Downloads.
|
||||||
3. Check the download:
|
3. Check the download:
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ The plugin SDK `@runestone/plugin-sdk` gives the API types, the feature checks,
|
|||||||
Install it in each plugin project from the URL of its package file on the RuneStone releases page.
|
Install it in each plugin project from the URL of its package file on the RuneStone releases page.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
pnpm add -D "https://github.com/KnottyWyvern-GH/RuneStone/releases/download/plugin-sdk-v0.1.2/runestone-plugin-sdk-0.1.2.tgz"
|
pnpm add -D "https://github.com/kwyvern-gh/RuneStone/releases/download/plugin-sdk-v0.1.2/runestone-plugin-sdk-0.1.2.tgz"
|
||||||
```
|
```
|
||||||
|
|
||||||
- Always give the full URL. The SDK is not on the npm registry, and another account owns the `@runestone` scope there.
|
- Always give the full URL. The SDK is not on the npm registry, and another account owns the `@runestone` scope there.
|
||||||
|
|||||||
+2
-2
@@ -88,7 +88,7 @@ The installer, engine, and SDK scripts stop if the release file exists. The plug
|
|||||||
|
|
||||||
## Publish an installer
|
## Publish an installer
|
||||||
|
|
||||||
Publish RuneStone installers on the [RuneStone releases page](https://github.com/KnottyWyvern-GH/RuneStone/releases). Browser engine ZIPs and SDK packages use the same page.
|
Publish RuneStone installers on the [RuneStone releases page](https://github.com/kwyvern-gh/RuneStone/releases). Browser engine ZIPs and SDK packages use the same page.
|
||||||
|
|
||||||
1. Build the installer and complete the [installer checks](builds.md#installer-checks).
|
1. Build the installer and complete the [installer checks](builds.md#installer-checks).
|
||||||
2. Create a release with the tag `v<version>` on the commit that sets the version.
|
2. Create a release with the tag `v<version>` on the commit that sets the version.
|
||||||
@@ -181,7 +181,7 @@ Plugin authors install the SDK from the URL of that file. See [Install the SDK](
|
|||||||
|
|
||||||
1. Commit the SDK changes in RuneStone. Run `pnpm check` and `pnpm test`.
|
1. Commit the SDK changes in RuneStone. Run `pnpm check` and `pnpm test`.
|
||||||
2. Run `pnpm release:sdk --release-url <folder URL> --version <version> --dry-run`. Read the plan.
|
2. Run `pnpm release:sdk --release-url <folder URL> --version <version> --dry-run`. Read the plan.
|
||||||
The folder URL is the download folder of the release, for example `https://github.com/KnottyWyvern-GH/RuneStone/releases/download/plugin-sdk-v0.1.2`.
|
The folder URL is the download folder of the release, for example `https://github.com/kwyvern-gh/RuneStone/releases/download/plugin-sdk-v0.1.2`.
|
||||||
3. Run the same command without `--dry-run`.
|
3. Run the same command without `--dry-run`.
|
||||||
4. On the RuneStone releases page, create a release with the tag `plugin-sdk-v<version>` on the `source` commit in `sdk.json`.
|
4. On the RuneStone releases page, create a release with the tag `plugin-sdk-v<version>` on the `source` commit in `sdk.json`.
|
||||||
5. Attach only the `.tgz` file. Leave the release description empty.
|
5. Attach only the `.tgz` file. Leave the release description empty.
|
||||||
|
|||||||
+2
-3
@@ -193,12 +193,11 @@ Use panes to see two tabs at the same time. For example, browse the web or read
|
|||||||
|
|
||||||
The tab opens in a new pane to the right of the active pane. A pane shows a document, a PDF file, or a plugin tab, for example a browser tab. A tab shows in one pane at a time.
|
The tab opens in a new pane to the right of the active pane. A pane shows a document, a PDF file, or a plugin tab, for example a browser tab. A tab shows in one pane at a time.
|
||||||
|
|
||||||
You can also drag a tab from the tab bar to a pane. A drop on the middle of the pane shows the tab in that pane. A drop on the left, right, or bottom part opens a new pane there. A hint shows the place before you release the tab.
|
You can also drag a tab from the tab bar to a pane. A drop on the middle of the pane shows the tab in that pane. A drop on the right or bottom part opens a new pane there. A hint shows the place before you release the tab.
|
||||||
You can also drag the tab that a pane shows to the left, right, or bottom part of that pane. The tab moves to the new pane, and the old pane shows the next tab that is not visible. This needs a second tab that is not visible.
|
|
||||||
|
|
||||||
- Click a pane to make its tab the active tab. A tab that you select, or a file that you open, replaces the content of the active pane. The replaced tab stays open.
|
- Click a pane to make its tab the active tab. A tab that you select, or a file that you open, replaces the content of the active pane. The replaced tab stays open.
|
||||||
- Drag the divider between two panes to change their sizes. Double-click the divider to give the panes equal sizes. With the keyboard, focus the divider and use the arrow keys.
|
- Drag the divider between two panes to change their sizes. Double-click the divider to give the panes equal sizes. With the keyboard, focus the divider and use the arrow keys.
|
||||||
- A pane beside other panes names its file in the bar above the document. To close the pane, select **Close split** in that bar. You can also right-click its tab and select **Close split**. The tab stays open.
|
- A pane beside other panes names its file in the bar above the document. Select **Close split** in that bar to close the pane. The tab stays open.
|
||||||
- A browser tab or a PDF tab that fills the area moves to the left pane when a tab opens to the right. When one pane is left, its tab fills the area again.
|
- A browser tab or a PDF tab that fills the area moves to the left pane when a tab opens to the right. When one pane is left, its tab fills the area again.
|
||||||
- In the menu of a browser tab, **New tab to the right** and **New tab below** open a new browser tab with the home page in a pane beside it.
|
- In the menu of a browser tab, **New tab to the right** and **New tab below** open a new browser tab with the home page in a pane beside it.
|
||||||
- The link menu also has **Open to the right**. In a narrow window, the panes show one above the other.
|
- The link menu also has **Open to the right**. In a narrow window, the panes show one above the other.
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "runestone",
|
"name": "runestone",
|
||||||
"version": "1.0.0a",
|
"version": "1.0.1c",
|
||||||
"description": "Desktop editor for a local workspace",
|
"description": "Desktop editor for a local workspace",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# RuneStone Plugin SDK
|
# RuneStone Plugin SDK
|
||||||
|
|
||||||
`@runestone/plugin-sdk` gives TypeScript types and small helpers for [RuneStone](https://github.com/KnottyWyvern-GH/RuneStone) plugins.
|
`@runestone/plugin-sdk` gives TypeScript types and small helpers for [RuneStone](https://github.com/kwyvern-gh/RuneStone) plugins.
|
||||||
RuneStone is a desktop workspace for Markdown notes, code, and project work. Plugins add views, commands, and document editors to it.
|
RuneStone is a desktop workspace for Markdown notes, code, and project work. Plugins add views, commands, and document editors to it.
|
||||||
|
|
||||||
The SDK contains:
|
The SDK contains:
|
||||||
@@ -17,7 +17,7 @@ The SDK does not run plugins and does not call RuneStone. RuneStone gives the `a
|
|||||||
Install the SDK from the URL of its package file on the RuneStone releases page.
|
Install the SDK from the URL of its package file on the RuneStone releases page.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
pnpm add -D "https://github.com/KnottyWyvern-GH/RuneStone/releases/download/plugin-sdk-v0.1.2/runestone-plugin-sdk-0.1.2.tgz"
|
pnpm add -D "https://github.com/kwyvern-gh/RuneStone/releases/download/plugin-sdk-v0.1.2/runestone-plugin-sdk-0.1.2.tgz"
|
||||||
```
|
```
|
||||||
|
|
||||||
The result in `package.json`:
|
The result in `package.json`:
|
||||||
@@ -25,7 +25,7 @@ The result in `package.json`:
|
|||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@runestone/plugin-sdk": "https://github.com/KnottyWyvern-GH/RuneStone/releases/download/plugin-sdk-v0.1.2/runestone-plugin-sdk-0.1.2.tgz"
|
"@runestone/plugin-sdk": "https://github.com/kwyvern-gh/RuneStone/releases/download/plugin-sdk-v0.1.2/runestone-plugin-sdk-0.1.2.tgz"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -60,7 +60,7 @@ export function activate(api: PluginApi) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
Compile the module with a bundler, so the entry file contains the SDK helpers that it uses. RuneStone loads the entry from a Blob URL, so imports from `node_modules` do not resolve at run time.
|
Compile the module with a bundler, so the entry file contains the SDK helpers that it uses. RuneStone loads the entry from a Blob URL, so imports from `node_modules` do not resolve at run time.
|
||||||
Then make the plugin ZIP. See [Build and package a plugin](https://github.com/KnottyWyvern-GH/RuneStone/blob/master/docs/plugin-development.md#build-and-package-a-plugin).
|
Then make the plugin ZIP. See [Build and package a plugin](https://github.com/kwyvern-gh/RuneStone/blob/master/docs/plugin-development.md#build-and-package-a-plugin).
|
||||||
|
|
||||||
A type-only import, such as `import type { PluginApi }`, adds no code to the bundle.
|
A type-only import, such as `import type { PluginApi }`, adds no code to the bundle.
|
||||||
|
|
||||||
@@ -128,12 +128,12 @@ A new SDK release can add types for new RuneStone features. Use the feature chec
|
|||||||
|
|
||||||
## Documentation and help
|
## Documentation and help
|
||||||
|
|
||||||
- [Plugin development reference](https://github.com/KnottyWyvern-GH/RuneStone/blob/master/docs/plugin-development.md): the package format, the API, and the build procedure
|
- [Plugin development reference](https://github.com/kwyvern-gh/RuneStone/blob/master/docs/plugin-development.md): the package format, the API, and the build procedure
|
||||||
- [Completion API](https://github.com/KnottyWyvern-GH/RuneStone/blob/master/docs/completion.md)
|
- [Completion API](https://github.com/kwyvern-gh/RuneStone/blob/master/docs/completion.md)
|
||||||
- [Install and manage plugins](https://github.com/KnottyWyvern-GH/RuneStone/blob/master/docs/plugins.md)
|
- [Install and manage plugins](https://github.com/kwyvern-gh/RuneStone/blob/master/docs/plugins.md)
|
||||||
- [Release policy](https://github.com/KnottyWyvern-GH/RuneStone/blob/master/docs/releases.md#sdk-releases)
|
- [Release policy](https://github.com/kwyvern-gh/RuneStone/blob/master/docs/releases.md#sdk-releases)
|
||||||
|
|
||||||
The SDK source is in the `packages/plugin-sdk` folder of the [RuneStone repository](https://github.com/KnottyWyvern-GH/RuneStone). Report problems there.
|
The SDK source is in the `packages/plugin-sdk` folder of the [RuneStone repository](https://github.com/kwyvern-gh/RuneStone). Report problems there.
|
||||||
|
|
||||||
Knotty Wyvern maintains RuneStone and the SDK.
|
Knotty Wyvern maintains RuneStone and the SDK.
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ export const actionIcons = {
|
|||||||
puzzle: '<path d="M9 3H4v6a3 3 0 1 1 0 6v5h6a3 3 0 1 1 6 0h4v-6a3 3 0 1 0 0-6V3h-5a3 3 0 1 1-6 0Z"/>',
|
puzzle: '<path d="M9 3H4v6a3 3 0 1 1 0 6v5h6a3 3 0 1 1 6 0h4v-6a3 3 0 1 0 0-6V3h-5a3 3 0 1 1-6 0Z"/>',
|
||||||
'split-right': '<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M12 4v16m3-11 3 3-3 3"/>',
|
'split-right': '<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M12 4v16m3-11 3 3-3 3"/>',
|
||||||
'split-down': '<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M3 12h18m-12 3 3 3 3-3"/>',
|
'split-down': '<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M3 12h18m-12 3 3 3 3-3"/>',
|
||||||
'split-close': '<rect x="3" y="4" width="18" height="16" rx="2"/><path d="m7 9 3 3-3 3m10-6-3 3 3 3"/>',
|
|
||||||
kanban: '<rect x="3" y="4" width="5" height="16" rx="1"/><rect x="10" y="4" width="5" height="11" rx="1"/><rect x="17" y="4" width="4" height="7" rx="1"/>',
|
kanban: '<rect x="3" y="4" width="5" height="16" rx="1"/><rect x="10" y="4" width="5" height="11" rx="1"/><rect x="17" y="4" width="4" height="7" rx="1"/>',
|
||||||
bookmark: '<path d="M6 4h12v16l-6-3-6 3z"/>',
|
bookmark: '<path d="M6 4h12v16l-6-3-6 3z"/>',
|
||||||
'file-plus': '<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8zM14 2v6h6M12 18v-6M9 15h6"/>',
|
'file-plus': '<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8zM14 2v6h6M12 18v-6M9 15h6"/>',
|
||||||
|
|||||||
Generated
+1
-1
@@ -3130,7 +3130,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "runestone"
|
name = "runestone"
|
||||||
version = "1.0.0+1"
|
version = "1.0.1+3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.23.1",
|
"base64 0.23.1",
|
||||||
"dunce",
|
"dunce",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "runestone"
|
name = "runestone"
|
||||||
version = "1.0.0+1"
|
version = "1.0.1+3"
|
||||||
description = "Writing workspace plus script editor"
|
description = "Writing workspace plus script editor"
|
||||||
authors = ["Knotty Wyvern"]
|
authors = ["Knotty Wyvern"]
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
@@ -47,4 +47,4 @@ opt-level = 3
|
|||||||
strip = true
|
strip = true
|
||||||
|
|
||||||
[package.metadata.runestone]
|
[package.metadata.runestone]
|
||||||
version = "1.0.0a"
|
version = "1.0.1c"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"protocol": 1,
|
"protocol": 1,
|
||||||
"platforms": {
|
"platforms": {
|
||||||
"windows-x86_64": {
|
"windows-x86_64": {
|
||||||
"url": "https://github.com/KnottyWyvern-GH/RuneStone/releases/download/browser-engine-v0.1.11/RuneStone-Browser_0.1.11_win32-x64.zip",
|
"url": "https://github.com/kwyvern-gh/RuneStone/releases/download/browser-engine-v0.1.11/RuneStone-Browser_0.1.11_win32-x64.zip",
|
||||||
"bytes": 163623801,
|
"bytes": 163623801,
|
||||||
"sha256": "1e0153b134cebe882b36f74e1f3c2a4ed37acb2caca10548034a8b5d88738d26"
|
"sha256": "1e0153b134cebe882b36f74e1f3c2a4ed37acb2caca10548034a8b5d88738d26"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,7 @@
|
|||||||
//!
|
//!
|
||||||
//! The file holds a `schema` number, a `revision` number, and one value for each section.
|
//! The file holds a `schema` number, a `revision` number, and one value for each section.
|
||||||
//! The host does not interpret the section values. The frontend normalizes them.
|
//! The host does not interpret the section values. The frontend normalizes them.
|
||||||
//! A write that changes a section replaces the complete file atomically and sends `settings-changed` to all windows.
|
//! Every write replaces the complete file atomically and sends `settings-changed` to all windows.
|
||||||
//! A write of the value that a section already holds changes nothing and sends no event.
|
|
||||||
//! Plugin settings stay in the app data folder (see `plugins.rs`).
|
//! Plugin settings stay in the app data folder (see `plugins.rs`).
|
||||||
|
|
||||||
use std::io;
|
use std::io;
|
||||||
@@ -179,19 +178,6 @@ impl Store {
|
|||||||
Ok(Change { section: section.into(), revision: next, value })
|
Ok(Change { section: section.into(), revision: next, value })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Like `write`, but when the file already holds `value` in this section, the file stays as it is.
|
|
||||||
/// The change then has the current revision, and `false` tells the caller to send no event.
|
|
||||||
/// The compare ignores the key order of objects. Without this check, windows that save the same value
|
|
||||||
/// can start each other again without end, and each write replaces the file.
|
|
||||||
pub fn write_if_changed(&mut self, section: &str, value: Value) -> Result<(Change, bool)> {
|
|
||||||
check_section(section)?;
|
|
||||||
let loaded = self.load()?;
|
|
||||||
if loaded.exists && *loaded.document.get(section).unwrap_or(&Value::Null) == value {
|
|
||||||
return Ok((Change { section: section.into(), revision: revision(&loaded.document), value }, false));
|
|
||||||
}
|
|
||||||
Ok((self.write(section, value)?, true))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Write the first file from the migrated values. When a file exists, keep it and return it unchanged.
|
/// Write the first file from the migrated values. When a file exists, keep it and return it unchanged.
|
||||||
pub fn migrate(&mut self, sections: Map<String, Value>) -> Result<Snapshot> {
|
pub fn migrate(&mut self, sections: Map<String, Value>) -> Result<Snapshot> {
|
||||||
for name in sections.keys() { check_section(name)?; }
|
for name in sections.keys() { check_section(name)?; }
|
||||||
@@ -243,9 +229,9 @@ pub async fn settings_read(app: AppHandle) -> Result<Snapshot> {
|
|||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub async fn settings_write(app: AppHandle, section: String, value: Value) -> Result<Change> {
|
pub async fn settings_write(app: AppHandle, section: String, value: Value) -> Result<Change> {
|
||||||
let (change, saved) = with_store(&app, move |store| store.write_if_changed(§ion, value)).await?;
|
let change = with_store(&app, move |store| store.write(§ion, value)).await?;
|
||||||
// Every window shows the same preferences, so the change goes to all of them.
|
// Every window shows the same preferences, so the change goes to all of them.
|
||||||
if saved { let _ = app.emit(CHANGED_EVENT, &change); }
|
let _ = app.emit(CHANGED_EVENT, &change);
|
||||||
Ok(change)
|
Ok(change)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -306,35 +292,6 @@ mod tests {
|
|||||||
fs::remove_dir_all(dir).unwrap();
|
fs::remove_dir_all(dir).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn a_write_of_the_stored_value_keeps_the_file_and_the_revision() {
|
|
||||||
let (dir, path) = fixture("unchanged");
|
|
||||||
let mut store = Store::new(path.clone());
|
|
||||||
// A missing file gets created, also for a value that matches the empty default.
|
|
||||||
let (created, saved) = store.write_if_changed("language", Value::Null).unwrap();
|
|
||||||
assert!(saved);
|
|
||||||
assert_eq!(created.revision, 1);
|
|
||||||
let (first, saved) = store.write_if_changed("appearance", json!({ "theme": "harvest-moon", "mode": "dark", "transparency": { "enabled": true, "amount": 18 } })).unwrap();
|
|
||||||
assert!(saved);
|
|
||||||
assert_eq!(first.revision, 2);
|
|
||||||
let before = fs::read(&path).unwrap();
|
|
||||||
// The same value in a different key order changes nothing.
|
|
||||||
let (again, saved) = store.write_if_changed("appearance", json!({ "transparency": { "amount": 18, "enabled": true }, "mode": "dark", "theme": "harvest-moon" })).unwrap();
|
|
||||||
assert!(!saved, "No save and no event");
|
|
||||||
assert_eq!(again.revision, 2);
|
|
||||||
assert_eq!(fs::read(&path).unwrap(), before, "The file stays as it is");
|
|
||||||
// A missing section and `null` are the same.
|
|
||||||
assert!(!store.write_if_changed("terminal", Value::Null).unwrap().1);
|
|
||||||
// A different value saves as usual.
|
|
||||||
let (changed, saved) = store.write_if_changed("appearance", json!({ "theme": "harvest-moon", "mode": "light" })).unwrap();
|
|
||||||
assert!(saved);
|
|
||||||
assert_eq!(changed.revision, 3);
|
|
||||||
assert_eq!(on_disk(&path)["appearance"], json!({ "mode": "light", "theme": "harvest-moon" }));
|
|
||||||
assert!(store.write_if_changed("plugins", json!({})).is_err(), "Unknown sections stay refused");
|
|
||||||
assert_eq!(files(&dir), vec![FILE_NAME.to_owned()], "No temporary files remain");
|
|
||||||
fs::remove_dir_all(dir).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn writes_reject_unknown_sections_and_values_above_the_limit() {
|
fn writes_reject_unknown_sections_and_values_above_the_limit() {
|
||||||
let (dir, path) = fixture("limits");
|
let (dir, path) = fixture("limits");
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://schema.tauri.app/config/2",
|
"$schema": "https://schema.tauri.app/config/2",
|
||||||
"productName": "RuneStone",
|
"productName": "RuneStone",
|
||||||
"version": "1.0.0+1",
|
"version": "1.0.1+3",
|
||||||
"identifier": "com.runestone.app",
|
"identifier": "com.runestone.app",
|
||||||
"build": {
|
"build": {
|
||||||
"beforeDevCommand": "pnpm dev",
|
"beforeDevCommand": "pnpm dev",
|
||||||
|
|||||||
@@ -1464,10 +1464,10 @@ export const messageRows: [string, string, string, string][] = [
|
|||||||
"版本 {version}"
|
"版本 {version}"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"RuneStone is under development. Maintained by KnottyWyvern-GH.",
|
"RuneStone is under development. Maintained by kwyvern-gh.",
|
||||||
"RuneStone est en développement. Maintenu par KnottyWyvern-GH.",
|
"RuneStone est en développement. Maintenu par kwyvern-gh.",
|
||||||
"RuneStoneは開発中です。管理者:KnottyWyvern-GH。",
|
"RuneStoneは開発中です。管理者:kwyvern-gh。",
|
||||||
"RuneStone 正在开发中。由 KnottyWyvern-GH 维护。"
|
"RuneStone 正在开发中。由 kwyvern-gh 维护。"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"Use the folder button to open a workspace or create one. Your notes and scripts stay as ordinary files on disk.",
|
"Use the folder button to open a workspace or create one. Your notes and scripts stay as ordinary files on disk.",
|
||||||
@@ -3306,7 +3306,6 @@ export const messageRows: [string, string, string, string][] = [
|
|||||||
["Drag to resize the panes. Double-click to give them equal sizes.", "Faites glisser pour redimensionner les volets. Double-cliquez pour leur donner la même taille.", "ドラッグしてペインのサイズを変更します。ダブルクリックすると同じサイズになります。", "拖动以调整窗格大小。双击使窗格大小相同。"],
|
["Drag to resize the panes. Double-click to give them equal sizes.", "Faites glisser pour redimensionner les volets. Double-cliquez pour leur donner la même taille.", "ドラッグしてペインのサイズを変更します。ダブルクリックすると同じサイズになります。", "拖动以调整窗格大小。双击使窗格大小相同。"],
|
||||||
["Show here", "Afficher ici", "ここに表示", "在此显示"],
|
["Show here", "Afficher ici", "ここに表示", "在此显示"],
|
||||||
["Open below", "Ouvrir en dessous", "下に開く", "在下方打开"],
|
["Open below", "Ouvrir en dessous", "下に開く", "在下方打开"],
|
||||||
["Open to the left", "Ouvrir à gauche", "左側で開く", "在左侧打开"],
|
|
||||||
["Find…", "Rechercher…", "検索…", "查找…"],
|
["Find…", "Rechercher…", "検索…", "查找…"],
|
||||||
["Open in default browser", "Ouvrir dans le navigateur par défaut", "既定のブラウザーで開く", "在默认浏览器中打开"],
|
["Open in default browser", "Ouvrir dans le navigateur par défaut", "既定のブラウザーで開く", "在默认浏览器中打开"],
|
||||||
["Invalid browser tab transfer.", "Transfert d’onglet de navigateur non valide.", "ブラウザータブの移動が無効です。", "浏览器标签页转移无效。"],
|
["Invalid browser tab transfer.", "Transfert d’onglet de navigateur non valide.", "ブラウザータブの移動が無効です。", "浏览器标签页转移无效。"],
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
import Icon from "$lib/ui/Icon.svelte";
|
|
||||||
import { attachTooltip } from "$lib/ui/tooltip";
|
|
||||||
import { t } from "$lib/i18n";
|
|
||||||
|
|
||||||
// A pane beside other panes closes with this button. Its tab stays open in the tab bar.
|
|
||||||
// The button shows its name, because a bare close icon looks like the close button of a tab.
|
|
||||||
// A narrow pane shows only the icon. Then the tooltip gives the name.
|
|
||||||
let { onclick }: { onclick: () => void } = $props();
|
|
||||||
let text: HTMLSpanElement;
|
|
||||||
|
|
||||||
function tooltip(node: HTMLElement) {
|
|
||||||
const dispose = attachTooltip(node, () => text && getComputedStyle(text).display === "none" ? $t("Close split") : "");
|
|
||||||
return { destroy: dispose };
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<button type="button" class="close-split" aria-label={$t("Close split")} {onclick} use:tooltip><Icon icon="split-close" /><span bind:this={text}>{$t("Close split")}</span></button>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.close-split {
|
|
||||||
display: inline-flex;
|
|
||||||
flex: 0 0 auto;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
gap: 6px;
|
|
||||||
min-width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
padding: 0 10px 0 8px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
border: 1px solid var(--rs-border);
|
|
||||||
border-radius: var(--rs-control-radius);
|
|
||||||
background: transparent;
|
|
||||||
color: var(--rs-text-dim);
|
|
||||||
font: inherit;
|
|
||||||
font-size: 12px;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
.close-split :global(svg) { width: 16px; height: 16px; flex-shrink: 0; }
|
|
||||||
.close-split:hover { background: var(--rs-hover-bg); color: var(--rs-text-strong); }
|
|
||||||
/* The pane bar and the editor bar are size containers. A narrow pane keeps room for its path and its view controls. */
|
|
||||||
@container (max-width: 420px) {
|
|
||||||
.close-split { padding: 0; }
|
|
||||||
.close-split span { display: none; }
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
import type { OpenBuffer } from "$lib/workspace/types";
|
import type { OpenBuffer } from "$lib/workspace/types";
|
||||||
import EditorPane from "./EditorPane.svelte";
|
import EditorPane from "./EditorPane.svelte";
|
||||||
import Icon from "$lib/ui/Icon.svelte";
|
import Icon from "$lib/ui/Icon.svelte";
|
||||||
import CloseSplitButton from "./CloseSplitButton.svelte";
|
import IconButton from "$lib/ui/IconButton.svelte";
|
||||||
import { paneBounds, splitDividers, stackLayout, type SplitDivider, type SplitLayout, type SplitPath } from "$lib/workspace/splitLayout";
|
import { paneBounds, splitDividers, stackLayout, type SplitDivider, type SplitLayout, type SplitPath } from "$lib/workspace/splitLayout";
|
||||||
import type { PaneDrop } from "$lib/workspace/documentPanes";
|
import type { PaneDrop } from "$lib/workspace/documentPanes";
|
||||||
import { attachTooltip } from "$lib/ui/tooltip";
|
import { attachTooltip } from "$lib/ui/tooltip";
|
||||||
@@ -121,7 +121,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The drop target under a point: a pane, and the place on it. The left, right, and bottom sides open a new pane.
|
* The drop target under a point: a pane, and the place on it. The right and bottom sides open a new pane.
|
||||||
* While a plugin view covers the area, the area is one pane. A narrow area opens new panes only below.
|
* While a plugin view covers the area, the area is one pane. A narrow area opens new panes only below.
|
||||||
*/
|
*/
|
||||||
export function dropAt(x: number, y: number): DropTarget | null {
|
export function dropAt(x: number, y: number): DropTarget | null {
|
||||||
@@ -135,14 +135,13 @@
|
|||||||
const box = pane ? (pluginCover ? full : bounds[pane]) : undefined;
|
const box = pane ? (pluginCover ? full : bounds[pane]) : undefined;
|
||||||
if (!pane || !box) return null;
|
if (!pane || !box) return null;
|
||||||
const rx = (px - box.left) / box.width, ry = (py - box.top) / box.height;
|
const rx = (px - box.left) / box.width, ry = (py - box.top) / box.height;
|
||||||
return { pane, zone: rx > 0.7 && !stacked ? "right" : rx < 0.3 && !stacked ? "left" : ry > 0.7 ? "down" : "center" };
|
return { pane, zone: rx > 0.7 && !stacked ? "right" : ry > 0.7 ? "down" : "center" };
|
||||||
}
|
}
|
||||||
const dropBox = $derived.by(() => {
|
const dropBox = $derived.by(() => {
|
||||||
if (!drop) return null;
|
if (!drop) return null;
|
||||||
const box = pluginCover ? full : bounds[drop.pane];
|
const box = pluginCover ? full : bounds[drop.pane];
|
||||||
if (!box) return null;
|
if (!box) return null;
|
||||||
if (drop.zone === "right") return { ...box, left: box.left + box.width / 2, width: box.width / 2 };
|
if (drop.zone === "right") return { ...box, left: box.left + box.width / 2, width: box.width / 2 };
|
||||||
if (drop.zone === "left") return { ...box, width: box.width / 2 };
|
|
||||||
if (drop.zone === "down") return { ...box, top: box.top + box.height / 2, height: box.height / 2 };
|
if (drop.zone === "down") return { ...box, top: box.top + box.height / 2, height: box.height / 2 };
|
||||||
return box;
|
return box;
|
||||||
});
|
});
|
||||||
@@ -223,7 +222,7 @@
|
|||||||
{#if host && several}
|
{#if host && several}
|
||||||
<div class="pane-bar">
|
<div class="pane-bar">
|
||||||
<span class="pane-title" title={view.title}>{view.title}</span>
|
<span class="pane-title" title={view.title}>{view.title}</span>
|
||||||
<CloseSplitButton onclick={() => onCloseSplit(host)} />
|
<IconButton icon="close" label={$t("Close split")} onclick={() => onCloseSplit(host)} />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<PluginEditor bind:this={pluginPaneComponents[view.key]} {view} />
|
<PluginEditor bind:this={pluginPaneComponents[view.key]} {view} />
|
||||||
@@ -243,7 +242,7 @@
|
|||||||
{/each}
|
{/each}
|
||||||
{#if dropBox && drop}
|
{#if dropBox && drop}
|
||||||
<div class="drop-hint" data-drop-zone={drop.zone} style:left={`${dropBox.left}%`} style:top={`${dropBox.top}%`} style:width={`${dropBox.width}%`} style:height={`${dropBox.height}%`}>
|
<div class="drop-hint" data-drop-zone={drop.zone} style:left={`${dropBox.left}%`} style:top={`${dropBox.top}%`} style:width={`${dropBox.width}%`} style:height={`${dropBox.height}%`}>
|
||||||
<span>{drop.zone === "center" ? $t("Show here") : drop.zone === "right" ? $t("Open to the right") : drop.zone === "left" ? $t("Open to the left") : $t("Open below")}</span>
|
<span>{drop.zone === "center" ? $t("Show here") : drop.zone === "right" ? $t("Open to the right") : $t("Open below")}</span>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</main>
|
</main>
|
||||||
@@ -293,7 +292,7 @@
|
|||||||
.plugin-pane.embedded { background: var(--rs-bg); }
|
.plugin-pane.embedded { background: var(--rs-bg); }
|
||||||
.plugin-pane.inactive { display: none; }
|
.plugin-pane.inactive { display: none; }
|
||||||
/* The bar of a plugin view in a pane matches the chrome bar of a document pane. */
|
/* The bar of a plugin view in a pane matches the chrome bar of a document pane. */
|
||||||
.pane-bar { container-type: inline-size; display: flex; align-items: center; gap: 8px; min-height: 34px; flex: 0 0 auto; padding: 0 10px; background: var(--rs-bg); border-bottom: 1px solid var(--rs-border); color: var(--rs-text-dim); }
|
.pane-bar { display: flex; align-items: center; gap: 8px; min-height: 34px; flex: 0 0 auto; padding: 0 10px; background: var(--rs-bg); border-bottom: 1px solid var(--rs-border); color: var(--rs-text-dim); }
|
||||||
.plugin-pane.focused .pane-bar { background: var(--rs-bg-active); }
|
.plugin-pane.focused .pane-bar { background: var(--rs-bg-active); }
|
||||||
.pane-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
.pane-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
/* A divider is a wide, invisible target over the border between two panes. It shows the accent color on hover and focus. */
|
/* A divider is a wide, invisible target over the border between two panes. It shows the accent color on hover and focus. */
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
import type { FindTarget } from "$lib/editor/findTarget";
|
import type { FindTarget } from "$lib/editor/findTarget";
|
||||||
import DocumentEditor from "$lib/editor/DocumentEditor.svelte";
|
import DocumentEditor from "$lib/editor/DocumentEditor.svelte";
|
||||||
import { tick } from "svelte";
|
import { tick } from "svelte";
|
||||||
import CloseSplitButton from "./CloseSplitButton.svelte";
|
import IconButton from "$lib/ui/IconButton.svelte";
|
||||||
import ImageViewer from "./ImageViewer.svelte";
|
import ImageViewer from "./ImageViewer.svelte";
|
||||||
import MarkdownView from "./MarkdownView.svelte";
|
import MarkdownView from "./MarkdownView.svelte";
|
||||||
import ViewModes, { type ViewMode } from "./ViewModes.svelte";
|
import ViewModes, { type ViewMode } from "./ViewModes.svelte";
|
||||||
@@ -154,7 +154,7 @@
|
|||||||
|
|
||||||
{#if !buffer || buffer.kind === "empty"}
|
{#if !buffer || buffer.kind === "empty"}
|
||||||
<div class="empty">
|
<div class="empty">
|
||||||
{#if onCloseSplit}<CloseSplitButton onclick={onCloseSplit} />{/if}
|
{#if onCloseSplit}<IconButton icon="close" label={$t("Close split")} onclick={onCloseSplit} />{/if}
|
||||||
<div class="welcome-actions">
|
<div class="welcome-actions">
|
||||||
{#if hasWorkspace}
|
{#if hasWorkspace}
|
||||||
<div class="welcome-row">
|
<div class="welcome-row">
|
||||||
@@ -180,7 +180,7 @@
|
|||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="actions" bind:this={modeControls}>
|
<div class="actions" bind:this={modeControls}>
|
||||||
{#if onCloseSplit}<CloseSplitButton onclick={onCloseSplit} />{/if}
|
{#if onCloseSplit}<IconButton icon="close" label={$t("Close split")} onclick={onCloseSplit} />{/if}
|
||||||
{#if !isImage}<ViewModes {view} split={splitView} readable={canPreview} onView={next => onView?.(next)} onSplit={next => onSplit?.(next)} />{/if}
|
{#if !isImage}<ViewModes {view} split={splitView} readable={canPreview} onView={next => onView?.(next)} onSplit={next => onSplit?.(next)} />{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -253,7 +253,7 @@
|
|||||||
{/each}
|
{/each}
|
||||||
</details>
|
</details>
|
||||||
</div>
|
</div>
|
||||||
<p class="about-note">{$t("RuneStone is under development. Maintained by KnottyWyvern-GH.")}</p>
|
<p class="about-note">{$t("RuneStone is under development. Maintained by kwyvern-gh.")}</p>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
import { WorkspaceSession } from "$lib/workspace/session.svelte";
|
import { WorkspaceSession } from "$lib/workspace/session.svelte";
|
||||||
import { retainEditorStates } from "$lib/editor/editorStates";
|
import { retainEditorStates } from "$lib/editor/editorStates";
|
||||||
import { initialDocumentPanes, syncDocumentPanes, splitDocumentPane, closeDocumentPane, selectPane, readDocumentPane, splitDocumentView,
|
import { initialDocumentPanes, syncDocumentPanes, splitDocumentPane, closeDocumentPane, selectPane, readDocumentPane, splitDocumentView,
|
||||||
paneOf, showInActivePane, splitWithContent, releaseSolePlugin, dropInPane, moveToNewPane, resizeDocumentPanes, type PaneContent, type PaneDrop, type DocumentPanes } from "$lib/workspace/documentPanes";
|
paneOf, showInActivePane, splitWithContent, releaseSolePlugin, dropInPane, resizeDocumentPanes, type PaneContent, type PaneDrop, type DocumentPanes } from "$lib/workspace/documentPanes";
|
||||||
import type { ViewMode } from "./ViewModes.svelte";
|
import type { ViewMode } from "./ViewModes.svelte";
|
||||||
import { selectedEditorText } from "$lib/editor/selection";
|
import { selectedEditorText } from "$lib/editor/selection";
|
||||||
import { pluginHost } from "$lib/plugins/registry";
|
import { pluginHost } from "$lib/plugins/registry";
|
||||||
@@ -336,21 +336,9 @@
|
|||||||
const tab = workingTabs.find(tab => tab.relPath === path);
|
const tab = workingTabs.find(tab => tab.relPath === path);
|
||||||
const target = tab && !switching ? documentArea?.dropAt(x, y) ?? null : null;
|
const target = tab && !switching ? documentArea?.dropAt(x, y) ?? null : null;
|
||||||
if (!tab || !target) return null;
|
if (!tab || !target) return null;
|
||||||
const own = coverKey ? "plugin" in tab && tab.plugin.key === coverKey : paneOf(documentPanes, tabContent(tab))?.id === target.pane;
|
// A drop on the pane that shows the tab changes nothing.
|
||||||
if (!own) return { tab, target, stay: null };
|
if (coverKey ? "plugin" in tab && tab.plugin.key === coverKey : paneOf(documentPanes, tabContent(tab))?.id === target.pane) return null;
|
||||||
// The tab that the pane shows can move to a new pane beside it. Then the pane shows a different tab:
|
return { tab, target };
|
||||||
// the document below a plugin view that covers the area, or the next tab that no pane shows.
|
|
||||||
if (target.zone === "center") return null;
|
|
||||||
const below = coverKey ? documentPanes.panes.find(pane => pane.id === target.pane)?.documentId : null;
|
|
||||||
const next = below ? undefined : tabAfter(tab);
|
|
||||||
const stay: PaneContent | null = below ? { documentId: below } : next ? tabContent(next) : null;
|
|
||||||
return stay ? { tab, target, stay } : null;
|
|
||||||
}
|
|
||||||
/** The nearest tab that no pane shows: first the tabs after `tab`, then the tabs before it. A closed tab uses the same order. */
|
|
||||||
function tabAfter(tab: EditorTab) {
|
|
||||||
const index = workingTabs.indexOf(tab);
|
|
||||||
const free = (item: EditorTab) => item !== tab && !paneOf(documentPanes, tabContent(item));
|
|
||||||
return workingTabs.slice(index + 1).find(free) ?? workingTabs.slice(0, Math.max(index, 0)).reverse().find(free);
|
|
||||||
}
|
}
|
||||||
function tabDragAt(path: string, x: number, y: number) {
|
function tabDragAt(path: string, x: number, y: number) {
|
||||||
tabDrop = tabDropTarget(path, x, y)?.target ?? null;
|
tabDrop = tabDropTarget(path, x, y)?.target ?? null;
|
||||||
@@ -360,11 +348,7 @@
|
|||||||
const found = tabDropTarget(path, x, y);
|
const found = tabDropTarget(path, x, y);
|
||||||
tabDrop = null;
|
tabDrop = null;
|
||||||
if (!found) return false;
|
if (!found) return false;
|
||||||
const { tab, target, stay } = found;
|
const { tab, target } = found;
|
||||||
if (stay) {
|
|
||||||
if (target.zone !== "center") changePanes(moveToNewPane(documentPanes, target.pane, stay, tabContent(tab), target.zone, crypto.randomUUID()));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (coverKey) {
|
if (coverKey) {
|
||||||
if (target.zone === "center") { selectWorkingTab(tab.relPath); return true; }
|
if (target.zone === "center") { selectWorkingTab(tab.relPath); return true; }
|
||||||
keepCoverInPane();
|
keepCoverInPane();
|
||||||
@@ -734,11 +718,8 @@
|
|||||||
if (!tab) return [];
|
if (!tab) return [];
|
||||||
const actions = "plugin" in tab ? pluginTabActions(tab.plugin) : [];
|
const actions = "plugin" in tab ? pluginTabActions(tab.plugin) : [];
|
||||||
const right: ActionMenuItem = { label: $t("Open to the right"), icon: "split-right", disabled: tabVisible(tab), run: () => openTabToRight(tab) };
|
const right: ActionMenuItem = { label: $t("Open to the right"), icon: "split-right", disabled: tabVisible(tab), run: () => openTabToRight(tab) };
|
||||||
// A tab in a pane beside other panes can leave the split. The tab stays open.
|
if (actions.some(action => "label" in action && /(?:move|open).*new window/i.test(action.label))) return [right, ...actions];
|
||||||
const pane = !coverKey && documentPanes.panes.length > 1 ? paneOf(documentPanes, tabContent(tab)) : undefined;
|
return [right, { label: $t("Open in new window"), icon: "external", disabled: !desktop || !workspace, run: () => { void detachTab(tab); } }, ...actions];
|
||||||
const close: ActionMenuItem[] = pane ? [{ label: $t("Close split"), icon: "split-close", run: () => closeSplit(pane.id) }] : [];
|
|
||||||
if (actions.some(action => "label" in action && /(?:move|open).*new window/i.test(action.label))) return [right, ...close, ...actions];
|
|
||||||
return [right, ...close, { label: $t("Open in new window"), icon: "external", disabled: !desktop || !workspace, run: () => { void detachTab(tab); } }, ...actions];
|
|
||||||
}
|
}
|
||||||
async function detachTab(item: WorkbenchTab, keepSource = false) {
|
async function detachTab(item: WorkbenchTab, keepSource = false) {
|
||||||
const tab = workingTabs.find(tab => tab.id === item.id);
|
const tab = workingTabs.find(tab => tab.id === item.id);
|
||||||
|
|||||||
@@ -56,23 +56,6 @@ function encode(section: SettingsSection, value: unknown): string {
|
|||||||
return section === 'language' && typeof value === 'string' ? value : JSON.stringify(value);
|
return section === 'language' && typeof value === 'string' ? value : JSON.stringify(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The same value with the object keys in alphabetical order, at every depth.
|
|
||||||
function sortKeys(value: unknown): unknown {
|
|
||||||
if (Array.isArray(value)) return value.map(sortKeys);
|
|
||||||
if (!value || typeof value !== 'object') return value;
|
|
||||||
const source = value as Record<string, unknown>;
|
|
||||||
return Object.fromEntries(Object.keys(source).sort().map(key => [key, sortKeys(source[key])]));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* True when two section values hold the same data. The key order of objects does not matter.
|
|
||||||
* The desktop host stores the keys in alphabetical order, so a value that comes back from the host
|
|
||||||
* can have a different key order than the value that a window saved.
|
|
||||||
*/
|
|
||||||
export function sameSettingsValue(a: unknown, b: unknown): boolean {
|
|
||||||
return JSON.stringify(sortKeys(a)) === JSON.stringify(sortKeys(b));
|
|
||||||
}
|
|
||||||
|
|
||||||
function notify(section: SettingsSection) {
|
function notify(section: SettingsSection) {
|
||||||
for (const callback of [...subscribers.get(section) ?? []]) {
|
for (const callback of [...subscribers.get(section) ?? []]) {
|
||||||
try { callback(); } catch (reason) { console.error(`A ${section} settings subscriber failed.`, reason); }
|
try { callback(); } catch (reason) { console.error(`A ${section} settings subscriber failed.`, reason); }
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { syncTableFormulas } from '$lib/formulas';
|
import { syncTableFormulas } from '$lib/formulas';
|
||||||
import { syncFileTitle } from '$lib/editor/fileTitle';
|
import { syncFileTitle } from '$lib/editor/fileTitle';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { onSettingsChange, readSection, sameSettingsValue, writeSection } from '$lib/settings/store';
|
import { onSettingsChange, readSection, writeSection } from '$lib/settings/store';
|
||||||
import { applyAppearance, readAppearance } from './appearance';
|
import { applyAppearance, readAppearance } from './appearance';
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
const stopLocale = syncLocale();
|
const stopLocale = syncLocale();
|
||||||
@@ -14,8 +14,7 @@
|
|||||||
const stored = readSection('appearance');
|
const stored = readSection('appearance');
|
||||||
const appearance = readAppearance();
|
const appearance = readAppearance();
|
||||||
// Save the normalized value, for example a new ID for a renamed theme.
|
// Save the normalized value, for example a new ID for a renamed theme.
|
||||||
// Ignore the key order: the host sorts the keys, so a text compare saves again in each window without end.
|
if (stored !== undefined && JSON.stringify(stored) !== JSON.stringify(appearance)) {
|
||||||
if (stored !== undefined && !sameSettingsValue(stored, appearance)) {
|
|
||||||
writeSection('appearance', appearance).catch(() => { /* The normalized value applies until the next save. */ });
|
writeSection('appearance', appearance).catch(() => { /* The normalized value applies until the next save. */ });
|
||||||
}
|
}
|
||||||
applyAppearance(appearance);
|
applyAppearance(appearance);
|
||||||
|
|||||||
@@ -156,8 +156,6 @@
|
|||||||
<path d="M3 4v16M21 4v16M7 12h10M10 9l-3 3 3 3M14 9l3 3-3 3" />
|
<path d="M3 4v16M21 4v16M7 12h10M10 9l-3 3 3 3M14 9l3 3-3 3" />
|
||||||
{:else if icon === "rotate"}
|
{:else if icon === "rotate"}
|
||||||
<path d="M20 7v5h-5" /><path d="M20 12a8 8 0 1 0-2 6" />
|
<path d="M20 7v5h-5" /><path d="M20 12a8 8 0 1 0-2 6" />
|
||||||
{:else if icon === "split-close"}
|
|
||||||
{@html actionIcons["split-close"]}
|
|
||||||
{/if}
|
{/if}
|
||||||
</svg>
|
</svg>
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -62,8 +62,7 @@
|
|||||||
| "zoom-in"
|
| "zoom-in"
|
||||||
| "zoom-out"
|
| "zoom-out"
|
||||||
| "fit-width"
|
| "fit-width"
|
||||||
| "rotate"
|
| "rotate";
|
||||||
| "split-close";
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
icon: IconName;
|
icon: IconName;
|
||||||
|
|||||||
@@ -73,16 +73,12 @@ export function showInActivePane(state: DocumentPanes, content: PaneContent): Do
|
|||||||
return { ...state, panes: state.panes.map(pane => pane.id === state.active ? filled(pane.id, content) : pane) };
|
return { ...state, panes: state.panes.map(pane => pane.id === state.active ? filled(pane.id, content) : pane) };
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The side of a pane where a new pane opens. */
|
|
||||||
export type PaneSide = "right" | "down" | "left";
|
|
||||||
|
|
||||||
/** Show the content in a new pane beside `source`. When a pane already shows it, that pane becomes active. */
|
/** Show the content in a new pane beside `source`. When a pane already shows it, that pane becomes active. */
|
||||||
export function splitWithContent(state: DocumentPanes, source: string, content: PaneContent, paneId: string, direction: PaneSide = "right"): DocumentPanes {
|
export function splitWithContent(state: DocumentPanes, source: string, content: PaneContent, paneId: string, direction: "right" | "down" = "right"): DocumentPanes {
|
||||||
const existing = paneOf(state, content);
|
const existing = paneOf(state, content);
|
||||||
if (existing) return selectPane(state, existing.id);
|
if (existing) return selectPane(state, existing.id);
|
||||||
if (!state.panes.some(pane => pane.id === source) || state.panes.some(pane => pane.id === paneId)) return state;
|
if (!state.panes.some(pane => pane.id === source) || state.panes.some(pane => pane.id === paneId)) return state;
|
||||||
const layout = splitPane(state.layout, source, paneId, direction === "left" ? "right" : direction, direction === "left");
|
return { layout: splitPane(state.layout, source, paneId, direction), panes: [...state.panes, filled(paneId, content)], active: paneId };
|
||||||
return { layout, panes: [...state.panes, filled(paneId, content)], active: paneId };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function splitDocumentPane(state: DocumentPanes, source: string, documentId: string, paneId: string): DocumentPanes {
|
export function splitDocumentPane(state: DocumentPanes, source: string, documentId: string, paneId: string): DocumentPanes {
|
||||||
@@ -110,8 +106,8 @@ export function releaseSolePlugin(state: DocumentPanes): { state: DocumentPanes;
|
|||||||
return { state: { ...state, panes: [{ ...pane, pluginKey: null }] }, pluginKey: pane.pluginKey };
|
return { state: { ...state, panes: [{ ...pane, pluginKey: null }] }, pluginKey: pane.pluginKey };
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The place of a tab drop on a pane: the pane itself, or a new pane on its left, right, or bottom side. */
|
/** The place of a tab drop on a pane: the pane itself, or a new pane on its right or bottom side. */
|
||||||
export type PaneDrop = "center" | PaneSide;
|
export type PaneDrop = "center" | "right" | "down";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the content in the `target` pane (`center`), or in a new pane beside it.
|
* Show the content in the `target` pane (`center`), or in a new pane beside it.
|
||||||
@@ -127,18 +123,6 @@ export function dropInPane(state: DocumentPanes, content: PaneContent, target: s
|
|||||||
return splitWithContent(collapse(state, cleared, target), target, content, paneId, zone);
|
return splitWithContent(collapse(state, cleared, target), target, content, paneId, zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Move the content of the `source` pane to a new pane beside it. The `source` pane then shows `stay`.
|
|
||||||
* `stay` is content that no other pane shows. `content` is the content of `source`, or content that no pane shows,
|
|
||||||
* for example a plugin view that covers the area.
|
|
||||||
*/
|
|
||||||
export function moveToNewPane(state: DocumentPanes, source: string, stay: PaneContent, content: PaneContent, zone: PaneSide, paneId: string): DocumentPanes {
|
|
||||||
const holder = paneOf(state, stay), shown = paneOf(state, content);
|
|
||||||
if (!state.panes.some(pane => pane.id === source) || (holder && holder.id !== source) || (shown && shown.id !== source) || (holder && shown)) return state;
|
|
||||||
const panes = holder ? state.panes : state.panes.map(pane => pane.id === source ? filled(source, stay) : pane);
|
|
||||||
return splitWithContent({ ...state, panes }, source, content, paneId, zone);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Give a new ratio to a split between panes. */
|
/** Give a new ratio to a split between panes. */
|
||||||
export function resizeDocumentPanes(state: DocumentPanes, path: SplitPath, ratio: number): DocumentPanes {
|
export function resizeDocumentPanes(state: DocumentPanes, path: SplitPath, ratio: number): DocumentPanes {
|
||||||
const layout = setSplitRatio(state.layout, path, ratio);
|
const layout = setSplitRatio(state.layout, path, ratio);
|
||||||
|
|||||||
@@ -11,10 +11,9 @@ export function containsPane(tree: SplitLayout, key: string): boolean {
|
|||||||
return typeof tree === "string" ? tree === key : containsPane(tree.first, key) || containsPane(tree.second, key);
|
return typeof tree === "string" ? tree === key : containsPane(tree.first, key) || containsPane(tree.second, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Split the `key` pane. The `next` pane goes after it, or before it when `before` is true. */
|
export function splitPane(tree: SplitLayout, key: string, next: string, direction: "right" | "down"): SplitLayout {
|
||||||
export function splitPane(tree: SplitLayout, key: string, next: string, direction: "right" | "down", before = false): SplitLayout {
|
if (typeof tree === "string") return tree === key ? { direction, first: tree, second: next } : tree;
|
||||||
if (typeof tree === "string") return tree === key ? (before ? { direction, first: next, second: tree } : { direction, first: tree, second: next }) : tree;
|
return { ...tree, first: splitPane(tree.first, key, next, direction), second: splitPane(tree.second, key, next, direction) };
|
||||||
return { ...tree, first: splitPane(tree.first, key, next, direction, before), second: splitPane(tree.second, key, next, direction, before) };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function removePane(tree: SplitLayout, key: string): SplitLayout | null {
|
export function removePane(tree: SplitLayout, key: string): SplitLayout | null {
|
||||||
|
|||||||
@@ -1,171 +0,0 @@
|
|||||||
// A drag of the tab that a pane shows, with real mouse input: the tab moves to a new pane on the right or bottom side of
|
|
||||||
// its pane, and the pane shows the next tab. A browser tab that covers the area moves beside the document below it.
|
|
||||||
// With only one tab, the drag shows no hint.
|
|
||||||
import assert from "node:assert/strict";
|
|
||||||
import path from "node:path";
|
|
||||||
import { mockTauri, outputDir, runSmoke, smokeUrl } from "../_harness/index.mjs";
|
|
||||||
|
|
||||||
await runSmoke("layout/visibleTabDrag", async ({ page }) => {
|
|
||||||
const output = await outputDir("layout/visibleTabDrag");
|
|
||||||
await page.addInitScript(() => localStorage.setItem("runestone.settings", JSON.stringify({ autosaveEnabled: false })));
|
|
||||||
await mockTauri(page, {
|
|
||||||
commands: test => {
|
|
||||||
const workspace = test.workspace({
|
|
||||||
root: "C:\\visible-tab-drag-workspace",
|
|
||||||
files: { "a.md": "# Alpha\n\nAlpha text.\n", "b.md": "# Bravo\n\nBravo text.\n", "c.md": "# Charlie\n\nCharlie text.\n" },
|
|
||||||
});
|
|
||||||
const snapshot = { profiles: [{ id: "user", name: "User" }], tabs: [], bookmarks: [], settings: { search: "duckduckgo", adblock: true, linkDestination: "internal", personalRules: "", homepage: "", filterLists: [] } };
|
|
||||||
let next = 0;
|
|
||||||
return {
|
|
||||||
...workspace,
|
|
||||||
browser_connect: () => "window-session",
|
|
||||||
browser_request: ({ command }) => {
|
|
||||||
if (command === "newTab") { const tabId = "native-" + (++next); snapshot.tabs.push({ id: tabId, profileId: "user", url: "about:blank", title: "Browser", loading: false, blocked: 0, canBack: false, canForward: false }); return { tabId }; }
|
|
||||||
return structuredClone(snapshot);
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const pane = rel => page.locator(`[data-document-path="${rel}"]`);
|
|
||||||
const browserPane = page.locator(".plugin-pane:not(.inactive)").filter({ has: page.locator('[data-browser-state="ready"]') });
|
|
||||||
const tab = name => page.getByRole("tab", { name: new RegExp(name) });
|
|
||||||
const hint = page.locator(".drop-hint");
|
|
||||||
async function box(locator) { const value = await locator.boundingBox(); assert.ok(value, "The element is visible"); return value; }
|
|
||||||
const shown = () => page.locator("[data-document-path]").evaluateAll(nodes => nodes.map(node => node.getAttribute("data-document-path")));
|
|
||||||
const activeTab = () => page.locator('[role="tab"][aria-selected="true"]').innerText();
|
|
||||||
/** Press the mouse button on a tab and move the pointer to a part of a target. The button stays down. */
|
|
||||||
async function dragTo(name, target, where) {
|
|
||||||
const from = await box(tab(name)), to = await box(target);
|
|
||||||
const point = where === "right" ? { x: to.x + to.width - 30, y: to.y + to.height / 2 }
|
|
||||||
: where === "left" ? { x: to.x + 30, y: to.y + to.height / 2 }
|
|
||||||
: where === "down" ? { x: to.x + to.width / 2, y: to.y + to.height - 30 }
|
|
||||||
: { x: to.x + to.width / 2, y: to.y + to.height / 2 };
|
|
||||||
await page.mouse.move(from.x + from.width / 2, from.y + from.height / 2);
|
|
||||||
await page.mouse.down();
|
|
||||||
await page.mouse.move(from.x + from.width / 2 + 8, from.y + from.height / 2 + 8, { steps: 3 });
|
|
||||||
await page.mouse.move(point.x, point.y, { steps: 10 });
|
|
||||||
// The browser fires dragover on the next move. A target that a step only enters gets no dragover.
|
|
||||||
await page.mouse.move(point.x + 2, point.y + 2, { steps: 2 });
|
|
||||||
}
|
|
||||||
async function open(name) {
|
|
||||||
await page.locator(`[data-tree-rel="${name}"]`).click();
|
|
||||||
await pane(name).locator(".cm-content").waitFor();
|
|
||||||
}
|
|
||||||
|
|
||||||
await page.goto(smokeUrl);
|
|
||||||
await open("a.md");
|
|
||||||
assert.equal(await page.getByRole("tab").count(), 1);
|
|
||||||
|
|
||||||
// The only tab has no other tab to leave in its pane. The drag shows no hint and changes nothing.
|
|
||||||
await dragTo("a.md", pane("a.md"), "right");
|
|
||||||
await page.waitForTimeout(200);
|
|
||||||
assert.equal(await hint.count(), 0, "The only tab cannot open a pane");
|
|
||||||
await page.mouse.up();
|
|
||||||
assert.deepEqual(await shown(), ["a.md"]);
|
|
||||||
|
|
||||||
// A click in the file tree replaces the current tab, so each more file opens from a new tab.
|
|
||||||
for (const name of ["b.md", "c.md"]) {
|
|
||||||
await page.getByRole("button", { name: "New tab (Ctrl+T)", exact: true }).click();
|
|
||||||
await open(name);
|
|
||||||
}
|
|
||||||
assert.deepEqual(await shown(), ["c.md"]);
|
|
||||||
|
|
||||||
// The middle of the pane already shows the tab, so it is no drop target. The right part opens a new pane.
|
|
||||||
await dragTo("c.md", pane("c.md"), "center");
|
|
||||||
await page.waitForTimeout(200);
|
|
||||||
assert.equal(await hint.count(), 0, "The middle of the pane does not take its own tab");
|
|
||||||
const area = await box(page.locator("main.center"));
|
|
||||||
await page.mouse.move(area.x + area.width - 30, area.y + area.height / 2, { steps: 5 });
|
|
||||||
await page.locator('.drop-hint[data-drop-zone="right"]').waitFor();
|
|
||||||
await page.screenshot({ path: path.join(output, "visible-tab-hint.png") });
|
|
||||||
await page.mouse.up();
|
|
||||||
await pane("b.md").locator(".cm-content").waitFor();
|
|
||||||
assert.equal(await hint.count(), 0);
|
|
||||||
// c.md is the last tab, so its pane shows the tab before it.
|
|
||||||
assert.deepEqual(await shown(), ["b.md", "c.md"], "The tab moves to the right, and its pane shows the tab before it");
|
|
||||||
assert.match(await activeTab(), /c\.md/, "The moved tab stays the active tab");
|
|
||||||
const left = await box(pane("b.md")), right = await box(pane("c.md"));
|
|
||||||
assert.ok(right.x >= left.x + left.width - 1 && Math.abs(left.y - right.y) < 2, "The panes show side by side");
|
|
||||||
assert.equal(await page.getByRole("tab").count(), 3, "All tabs stay open");
|
|
||||||
|
|
||||||
// The tab of the left pane moves below it. The pane shows the only tab that no pane shows.
|
|
||||||
await dragTo("b.md", pane("b.md"), "down");
|
|
||||||
await page.locator('.drop-hint[data-drop-zone="down"]').waitFor();
|
|
||||||
await page.mouse.up();
|
|
||||||
await pane("a.md").locator(".cm-content").waitFor();
|
|
||||||
assert.equal(await page.locator(".document-pane").count(), 3);
|
|
||||||
const top = await box(pane("a.md")), bottom = await box(pane("b.md"));
|
|
||||||
assert.ok(bottom.y >= top.y + top.height - 1 && Math.abs(top.x - bottom.x) < 2, "The moved tab shows below its old pane");
|
|
||||||
assert.match(await activeTab(), /b\.md/);
|
|
||||||
|
|
||||||
// Each tab now shows in a pane, so a pane has no other tab to show. The drag shows no hint.
|
|
||||||
await dragTo("a.md", pane("a.md"), "right");
|
|
||||||
await page.waitForTimeout(200);
|
|
||||||
assert.equal(await hint.count(), 0, "No tab is free for the pane");
|
|
||||||
await page.mouse.up();
|
|
||||||
assert.equal(await page.locator(".document-pane").count(), 3);
|
|
||||||
|
|
||||||
// A browser tab that covers the area moves to a new pane on the right. The document below it shows on the left.
|
|
||||||
for (let panes = 3; panes > 1; panes--) await page.getByRole("button", { name: "Close split", exact: true }).first().click();
|
|
||||||
assert.equal(await page.locator(".document-pane").count(), 1);
|
|
||||||
const below = (await shown())[0];
|
|
||||||
await page.waitForFunction(async () => { const { pluginHost } = await import("/src/lib/plugins/registry.ts"); return !!pluginHost.get("browser"); });
|
|
||||||
await page.evaluate(async () => { const { pluginHost } = await import("/src/lib/plugins/registry.ts"); await pluginHost.get("browser").newTab(); });
|
|
||||||
await page.locator('[data-browser-state="ready"]').waitFor();
|
|
||||||
assert.ok((await box(browserPane)).width > area.width - 4, "The browser covers the area");
|
|
||||||
await dragTo("Browser", page.locator("main.center"), "right");
|
|
||||||
await page.locator('.drop-hint[data-drop-zone="right"]').waitFor();
|
|
||||||
await page.mouse.up();
|
|
||||||
await pane(below).locator(".cm-content").waitFor();
|
|
||||||
const documentBox = await box(pane(below)), webBox = await box(browserPane);
|
|
||||||
assert.ok(webBox.x >= documentBox.x + documentBox.width - 1, "The browser shows to the right of the document");
|
|
||||||
assert.match(await activeTab(), /Browser/);
|
|
||||||
|
|
||||||
// A tab that no pane shows opens in a new pane on the left side of the browser pane (card 156758f1).
|
|
||||||
const free = ["a.md", "b.md", "c.md"].find(name => name !== below);
|
|
||||||
await dragTo(free, browserPane, "left");
|
|
||||||
await page.locator('.drop-hint[data-drop-zone="left"]').waitFor();
|
|
||||||
const leftHint = await box(hint), browserBefore = await box(browserPane);
|
|
||||||
assert.ok(Math.abs(leftHint.x - browserBefore.x) < 2 && leftHint.width < browserBefore.width * 0.6, "The hint covers the left half of the pane");
|
|
||||||
assert.equal((await hint.innerText()).trim(), "Open to the left");
|
|
||||||
await page.screenshot({ path: path.join(output, "left-drop-hint.png") });
|
|
||||||
await page.mouse.up();
|
|
||||||
await pane(free).locator(".cm-content").waitFor();
|
|
||||||
const first = await box(pane(below)), middle = await box(pane(free)), last = await box(browserPane);
|
|
||||||
assert.ok(first.x + first.width <= middle.x + 1 && middle.x + middle.width <= last.x + 1, "The new pane shows between the document and the browser");
|
|
||||||
assert.match(await activeTab(), new RegExp(free.replace(".", "\\.")));
|
|
||||||
|
|
||||||
// The tab menu closes the split of a tab. The tab stays open, and the other panes stay.
|
|
||||||
const tabCount = await page.getByRole("tab").count();
|
|
||||||
const closeButtons = page.getByRole("button", { name: "Close split", exact: true });
|
|
||||||
assert.equal(await closeButtons.count(), 3, "Each pane bar has a Close split button");
|
|
||||||
assert.equal((await closeButtons.first().innerText()).trim(), "Close split", "The button shows its name");
|
|
||||||
await closeButtons.first().screenshot({ path: path.join(output, "close-split-button.png") });
|
|
||||||
// Screenshots of the pane bars in both themes and in a narrow window.
|
|
||||||
const viewport = page.viewportSize();
|
|
||||||
for (const mode of ["light", "dark"]) {
|
|
||||||
await page.evaluate(async mode => { const { saveAppearance } = await import("/src/lib/theme/appearance.ts"); saveAppearance({ theme: "default", mode }); }, mode);
|
|
||||||
await page.waitForTimeout(150);
|
|
||||||
await page.screenshot({ path: path.join(output, `close-split-${mode}.png`) });
|
|
||||||
}
|
|
||||||
await page.setViewportSize({ width: 760, height: viewport.height });
|
|
||||||
await page.waitForTimeout(200);
|
|
||||||
await page.screenshot({ path: path.join(output, "close-split-narrow.png") });
|
|
||||||
// A narrow pane shows only the icon of the button. The tooltip gives its name.
|
|
||||||
await closeButtons.last().hover();
|
|
||||||
await page.locator(".rs-tooltip:popover-open").filter({ hasText: "Close split" }).waitFor();
|
|
||||||
await page.mouse.move(0, 0);
|
|
||||||
await page.setViewportSize(viewport);
|
|
||||||
await tab(free).click({ button: "right" });
|
|
||||||
await page.getByRole("menuitem", { name: "Close split", exact: true }).click();
|
|
||||||
await page.waitForFunction(count => document.querySelectorAll(".document-pane").length + document.querySelectorAll(".plugin-pane:not(.inactive)").length <= count, 3);
|
|
||||||
assert.deepEqual((await shown()).filter(Boolean), [below], "The pane of the tab closes. The browser pane stays.");
|
|
||||||
assert.equal(await page.getByRole("tab").count(), tabCount, "The tab stays open");
|
|
||||||
// A tab that no pane shows has no Close split item.
|
|
||||||
await tab(free).click({ button: "right" });
|
|
||||||
assert.equal(await page.getByRole("menuitem", { name: "Close split", exact: true }).count(), 0);
|
|
||||||
await page.keyboard.press("Escape");
|
|
||||||
|
|
||||||
console.log(JSON.stringify({ passed: ["one tab shows no hint", "own pane middle is no target", "visible tab moves right", "visible tab moves below", "no free tab shows no hint", "covering browser tab moves right", "free tab opens left of a pane", "tab menu closes a split and keeps the tab"], nativeDesktop: "not tested" }, null, 2));
|
|
||||||
});
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { test } from "node:test";
|
import { test } from "node:test";
|
||||||
import assert from "node:assert/strict";
|
import assert from "node:assert/strict";
|
||||||
import { initialDocumentPanes, syncDocumentPanes, splitDocumentPane, closeDocumentPane, selectPane, readDocumentPane, splitDocumentView, splitWithContent, showInActivePane, paneOf, releaseSolePlugin, dropInPane, moveToNewPane, resizeDocumentPanes } from "../../../src/lib/workspace/documentPanes.ts";
|
import { initialDocumentPanes, syncDocumentPanes, splitDocumentPane, closeDocumentPane, selectPane, readDocumentPane, splitDocumentView, splitWithContent, showInActivePane, paneOf, releaseSolePlugin, dropInPane, resizeDocumentPanes } from "../../../src/lib/workspace/documentPanes.ts";
|
||||||
import { paneBounds, splitDividers, splitSibling, stackLayout, setSplitRatio } from "../../../src/lib/workspace/splitLayout.ts";
|
import { paneBounds, splitDividers, splitSibling, stackLayout, setSplitRatio } from "../../../src/lib/workspace/splitLayout.ts";
|
||||||
import { registerSelection, selectedEditorText } from "../../../src/lib/editor/selection.ts";
|
import { registerSelection, selectedEditorText } from "../../../src/lib/editor/selection.ts";
|
||||||
|
|
||||||
@@ -143,10 +143,6 @@ test("a tab drop replaces the content of a pane or opens a pane beside it, and t
|
|||||||
next = dropInPane(state, { documentId: "c" }, main, "down", "new");
|
next = dropInPane(state, { documentId: "c" }, main, "down", "new");
|
||||||
assert.deepEqual(paneBounds(next.layout).new, { left: 0, top: 50, width: 50, height: 50 });
|
assert.deepEqual(paneBounds(next.layout).new, { left: 0, top: 50, width: 50, height: 50 });
|
||||||
assert.equal(next.active, "new");
|
assert.equal(next.active, "new");
|
||||||
// A drop on the left side of a pane opens a new pane before it.
|
|
||||||
next = dropInPane(state, { documentId: "c" }, "right", "left", "new");
|
|
||||||
assert.deepEqual(paneBounds(next.layout), { [main]: { left: 0, top: 0, width: 50, height: 100 }, new: { left: 50, top: 0, width: 25, height: 100 }, right: { left: 75, top: 0, width: 25, height: 100 } });
|
|
||||||
assert.equal(next.active, "new");
|
|
||||||
// A visible tab moves: its old pane closes.
|
// A visible tab moves: its old pane closes.
|
||||||
next = dropInPane(state, { pluginKey: "web" }, main, "down", "new");
|
next = dropInPane(state, { pluginKey: "web" }, main, "down", "new");
|
||||||
assert.deepEqual(next.panes.map(pane => [pane.id, pane.pluginKey]), [[main, null], ["new", "web"]]);
|
assert.deepEqual(next.panes.map(pane => [pane.id, pane.pluginKey]), [[main, null], ["new", "web"]]);
|
||||||
@@ -158,27 +154,3 @@ test("a tab drop replaces the content of a pane or opens a pane beside it, and t
|
|||||||
assert.equal(dropInPane(state, { documentId: "a" }, "missing", "center", "new"), state);
|
assert.equal(dropInPane(state, { documentId: "a" }, "missing", "center", "new"), state);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("the content of a pane moves to a new pane beside it, and the pane shows other content", () => {
|
|
||||||
let state = syncDocumentPanes(initialDocumentPanes(), ["a", "b", "c"], "a");
|
|
||||||
const main = state.active;
|
|
||||||
state = readDocumentPane(state, main, true);
|
|
||||||
// The visible document moves to the right. Its pane shows the next document, in the default view.
|
|
||||||
let next = moveToNewPane(state, main, { documentId: "b" }, { documentId: "a" }, "right", "new");
|
|
||||||
assert.deepEqual(next.panes.map(pane => [pane.id, pane.documentId, pane.reading]), [[main, "b", false], ["new", "a", false]]);
|
|
||||||
assert.deepEqual(paneBounds(next.layout).new, { left: 50, top: 0, width: 50, height: 100 });
|
|
||||||
assert.equal(next.active, "new");
|
|
||||||
// A plugin view that covers the area moves below. The pane keeps its document and its view.
|
|
||||||
next = moveToNewPane(state, main, { documentId: "a" }, { pluginKey: "web" }, "down", "new");
|
|
||||||
assert.deepEqual(next.panes.map(pane => [pane.documentId, pane.pluginKey, pane.reading]), [["a", null, true], [null, "web", false]]);
|
|
||||||
assert.deepEqual(paneBounds(next.layout).new, { left: 0, top: 50, width: 100, height: 50 });
|
|
||||||
// The visible document moves to a new pane on the left.
|
|
||||||
next = moveToNewPane(state, main, { documentId: "b" }, { documentId: "a" }, "left", "new");
|
|
||||||
assert.deepEqual(next.panes.map(pane => [pane.id, pane.documentId]), [[main, "b"], ["new", "a"]]);
|
|
||||||
assert.deepEqual(paneBounds(next.layout), { new: { left: 0, top: 0, width: 50, height: 100 }, [main]: { left: 50, top: 0, width: 50, height: 100 } });
|
|
||||||
next = moveToNewPane(state, main, { documentId: "a" }, { pluginKey: "web" }, "down", "new");
|
|
||||||
// Content that a different pane shows cannot stay, and cannot move from this pane.
|
|
||||||
assert.equal(moveToNewPane(next, main, { pluginKey: "web" }, { documentId: "a" }, "right", "third"), next);
|
|
||||||
assert.equal(moveToNewPane(next, main, { documentId: "b" }, { pluginKey: "web" }, "right", "third"), next);
|
|
||||||
assert.equal(moveToNewPane(state, "missing", { documentId: "b" }, { documentId: "a" }, "right", "new"), state);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|||||||
@@ -116,17 +116,3 @@ test('A failed write reaches the caller', async () => {
|
|||||||
handlers.set('settings_write', () => { throw 'Disk full'; });
|
handlers.set('settings_write', () => { throw 'Disk full'; });
|
||||||
await assert.rejects(store.writeSection('customThemes', []), /Disk full/);
|
await assert.rejects(store.writeSection('customThemes', []), /Disk full/);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('The same data in a different key order is the same settings value', () => {
|
|
||||||
const saved = { theme: 'harvest-moon', mode: 'dark', transparency: { enabled: true, amount: 18 }, targets: ['app', 'pm-all'] };
|
|
||||||
// The host sends the keys back in alphabetical order.
|
|
||||||
const fromHost = { mode: 'dark', targets: ['app', 'pm-all'], theme: 'harvest-moon', transparency: { amount: 18, enabled: true } };
|
|
||||||
assert.notEqual(JSON.stringify(saved), JSON.stringify(fromHost));
|
|
||||||
assert.ok(store.sameSettingsValue(saved, fromHost));
|
|
||||||
assert.ok(!store.sameSettingsValue(saved, { ...fromHost, mode: 'light' }));
|
|
||||||
assert.ok(!store.sameSettingsValue(saved, { ...fromHost, targets: ['pm-all', 'app'] }), 'The order of an array counts');
|
|
||||||
assert.ok(!store.sameSettingsValue(saved, { ...fromHost, extra: 1 }));
|
|
||||||
assert.ok(store.sameSettingsValue('en', 'en'));
|
|
||||||
assert.ok(store.sameSettingsValue(null, null));
|
|
||||||
assert.ok(!store.sameSettingsValue(null, {}));
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import { test } from 'node:test';
|
|||||||
import { parseCustomTheme } from '../../../src/lib/theme/customThemes.ts';
|
import { parseCustomTheme } from '../../../src/lib/theme/customThemes.ts';
|
||||||
import { SYNTAX_ROLES } from '../../../src/lib/theme/roles.ts';
|
import { SYNTAX_ROLES } from '../../../src/lib/theme/roles.ts';
|
||||||
import { parseAppearance, normalizeAppearance, exportAppearanceTheme, BUILTIN_THEMES, THEMES, themeModes } from '../../../src/lib/theme/appearance.ts';
|
import { parseAppearance, normalizeAppearance, exportAppearanceTheme, BUILTIN_THEMES, THEMES, themeModes } from '../../../src/lib/theme/appearance.ts';
|
||||||
import { sameSettingsValue } from '../../../src/lib/settings/store.ts';
|
|
||||||
|
|
||||||
test('Removed palettes preserve the saved mode with the default palette', () => {
|
test('Removed palettes preserve the saved mode with the default palette', () => {
|
||||||
for (const theme of ['gpt', 'terminal', 'unknown', 'renamon', 'asuka-school']) {
|
for (const theme of ['gpt', 'terminal', 'unknown', 'renamon', 'asuka-school']) {
|
||||||
@@ -85,19 +84,3 @@ test('Background image references clamp the overlay and discard obsolete colors'
|
|||||||
assert.deepEqual(normalizeAppearance({ newTabBackground: { imageId, overlay: NaN } }).newTabBackground, { imageId, overlay: 0, ...layout });
|
assert.deepEqual(normalizeAppearance({ newTabBackground: { imageId, overlay: NaN } }).newTabBackground, { imageId, overlay: 0, ...layout });
|
||||||
assert.equal(normalizeAppearance({ newTabBackground: { imageId: 'invalid' } }).newTabBackground, undefined);
|
assert.equal(normalizeAppearance({ newTabBackground: { imageId: 'invalid' } }).newTabBackground, undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('A valid appearance from the host needs no new save, although the host sorted its keys', () => {
|
|
||||||
// ThemeSync saves the normalized appearance only when it differs from the stored value.
|
|
||||||
// A key-order difference made two windows save the same value to each other without end.
|
|
||||||
const imageId = 'd10adda6-a2ec-4d73-a0a6-2cb1ed43bebc';
|
|
||||||
const fromHost = [
|
|
||||||
{ mode: 'dark', theme: 'harvest-moon', transparency: { amount: 18, enabled: true } },
|
|
||||||
{ mode: 'light', newTabBackground: { imageId, overlay: 0.2, position: 'center', size: 'cover' }, theme: 'default' },
|
|
||||||
];
|
|
||||||
for (const stored of fromHost) {
|
|
||||||
const normalized = normalizeAppearance(stored);
|
|
||||||
assert.notEqual(JSON.stringify(normalized), JSON.stringify(stored), 'The fixture has a different key order');
|
|
||||||
assert.ok(sameSettingsValue(stored, normalized), JSON.stringify(stored));
|
|
||||||
}
|
|
||||||
assert.ok(!sameSettingsValue({ mode: 'dark', theme: 'holo' }, normalizeAppearance({ mode: 'dark', theme: 'holo' })), 'A renamed theme still gets saved');
|
|
||||||
});
|
|
||||||
|
|||||||
Reference in New Issue
Block a user