xlsx-svelte-viewer 1.4.1 → 2.0.0

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
@@ -1,85 +1,134 @@
1
1
  # xlsx-svelte-viewer
2
2
 
3
+ **The Excel editor for Svelte: open, edit, calculate and save `.xlsx` workbooks entirely in the browser.**
4
+
3
5
  [![npm version](https://img.shields.io/npm/v/xlsx-svelte-viewer.svg)](https://www.npmjs.com/package/xlsx-svelte-viewer)
4
6
  [![license](https://img.shields.io/npm/l/xlsx-svelte-viewer.svg)](https://github.com/ChristopherVR/ooxml/blob/main/viewers/xlsx/LICENSE)
5
- [![types](https://img.shields.io/npm/types/xlsx-svelte-viewer.svg)](https://www.npmjs.com/package/xlsx-svelte-viewer)
6
-
7
- > A browser Excel spreadsheet editor for Svelte 5, using one shared editor and the canonical OOXML document engine.
7
+ [![docs](https://img.shields.io/badge/docs-christophervr.github.io-1f9d63.svg)](https://christophervr.github.io/ooxml/xlsx/)
8
8
 
9
- [Live demo](https://christophervr.github.io/ooxml/xlsx/demo/) | [npm](https://www.npmjs.com/package/xlsx-svelte-viewer) | [Full docs](https://christophervr.github.io/ooxml/xlsx/) | [Source](https://github.com/ChristopherVR/ooxml/tree/main/viewers/xlsx)
9
+ [Live demo](https://christophervr.github.io/ooxml/xlsx/demo-svelte/) · [Documentation](https://christophervr.github.io/ooxml/xlsx/) · [Changelog](https://github.com/ChristopherVR/ooxml/blob/main/viewers/xlsx/packages/svelte/CHANGELOG.md) · [Report a bug](https://github.com/ChristopherVR/ooxml/issues)
10
10
 
11
- Part of [ooxml](https://github.com/ChristopherVR/ooxml#readme): [Office](https://github.com/ChristopherVR/ooxml#ooxml-office-the-whole-suite-in-one-app) · [Word](https://github.com/ChristopherVR/ooxml/tree/main/viewers/docx#readme) · **[Excel](https://github.com/ChristopherVR/ooxml/tree/main/viewers/xlsx#readme)** · [PowerPoint](https://github.com/ChristopherVR/ooxml/tree/main/viewers/pptx#readme) · [Visio](https://github.com/ChristopherVR/ooxml/tree/main/viewers/visio#readme) · [OpenTeams](https://github.com/ChristopherVR/ooxml/tree/main/viewers/teams#readme) · [Core](https://github.com/ChristopherVR/ooxml/tree/main/src/core#readme)
11
+ ![The Excel editor with its ribbon, formula bar, grid and sheet tabs](https://raw.githubusercontent.com/ChristopherVR/ooxml/main/viewers/xlsx/docs/public/hero-editor.webp)
12
12
 
13
13
  ## Install
14
14
 
15
15
  ```bash
16
- npm install xlsx-svelte-viewer
16
+ npm install xlsx-svelte-viewer svelte
17
17
  ```
18
18
 
19
- Use the framework peers declared by this package: `svelte` (`^5.0.0`). Existing framework apps normally already provide them.
20
-
21
- The package bundles its editor UI and adapter. The core model and shared controls
22
- are installed as regular registry dependencies and the model API is re-exported.
23
- One viewer package is enough; no separate core install is required.
19
+ One install is enough. The package bundles the editor and its Svelte adapter, and brings the workbook model (`@christophervr/xlsx-core`, re-exported from this package), `ooxml-core` and `ooxml-ui` with it. The peer dependency is `svelte` 5.
24
20
 
25
21
  ## Quick start
26
22
 
27
23
  ```svelte
28
24
  <script>
29
- import XlsxEditor from 'xlsx-svelte-viewer';
30
- import { createWorkbook } from 'xlsx-svelte-viewer/runtime';
31
- let workbook = $state.raw(createWorkbook());
25
+ import XlsxEditor from 'xlsx-svelte-viewer';
26
+ import { createWorkbook } from 'xlsx-svelte-viewer/runtime';
27
+
28
+ let workbook = $state.raw(createWorkbook());
32
29
  </script>
33
- <XlsxEditor {workbook} onworkbookchange={(next) => (workbook = next)} />
30
+
31
+ <div style="height: 100vh">
32
+ <XlsxEditor {workbook} onworkbookchange={(next) => (workbook = next)} />
33
+ </div>
34
34
  ```
35
35
 
36
- Mount in the browser and give the host a height. Use one editor package per
37
- application: each registers the same editor custom element.
36
+ Give the editor a height: the grid fills its container and scrolls inside it. Use one Excel editor package per application, since each registers the same `<xlsx-editor>` element.
38
37
 
39
- ## Features
38
+ ## Open and save files
40
39
 
41
- | Feature | Description |
42
- | ---------- | ----------------------------------------------------------------------------------- |
43
- | Editing | Shared grid, ribbon, formula bar, sheet tabs and workbook change events. |
44
- | Files | XLSX, XLSM, XLTX, legacy XLS and CSV loading through core. |
45
- | Model | `createWorkbook`, `loadWorkbook`, `saveXlsx` and core types from the package entry. |
46
- | Frameworks | The same `<xlsx-editor>` UI behind six thin adapters. |
40
+ Pass `bytes` (with `fileName`) or a `src` URL to open a file, and use the handle to save:
47
41
 
48
- ## API
42
+ ```svelte
43
+ <script>
44
+ import XlsxEditor from 'xlsx-svelte-viewer';
49
45
 
50
- Shared option types, `loadWorkbook` and `detectWorkbookFormat` helpers are exported
51
- from the package. `mountEditor(container, options)` returns an imperative binding
52
- with `load`, `save` and `destroy`. `ooxml-core` and `ooxml-ui` are regular
53
- dependencies. Parsing, formulas, editing and grid calculations live in core.
46
+ let editor;
47
+ </script>
54
48
 
55
- The root exports the Svelte component; JavaScript helpers and model exports are
56
- under `xlsx-svelte-viewer/runtime`.
49
+ <button onclick={() => editor.download('Budget.xlsx')}>Download</button>
50
+ <div style="height: 600px">
51
+ <XlsxEditor
52
+ bind:this={editor}
53
+ src="/files/budget.xlsx"
54
+ fileName="Budget.xlsx"
55
+ ondirtychange={(dirty) => console.log('unsaved edits:', dirty)}
56
+ />
57
+ </div>
58
+ ```
57
59
 
58
- ## Limitations
60
+ The editor opens `.xlsx`, `.xlsm`, `.xltx`, password-protected workbooks, legacy `.xls` and `.csv`. `save()` resolves to an `.xlsx` Blob, `saveBytes('csv')` exports the active sheet, and `download()` saves and marks the workbook clean. For headless work, the package also exports the model API: `createWorkbook`, `loadWorkbook`, `saveWorkbook`, `detectWorkbookFormat` and the rest of `@christophervr/xlsx-core`.
61
+
62
+ ## What you get
63
+
64
+ - **The Excel window.** Ribbon with Tell me, Name Box, formula bar, grid with frozen panes, sheet tabs, a status bar with sum, average and count, the File backstage, Find and Replace, and undo and redo.
65
+ - **A calculation engine.** More than 500 functions, dynamic arrays, `LET` and `LAMBDA`, automatic or manual calculation and iterative calculation. Each formula has a work budget, and a slow calculation on open runs in a worker, so a workbook cannot freeze the page.
66
+ - **Formatting.** Fonts, fills, borders, number formats, merged cells, tables, outline groups, data validation and conditional formatting with colour scales, data bars and icon sets.
67
+ - **Objects.** Charts drawn from live values and edited from the Chart Design tab and Format pane, SmartArt, shapes, pictures, sparklines, worksheet PivotTables and slicers, and form controls linked to cells.
68
+ - **Collaboration.** Optional real-time co-editing between tabs of one browser, or across machines through a y-websocket compatible server you run.
69
+ - **Five interface languages.** English, French, German, Spanish and Simplified Chinese through `locale`. Workbook content is never translated.
70
+ - **Keyboard and screen reader support.** F6 regions, Excel's shortcuts, a grid that reads as a table, and forced-colours support.
71
+
72
+ ## Svelte notes
59
73
 
60
- This is an early editor, without Microsoft Excel parity or guaranteed lossless
61
- saving for unsupported features. Legacy XLS input saves as XLSX. Pivot tables,
62
- slicers and sparklines are not editable; macros never execute. Review core
63
- diagnostics and the feature guide before relying on preservation.
74
+ - The package root is the Svelte 5 component (default export). The plain-JavaScript half, with `createWorkbook`, `loadWorkbook`, `mountEditor` and the shared types, is `xlsx-svelte-viewer/runtime`.
75
+ - Callbacks are lower-case props: `onworkbookchange`, `onselectionchange`, `ondirtychange`, `onfilecommand` and the others in the [bindings guide](https://christophervr.github.io/ooxml/xlsx/bindings#callbacks-and-events).
76
+ - `bind:this` gives the component, whose exports are the [handle](#the-handle): `load`, `save`, `download` and the rest, plus live `element` and `dirty` properties.
77
+ - Hold the workbook in `$state.raw`: it is a large plain object, and deep reactivity adds nothing but cost.
64
78
 
65
- ## Documentation
79
+ ## Configuration
66
80
 
67
- [Framework guide](https://christophervr.github.io/ooxml/xlsx/frameworks/svelte) |
68
- [Bindings](https://christophervr.github.io/ooxml/xlsx/bindings)
81
+ Every binding takes the same settings (the [bindings guide](https://christophervr.github.io/ooxml/xlsx/bindings) has the full list):
82
+
83
+ | Setting | What it does |
84
+ | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
85
+ | `workbook`, `bytes`, `src`, `fileName` | What to show: a model, file bytes or a URL, and the name used by the title bar, Save and Download. |
86
+ | `readOnly` | Opens in Viewing mode. |
87
+ | `locale` | `en`, `fr`, `de`, `es` or `zh-CN` (tags such as `de-DE` map to one). |
88
+ | `theme`, `themeColors` | `light`, `dark` or `auto`, and `--xve-*` token overrides. See [theming](https://christophervr.github.io/ooxml/xlsx/theming). |
89
+ | `showToolbar`, `showFormulaBar` | Show or hide the ribbon and the formula bar. |
90
+ | `hiddenActions`, `ribbonAddIns` | Hide ribbon commands by id, or add your own tabs after Excel's. |
91
+ | `customization` | Capabilities, hidden ribbon tabs (`ribbon.hiddenTabs`, including File), extra backstage pages and menu items. |
92
+ | `storage`, `fileProviders` | Send Save and Open to your own storage, and offer OneDrive or your own cloud places in File > Open. |
93
+ | `collaboration` | Join a shared room. See [collaboration](https://christophervr.github.io/ooxml/xlsx/collaboration). |
94
+ | `authorName`, `validateReplace` | The author of new comments, and whether Replace applies data validation. |
95
+
96
+ ### The handle
97
+
98
+ The handle has `load(bytes, fileName?)`, `newWorkbook()`, `save()`, `saveBytes(format?)`, `download(fileName?)`, `markClean()`, `openCloudFile(file)`, `select(ref)`, `getSelection()`, `setActiveSheet(index)`, `share()`, and the `dirty` and `element` properties.
99
+
100
+ ### Building blocks
101
+
102
+ To build your own interface around the grid, use `createViewerBuildingBlocks` from `xlsx-svelte-viewer/runtime` with the `SpreadsheetCanvas.svelte`, `Toolbar.svelte`, `FormulaBar.svelte` and `SheetTabs.svelte` components (each its own subpath, such as `xlsx-svelte-viewer/Toolbar.svelte`). No title bar, ribbon, backstage or dialog is mounted, and the surface is read-only until you pass `canEdit: true`. See the [building blocks guide](https://christophervr.github.io/ooxml/xlsx/building-blocks).
103
+
104
+ ## Supported environments
105
+
106
+ - **Browsers:** the last two major versions of Chrome, Edge, Firefox and Safari, and Safari 16.4 at least ([browser support](https://github.com/ChristopherVR/ooxml/blob/main/docs/browser-support.md)).
107
+ - **Node.js:** 22.3 or newer for builds, tests and server rendering. The package imports without a DOM; the editor itself runs in the browser.
108
+ - **Workers:** a workbook that needs a long calculation on open is calculated in a module worker that bundlers pick up from `new Worker(new URL(..., import.meta.url))`. A Content Security Policy must allow `worker-src 'self'`; without workers the calculation runs on the page under the same time limit.
109
+
110
+ ## Limitations
111
+
112
+ This is not Microsoft Excel. Content the model does not cover is kept through a save or reported, as the [preservation guarantee](https://christophervr.github.io/ooxml/xlsx/preservation) describes, and the [features page](https://christophervr.github.io/ooxml/xlsx/features) lists what is supported.
113
+
114
+ - `.xlsb` and `.ods` do not open. Legacy `.xls` workbooks are read and saved as `.xlsx`.
115
+ - Macros never run; a `.xlsm` keeps its VBA project on save.
116
+ - External links, Power Query, OLAP and external-source PivotTables are kept but never refreshed, and `WEBSERVICE` is not evaluated.
117
+ - A few functions are not implemented (`ASC`, `DBCS`, `JIS`, `PHONETIC`, `INFO`, `WEBSERVICE`) and show `#NAME?`.
118
+ - Ink and OLE objects show as placeholders. In a shared room, pictures, other drawings and page setup stay local.
69
119
 
70
120
  ## Privacy and network use
71
121
 
72
- The Excel packages make no network request when opening, rendering, editing or saving a document: linked pictures are not fetched, linked data is not refreshed, and fonts come from the device only (nothing is downloaded from Google Fonts or any other font service). Hyperlinks open only when the reader follows them. Nothing collects analytics or telemetry. See [PRIVACY.md](https://github.com/ChristopherVR/ooxml/blob/main/PRIVACY.md).
122
+ The editor makes no network request when it opens, renders, edits or saves a workbook. Linked pictures are not fetched, external workbook links and linked data are not refreshed, and fonts come from the device and the file. Fonts are downloaded only when the reader turns on the Trust Center option (off by default) or the host sets `googleFonts`, and then only public font family names are sent, never the workbook. Workers load from your own origin. Hyperlinks open only when the reader follows them. Collaboration talks only to the server you configure (without one it stays in the browser), and OneDrive only when you connect it. Preferences such as the font-download choice (`ooxml.xlsx.allowFontDownloads`) stay in the browser's localStorage. Nothing collects analytics or telemetry. See [PRIVACY.md](https://github.com/ChristopherVR/ooxml/blob/main/PRIVACY.md).
73
123
 
74
- ## License
124
+ ## Related packages
75
125
 
76
- Apache-2.0.
126
+ - Other frameworks: [React](https://www.npmjs.com/package/@christophervr/xlsx-react-viewer) (`@christophervr/xlsx-react-viewer`), [Vue](https://www.npmjs.com/package/xlsx-vue-viewer) (`xlsx-vue-viewer`), [Angular](https://www.npmjs.com/package/xlsx-angular-viewer) (`xlsx-angular-viewer`), [Solid](https://www.npmjs.com/package/xlsx-solid-viewer) (`xlsx-solid-viewer`), [Vanilla JS](https://www.npmjs.com/package/xlsx-vanilla-viewer) (`xlsx-vanilla-viewer`).
127
+ - [`@christophervr/xlsx-core`](https://www.npmjs.com/package/@christophervr/xlsx-core): the workbook model on its own, for servers and scripts.
128
+ - [`xlsx-viewer-mcp`](https://www.npmjs.com/package/xlsx-viewer-mcp): Excel tools for AI agents over MCP.
129
+ - [`ooxml-core`](https://www.npmjs.com/package/ooxml-core) and [`ooxml-ui`](https://www.npmjs.com/package/ooxml-ui): the engine and the shared editor elements underneath.
130
+ - The same approach for [Word](https://github.com/ChristopherVR/ooxml/tree/main/viewers/docx#readme), [PowerPoint](https://github.com/ChristopherVR/ooxml/tree/main/viewers/pptx#readme) and [Visio](https://github.com/ChristopherVR/ooxml/tree/main/viewers/visio#readme), or the whole [OOXML Office suite](https://github.com/ChristopherVR/ooxml#readme).
77
131
 
78
- ## OneDrive integration
132
+ ## License
79
133
 
80
- Use the optional shared `ooxml-core/embedding/onedrive` connection with host-supplied Microsoft
81
- sign-in. See the [Office package and integration reference](https://github.com/ChristopherVR/ooxml/blob/main/docs/onedrive-integration.md#excel-xlsx)
82
- for this product's load/save API, native storage wiring, sharing permissions and conflict recovery.
83
- The [testing guide](https://github.com/ChristopherVR/ooxml/blob/main/docs/onedrive-testing.md)
84
- separates test-local transports from live Microsoft acceptance. No simulation service is shipped;
85
- OneDrive storage does not provide Microsoft Office coauthoring or automatic document merging.
134
+ [Apache-2.0](https://github.com/ChristopherVR/ooxml/blob/main/viewers/xlsx/LICENSE)
@@ -16,7 +16,7 @@
16
16
  oncollaborationchange?: EditorEventHandlers['collaboration-change'];
17
17
  onready?: EditorEventHandlers['ready'];
18
18
  };
19
- let { workbook, bytes, src, fileName, readOnly = false, locale = 'en', theme = 'auto', authorName = 'Author', showToolbar = true, showFormulaBar = true, hiddenActions = [], ribbonAddIns, themeColors, collaboration, customization, storage, fileProviders, onworkbookchange, onworkbookerror, onselectionchange, ondirtychange, onreadonlychange, onfilecommand, onworkbookwarning, onribbonaction, onribboncustomize, onsheetchange, onribbonaddin, oncollaborationchange, onready }: Props = $props();
19
+ let { workbook, bytes, src, fileName, readOnly = false, locale = 'en', theme = 'auto', authorName = 'Author', validateReplace = false, showToolbar = true, showFormulaBar = true, hiddenActions = [], ribbonAddIns, themeColors, collaboration, customization, storage, fileProviders, onworkbookchange, onworkbookerror, onselectionchange, ondirtychange, onreadonlychange, onfilecommand, onworkbookwarning, onribbonaction, onribboncustomize, onsheetchange, onribbonaddin, oncollaborationchange, onready }: Props = $props();
20
20
  let binding: EditorBinding | undefined;
21
21
  const handle = deferredHandle(() => binding);
22
22
  // Live `element` and `dirty`, the same handle vocabulary as the other frameworks (`EDITOR_HANDLE_KEYS`).
@@ -49,4 +49,4 @@
49
49
  export function getElement() { return binding?.element; }
50
50
  export { element, dirty };
51
51
  </script>
52
- <div use:attach={{ workbook, bytes, src, fileName, readOnly, locale, theme, authorName, showToolbar, showFormulaBar, hiddenActions, ribbonAddIns, themeColors, collaboration, customization, storage, fileProviders, onworkbookchange, onworkbookerror, onselectionchange, ondirtychange, onreadonlychange, onfilecommand, onworkbookwarning, onribbonaction, onribboncustomize, onsheetchange, onribbonaddin, oncollaborationchange, onready }}></div>
52
+ <div use:attach={{ workbook, bytes, src, fileName, readOnly, locale, theme, authorName, validateReplace, showToolbar, showFormulaBar, hiddenActions, ribbonAddIns, themeColors, collaboration, customization, storage, fileProviders, onworkbookchange, onworkbookerror, onselectionchange, ondirtychange, onreadonlychange, onfilecommand, onworkbookwarning, onribbonaction, onribboncustomize, onsheetchange, onribbonaddin, oncollaborationchange, onready }}></div>
package/dist/runtime.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as ooxml_core_xlsx from 'ooxml-core/xlsx';
2
2
  import * as ooxml_core_xlsx_ui from 'ooxml-core/xlsx/ui';
3
3
  import * as ooxml_core_collab from 'ooxml-core/collab';
4
- import { EditorLocaleInput, EditorThemeMode, RibbonAddInTab, XlsxThemeColors, XlsxCollaborationOptions, ExcelCustomization, SelectionChangeDetail, FileCommandDetail, RibbonAddInCommandDetail, XlsxCollaborationState, XlsxEditorElement, SurfaceHostActions, ValidationErrorDetail, SpreadsheetToolbarProps } from 'ooxml-ui/xlsx';
4
+ import { EditorLocaleInput, EditorThemeMode, RibbonAddInTab, XlsxThemeColors, XlsxCollaborationOptions, ExcelCustomization, SelectionChangeDetail, FileCommandDetail, RibbonAddInCommandDetail, XlsxCollaborationState, XlsxEditorElement, SurfaceHostActions, ValidationErrorDetail, FormatCellsOperations, FindOperations, InsertFunctionOperations, ContextMenuKind, ContextMenuModel, SpreadsheetToolbarProps } from 'ooxml-ui/xlsx';
5
5
  export * from 'ooxml-ui/xlsx';
6
6
  export { SpreadsheetToolbarProps } from 'ooxml-ui/xlsx';
7
7
  import { Workbook } from '@christophervr/xlsx-core';
@@ -28,6 +28,11 @@ interface EditorProps {
28
28
  theme?: EditorThemeMode | undefined;
29
29
  /** Author recorded on new comments. Default `Author`. */
30
30
  authorName?: string | undefined;
31
+ /**
32
+ * Replace and Replace All check each new value against the cell's data validation and leave
33
+ * cells it refuses unchanged. Default false: like Excel, Replace does not apply data validation.
34
+ */
35
+ validateReplace?: boolean | undefined;
31
36
  /** Ribbon visibility. Default true. */
32
37
  showToolbar?: boolean | undefined;
33
38
  /** Formula bar and name box visibility. Default true. */
@@ -106,7 +111,7 @@ interface EditorEventOptions {
106
111
  interface EditorOptions extends EditorProps, EditorEventOptions {
107
112
  }
108
113
  /** Single source of truth for the prop keys every adapter forwards. */
109
- declare const EDITOR_PROP_KEYS: readonly ["workbook", "bytes", "src", "fileName", "readOnly", "locale", "theme", "authorName", "showToolbar", "showFormulaBar", "hiddenActions", "ribbonAddIns", "themeColors", "collaboration", "storage", "fileProviders", "customization"];
114
+ declare const EDITOR_PROP_KEYS: readonly ["workbook", "bytes", "src", "fileName", "readOnly", "locale", "theme", "authorName", "validateReplace", "showToolbar", "showFormulaBar", "hiddenActions", "ribbonAddIns", "themeColors", "collaboration", "storage", "fileProviders", "customization"];
110
115
  type EditorPropKey = (typeof EDITOR_PROP_KEYS)[number];
111
116
  /** Single source of truth for the element events every adapter surfaces. */
112
117
  declare const EDITOR_EVENT_NAMES: readonly ["workbook-change", "workbook-error", "selection-change", "dirty-change", "readonly-change", "file-command", "workbook-warning", "ribbon-action", "ribbon-customize", "sheet-change", "office-ribbon-add-in", "collaboration-change"];
@@ -216,7 +221,18 @@ declare function mountEditorSurface(host: HTMLElement, initial?: SurfaceOptions)
216
221
  findReplace: boolean;
217
222
  insertFunction: boolean;
218
223
  validationAlert: boolean;
224
+ contextMenu: boolean;
225
+ find: boolean;
226
+ replace: boolean;
227
+ applyFormatCells: boolean;
228
+ insertFunctionCall: boolean;
229
+ };
230
+ workflows: {
231
+ formatCells: FormatCellsOperations;
232
+ find: FindOperations;
233
+ insertFunction: InsertFunctionOperations;
219
234
  };
235
+ contextMenu: (menu: ContextMenuKind, sheet?: number) => ContextMenuModel;
220
236
  labels: {
221
237
  [k: string]: string;
222
238
  };
package/dist/runtime.js CHANGED
@@ -5,7 +5,7 @@ import { writable as b } from "svelte/store";
5
5
  import * as x from "ooxml-ui/theme";
6
6
  export * from "ooxml-ui/xlsx";
7
7
  export * from "@christophervr/xlsx-core";
8
- //#region \0rolldown/runtime.js
8
+ // \0rolldown/runtime.js
9
9
  var S = Object.defineProperty, C = Object.getOwnPropertyDescriptor, w = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, E = (e, t) => {
10
10
  let n = {};
11
11
  for (var r in e) S(n, r, {
@@ -22,8 +22,7 @@ var S = Object.defineProperty, C = Object.getOwnPropertyDescriptor, w = Object.g
22
22
  }, O = (e, t, n) => (D(e, t, "default"), n && D(n, t, "default")), k = /* @__PURE__ */ E({});
23
23
  import * as A from "ooxml-ui/xlsx";
24
24
  O(k, A);
25
- //#endregion
26
- //#region packages/bindings/src/contract.ts
25
+ // packages/bindings/src/contract.ts
27
26
  var j = [
28
27
  "workbook",
29
28
  "bytes",
@@ -33,6 +32,7 @@ var j = [
33
32
  "locale",
34
33
  "theme",
35
34
  "authorName",
35
+ "validateReplace",
36
36
  "showToolbar",
37
37
  "showFormulaBar",
38
38
  "hiddenActions",
@@ -73,6 +73,10 @@ var j = [
73
73
  forward: "changed",
74
74
  fallback: "Author"
75
75
  },
76
+ validateReplace: {
77
+ forward: "changed",
78
+ fallback: !1
79
+ },
76
80
  showToolbar: {
77
81
  forward: "changed",
78
82
  fallback: !0
@@ -194,8 +198,7 @@ var z = [
194
198
  "share",
195
199
  "dirty"
196
200
  ];
197
- //#endregion
198
- //#region packages/bindings/src/index.ts
201
+ // packages/bindings/src/index.ts
199
202
  function B(t, r = {}, i = !1) {
200
203
  (0, k.defineXlsxEditor)();
201
204
  let a = t.ownerDocument.createElement("xlsx-editor");
@@ -236,7 +239,9 @@ var V = [
236
239
  "onOpenFormatCells",
237
240
  "onOpenFindReplace",
238
241
  "onOpenInsertFunction",
239
- "onOpenValidationAlert"
242
+ "onOpenValidationAlert",
243
+ "onContextMenu",
244
+ "onContextMenuItems"
240
245
  ];
241
246
  function H(e, t = {}) {
242
247
  let n = t, r = (e) => ({
@@ -259,8 +264,7 @@ function H(e, t = {}) {
259
264
  subscribe: (e) => a.subscribeEditorState(e)
260
265
  });
261
266
  }
262
- //#endregion
263
- //#region packages/bindings/src/common.ts
267
+ // packages/bindings/src/common.ts
264
268
  var U = /* @__PURE__ */ E({
265
269
  LegacyXlsError: () => d,
266
270
  csvToWorkbook: () => f,
@@ -273,8 +277,7 @@ var U = /* @__PURE__ */ E({
273
277
  sheetToCsv: () => v
274
278
  });
275
279
  O(U, k);
276
- //#endregion
277
- //#region packages/bindings/src/building-blocks.ts
280
+ // packages/bindings/src/building-blocks.ts
278
281
  var W = Object.freeze({
279
282
  active: !1,
280
283
  roomId: void 0,
@@ -392,15 +395,13 @@ function X(e, t) {
392
395
  return !1;
393
396
  }
394
397
  }
395
- //#endregion
396
- //#region packages/bindings/src/block-theme.ts
398
+ // packages/bindings/src/block-theme.ts
397
399
  function Z(e, t) {
398
400
  if (!e || typeof e != "object" || !("ownerDocument" in e)) return;
399
401
  let n = e, r = Reflect.get(x, "prepareOfficeUiBlock");
400
402
  typeof r == "function" ? r(n, t, "xlsx") : (x.installOfficeUiTheme(n.ownerDocument), n.setAttribute("data-office-block", t), n.setAttribute("data-office-product", "xlsx"));
401
403
  }
402
- //#endregion
403
- //#region packages/svelte/src/building-blocks.ts
404
+ // packages/svelte/src/building-blocks.ts
404
405
  function Q(e = {}) {
405
406
  let t = b(q()), n = K(t.set);
406
407
  return n.update(e), y(n.destroy), {
@@ -436,5 +437,4 @@ O(/* @__PURE__ */ E({
436
437
  svelteEditorOptions: () => L,
437
438
  toolbarModel: () => Y
438
439
  }), U);
439
- //#endregion
440
440
  export { P as EDITOR_CALLBACKS, N as EDITOR_CONTRACT, M as EDITOR_EVENT_NAMES, z as EDITOR_HANDLE_KEYS, j as EDITOR_PROP_KEYS, d as LegacyXlsError, Q as createViewerBuildingBlocks, f as csvToWorkbook, R as deferredHandle, p as detectWorkbookFormat, I as eventOptions, m as loadLegacyXls, h as loadWorkbook, B as mountEditor, H as mountEditorSurface, g as parseCsv, F as pickEditorProps, Z as prepareBlock, _ as saveWorkbook, X as selectReference, v as sheetToCsv, L as svelteEditorOptions, Y as toolbarModel };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xlsx-svelte-viewer",
3
- "version": "1.4.1",
3
+ "version": "2.0.0",
4
4
  "description": "Svelte 5 component for the Excel spreadsheet editor. Self-contained: includes the editor, the formula engine and the legacy .xls reader.",
5
5
  "keywords": [
6
6
  "editor",
@@ -66,11 +66,14 @@
66
66
  "access": "public"
67
67
  },
68
68
  "dependencies": {
69
- "@christophervr/xlsx-core": "^1.1.1",
70
- "ooxml-core": "^1.42.0",
71
- "ooxml-ui": "^1.45.0"
69
+ "@christophervr/xlsx-core": "^2.0.0",
70
+ "ooxml-core": "^2.0.0",
71
+ "ooxml-ui": "^2.0.0"
72
72
  },
73
73
  "peerDependencies": {
74
74
  "svelte": "^5.0.0"
75
+ },
76
+ "engines": {
77
+ "node": ">=22.3"
75
78
  }
76
79
  }