efficient-office 0.2.1 → 0.4.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 +19 -0
- package/dist/Documents-XZ3AZVHI.js +1 -0
- package/dist/Spreadsheet-U35IV6OG.js +1 -0
- package/dist/chunk-3SRMKGQW.js +1 -0
- package/dist/chunk-CED4ECIS.js +1 -0
- package/dist/chunk-ZKFPXX72.js +1 -0
- package/dist/documents/documents.css +47 -0
- package/dist/documents/index.d.ts +240 -0
- package/dist/documents/index.js +1 -0
- package/dist/spreadsheet/index.d.ts +282 -0
- package/dist/spreadsheet/index.js +1 -0
- package/dist/spreadsheet/spreadsheet.css +14 -0
- package/package.json +24 -7
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode, ComponentType } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The Spreadsheets app's words: its English, and each language this package carries. A
|
|
6
|
+
* host hands a language in through `SpreadsheetWordsProvider`.
|
|
7
|
+
*
|
|
8
|
+
* The zh-Hans words for the file list and saving (`backToFiles` to
|
|
9
|
+
* `deleteConfirm`) are machine-written, and no person has read them yet.
|
|
10
|
+
*/
|
|
11
|
+
interface SpreadsheetWords {
|
|
12
|
+
untitled: string;
|
|
13
|
+
backToFiles: string;
|
|
14
|
+
filesHeading: string;
|
|
15
|
+
newFile: string;
|
|
16
|
+
openFile: string;
|
|
17
|
+
filesEmptyTitle: string;
|
|
18
|
+
filesEmptyBody: string;
|
|
19
|
+
deleteFile: string;
|
|
20
|
+
createFailed: string;
|
|
21
|
+
deleteFailed: string;
|
|
22
|
+
storedOpenFailed: string;
|
|
23
|
+
loading: string;
|
|
24
|
+
renameFailed: string;
|
|
25
|
+
conflict: string;
|
|
26
|
+
reload: string;
|
|
27
|
+
noStoreEdited: string;
|
|
28
|
+
noStoreClean: string;
|
|
29
|
+
deleteConfirm: (title: string) => string;
|
|
30
|
+
spreadsheetFile: string;
|
|
31
|
+
sheetBase: string;
|
|
32
|
+
menuFile: string;
|
|
33
|
+
menuEdit: string;
|
|
34
|
+
menuView: string;
|
|
35
|
+
menuInsert: string;
|
|
36
|
+
menuFormat: string;
|
|
37
|
+
menuData: string;
|
|
38
|
+
menuNew: string;
|
|
39
|
+
menuOpen: string;
|
|
40
|
+
saveExcel: string;
|
|
41
|
+
saveCsv: string;
|
|
42
|
+
email: string;
|
|
43
|
+
undo: string;
|
|
44
|
+
redo: string;
|
|
45
|
+
cut: string;
|
|
46
|
+
copy: string;
|
|
47
|
+
paste: string;
|
|
48
|
+
pasteValues: string;
|
|
49
|
+
pasteFormats: string;
|
|
50
|
+
findReplace: string;
|
|
51
|
+
clearValues: string;
|
|
52
|
+
freeze: string;
|
|
53
|
+
gridlines: string;
|
|
54
|
+
showFormulas: string;
|
|
55
|
+
rowsAbove: string;
|
|
56
|
+
rowsBelow: string;
|
|
57
|
+
columnsLeft: string;
|
|
58
|
+
columnsRight: string;
|
|
59
|
+
sheet: string;
|
|
60
|
+
function: string;
|
|
61
|
+
functions: string;
|
|
62
|
+
number: string;
|
|
63
|
+
bold: string;
|
|
64
|
+
italic: string;
|
|
65
|
+
underline: string;
|
|
66
|
+
strikethrough: string;
|
|
67
|
+
fontSize: string;
|
|
68
|
+
alignment: string;
|
|
69
|
+
borders: string;
|
|
70
|
+
wrapText: string;
|
|
71
|
+
mergeCells: string;
|
|
72
|
+
clearFormatting: string;
|
|
73
|
+
sortAscending: string;
|
|
74
|
+
sortDescending: string;
|
|
75
|
+
filter: string;
|
|
76
|
+
hideRows: string;
|
|
77
|
+
hideColumns: string;
|
|
78
|
+
unhideRows: string;
|
|
79
|
+
unhideColumns: string;
|
|
80
|
+
deleteRows: string;
|
|
81
|
+
deleteColumns: string;
|
|
82
|
+
formatGeneral: string;
|
|
83
|
+
formatNumber: string;
|
|
84
|
+
formatPercent: string;
|
|
85
|
+
formatScientific: string;
|
|
86
|
+
formatCurrency: string;
|
|
87
|
+
formatDate: string;
|
|
88
|
+
formatTime: string;
|
|
89
|
+
formatDateTime: string;
|
|
90
|
+
formatText: string;
|
|
91
|
+
bordersAll: string;
|
|
92
|
+
bordersOuter: string;
|
|
93
|
+
bordersTop: string;
|
|
94
|
+
bordersBottom: string;
|
|
95
|
+
bordersLeft: string;
|
|
96
|
+
bordersRight: string;
|
|
97
|
+
bordersNone: string;
|
|
98
|
+
alignLeft: string;
|
|
99
|
+
alignCenter: string;
|
|
100
|
+
alignRight: string;
|
|
101
|
+
alignTop: string;
|
|
102
|
+
alignMiddle: string;
|
|
103
|
+
alignBottom: string;
|
|
104
|
+
formatPainter: string;
|
|
105
|
+
fewerDecimals: string;
|
|
106
|
+
moreDecimals: string;
|
|
107
|
+
textColor: string;
|
|
108
|
+
fillColor: string;
|
|
109
|
+
nameBox: string;
|
|
110
|
+
formulaBar: string;
|
|
111
|
+
cellEditor: string;
|
|
112
|
+
selectAll: string;
|
|
113
|
+
fillHandle: string;
|
|
114
|
+
find: string;
|
|
115
|
+
replaceWith: string;
|
|
116
|
+
replace: string;
|
|
117
|
+
replaceAll: string;
|
|
118
|
+
previous: string;
|
|
119
|
+
next: string;
|
|
120
|
+
close: string;
|
|
121
|
+
matchCase: string;
|
|
122
|
+
wholeCell: string;
|
|
123
|
+
inFormulas: string;
|
|
124
|
+
addSheet: string;
|
|
125
|
+
rename: string;
|
|
126
|
+
duplicate: string;
|
|
127
|
+
moveLeft: string;
|
|
128
|
+
moveRight: string;
|
|
129
|
+
tabColor: string;
|
|
130
|
+
noColor: string;
|
|
131
|
+
deleteSheet: string;
|
|
132
|
+
deleteSheetTitle: string;
|
|
133
|
+
sheetNameTaken: string;
|
|
134
|
+
saveFailed: string;
|
|
135
|
+
openFailed: string;
|
|
136
|
+
statSum: string;
|
|
137
|
+
statAverage: string;
|
|
138
|
+
statCount: string;
|
|
139
|
+
statMin: string;
|
|
140
|
+
statMax: string;
|
|
141
|
+
blank: string;
|
|
142
|
+
clear: string;
|
|
143
|
+
apply: string;
|
|
144
|
+
sheetName: (n: number) => string;
|
|
145
|
+
filterColumn: (column: string) => string;
|
|
146
|
+
freezeRows: (n: number) => string;
|
|
147
|
+
freezeColumns: (n: number) => string;
|
|
148
|
+
freezeUpToRow: (row: number) => string;
|
|
149
|
+
freezeUpToColumn: (column: string) => string;
|
|
150
|
+
hitCount: (at: number, of: number) => string;
|
|
151
|
+
replacedCount: (n: number) => string;
|
|
152
|
+
deleteSheetMessage: (name: string) => string;
|
|
153
|
+
/** One line about a formula function, by its name; the name itself for one it has none for. */
|
|
154
|
+
functionHelp: (name: string) => string;
|
|
155
|
+
}
|
|
156
|
+
declare const ENGLISH_WORDS: SpreadsheetWords;
|
|
157
|
+
declare const ZH_HANS_WORDS: SpreadsheetWords;
|
|
158
|
+
|
|
159
|
+
declare function SpreadsheetWordsProvider({ words, children }: {
|
|
160
|
+
words: SpreadsheetWords;
|
|
161
|
+
children: ReactNode;
|
|
162
|
+
}): react.JSX.Element;
|
|
163
|
+
|
|
164
|
+
interface CellRange {
|
|
165
|
+
r1: number;
|
|
166
|
+
c1: number;
|
|
167
|
+
r2: number;
|
|
168
|
+
c2: number;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
interface CellBorders {
|
|
172
|
+
top?: boolean;
|
|
173
|
+
right?: boolean;
|
|
174
|
+
bottom?: boolean;
|
|
175
|
+
left?: boolean;
|
|
176
|
+
}
|
|
177
|
+
interface CellFormat {
|
|
178
|
+
bold?: boolean;
|
|
179
|
+
italic?: boolean;
|
|
180
|
+
underline?: boolean;
|
|
181
|
+
strike?: boolean;
|
|
182
|
+
/** Points, as Excel counts them. */
|
|
183
|
+
fontSize?: number;
|
|
184
|
+
color?: string;
|
|
185
|
+
fill?: string;
|
|
186
|
+
align?: 'left' | 'center' | 'right';
|
|
187
|
+
vAlign?: 'top' | 'middle' | 'bottom';
|
|
188
|
+
wrap?: boolean;
|
|
189
|
+
/** An Excel number format code. See `numberFormat.ts`. */
|
|
190
|
+
numFmt?: string;
|
|
191
|
+
border?: CellBorders;
|
|
192
|
+
}
|
|
193
|
+
interface SheetFilter {
|
|
194
|
+
/** The header row is `range.r1`; the rows under it are what gets filtered. */
|
|
195
|
+
range: CellRange;
|
|
196
|
+
/** By column: the displayed values unticked in its menu. */
|
|
197
|
+
excluded: Record<number, string[]>;
|
|
198
|
+
}
|
|
199
|
+
interface Sheet {
|
|
200
|
+
id: string;
|
|
201
|
+
name: string;
|
|
202
|
+
tabColor?: string;
|
|
203
|
+
rowCount: number;
|
|
204
|
+
colCount: number;
|
|
205
|
+
cells: string[][];
|
|
206
|
+
/** Keyed by `${row}:${col}`. */
|
|
207
|
+
formats: Record<string, CellFormat>;
|
|
208
|
+
colWidths: Record<number, number>;
|
|
209
|
+
rowHeights: Record<number, number>;
|
|
210
|
+
hiddenRows: number[];
|
|
211
|
+
hiddenCols: number[];
|
|
212
|
+
merges: CellRange[];
|
|
213
|
+
frozenRows: number;
|
|
214
|
+
frozenCols: number;
|
|
215
|
+
filter: SheetFilter | null;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/** What a store holds for one spreadsheet. */
|
|
219
|
+
interface Workbook {
|
|
220
|
+
sheets: Sheet[];
|
|
221
|
+
}
|
|
222
|
+
interface SpreadsheetSummary {
|
|
223
|
+
id: string;
|
|
224
|
+
title: string;
|
|
225
|
+
updatedAt: string;
|
|
226
|
+
}
|
|
227
|
+
interface StoredSpreadsheet {
|
|
228
|
+
id: string;
|
|
229
|
+
title: string;
|
|
230
|
+
/** The workbook as stored. Null for a new spreadsheet, which opens on one blank sheet. */
|
|
231
|
+
workbook: Workbook | null;
|
|
232
|
+
/** The version this workbook was read at, opaque to this package. */
|
|
233
|
+
version: string;
|
|
234
|
+
}
|
|
235
|
+
/** A save refused because somebody saved since this editor read the spreadsheet. */
|
|
236
|
+
declare class SpreadsheetsConflict extends Error {
|
|
237
|
+
}
|
|
238
|
+
interface SpreadsheetsStore {
|
|
239
|
+
list: () => Promise<SpreadsheetSummary[]>;
|
|
240
|
+
get: (id: string) => Promise<StoredSpreadsheet>;
|
|
241
|
+
create: (title: string) => Promise<StoredSpreadsheet>;
|
|
242
|
+
rename: (id: string, title: string) => Promise<void>;
|
|
243
|
+
/** Writes the workbook whole, and answers its new version. Rejects with
|
|
244
|
+
* `SpreadsheetsConflict` when `version` is no longer the stored one. */
|
|
245
|
+
save: (id: string, workbook: Workbook, version: string) => Promise<string>;
|
|
246
|
+
remove: (id: string) => Promise<void>;
|
|
247
|
+
}
|
|
248
|
+
interface SpreadsheetsHost {
|
|
249
|
+
/** Absent: nothing saves by itself. */
|
|
250
|
+
store?: SpreadsheetsStore;
|
|
251
|
+
/** Absent: a person may. */
|
|
252
|
+
canCreate?: boolean;
|
|
253
|
+
canDelete?: boolean;
|
|
254
|
+
}
|
|
255
|
+
declare function SpreadsheetsProvider({ value, children }: {
|
|
256
|
+
value: SpreadsheetsHost;
|
|
257
|
+
children: ReactNode;
|
|
258
|
+
}): react.JSX.Element;
|
|
259
|
+
|
|
260
|
+
declare const Spreadsheet: ComponentType<{
|
|
261
|
+
spreadsheetId?: string;
|
|
262
|
+
onClose?: () => void;
|
|
263
|
+
}>;
|
|
264
|
+
/** One stored spreadsheet in the editor, for a host with an address of its own for each file. */
|
|
265
|
+
declare const SpreadsheetEditor: ComponentType<{
|
|
266
|
+
id: string;
|
|
267
|
+
onClose: () => void;
|
|
268
|
+
}>;
|
|
269
|
+
declare const spreadsheetApp: {
|
|
270
|
+
readonly '/spreadsheet': {
|
|
271
|
+
readonly component: react.FunctionComponent<{
|
|
272
|
+
spreadsheetId?: string;
|
|
273
|
+
onClose?: () => void;
|
|
274
|
+
}>;
|
|
275
|
+
readonly label: "Spreadsheets";
|
|
276
|
+
readonly size: "2xl";
|
|
277
|
+
readonly appStyle: true;
|
|
278
|
+
readonly multiInstance: true;
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
export { ENGLISH_WORDS, Spreadsheet, SpreadsheetEditor, type SpreadsheetSummary, type SpreadsheetWords, SpreadsheetWordsProvider, SpreadsheetsConflict, type SpreadsheetsHost, SpreadsheetsProvider, type SpreadsheetsStore, type StoredSpreadsheet, type Workbook, ZH_HANS_WORDS, spreadsheetApp };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ENGLISH_WORDS as e,SpreadsheetWordsProvider as t,SpreadsheetsConflict as r,SpreadsheetsProvider as p,ZH_HANS_WORDS as s}from"../chunk-ZKFPXX72.js";import{lazy as a}from"react";var o=a(()=>import("../Spreadsheet-U35IV6OG.js")),m=a(()=>import("../Spreadsheet-U35IV6OG.js").then(e=>({default:e.SpreadsheetById}))),d={"/spreadsheet":{component:o,label:"Spreadsheets",size:"2xl",appStyle:!0,multiInstance:!0}};export{e as ENGLISH_WORDS,o as Spreadsheet,m as SpreadsheetEditor,t as SpreadsheetWordsProvider,r as SpreadsheetsConflict,p as SpreadsheetsProvider,s as ZH_HANS_WORDS,d as spreadsheetApp};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* The file list Documents and Spreadsheet share (./FileList.tsx), laid out as
|
|
2
|
+
Slides' deck list is. The build appends this to documents.css and
|
|
3
|
+
spreadsheet.css, so a host loads it with the app's own stylesheet. */
|
|
4
|
+
.office-filelist { display: flex; flex-direction: column; height: 100%; background: var(--surface); color: var(--ink); }
|
|
5
|
+
.office-filelist-head { display: flex; align-items: center; gap: 8px; padding: 16px; border-bottom: 1px solid var(--line); }
|
|
6
|
+
.office-filelist-head h2 { flex: 1; margin: 0; font-size: 16px; font-weight: 500; }
|
|
7
|
+
.office-filelist-empty { padding: 24px; }
|
|
8
|
+
.office-filelist-rows { flex: 1; overflow-y: auto; margin: 0; padding: 0; list-style: none; }
|
|
9
|
+
.office-filelist-row { display: flex; align-items: center; gap: 12px; padding: 8px 16px; border-bottom: 1px solid var(--line); }
|
|
10
|
+
.office-filelist-date { flex: 1; text-align: right; font-size: 14px; opacity: 0.7; }
|
|
11
|
+
.office-filelist-input { display: none; }
|
|
12
|
+
.office-conflict { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; background: var(--status-warning-bg, var(--surface-raised)); border-bottom: 1px solid var(--line); font-size: 12px; }
|
|
13
|
+
.office-open-failed { padding: 24px; }
|
|
14
|
+
.office-save-state { margin-left: auto; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-office",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Efficient Office: the EFFICIENT office apps, on efficient-shell and efficient-easel.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -21,10 +21,22 @@
|
|
|
21
21
|
"import": "./dist/slides/index.js",
|
|
22
22
|
"default": "./dist/slides/index.js"
|
|
23
23
|
},
|
|
24
|
-
"./slides.css": "./dist/slides/slides.css"
|
|
24
|
+
"./slides.css": "./dist/slides/slides.css",
|
|
25
|
+
"./documents": {
|
|
26
|
+
"types": "./dist/documents/index.d.ts",
|
|
27
|
+
"import": "./dist/documents/index.js",
|
|
28
|
+
"default": "./dist/documents/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./documents.css": "./dist/documents/documents.css",
|
|
31
|
+
"./spreadsheet": {
|
|
32
|
+
"types": "./dist/spreadsheet/index.d.ts",
|
|
33
|
+
"import": "./dist/spreadsheet/index.js",
|
|
34
|
+
"default": "./dist/spreadsheet/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./spreadsheet.css": "./dist/spreadsheet/spreadsheet.css"
|
|
25
37
|
},
|
|
26
38
|
"scripts": {
|
|
27
|
-
"build": "tsup && cp src/slides/slides.css dist/slides/slides.css",
|
|
39
|
+
"build": "tsup && cp src/slides/slides.css dist/slides/slides.css && cat src/documents/documents.css src/files/files.css > dist/documents/documents.css && cp src/files/files.css dist/spreadsheet/spreadsheet.css",
|
|
28
40
|
"typecheck": "tsc --noEmit",
|
|
29
41
|
"test": "vitest run",
|
|
30
42
|
"standalone:dev": "vite standalone",
|
|
@@ -32,14 +44,18 @@
|
|
|
32
44
|
},
|
|
33
45
|
"peerDependencies": {
|
|
34
46
|
"efficient-easel": "^26.8.0",
|
|
35
|
-
"efficient-shell": "^11.
|
|
47
|
+
"efficient-shell": "^11.12.0",
|
|
36
48
|
"pptxgenjs": "^4.0.1",
|
|
37
49
|
"react": ">=19",
|
|
38
|
-
"react-dom": ">=19"
|
|
50
|
+
"react-dom": ">=19",
|
|
51
|
+
"xlsx": "*"
|
|
39
52
|
},
|
|
40
53
|
"peerDependenciesMeta": {
|
|
41
54
|
"pptxgenjs": {
|
|
42
55
|
"optional": true
|
|
56
|
+
},
|
|
57
|
+
"xlsx": {
|
|
58
|
+
"optional": true
|
|
43
59
|
}
|
|
44
60
|
},
|
|
45
61
|
"publishConfig": {
|
|
@@ -56,7 +72,7 @@
|
|
|
56
72
|
"@types/react-dom": "^19.3.0",
|
|
57
73
|
"@vitejs/plugin-react": "^6.1.2",
|
|
58
74
|
"efficient-easel": "^26.8.0",
|
|
59
|
-
"efficient-shell": "^11.
|
|
75
|
+
"efficient-shell": "^11.12.0",
|
|
60
76
|
"jsdom": "^30.1.3",
|
|
61
77
|
"jszip": "^3.10.2",
|
|
62
78
|
"pptxgenjs": "^4.0.1",
|
|
@@ -68,6 +84,7 @@
|
|
|
68
84
|
"tsup": "^8.5.1",
|
|
69
85
|
"typescript": "^5.9.3",
|
|
70
86
|
"vite": "^8.3.5",
|
|
71
|
-
"vitest": "^5.0.5"
|
|
87
|
+
"vitest": "^5.0.5",
|
|
88
|
+
"xlsx": "^0.18.5"
|
|
72
89
|
}
|
|
73
90
|
}
|