xlsx-svelte-viewer 2.2.1 → 2.3.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 +8 -7
- package/dist/XlsxEditor.svelte +1 -1
- package/dist/runtime.d.ts +2 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
[Live demo](https://christophervr.github.io/ooxml/xlsx/demo-svelte/) · [Documentation](https://christophervr.github.io/ooxml/xlsx/) · [Svelte guide](https://christophervr.github.io/ooxml/xlsx/frameworks/svelte) · [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
|
-
[](https://christophervr.github.io/ooxml/apps/excel/)
|
|
12
12
|
|
|
13
13
|
## Install
|
|
14
14
|
|
|
@@ -66,7 +66,7 @@ The component renders one host `<div>`, which `class` and `style` style: give it
|
|
|
66
66
|
|
|
67
67
|
Props are forwarded only when their value changes, so a re-render never undoes what the user changed inside the editor (Editing or Viewing, theme, language, Customize Ribbon). Keep `customization`, `fileProviders` and `ribbonAddIns` stable between renders.
|
|
68
68
|
|
|
69
|
-
`bind:this` gives the component, whose exports are the editor handle, with live `element` and `dirty` properties (`isDirty()` and `getElement()` are deprecated). The handle has `load(bytes, fileName?)`, `newWorkbook()`, `save()`, `saveBytes('xlsx' | 'csv')`, `download(fileName?)`, `markClean()`, `openCloudFile(file)`, `select(ref)`, `getSelection()`, `setActiveSheet(index)`, `share()`, and the `dirty` and `element` properties. A method called before the editor has mounted throws `Editor is not mounted`.
|
|
69
|
+
`bind:this` gives the component, whose exports are the editor handle, with live `element` and `dirty` properties (`isDirty()` and `getElement()` are deprecated). The handle has `load(bytes, fileName?)`, `newWorkbook()`, `save()`, `saveBytes('xlsx' | 'csv' | 'ods')`, `download(fileName?)`, `markClean()`, `openCloudFile(file)`, `select(ref)`, `getSelection()`, `setActiveSheet(index)`, `share()`, and the `dirty` and `element` properties. A method called before the editor has mounted throws `Editor is not mounted`.
|
|
70
70
|
|
|
71
71
|
Full reference: [framework bindings](https://christophervr.github.io/ooxml/xlsx/bindings) and the [element API](https://christophervr.github.io/ooxml/xlsx/api).
|
|
72
72
|
|
|
@@ -92,7 +92,7 @@ See [callbacks and events](https://christophervr.github.io/ooxml/xlsx/bindings#c
|
|
|
92
92
|
|
|
93
93
|
## Open and save files
|
|
94
94
|
|
|
95
|
-
The editor opens `.xlsx`, `.xlsm` (macros never run), `.xltx`, password-protected workbooks, legacy `.xls` and `.csv`; `.xls` and `.csv` are saved as `.xlsx`. `save()` resolves to an `.xlsx` Blob and does not clear `dirty`: call `markClean()` once you have stored it, or use `download()`, which does both. `saveBytes('csv')` exports the active sheet. The model API (`createWorkbook`, `loadWorkbook`, `saveWorkbook`, `detectWorkbookFormat` and the rest of `@christophervr/xlsx-core`) is re-exported from `xlsx-svelte-viewer/runtime`, so headless work needs no second install. The editor mounts in an action, so the component is safe in server-rendered apps.
|
|
95
|
+
The editor opens `.xlsx`, `.xlsm` (macros never run), `.xltx`, password-protected workbooks, legacy `.xls`, OpenDocument `.ods` and `.fods` and `.csv`; `.xls` and `.csv` are saved as `.xlsx`, while `.ods` and `.fods` are saved as `.ods`. `save()` resolves to an `.xlsx` Blob (an `.ods` package for an `.ods` file name) and does not clear `dirty`: call `markClean()` once you have stored it, or use `download()`, which does both. `saveBytes('csv')` exports the active sheet. The model API (`createWorkbook`, `loadWorkbook`, `saveWorkbook`, `detectWorkbookFormat` and the rest of `@christophervr/xlsx-core`) is re-exported from `xlsx-svelte-viewer/runtime`, so headless work needs no second install. The editor mounts in an action, so the component is safe in server-rendered apps.
|
|
96
96
|
|
|
97
97
|
## Theming
|
|
98
98
|
|
|
@@ -104,7 +104,7 @@ The interface is available in English (`en`, the default, built in), French (`fr
|
|
|
104
104
|
|
|
105
105
|
## Status and limits
|
|
106
106
|
|
|
107
|
-
Excel is **Stable** under the [stability policy](https://github.com/ChristopherVR/ooxml/blob/main/docs/stability.md): a frozen API under semver, a [preservation guarantee](https://christophervr.github.io/ooxml/xlsx/preservation) and native Excel save and reopen checks. It does not match Microsoft Excel feature for feature.
|
|
107
|
+
Excel is **Stable** under the [stability policy](https://github.com/ChristopherVR/ooxml/blob/main/docs/project/stability.md): a frozen API under semver, a [preservation guarantee](https://christophervr.github.io/ooxml/xlsx/preservation) and native Excel save and reopen checks. It does not match Microsoft Excel feature for feature.
|
|
108
108
|
|
|
109
109
|
- `.xlsb` and `.ods` do not open.
|
|
110
110
|
- Macros never run (a `.xlsm` keeps its VBA project). External links, data connections and Power Query are kept with their cached values and never refreshed.
|
|
@@ -112,15 +112,16 @@ Excel is **Stable** under the [stability policy](https://github.com/ChristopherV
|
|
|
112
112
|
- Ink is drawn, erased and saved as Excel ink from the Draw tab, with the Ruler, and shared in a shared workbook (Ink to Math needs a handwriting recognizer the host supplies with `setInkMathRecognizer`; none is built in). Older OLE objects show as placeholders; form controls cannot be moved or resized, and buttons run no macro.
|
|
113
113
|
- In a shared room, pictures, ink, other drawings, page setup and PivotTables are not shared.
|
|
114
114
|
|
|
115
|
-
See [features and limitations](https://christophervr.github.io/ooxml/xlsx/features) and the [parity checklist](https://github.com/ChristopherVR/ooxml/blob/main/docs/parity-checklist.md).
|
|
115
|
+
See [features and limitations](https://christophervr.github.io/ooxml/xlsx/features) and the [parity checklist](https://github.com/ChristopherVR/ooxml/blob/main/docs/project/parity-checklist.md).
|
|
116
116
|
|
|
117
117
|
## Privacy and network use
|
|
118
118
|
|
|
119
119
|
Workbooks open, calculate, render, edit and save on the device. Nothing is uploaded, and nothing collects analytics or telemetry.
|
|
120
120
|
|
|
121
121
|
- **Same-origin assets.** Workers, the selected non-English language, and chart, PivotTable, picture and shape tool code load on demand from your app's origin, carrying only the asset URL. Keep `locale` at `en` to skip language requests.
|
|
122
|
+
- **@mentions.** Off unless the host sets `customization.people`. Typing `@` in a comment or reply box then passes the lower-cased words after the `@` (also when the caret enters an existing `@` token) to the host's `search` function, after a short pause. The editor makes no request itself and sends nothing from the workbook.
|
|
122
123
|
- **Fonts.** Off by default. Fonts the device lacks are downloaded from `fonts.googleapis.com` and `fonts.gstatic.com` only when the reader turns on File > Options > Trust Center "Download fonts that are not installed or embedded", or the host sets the `googleFonts` prop: `false` turns downloads off and locks the toggle, `{ baseUrl }` points at Google Fonts or your own mirror. Only public font family names are sent. Font files you pass in the `fonts` prop are registered on the page and fetched only when an entry is a URL you name; they are removed when the editor is removed.
|
|
123
|
-
- **Linked content.** Linked pictures are not fetched, external links and linked data
|
|
124
|
+
- **Linked content.** Linked pictures are not fetched, external links and connections are refreshed only through a `customization.dataSources` provider you pass (Data > Edit Links, Queries & Connections), linked data is not refreshed, and `WEBSERVICE` is not evaluated. `IMAGE` formulas fetch only through an `imageProvider` you pass.
|
|
124
125
|
- **Destinations you choose.** `src` fetches the URL you pass; sharing (`collaboration`, or a server URL the reader types in File > Share) talks only to that server, and without one connects tabs of the same browser only; OneDrive and other `fileProviders` only when you add them. Hyperlinks and the Forms link open only when the reader follows them.
|
|
125
126
|
- **On the device.** Small preferences, such as the font-download choice (`ooxml.xlsx.allowFontDownloads`), stay in localStorage.
|
|
126
127
|
|
|
@@ -128,7 +129,7 @@ See [PRIVACY.md](https://github.com/ChristopherVR/ooxml/blob/main/PRIVACY.md#wor
|
|
|
128
129
|
|
|
129
130
|
## Browser support
|
|
130
131
|
|
|
131
|
-
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)). Svelte 5. Node.js 22.3 or newer for builds, tests and server rendering. A slow calculation on open runs in a module worker from your origin, so a Content Security Policy must allow `worker-src 'self'`; without workers it runs on the page under the same time limit.
|
|
132
|
+
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/project/browser-support.md)). Svelte 5. Node.js 22.3 or newer for builds, tests and server rendering. A slow calculation on open runs in a module worker from your origin, so a Content Security Policy must allow `worker-src 'self'`; without workers it runs on the page under the same time limit.
|
|
132
133
|
|
|
133
134
|
## Documentation and demos
|
|
134
135
|
|
package/dist/XlsxEditor.svelte
CHANGED
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
export function load(input: Uint8Array | ArrayBuffer, name?: string) { return handle.load(input, name); }
|
|
39
39
|
export function newWorkbook() { handle.newWorkbook(); }
|
|
40
40
|
export function save() { return handle.save(); }
|
|
41
|
-
export function saveBytes(format?: 'xlsx' | 'csv') { return handle.saveBytes(format); }
|
|
41
|
+
export function saveBytes(format?: 'xlsx' | 'csv' | 'ods') { return handle.saveBytes(format); }
|
|
42
42
|
export function download(name?: string) { return handle.download(name); }
|
|
43
43
|
export function openCloudFile(file: CloudOpenedFile) { return handle.openCloudFile(file); }
|
|
44
44
|
export function markClean() { handle.markClean(); dirtyState = handle.dirty; }
|
package/dist/runtime.d.ts
CHANGED
|
@@ -101,7 +101,7 @@ interface EditorEventOptions {
|
|
|
101
101
|
hostReadOnly: boolean;
|
|
102
102
|
}) => void) | undefined;
|
|
103
103
|
/**
|
|
104
|
-
* A File command (new, open, save, saveAs, export, exportCsv, print) is about to run. The event is
|
|
104
|
+
* A File command (new, open, save, saveAs, export, exportCsv, print, share, close) is about to run. The event is
|
|
105
105
|
* cancelable: call `event.preventDefault()` to take the command over yourself.
|
|
106
106
|
*/
|
|
107
107
|
onFileCommand?: ((event: CustomEvent<FileCommandDetail>) => void) | undefined;
|
|
@@ -155,7 +155,7 @@ interface EditorHandle {
|
|
|
155
155
|
newWorkbook(): void;
|
|
156
156
|
/** The saved workbook as an .xlsx Blob. Does not clear `dirty`; call `markClean()` after persisting it. */
|
|
157
157
|
save(): Promise<Blob>;
|
|
158
|
-
saveBytes(format?: 'xlsx' | 'csv'): Promise<Uint8Array>;
|
|
158
|
+
saveBytes(format?: 'xlsx' | 'csv' | 'ods'): Promise<Uint8Array>;
|
|
159
159
|
/** Saves and downloads in the browser, then marks the workbook clean. */
|
|
160
160
|
download(fileName?: string): Promise<void>;
|
|
161
161
|
markClean(): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xlsx-svelte-viewer",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.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,9 +66,9 @@
|
|
|
66
66
|
"access": "public"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@christophervr/xlsx-core": "^2.0
|
|
70
|
-
"ooxml-core": "^2.
|
|
71
|
-
"ooxml-ui": "^2.
|
|
69
|
+
"@christophervr/xlsx-core": "^2.1.0",
|
|
70
|
+
"ooxml-core": "^2.11.0",
|
|
71
|
+
"ooxml-ui": "^2.10.0"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"svelte": "^5.0.0"
|