bdf.mbt 2026.11.4 → 2026.11.6

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.
package/README.md CHANGED
@@ -126,6 +126,45 @@ A bundler may resolve `import { bdf_create_native_converter } from "bdf.mbt"`
126
126
  in application code, but must also emit the Worker assets or use these static
127
127
  URLs. Page import maps do not apply inside Workers.
128
128
 
129
+ ### Selecting and copying
130
+
131
+ The current staging build exposes `bdf_create_viewer`,
132
+ `bdf_selection_text`, and `bdf_selection_cells_async` from `bdf.mbt`.
133
+ For a selected range of cells, the async function returns an object with
134
+ `text` (TSV) and `html`; it waits for tiles that have not been visited.
135
+ It returns no cell result for an ordinary text selection. A selection inside
136
+ one cell is treated as text. Copy and cut events on the viewer also provide
137
+ the two formats for a cell range. If the browser refuses clipboard access,
138
+ the host receives `clipboarderror`.
139
+
140
+ For callers that already know a sheet view ID and a zero-based, inclusive
141
+ rectangle, the render Worker client can retrieve the same formats without a
142
+ DOM selection:
143
+
144
+ ```js
145
+ import { bdf_render_worker_client } from "bdf.mbt";
146
+ const client = bdf_render_worker_client(new Worker("/bdf.mbt-dist/workers/render_worker.js", { type: "module" }));
147
+ await client.open({ kind: "buffer", buffer: bdfBytes.buffer });
148
+ const { text, html } = await client.sheetClipboard(sheetViewId, {
149
+ row0: 0, col0: 0, row1: 4, col1: 2,
150
+ });
151
+ client.terminate();
152
+ ```
153
+
154
+ Use an `ArrayBuffer` containing exactly the BDF bytes. Merged cells are
155
+ expanded and hidden rows and columns omitted. Results and ranges are bounded;
156
+ invalid or oversized requests reject. A current limitation is that embedded
157
+ line breaks and tabs in some converted CSV cells become spaces when copied.
158
+ The generated browser declarations currently type the renderer client and
159
+ selection result as `any`; consumers should validate results at their boundary.
160
+
161
+ In a multipage viewer, rendering a page does not guarantee its text is ready.
162
+ An incomplete page-spanning copy is refused with `clipboarderror` while text
163
+ is loaded; `clipboardready` signals that the user can copy again. This is
164
+ separate from browser clipboard permission. The selection is cleared if a
165
+ selected page is replaced. Verify these behaviors against the version used by
166
+ the application; the first published version predates this staging build.
167
+
129
168
  To use native builtins instead, choose
130
169
  `/bdf.mbt-dist/workers/native_converter_worker.js` as the Worker URL and use
131
170
  options supported by the selected native format.
@@ -362,6 +401,8 @@ converted document; every route produces the same input for `exportPdf`.
362
401
  | Page size, view selection | Page-less views warn; a selection with no page rejects. |
363
402
  | Text, cells of a form grid, floats in Japanese | Drawn with the document's fonts, or the `fallbackFont` subset. |
364
403
  | Vector paths, fills, colors, links | As the writer draws them. |
404
+ | Opaque axial and radial fills, including text | Stops must include 0 and 1 and stay distinct at PDF numeric precision. |
405
+ | Opaque axial and radial path and rectangle strokes | The same stop restrictions apply. |
365
406
  | Annotations of a link, document metadata title and author | Link targets come from the document. |
366
407
 
367
408
  | Not reproduced (the result warns) | Message |
@@ -370,8 +411,8 @@ converted document; every route produces the same input for `exportPdf`.
370
411
  | Cropped images | `a cropped image is omitted` |
371
412
  | Shadows | `a shadow is omitted` |
372
413
  | Image filters | `an image filter is omitted` |
373
- | Gradients | `gradients are approximated with a solid colour` |
374
- | Pattern fills | `a pattern fill is drawn with its solid colour` |
414
+ | Other gradient fills and strokes, including text strokes | `gradients are approximated with a solid colour` |
415
+ | Pattern path fills | `a pattern fill is drawn with its solid colour` |
375
416
  | Masks | `a mask is omitted; its mask content is not drawn` |
376
417
  | Tagged structure (`tagged: true`) | `tagged PDF structure is not written yet` |
377
418
  | Characters the fallback font lacks | `the fallback font has no glyph for: …` |
@@ -382,7 +423,8 @@ converted document; every route produces the same input for `exportPdf`.
382
423
 
383
424
  Treat any warning as a visible omission: a result with warnings is not a
384
425
  faithful reproduction of the source document, so surfaces that show it
385
- should say so. Tagged/PDF-A signatures, images and Office round-trips are
426
+ should say so. Rectangular pattern fills can also fall back to a solid color
427
+ without a warning. Tagged/PDF-A signatures, images and Office round-trips are
386
428
  outside this writer's scope.
387
429
 
388
430
  ## TypeScript plugin checking
package/dist/browser.d.ts CHANGED
@@ -132,6 +132,13 @@ export function encrypt_bdf_password(data: MoonBit.Bytes,
132
132
  password: MoonBit.String,
133
133
  iterations: MoonBit.Int): any;
134
134
 
135
+ export function encrypt_bdf_segment_ecdh(data: MoonBit.Bytes,
136
+ public_key: MoonBit.Bytes,
137
+ view: MoonBit.String,
138
+ page: MoonBit.Int,
139
+ pages: MoonBit.Int,
140
+ have_json: MoonBit.String): any;
141
+
135
142
  export function render_bdf_sheet_region_split_async(host: any,
136
143
  manifest: MoonBit.Bytes,
137
144
  loader: any,