frameos-wasm 2026.11.13 → 2026.11.14

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
@@ -148,6 +148,26 @@ await preview.resetAssets() // wipe + regenerate the samples
148
148
  `onReady(sceneInfo, assets)` reports whether the folder is persistent or in-memory.
149
149
  Pass `browserAssets: false` for an empty in-memory folder instead.
150
150
 
151
+ ### Files from and to the computer
152
+
153
+ The Files scene has Upload and Download here (`fileTransfer`, on by default; a bundle that has them
154
+ says `runtimeInfo.fileTransfer`). A file picker and a download need a gesture in the page, and the
155
+ tap on Upload is still one when the request arrives a few milliseconds later, so the preview opens
156
+ the picker (or saves the file) at once. When the page has no gesture left
157
+ (`navigator.userActivation.isActive` is false, or the browser cannot say), it calls
158
+ `onFileRequest(request)` instead: show a button whose click calls `preview.answerFileRequest()`,
159
+ and one for `preview.cancelFileRequest()`; `onFileRequest(null)` says it is over. Without
160
+ `onFileRequest` the preview tries anyway. The files picked go into the folder the scene shows, in
161
+ the browser asset folder above.
162
+
163
+ ```ts
164
+ const preview = createFrameOSPreview({
165
+ ...options,
166
+ onFileRequest: (request) => showAsk(request), // {id, op: 'upload' | 'download', name} or null
167
+ })
168
+ askButton.onclick = () => preview.answerFileRequest()
169
+ ```
170
+
151
171
  Helpers for building your own UI are exported too: `evaluateShowIf`, `visiblePublicStateFields`,
152
172
  `coerceStateFieldValue`, `sceneEventButtons`, and the `StateField`/`FrameOSScene` types.
153
173
 
@@ -4570,6 +4570,12 @@ var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => {
4570
4570
  }
4571
4571
  }
4572
4572
 
