xlsx-svelte-viewer 1.3.0 → 1.4.1
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 +4 -0
- package/dist/XlsxEditor.svelte +4 -2
- package/dist/runtime.d.ts +14 -3
- package/dist/runtime.js +8 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -67,6 +67,10 @@ diagnostics and the feature guide before relying on preservation.
|
|
|
67
67
|
[Framework guide](https://christophervr.github.io/ooxml/xlsx/frameworks/svelte) |
|
|
68
68
|
[Bindings](https://christophervr.github.io/ooxml/xlsx/bindings)
|
|
69
69
|
|
|
70
|
+
## Privacy and network use
|
|
71
|
+
|
|
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).
|
|
73
|
+
|
|
70
74
|
## License
|
|
71
75
|
|
|
72
76
|
Apache-2.0.
|
package/dist/XlsxEditor.svelte
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import type { CloudOpenedFile } from 'ooxml-core/embedding';
|
|
2
3
|
import { deferredHandle, mountEditor, svelteEditorOptions, type EditorBinding, type EditorEventHandlers, type EditorOptions, type EditorProps, type EditorHandle } from './runtime.js';
|
|
3
4
|
type Props = EditorProps & {
|
|
4
5
|
onworkbookchange?: EditorEventHandlers['workbook-change'];
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
oncollaborationchange?: EditorEventHandlers['collaboration-change'];
|
|
16
17
|
onready?: EditorEventHandlers['ready'];
|
|
17
18
|
};
|
|
18
|
-
let { workbook, bytes, src, fileName, readOnly = false, locale = 'en', theme = 'auto', authorName = 'Author', showToolbar = true, showFormulaBar = true, hiddenActions = [], ribbonAddIns, themeColors, collaboration, customization, storage, 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', 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
20
|
let binding: EditorBinding | undefined;
|
|
20
21
|
const handle = deferredHandle(() => binding);
|
|
21
22
|
// Live `element` and `dirty`, the same handle vocabulary as the other frameworks (`EDITOR_HANDLE_KEYS`).
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
export function save() { return handle.save(); }
|
|
37
38
|
export function saveBytes(format?: 'xlsx' | 'csv') { return handle.saveBytes(format); }
|
|
38
39
|
export function download(name?: string) { return handle.download(name); }
|
|
40
|
+
export function openCloudFile(file: CloudOpenedFile) { return handle.openCloudFile(file); }
|
|
39
41
|
export function markClean() { handle.markClean(); dirtyState = handle.dirty; }
|
|
40
42
|
export function select(ref: string) { handle.select(ref); }
|
|
41
43
|
export function getSelection() { return handle.getSelection(); }
|
|
@@ -47,4 +49,4 @@
|
|
|
47
49
|
export function getElement() { return binding?.element; }
|
|
48
50
|
export { element, dirty };
|
|
49
51
|
</script>
|
|
50
|
-
<div use:attach={{ workbook, bytes, src, fileName, readOnly, locale, theme, authorName, showToolbar, showFormulaBar, hiddenActions, ribbonAddIns, themeColors, collaboration, customization, storage, 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, 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
|
@@ -6,7 +6,7 @@ export * from 'ooxml-ui/xlsx';
|
|
|
6
6
|
export { SpreadsheetToolbarProps } from 'ooxml-ui/xlsx';
|
|
7
7
|
import { Workbook } from '@christophervr/xlsx-core';
|
|
8
8
|
export * from '@christophervr/xlsx-core';
|
|
9
|
-
import { DocumentStorage } from 'ooxml-core/embedding';
|
|
9
|
+
import { DocumentStorage, CloudFileProvider, CloudOpenedFile } from 'ooxml-core/embedding';
|
|
10
10
|
import { BindingContract } from 'ooxml-ui/bindings';
|
|
11
11
|
export { LegacyXlsError, WorkbookFormat, csvToWorkbook, detectWorkbookFormat, loadLegacyXls, loadWorkbook, parseCsv, saveWorkbook, sheetToCsv } from '@christophervr/xlsx-core/load';
|
|
12
12
|
import * as svelte_store from 'svelte/store';
|
|
@@ -48,6 +48,12 @@ interface EditorProps {
|
|
|
48
48
|
* File > Open to `storage.open()` when it has one. `file-command` still fires first.
|
|
49
49
|
*/
|
|
50
50
|
storage?: DocumentStorage | null | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Cloud places (OneDrive, or a host's own `CloudFileProvider`) File > Open offers next to "This
|
|
53
|
+
* device". A workbook opened from one saves back to that file; empty or omitted keeps Open as it
|
|
54
|
+
* was. Forwarded when the array changes, so keep it stable.
|
|
55
|
+
*/
|
|
56
|
+
fileProviders?: readonly CloudFileProvider[] | null | undefined;
|
|
51
57
|
/**
|
|
52
58
|
* Host customisation (`ExcelCustomization`): `capabilities`, `backstage.extraPages` and
|
|
53
59
|
* `contextMenu.extraCommands`. Forwarded when the object changes, so keep it stable (memoise
|
|
@@ -100,7 +106,7 @@ interface EditorEventOptions {
|
|
|
100
106
|
interface EditorOptions extends EditorProps, EditorEventOptions {
|
|
101
107
|
}
|
|
102
108
|
/** Single source of truth for the prop keys every adapter forwards. */
|
|
103
|
-
declare const EDITOR_PROP_KEYS: readonly ["workbook", "bytes", "src", "fileName", "readOnly", "locale", "theme", "authorName", "showToolbar", "showFormulaBar", "hiddenActions", "ribbonAddIns", "themeColors", "collaboration", "storage", "customization"];
|
|
109
|
+
declare const EDITOR_PROP_KEYS: readonly ["workbook", "bytes", "src", "fileName", "readOnly", "locale", "theme", "authorName", "showToolbar", "showFormulaBar", "hiddenActions", "ribbonAddIns", "themeColors", "collaboration", "storage", "fileProviders", "customization"];
|
|
104
110
|
type EditorPropKey = (typeof EDITOR_PROP_KEYS)[number];
|
|
105
111
|
/** Single source of truth for the element events every adapter surfaces. */
|
|
106
112
|
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"];
|
|
@@ -131,6 +137,11 @@ interface EditorHandle {
|
|
|
131
137
|
/** Saves and downloads in the browser, then marks the workbook clean. */
|
|
132
138
|
download(fileName?: string): Promise<void>;
|
|
133
139
|
markClean(): void;
|
|
140
|
+
/**
|
|
141
|
+
* Opens a file got from a `CloudFileProvider` (the host's own picker or a start page) the way File >
|
|
142
|
+
* Open > OneDrive does: its name, read-only state and storage for Save.
|
|
143
|
+
*/
|
|
144
|
+
openCloudFile(file: CloudOpenedFile): Promise<void>;
|
|
134
145
|
select(ref: string): void;
|
|
135
146
|
getSelection(): string;
|
|
136
147
|
setActiveSheet(index: number): void;
|
|
@@ -166,7 +177,7 @@ declare function deferredHandle(current: () => EditorBinding | null | undefined)
|
|
|
166
177
|
* The imperative handle every framework exposes (React ref, Vue template ref, Angular component
|
|
167
178
|
* instance, Solid `editorRef`, Svelte component instance). `contract-parity.test.ts` checks each.
|
|
168
179
|
*/
|
|
169
|
-
declare const EDITOR_HANDLE_KEYS: readonly ["element", "load", "newWorkbook", "save", "saveBytes", "download", "markClean", "select", "getSelection", "setActiveSheet", "share", "dirty"];
|
|
180
|
+
declare const EDITOR_HANDLE_KEYS: readonly ["element", "load", "newWorkbook", "save", "saveBytes", "download", "markClean", "openCloudFile", "select", "getSelection", "setActiveSheet", "share", "dirty"];
|
|
170
181
|
type EditorHandleKey = (typeof EDITOR_HANDLE_KEYS)[number];
|
|
171
182
|
|
|
172
183
|
/** All framework adapters share property, event and lifecycle semantics here. */
|
package/dist/runtime.js
CHANGED
|
@@ -40,6 +40,7 @@ var j = [
|
|
|
40
40
|
"themeColors",
|
|
41
41
|
"collaboration",
|
|
42
42
|
"storage",
|
|
43
|
+
"fileProviders",
|
|
43
44
|
"customization"
|
|
44
45
|
], M = [
|
|
45
46
|
"workbook-change",
|
|
@@ -93,6 +94,10 @@ var j = [
|
|
|
93
94
|
forward: "changed",
|
|
94
95
|
apply: (e, t) => e.storage = t ?? void 0
|
|
95
96
|
},
|
|
97
|
+
fileProviders: {
|
|
98
|
+
forward: "changed",
|
|
99
|
+
apply: (e, t) => e.fileProviders = t ?? []
|
|
100
|
+
},
|
|
96
101
|
themeColors: {
|
|
97
102
|
forward: "changed",
|
|
98
103
|
same: l,
|
|
@@ -151,6 +156,7 @@ var j = [
|
|
|
151
156
|
saveBytes: "async",
|
|
152
157
|
download: "async",
|
|
153
158
|
markClean: "optional-call",
|
|
159
|
+
openCloudFile: "async",
|
|
154
160
|
select: "call",
|
|
155
161
|
getSelection: "call",
|
|
156
162
|
setActiveSheet: "call",
|
|
@@ -181,6 +187,7 @@ var z = [
|
|
|
181
187
|
"saveBytes",
|
|
182
188
|
"download",
|
|
183
189
|
"markClean",
|
|
190
|
+
"openCloudFile",
|
|
184
191
|
"select",
|
|
185
192
|
"getSelection",
|
|
186
193
|
"setActiveSheet",
|
|
@@ -209,6 +216,7 @@ function B(t, r = {}, i = !1) {
|
|
|
209
216
|
saveBytes: (e) => a.saveBytes(e),
|
|
210
217
|
download: (e) => a.download(e),
|
|
211
218
|
markClean: () => a.markClean(),
|
|
219
|
+
openCloudFile: (e) => a.openCloudFile(e),
|
|
212
220
|
select: (e) => a.select(e),
|
|
213
221
|
getSelection: () => a.getSelection(),
|
|
214
222
|
setActiveSheet: (e) => a.setActiveSheet(e),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xlsx-svelte-viewer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
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": "^1.1.
|
|
70
|
-
"ooxml-core": "^1.
|
|
71
|
-
"ooxml-ui": "^1.
|
|
69
|
+
"@christophervr/xlsx-core": "^1.1.1",
|
|
70
|
+
"ooxml-core": "^1.42.0",
|
|
71
|
+
"ooxml-ui": "^1.45.0"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"svelte": "^5.0.0"
|