@protobase/cli 0.94.29 → 0.94.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.94.29";
2
+ var version = "0.94.30";
3
3
  //#endregion
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/cli",
3
- "version": "0.94.29",
3
+ "version": "0.94.30",
4
4
  "description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -43,13 +43,13 @@
43
43
  "dependencies": {
44
44
  "@better-auth/core": "^1.7.12",
45
45
  "@hono/node-server": "^2.1.3",
46
- "@protobase/config": "0.94.29",
47
- "@protobase/layout": "0.94.29",
48
- "@protobase/query": "0.94.29",
49
- "@protobase/schema": "0.94.29",
50
- "@protobase/server": "0.94.29",
51
- "@protobase/ui": "0.94.29",
52
- "@protobase/workflows": "0.94.29",
46
+ "@protobase/config": "0.94.30",
47
+ "@protobase/layout": "0.94.30",
48
+ "@protobase/query": "0.94.30",
49
+ "@protobase/schema": "0.94.30",
50
+ "@protobase/server": "0.94.30",
51
+ "@protobase/ui": "0.94.30",
52
+ "@protobase/workflows": "0.94.30",
53
53
  "@react-email/render": "^2.1.0",
54
54
  "@scalar/hono-api-reference": "^0.12.10",
55
55
  "@sentry/vite-plugin": "^11.10.0",
@@ -12,6 +12,7 @@ Uploaded files and images, where they are kept and how they are served.
12
12
  - [Type detection](../reference/files.md#how-the-type-is-decided): An upload's type is decided from its content, and a disguised file is refused.
13
13
  - [Your own types](../reference/files.md#your-own-types): An app names its own media types and their extensions, and files with them are stored and served as those types.
14
14
  - [File viewers](../reference/files.md#viewers): A plugin registers a viewer for a media type, and a file of that type opens in it in the app instead of downloading.
15
+ - [Image and PDF viewers](../reference/files.md#image-and-pdf-viewers): Two plugins an app can attach open stored images and PDFs in the app, loaded only when such a file opens.
15
16
  - [Signed downloads](../reference/files.md#downloads): Private files open through short-lived links that stop working once the record no longer holds the file.
16
17
  - [Type and size fields](../reference/files.md#type-and-size-fields): Each file's media type and size are kept in columns of their own, for lists and aggregate queries, and serving reads the type from there.
17
18
  - [Derived fields](../reference/files.md#derived-fields): Width, height, size and type of each upload are written to other fields.
@@ -213,6 +213,30 @@ A plugin, or the app's own `protobase.ui.tsx`, registers a viewer for a media ty
213
213
 
214
214
  The viewer gets the file and its **siblings**: the record's other files, and the files of the records of the same resource that point at the same records through filterable relations, read in one list call of at most 100 records. For attachments that each point at a task, the siblings of one are the other attachments of that task, so a report can show the images it names by file name.
215
215
 
216
+ ### Image and PDF viewers
217
+
218
+ Protobase brings no viewer of its own. Two plugins, each a package of its own, open images and PDFs in the app; an app that wants them installs them and extends its `protobase.ui.tsx` with them:
219
+
220
+ ```sh
221
+ npm install @protobase/image-viewer @protobase/pdf-viewer
222
+ ```
223
+
224
+ ```tsx
225
+ // protobase.ui.tsx
226
+ import { defineUi } from '@protobase/ui'
227
+ import imageViewer from '@protobase/image-viewer'
228
+ import pdfViewer from '@protobase/pdf-viewer'
229
+
230
+ export default defineUi({ extends: [imageViewer, pdfViewer] })
231
+ ```
232
+
233
+ Each viewer's code is a chunk of the app's build that loads only when such a file opens, so an app that extends them loads nothing more until then. On a phone both are as wide as the screen. A file a viewer cannot draw shows the Download button in its place.
234
+
235
+ - `@protobase/image-viewer` opens PNG, JPEG, GIF, WebP, AVIF and BMP, the images downloads serve inline: fitted to the page, with its size in pixels and an **Actual size** button that shows it pixel for pixel, scrolling in its own box when it is wider than the page. SVG stays a download.
236
+ - `@protobase/pdf-viewer` opens PDF files with an open-source PDF renderer that runs in a web worker: the pages one under the other, as wide as the page up to 60rem, each drawn when it comes within a screen of being shown and let go again once it is further away, so a long PDF holds only the pages around the screen. Scanned pages in JPEG 2000 or JBIG2 are drawn with the renderer's decoders, which the viewer brings. The renderer reads the file with `fetch`, so a PDF served from another origin than the app's, from a [bucket](#s3-compatible-buckets) or an [external URL](#external-urls)'s host, opens only when that host allows the app's origin with CORS; otherwise the viewer shows the Download button. <gap>The PDF viewer cannot select or search a page's text because a text layer is not implemented, so the page is an image and its text is read in the download.</gap> <gap>The PDF viewer cannot draw text that uses one of the renderer's predefined CMaps, as many Chinese, Japanese and Korean PDFs do whether or not they embed the font, because bringing those CMaps is not implemented, so such text is read in the download.</gap>
237
+
238
+ Each package also exports its viewer component (`ImageViewer`, `PdfViewer`), for an app that registers it for a type of its own in `fileViewers`.
239
+
216
240
  ## Type and size fields
217
241
 
218
242
  `.typeField()` and `.sizeField()` keep each file's media type and size in columns of their own, so a list can show them and SQL can count and sum by them:
@@ -176,7 +176,7 @@ The create form and the record's form pick the members of the organization the s
176
176
 
177
177
  ## File viewers
178
178
 
179
- A file viewer shows files of one media type in the app, such as a report the app writes as JSON, instead of downloading them. A plugin registers it by the type, which the server must know: a built-in type, or one of the app's own in `files.types` (see [Your own types](files.md#your-own-types)).
179
+ A file viewer shows files of one media type in the app, such as a report the app writes as JSON, instead of downloading them. `@protobase/image-viewer` and `@protobase/pdf-viewer` are two such plugins for images and PDFs (see [Image and PDF viewers](files.md#image-and-pdf-viewers)). A plugin registers it by the type, which the server must know: a built-in type, or one of the app's own in `files.types` (see [Your own types](files.md#your-own-types)).
180
180
 
181
181
  ```tsx
182
182
  // protobase.ui.tsx