@pixerate/editor-svelte 0.111.1 → 0.112.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.
|
@@ -73,6 +73,8 @@ export declare function createReactiveSpreadsheet(options?: SpreadsheetControlle
|
|
|
73
73
|
activeSheetId: string;
|
|
74
74
|
names: import("@pixerate/editor").SpreadsheetNameInfo[];
|
|
75
75
|
controller: SpreadsheetController;
|
|
76
|
+
/** The save / load / undo contract (for `createEditorAutosave` or `createDocumentToolProvider`). */
|
|
77
|
+
editorDocument: import("@pixerate/editor/persistence").EditorDocument<import("@pixerate/editor").SpreadsheetWorkbook>;
|
|
76
78
|
getCell(rowId: string, colId: string): CellData;
|
|
77
79
|
setCellValue(rowId: string, colId: string, raw: string): void;
|
|
78
80
|
selectCell(row: number, col: number, extendSelection?: boolean): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SpreadsheetController, bindSpreadsheetTableActions } from '@pixerate/editor/spreadsheet';
|
|
1
|
+
import { SpreadsheetController, bindSpreadsheetTableActions, createSpreadsheetEditorDocument } from '@pixerate/editor/spreadsheet';
|
|
2
2
|
export function createReactiveSpreadsheet(options = {}) {
|
|
3
3
|
let doc = $state({
|
|
4
4
|
id: options.document?.id || `sheet_${Date.now()}`,
|
|
@@ -114,6 +114,8 @@ export function createReactiveSpreadsheet(options = {}) {
|
|
|
114
114
|
controller.draftValue = val;
|
|
115
115
|
},
|
|
116
116
|
controller,
|
|
117
|
+
/** The save / load / undo contract (for `createEditorAutosave` or `createDocumentToolProvider`). */
|
|
118
|
+
editorDocument: createSpreadsheetEditorDocument(controller),
|
|
117
119
|
getCell(rowId, colId) {
|
|
118
120
|
return controller.getCell(rowId, colId);
|
|
119
121
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type TokenCssOptions, type TokenModeContext, type TokenState, type TokenStore } from "@pixerate/editor/tokens";
|
|
2
|
+
import type { EditorDocument } from "@pixerate/editor/persistence";
|
|
2
3
|
export interface CreateTokensOptions {
|
|
3
4
|
/** Modes for `cssVariables` (collection id → mode id), or a getter for reactive modes. */
|
|
4
5
|
modes?: TokenModeContext | (() => TokenModeContext | undefined);
|
|
@@ -7,6 +8,8 @@ export interface CreateTokensOptions {
|
|
|
7
8
|
}
|
|
8
9
|
export interface SvelteTokens {
|
|
9
10
|
readonly store: TokenStore;
|
|
11
|
+
/** The save / load / undo contract (for `createEditorAutosave` or `createDocumentToolProvider`). */
|
|
12
|
+
readonly editorDocument: EditorDocument<TokenState>;
|
|
10
13
|
/** The store's state (reactive). */
|
|
11
14
|
readonly state: TokenState;
|
|
12
15
|
/** Resolved custom properties for `modes` (reactive), e.g. for `style:` directives. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { exportTokensCss, getTokenCssVariables, } from "@pixerate/editor/tokens";
|
|
1
|
+
import { createTokensEditorDocument, exportTokensCss, getTokenCssVariables, } from "@pixerate/editor/tokens";
|
|
2
2
|
/**
|
|
3
3
|
* Svelte 5 rune: subscribes to a `TokenStore` and exposes its state plus CSS custom properties
|
|
4
4
|
* for app theming (`<div style={tokens.style}>`, or inject `tokens.css` and switch the
|
|
@@ -12,8 +12,10 @@ export function createTokens(store, options = {}) {
|
|
|
12
12
|
const modes = () => (typeof options.modes === "function" ? options.modes() : options.modes);
|
|
13
13
|
const cssVariables = $derived(getTokenCssVariables(state, modes(), options.css));
|
|
14
14
|
const css = $derived(exportTokensCss(state, options.css));
|
|
15
|
+
const editorDocument = createTokensEditorDocument(store);
|
|
15
16
|
return {
|
|
16
17
|
store,
|
|
18
|
+
editorDocument,
|
|
17
19
|
get state() {
|
|
18
20
|
return state;
|
|
19
21
|
},
|
|
@@ -38,6 +40,9 @@ export function createTokens(store, options = {}) {
|
|
|
38
40
|
},
|
|
39
41
|
undo: () => void store.undo(),
|
|
40
42
|
redo: () => void store.redo(),
|
|
41
|
-
destroy:
|
|
43
|
+
destroy: () => {
|
|
44
|
+
unsubscribe();
|
|
45
|
+
editorDocument.destroy();
|
|
46
|
+
},
|
|
42
47
|
};
|
|
43
48
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixerate/editor-svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.112.0",
|
|
4
4
|
"description": "Svelte bindings and prompt/rich-text components for @pixerate/editor",
|
|
5
5
|
"author": "Pixerate",
|
|
6
6
|
"license": "MIT",
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
"@tiptap/extension-bubble-menu": "^2.27.3",
|
|
161
161
|
"@tiptap/extension-placeholder": "^2.27.3",
|
|
162
162
|
"@tiptap/starter-kit": "^2.27.3",
|
|
163
|
-
"@pixerate/editor": "0.
|
|
163
|
+
"@pixerate/editor": "0.153.0"
|
|
164
164
|
},
|
|
165
165
|
"peerDependencies": {
|
|
166
166
|
"@dagrejs/dagre": "^1.1.4",
|