@casualoffice/sheets 0.9.0 → 0.10.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/dist/api-BI2VLYQ6.d.cts +62 -0
- package/dist/api-BI2VLYQ6.d.ts +62 -0
- package/dist/chrome.cjs +2569 -0
- package/dist/chrome.cjs.map +1 -0
- package/dist/chrome.d.cts +96 -0
- package/dist/chrome.d.ts +96 -0
- package/dist/chrome.js +2556 -0
- package/dist/chrome.js.map +1 -0
- package/dist/collab.cjs +770 -0
- package/dist/collab.cjs.map +1 -0
- package/dist/collab.d.cts +248 -0
- package/dist/collab.d.ts +248 -0
- package/dist/collab.js +737 -0
- package/dist/collab.js.map +1 -0
- package/dist/embed/embed-runtime.js +128 -128
- package/dist/embed.cjs +166 -0
- package/dist/embed.cjs.map +1 -1
- package/dist/embed.d.cts +78 -3
- package/dist/embed.d.ts +78 -3
- package/dist/embed.js +166 -0
- package/dist/embed.js.map +1 -1
- package/dist/index.cjs +262 -165
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +271 -168
- package/dist/index.js.map +1 -1
- package/dist/{protocol--KyBQUjU.d.cts → protocol-Cq4Cdoyi.d.cts} +19 -2
- package/dist/{protocol-cEzy7S0i.d.ts → protocol-DqDaG2yG.d.ts} +19 -2
- package/dist/sheets.cjs +102 -16
- package/dist/sheets.cjs.map +1 -1
- package/dist/sheets.d.cts +49 -63
- package/dist/sheets.d.ts +49 -63
- package/dist/sheets.js +111 -19
- package/dist/sheets.js.map +1 -1
- package/package.json +28 -3
- package/src/chrome/AutoSumPicker.tsx +176 -0
- package/src/chrome/BordersPicker.tsx +171 -0
- package/src/chrome/ChromeBottom.tsx +18 -0
- package/src/chrome/ChromeTop.tsx +21 -0
- package/src/chrome/ColorPicker.tsx +220 -0
- package/src/chrome/FindReplace.tsx +370 -0
- package/src/chrome/FormulaBar.tsx +378 -0
- package/src/chrome/Icon.tsx +43 -0
- package/src/chrome/MenuBar.tsx +336 -0
- package/src/chrome/NameBox.tsx +347 -0
- package/src/chrome/SheetTabs.tsx +346 -0
- package/src/chrome/StatusBar.tsx +232 -0
- package/src/chrome/Toolbar.tsx +401 -0
- package/src/chrome/fonts.ts +42 -0
- package/src/chrome/index.ts +24 -0
- package/src/collab/attachCollab.ts +151 -0
- package/src/collab/bridge-helpers.ts +97 -0
- package/src/collab/bridge.ts +885 -0
- package/src/collab/bridge.unit.test.ts +160 -0
- package/src/collab/index.ts +38 -0
- package/src/collab/replay-retry.ts +137 -0
- package/src/collab/replay-retry.unit.test.ts +223 -0
- package/src/collab/ws-url.ts +20 -0
- package/src/collab/ws-url.unit.test.ts +35 -0
- package/src/embed/EmbedHostTransport.ts +16 -1
- package/src/embed/EmbedTransport.ts +16 -0
- package/src/embed/EmbedTransport.unit.test.ts +88 -2
- package/src/embed/index.ts +7 -0
- package/src/embed/protocol.ts +34 -0
- package/src/embed-runtime/index.tsx +20 -0
- package/src/sheets/CasualSheets.tsx +204 -33
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { FUniver } from '@univerjs/core/facade';
|
|
2
|
+
import { IWorkbookData, IRange } from '@univerjs/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* CasualSheetsAPI — the imperative ref handed to a host via `<CasualSheets onReady>`.
|
|
6
|
+
*
|
|
7
|
+
* This is the SDK's stable integration surface (Excalidraw's model: props +
|
|
8
|
+
* imperative ref). Hosts drive the editor through these methods rather than
|
|
9
|
+
* reaching into Univer directly; `api.univer` is the documented escape hatch and
|
|
10
|
+
* is explicitly NOT covered by semver — everything else here is.
|
|
11
|
+
*
|
|
12
|
+
* Scope of THIS batch (SDK restructure, Phase 1 step 3):
|
|
13
|
+
* getSnapshot / loadSnapshot / getSelection / executeCommand / univer
|
|
14
|
+
*
|
|
15
|
+
* Deferred to later, clearly-scoped batches (kept off the type until they work,
|
|
16
|
+
* so the surface never advertises a method that throws):
|
|
17
|
+
* - importXlsx / exportXlsx — the xlsx I/O batch. importXlsx must NOT be a
|
|
18
|
+
* plain `import('../xlsx')` here: the main tsup config is `splitting:false`,
|
|
19
|
+
* so a dynamic import gets inlined and balloons the editor entry from ~11KB
|
|
20
|
+
* to ~200KB of parser code for hosts that never open a file. The xlsx-I/O
|
|
21
|
+
* batch wires it as its own chunk (and lifts the export converter out of
|
|
22
|
+
* apps/web — the SDK xlsx module is import-only today).
|
|
23
|
+
* - attachCollab — belongs to the storage/collab adapter phase (Phase 2);
|
|
24
|
+
* the editor ships collab-unaware until then.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/** The active selection, as a sheet-scoped range. */
|
|
28
|
+
interface RangeRef {
|
|
29
|
+
/** Workbook unit id the selection belongs to. */
|
|
30
|
+
unitId: string;
|
|
31
|
+
/** Worksheet (sub-unit) id the selection belongs to. */
|
|
32
|
+
sheetId: string;
|
|
33
|
+
/** `{ startRow, startColumn, endRow, endColumn }`. */
|
|
34
|
+
range: IRange;
|
|
35
|
+
}
|
|
36
|
+
interface CasualSheetsAPI {
|
|
37
|
+
/** Current workbook as an `IWorkbookData` snapshot. `null` before the unit
|
|
38
|
+
* is created (shouldn't happen after `onReady`, but typed defensively). */
|
|
39
|
+
getSnapshot(): IWorkbookData | null;
|
|
40
|
+
/** Replace the workbook with a new snapshot. Disposes the current unit and
|
|
41
|
+
* mounts `data` as a fresh one. */
|
|
42
|
+
loadSnapshot(data: IWorkbookData): void;
|
|
43
|
+
/** The active selection, or `null` when there is none. */
|
|
44
|
+
getSelection(): RangeRef | null;
|
|
45
|
+
/** Dispatch a Univer command by id. Resolves to the command's boolean
|
|
46
|
+
* result. */
|
|
47
|
+
executeCommand(id: string, params?: object): Promise<boolean>;
|
|
48
|
+
/** Imperative light/dark switch — the API equivalent of the reactive
|
|
49
|
+
* `appearance` prop. Flips Univer's `ThemeService.setDarkMode` (canvas
|
|
50
|
+
* colours + the `univer-dark` class Univer applies to the document root). */
|
|
51
|
+
setTheme(appearance: 'light' | 'dark'): void;
|
|
52
|
+
/** The FUniver facade — documented escape hatch, NOT covered by semver. */
|
|
53
|
+
univer: FUniver;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Build the imperative API over a live FUniver facade. The wrapper holds no
|
|
57
|
+
* state of its own — every call reads the current active workbook, so it stays
|
|
58
|
+
* correct across `loadSnapshot` swaps without the host re-acquiring the ref.
|
|
59
|
+
*/
|
|
60
|
+
declare function createCasualSheetsAPI(univerAPI: FUniver): CasualSheetsAPI;
|
|
61
|
+
|
|
62
|
+
export { type CasualSheetsAPI as C, type RangeRef as R, createCasualSheetsAPI as c };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { FUniver } from '@univerjs/core/facade';
|
|
2
|
+
import { IWorkbookData, IRange } from '@univerjs/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* CasualSheetsAPI — the imperative ref handed to a host via `<CasualSheets onReady>`.
|
|
6
|
+
*
|
|
7
|
+
* This is the SDK's stable integration surface (Excalidraw's model: props +
|
|
8
|
+
* imperative ref). Hosts drive the editor through these methods rather than
|
|
9
|
+
* reaching into Univer directly; `api.univer` is the documented escape hatch and
|
|
10
|
+
* is explicitly NOT covered by semver — everything else here is.
|
|
11
|
+
*
|
|
12
|
+
* Scope of THIS batch (SDK restructure, Phase 1 step 3):
|
|
13
|
+
* getSnapshot / loadSnapshot / getSelection / executeCommand / univer
|
|
14
|
+
*
|
|
15
|
+
* Deferred to later, clearly-scoped batches (kept off the type until they work,
|
|
16
|
+
* so the surface never advertises a method that throws):
|
|
17
|
+
* - importXlsx / exportXlsx — the xlsx I/O batch. importXlsx must NOT be a
|
|
18
|
+
* plain `import('../xlsx')` here: the main tsup config is `splitting:false`,
|
|
19
|
+
* so a dynamic import gets inlined and balloons the editor entry from ~11KB
|
|
20
|
+
* to ~200KB of parser code for hosts that never open a file. The xlsx-I/O
|
|
21
|
+
* batch wires it as its own chunk (and lifts the export converter out of
|
|
22
|
+
* apps/web — the SDK xlsx module is import-only today).
|
|
23
|
+
* - attachCollab — belongs to the storage/collab adapter phase (Phase 2);
|
|
24
|
+
* the editor ships collab-unaware until then.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/** The active selection, as a sheet-scoped range. */
|
|
28
|
+
interface RangeRef {
|
|
29
|
+
/** Workbook unit id the selection belongs to. */
|
|
30
|
+
unitId: string;
|
|
31
|
+
/** Worksheet (sub-unit) id the selection belongs to. */
|
|
32
|
+
sheetId: string;
|
|
33
|
+
/** `{ startRow, startColumn, endRow, endColumn }`. */
|
|
34
|
+
range: IRange;
|
|
35
|
+
}
|
|
36
|
+
interface CasualSheetsAPI {
|
|
37
|
+
/** Current workbook as an `IWorkbookData` snapshot. `null` before the unit
|
|
38
|
+
* is created (shouldn't happen after `onReady`, but typed defensively). */
|
|
39
|
+
getSnapshot(): IWorkbookData | null;
|
|
40
|
+
/** Replace the workbook with a new snapshot. Disposes the current unit and
|
|
41
|
+
* mounts `data` as a fresh one. */
|
|
42
|
+
loadSnapshot(data: IWorkbookData): void;
|
|
43
|
+
/** The active selection, or `null` when there is none. */
|
|
44
|
+
getSelection(): RangeRef | null;
|
|
45
|
+
/** Dispatch a Univer command by id. Resolves to the command's boolean
|
|
46
|
+
* result. */
|
|
47
|
+
executeCommand(id: string, params?: object): Promise<boolean>;
|
|
48
|
+
/** Imperative light/dark switch — the API equivalent of the reactive
|
|
49
|
+
* `appearance` prop. Flips Univer's `ThemeService.setDarkMode` (canvas
|
|
50
|
+
* colours + the `univer-dark` class Univer applies to the document root). */
|
|
51
|
+
setTheme(appearance: 'light' | 'dark'): void;
|
|
52
|
+
/** The FUniver facade — documented escape hatch, NOT covered by semver. */
|
|
53
|
+
univer: FUniver;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Build the imperative API over a live FUniver facade. The wrapper holds no
|
|
57
|
+
* state of its own — every call reads the current active workbook, so it stays
|
|
58
|
+
* correct across `loadSnapshot` swaps without the host re-acquiring the ref.
|
|
59
|
+
*/
|
|
60
|
+
declare function createCasualSheetsAPI(univerAPI: FUniver): CasualSheetsAPI;
|
|
61
|
+
|
|
62
|
+
export { type CasualSheetsAPI as C, type RangeRef as R, createCasualSheetsAPI as c };
|