open-grid 1.7.0 → 1.7.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/CHANGELOG.md +34 -0
- package/dist/ExportProgressView-BYPw8osg.cjs +2 -0
- package/dist/ExportProgressView-Bt5-z7rE.js +2 -0
- package/dist/LcpMergeOrderer-CeP6C6G1.cjs +2 -0
- package/dist/LcpMergeOrderer-Ebwuir-r.js +2 -0
- package/dist/OpenGrid-Bh1NMOcm.cjs +98 -0
- package/dist/OpenGrid-CeXt04ho.js +98 -0
- package/dist/Registry-CrT46EAO.js +2 -0
- package/dist/Registry-DpHOpU5V.cjs +2 -0
- package/dist/XlsxChannel-CuOZ3LQz.js +2 -0
- package/dist/XlsxChannel-DQHLGend.cjs +2 -0
- package/dist/XlsxWorkbookWriter-DixuNGtw.cjs +3 -0
- package/dist/XlsxWorkbookWriter-VgbibI0Z.js +3 -0
- package/dist/fflate-Cs3txMgg.js +2 -0
- package/dist/fflate-G9RAFEgF.cjs +2 -0
- package/dist/index-1OXjJmct.js +2 -0
- package/dist/index-B5V7e4Xc.js +2 -0
- package/dist/index-DbKDox8y.cjs +2 -0
- package/dist/index-HaDoF1HM.cjs +2 -0
- package/dist/open-grid-react.cjs +1 -27
- package/dist/open-grid-react.js +1 -30
- package/dist/open-grid-vue.cjs +1 -31
- package/dist/open-grid-vue.js +1 -33
- package/dist/open-grid.cjs +6 -275
- package/dist/open-grid.js +6 -293
- package/dist/sinks-BCZFMGQJ.cjs +2 -0
- package/dist/sinks-qkBJ5bKn.js +2 -0
- package/dist/types/core/ExportManager.d.ts +1 -0
- package/dist/types/core/export/channels/XlsxChannel.d.ts +9 -1
- package/dist/types/core/export/channels/XlsxRichTextRun.d.ts +14 -0
- package/dist/types/core/export/channels/XlsxSheetXml.d.ts +19 -0
- package/dist/types/core/export/channels/XlsxStyleEntries.d.ts +80 -0
- package/dist/types/core/export/channels/XlsxStylesRegistry.d.ts +20 -0
- package/dist/types/core/export/channels/XlsxWorkbookWriter.d.ts +7 -4
- package/dist/types/core/export/channels/XlsxXml.d.ts +6 -0
- package/dist/types/core/export/types.d.ts +63 -0
- package/dist/types/core/types.d.ts +24 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/xlsx.min-CMvrM6b4.cjs +138 -0
- package/dist/xlsx.min-i_b-4PvU.js +138 -0
- package/package.json +2 -1
- package/dist/ExportProgressView-9Kt1SQxv.js +0 -48
- package/dist/ExportProgressView-B59uHIwt.cjs +0 -48
- package/dist/LcpMergeOrderer-BdUtV67j.js +0 -114
- package/dist/LcpMergeOrderer-C_ANVkGk.cjs +0 -113
- package/dist/OpenGrid-BUYQs1_w.cjs +0 -9806
- package/dist/OpenGrid-BmagF0yo.js +0 -9819
- package/dist/Registry-CPJYOqCn.js +0 -74
- package/dist/Registry-D74ZmdDz.cjs +0 -71
- package/dist/XlsxChannel-DOeHeP7h.cjs +0 -95
- package/dist/XlsxChannel-DdaiytFR.js +0 -95
- package/dist/XlsxWorkbookWriter-BTNtZ80J.js +0 -199
- package/dist/XlsxWorkbookWriter-_u5stfg4.cjs +0 -198
- package/dist/index-B9_g5Eg3.js +0 -481
- package/dist/index-CeJ-0-80.cjs +0 -260
- package/dist/index-CnyumyPV.cjs +0 -452
- package/dist/index-DnarQ4eR.js +0 -266
- package/dist/sinks-BWkWQexV.js +0 -149
- package/dist/sinks-DPK0VxYG.cjs +0 -143
- package/dist/xlsx.min-BQ1o3sB6.cjs +0 -11793
- package/dist/xlsx.min-Bbz2ZypC.js +0 -11794
package/dist/index-DnarQ4eR.js
DELETED
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
const a = (h) => {
|
|
2
|
-
const e = globalThis.requestAnimationFrame;
|
|
3
|
-
if (typeof e == "function") {
|
|
4
|
-
const i = e(() => h()), o = globalThis.cancelAnimationFrame;
|
|
5
|
-
return { cancel: () => o == null ? void 0 : o(i) };
|
|
6
|
-
}
|
|
7
|
-
const s = setTimeout(h, 16);
|
|
8
|
-
return { cancel: () => clearTimeout(s) };
|
|
9
|
-
};
|
|
10
|
-
class c {
|
|
11
|
-
constructor(e) {
|
|
12
|
-
this._cells = /* @__PURE__ */ new Map(), this._upserts = /* @__PURE__ */ new Map(), this._removes = /* @__PURE__ */ new Set(), this._coalesced = 0, this._dropped = 0, this._disposed = false, this._cfg = e;
|
|
13
|
-
}
|
|
14
|
-
enqueue(e) {
|
|
15
|
-
if (!this._disposed) {
|
|
16
|
-
if (e.kind === "snapshot") {
|
|
17
|
-
this._dropped += this._cells.size + this._upserts.size + this._removes.size, this._cells.clear(), this._upserts.clear(), this._removes.clear(), this._snapshot = e, this._scheduleFrame();
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
this._mergeDelta(e), this._scheduleFrame();
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
_mergeDelta(e) {
|
|
24
|
-
if (e.removes) for (const s of e.removes) {
|
|
25
|
-
this._removes.add(s), this._upserts.delete(s);
|
|
26
|
-
for (const i of this._cells.keys()) i.slice(0, i.indexOf("\0")) === s && this._cells.delete(i);
|
|
27
|
-
}
|
|
28
|
-
if (e.upserts) for (const s of e.upserts) {
|
|
29
|
-
if (this._removes.has(s.rowId)) continue;
|
|
30
|
-
const i = this._upserts.get(s.rowId);
|
|
31
|
-
i && this._coalesced++, this._upserts.set(s.rowId, { ...i ?? {}, ...s.row });
|
|
32
|
-
}
|
|
33
|
-
if (e.cells) for (const s of e.cells) {
|
|
34
|
-
if (this._removes.has(s.rowId)) continue;
|
|
35
|
-
const i = s.rowId + "\0" + s.field;
|
|
36
|
-
this._cells.has(i) && this._coalesced++, this._cells.set(i, { rowId: s.rowId, field: s.field, value: s.value });
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
_scheduleFrame() {
|
|
40
|
-
this._frame || (this._frame = this._cfg.scheduleFrame(() => {
|
|
41
|
-
this._frame = void 0, this._flushFrame();
|
|
42
|
-
}));
|
|
43
|
-
}
|
|
44
|
-
_flushFrame() {
|
|
45
|
-
if (this._disposed) return;
|
|
46
|
-
if (this._snapshot) {
|
|
47
|
-
const r = this._snapshot;
|
|
48
|
-
this._snapshot = void 0, this._cfg.flush({ cells: [], upserts: [], removes: [], snapshot: r, overflowToNextFrame: false });
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const e = this._cfg.maxBatchPerFrame ?? 0, s = [];
|
|
52
|
-
let i = false;
|
|
53
|
-
for (const [r, n] of this._cells) {
|
|
54
|
-
if (e > 0 && s.length >= e) {
|
|
55
|
-
i = true;
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
s.push(n), this._cells.delete(r);
|
|
59
|
-
}
|
|
60
|
-
const o = [...this._upserts.entries()].map(([r, n]) => ({ rowId: r, row: n })), t = [...this._removes];
|
|
61
|
-
this._upserts.clear(), this._removes.clear(), !(s.length === 0 && o.length === 0 && t.length === 0) && (this._cfg.flush({ cells: s.map((r) => ({ rowId: r.rowId, field: r.field, value: r.value })), upserts: o, removes: t, overflowToNextFrame: i }), (i || this._cells.size > 0) && this._scheduleFrame());
|
|
62
|
-
}
|
|
63
|
-
get stats() {
|
|
64
|
-
return { pending: this._cells.size + this._upserts.size + this._removes.size, coalesced: this._coalesced, dropped: this._dropped };
|
|
65
|
-
}
|
|
66
|
-
dispose() {
|
|
67
|
-
var _a;
|
|
68
|
-
this._disposed = true, (_a = this._frame) == null ? void 0 : _a.cancel(), this._frame = void 0, this._cells.clear(), this._upserts.clear(), this._removes.clear(), this._snapshot = void 0;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
class d {
|
|
72
|
-
constructor(e) {
|
|
73
|
-
this.spi = "command", this.kind = "rt.apply", this.label = "rt.backgroundUpdate", this._at = 0, this._cellInverse = [], this._insertedRowIds = [], this._removedInverse = [], this._batch = e, this.footprint = d._footprintOf(e);
|
|
74
|
-
}
|
|
75
|
-
get appliedDelta() {
|
|
76
|
-
return this._applied;
|
|
77
|
-
}
|
|
78
|
-
do(e) {
|
|
79
|
-
this._at = e.clock.now(), this._cellInverse = [], this._insertedRowIds = [], this._removedInverse = [];
|
|
80
|
-
const s = [];
|
|
81
|
-
e.mutation.beginBatch();
|
|
82
|
-
try {
|
|
83
|
-
const i = [];
|
|
84
|
-
for (const t of this._batch.cells) {
|
|
85
|
-
const r = e.coords.indexOf(t.rowId);
|
|
86
|
-
r < 0 || (this._cellInverse.push({ rowId: t.rowId, field: t.field, oldValue: e.coords.getCellValue(t.rowId, t.field) }), i.push({ rowIndex: r, field: t.field, value: t.value }), s.push({ rowId: t.rowId, field: t.field }));
|
|
87
|
-
}
|
|
88
|
-
i.length > 0 && e.mutation.writeCells(i);
|
|
89
|
-
for (const t of this._batch.upserts) {
|
|
90
|
-
const r = e.coords.indexOf(t.rowId);
|
|
91
|
-
if (r >= 0) {
|
|
92
|
-
const n = [];
|
|
93
|
-
for (const [l, _] of Object.entries(t.row)) this._cellInverse.push({ rowId: t.rowId, field: l, oldValue: e.coords.getCellValue(t.rowId, l) }), n.push({ rowIndex: r, field: l, value: _ }), s.push({ rowId: t.rowId, field: l });
|
|
94
|
-
n.length > 0 && e.mutation.writeCells(n);
|
|
95
|
-
} else e.mutation.insertRow(t.row, "last"), this._insertedRowIds.push(t.rowId);
|
|
96
|
-
}
|
|
97
|
-
const o = [];
|
|
98
|
-
for (const t of this._batch.removes) {
|
|
99
|
-
const r = e.coords.indexOf(t);
|
|
100
|
-
r < 0 || (this._removedInverse.push({ rowId: t, snapshot: e.coords.getRowSnapshot(t) }), o.push({ rowId: t, index: r }));
|
|
101
|
-
}
|
|
102
|
-
o.length > 0 && e.mutation.deleteRows(o.sort((t, r) => r.index - t.index).map((t) => t.index)), this._applied = { changedCells: s, insertedRowIds: [...this._insertedRowIds], removedRowIds: this._removedInverse.map((t) => t.rowId), userInitiated: false };
|
|
103
|
-
} finally {
|
|
104
|
-
e.mutation.endBatch();
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
undo(e) {
|
|
108
|
-
e.mutation.beginBatch();
|
|
109
|
-
try {
|
|
110
|
-
const s = this._insertedRowIds.map((o) => e.coords.indexOf(o)).filter((o) => o >= 0).sort((o, t) => t - o);
|
|
111
|
-
s.length > 0 && e.mutation.deleteRows(s);
|
|
112
|
-
for (const o of this._removedInverse) o.snapshot && e.mutation.insertRow(o.snapshot, "last");
|
|
113
|
-
const i = [];
|
|
114
|
-
for (const o of this._cellInverse) {
|
|
115
|
-
const t = e.coords.indexOf(o.rowId);
|
|
116
|
-
t >= 0 && i.push({ rowIndex: t, field: o.field, value: o.oldValue });
|
|
117
|
-
}
|
|
118
|
-
i.length > 0 && e.mutation.writeCells(i);
|
|
119
|
-
} finally {
|
|
120
|
-
e.mutation.endBatch();
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
serialize() {
|
|
124
|
-
return { kind: this.kind, payload: { cells: this._batch.cells, upserts: this._batch.upserts, removes: this._batch.removes }, at: this._at };
|
|
125
|
-
}
|
|
126
|
-
static _footprintOf(e) {
|
|
127
|
-
if (e.snapshot || e.upserts.length > 0 || e.removes.length > 0) return { scope: "structure" };
|
|
128
|
-
const s = [...new Set(e.cells.map((o) => o.rowId))], i = [...new Set(e.cells.map((o) => o.field))];
|
|
129
|
-
return s.length === 1 && i.length === 1 ? { scope: "cell", rowId: s[0], field: i[0] } : { scope: "range", rowIds: s, fields: i };
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
class u {
|
|
133
|
-
constructor(e, s) {
|
|
134
|
-
this._statusListeners = /* @__PURE__ */ new Set(), this._attached = false, this._source = e, this._deps = s, this._now = s.now ?? (() => Date.now()), this._connection = e.status, this._scheduler = new c({ ...s.maxBatchPerFrame !== void 0 ? { maxBatchPerFrame: s.maxBatchPerFrame } : {}, scheduleFrame: s.scheduleFrame ?? a, flush: (i) => this._applyBatch(i) });
|
|
135
|
-
}
|
|
136
|
-
attach() {
|
|
137
|
-
this._attached || (this._attached = true, this._offData = this._source.onData((e) => this._onData(e)), this._offStatus = this._source.onStatus((e) => this._onStatus(e)), this._source.start());
|
|
138
|
-
}
|
|
139
|
-
detach() {
|
|
140
|
-
var _a, _b;
|
|
141
|
-
this._attached && (this._attached = false, (_a = this._offData) == null ? void 0 : _a.call(this), (_b = this._offStatus) == null ? void 0 : _b.call(this), this._offData = void 0, this._offStatus = void 0, this._source.stop(), this._scheduler.dispose());
|
|
142
|
-
}
|
|
143
|
-
get connection() {
|
|
144
|
-
return this._connection;
|
|
145
|
-
}
|
|
146
|
-
get backpressureStats() {
|
|
147
|
-
return this._scheduler.stats;
|
|
148
|
-
}
|
|
149
|
-
onConnection(e) {
|
|
150
|
-
return this._statusListeners.add(e), () => this._statusListeners.delete(e);
|
|
151
|
-
}
|
|
152
|
-
_onData(e) {
|
|
153
|
-
this._deps.freshness.markReceived(e.serverTime ?? this._now()), this._scheduler.enqueue(e);
|
|
154
|
-
}
|
|
155
|
-
_onStatus(e) {
|
|
156
|
-
this._connection = e, this._deps.announce.onConnection(e.status), this._deps.freshness.tick();
|
|
157
|
-
for (const s of this._statusListeners) s(e);
|
|
158
|
-
}
|
|
159
|
-
_applyBatch(e) {
|
|
160
|
-
const s = this._deps.stateGuard.capture();
|
|
161
|
-
if (e.snapshot) {
|
|
162
|
-
if (this._deps.applySnapshot) {
|
|
163
|
-
this._deps.applySnapshot(e.snapshot.rows);
|
|
164
|
-
const t = { changedCells: [], insertedRowIds: [], removedRowIds: [], userInitiated: false };
|
|
165
|
-
this._deps.stateGuard.restore(s, t), this._deps.announce.onBackgroundChange(t);
|
|
166
|
-
} else console.warn("[open-grid/realtime] snapshot received but no applySnapshot dep wired — skipped");
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
const i = new d(e);
|
|
170
|
-
this._deps.sink.beginBatch();
|
|
171
|
-
try {
|
|
172
|
-
this._deps.sink.dispatchSilent(i);
|
|
173
|
-
} finally {
|
|
174
|
-
this._deps.sink.endBatch();
|
|
175
|
-
}
|
|
176
|
-
const o = i.appliedDelta;
|
|
177
|
-
if (o && (this._deps.stateGuard.restore(s, o), this._deps.announce.onBackgroundChange(o), this._deps.chart)) {
|
|
178
|
-
const t = [.../* @__PURE__ */ new Set([...o.changedCells.map((r) => r.rowId), ...o.insertedRowIds, ...o.removedRowIds])];
|
|
179
|
-
t.length > 0 && this._deps.chart.markDirty(t);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
class f {
|
|
184
|
-
constructor(e, s) {
|
|
185
|
-
this._lastConflicts = [], this._src = e, this._coords = s;
|
|
186
|
-
}
|
|
187
|
-
get lastConflicts() {
|
|
188
|
-
return this._lastConflicts;
|
|
189
|
-
}
|
|
190
|
-
capture() {
|
|
191
|
-
const e = this._src.readEditing();
|
|
192
|
-
return { selection: this._src.readSelection(), scroll: this._src.readScroll(), ...e ? { editing: e } : {}, sortFilterSig: this._src.readSortFilterSig() };
|
|
193
|
-
}
|
|
194
|
-
restore(e, s) {
|
|
195
|
-
this._lastConflicts = [];
|
|
196
|
-
const i = new Set(s.removedRowIds), o = e.selection.filter((t) => !i.has(t.rowId) && this._coords.rowIdToIndex(t.rowId) >= 0);
|
|
197
|
-
this._src.writeSelection(o), e.scroll.anchorRowId && (i.has(e.scroll.anchorRowId) || this._coords.rowIdToIndex(e.scroll.anchorRowId) < 0) ? this._src.writeScroll({ pixelWithinRow: 0, scrollLeft: e.scroll.scrollLeft }) : this._src.writeScroll(e.scroll), e.editing && (!i.has(e.editing.rowId) && this._coords.rowIdToIndex(e.editing.rowId) >= 0 ? (s.changedCells.some((n) => n.rowId === e.editing.rowId && n.field === e.editing.field) && this._lastConflicts.push({ rowId: e.editing.rowId, field: e.editing.field }), this._src.writeEditing(e.editing)) : this._src.writeEditing(void 0));
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
class p {
|
|
201
|
-
constructor(e) {
|
|
202
|
-
this._lastState = "stale", this._listeners = /* @__PURE__ */ new Set(), this._staleAfterMs = e.staleAfterMs, this._now = e.now ?? (() => Date.now());
|
|
203
|
-
}
|
|
204
|
-
markReceived(e) {
|
|
205
|
-
this._lastReceivedAt = e, this._emitIfChanged();
|
|
206
|
-
}
|
|
207
|
-
compute() {
|
|
208
|
-
const e = this._now();
|
|
209
|
-
if (this._lastReceivedAt === void 0) return { state: "stale", ageMs: 1 / 0 };
|
|
210
|
-
const s = e - this._lastReceivedAt;
|
|
211
|
-
return { state: s > this._staleAfterMs ? "stale" : "fresh", ageMs: s, lastReceivedAt: this._lastReceivedAt };
|
|
212
|
-
}
|
|
213
|
-
tick() {
|
|
214
|
-
return this._emitIfChanged();
|
|
215
|
-
}
|
|
216
|
-
_emitIfChanged() {
|
|
217
|
-
const e = this.compute();
|
|
218
|
-
if (e.state !== this._lastState) {
|
|
219
|
-
this._lastState = e.state;
|
|
220
|
-
for (const s of this._listeners) s(e);
|
|
221
|
-
}
|
|
222
|
-
return e;
|
|
223
|
-
}
|
|
224
|
-
onChange(e) {
|
|
225
|
-
return this._listeners.add(e), () => this._listeners.delete(e);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
class w {
|
|
229
|
-
constructor(e) {
|
|
230
|
-
this._pendingCells = /* @__PURE__ */ new Set(), this._pendingRows = /* @__PURE__ */ new Set(), this._announce = e.announce, this._debounceMs = e.debounceMs ?? 500, this._schedule = e.schedule ?? ((s, i) => {
|
|
231
|
-
const o = setTimeout(s, i);
|
|
232
|
-
return { cancel: () => clearTimeout(o) };
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
onBackgroundChange(e) {
|
|
236
|
-
for (const s of e.changedCells) this._pendingCells.add(s.rowId + " " + s.field), this._pendingRows.add(s.rowId);
|
|
237
|
-
for (const s of e.insertedRowIds) this._pendingRows.add(s);
|
|
238
|
-
for (const s of e.removedRowIds) this._pendingRows.add(s);
|
|
239
|
-
this._arm();
|
|
240
|
-
}
|
|
241
|
-
_arm() {
|
|
242
|
-
this._timer || (this._timer = this._schedule(() => {
|
|
243
|
-
this._timer = void 0, this._flush();
|
|
244
|
-
}, this._debounceMs));
|
|
245
|
-
}
|
|
246
|
-
_flush() {
|
|
247
|
-
this._pendingCells.size === 0 && this._pendingRows.size === 0 || (this._announce({ kind: "background-update", changedCount: this._pendingCells.size, rowCount: this._pendingRows.size, label: "background", interruptsFocus: false }), this._pendingCells.clear(), this._pendingRows.clear());
|
|
248
|
-
}
|
|
249
|
-
onConnection(e) {
|
|
250
|
-
this._announce({ kind: "connection", changedCount: 0, rowCount: 0, label: "connection", interruptsFocus: false, connectionStatus: e });
|
|
251
|
-
}
|
|
252
|
-
dispose() {
|
|
253
|
-
var _a;
|
|
254
|
-
(_a = this._timer) == null ? void 0 : _a.cancel(), this._timer = void 0, this._pendingCells.clear(), this._pendingRows.clear();
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
export {
|
|
258
|
-
c as BackpressureScheduler,
|
|
259
|
-
p as FreshnessClock,
|
|
260
|
-
f as LiveStateGuard,
|
|
261
|
-
u as RealtimeController,
|
|
262
|
-
w as RtAnnouncePolicy,
|
|
263
|
-
d as RtApplyCommand,
|
|
264
|
-
a as defaultFrameScheduler
|
|
265
|
-
};
|
|
266
|
-
//# sourceMappingURL=index-DnarQ4eR.js.map
|
package/dist/sinks-BWkWQexV.js
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
const o = new TextEncoder();
|
|
2
|
-
class l {
|
|
3
|
-
constructor(e = 8 * 1024 * 1024) {
|
|
4
|
-
this._highWaterMark = e, this._chunks = [], this._bytes = 0, this._closed = false, this._aborted = false;
|
|
5
|
-
}
|
|
6
|
-
write(e) {
|
|
7
|
-
return this._closed || this._aborted ? Promise.reject(new Error("sink closed/aborted")) : (this._chunks.push(e), this._bytes += typeof e == "string" ? o.encode(e).length : e.length, Promise.resolve());
|
|
8
|
-
}
|
|
9
|
-
close() {
|
|
10
|
-
return this._closed = true, Promise.resolve();
|
|
11
|
-
}
|
|
12
|
-
abort(e) {
|
|
13
|
-
this._aborted = true, e !== void 0 && (this._abortReason = e);
|
|
14
|
-
}
|
|
15
|
-
get desiredSize() {
|
|
16
|
-
return this._highWaterMark - this._bytes;
|
|
17
|
-
}
|
|
18
|
-
toString() {
|
|
19
|
-
return this._chunks.map((e) => typeof e == "string" ? e : new TextDecoder().decode(e)).join("");
|
|
20
|
-
}
|
|
21
|
-
get bytesWritten() {
|
|
22
|
-
return this._bytes;
|
|
23
|
-
}
|
|
24
|
-
get closed() {
|
|
25
|
-
return this._closed;
|
|
26
|
-
}
|
|
27
|
-
get aborted() {
|
|
28
|
-
return this._aborted;
|
|
29
|
-
}
|
|
30
|
-
get abortReason() {
|
|
31
|
-
return this._abortReason;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
class c {
|
|
35
|
-
constructor(e, t = Number.POSITIVE_INFINITY) {
|
|
36
|
-
this._download = e, this._highWaterMark = t, this._buf = "", this._bytes = 0, this._closed = false;
|
|
37
|
-
}
|
|
38
|
-
write(e) {
|
|
39
|
-
const t = typeof e == "string" ? e : new TextDecoder().decode(e);
|
|
40
|
-
return this._buf += t, this._bytes += o.encode(t).length, Promise.resolve();
|
|
41
|
-
}
|
|
42
|
-
close() {
|
|
43
|
-
return this._closed || (this._closed = true, this._download(this._buf)), Promise.resolve();
|
|
44
|
-
}
|
|
45
|
-
abort() {
|
|
46
|
-
this._closed = true;
|
|
47
|
-
}
|
|
48
|
-
get desiredSize() {
|
|
49
|
-
return this._highWaterMark - this._bytes;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
const a = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
53
|
-
function _(s) {
|
|
54
|
-
return typeof s == "string" ? o.encode(s).length : s.length;
|
|
55
|
-
}
|
|
56
|
-
class h {
|
|
57
|
-
constructor(e, t = 8 * 1024 * 1024) {
|
|
58
|
-
this._writable = e, this._highWaterMark = t, this._pending = 0, this._closed = false, this._aborted = false;
|
|
59
|
-
}
|
|
60
|
-
async write(e) {
|
|
61
|
-
if (this._closed || this._aborted) throw new Error("sink closed/aborted");
|
|
62
|
-
const t = _(e);
|
|
63
|
-
this._pending += t;
|
|
64
|
-
try {
|
|
65
|
-
await this._writable.write(e);
|
|
66
|
-
} finally {
|
|
67
|
-
this._pending -= t;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
async close() {
|
|
71
|
-
this._closed || this._aborted || (this._closed = true, await this._writable.close());
|
|
72
|
-
}
|
|
73
|
-
abort(e) {
|
|
74
|
-
var _a, _b;
|
|
75
|
-
if (!this._aborted) {
|
|
76
|
-
this._aborted = true;
|
|
77
|
-
try {
|
|
78
|
-
const t = (_b = (_a = this._writable).abort) == null ? void 0 : _b.call(_a, e);
|
|
79
|
-
t && typeof t.catch == "function" && t.catch(() => {
|
|
80
|
-
});
|
|
81
|
-
} catch {
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
get desiredSize() {
|
|
86
|
-
return this._highWaterMark - this._pending;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
class n {
|
|
90
|
-
constructor(e = {}) {
|
|
91
|
-
this._parts = [], this._bytes = 0, this._closed = false, this._aborted = false, this._fileName = e.fileName ?? "export.xlsx", this._mime = e.mime ?? a, this._hwm = e.highWaterMark ?? 1024 * 1024 * 1024, this._download = e.download;
|
|
92
|
-
}
|
|
93
|
-
write(e) {
|
|
94
|
-
if (this._closed || this._aborted) return Promise.reject(new Error("sink closed/aborted"));
|
|
95
|
-
const t = typeof e == "string" ? o.encode(e) : e;
|
|
96
|
-
return this._parts.push(t), this._bytes += t.length, Promise.resolve();
|
|
97
|
-
}
|
|
98
|
-
close() {
|
|
99
|
-
if (this._closed || this._aborted) return Promise.resolve();
|
|
100
|
-
this._closed = true;
|
|
101
|
-
const e = new Blob(this._parts, { type: this._mime });
|
|
102
|
-
return this._parts.length = 0, this._download ? this._download(e, this._fileName) : n._anchorDownload(e, this._fileName), Promise.resolve();
|
|
103
|
-
}
|
|
104
|
-
abort() {
|
|
105
|
-
this._aborted = true, this._parts.length = 0;
|
|
106
|
-
}
|
|
107
|
-
get desiredSize() {
|
|
108
|
-
return this._hwm - this._bytes;
|
|
109
|
-
}
|
|
110
|
-
get bytesWritten() {
|
|
111
|
-
return this._bytes;
|
|
112
|
-
}
|
|
113
|
-
static _anchorDownload(e, t) {
|
|
114
|
-
if (typeof document > "u" || typeof URL > "u" || !URL.createObjectURL) return;
|
|
115
|
-
const i = URL.createObjectURL(e);
|
|
116
|
-
try {
|
|
117
|
-
const r = document.createElement("a");
|
|
118
|
-
r.href = i, r.download = t, r.style.display = "none", document.body.appendChild(r), r.click(), r.remove();
|
|
119
|
-
} finally {
|
|
120
|
-
URL.revokeObjectURL(i);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
function d(s = {}) {
|
|
125
|
-
if (s.fsAccess === "off") return false;
|
|
126
|
-
const e = s.env !== void 0 ? s.env : typeof window < "u" ? window : void 0;
|
|
127
|
-
return !!e && typeof e.showSaveFilePicker == "function";
|
|
128
|
-
}
|
|
129
|
-
function f(s = {}) {
|
|
130
|
-
const e = s.fileName ?? "export.xlsx", t = s.mime ?? a;
|
|
131
|
-
if (d(s)) {
|
|
132
|
-
const i = s.env !== void 0 ? s.env : window;
|
|
133
|
-
return { kind: "fs", async create() {
|
|
134
|
-
const r = await i.showSaveFilePicker({ suggestedName: e, types: [{ description: "Excel", accept: { [t]: [".xlsx"] } }] });
|
|
135
|
-
return new h(await r.createWritable(), s.highWaterMark);
|
|
136
|
-
} };
|
|
137
|
-
}
|
|
138
|
-
return { kind: "blob", create: () => Promise.resolve(new n({ fileName: e, mime: t, highWaterMark: s.highWaterMark, download: s.download })) };
|
|
139
|
-
}
|
|
140
|
-
export {
|
|
141
|
-
n as BlobDownloadByteSink,
|
|
142
|
-
c as DownloadByteSink,
|
|
143
|
-
h as FileSystemByteSink,
|
|
144
|
-
l as MemoryByteSink,
|
|
145
|
-
a as XLSX_MIME,
|
|
146
|
-
d as canUseFileSystemAccess,
|
|
147
|
-
f as pickExcelSink
|
|
148
|
-
};
|
|
149
|
-
//# sourceMappingURL=sinks-BWkWQexV.js.map
|
package/dist/sinks-DPK0VxYG.cjs
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const ENC = new TextEncoder();
|
|
4
|
-
class MemoryByteSink {
|
|
5
|
-
constructor(e = 8 * 1024 * 1024) {
|
|
6
|
-
this._highWaterMark = e, this._chunks = [], this._bytes = 0, this._closed = false, this._aborted = false;
|
|
7
|
-
}
|
|
8
|
-
write(e) {
|
|
9
|
-
return this._closed || this._aborted ? Promise.reject(new Error("sink closed/aborted")) : (this._chunks.push(e), this._bytes += typeof e == "string" ? ENC.encode(e).length : e.length, Promise.resolve());
|
|
10
|
-
}
|
|
11
|
-
close() {
|
|
12
|
-
return this._closed = true, Promise.resolve();
|
|
13
|
-
}
|
|
14
|
-
abort(e) {
|
|
15
|
-
this._aborted = true, e !== void 0 && (this._abortReason = e);
|
|
16
|
-
}
|
|
17
|
-
get desiredSize() {
|
|
18
|
-
return this._highWaterMark - this._bytes;
|
|
19
|
-
}
|
|
20
|
-
toString() {
|
|
21
|
-
return this._chunks.map((e) => typeof e == "string" ? e : new TextDecoder().decode(e)).join("");
|
|
22
|
-
}
|
|
23
|
-
get bytesWritten() {
|
|
24
|
-
return this._bytes;
|
|
25
|
-
}
|
|
26
|
-
get closed() {
|
|
27
|
-
return this._closed;
|
|
28
|
-
}
|
|
29
|
-
get aborted() {
|
|
30
|
-
return this._aborted;
|
|
31
|
-
}
|
|
32
|
-
get abortReason() {
|
|
33
|
-
return this._abortReason;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
class DownloadByteSink {
|
|
37
|
-
constructor(e, t = Number.POSITIVE_INFINITY) {
|
|
38
|
-
this._download = e, this._highWaterMark = t, this._buf = "", this._bytes = 0, this._closed = false;
|
|
39
|
-
}
|
|
40
|
-
write(e) {
|
|
41
|
-
const t = typeof e == "string" ? e : new TextDecoder().decode(e);
|
|
42
|
-
return this._buf += t, this._bytes += ENC.encode(t).length, Promise.resolve();
|
|
43
|
-
}
|
|
44
|
-
close() {
|
|
45
|
-
return this._closed || (this._closed = true, this._download(this._buf)), Promise.resolve();
|
|
46
|
-
}
|
|
47
|
-
abort() {
|
|
48
|
-
this._closed = true;
|
|
49
|
-
}
|
|
50
|
-
get desiredSize() {
|
|
51
|
-
return this._highWaterMark - this._bytes;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
const XLSX_MIME = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
55
|
-
function byteLen(s) {
|
|
56
|
-
return typeof s == "string" ? ENC.encode(s).length : s.length;
|
|
57
|
-
}
|
|
58
|
-
class FileSystemByteSink {
|
|
59
|
-
constructor(e, t = 8 * 1024 * 1024) {
|
|
60
|
-
this._writable = e, this._highWaterMark = t, this._pending = 0, this._closed = false, this._aborted = false;
|
|
61
|
-
}
|
|
62
|
-
async write(e) {
|
|
63
|
-
if (this._closed || this._aborted) throw new Error("sink closed/aborted");
|
|
64
|
-
const t = byteLen(e);
|
|
65
|
-
this._pending += t;
|
|
66
|
-
try {
|
|
67
|
-
await this._writable.write(e);
|
|
68
|
-
} finally {
|
|
69
|
-
this._pending -= t;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
async close() {
|
|
73
|
-
this._closed || this._aborted || (this._closed = true, await this._writable.close());
|
|
74
|
-
}
|
|
75
|
-
abort(e) {
|
|
76
|
-
var _a, _b;
|
|
77
|
-
if (!this._aborted) {
|
|
78
|
-
this._aborted = true;
|
|
79
|
-
try {
|
|
80
|
-
const t = (_b = (_a = this._writable).abort) == null ? void 0 : _b.call(_a, e);
|
|
81
|
-
t && typeof t.catch == "function" && t.catch(() => {
|
|
82
|
-
});
|
|
83
|
-
} catch {
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
get desiredSize() {
|
|
88
|
-
return this._highWaterMark - this._pending;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
class BlobDownloadByteSink {
|
|
92
|
-
constructor(e = {}) {
|
|
93
|
-
this._parts = [], this._bytes = 0, this._closed = false, this._aborted = false, this._fileName = e.fileName ?? "export.xlsx", this._mime = e.mime ?? XLSX_MIME, this._hwm = e.highWaterMark ?? 1024 * 1024 * 1024, this._download = e.download;
|
|
94
|
-
}
|
|
95
|
-
write(e) {
|
|
96
|
-
if (this._closed || this._aborted) return Promise.reject(new Error("sink closed/aborted"));
|
|
97
|
-
const t = typeof e == "string" ? ENC.encode(e) : e;
|
|
98
|
-
return this._parts.push(t), this._bytes += t.length, Promise.resolve();
|
|
99
|
-
}
|
|
100
|
-
close() {
|
|
101
|
-
if (this._closed || this._aborted) return Promise.resolve();
|
|
102
|
-
this._closed = true;
|
|
103
|
-
const e = new Blob(this._parts, { type: this._mime });
|
|
104
|
-
return this._parts.length = 0, this._download ? this._download(e, this._fileName) : BlobDownloadByteSink._anchorDownload(e, this._fileName), Promise.resolve();
|
|
105
|
-
}
|
|
106
|
-
abort() {
|
|
107
|
-
this._aborted = true, this._parts.length = 0;
|
|
108
|
-
}
|
|
109
|
-
get desiredSize() {
|
|
110
|
-
return this._hwm - this._bytes;
|
|
111
|
-
}
|
|
112
|
-
get bytesWritten() {
|
|
113
|
-
return this._bytes;
|
|
114
|
-
}
|
|
115
|
-
static _anchorDownload(e, t) {
|
|
116
|
-
if (typeof document > "u" || typeof URL > "u" || !URL.createObjectURL) return;
|
|
117
|
-
const i = URL.createObjectURL(e);
|
|
118
|
-
try {
|
|
119
|
-
const r = document.createElement("a");
|
|
120
|
-
r.href = i, r.download = t, r.style.display = "none", document.body.appendChild(r), r.click(), r.remove();
|
|
121
|
-
} finally {
|
|
122
|
-
URL.revokeObjectURL(i);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
function canUseFileSystemAccess(s = {}) {
|
|
127
|
-
if (s.fsAccess === "off") return false;
|
|
128
|
-
const e = s.env !== void 0 ? s.env : typeof window < "u" ? window : void 0;
|
|
129
|
-
return !!e && typeof e.showSaveFilePicker == "function";
|
|
130
|
-
}
|
|
131
|
-
function pickExcelSink(s = {}) {
|
|
132
|
-
const e = s.fileName ?? "export.xlsx", t = s.mime ?? XLSX_MIME;
|
|
133
|
-
if (canUseFileSystemAccess(s)) {
|
|
134
|
-
const i = s.env !== void 0 ? s.env : window;
|
|
135
|
-
return { kind: "fs", async create() {
|
|
136
|
-
const r = await i.showSaveFilePicker({ suggestedName: e, types: [{ description: "Excel", accept: { [t]: [".xlsx"] } }] });
|
|
137
|
-
return new FileSystemByteSink(await r.createWritable(), s.highWaterMark);
|
|
138
|
-
} };
|
|
139
|
-
}
|
|
140
|
-
return { kind: "blob", create: () => Promise.resolve(new BlobDownloadByteSink({ fileName: e, mime: t, highWaterMark: s.highWaterMark, download: s.download })) };
|
|
141
|
-
}
|
|
142
|
-
exports.BlobDownloadByteSink = BlobDownloadByteSink, exports.DownloadByteSink = DownloadByteSink, exports.FileSystemByteSink = FileSystemByteSink, exports.MemoryByteSink = MemoryByteSink, exports.XLSX_MIME = XLSX_MIME, exports.canUseFileSystemAccess = canUseFileSystemAccess, exports.pickExcelSink = pickExcelSink;
|
|
143
|
-
//# sourceMappingURL=sinks-DPK0VxYG.cjs.map
|