open-grid 1.6.1 → 1.7.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/CHANGELOG.md +28 -0
- package/dist/ExportProgressView-9Kt1SQxv.js +48 -0
- package/dist/ExportProgressView-B59uHIwt.cjs +48 -0
- package/dist/LcpMergeOrderer-BdUtV67j.js +114 -0
- package/dist/LcpMergeOrderer-C_ANVkGk.cjs +113 -0
- package/dist/OpenGrid-BUYQs1_w.cjs +9806 -0
- package/dist/OpenGrid-BmagF0yo.js +9819 -0
- package/dist/XlsxChannel-DOeHeP7h.cjs +95 -0
- package/dist/XlsxChannel-DdaiytFR.js +95 -0
- package/dist/XlsxWorkbookWriter-BTNtZ80J.js +199 -0
- package/dist/XlsxWorkbookWriter-_u5stfg4.cjs +198 -0
- package/dist/{index-VkKgQ506.js → index-B9_g5Eg3.js} +2 -2
- package/dist/{index-D0DJtKYI.cjs → index-CnyumyPV.cjs} +2 -2
- package/dist/open-grid-react.cjs +1 -1
- package/dist/open-grid-react.js +1 -1
- package/dist/open-grid-vue.cjs +1 -1
- package/dist/open-grid-vue.js +1 -1
- package/dist/open-grid.cjs +1 -1
- package/dist/open-grid.js +2 -2
- package/dist/sinks-BWkWQexV.js +149 -0
- package/dist/sinks-DPK0VxYG.cjs +143 -0
- package/dist/types/core/CFRenderBridge.d.ts +5 -1
- package/dist/types/core/CellEditManager.d.ts +26 -2
- package/dist/types/core/CellEventHandler.d.ts +6 -2
- package/dist/types/core/ColumnLayout.d.ts +8 -0
- package/dist/types/core/DataLayer.d.ts +48 -1
- package/dist/types/core/DetailManager.d.ts +43 -2
- package/dist/types/core/ExportManager.d.ts +24 -0
- package/dist/types/core/FindBarManager.d.ts +6 -2
- package/dist/types/core/FlatRowModel.d.ts +61 -3
- package/dist/types/core/FooterManager.d.ts +43 -1
- package/dist/types/core/FormulaController.d.ts +4 -4
- package/dist/types/core/GridComposer.d.ts +11 -1
- package/dist/types/core/GridRenderer.d.ts +84 -19
- package/dist/types/core/GroupTreeManager.d.ts +6 -4
- package/dist/types/core/KeyboardManager.d.ts +3 -2
- package/dist/types/core/MutationService.d.ts +10 -8
- package/dist/types/core/OpenGrid.d.ts +7 -5
- package/dist/types/core/RangeSelectionManager.d.ts +23 -2
- package/dist/types/core/RenderController.d.ts +126 -8
- package/dist/types/core/SortFilterManager.d.ts +10 -2
- package/dist/types/core/VirtualScroll.d.ts +12 -0
- package/dist/types/core/coordinate/CellTextPolicy.d.ts +58 -0
- package/dist/types/core/coordinate/ColumnGeometry.d.ts +60 -0
- package/dist/types/core/coordinate/ColumnWindow.d.ts +40 -0
- package/dist/types/core/coordinate/ColumnWindowPolicy.d.ts +89 -0
- package/dist/types/core/coordinate/ExtraColumns.d.ts +39 -0
- package/dist/types/core/coordinate/RangeRectCalculator.d.ts +35 -0
- package/dist/types/core/coordinate/ViewportHeightJudge.d.ts +28 -0
- package/dist/types/core/coordinate/geometryPorts.d.ts +250 -0
- package/dist/types/core/coordinate/ports.d.ts +5 -0
- package/dist/types/core/domain/footer/FooterValues.d.ts +50 -0
- package/dist/types/core/domain/footer/ports.d.ts +31 -0
- package/dist/types/core/domain/render/RenderPlanner.d.ts +17 -0
- package/dist/types/core/domain/render/RenderRequest.d.ts +91 -0
- package/dist/types/core/domain/render/ports.d.ts +169 -0
- package/dist/types/core/domain/resize/ResizeGesture.d.ts +25 -0
- package/dist/types/core/domain/resize/ResizeHitZone.d.ts +23 -0
- package/dist/types/core/domain/resize/ports.d.ts +64 -0
- package/dist/types/core/domain/sort/ComparisonOrderer.d.ts +11 -0
- package/dist/types/core/domain/sort/LcpMergeOrderer.d.ts +15 -0
- package/dist/types/core/domain/sort/RankIndex.d.ts +74 -0
- package/dist/types/core/domain/sort/SortCostEstimate.d.ts +36 -0
- package/dist/types/core/domain/sort/SortKeyColumn.d.ts +89 -0
- package/dist/types/core/domain/sort/SortKeyStore.d.ts +34 -0
- package/dist/types/core/domain/sort/Sorter.d.ts +54 -0
- package/dist/types/core/domain/sort/SyncSortRunner.d.ts +9 -0
- package/dist/types/core/domain/sort/commonPrefix.d.ts +5 -0
- package/dist/types/core/domain/sort/ports.d.ts +140 -0
- package/dist/types/core/export/ExportProgressView.d.ts +28 -0
- package/dist/types/core/export/channels/XlsxChannel.d.ts +29 -0
- package/dist/types/core/export/channels/XlsxWorkbookWriter.d.ts +17 -0
- package/dist/types/core/export/index.d.ts +2 -0
- package/dist/types/core/export/sinks.d.ts +81 -0
- package/dist/types/core/host/archCheck.d.ts +16 -1
- package/dist/types/core/i18n/locales/en.d.ts +6 -0
- package/dist/types/core/i18n/locales/ko.d.ts +6 -0
- package/dist/types/core/i18n/types.d.ts +8 -0
- package/dist/types/core/render/FooterView.d.ts +121 -0
- package/dist/types/core/render/GeometryApplier.d.ts +55 -0
- package/dist/types/core/render/HorizontalReveal.d.ts +26 -0
- package/dist/types/core/render/RangeOverlayAdapter.d.ts +10 -0
- package/dist/types/core/render/RenderScheduler.d.ts +225 -0
- package/dist/types/core/render/ResizeSinkAdapter.d.ts +35 -0
- package/dist/types/core/render/ScrollFollower.d.ts +34 -0
- package/dist/types/core/render/ScrollObserver.d.ts +47 -0
- package/dist/types/core/render/ScrollbarGutter.d.ts +19 -0
- package/dist/types/core/render/body/BodyEventRouter.d.ts +58 -0
- package/dist/types/core/render/body/BodyRowSet.d.ts +28 -0
- package/dist/types/core/render/body/BodyView.d.ts +185 -0
- package/dist/types/core/render/body/CellLocator.d.ts +36 -0
- package/dist/types/core/render/body/CellRegistry.d.ts +24 -0
- package/dist/types/core/render/body/ColumnPaintPlan.d.ts +19 -0
- package/dist/types/core/render/body/ExtraCellPainters.d.ts +20 -0
- package/dist/types/core/render/body/rows/BodyRowContext.d.ts +138 -0
- package/dist/types/core/render/body/rows/DataRowPainter.d.ts +58 -0
- package/dist/types/core/render/body/rows/DetailRowPainter.d.ts +24 -0
- package/dist/types/core/render/body/rows/GroupRowPainter.d.ts +32 -0
- package/dist/types/core/render/body/rows/RowPainterTable.d.ts +24 -0
- package/dist/types/core/render/body/rows/WindowLayout.d.ts +38 -0
- package/dist/types/core/render/dom.d.ts +10 -0
- package/dist/types/core/render/header/HeaderSortIndicator.d.ts +39 -0
- package/dist/types/core/render/header/HeaderView.d.ts +84 -0
- package/dist/types/core/render/header/ResizeHandleBinder.d.ts +110 -0
- package/dist/types/core/render/ports.d.ts +218 -0
- package/dist/types/core/renderers/CellRenderer.d.ts +7 -0
- package/dist/types/core/types.d.ts +70 -0
- package/dist/types/vue/OpenGrid.vue.d.ts +1 -1
- package/package.json +2 -8
- package/dist/OpenGrid-CLk8Vt7j.cjs +0 -7459
- package/dist/OpenGrid-D6YxCsnV.js +0 -7472
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to OPEN_GRID will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.7.0] - 2026-11-21
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **대용량 엑셀 내보내기 스트리밍 + 진척바 + 취소** / **Streaming Excel export with a progress bar and cancel.**
|
|
9
|
+
수만~수십만 행을 내보낼 때 통째로 메모리에 쌓다 브라우저가 멈추던 문제를 없앴다. 행을 조금씩 흘려 쓰며,
|
|
10
|
+
지원 브라우저(Chromium 계열)에서는 **파일을 디스크로 바로 스트리밍**(File System Access)해 메모리를 거의 쓰지 않고,
|
|
11
|
+
없는 브라우저는 자동으로 기존 방식으로 떨어진다. 진행률 막대와 취소 버튼이 뜬다. 작은 표는 종전 스타일 경로 그대로.
|
|
12
|
+
옵션 `stream: 'auto' | 'force' | 'off'`(기본 `auto`, 큰 표만 스트리밍), `onProgress(done, total)`, `signal`(AbortSignal), `onError` 추가(전부 더하기).
|
|
13
|
+
/ Exporting tens of thousands of rows no longer freezes the tab. Rows are flushed in chunks; on Chromium-based browsers the file
|
|
14
|
+
**streams straight to disk** (File System Access) so memory stays flat, with an automatic fallback elsewhere. A progress bar and
|
|
15
|
+
cancel button appear. Small tables keep the existing styled path. New `ExportOptions`: `stream`, `onProgress`, `signal`, `onError` (all additive).
|
|
16
|
+
|
|
17
|
+
### Performance
|
|
18
|
+
- **넓은 그리드(수만 행 × 수십 컬럼)가 크게 빨라졌다** / **Large wide grids are dramatically faster.**
|
|
19
|
+
10만 행 × 50컬럼(칸마다 200자) 기준 — 컬럼 너비 조절 손 뗌→반영 **3,489ms → 약 27ms**, 가로 한 걸음 **1,667ms → 약 17ms**,
|
|
20
|
+
세로 휠 **1,183ms → 약 17ms**, 푸터 50칸 첫 표시 **7.7초 → 약 0.7초**, 정렬(200자) **7,513ms → 약 205ms**. 동작은 그대로, 속도만.
|
|
21
|
+
가로·세로 가상화, 세로 행 차분(바뀐 행만 다시 그림), 실시간 너비 조절, 푸터 합계 스트리밍 계산이 들어갔다.
|
|
22
|
+
/ At 100k rows × 50 columns (200 chars/cell): column-resize apply **3,489ms → ~27ms**, one horizontal step **1,667ms → ~17ms**,
|
|
23
|
+
vertical wheel **1,183ms → ~17ms**, 50-column footer **7.7s → ~0.7s**, sort (200-char) **7,513ms → ~205ms**. Same behavior, just faster.
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
- 너비 조절 손잡이 리스너가 파기 사이에 남던 누수, LTR 에서 일시적 음수 스크롤이 RTL 로 굳던 문제, 세로 행 차분 중 편집 중인 행이 다시 그려지던 문제, 스트리밍 엑셀의 지수표기 숫자 셀이 어긋나던 문제.
|
|
27
|
+
/ Resize-handle listener leak across destroy; an LTR transient negative scroll latching as RTL; the row being edited getting rebuilt during vertical row-diff; exponential-form number cells in the streaming Excel path.
|
|
28
|
+
|
|
29
|
+
### Note
|
|
30
|
+
- 위 성능·내보내기 기능이 더해지며 코어 번들(gzip)이 권고 예산(108KB)을 넘어 약 119KB가 되었다. 무거운 부분(스트리밍 writer·싱크·xlsx)은 전부 **지연 로드**라 처음 받는 양에는 거의 영향이 없다.
|
|
31
|
+
/ Adding the above pushed the core bundle (gzip) to ~119KB, over the 108KB advisory budget; the heavy parts (streaming writer, sinks, xlsx) are all **lazy-loaded**.
|
|
32
|
+
|
|
5
33
|
## [1.6.1] - 2026-09-24
|
|
6
34
|
|
|
7
35
|
### Fixed
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const l = { "export.preparing": "Preparing export…", "export.exporting": "Exporting {done} / {total} rows ({percent}%)", "export.cancel": "Cancel", "export.cancelled": "Export cancelled", "export.done": "Export complete", "export.exportError": "Export failed" };
|
|
2
|
+
class c {
|
|
3
|
+
constructor(e = {}) {
|
|
4
|
+
if (this.opts = e, this._root = null, this._bar = null, this._text = null, this._btn = null, this._closed = false, this._failed = false, this._prevFocus = null, typeof document > "u" || !document.body) return;
|
|
5
|
+
const t = document.createElement("div");
|
|
6
|
+
t.className = "og-export-progress", t.setAttribute("role", "dialog"), t.setAttribute("aria-modal", "true"), t.setAttribute("aria-label", this._t("export.preparing")), t.style.cssText = "position:fixed;inset:0;background:rgba(0,0,0,0.4);z-index:1100;display:flex;align-items:center;justify-content:center;font:14px/1.4 sans-serif;";
|
|
7
|
+
const r = document.createElement("div");
|
|
8
|
+
r.className = "og-export-progress__panel", r.style.cssText = "box-sizing:border-box;width:min(360px,90vw);padding:16px;background:#fff;color:#212121;border-radius:6px;box-shadow:0 8px 30px rgba(0,0,0,0.3);";
|
|
9
|
+
const i = document.createElement("div");
|
|
10
|
+
i.className = "og-export-progress__text", i.setAttribute("aria-live", "polite"), i.textContent = this._t("export.preparing");
|
|
11
|
+
const o = document.createElement("div");
|
|
12
|
+
o.className = "og-export-progress__track", o.setAttribute("role", "progressbar"), o.setAttribute("aria-valuemin", "0"), o.setAttribute("aria-valuemax", "100"), o.setAttribute("aria-valuenow", "0"), o.style.cssText = "height:8px;margin:12px 0;background:#e0e0e0;border-radius:4px;overflow:hidden;";
|
|
13
|
+
const n = document.createElement("div");
|
|
14
|
+
n.className = "og-export-progress__bar", n.style.cssText = "height:100%;width:0%;background:#1565c0;", o.appendChild(n);
|
|
15
|
+
const s = document.createElement("button");
|
|
16
|
+
s.type = "button", s.className = "og-export-progress__cancel", s.textContent = this._t("export.cancel"), s.addEventListener("click", () => {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
return (_b = (_a = this.opts).onCancel) == null ? void 0 : _b.call(_a);
|
|
19
|
+
}), r.append(i, o, s), t.appendChild(r), t.addEventListener("keydown", (a) => {
|
|
20
|
+
var _a, _b, _c2;
|
|
21
|
+
a.key === "Escape" ? (a.preventDefault(), this._failed ? this.close() : (_b = (_a = this.opts).onCancel) == null ? void 0 : _b.call(_a)) : a.key === "Tab" && (a.preventDefault(), (_c2 = this._btn) == null ? void 0 : _c2.focus());
|
|
22
|
+
}), this._prevFocus = document.activeElement, document.body.appendChild(t), s.focus(), this._root = t, this._bar = n, this._text = i, this._btn = s;
|
|
23
|
+
}
|
|
24
|
+
_t(e, t) {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
const r = (_b = (_a = this.opts).t) == null ? void 0 : _b.call(_a, e, t);
|
|
27
|
+
return r && r !== e ? r : (l[e] ?? e).replace(/\{(\w+)\}/g, (i, o) => String((t == null ? void 0 : t[o]) ?? ""));
|
|
28
|
+
}
|
|
29
|
+
update(e, t) {
|
|
30
|
+
if (this._closed || !this._root) return;
|
|
31
|
+
const r = t > 0 ? Math.min(100, Math.floor(e / t * 100)) : 0;
|
|
32
|
+
this._bar.style.width = `${r}%`, this._bar.parentElement.setAttribute("aria-valuenow", String(r)), this._text.textContent = this._t("export.exporting", { done: e, total: t, percent: r });
|
|
33
|
+
}
|
|
34
|
+
fail(e) {
|
|
35
|
+
this._closed || !this._root || (this._text.textContent = e ? `${this._t("export.exportError")}: ${e}` : this._t("export.exportError"), this._failed = true, this._root.setAttribute("role", "alertdialog"), this._btn.textContent = "OK", this._btn.onclick = () => this.close());
|
|
36
|
+
}
|
|
37
|
+
close() {
|
|
38
|
+
var _a, _b, _c2;
|
|
39
|
+
this._closed || (this._closed = true, (_a = this._root) == null ? void 0 : _a.remove(), (_c2 = (_b = this._prevFocus) == null ? void 0 : _b.focus) == null ? void 0 : _c2.call(_b), this._prevFocus = null, this._root = this._bar = this._text = this._btn = null);
|
|
40
|
+
}
|
|
41
|
+
get isOpen() {
|
|
42
|
+
return !this._closed && !!this._root;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
c as ExportProgressView
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=ExportProgressView-9Kt1SQxv.js.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const FALLBACK = { "export.preparing": "Preparing export…", "export.exporting": "Exporting {done} / {total} rows ({percent}%)", "export.cancel": "Cancel", "export.cancelled": "Export cancelled", "export.done": "Export complete", "export.exportError": "Export failed" };
|
|
4
|
+
class ExportProgressView {
|
|
5
|
+
constructor(e = {}) {
|
|
6
|
+
if (this.opts = e, this._root = null, this._bar = null, this._text = null, this._btn = null, this._closed = false, this._failed = false, this._prevFocus = null, typeof document > "u" || !document.body) return;
|
|
7
|
+
const t = document.createElement("div");
|
|
8
|
+
t.className = "og-export-progress", t.setAttribute("role", "dialog"), t.setAttribute("aria-modal", "true"), t.setAttribute("aria-label", this._t("export.preparing")), t.style.cssText = "position:fixed;inset:0;background:rgba(0,0,0,0.4);z-index:1100;display:flex;align-items:center;justify-content:center;font:14px/1.4 sans-serif;";
|
|
9
|
+
const r = document.createElement("div");
|
|
10
|
+
r.className = "og-export-progress__panel", r.style.cssText = "box-sizing:border-box;width:min(360px,90vw);padding:16px;background:#fff;color:#212121;border-radius:6px;box-shadow:0 8px 30px rgba(0,0,0,0.3);";
|
|
11
|
+
const i = document.createElement("div");
|
|
12
|
+
i.className = "og-export-progress__text", i.setAttribute("aria-live", "polite"), i.textContent = this._t("export.preparing");
|
|
13
|
+
const o = document.createElement("div");
|
|
14
|
+
o.className = "og-export-progress__track", o.setAttribute("role", "progressbar"), o.setAttribute("aria-valuemin", "0"), o.setAttribute("aria-valuemax", "100"), o.setAttribute("aria-valuenow", "0"), o.style.cssText = "height:8px;margin:12px 0;background:#e0e0e0;border-radius:4px;overflow:hidden;";
|
|
15
|
+
const n = document.createElement("div");
|
|
16
|
+
n.className = "og-export-progress__bar", n.style.cssText = "height:100%;width:0%;background:#1565c0;", o.appendChild(n);
|
|
17
|
+
const s = document.createElement("button");
|
|
18
|
+
s.type = "button", s.className = "og-export-progress__cancel", s.textContent = this._t("export.cancel"), s.addEventListener("click", () => {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
return (_b = (_a = this.opts).onCancel) == null ? void 0 : _b.call(_a);
|
|
21
|
+
}), r.append(i, o, s), t.appendChild(r), t.addEventListener("keydown", (a) => {
|
|
22
|
+
var _a, _b, _c;
|
|
23
|
+
a.key === "Escape" ? (a.preventDefault(), this._failed ? this.close() : (_b = (_a = this.opts).onCancel) == null ? void 0 : _b.call(_a)) : a.key === "Tab" && (a.preventDefault(), (_c = this._btn) == null ? void 0 : _c.focus());
|
|
24
|
+
}), this._prevFocus = document.activeElement, document.body.appendChild(t), s.focus(), this._root = t, this._bar = n, this._text = i, this._btn = s;
|
|
25
|
+
}
|
|
26
|
+
_t(e, t) {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
const r = (_b = (_a = this.opts).t) == null ? void 0 : _b.call(_a, e, t);
|
|
29
|
+
return r && r !== e ? r : (FALLBACK[e] ?? e).replace(/\{(\w+)\}/g, (i, o) => String((t == null ? void 0 : t[o]) ?? ""));
|
|
30
|
+
}
|
|
31
|
+
update(e, t) {
|
|
32
|
+
if (this._closed || !this._root) return;
|
|
33
|
+
const r = t > 0 ? Math.min(100, Math.floor(e / t * 100)) : 0;
|
|
34
|
+
this._bar.style.width = `${r}%`, this._bar.parentElement.setAttribute("aria-valuenow", String(r)), this._text.textContent = this._t("export.exporting", { done: e, total: t, percent: r });
|
|
35
|
+
}
|
|
36
|
+
fail(e) {
|
|
37
|
+
this._closed || !this._root || (this._text.textContent = e ? `${this._t("export.exportError")}: ${e}` : this._t("export.exportError"), this._failed = true, this._root.setAttribute("role", "alertdialog"), this._btn.textContent = "OK", this._btn.onclick = () => this.close());
|
|
38
|
+
}
|
|
39
|
+
close() {
|
|
40
|
+
var _a, _b, _c;
|
|
41
|
+
this._closed || (this._closed = true, (_a = this._root) == null ? void 0 : _a.remove(), (_c = (_b = this._prevFocus) == null ? void 0 : _b.focus) == null ? void 0 : _c.call(_b), this._prevFocus = null, this._root = this._bar = this._text = this._btn = null);
|
|
42
|
+
}
|
|
43
|
+
get isOpen() {
|
|
44
|
+
return !this._closed && !!this._root;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.ExportProgressView = ExportProgressView;
|
|
48
|
+
//# sourceMappingURL=ExportProgressView-B59uHIwt.cjs.map
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
const B = 256;
|
|
2
|
+
function k(d, r, i) {
|
|
3
|
+
const n = d.length < r.length ? d.length : r.length;
|
|
4
|
+
let t = i;
|
|
5
|
+
if (n - t > 64) for (; t + 256 <= n && d.substring(t, t + 256) === r.substring(t, t + 256); ) t += 256;
|
|
6
|
+
for (; t < n && d.charCodeAt(t) === r.charCodeAt(t); ) t++;
|
|
7
|
+
return t;
|
|
8
|
+
}
|
|
9
|
+
const H = "lcpMerge", L = 1024, O = 64, R = 12e-6, T = 3e-5, C = 2e-5, S = 1e-7, y = 64, G = 100;
|
|
10
|
+
function K(d, r) {
|
|
11
|
+
const i = Math.min(y, r);
|
|
12
|
+
if (i === 0) return 0;
|
|
13
|
+
const n = r / i;
|
|
14
|
+
let t = 0;
|
|
15
|
+
for (let e = 0; e < i; e++) {
|
|
16
|
+
const s = d.stringKeyAt(Math.floor(e * n));
|
|
17
|
+
s !== null && (t += s.length);
|
|
18
|
+
}
|
|
19
|
+
return t / i;
|
|
20
|
+
}
|
|
21
|
+
const P = { number: () => R, ranked: () => R, general: () => T, string: (d, r) => C + S * K(d, r) };
|
|
22
|
+
class _ {
|
|
23
|
+
constructor(r) {
|
|
24
|
+
this.expectedMs = r;
|
|
25
|
+
}
|
|
26
|
+
static of(r, i, n) {
|
|
27
|
+
const t = Math.max(0, Math.floor(r));
|
|
28
|
+
if (t < 2 || i.length === 0) return new _(0);
|
|
29
|
+
let e = 0;
|
|
30
|
+
for (const s of i) e += n ? R : P[s.kind](s, t);
|
|
31
|
+
return new _(t * Math.log2(t) * e);
|
|
32
|
+
}
|
|
33
|
+
prefersSlicing(r = G) {
|
|
34
|
+
return this.expectedMs > r;
|
|
35
|
+
}
|
|
36
|
+
static meanCommonPrefix(r, i) {
|
|
37
|
+
const n = i.length, t = n < L ? n : L, e = [];
|
|
38
|
+
let s = 2654435769;
|
|
39
|
+
for (let u = 0; u < t; u++) {
|
|
40
|
+
s = Math.imul(s, 1103515245) + 12345 >>> 0;
|
|
41
|
+
const E = Math.floor(u * n / t), M = Math.floor((u + 1) * n / t), l = E + Math.floor(s / 4294967296 * (M - E)), a = r.stringKeyAt(i[l]);
|
|
42
|
+
a !== null && e.push(a);
|
|
43
|
+
}
|
|
44
|
+
if (e.length < 2) return 0;
|
|
45
|
+
e.sort();
|
|
46
|
+
let f = 0;
|
|
47
|
+
for (let u = 1; u < e.length; u++) f += k(e[u - 1], e[u], 0);
|
|
48
|
+
return f / (e.length - 1);
|
|
49
|
+
}
|
|
50
|
+
static pickOrderer(r, i, n) {
|
|
51
|
+
let t = null, e = null;
|
|
52
|
+
for (const s of r) s.accepts(i, n.length) && (s.id === H ? t ?? (t = s) : e ?? (e = s));
|
|
53
|
+
if (t && (!e || n.length >= L && _.meanCommonPrefix(i[0], n) > O)) return t;
|
|
54
|
+
if (!e) throw new Error("Sorter: no orderer accepts these keys");
|
|
55
|
+
return e;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
class x {
|
|
59
|
+
constructor() {
|
|
60
|
+
this.id = "lcpMerge";
|
|
61
|
+
}
|
|
62
|
+
accepts(r, i) {
|
|
63
|
+
return r.length === 1 && r[0].kind === "string";
|
|
64
|
+
}
|
|
65
|
+
order(r, i, n) {
|
|
66
|
+
const t = i[0], e = n[0] !== "asc", s = r.length, f = [], u = [], E = [];
|
|
67
|
+
for (let o = 0; o < s; o++) {
|
|
68
|
+
const h = r[o], m = t.stringKeyAt(h);
|
|
69
|
+
m === null ? f.push(h) : (u.push(h), E.push(m));
|
|
70
|
+
}
|
|
71
|
+
const M = this._sort(E, e), l = new Int32Array(s);
|
|
72
|
+
let a = 0;
|
|
73
|
+
if (!e) for (let o = 0; o < f.length; o++) l[a++] = f[o];
|
|
74
|
+
for (let o = 0; o < M.length; o++) l[a++] = u[M[o]];
|
|
75
|
+
if (e) for (let o = 0; o < f.length; o++) l[a++] = f[o];
|
|
76
|
+
return l;
|
|
77
|
+
}
|
|
78
|
+
_sort(r, i) {
|
|
79
|
+
const n = r.length;
|
|
80
|
+
let t = new Int32Array(n), e = new Int32Array(n), s = new Int32Array(n), f = new Int32Array(n);
|
|
81
|
+
for (let l = 0; l < n; l++) t[l] = l;
|
|
82
|
+
const u = i ? -1 : 1;
|
|
83
|
+
let E = 0;
|
|
84
|
+
const M = (l, a, o) => {
|
|
85
|
+
const h = k(l, a, o);
|
|
86
|
+
return E = h, h === l.length ? h === a.length ? 0 : -u : h === a.length ? u : (l.charCodeAt(h) - a.charCodeAt(h)) * u;
|
|
87
|
+
};
|
|
88
|
+
for (let l = 1; l < n; l *= 2) {
|
|
89
|
+
for (let o = 0; o < n; o += 2 * l) {
|
|
90
|
+
const h = o + l < n ? o + l : n, m = o + 2 * l < n ? o + 2 * l : n;
|
|
91
|
+
let g = o, p = h, c = o;
|
|
92
|
+
if (h >= m) {
|
|
93
|
+
for (; g < m; g++, c++) e[c] = t[g], f[c] = s[g];
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
let A = 0, I = 0;
|
|
97
|
+
for (; g < h && p < m; ) {
|
|
98
|
+
let w;
|
|
99
|
+
A > I ? w = true : A < I ? w = false : (w = M(r[t[g]], r[t[p]], A) <= 0, w ? I = E : A = E), w ? (e[c] = t[g], f[c] = c === o ? 0 : A, c++, g++, A = g < h ? s[g] : 0) : (e[c] = t[p], f[c] = c === o ? 0 : I, c++, p++, I = p < m ? s[p] : 0);
|
|
100
|
+
}
|
|
101
|
+
if (g < h) for (e[c] = t[g], f[c] = A, c++, g++; g < h; g++, c++) e[c] = t[g], f[c] = s[g];
|
|
102
|
+
if (p < m) for (e[c] = t[p], f[c] = I, c++, p++; p < m; p++, c++) e[c] = t[p], f[c] = s[p];
|
|
103
|
+
}
|
|
104
|
+
let a = t;
|
|
105
|
+
t = e, e = a, a = s, s = f, f = a;
|
|
106
|
+
}
|
|
107
|
+
return t;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
export {
|
|
111
|
+
x as LcpMergeOrderer,
|
|
112
|
+
_ as SortCostEstimate
|
|
113
|
+
};
|
|
114
|
+
//# sourceMappingURL=LcpMergeOrderer-BdUtV67j.js.map
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const BLOCK = 256;
|
|
4
|
+
function commonPrefix(d, r, i) {
|
|
5
|
+
const n = d.length < r.length ? d.length : r.length;
|
|
6
|
+
let t = i;
|
|
7
|
+
if (n - t > 64) for (; t + BLOCK <= n && d.substring(t, t + BLOCK) === r.substring(t, t + BLOCK); ) t += BLOCK;
|
|
8
|
+
for (; t < n && d.charCodeAt(t) === r.charCodeAt(t); ) t++;
|
|
9
|
+
return t;
|
|
10
|
+
}
|
|
11
|
+
const PREFIX_ORDERER_ID = "lcpMerge", PREFIX_SAMPLES = 1024, PREFIX_THRESHOLD = 64, NUMBER_WEIGHT = 12e-6, GENERAL_WEIGHT = 3e-5, STRING_BASE_WEIGHT = 2e-5, STRING_PER_CHAR_WEIGHT = 1e-7, LENGTH_SAMPLES = 64, DEFAULT_THRESHOLD_MS = 100;
|
|
12
|
+
function meanKeyLength(d, r) {
|
|
13
|
+
const i = Math.min(LENGTH_SAMPLES, r);
|
|
14
|
+
if (i === 0) return 0;
|
|
15
|
+
const n = r / i;
|
|
16
|
+
let t = 0;
|
|
17
|
+
for (let e = 0; e < i; e++) {
|
|
18
|
+
const s = d.stringKeyAt(Math.floor(e * n));
|
|
19
|
+
s !== null && (t += s.length);
|
|
20
|
+
}
|
|
21
|
+
return t / i;
|
|
22
|
+
}
|
|
23
|
+
const WEIGHT_OF = { number: () => NUMBER_WEIGHT, ranked: () => NUMBER_WEIGHT, general: () => GENERAL_WEIGHT, string: (d, r) => STRING_BASE_WEIGHT + STRING_PER_CHAR_WEIGHT * meanKeyLength(d, r) };
|
|
24
|
+
class SortCostEstimate {
|
|
25
|
+
constructor(r) {
|
|
26
|
+
this.expectedMs = r;
|
|
27
|
+
}
|
|
28
|
+
static of(r, i, n) {
|
|
29
|
+
const t = Math.max(0, Math.floor(r));
|
|
30
|
+
if (t < 2 || i.length === 0) return new SortCostEstimate(0);
|
|
31
|
+
let e = 0;
|
|
32
|
+
for (const s of i) e += n ? NUMBER_WEIGHT : WEIGHT_OF[s.kind](s, t);
|
|
33
|
+
return new SortCostEstimate(t * Math.log2(t) * e);
|
|
34
|
+
}
|
|
35
|
+
prefersSlicing(r = DEFAULT_THRESHOLD_MS) {
|
|
36
|
+
return this.expectedMs > r;
|
|
37
|
+
}
|
|
38
|
+
static meanCommonPrefix(r, i) {
|
|
39
|
+
const n = i.length, t = n < PREFIX_SAMPLES ? n : PREFIX_SAMPLES, e = [];
|
|
40
|
+
let s = 2654435769;
|
|
41
|
+
for (let u = 0; u < t; u++) {
|
|
42
|
+
s = Math.imul(s, 1103515245) + 12345 >>> 0;
|
|
43
|
+
const m = Math.floor(u * n / t), A = Math.floor((u + 1) * n / t), l = m + Math.floor(s / 4294967296 * (A - m)), a = r.stringKeyAt(i[l]);
|
|
44
|
+
a !== null && e.push(a);
|
|
45
|
+
}
|
|
46
|
+
if (e.length < 2) return 0;
|
|
47
|
+
e.sort();
|
|
48
|
+
let f = 0;
|
|
49
|
+
for (let u = 1; u < e.length; u++) f += commonPrefix(e[u - 1], e[u], 0);
|
|
50
|
+
return f / (e.length - 1);
|
|
51
|
+
}
|
|
52
|
+
static pickOrderer(r, i, n) {
|
|
53
|
+
let t = null, e = null;
|
|
54
|
+
for (const s of r) s.accepts(i, n.length) && (s.id === PREFIX_ORDERER_ID ? t ?? (t = s) : e ?? (e = s));
|
|
55
|
+
if (t && (!e || n.length >= PREFIX_SAMPLES && SortCostEstimate.meanCommonPrefix(i[0], n) > PREFIX_THRESHOLD)) return t;
|
|
56
|
+
if (!e) throw new Error("Sorter: no orderer accepts these keys");
|
|
57
|
+
return e;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
class LcpMergeOrderer {
|
|
61
|
+
constructor() {
|
|
62
|
+
this.id = "lcpMerge";
|
|
63
|
+
}
|
|
64
|
+
accepts(r, i) {
|
|
65
|
+
return r.length === 1 && r[0].kind === "string";
|
|
66
|
+
}
|
|
67
|
+
order(r, i, n) {
|
|
68
|
+
const t = i[0], e = n[0] !== "asc", s = r.length, f = [], u = [], m = [];
|
|
69
|
+
for (let o = 0; o < s; o++) {
|
|
70
|
+
const h = r[o], E = t.stringKeyAt(h);
|
|
71
|
+
E === null ? f.push(h) : (u.push(h), m.push(E));
|
|
72
|
+
}
|
|
73
|
+
const A = this._sort(m, e), l = new Int32Array(s);
|
|
74
|
+
let a = 0;
|
|
75
|
+
if (!e) for (let o = 0; o < f.length; o++) l[a++] = f[o];
|
|
76
|
+
for (let o = 0; o < A.length; o++) l[a++] = u[A[o]];
|
|
77
|
+
if (e) for (let o = 0; o < f.length; o++) l[a++] = f[o];
|
|
78
|
+
return l;
|
|
79
|
+
}
|
|
80
|
+
_sort(r, i) {
|
|
81
|
+
const n = r.length;
|
|
82
|
+
let t = new Int32Array(n), e = new Int32Array(n), s = new Int32Array(n), f = new Int32Array(n);
|
|
83
|
+
for (let l = 0; l < n; l++) t[l] = l;
|
|
84
|
+
const u = i ? -1 : 1;
|
|
85
|
+
let m = 0;
|
|
86
|
+
const A = (l, a, o) => {
|
|
87
|
+
const h = commonPrefix(l, a, o);
|
|
88
|
+
return m = h, h === l.length ? h === a.length ? 0 : -u : h === a.length ? u : (l.charCodeAt(h) - a.charCodeAt(h)) * u;
|
|
89
|
+
};
|
|
90
|
+
for (let l = 1; l < n; l *= 2) {
|
|
91
|
+
for (let o = 0; o < n; o += 2 * l) {
|
|
92
|
+
const h = o + l < n ? o + l : n, E = o + 2 * l < n ? o + 2 * l : n;
|
|
93
|
+
let g = o, p = h, c = o;
|
|
94
|
+
if (h >= E) {
|
|
95
|
+
for (; g < E; g++, c++) e[c] = t[g], f[c] = s[g];
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
let M = 0, I = 0;
|
|
99
|
+
for (; g < h && p < E; ) {
|
|
100
|
+
let w;
|
|
101
|
+
M > I ? w = true : M < I ? w = false : (w = A(r[t[g]], r[t[p]], M) <= 0, w ? I = m : M = m), w ? (e[c] = t[g], f[c] = c === o ? 0 : M, c++, g++, M = g < h ? s[g] : 0) : (e[c] = t[p], f[c] = c === o ? 0 : I, c++, p++, I = p < E ? s[p] : 0);
|
|
102
|
+
}
|
|
103
|
+
if (g < h) for (e[c] = t[g], f[c] = M, c++, g++; g < h; g++, c++) e[c] = t[g], f[c] = s[g];
|
|
104
|
+
if (p < E) for (e[c] = t[p], f[c] = I, c++, p++; p < E; p++, c++) e[c] = t[p], f[c] = s[p];
|
|
105
|
+
}
|
|
106
|
+
let a = t;
|
|
107
|
+
t = e, e = a, a = s, s = f, f = a;
|
|
108
|
+
}
|
|
109
|
+
return t;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
exports.LcpMergeOrderer = LcpMergeOrderer, exports.SortCostEstimate = SortCostEstimate;
|
|
113
|
+
//# sourceMappingURL=LcpMergeOrderer-C_ANVkGk.cjs.map
|