efficient-office 0.5.1 → 0.6.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 +17 -0
- package/dist/Documents-HT324TAY.js +1 -0
- package/dist/Slides-EUDBOA5K.js +1 -0
- package/dist/SlidesEditor-6KDRHX4H.js +1 -0
- package/dist/Spreadsheet-SOF7NDLP.js +1 -0
- package/dist/chunk-2AKHYM66.js +1 -0
- package/dist/chunk-2PIEDEY5.js +1 -0
- package/dist/chunk-2TZUCKZ7.js +1 -0
- package/dist/chunk-AVUZSUQD.js +1 -0
- package/dist/chunk-E4N3DBYM.js +1 -0
- package/dist/chunk-JKYJGXJE.js +1 -0
- package/dist/chunk-N26CBJZA.js +1 -0
- package/dist/chunk-PWF37Y2N.js +1 -0
- package/dist/chunk-QSM7NWZ2.js +1 -0
- package/dist/chunk-RHW2M2UY.js +1 -0
- package/dist/chunk-SB3YS3LH.js +1 -0
- package/dist/chunk-USKJW3BA.js +1 -0
- package/dist/chunk-VKCG3LPQ.js +1 -0
- package/dist/chunk-XKOHIZO5.js +1 -0
- package/dist/chunk-YYHJJIA4.js +1 -0
- package/dist/deckPdf-Q4OXQ7HV.js +1 -0
- package/dist/documents/index.d.ts +5 -1
- package/dist/documents/index.js +1 -1
- package/dist/docxPdf-NCSEKI4J.js +1 -0
- package/dist/options-Djr917yc.d.ts +10 -0
- package/dist/pptxImport-QEKBZWT2.js +1 -0
- package/dist/slides/index.d.ts +124 -57
- package/dist/slides/index.js +1 -1
- package/dist/spreadsheet/index.d.ts +7 -1
- package/dist/spreadsheet/index.js +1 -1
- package/dist/workbookPdf-OJDSHKRR.js +1 -0
- package/dist/xlsxFile-B2JCZCOL.js +1 -0
- package/package.json +6 -1
- package/dist/Documents-XZ3AZVHI.js +0 -1
- package/dist/Slides-ILKPLYAJ.js +0 -1
- package/dist/SlidesEditor-44ITB7B2.js +0 -1
- package/dist/Spreadsheet-R5MYRMOF.js +0 -1
- package/dist/chunk-372GCYWH.js +0 -1
- package/dist/chunk-3JJCHWPJ.js +0 -1
- package/dist/chunk-BTDWPUTS.js +0 -1
- package/dist/chunk-CED4ECIS.js +0 -1
package/dist/slides/index.d.ts
CHANGED
|
@@ -1,5 +1,111 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, ComponentType } from 'react';
|
|
3
|
+
import { P as PdfOptions } from '../options-Djr917yc.js';
|
|
4
|
+
|
|
5
|
+
interface Box {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
w: number;
|
|
9
|
+
h: number;
|
|
10
|
+
}
|
|
11
|
+
interface ElementBase extends Box {
|
|
12
|
+
id: string;
|
|
13
|
+
rotation: number;
|
|
14
|
+
}
|
|
15
|
+
interface TextElement extends ElementBase {
|
|
16
|
+
type: 'text';
|
|
17
|
+
text: string;
|
|
18
|
+
fontSize: number;
|
|
19
|
+
bold: boolean;
|
|
20
|
+
color: string;
|
|
21
|
+
align: 'left' | 'center' | 'right';
|
|
22
|
+
}
|
|
23
|
+
type ShapeKind = 'rect' | 'ellipse' | 'roundRect' | 'diamond' | 'line';
|
|
24
|
+
interface ShapeElement extends ElementBase {
|
|
25
|
+
type: 'shape';
|
|
26
|
+
/** A `line` runs left to right through the middle of its box; `rotation` turns it. */
|
|
27
|
+
shape: ShapeKind;
|
|
28
|
+
fill: string;
|
|
29
|
+
stroke?: string;
|
|
30
|
+
strokeWidth?: number;
|
|
31
|
+
/** A `roundRect`'s corners, in slide pixels. */
|
|
32
|
+
radius?: number;
|
|
33
|
+
arrowEnd?: boolean;
|
|
34
|
+
arrowStart?: boolean;
|
|
35
|
+
}
|
|
36
|
+
interface ImageElement extends ElementBase {
|
|
37
|
+
type: 'image';
|
|
38
|
+
src: string;
|
|
39
|
+
alt: string;
|
|
40
|
+
}
|
|
41
|
+
interface ChartPoint {
|
|
42
|
+
label: string;
|
|
43
|
+
value: number;
|
|
44
|
+
}
|
|
45
|
+
interface ChartElement extends ElementBase {
|
|
46
|
+
type: 'chart';
|
|
47
|
+
kind: 'bar' | 'line';
|
|
48
|
+
points: ChartPoint[];
|
|
49
|
+
color: string;
|
|
50
|
+
}
|
|
51
|
+
interface TableElement extends ElementBase {
|
|
52
|
+
type: 'table';
|
|
53
|
+
rows: string[][];
|
|
54
|
+
headerFill: string;
|
|
55
|
+
/** With none of these, a table draws at the standard size with even rows and columns. */
|
|
56
|
+
fontSize?: number;
|
|
57
|
+
headerColor?: string;
|
|
58
|
+
/** Each column's share of the width; together they make 1. */
|
|
59
|
+
columnWidths?: number[];
|
|
60
|
+
/** In slide pixels, drawn in proportion to the box. */
|
|
61
|
+
rowHeights?: number[];
|
|
62
|
+
/** By row and column; null takes the table's own look. */
|
|
63
|
+
cellFills?: (string | null)[][];
|
|
64
|
+
cellColors?: (string | null)[][];
|
|
65
|
+
}
|
|
66
|
+
type SlideElement = TextElement | ShapeElement | ImageElement | ChartElement | TableElement;
|
|
67
|
+
interface Slide {
|
|
68
|
+
id: string;
|
|
69
|
+
background: string;
|
|
70
|
+
notes: string;
|
|
71
|
+
elements: SlideElement[];
|
|
72
|
+
}
|
|
73
|
+
interface DeckDocument {
|
|
74
|
+
slides: Slide[];
|
|
75
|
+
}
|
|
76
|
+
/** A document that came back from the server with nothing in it yet. */
|
|
77
|
+
declare function asDocument(stored: unknown): DeckDocument;
|
|
78
|
+
|
|
79
|
+
interface PptxImportNotes {
|
|
80
|
+
slides: number;
|
|
81
|
+
images: number;
|
|
82
|
+
imageBytesBefore: number;
|
|
83
|
+
imageBytesAfter: number;
|
|
84
|
+
/** Typefaces in the file that are not the deck's font. */
|
|
85
|
+
fontsReplaced: string[];
|
|
86
|
+
/** Slides carrying `p:timing`. */
|
|
87
|
+
animationsDropped: number;
|
|
88
|
+
/** Text boxes whose runs had differing formats. */
|
|
89
|
+
mixedTextSimplified: number;
|
|
90
|
+
/** Shapes with no deck equivalent (charts, custom geometry, video). */
|
|
91
|
+
skipped: number;
|
|
92
|
+
}
|
|
93
|
+
interface PptxImportOptions {
|
|
94
|
+
/** Stores one prepared image, answering the address a deck image uses. */
|
|
95
|
+
storeImage: (image: Blob, name: string) => Promise<string>;
|
|
96
|
+
/** Called as work proceeds: 0..1. */
|
|
97
|
+
onProgress?: (fraction: number) => void;
|
|
98
|
+
signal?: AbortSignal;
|
|
99
|
+
/** Replaces the browser's canvas compression; tests and Node pass it. */
|
|
100
|
+
prepareImage?: (bytes: Uint8Array, contentType: string) => Promise<Blob>;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
declare class PptxPasswordError extends Error {
|
|
104
|
+
constructor(message?: string);
|
|
105
|
+
}
|
|
106
|
+
declare class PptxUnreadableError extends Error {
|
|
107
|
+
constructor(message?: string);
|
|
108
|
+
}
|
|
3
109
|
|
|
4
110
|
/**
|
|
5
111
|
* The Slides app's words: its English, and each language this package carries. A
|
|
@@ -76,6 +182,10 @@ interface SlidesWords {
|
|
|
76
182
|
colour: string;
|
|
77
183
|
rectangle: string;
|
|
78
184
|
ellipse: string;
|
|
185
|
+
roundedRectangle: string;
|
|
186
|
+
diamond: string;
|
|
187
|
+
lineShape: string;
|
|
188
|
+
outlineColour: string;
|
|
79
189
|
imageAddress: string;
|
|
80
190
|
chooseImage: string;
|
|
81
191
|
imageTitle: string;
|
|
@@ -89,6 +199,12 @@ interface SlidesWords {
|
|
|
89
199
|
rows: string;
|
|
90
200
|
rowsHint: string;
|
|
91
201
|
headingColour: string;
|
|
202
|
+
pptxPasswordProtected: string;
|
|
203
|
+
pptxUnreadable: string;
|
|
204
|
+
pptxLegacyFormat: string;
|
|
205
|
+
pptxTooManySlides: (count: number, limit: number) => string;
|
|
206
|
+
pptxTooLarge: (size: string, limit: number) => string;
|
|
207
|
+
pdfSlideFailed: (slide: number) => string;
|
|
92
208
|
}
|
|
93
209
|
declare const ENGLISH_WORDS: SlidesWords;
|
|
94
210
|
/** Machine-written and not yet reviewed. */
|
|
@@ -139,62 +255,6 @@ declare function SlidesProvider({ value, children }: {
|
|
|
139
255
|
children: ReactNode;
|
|
140
256
|
}): react.JSX.Element;
|
|
141
257
|
|
|
142
|
-
interface Box {
|
|
143
|
-
x: number;
|
|
144
|
-
y: number;
|
|
145
|
-
w: number;
|
|
146
|
-
h: number;
|
|
147
|
-
}
|
|
148
|
-
interface ElementBase extends Box {
|
|
149
|
-
id: string;
|
|
150
|
-
rotation: number;
|
|
151
|
-
}
|
|
152
|
-
interface TextElement extends ElementBase {
|
|
153
|
-
type: 'text';
|
|
154
|
-
text: string;
|
|
155
|
-
fontSize: number;
|
|
156
|
-
bold: boolean;
|
|
157
|
-
color: string;
|
|
158
|
-
align: 'left' | 'center' | 'right';
|
|
159
|
-
}
|
|
160
|
-
interface ShapeElement extends ElementBase {
|
|
161
|
-
type: 'shape';
|
|
162
|
-
shape: 'rect' | 'ellipse';
|
|
163
|
-
fill: string;
|
|
164
|
-
}
|
|
165
|
-
interface ImageElement extends ElementBase {
|
|
166
|
-
type: 'image';
|
|
167
|
-
src: string;
|
|
168
|
-
alt: string;
|
|
169
|
-
}
|
|
170
|
-
interface ChartPoint {
|
|
171
|
-
label: string;
|
|
172
|
-
value: number;
|
|
173
|
-
}
|
|
174
|
-
interface ChartElement extends ElementBase {
|
|
175
|
-
type: 'chart';
|
|
176
|
-
kind: 'bar' | 'line';
|
|
177
|
-
points: ChartPoint[];
|
|
178
|
-
color: string;
|
|
179
|
-
}
|
|
180
|
-
interface TableElement extends ElementBase {
|
|
181
|
-
type: 'table';
|
|
182
|
-
rows: string[][];
|
|
183
|
-
headerFill: string;
|
|
184
|
-
}
|
|
185
|
-
type SlideElement = TextElement | ShapeElement | ImageElement | ChartElement | TableElement;
|
|
186
|
-
interface Slide {
|
|
187
|
-
id: string;
|
|
188
|
-
background: string;
|
|
189
|
-
notes: string;
|
|
190
|
-
elements: SlideElement[];
|
|
191
|
-
}
|
|
192
|
-
interface DeckDocument {
|
|
193
|
-
slides: Slide[];
|
|
194
|
-
}
|
|
195
|
-
/** A document that came back from the server with nothing in it yet. */
|
|
196
|
-
declare function asDocument(stored: unknown): DeckDocument;
|
|
197
|
-
|
|
198
258
|
/** The slide at `width` pixels. `editingId`'s element gives way to `editor`. */
|
|
199
259
|
declare function SlideView({ slide, width, editingId, editor, }: {
|
|
200
260
|
slide: Slide;
|
|
@@ -219,5 +279,12 @@ declare const slidesApps: {
|
|
|
219
279
|
readonly autoHeight: false;
|
|
220
280
|
};
|
|
221
281
|
};
|
|
282
|
+
/** Throws `PptxPasswordError` for an encrypted file, `PptxUnreadableError` for one that is not a pptx. */
|
|
283
|
+
declare function importPptx(file: Blob, options: PptxImportOptions): Promise<{
|
|
284
|
+
document: DeckDocument;
|
|
285
|
+
notes: PptxImportNotes;
|
|
286
|
+
}>;
|
|
287
|
+
/** A PDF with one page for each slide, drawn as `SlideView` draws it. */
|
|
288
|
+
declare function deckToPdf(document: DeckDocument, options?: PdfOptions): Promise<Blob>;
|
|
222
289
|
|
|
223
|
-
export { DeckEditor, type DeckSummary, ENGLISH_WORDS, SlideView, Slides, SlidesConflict, type SlidesHost, SlidesProvider, type SlidesStore, type SlidesWords, type StoredDeck, ZH_HANS_WORDS, asDocument, browserSlidesStore, slidesApps };
|
|
290
|
+
export { DeckEditor, type DeckSummary, ENGLISH_WORDS, PdfOptions, type PptxImportNotes, type PptxImportOptions, PptxPasswordError, PptxUnreadableError, SlideView, Slides, SlidesConflict, type SlidesHost, SlidesProvider, type SlidesStore, type SlidesWords, type StoredDeck, ZH_HANS_WORDS, asDocument, browserSlidesStore, deckToPdf, importPptx, slidesApps };
|
package/dist/slides/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{SlidesConflict as t,SlidesProvider as o,browserSlidesStore as r}from"../chunk-QSM7NWZ2.js";import{PptxPasswordError as i,PptxUnreadableError as p}from"../chunk-USKJW3BA.js";import{SlideView as s}from"../chunk-2AKHYM66.js";import{asDocument as e}from"../chunk-2TZUCKZ7.js";import{ENGLISH_WORDS as m,ZH_HANS_WORDS as n}from"../chunk-SB3YS3LH.js";import{lazy as c}from"react";var a=c(()=>import("../Slides-EUDBOA5K.js")),f=c(()=>import("../Slides-EUDBOA5K.js").then(t=>({default:t.OpenDeck}))),u={"/slides":{component:a,label:"Slides",size:"3xl",appStyle:!0,flushBody:!0,autoHeight:!1}};async function d(t,o){const{importPptx:r}=await(import("../pptxImport-QEKBZWT2.js"));return r(t,o)}async function l(t,o){const{deckToPdf:r}=await(import("../deckPdf-Q4OXQ7HV.js"));return r(t,o)}export{f as DeckEditor,m as ENGLISH_WORDS,i as PptxPasswordError,p as PptxUnreadableError,s as SlideView,a as Slides,t as SlidesConflict,o as SlidesProvider,n as ZH_HANS_WORDS,e as asDocument,r as browserSlidesStore,l as deckToPdf,d as importPptx,u as slidesApps};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode, ComponentType } from 'react';
|
|
3
3
|
import { SpreadsheetPreviewData } from 'efficient-shell/apps';
|
|
4
|
+
import { P as PdfOptions } from '../options-Djr917yc.js';
|
|
4
5
|
|
|
5
6
|
interface CellRange {
|
|
6
7
|
r1: number;
|
|
@@ -333,6 +334,7 @@ interface SpreadsheetWords {
|
|
|
333
334
|
deleteSheetMessage: (name: string) => string;
|
|
334
335
|
/** One line about a formula function, by its name; the name itself for one it has none for. */
|
|
335
336
|
functionHelp: (name: string) => string;
|
|
337
|
+
pdfPageFailed: (page: number) => string;
|
|
336
338
|
}
|
|
337
339
|
declare const ENGLISH_WORDS: SpreadsheetWords;
|
|
338
340
|
declare const ZH_HANS_WORDS: SpreadsheetWords;
|
|
@@ -416,5 +418,9 @@ declare const spreadsheetApp: {
|
|
|
416
418
|
readonly multiInstance: true;
|
|
417
419
|
};
|
|
418
420
|
};
|
|
421
|
+
/** The sheets of an `.xlsx`, formulas and formatting kept. */
|
|
422
|
+
declare function readXlsx(bytes: Uint8Array): Promise<Sheet[]>;
|
|
423
|
+
/** A PDF of each sheet's displayed values, A4 landscape, its header row on every page. */
|
|
424
|
+
declare function workbookToPdf(sheets: readonly Sheet[], options?: PdfOptions): Promise<Blob>;
|
|
419
425
|
|
|
420
|
-
export { ENGLISH_WORDS, type Sheet, type SheetBridge, type SheetBridgeState, type SheetEditFormat, type SheetEditOp, SheetEditRefused, type SheetEditResult, type SheetEditorPort, type SheetSnapshot, Spreadsheet, SpreadsheetEditor, SpreadsheetPane, type SpreadsheetSummary, type SpreadsheetWords, SpreadsheetWordsProvider, SpreadsheetsConflict, type SpreadsheetsHost, SpreadsheetsProvider, type SpreadsheetsStore, type StoredSpreadsheet, type Workbook, ZH_HANS_WORDS, applySheetOps, createSheetBridge, spreadsheetApp };
|
|
426
|
+
export { ENGLISH_WORDS, PdfOptions, type Sheet, type SheetBridge, type SheetBridgeState, type SheetEditFormat, type SheetEditOp, SheetEditRefused, type SheetEditResult, type SheetEditorPort, type SheetSnapshot, Spreadsheet, SpreadsheetEditor, SpreadsheetPane, type SpreadsheetSummary, type SpreadsheetWords, SpreadsheetWordsProvider, SpreadsheetsConflict, type SpreadsheetsHost, SpreadsheetsProvider, type SpreadsheetsStore, type StoredSpreadsheet, type Workbook, ZH_HANS_WORDS, applySheetOps, createSheetBridge, readXlsx, spreadsheetApp, workbookToPdf };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{SpreadsheetWordsProvider as e,SpreadsheetsConflict as t,SpreadsheetsProvider as n}from"../chunk-YYHJJIA4.js";import{ENGLISH_WORDS as s,ZH_HANS_WORDS as r}from"../chunk-2PIEDEY5.js";import{cellDisplay as o,cellLabel as a,changeStructure as l,clearValues as c,colIndex as i,commitEntry as h,isFormula as u,makeEvaluator as p,newSheet as d,parseRangeLabel as m,rangeLabel as f,renameSheet as w,sortRange as g,updateFormats as b,usedBounds as k}from"../chunk-VKCG3LPQ.js";import{lazy as S}from"react";var L=class extends Error{};function y(e,t,n){if(!t)return Math.min(n,e.length-1);const s=e.findIndex(e=>e.name.toLowerCase()===t.trim().toLowerCase());if(s<0)throw new L(`there is no sheet "${t}" any more`);return s}function _(e){const t=m(e);if(!t)throw new L(`"${e}" is not a range`);return t}function j(e,t,n){return e.map((e,s)=>s===t?n(e):e)}function x(e,t){const n={...e},s=(e,t)=>{void 0!==t&&(null===t||!1===t?delete n[e]:n[e]=t)};return s("bold",t.bold),s("italic",t.italic),s("underline",t.underline),s("align",t.align),s("fill",t.fill),s("color",t.color),s("numFmt",t.numFmt),n}function P(e,t,n){let s=e;for(const e of n)switch(e.op){case"add_sheet":if(s.some(t=>t.name.toLowerCase()===e.name.toLowerCase()))throw new L(`there is already a sheet "${e.name}"`);s=[...s,d(e.name)];break;case"rename_sheet":s=w(s,y(s,e.sheet,t),e.name);break;case"set_cells":{const n=y(s,e.sheet,t),r=_(e.start);s=j(s,n,t=>{let n=t;return e.values.forEach((e,t)=>e.forEach((e,s)=>{n=h(n,r.r1+t,r.c1+s,e)})),n});break}case"clear":s=j(s,y(s,e.sheet,t),t=>c(t,_(e.range)));break;case"insert_rows":case"delete_rows":{const n=y(s,e.sheet,t);s=l(s,n,"row",e.at-1,"insert_rows"===e.op?e.count:-e.count);break}case"insert_columns":case"delete_columns":{const n=y(s,e.sheet,t);s=l(s,n,"col",i(e.at),"insert_columns"===e.op?e.count:-e.count);break}case"sort":{const n=y(s,e.sheet,t),r=p(s);s=j(s,n,t=>g(t,n,r,_(e.range),i(e.by),!e.descending));break}case"format":s=j(s,y(s,e.sheet,t),t=>b(t,_(e.range),t=>x(t,e.format)));break;default:throw new L("this spreadsheet does not make that change")}return s}function v(){let e=null,t={open:!1,title:"",selection:null};const n=new Set,s=new Map,r=e=>{if(e.open!==t.open||e.title!==t.title||e.selection?.sheet!==t.selection?.sheet||e.selection?.range!==t.selection?.range){t=e;for(const e of n)e()}};return{getState:()=>t,subscribe:e=>(n.add(e),()=>{n.delete(e)}),attach:t=>(e=t,s.clear(),()=>{e===t&&(e=null,s.clear(),r({open:!1,title:"",selection:null}))}),changed(){if(!e)return;const t=e.sheets(),n=e.selection();r({open:!0,title:e.title(),selection:n&&t[n.sheet]?{sheet:t[n.sheet].name,range:f(n.range)}:null})},snapshot:()=>e?function(e,t,n,s){const r=p(t);return{title:e,sheets:t.map((e,t)=>{const n=k(e),s=[],l={};if(n)for(let c=0;c<=Math.min(n.row,4999);c++){const n=[],i=Math.min(e.cells[c]?.length??0,200);for(let s=0;s<i;s++){const i=e.cells[c][s]??"";""!==i?(n.push(o(e,t,r,c,s).text),u(i)&&(l[a(c,s)]=i)):n.push("")}s.push(n)}return{name:e.name,rows:s,formulas:l}}),activeSheet:Math.min(n,t.length-1),selection:s?{sheet:s.sheet,range:f(s.range)}:null}}(e.title(),e.sheets(),e.activeSheet(),e.selection()):null,apply(t,n){if(!e)return{applied:!1,reason:"the spreadsheet is closed"};if(s.has(t))return{applied:!0};const r=e.sheets();let o;try{o=P(r,e.activeSheet(),n)}catch(e){return{applied:!1,reason:e instanceof L?e.message:"it no longer fits the sheet"}}return e.commit(o),s.set(t,{before:r,after:o}),{applied:!0}},undo(t){const n=s.get(t);return e&&n?e.sheets()!==n.after?{applied:!1,reason:"the sheet has changed since"}:(e.undoLast(),s.delete(t),{applied:!0}):{applied:!1,reason:"the spreadsheet has been closed since"}}}}var C=S(()=>import("../Spreadsheet-SOF7NDLP.js")),F=S(()=>import("../Spreadsheet-SOF7NDLP.js").then(e=>({default:e.SpreadsheetById}))),D=S(()=>import("../Spreadsheet-SOF7NDLP.js").then(e=>({default:e.SpreadsheetPane}))),E={"/spreadsheet":{component:C,label:"Spreadsheets",size:"2xl",appStyle:!0,multiInstance:!0}};async function I(e){const{readXlsx:t}=await(import("../xlsxFile-B2JCZCOL.js"));return t(e)}async function M(e,t){const{workbookToPdf:n}=await(import("../workbookPdf-OJDSHKRR.js"));return n(e,t)}export{s as ENGLISH_WORDS,L as SheetEditRefused,C as Spreadsheet,F as SpreadsheetEditor,D as SpreadsheetPane,e as SpreadsheetWordsProvider,t as SpreadsheetsConflict,n as SpreadsheetsProvider,r as ZH_HANS_WORDS,P as applySheetOps,v as createSheetBridge,I as readXlsx,E as spreadsheetApp,M as workbookToPdf};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{rowPageStarts as t}from"./chunk-PWF37Y2N.js";import{ENGLISH_WORDS as e}from"./chunk-2PIEDEY5.js";import{DEFAULT_COL_WIDTH as o,cellDisplay as n,filteredRows as r,formatKey as s,makeEvaluator as a,usedBounds as i}from"./chunk-VKCG3LPQ.js";import{drawJpeg as l,embeddedFonts as c,jpegPdf as d,openStage as p,settled as h}from"./chunk-JKYJGXJE.js";var m=t=>t*(4/3),f=m(842),u=m(595),w=f-2*m(36),g=u-2*m(36),y="Calibri,Carlito,Arial,sans-serif",b=t=>Array.from({length:t},(t,e)=>e);function x(t,e,a){const l=i(t);if(!l)return{name:t.name,widths:[],rows:[],headerRows:0};const c=new Set([...t.hiddenRows,...r(t,e,a)]),d=new Set(t.hiddenCols),p=b(l.col+1).filter(t=>!d.has(t)),h=b(l.row+1).filter(t=>!c.has(t)).map(o=>p.map(r=>{const{text:i,align:l,color:c}=n(t,e,a,o,r),d=t.formats[s(o,r)];return{text:i,align:d?.align??l,color:d?.color??c,format:d}}));return{name:t.name,widths:p.map(e=>t.colWidths[e]??o),rows:h,headerRows:Math.min(Math.max(t.frozenRows,1),h.length)}}function E(t){const e=document.createElement("td");e.textContent=t.text;const{format:o}=t;return e.style.cssText=`border:.5pt solid #bbb;padding:1pt 3pt;vertical-align:top;overflow-wrap:anywhere;white-space:pre-wrap;text-align:${t.align}`,t.color&&(e.style.color=t.color),o?.fill&&(e.style.background=o.fill),o?.bold&&(e.style.fontWeight="700"),o?.italic&&(e.style.fontStyle="italic"),o?.fontSize&&(e.style.fontSize=`${o.fontSize}pt`),e}function R(t){const e=document.createElement("tr");return e.append(...t.map(E)),e}function v(t,e){const o=document.createElement("table"),n=t.widths.reduce((t,e)=>t+e,0);o.style.cssText=`border-collapse:collapse;table-layout:fixed;width:${n}px;font:10pt ${y};color:#000`;const r=document.createElement("colgroup");r.append(...t.widths.map(t=>Object.assign(document.createElement("col"),{style:`width:${t}px`})));const s=document.createElement("tbody");return s.append(...e.map(R)),o.append(r,s),o}function $(t){const e=document.createElement("div");return e.textContent=t,e.style.cssText=`font:600 13pt ${y};color:#000;margin-bottom:6pt`,e}function C({table:t,scale:e,starts:o},n){const r=document.createElement("div");if(r.style.cssText=`position:relative;overflow:hidden;background:#fff;width:${f}px;height:${u}px;padding:${m(36)}px;box-sizing:border-box`,r.append($(t.name)),t.rows.length){const s=o[n+1]??t.rows.length,a=v(t,[...t.rows.slice(0,t.headerRows),...t.rows.slice(o[n],s)]);a.style.transform=`scale(${e})`,a.style.transformOrigin="0 0",r.append(a)}return r}async function k(t,e,o,n){e.append(t);try{await h(t);return{jpeg:await l(t,{width:f,height:u,pixelRatio:2,quality:n,fontCss:o}),width:842,height:595}}finally{t.remove()}}async function S(o,n={}){const{signal:r,onProgress:s,quality:i}=n;r?.throwIfAborted();const l=p();try{const n=a(o),p=o.map((e,o)=>function(e,o){const n=e.widths.reduce((t,e)=>t+e,0),r=n>w?w/n:1,s=$(e.name),a=v(e,e.rows);o.append(s,a);const i=s.getBoundingClientRect().height+m(6),l=Array.from(a.querySelectorAll("tr"),t=>t.getBoundingClientRect().height);s.remove(),a.remove();const c=l.slice(0,e.headerRows).reduce((t,e)=>t+e,0),d=(g-i)/r,p=t(l.slice(e.headerRows),d,c).map(t=>t+e.headerRows);return{table:e,scale:r,starts:p}}(x(e,o,n),l.root)),h=p.reduce((t,e)=>t+e.starts.length,0),f=await c(l.root),u=[];for(const t of p)for(const o of t.starts.keys())r?.throwIfAborted(),u.push(await k(C(t,o),l.root,f,i).catch(t=>{throw new Error(e.pdfPageFailed(u.length+1),{cause:t})})),s?.(u.length,h);return d(u)}finally{l.close()}}export{x as sheetTable,S as workbookToPdf};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readXlsx as o,unzip as r,writeXlsx as m,zip as p}from"./chunk-N26CBJZA.js";import"./chunk-VKCG3LPQ.js";export{o as readXlsx,r as unzip,m as writeXlsx,p as zip};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-office",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Efficient Office: the EFFICIENT office apps, on efficient-shell and efficient-easel.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -45,12 +45,16 @@
|
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"efficient-easel": "^26.8.0",
|
|
47
47
|
"efficient-shell": "^11.12.0",
|
|
48
|
+
"html-to-image": "^1.11.13",
|
|
48
49
|
"pptxgenjs": "^4.0.1",
|
|
49
50
|
"react": ">=19",
|
|
50
51
|
"react-dom": ">=19",
|
|
51
52
|
"xlsx": "*"
|
|
52
53
|
},
|
|
53
54
|
"peerDependenciesMeta": {
|
|
55
|
+
"html-to-image": {
|
|
56
|
+
"optional": true
|
|
57
|
+
},
|
|
54
58
|
"pptxgenjs": {
|
|
55
59
|
"optional": true
|
|
56
60
|
},
|
|
@@ -73,6 +77,7 @@
|
|
|
73
77
|
"@vitejs/plugin-react": "^6.1.2",
|
|
74
78
|
"efficient-easel": "^26.8.0",
|
|
75
79
|
"efficient-shell": "^11.12.0",
|
|
80
|
+
"html-to-image": "^1.11.13",
|
|
76
81
|
"jsdom": "^30.1.3",
|
|
77
82
|
"jszip": "^3.10.2",
|
|
78
83
|
"pptxgenjs": "^4.0.1",
|