Architecture spike for a standalone, read-only browser-based Office Open XML viewer built on @silurus/ooxml.
This repository currently contains a technical spike with an initial <office-viewer> custom-element wrapper.
Milestone 1 (minimal component shell and lifecycle baseline) is complete; the API remains experimental.
Included in this milestone:
- verified upstream API notes for
@silurus/ooxml - a raw integration harness under
/demo - representative DOCX, XLSX, and PPTX fixtures under
/public/fixtures - focused Vitest + WebdriverIO tests
- production-build asset checks and bundle-size notes
- first-pass
OfficeViewerElementwrapper that delegates to the integration spike engine
Not included yet:
- the polished, stable public custom-element API
- common printing
- PDF support
- a public
workerUrloption
The package now exports an early wrapper for browser usage:
OfficeViewerElementdefineOfficeViewerElement()
Current wrapper behavior:
- delegates loading/reload/destroy to the existing
OoxmlIntegrationSpike - supports
src,file-name,file-type,mode, andwasm-urlattributes - exposes
load(),reload(),destroy(), andgetSummary() - exposes format-specific navigation methods:
goToPage(),goToSheet(),goToSlide() - supports request cancellation via
load(source, { signal })usingAbortSignal - dispatches
loadstart,progress,ready,loaderror,pagechange,sheetchange,slidechange, anddestroyevents
This surface is intentionally provisional while the final public API is being validated.
corepack enable
corepack prepare pnpm@latest --activate
pnpm installpnpm devThen open:
http://127.0.0.1:5173/demo/
The harness lets you:
- load sample DOCX/XLSX/PPTX fixtures by URL
- switch between
workerandmainmode - load a local file
- destroy and reload the active viewer
- experiment with
wasmUrlwhen you have a custom hosted WASM path
pnpm test
pnpm build
pnpm test:buildpnpm previewThen open:
http://127.0.0.1:4173/demo/
- Verified API notes:
docs/ooxml-integration-notes.md - Bundle and asset measurements:
docs/bundle-size-spike.md
- The custom-element wrapper is an initial slice and may change before the stable release.
- The harness normalizes
File,Blob, andUint8Arrayinputs toArrayBufferbecause current upstream declarations typeload(source)asstring | ArrayBuffer. - The spike verifies Vite 8 development/build behavior and a local static preview. It does not add custom worker hosting because upstream does not expose a public
workerUrl. - If a bundler does not preserve upstream
new URL(..., import.meta.url)WASM resolution, copy the required*_parser_bg.wasmfile into served assets and passwasmUrl.