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