4573
+ function _frameos_wasm_js_file_request(requestPtr) {
4574
+ if (Module['onFrameosFileRequest']) {
4575
+ Module['onFrameosFileRequest'](UTF8ToString(requestPtr))
4576
+ }
4577
+ }
4578
+
4573
4579
  function _frameos_wasm_js_log(msgPtr) {
4574
4580
  var msg = UTF8ToString(msgPtr)
4575
4581
  if (Module['onFrameosLog']) {
@@ -4768,6 +4774,8 @@ var _free,
4768
4774
  _frameos_wasm_memory_render_headroom,
4769
4775
  _frameos_wasm_memory_used,
4770
4776
  _frameos_wasm_set_store_preview,
4777
+ _frameos_wasm_set_file_transfer,
4778
+ _frameos_wasm_file_transfer_done,
4771
4779
  _frameos_wasm_init,
4772
4780
  _frameos_wasm_load_scenes,
4773
4781
  _frameos_wasm_set_save_assets,
@@ -4832,6 +4840,8 @@ function assignWasmExports(wasmExports) {
4832
4840
  _frameos_wasm_memory_render_headroom = Module['_frameos_wasm_memory_render_headroom'] = wasmExports['frameos_wasm_memory_render_headroom'];
4833
4841
  _frameos_wasm_memory_used = Module['_frameos_wasm_memory_used'] = wasmExports['frameos_wasm_memory_used'];
4834
4842
  _frameos_wasm_set_store_preview = Module['_frameos_wasm_set_store_preview'] = wasmExports['frameos_wasm_set_store_preview'];
4843
+ _frameos_wasm_set_file_transfer = Module['_frameos_wasm_set_file_transfer'] = wasmExports['frameos_wasm_set_file_transfer'];
4844
+ _frameos_wasm_file_transfer_done = Module['_frameos_wasm_file_transfer_done'] = wasmExports['frameos_wasm_file_transfer_done'];
4835
4845
  _frameos_wasm_init = Module['_frameos_wasm_init'] = wasmExports['frameos_wasm_init'];
4836
4846
  _frameos_wasm_load_scenes = Module['_frameos_wasm_load_scenes'] = wasmExports['frameos_wasm_load_scenes'];
4837
4847
  _frameos_wasm_set_save_assets = Module['_frameos_wasm_set_save_assets'] = wasmExports['frameos_wasm_set_save_assets'];
@@ -4953,6 +4963,8 @@ var wasmImports = {
4953
4963
  /** @export */
4954
4964
  frameos_wasm_js_event: _frameos_wasm_js_event,
4955
4965
  /** @export */
4966
+ frameos_wasm_js_file_request: _frameos_wasm_js_file_request,
4967
+ /** @export */
4956
4968
  frameos_wasm_js_log: _frameos_wasm_js_log,
4957
4969
  /** @export */
4958
4970
  frameos_wasm_js_open_link: _frameos_wasm_js_open_link,
Binary file
@@ -16,6 +16,8 @@
16
16
  // Restart and Reboot come out as `sceneEvent`s `restart` / `reboot`, a new scale as `frameSettings`.
17
17
  // sceneState: public field values for the scene it starts on, set before the first render
18
18
  // (`sceneStateSeeded` in `ready` says they were; an older bundle leaves that false).
19
+ // fileTransfer: the page answers `fileRequest`s (a file picker, a download), so the Files scene shows
20
+ // Upload and Download (frameos/file_transfer_preview.nim). `ready`'s `fileTransfer` says the bundle took it.
19
21
  // lanAccess: the previewed cloud frame's local network access (docs/lan-access.md); `false` makes the
20
22
  // runtime refuse private hosts the way that frame would. Absent = nothing to copy, nothing refused.
21
23
  // {type: 'render'} force a render now
@@ -33,6 +35,10 @@
33
35
  // {type: 'assets', requestId, op, ...} browser asset folder ops, see handleAssetsRequest
34
36
  // {type: 'clipboard', text} the browser's clipboard, for the frame's next Paste (docs/jsx-ui.md
35
37
  // "Selecting, copying and pasting"); a bundle without it ignores it
38
+ // {type: 'fileUpload', id, files} the files the person picked for the Files scene's Upload: [{name, data}]
39
+ // (data an ArrayBuffer), written into the folder request `id` named
40
+ // {type: 'fileTransferDone', id, ok, error?} the page's end of request `id` without files: a download saved
41
+ // (ok), or the picker or the save given up (error 'cancelled')
36
42
  // Messages out:
37
43
  // {type: 'ready', sceneInfo, sceneStateSeeded, browserAssets, runtimeVersion, pointerEvents, inputEvents, gpioEvents,
38
44
  // clipboard}
@@ -57,6 +63,10 @@
57
63
  // hotX, hotY, pixels, scale, hideMs}; null for "none")
58
64
  // {type: 'assetsResult', requestId, ok, ...} reply to an 'assets' request
59
65
  // {type: 'clipboard', text} a Copy or a Cut in a JSX field: for the browser's clipboard
66
+ // {type: 'fileRequest', id, op, name, data?} the Files scene asks the page: op 'upload' (pick files from the
67
+ // computer for the folder `name`, answered with `fileUpload`) or
68
+ // 'download' (save `data`, an ArrayBuffer, as `name`, answered with
69
+ // `fileTransferDone`). A new request replaces one still waiting.
60
70
  //
61
71
  // Browser asset folder: the runtime's /srv/assets (the same path a real frame
62
72
  // keeps its assets at) is an emscripten IDBFS mount — files live in this
@@ -643,6 +653,181 @@ async function handleAssetsRequest(msg) {
643
653
  }
644
654
  }
645
655
 
656
+ // ------------------------------------------- files to and from the computer
657
+
658
+ // Upload and Download in the Files scene (frameos/file_transfer_preview.nim).
659
+ // The runtime asks while the scene's tap runs (onFrameosFileRequest); the
660
+ // request goes to the page, because a file picker and a download start from a
661
+ // person's gesture and only the page has one. The page answers with the files
662
+ // picked (`fileUpload`, written here into the folder the runtime named, never
663
+ // one the page names) or with `fileTransferDone`, and the runtime draws the
664
+ // scene that asked again. One request at a time: a new one replaces another
665
+ // still waiting, in the runtime too.
666
+ let fileTransferOn = false
667
+ const fileRequests = new Map() // id -> {op, path}
668
+
669
+ function onFileRequest(text) {
670
+ let request = null
671
+ try {
672
+ request = JSON.parse(text)
673
+ } catch (e) {
674
+ return
675
+ }
676
+ // Out of the runtime's call first: the answer goes back into it.
677
+ setTimeout(() => startFileRequest(request), 0)
678
+ }
679
+
680
+ // A path the runtime named, relative to the assets root, or null for one
681
+ // outside it.
682
+ function assetPathFromRuntime(path) {
683
+ const text = String(path || '')
684
+ if (text !== ASSETS_ROOT && !text.startsWith(ASSETS_ROOT + '/')) {
685
+ return null
686
+ }
687
+ return normalizeAssetPath(text)
688
+ }
689
+
690
+ function baseNameOf(rel) {
691
+ return rel.slice(rel.lastIndexOf('/') + 1)
692
+ }
693
+
694
+ function startFileRequest(request) {
695
+ const id = Number(request && request.id) || 0
696
+ const rel = assetPathFromRuntime(request && request.path)
697
+ fileRequests.clear()
698
+ if (!id || rel === null || !assetsMounted) {
699
+ finishFileRequest(id, false, 0, 'failed')
700
+ return
701
+ }
702
+ if (request.op === 'download') {
703
+ let data
704
+ try {
705
+ const bytes = Module.FS.readFile(assetAbsolutePath(rel))
706
+ data = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength)
707
+ } catch (e) {
708
+ finishFileRequest(id, false, 0, 'failed')
709
+ return
710
+ }
711
+ fileRequests.set(id, { op: 'download', path: rel })
712
+ post({ type: 'fileRequest', id, op: 'download', name: baseNameOf(rel), data }, [data])
713
+ } else if (request.op === 'upload') {
714
+ fileRequests.set(id, { op: 'upload', path: rel })
715
+ post({ type: 'fileRequest', id, op: 'upload', name: rel ? baseNameOf(rel) : '' })
716
+ } else {
717
+ finishFileRequest(id, false, 0, 'failed')
718
+ }
719
+ }
720
+
721
+ // A picked file's name as a name in the folder: no folders, no control
722
+ // characters, no dot first (the listing hides those), not too long.
723
+ function cleanFileName(name) {
724
+ let clean = String(name || '')
725
+ clean = clean.slice(Math.max(clean.lastIndexOf('/'), clean.lastIndexOf('\\')) + 1)
726
+ clean = clean.replace(/[\u0000-\u001f\u007f]/g, '').replace(/^[.\s]+/, '').trim()
727
+ if (clean.length > 120) {
728
+ const dot = clean.lastIndexOf('.')
729
+ const ext = dot > 0 && clean.length - dot <= 10 ? clean.slice(dot) : ''
730
+ clean = clean.slice(0, 120 - ext.length) + ext
731
+ }
732
+ return clean || 'file'
733
+ }
734
+
735
+ function pathExists(path) {
736
+ try {
737
+ Module.FS.stat(path)
738
+ return true
739
+ } catch (e) {
740
+ return false
741
+ }
742
+ }
743
+
744
+ // `name` in `dir`, or "name (2).jpg" and on when that is taken: an upload
745
+ // never replaces a file that is there.
746
+ function freeFileName(dir, name) {
747
+ if (!pathExists(dir + '/' + name)) {
748
+ return name
749
+ }
750
+ const dot = name.lastIndexOf('.')
751
+ const stem = dot > 0 ? name.slice(0, dot) : name
752
+ const ext = dot > 0 ? name.slice(dot) : ''
753
+ for (let n = 2; n < 1000; n++) {
754
+ const next = stem + ' (' + n + ')' + ext
755
+ if (!pathExists(dir + '/' + next)) {
756
+ return next
757
+ }
758
+ }
759
+ return null
760
+ }
761
+
762
+ async function handleFileUpload(msg) {
763
+ const id = Number(msg.id) || 0
764
+ const request = fileRequests.get(id)
765
+ if (!request || request.op !== 'upload') {
766
+ return
767
+ }
768
+ fileRequests.delete(id)
769
+ const files = Array.isArray(msg.files) ? msg.files : []
770
+ let count = 0
771
+ let error = files.length === 0 ? 'cancelled' : ''
772
+ try {
773
+ const dir = assetAbsolutePath(request.path)
774
+ fsEnsureDir(dir)
775
+ let total = assetsTotalBytes()
776
+ for (const file of files) {
777
+ // Any realm's ArrayBuffer (a page's, a test's): Uint8Array reads its bytes.
778
+ const bytes = file && file.data && typeof file.data.byteLength === 'number' ? new Uint8Array(file.data) : new Uint8Array(0)
779
+ if (total + bytes.length > ASSETS_MAX_BYTES) {
780
+ error = 'too_big'
781
+ break
782
+ }
783
+ const name = freeFileName(dir, cleanFileName(file && file.name))
784
+ if (!name) {
785
+ error = 'failed'
786
+ continue
787
+ }
788
+ Module.FS.writeFile(dir + '/' + name, bytes)
789
+ total += bytes.length
790
+ count++
791
+ }
792
+ } catch (e) {
793
+ log('assets: an upload failed: ' + errorText(e))
794
+ error = 'failed'
795
+ }
796
+ if (count > 0) {
797
+ await persistAssets()
798
+ post({ type: 'assetsChanged' })
799
+ }
800
+ finishFileRequest(id, count > 0, count, error)
801
+ }
802
+
803
+ function handleFileTransferDone(msg) {
804
+ const id = Number(msg.id) || 0
805
+ const request = fileRequests.get(id)
806
+ if (!request) {
807
+ return
808
+ }
809
+ fileRequests.delete(id)
810
+ const ok = msg.ok === true && request.op === 'download'
811
+ finishFileRequest(id, ok, ok ? 1 : 0, ok ? '' : String(msg.error || 'cancelled'))
812
+ }
813
+
814
+ function finishFileRequest(id, ok, count, error) {
815
+ if (!Module || outOfMemory || typeof Module._frameos_wasm_file_transfer_done !== 'function') {
816
+ return
817
+ }
818
+ try {
819
+ call('frameos_wasm_file_transfer_done', 'boolean', ['number', 'boolean', 'number', 'string'], [
820
+ id,
821
+ ok,
822
+ count,
823
+ error || '',
824
+ ])
825
+ } catch (e) {
826
+ post({ type: 'error', message: 'file transfer failed: ' + errorText(e) })
827
+ }
828
+ renderSoonIfRequested()
829
+ }
830
+
646
831
  // ------------------------------------------------- simulated device memory
647
832
 
648
833
  // The runtime returns 3 from a render whose allocation was refused under the
@@ -853,6 +1038,8 @@ async function init(msg) {
853
1038
  onFrameosLog: (message) => post({ type: 'log', message }),
854
1039
  // A tapped link (docs/jsx-ui.md "Links"): the page opens it in a tab.
855
1040
  onFrameosOpenLink: (url) => post({ type: 'openLink', url: String(url) }),
1041
+ // Upload / Download in the Files scene: handed to the page (below).
1042
+ onFrameosFileRequest: (text) => onFileRequest(text),
856
1043
  onFrameosEvent: (name, payload) => {
857
1044
  let parsed = {}
858
1045
  try {
@@ -932,6 +1119,15 @@ async function init(msg) {
932
1119
  post({ type: 'log', message: 'the frame page is unavailable in this runtime build' })
933
1120
  }
934
1121
  }
1122
+ // Upload and Download in the Files scene, for a page that opens a file
1123
+ // picker and saves a file when asked (`fileRequest` below). A bundle
1124
+ // without the export shows neither.
1125
+ fileTransferOn = false
1126
+ fileRequests.clear()
1127
+ if (msg.fileTransfer === true && typeof Module._frameos_wasm_set_file_transfer === 'function') {
1128
+ call('frameos_wasm_set_file_transfer', null, ['boolean'], [true])
1129
+ fileTransferOn = true
1130
+ }
935
1131
  // Apps may save into the browser folder (a device's saveAssets setting;
936
1132
  // on by default here — it's the visitor's own browser storage). Pass
937
1133
  // `saveAssets: false` or a {nodeName: bool} map to mirror a frame.
@@ -988,6 +1184,9 @@ async function init(msg) {
988
1184
  cursor: typeof Module._frameos_wasm_cursor === 'function',
989
1185
  // The frame's clipboard is the browser's (2026.11.11): 'clipboard' in and out.
990
1186
  clipboard: hasClipboard(),
1187
+ // Upload and Download in the Files scene (2026.11.14): `fileRequest` out, `fileUpload` and
1188
+ // `fileTransferDone` in.
1189
+ fileTransfer: fileTransferOn,
991
1190
  })
992
1191
  clipboardChanges = hasClipboard() ? call('frameos_wasm_clipboard_changes', 'number', [], []) : -1
993
1192
  renderNow()
@@ -1116,7 +1315,17 @@ function handleEvent(name, payload) {
1116
1315
  // memory (renderNow) the runtime was left mid-render and nothing goes into it
1117
1316
  // again: the page makes a new worker to start over. Clicks went on into it
1118
1317
  // and each came back as "event failed".
1119
- const RUNTIME_MESSAGES = new Set(['render', 'event', 'selectScene', 'resize', 'chooseLayout', 'setRenderScale', 'clipboard'])
1318
+ const RUNTIME_MESSAGES = new Set([
1319
+ 'render',
1320
+ 'event',
1321
+ 'selectScene',
1322
+ 'resize',
1323
+ 'chooseLayout',
1324
+ 'setRenderScale',
1325
+ 'clipboard',
1326
+ 'fileUpload',
1327
+ 'fileTransferDone',
1328
+ ])
1120
1329
 
1121
1330
  self.onmessage = (ev) => {
1122
1331
  const msg = ev.data || {}
@@ -1178,6 +1387,12 @@ self.onmessage = (ev) => {
1178
1387
  case 'clipboard':
1179
1388
  setClipboard(msg.text)
1180
1389
  break
1390
+ case 'fileUpload':
1391
+ void handleFileUpload(msg)
1392
+ break
1393
+ case 'fileTransferDone':
1394
+ handleFileTransferDone(msg)
1395
+ break
1181
1396
  case 'runAppTests':
1182
1397
  handleRunAppTests(msg)
1183
1398
  break
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "2026.11.13",
3
- "release": "2026.11.13",
4
- "commit": "c4d6bb12b29145d893a737cda6f33b11aec8dd54",
5
- "built_at": "2026-11-20T08:31:17Z"
2
+ "version": "2026.11.14",
3
+ "release": "2026.11.14",
4
+ "commit": "10c03217a2222072d25d1dc190b102f7f6ff2730",
5
+ "built_at": "2026-11-22T02:05:30Z"
6
6
  }
package/dist/devices.d.ts CHANGED
@@ -11,7 +11,7 @@ export interface DeviceLimits {
11
11
  * device's own bytes — the ones its logs report. */
12
12
  previewOverheadBytes: number;
13
13
  /** Bytes per pixel of the canvas the device keeps (esp32CanvasBytesPerPixel:
14
- * 2 RGB565, 1 luma, 4 RGBX; a Pi's is RGBX). A runtime that runs as an
14
+ * 2 RGB565, 1 luma, 0.5 sixteen greys; a Pi's is RGBX). A runtime that runs as an
15
15
  * ESP32 draws every render into one canvas of it, as the frame does; the
16
16
  * bytes it saves against RGBX stay charged, so `memoryBytes` and
17
17
  * `previewOverheadBytes` read the same with a runtime that predates it. */
@@ -45,12 +45,10 @@ export declare const ESP32_PIXEL_RGB565 = 9;
45
45
  /** Bytes per canvas pixel on an ESP32 (fos_render_canvas_bits_per_pixel, over 8),
46
46
  * decided by the panel's format first (the frame's `hardware.pixelFormat`;
47
47
  * null when unknown): half a byte on a sixteen-grey panel, one byte of luma
48
- * on another grey or black-and-white panel, RGB565 on an RGB565 LCD, whatever
49
- * the PSRAM. A colour e-paper panel gets
50
- * RGBX while two of it fit PSRAM, RGB565 beyond — which is where a 13.3"
51
- * panel on an 8 MB board lands, and a 16 MB board does not (verified against
52
- * a live 16 MB frame: 6,537 KB free PSRAM mid-scene at 1200x1600 is exactly
53
- * an RGBX canvas plus the panel buffer and the reserve). */
48
+ * on another grey or black-and-white panel, RGB565 on any other (an RGB565
49
+ * LCD, a colour e-paper), whatever the PSRAM. Up to 2026.11.13 a colour
50
+ * e-paper panel got RGBX while two of it fitted PSRAM; `psramBytes` no longer
51
+ * decides. */
54
52
  export declare function esp32CanvasBytesPerPixel(width: number, height: number, psramBytes?: number, pixelFormat?: number | null): number;
55
53
  /** The grey panel formats (fos_pixel_format_t, the firmware's
56
54
  * `fos_pixel_format_is_grey`): 1 black and white, 4 and 8 four and sixteen
@@ -62,15 +60,26 @@ export declare const ESP32_SHARED_CANVAS_FIRMWARE = "2026.11.6";
62
60
  /** The first firmware that packs a colour panel's picture into its own 565
63
61
  * canvas (esp32CanvasIsPanelBuffer). Older firmware keeps the two apart. */
64
62
  export declare const ESP32_PACK_IN_CANVAS_FIRMWARE = "2026.11.10";
63
+ /** A colour panel's picture is packed into its canvas only where the canvas
64
+ * and a panel buffer apart would take more than this share of the PSRAM
65
+ * (main.c PACK_IN_CANVAS_PSRAM_SHARE_DIVISOR): the canvas is the display's
66
+ * for the whole refresh, so the next render waits for the glass. */
67
+ export declare const ESP32_PACK_IN_CANVAS_PSRAM_SHARE_DIVISOR = 2;
68
+ /** frameos_display.c panel_buffer_size for a colour e-paper panel: rows of
69
+ * whole bytes, four pixels a byte for four colours (5), two for seven or
70
+ * Spectra 6. */
71
+ export declare function esp32PalettePanelBufferBytes(width: number, height: number, pixelFormat: number | null): number;
65
72
  /** Whether the scene canvas is the panel buffer itself while nothing turns
66
73
  * it: a sixteen-grey panel's 4-bit canvas is its packed picture byte for byte
67
74
  * (the firmware's main.c canvas_is_panel_picture: one 1.31 MB buffer on a
68
75
  * reTerminal E1003, not two), and a colour panel's picture is packed into the
69
- * first bytes of its 565 canvas (main.c canvas_holds_panel_picture: 960 KB
70
- * back on a reTerminal E1004). `rotate` is the frame's rotation, null when it
71
- * is not known or the firmware keeps two buffers (esp32CanvasRotation);
72
- * `canvasBytesPerPixel` the canvas (esp32CanvasBytesPerPixel). */
73
- export declare function esp32CanvasIsPanelBuffer(pixelFormat: number | null, rotate: number | null, canvasBytesPerPixel?: number | null): boolean;
76
+ * first bytes of its 565 canvas where the two apart would take more than half
77
+ * the PSRAM (main.c canvas_holds_panel_picture: 960 KB back on a reTerminal
78
+ * E1004; an 800x480 board or a 1200x1600 panel on 16 MB keeps a buffer of its
79
+ * own). `rotate` is the frame's rotation, null when it is not known or the
80
+ * firmware keeps two buffers (esp32CanvasRotation); `canvasBytesPerPixel` the
81
+ * canvas (esp32CanvasBytesPerPixel). */
82
+ export declare function esp32CanvasIsPanelBuffer(pixelFormat: number | null, rotate: number | null, canvasBytesPerPixel: number | null, width: number, height: number, psramBytes: number): boolean;
74
83
  /** The rotation to give the limits for a frame that reports `rotate` and runs
75
84
  * `firmwareVersion`: its own on firmware that draws a sixteen-grey scene in
76
85
  * the panel buffer (or, for a colour panel, `pixelFormat` 5 to 7, packs its
package/dist/devices.js CHANGED
@@ -20,10 +20,6 @@
20
20
  // ------------------------------------------------------------------- ESP32
21
21
  /** FOS_NIM_EMERGENCY_RESERVE_BYTES: armed at boot, outside the render budget. */
22
22
  const ESP32_EMERGENCY_RESERVE_BYTES = 1024 * 1024;
23
- /** FOS_RENDER_CANVAS_RGBX_MAX_PSRAM_SHARE (frameos_display.h): the canvas is
24
- * RGBX only while two of it fit the PSRAM heap; past that it is one byte of
25
- * luma on a grey panel, RGB565 on any other. */
26
- const ESP32_RGBX_MAX_PSRAM_SHARE = 2;
27
23
  /** What the boards report as `hardware.memory.psramBytes`. Both are the whole
28
24
  * chip: a 16 MB module registers all of it with the heap. */
29
25
  const ESP32_PSRAM_BYTES = 8 * 1024 * 1024;
@@ -62,7 +58,7 @@ export const devicePresets = [
62
58
  {
63
59
  key: 'esp32_16mb',
64
60
  label: 'ESP32 · 16 MB PSRAM',
65
- description: 'A 16 MB ESP32-S3 frame: room for a full RGBX canvas and several megabytes on top.',
61
+ description: 'A 16 MB ESP32-S3 frame: several megabytes more than an 8 MB one.',
66
62
  },
67
63
  {
68
64
  key: 'esp32',
@@ -81,12 +77,10 @@ export const ESP32_PIXEL_RGB565 = 9;
81
77
  /** Bytes per canvas pixel on an ESP32 (fos_render_canvas_bits_per_pixel, over 8),
82
78
  * decided by the panel's format first (the frame's `hardware.pixelFormat`;
83
79
  * null when unknown): half a byte on a sixteen-grey panel, one byte of luma
84
- * on another grey or black-and-white panel, RGB565 on an RGB565 LCD, whatever
85
- * the PSRAM. A colour e-paper panel gets
86
- * RGBX while two of it fit PSRAM, RGB565 beyond — which is where a 13.3"
87
- * panel on an 8 MB board lands, and a 16 MB board does not (verified against
88
- * a live 16 MB frame: 6,537 KB free PSRAM mid-scene at 1200x1600 is exactly
89
- * an RGBX canvas plus the panel buffer and the reserve). */
80
+ * on another grey or black-and-white panel, RGB565 on any other (an RGB565
81
+ * LCD, a colour e-paper), whatever the PSRAM. Up to 2026.11.13 a colour
82
+ * e-paper panel got RGBX while two of it fitted PSRAM; `psramBytes` no longer
83
+ * decides. */
90
84
  export function esp32CanvasBytesPerPixel(width, height, psramBytes = ESP32_PSRAM_BYTES, pixelFormat = null) {
91
85
  if (pixelFormat === ESP32_PIXEL_4BPP_GRAY) {
92
86
  return 0.5;
@@ -94,13 +88,6 @@ export function esp32CanvasBytesPerPixel(width, height, psramBytes = ESP32_PSRAM
94
88
  if (esp32PixelFormatIsGrey(pixelFormat)) {
95
89
  return 1;
96
90
  }
97
- if (pixelFormat === ESP32_PIXEL_RGB565) {
98
- return 2;
99
- }
100
- const pixels = Math.max(1, width) * Math.max(1, height);
101
- if (pixels * 4 * ESP32_RGBX_MAX_PSRAM_SHARE <= psramBytes) {
102
- return 4;
103
- }
104
91
  return 2;
105
92
  }
106
93
  /** fos_pixel_format_t's sixteen greys, whose canvas is 4-bit. */
@@ -122,18 +109,38 @@ export const ESP32_PACK_IN_CANVAS_FIRMWARE = '2026.11.10';
122
109
  function esp32PixelFormatIsPalette(pixelFormat) {
123
110
  return pixelFormat === 5 || pixelFormat === 6 || pixelFormat === 7;
124
111
  }
112
+ /** A colour panel's picture is packed into its canvas only where the canvas
113
+ * and a panel buffer apart would take more than this share of the PSRAM
114
+ * (main.c PACK_IN_CANVAS_PSRAM_SHARE_DIVISOR): the canvas is the display's
115
+ * for the whole refresh, so the next render waits for the glass. */
116
+ export const ESP32_PACK_IN_CANVAS_PSRAM_SHARE_DIVISOR = 2;
117
+ /** frameos_display.c panel_buffer_size for a colour e-paper panel: rows of
118
+ * whole bytes, four pixels a byte for four colours (5), two for seven or
119
+ * Spectra 6. */
120
+ export function esp32PalettePanelBufferBytes(width, height, pixelFormat) {
121
+ const pixelsPerByte = pixelFormat === 5 ? 4 : 2;
122
+ return Math.ceil(Math.max(1, width) / pixelsPerByte) * Math.max(1, height);
123
+ }
125
124
  /** Whether the scene canvas is the panel buffer itself while nothing turns
126
125
  * it: a sixteen-grey panel's 4-bit canvas is its packed picture byte for byte
127
126
  * (the firmware's main.c canvas_is_panel_picture: one 1.31 MB buffer on a
128
127
  * reTerminal E1003, not two), and a colour panel's picture is packed into the
129
- * first bytes of its 565 canvas (main.c canvas_holds_panel_picture: 960 KB
130
- * back on a reTerminal E1004). `rotate` is the frame's rotation, null when it
131
- * is not known or the firmware keeps two buffers (esp32CanvasRotation);
132
- * `canvasBytesPerPixel` the canvas (esp32CanvasBytesPerPixel). */
133
- export function esp32CanvasIsPanelBuffer(pixelFormat, rotate, canvasBytesPerPixel = null) {
128
+ * first bytes of its 565 canvas where the two apart would take more than half
129
+ * the PSRAM (main.c canvas_holds_panel_picture: 960 KB back on a reTerminal
130
+ * E1004; an 800x480 board or a 1200x1600 panel on 16 MB keeps a buffer of its
131
+ * own). `rotate` is the frame's rotation, null when it is not known or the
132
+ * firmware keeps two buffers (esp32CanvasRotation); `canvasBytesPerPixel` the
133
+ * canvas (esp32CanvasBytesPerPixel). */
134
+ export function esp32CanvasIsPanelBuffer(pixelFormat, rotate, canvasBytesPerPixel, width, height, psramBytes) {
134
135
  if (rotate !== 0)
135
136
  return false;
136
- return (pixelFormat === ESP32_PIXEL_4BPP_GRAY || (esp32PixelFormatIsPalette(pixelFormat) && canvasBytesPerPixel === 2));
137
+ if (pixelFormat === ESP32_PIXEL_4BPP_GRAY)
138
+ return true;
139
+ if (!esp32PixelFormatIsPalette(pixelFormat) || canvasBytesPerPixel !== 2)
140
+ return false;
141
+ const canvasBytes = Math.max(1, width) * Math.max(1, height) * 2;
142
+ const apart = canvasBytes + esp32PalettePanelBufferBytes(width, height, pixelFormat);
143
+ return apart > Math.floor(psramBytes / ESP32_PACK_IN_CANVAS_PSRAM_SHARE_DIVISOR);
137
144
  }
138
145
  /** "2026.11.6" (also "v2026.11.6+<sha>") as numbers; null when it is not one. */
139
146
  function firmwareVersionParts(version) {
@@ -174,7 +181,7 @@ export function esp32CanvasRotation(rotate, firmwareVersion, pixelFormat = null)
174
181
  * left. */
175
182
  export function esp32DeviceHeapBytes(width, height, psramBytes = ESP32_PSRAM_BYTES, pixelFormat = null, rotate = null) {
176
183
  const pixels = Math.max(1, width) * Math.max(1, height);
177
- const packedBytes = esp32CanvasIsPanelBuffer(pixelFormat, rotate, esp32CanvasBytesPerPixel(width, height, psramBytes, pixelFormat))
184
+ const packedBytes = esp32CanvasIsPanelBuffer(pixelFormat, rotate, esp32CanvasBytesPerPixel(width, height, psramBytes, pixelFormat), width, height, psramBytes)
178
185
  ? 0
179
186
  : pixelFormat === ESP32_PIXEL_RGB565
180
187
  ? pixels * 2 * 4
@@ -0,0 +1,28 @@
1
+ /** What the Files scene asks of the page. */
2
+ export interface PreviewFileRequest {
3
+ id: number;
4
+ /** 'upload': pick files from the computer; 'download': save one there. */
5
+ op: 'upload' | 'download';
6
+ /** The folder the files go into ('' its top), or the file to save. */
7
+ name: string;
8
+ }
9
+ /** One file picked, as the worker takes it. */
10
+ export interface PickedFile {
11
+ name: string;
12
+ data: ArrayBuffer;
13
+ }
14
+ /**
15
+ * Whether the page may open a file picker now: a gesture is still in force.
16
+ * False where the browser cannot say (no `navigator.userActivation`), so the
17
+ * page asks with a button instead of a picker that would not open.
18
+ */
19
+ export declare function pageHasGesture(): boolean;
20
+ /**
21
+ * Open the browser's file picker (several files at once) and resolve with
22
+ * the files read, or null when it was closed with none. Call it from a
23
+ * gesture. A browser that never says the picker was closed (no `cancel`
24
+ * event) leaves the promise waiting; the next request replaces it.
25
+ */
26
+ export declare function pickFiles(doc?: Document): Promise<PickedFile[] | null>;
27
+ /** Save `data` to the computer as `name` (a Blob and a link's download). */
28
+ export declare function saveFile(name: string, data: ArrayBuffer, doc?: Document): void;
package/dist/files.js ADDED
@@ -0,0 +1,74 @@
1
+ // Files between the preview and the computer: the page's half of Upload and
2
+ // Download in the Files scene (frameos/src/frameos/file_transfer_preview.nim,
3
+ // the worker's `fileRequest`).
4
+ //
5
+ // A file picker opens, and a download starts, only from a person's gesture.
6
+ // The tap on Upload happened on the canvas a moment ago, so the page still
7
+ // has it when the request arrives: `navigator.userActivation.isActive` says
8
+ // so, and the picker opens at once. A request that comes after the gesture
9
+ // ran out (a slow render in between), or in a browser that cannot say,
10
+ // waits for the page to ask the person with a button of its own
11
+ // (`onFileRequest`), whose click is the gesture.
12
+ /**
13
+ * Whether the page may open a file picker now: a gesture is still in force.
14
+ * False where the browser cannot say (no `navigator.userActivation`), so the
15
+ * page asks with a button instead of a picker that would not open.
16
+ */
17
+ export function pageHasGesture() {
18
+ try {
19
+ const activation = globalThis.navigator
20
+ ?.userActivation;
21
+ return activation?.isActive === true;
22
+ }
23
+ catch {
24
+ return false;
25
+ }
26
+ }
27
+ /**
28
+ * Open the browser's file picker (several files at once) and resolve with
29
+ * the files read, or null when it was closed with none. Call it from a
30
+ * gesture. A browser that never says the picker was closed (no `cancel`
31
+ * event) leaves the promise waiting; the next request replaces it.
32
+ */
33
+ export function pickFiles(doc = document) {
34
+ return new Promise((resolve) => {
35
+ const input = doc.createElement('input');
36
+ input.type = 'file';
37
+ input.multiple = true;
38
+ input.style.display = 'none';
39
+ let settled = false;
40
+ const settle = (files) => {
41
+ if (!settled) {
42
+ settled = true;
43
+ input.remove();
44
+ resolve(files);
45
+ }
46
+ };
47
+ input.addEventListener('change', () => {
48
+ const chosen = Array.from(input.files ?? []);
49
+ if (chosen.length === 0) {
50
+ settle(null);
51
+ return;
52
+ }
53
+ void Promise.all(chosen.map(async (file) => ({ name: file.name, data: await file.arrayBuffer() })))
54
+ .then((files) => settle(files))
55
+ .catch(() => settle(null));
56
+ });
57
+ input.addEventListener('cancel', () => settle(null));
58
+ doc.body.appendChild(input);
59
+ input.click();
60
+ });
61
+ }
62
+ /** Save `data` to the computer as `name` (a Blob and a link's download). */
63
+ export function saveFile(name, data, doc = document) {
64
+ const url = URL.createObjectURL(new Blob([data]));
65
+ const link = doc.createElement('a');
66
+ link.href = url;
67
+ link.download = name || 'file';
68
+ link.style.display = 'none';
69
+ doc.body.appendChild(link);
70
+ link.click();
71
+ link.remove();
72
+ // After the browser took it: revoking at once can cancel the download.
73
+ setTimeout(() => URL.revokeObjectURL(url), 60000);
74
+ }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { FrameOSPreview, createFrameOSPreview, type BeforeDitherHook, type DeviceMemoryUsage, type FrameOSPreviewOptions, } from './preview';
2
2
  export { describeDeviceLimits, describeOutOfMemory, deviceLimitsFor, devicePresetFor, devicePresets, ESP32_PIXEL_RGB565, ESP32_SHARED_CANVAS_FIRMWARE, esp32CanvasBytesPerPixel, esp32CanvasIsPanelBuffer, esp32CanvasRotation, esp32DeviceHeapBytes, esp32DeviceLimits, esp32PreviewMemoryBytes, esp32PixelFormatIsGrey, esp32PreviewOverheadBytes, piDeviceHeapBytes, type DeviceLimits, type DevicePreset, type DevicePresetKey, } from './devices';
3
3
  export { PreviewCursor, composeCursor, cssCursor, cursorRect, type CursorRect, type CursorSprite, } from './cursor';
4
+ export { pageHasGesture, pickFiles, saveFile, type PickedFile, type PreviewFileRequest } from './files';
4
5
  export { ditherFrame, panelPalettes, panelPaletteFor, type PanelPaletteKey } from './dither';
5
6
  export { mountFrameOSManager, type FrameOSManagerHandle, type FrameOSManagerOptions } from './manager';
6
7
  export { selectFieldOptions } from './options';
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@
7
7
  export { FrameOSPreview, createFrameOSPreview, } from './preview';
8
8
  export { describeDeviceLimits, describeOutOfMemory, deviceLimitsFor, devicePresetFor, devicePresets, ESP32_PIXEL_RGB565, ESP32_SHARED_CANVAS_FIRMWARE, esp32CanvasBytesPerPixel, esp32CanvasIsPanelBuffer, esp32CanvasRotation, esp32DeviceHeapBytes, esp32DeviceLimits, esp32PreviewMemoryBytes, esp32PixelFormatIsGrey, esp32PreviewOverheadBytes, piDeviceHeapBytes, } from './devices';
9
9
  export { PreviewCursor, composeCursor, cssCursor, cursorRect, } from './cursor';
10
+ export { pageHasGesture, pickFiles, saveFile } from './files';
10
11
  export { ditherFrame, panelPalettes, panelPaletteFor } from './dither';
11
12
  export { mountFrameOSManager } from './manager';
12
13
  export { selectFieldOptions } from './options';
package/dist/pointer.js CHANGED
@@ -323,9 +323,11 @@ export function attachPointerInput(canvas, send, options = {}) {
323
323
  lastPositions.clear();
324
324
  };
325
325
  }
326
- // Keys whose default is to scroll the page: taken by the scene while the
327
- // picture has the focus.
326
+ // Keys whose default is to scroll the page, or (Tab) to move the browser's
327
+ // focus off the picture: taken by the scene while the picture has the focus.
328
+ // Tab walks the frame's UI (docs/jsx-ui.md "Keys").
328
329
  const SCROLLING_KEYS = new Set([
330
+ 'Tab',
329
331
  'ArrowUp',
330
332
  'ArrowDown',
331
333
  'ArrowLeft',
package/dist/preview.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { DeviceLimits } from './devices';
2
2
  import { type PanelPaletteKey } from './dither';
3
+ import { type PreviewFileRequest } from './files';
3
4
  import type { FrameOSScene, PreviewAssetEntry, PreviewAssetsInfo, PreviewFrame, PreviewRuntimeInfo, SceneInfo, AppTestReport } from './types';
4
5
  /** What a render cost under a simulated device ceiling. */
5
6
  export interface DeviceMemoryUsage {
@@ -95,6 +96,19 @@ export interface FrameOSPreviewOptions {
95
96
  * from; defaults to https://cloud.frameos.net. The listing is fetched from
96
97
  * the worker, so another origin needs CORS or `proxyUrl`. */
97
98
  storeUrl?: string;
99
+ /** Upload and Download in the Files scene (file picker in, a download
100
+ * out; ./files). On by default; false and the scene shows neither, as on
101
+ * a frame. A bundle from before (`runtimeInfo.fileTransfer`) has neither. */
102
+ fileTransfer?: boolean;
103
+ /**
104
+ * The Files scene asked for files (Upload) or to save one (Download) when
105
+ * the page had no gesture left to open a picker or a download with: ask
106
+ * the person with a button of the page's own whose click calls
107
+ * `answerFileRequest()` (and one for `cancelFileRequest()`). Called with
108
+ * null when the request is over. Without it the page tries anyway, and a
109
+ * picker the browser refuses stays shut.
110
+ */
111
+ onFileRequest?: (request: PreviewFileRequest | null) => void;
98
112
  onReady?: (sceneInfo: SceneInfo, assets: PreviewAssetsInfo | null, runtime: PreviewRuntimeInfo) => void;
99
113
  onFrame?: (frame: PreviewFrame) => void;
100
114
  /** The mouse cursor over the picture took another shape (a CSS name):
@@ -152,6 +166,11 @@ export declare class FrameOSPreview {
152
166
  private cursorSprite;
153
167
  /** The mouse cursor's shape over the picture, as CSS names it. */
154
168
  cursorShape: string;
169
+ /** What the Files scene asked of the page and the person has not answered yet. */
170
+ fileRequest: PreviewFileRequest | null;
171
+ private fileRequestData;
172
+ /** Whether `onFileRequest` was told of the request waiting. */
173
+ private fileRequestShown;
155
174
  /** Latest scene info from the runtime (set once `ready` fires). */
156
175
  sceneInfo: SceneInfo | null;
157
176
  /** How the runtime's /srv/assets is backed (set once `ready` fires). */
@@ -185,6 +204,20 @@ export declare class FrameOSPreview {
185
204
  private paint;
186
205
  /** A message the worker answers by calling into the runtime. */
187
206
  private toRuntime;
207
+ /** The worker's `fileRequest`: answered now while the page still has the
208
+ * tap's gesture, else asked of the person (`onFileRequest`). A new one
209
+ * replaces one still waiting, as it does in the runtime. */
210
+ private takeFileRequest;
211
+ private endFileRequest;
212
+ /**
213
+ * Do what the Files scene asked (`fileRequest`): open the file picker and
214
+ * put the files picked into the folder it showed, or save the file to the
215
+ * computer. Call it from a click (a gesture): a picker opened from
216
+ * anywhere else stays shut. Nothing without a request waiting.
217
+ */
218
+ answerFileRequest(): void;
219
+ /** Give up what the Files scene asked: the scene says nothing was moved. */
220
+ cancelFileRequest(): void;
188
221
  /** Force a render now. */
189
222
  render(): void;
190
223
  /** Dispatch a scene event (a custom event node's keyword, "button", ...). */
package/dist/preview.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ditherFrame, panelPaletteFor } from './dither';
2
2
  import { attachKeyboardInput, attachPointerInput, writeHostClipboard } from './pointer';
3
3
  import { PreviewCursor } from './cursor';
4
+ import { pageHasGesture, pickFiles, saveFile } from './files';
4
5
  /** A panel's palette as colours: grey panels spelled out as their levels. */
5
6
  function panelColors(panel) {
6
7
  if ('grayLevels' in panel) {
@@ -43,6 +44,11 @@ export class FrameOSPreview {
43
44
  this.cursorSprite = null;
44
45
  /** The mouse cursor's shape over the picture, as CSS names it. */
45
46
  this.cursorShape = 'default';
47
+ /** What the Files scene asked of the page and the person has not answered yet. */
48
+ this.fileRequest = null;
49
+ this.fileRequestData = null;
50
+ /** Whether `onFileRequest` was told of the request waiting. */
51
+ this.fileRequestShown = false;
46
52
  /** Latest scene info from the runtime (set once `ready` fires). */
47
53
  this.sceneInfo = null;
48
54
  /** How the runtime's /srv/assets is backed (set once `ready` fires). */
@@ -56,6 +62,7 @@ export class FrameOSPreview {
56
62
  sceneStateSeeded: false,
57
63
  resize: false,
58
64
  cursor: false,
65
+ fileTransfer: false,
59
66
  };
60
67
  /** Latest public state of the current scene. */
61
68
  this.state = {};
@@ -96,6 +103,7 @@ export class FrameOSPreview {
96
103
  renderScale: options.renderScale ?? 0,
97
104
  windowed: options.windowed === true,
98
105
  framePage: options.framePage === true,
106
+ fileTransfer: options.fileTransfer !== false,
99
107
  ...(options.storeUrl ? { storeUrl: options.storeUrl } : {}),
100
108
  });
101
109
  }
@@ -118,6 +126,7 @@ export class FrameOSPreview {
118
126
  sceneStateSeeded: msg.sceneStateSeeded === true,
119
127
  resize: msg.resize === true,
120
128
  cursor: msg.cursor === true,
129
+ fileTransfer: msg.fileTransfer === true,
121
130
  };
122
131
  this.options.onReady?.(msg.sceneInfo, this.assetsInfo, this.runtimeInfo);
123
132
  break;
@@ -198,6 +207,9 @@ export class FrameOSPreview {
198
207
  // A Copy or a Cut in the frame's UI: the computer's clipboard too.
199
208
  writeHostClipboard(String(msg.text ?? ''));
200
209
  break;
210
+ case 'fileRequest':
211
+ this.takeFileRequest(msg);
212
+ break;
201
213
  case 'appTestsResult': {
202
214
  const pending = this.appTestsRequests.get(msg.requestId);
203
215
  if (pending) {
@@ -290,10 +302,80 @@ export class FrameOSPreview {
290
302
  this.cursor?.back();
291
303
  }
292
304
  /** A message the worker answers by calling into the runtime. */
293
- toRuntime(msg) {
305
+ toRuntime(msg, transfer = []) {
294
306
  if (!this.outOfMemory) {
295
- this.worker?.postMessage(msg);
307
+ this.worker?.postMessage(msg, transfer);
308
+ }
309
+ }
310
+ /** The worker's `fileRequest`: answered now while the page still has the
311
+ * tap's gesture, else asked of the person (`onFileRequest`). A new one
312
+ * replaces one still waiting, as it does in the runtime. */
313
+ takeFileRequest(msg) {
314
+ const op = msg.op === 'upload' || msg.op === 'download' ? msg.op : null;
315
+ const id = Number(msg.id) || 0;
316
+ if (!op || !id) {
317
+ return;
318
+ }
319
+ this.fileRequest = { id, op, name: String(msg.name ?? '') };
320
+ this.fileRequestData = op === 'download' && msg.data instanceof ArrayBuffer ? msg.data : null;
321
+ if (pageHasGesture() || !this.options.onFileRequest) {
322
+ this.answerFileRequest();
323
+ }
324
+ else {
325
+ this.fileRequestShown = true;
326
+ this.options.onFileRequest(this.fileRequest);
327
+ }
328
+ }
329
+ endFileRequest() {
330
+ this.fileRequest = null;
331
+ this.fileRequestData = null;
332
+ if (this.fileRequestShown) {
333
+ this.fileRequestShown = false;
334
+ this.options.onFileRequest?.(null);
335
+ }
336
+ }
337
+ /**
338
+ * Do what the Files scene asked (`fileRequest`): open the file picker and
339
+ * put the files picked into the folder it showed, or save the file to the
340
+ * computer. Call it from a click (a gesture): a picker opened from
341
+ * anywhere else stays shut. Nothing without a request waiting.
342
+ */
343
+ answerFileRequest() {
344
+ const request = this.fileRequest;
345
+ if (!request) {
346
+ return;
347
+ }
348
+ const data = this.fileRequestData;
349
+ this.endFileRequest();
350
+ if (request.op === 'download') {
351
+ try {
352
+ saveFile(request.name, data ?? new ArrayBuffer(0));
353
+ this.toRuntime({ type: 'fileTransferDone', id: request.id, ok: true });
354
+ }
355
+ catch {
356
+ this.toRuntime({ type: 'fileTransferDone', id: request.id, ok: false, error: 'failed' });
357
+ }
358
+ return;
359
+ }
360
+ void pickFiles().then((files) => {
361
+ if (this.destroyed) {
362
+ return;
363
+ }
364
+ if (!files || files.length === 0) {
365
+ this.toRuntime({ type: 'fileTransferDone', id: request.id, ok: false, error: 'cancelled' });
366
+ return;
367
+ }
368
+ this.toRuntime({ type: 'fileUpload', id: request.id, files }, files.map((file) => file.data));
369
+ });
370
+ }
371
+ /** Give up what the Files scene asked: the scene says nothing was moved. */
372
+ cancelFileRequest() {
373
+ const request = this.fileRequest;
374
+ if (!request) {
375
+ return;
296
376
  }
377
+ this.endFileRequest();
378
+ this.toRuntime({ type: 'fileTransferDone', id: request.id, ok: false, error: 'cancelled' });
297
379
  }
298
380
  /** Force a render now. */
299
381
  render() {
package/dist/types.d.ts CHANGED
@@ -113,6 +113,9 @@ export interface PreviewRuntimeInfo {
113
113
  /** Whether the bundle says what the mouse cursor looks like over the
114
114
  * picture (`FrameOSPreview.cursorShape`, the `drawnCursor` option). */
115
115
  cursor: boolean;
116
+ /** Whether the bundle has Upload and Download in the Files scene
117
+ * (`fileTransfer` option, `FrameOSPreview.answerFileRequest`). */
118
+ fileTransfer: boolean;
116
119
  }
117
120
  /** How the runtime's /srv/assets is backed, sent with the worker's `ready` message. */
118
121
  export interface PreviewAssetsInfo {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frameos-wasm",
3
- "version": "2026.11.13",
3
+ "version": "2026.11.14",
4
4
  "description": "Run FrameOS scenes in the browser via WebAssembly: a typed live-preview runtime plus a minimal showIf-aware management interface.",
5
5
  "keywords": [
6
6
  "frameos",
@@ -40,6 +40,6 @@
40
40
  "build:runtime": "bash ../tools/build_wasm.sh"
41
41
  },
42
42
  "devDependencies": {
43
- "typescript": "~5.9.3"
43
+ "typescript": "~7.0.2"
44
44
  }
45
45
  }