7w1 e378a0fe7a Add image viewer rework (#686)
<!-- Please read
https://github.com/SableClient/Sable/blob/dev/CONTRIBUTING.md before
submitting your pull request -->

### Description

<!-- Please include a summary of the change. Please also include
relevant motivation and context. List any dependencies that are required
for this change. -->

I've fixed many issues with the image viewer, while also adding some
intuitive functionality.

Fixes:
- Inline styles that aren't changed dynamically have been moved to the
CSS.
- The Zoom % pill no longer changes size except for manual zoom over
500%. This prevents the +/- buttons from moving as they are being
clicked.
- Transitions are now disabled for manual panning to improve
responsiveness.
- Images are now scaled independently of browser dimensions. This means
that 100% zoom will always refer to the image's native size, and zoomed
images will be rendered at full quality. (Previously, a small browser
window would shrink the base image such that zooming in would make it
visibly blurry.)
- Pinch gestures generally did not work before (as their detection was
usually overridden by the double tap detection, since pinching
inherently involves using two fingers); This should be fixed. (Waiting
for a deployment to test properly!)
- The double tap gesture will no longer be triggered by extremely fast
double taps, to prevent accidental triggers.

Changes:
- The Zoom % pill now allows entering a custom zoom value, rather than
resetting to 100% zoom on click.
- Related to the previous change, there is now a View Original Size
button (with a photo icon) that only appears when you aren't already at
100% zoom.
- With the image scaling changes, I *have* reasonably kept the original
behavior, with alterations to stay intuitive: Until an image being
viewed is manually panned or zoomed (or the view is reset), it is
automatically scaled to fit the container it's in.
- Related to the previous change, there is a Reset View button (with a
refresh icon) that only appears when you have manually panned or zoomed
away from the initial rendered position.
- The default rendering style for images is now `pixelated`; this
preserves detail for smaller images, especially pixel art, and
*shouldn't* be relevant for larger images, but it's a change I'm willing
to revert.

Known issues:
- The Reset View button doesn't animate the transition back to the
original view, but the View Original Size button does. I could not
figure out how to get this to work properly.
- Some functionalities/changes I'd make aren't possible without
project-wide reworks:
- Some of the buttons' functionalities would be much clearer with
tooltips, but *no* components use browser-level tooltips and I don't
feel confident adding the pop-up tooltips used in the sidebar.
- I would add a border to the Download button for better contrast, but
the only "Primary"-colored button I've seen with borders is the Mark All
As Read button, so changing that would require a broader scope.
- Some of these changes may need to be put into the PDF viewer as well,
or perhaps we should combine those two things at some point?
- It feels disingenuous for me to bundle a bug fix with added
functionality, but the process of fixing these bugs led to gaps that
needed to be filled; If necessary, we can try to separate this into two
PRs, but I assume the functionality will be appreciated already.
- This needs a changeset, but I'm not sure exactly how much of this will
make sense to put into it, since it's a fairly big change.

#### Type of change

- [x] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [x] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update

### Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings

### AI disclosure:

- [x] Partially AI assisted (clarify which code was AI assisted and
briefly explain what it does).
- [ ] Fully AI generated (explain what all the generated code does in
moderate detail).
<!-- Write any explanation required here, but do not generate the
explanation using AI!! You must prove you understand what the code in
this PR does. -->
I used AI to help wire gestures correctly and deal with correctly
selectively disabling animation transitions.
2026-05-18 22:42:35 +00:00
2026-05-18 22:42:35 +00:00
2026-05-08 18:04:24 +02:00
2026-05-13 19:26:40 -05:00
2026-05-13 19:26:20 -05:00
2026-05-18 22:42:35 +00:00
2026-03-05 22:34:11 -06:00
2026-05-08 18:04:24 +02:00
2026-03-04 19:21:00 -06:00
2026-05-01 04:59:25 +03:00
2026-05-15 05:03:48 +00:00
2026-03-13 21:38:40 -05:00
2026-05-04 21:50:11 -05:00
2026-05-01 04:59:25 +03:00
2026-03-12 00:31:27 +01:00
2026-05-08 18:04:24 +02:00
2026-05-13 01:42:09 +00:00
2026-05-13 18:28:20 -05:00
2026-05-01 04:59:25 +03:00
2026-05-01 04:59:25 +03:00
2023-02-24 17:28:04 +05:30
2026-05-08 18:04:24 +02:00
2026-05-01 04:59:25 +03:00
2026-05-15 05:03:48 +00:00
2026-05-09 17:49:48 -05:00
2026-05-13 12:42:00 -05:00

Sable

A Matrix client built to enhance the user experience with quality-of-life features, cosmetics, utilities, and sheer usability. See the changelog.

Soon to be replaced desktop apps can be downloaded here. They auto-update by pulling the website.

Join our matrix space here to discuss features, issues, or meowing.

Forked from Cinny.

Getting started

The web app is available at app.sable.moe and gets updated on frequently, as soon as a feature is deemed stable.

You can also download our desktop app for windows and linux from releases.

Self-hosting

You have a few options for self hosting, you can:

  1. Run the prebuilt docker container.
  2. Deploy on a site like GitLab Pages. Jae has a guide here.
  3. Build it yourself.

Docker

Prebuilt images are published to ghcr.io/sableclient/sable.

  • latest tracks the current dev branch image.
  • X.Y.Z tags are versioned releases.
  • X.Y tags float within a release line.
  • Pushes to dev also publish a short commit SHA tag.

Run the latest image with:

docker run --rm -p 8080:8080 ghcr.io/sableclient/sable:latest

Then open http://localhost:8080.

If you want to override the bundled config.json, mount your own file at /app/config.json:

services:
  sable:
    image: ghcr.io/sableclient/sable:latest
    ports:
      - '8080:8080'
    volumes:
      - ./config.json:/app/config.json:ro

Build it yourself

To build and serve Sable yourself with nginx, clone this repo and build it:

pnpm i # Installs all dependencies
pnpm run build # Compiles the app into the dist/ directory

After that, you can copy the dist/ directory to your server and serve it.

  • In the config.json, you can modify the default homeservers, feature rooms/spaces, toggle the account switcher, and toggle experimental simplified slilding sync support.

Optional default client settings

While the default settings are recommended for most users, you can optionally add a top-level "settingsDefaults" object whose keys match client settings (only fields you want to override) to override them. The default settings for any new logins will match these. Existing keys in local storage or users who chose to sync settings with their account data will still have their settings set.

For example:

{
  "settingsDefaults": {
    "hour24Clock": true,
    "pageZoom": 110,
    "messageLayout": 2,
    "rightSwipeAction": "members",
    "captionPosition": "below",
    "renderUserCards": "both",
    "jumboEmojiSize": "large"
  }
}

Invalid or unknown keys are ignored.

  • To deploy on subdirectory, you need to rebuild the app youself after updating the base path in build.config.ts.
    • For example, if you want to deploy on https://sable.moe/app, then set base: '/app'.

Local development

Tip

We recommend using a version manager as versions change quickly. fnm is a great cross-platform option (Windows, macOS, and Linux). NVM on Windows and nvm on Linux/macOS are also good choices. Use the version defined in .node-version.

Execute the following commands to start a development server:

fnm use --corepack-enabled # Activates the Node version and enables corepack
# If you not using fnm, install corepack manually: npm install --global corepack@latest
corepack install # Installs the pnpm version specified in package.json
pnpm i # Installs all dependencies
pnpm run dev # Serve a development version

To build the app:

pnpm run build # Compiles the app into the dist/ directory

Deployment and infrastructure

Deployment workflows and infrastructure details live in infra/README.md.

S
Description
No description provided
Readme AGPL-3.0
107 MiB
0 Stars 1 Watchers 0 Forks
Languages
TypeScript 93.2%
Rust 5.2%
JavaScript 0.8%
Kotlin 0.2%
CSS 0.2%
Other 0.3%