Files
paseo/plugin-examples/modal-ui
Mohamed Boudra 9bce7dbd25 refactor(plugin): unify the client UI entrypoint (#7474)
* fix(files): report document MIME types for binary files

File reads now carry the document's MIME type for binary files, so a file panel can
hand the bytes to a viewer that needs the real type (application/pdf).

* feat(plugins): file panels

Plugins contribute file panels with addFilePanel. A file tab hosts the panels that claim the
file: the built-in Markdown, HTML and image panels, plugin panels, and Source, Paseo's editor,
which claims every text file and is always the last candidate. The panel is the tab body;
the bar shows the document's status and a switcher between the file's panels (side by side
up to three, two on a phone, a menu beyond that).

Paseo asks which panel opens a file only when a plugin panel is among several candidates,
once per open, and remembers the answer per extension or exact filename when told to. Open
with in the tab menu and the switcher change the tab's panel; Always use remembers it.
Opening a file at a line switches the tab to Source.

Panels read and write the host's document, so dirty state, autosave and conflicts stay
Paseo's. DocumentFrame shows bytes documents such as PDFs in the browser's viewer.

Replaces the file tab's Preview/Source mode toggle.

* feat(file-panels): choose and forget file panels in Settings > Files

Settings > Files lists each extension or filename where a plugin panel competes with
another candidate, or that has a remembered panel. Each row chooses the panel that opens
it, or Ask every time; Ask again forgets the choice. Source appears as a candidate for
text files. Panels no connected host offers can be forgotten but not chosen.

* docs(plugins): file panel examples and author reference

Adds the pdf-panel and markdown-panel examples, the File panels section of the plugin
reference, and an e2e spec that installs both examples, opens a PDF in the browser
viewer, and edits Markdown through Paseo's document across the switcher, Source,
autosave and conflicts.

* feat(file-panels): panels read and write through a file handle

The file tab stats the file and mounts its panel without reading it. Every
panel, built-in or plugin, gets a PluginFile handle: readText, readBytes, url,
version-checked writeText/writeBytes (PluginFileConflictError unless force),
and watch. useFileText, useFileBytes and useFileUrl read through it, and
Loading joins @getpaseo/plugin/client/ui. Panels own their loading state.

The host document pipeline, the explorer preview cache and the preview
lifecycle are deleted. The daemon classifies a file version from a bounded
sniff and writes base64 content as bytes behind fileByteWrites.

A deleted file keeps its panel mounted; a read confirms the deletion first,
so a remove-and-rewrite is not reported as one. Native Source decodes with
builtins and highlights in idle-time slices, the lines around the opening
line first, so a large file no longer blocks the JS thread.

* fix(file-panels): Settings offers Source where the picker does, and review follow-ups

- Settings > Files offers Source on every key except those a built-in panel of
  another kind (Image) claims, so a plugin that alone claims a text extension
  shows the same choices as the picker.
- Delete the unused isSourceFilePanel.
- The Markdown example warns with the file name when its unmount write fails,
  rather than dropping the edit silently.
- Document that PluginFile stat fields are read at render time and that watch
  or the read hooks are how a panel learns they changed.

* refactor(plugin): consolidate the client UI entrypoint
2026-10-21 11:12:22 +07:00
..

Modal UI example

Install on a Paseo host with npm source installation support and npm available:

paseo plugin install npm:@getpaseo/plugin-example-modal-ui@0.1.1

In host Settings → Plugins, paste the same npm: identifier into Plugin source. Enable plugins, then open Modal examples from the sidebar or a workspace tab. Choose Open Form, type into Paste here, and watch the Input: text update. The installed plugin ID is modal-ui-example. Host Settings shows the package identity and installed version. With reviewed-update support, run paseo plugin update modal-ui-example --check to check for a newer version, then paseo plugin update modal-ui-example to review and approve it. An explicit install version selects the initial content; later updates still check the latest release.

The package ships the existing TypeScript entry and client sources. Paseo compiles them through its directory plugin loader; no package build or preparation command is required. React, React Native, and @getpaseo/plugin are peer contracts supplied by the host. npm is needed for installation, not loading or reloading. You can also install this directory while developing. See the source reference for supported identifiers and preparation rules.

The examples demonstrate default and custom padding, a full-width body, author-owned ScrollView and FlatList scrolling, horizontal tabs, and clipboard actions with a keyboard-aware input. See the host UI reference for the API contract.

The browser regression installs this exact example in an isolated daemon:

cd packages/app
npx playwright test e2e/browser/plugin-modal-body.spec.ts --project=browser --workers=1

On Android, open each example and drag up on its content to expand the sheet, then scroll the list. In FlatList, expand before using Jump to last row; row 100 should be visible. At the top of either list, drag down on a row to dismiss the sheet. In Form, press Copy text, long-press the input, and choose Paste. The input should contain “Copied from Paseo”. With the system keyboard enabled, focusing the input should keep it visible.

Run the native sheet regression to check body dismissal, list scrolling and horizontal tabs together.

These captures show Android copy/paste and custom padding on browser and wide native layouts. Android API 35 and Chromium were exercised; iOS and Electron were not tested.

Android copy/paste Browser custom padding Wide Android custom padding
Android copy and OS paste Browser custom padding Wide Android custom padding