web: XREFs, data links & extraction, ARCHIVE transmittals, worker-side saves

The last four big web-vs-desktop gaps.

XREFs: XATTACH reads the picked drawing's bytes and registers them
name-keyed (the image/PDF-underlay pattern), pre-parses on the web
worker, and the commit merge produces the same xref block flow as
native. Opened drawings resolve xrefs from the registry (trailing-name
match) before cache build; unresolved references produce ONE warning
listing the names and the fix — drop the referenced files on the page
(drops and picker opens now register their bytes) and reopen or
XRELOAD. XRELOAD works off the registry on unsaved drawings too.

Data Link & Extraction: spreadsheet links read picked xlsx/csv bytes
(calamine from slices / CSV from string) through a session registry,
so preview, refresh, and table-insert work on web; extraction takes
external drawings via a multi-file picker parsed on the worker, and
outputs CSV/TXT/.dxex via download_bytes. The disabled 'Add folder'
button explains why.

ARCHIVE/ETRANSMIT: assembles the drawing plus registered images, PDF
underlays, and session plot tables into a deterministic ZIP (minimal
writer over flate2 — no new dependency) delivered as
{stem}_transmit.zip; skipped dependencies are reported by name.

Save/autosave off the UI thread: the parse worker gains a serialize
action (protocol v5) — the document is prepared once on the main
thread (clone, styles, dimension bake), then the DWG/DXF writer pass,
the dominant cost, runs on the worker; any worker failure falls back
to inline serialization with the identical shared implementation.
The save path also clears the dirty flag only when the tab didn't
change mid-write, and the runtime-fields sidecar now carries
graphic_data, fixing a pre-existing loss of raw DWG round-trip bytes
on web-opened documents.
This commit is contained in:
Afonsop committed 2026-09-17 23:23:01 +01:00
1 parent c643a10ed9
commit 2e1006348b
44 files changed
+2564 -330

No files matched your search

Generated
+11
View File
@@ -42,6 +42,7 @@ dependencies = [
"objc2-app-kit 0.2.2",
"objc2-foundation 0.2.2",
"ocs_plugin_api",
"ocs_save",
"open",
"printpdf",
"rayon",
@@ -4174,6 +4175,15 @@ dependencies = [
"thiserror 1.0.69",
]
[[package]]
name = "ocs_save"
version = "0.1.0"
dependencies = [
"acadrust",
"bincode",
"serde",
]
[[package]]
name = "ocs_web_worker"
version = "0.1.0"
@@ -4183,6 +4193,7 @@ dependencies = [
"console_error_panic_hook",
"getrandom 0.3.4",
"js-sys",
"ocs_save",
"serde",
"sha2 0.10.9",
"wasm-bindgen",