open-grid 1.6.0 → 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.
Files changed (126) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/dist/ExportProgressView-9Kt1SQxv.js +48 -0
  3. package/dist/ExportProgressView-B59uHIwt.cjs +48 -0
  4. package/dist/LcpMergeOrderer-BdUtV67j.js +114 -0
  5. package/dist/LcpMergeOrderer-C_ANVkGk.cjs +113 -0
  6. package/dist/OpenGrid-BUYQs1_w.cjs +9806 -0
  7. package/dist/OpenGrid-BmagF0yo.js +9819 -0
  8. package/dist/XlsxChannel-DOeHeP7h.cjs +95 -0
  9. package/dist/XlsxChannel-DdaiytFR.js +95 -0
  10. package/dist/XlsxWorkbookWriter-BTNtZ80J.js +199 -0
  11. package/dist/XlsxWorkbookWriter-_u5stfg4.cjs +198 -0
  12. package/dist/{index-Brnev66-.js → index-B9_g5Eg3.js} +2 -2
  13. package/dist/{index-B_e5BXnW.cjs → index-CnyumyPV.cjs} +2 -2
  14. package/dist/open-grid-a11y.cjs +216 -0
  15. package/dist/open-grid-a11y.js +219 -0
  16. package/dist/open-grid-base.css +9 -0
  17. package/dist/open-grid-header.css +6 -15
  18. package/dist/open-grid-react.cjs +1 -1
  19. package/dist/open-grid-react.js +1 -1
  20. package/dist/open-grid-vue.cjs +1 -1
  21. package/dist/open-grid-vue.js +1 -1
  22. package/dist/open-grid.cjs +5 -2
  23. package/dist/open-grid.js +6 -3
  24. package/dist/sinks-BWkWQexV.js +149 -0
  25. package/dist/sinks-DPK0VxYG.cjs +143 -0
  26. package/dist/types/a11y/index.d.ts +37 -0
  27. package/dist/types/core/CFRenderBridge.d.ts +5 -1
  28. package/dist/types/core/CellEditManager.d.ts +26 -2
  29. package/dist/types/core/CellEventHandler.d.ts +6 -2
  30. package/dist/types/core/ColumnLayout.d.ts +11 -3
  31. package/dist/types/core/DataLayer.d.ts +48 -1
  32. package/dist/types/core/DetailManager.d.ts +43 -2
  33. package/dist/types/core/ExportManager.d.ts +26 -6
  34. package/dist/types/core/FindBarManager.d.ts +6 -2
  35. package/dist/types/core/FlatRowModel.d.ts +69 -3
  36. package/dist/types/core/FooterManager.d.ts +43 -1
  37. package/dist/types/core/FormulaController.d.ts +4 -4
  38. package/dist/types/core/GridComposer.d.ts +11 -1
  39. package/dist/types/core/GridRenderer.d.ts +84 -19
  40. package/dist/types/core/GroupTreeManager.d.ts +6 -4
  41. package/dist/types/core/KeyboardManager.d.ts +3 -2
  42. package/dist/types/core/MergeEngine.d.ts +45 -5
  43. package/dist/types/core/MutationService.d.ts +14 -17
  44. package/dist/types/core/OpenGrid.d.ts +350 -12
  45. package/dist/types/core/OrgChart.d.ts +24 -0
  46. package/dist/types/core/RangeSelectionManager.d.ts +23 -2
  47. package/dist/types/core/RenderController.d.ts +126 -8
  48. package/dist/types/core/RowDragDrop.d.ts +2 -0
  49. package/dist/types/core/SortFilterManager.d.ts +18 -2
  50. package/dist/types/core/VirtualScroll.d.ts +12 -0
  51. package/dist/types/core/WorksheetManager.d.ts +2 -2
  52. package/dist/types/core/a11y/KeyboardInteractionModel.d.ts +321 -20
  53. package/dist/types/core/a11y/LiveRegionController.d.ts +229 -27
  54. package/dist/types/core/a11y/VisualEquivRegistry.d.ts +199 -14
  55. package/dist/types/core/appearance/TextureRegistry.d.ts +10 -0
  56. package/dist/types/core/cf/CFRule.d.ts +145 -22
  57. package/dist/types/core/coordinate/CellTextPolicy.d.ts +58 -0
  58. package/dist/types/core/coordinate/ColumnGeometry.d.ts +60 -0
  59. package/dist/types/core/coordinate/ColumnWindow.d.ts +40 -0
  60. package/dist/types/core/coordinate/ColumnWindowPolicy.d.ts +89 -0
  61. package/dist/types/core/coordinate/ExtraColumns.d.ts +39 -0
  62. package/dist/types/core/coordinate/RangeRectCalculator.d.ts +35 -0
  63. package/dist/types/core/coordinate/ViewportHeightJudge.d.ts +28 -0
  64. package/dist/types/core/coordinate/geometryPorts.d.ts +250 -0
  65. package/dist/types/core/coordinate/ports.d.ts +5 -0
  66. package/dist/types/core/domain/footer/FooterValues.d.ts +50 -0
  67. package/dist/types/core/domain/footer/ports.d.ts +31 -0
  68. package/dist/types/core/domain/render/RenderPlanner.d.ts +17 -0
  69. package/dist/types/core/domain/render/RenderRequest.d.ts +91 -0
  70. package/dist/types/core/domain/render/ports.d.ts +169 -0
  71. package/dist/types/core/domain/resize/ResizeGesture.d.ts +25 -0
  72. package/dist/types/core/domain/resize/ResizeHitZone.d.ts +23 -0
  73. package/dist/types/core/domain/resize/ports.d.ts +64 -0
  74. package/dist/types/core/domain/sort/ComparisonOrderer.d.ts +11 -0
  75. package/dist/types/core/domain/sort/LcpMergeOrderer.d.ts +15 -0
  76. package/dist/types/core/domain/sort/RankIndex.d.ts +74 -0
  77. package/dist/types/core/domain/sort/SortCostEstimate.d.ts +36 -0
  78. package/dist/types/core/domain/sort/SortKeyColumn.d.ts +89 -0
  79. package/dist/types/core/domain/sort/SortKeyStore.d.ts +34 -0
  80. package/dist/types/core/domain/sort/Sorter.d.ts +54 -0
  81. package/dist/types/core/domain/sort/SyncSortRunner.d.ts +9 -0
  82. package/dist/types/core/domain/sort/commonPrefix.d.ts +5 -0
  83. package/dist/types/core/domain/sort/ports.d.ts +140 -0
  84. package/dist/types/core/export/ExportProgressView.d.ts +28 -0
  85. package/dist/types/core/export/channels/XlsxChannel.d.ts +29 -0
  86. package/dist/types/core/export/channels/XlsxWorkbookWriter.d.ts +17 -0
  87. package/dist/types/core/export/index.d.ts +2 -0
  88. package/dist/types/core/export/sinks.d.ts +81 -0
  89. package/dist/types/core/host/archCheck.d.ts +16 -1
  90. package/dist/types/core/i18n/locales/en.d.ts +6 -0
  91. package/dist/types/core/i18n/locales/ko.d.ts +6 -0
  92. package/dist/types/core/i18n/types.d.ts +8 -0
  93. package/dist/types/core/render/FooterView.d.ts +121 -0
  94. package/dist/types/core/render/GeometryApplier.d.ts +55 -0
  95. package/dist/types/core/render/HorizontalReveal.d.ts +26 -0
  96. package/dist/types/core/render/RangeOverlayAdapter.d.ts +10 -0
  97. package/dist/types/core/render/RenderScheduler.d.ts +225 -0
  98. package/dist/types/core/render/ResizeSinkAdapter.d.ts +35 -0
  99. package/dist/types/core/render/ScrollFollower.d.ts +34 -0
  100. package/dist/types/core/render/ScrollObserver.d.ts +47 -0
  101. package/dist/types/core/render/ScrollbarGutter.d.ts +19 -0
  102. package/dist/types/core/render/body/BodyEventRouter.d.ts +58 -0
  103. package/dist/types/core/render/body/BodyRowSet.d.ts +28 -0
  104. package/dist/types/core/render/body/BodyView.d.ts +185 -0
  105. package/dist/types/core/render/body/CellLocator.d.ts +36 -0
  106. package/dist/types/core/render/body/CellRegistry.d.ts +24 -0
  107. package/dist/types/core/render/body/ColumnPaintPlan.d.ts +19 -0
  108. package/dist/types/core/render/body/ExtraCellPainters.d.ts +20 -0
  109. package/dist/types/core/render/body/rows/BodyRowContext.d.ts +138 -0
  110. package/dist/types/core/render/body/rows/DataRowPainter.d.ts +58 -0
  111. package/dist/types/core/render/body/rows/DetailRowPainter.d.ts +24 -0
  112. package/dist/types/core/render/body/rows/GroupRowPainter.d.ts +32 -0
  113. package/dist/types/core/render/body/rows/RowPainterTable.d.ts +24 -0
  114. package/dist/types/core/render/body/rows/WindowLayout.d.ts +38 -0
  115. package/dist/types/core/render/dom.d.ts +10 -0
  116. package/dist/types/core/render/header/HeaderSortIndicator.d.ts +39 -0
  117. package/dist/types/core/render/header/HeaderView.d.ts +84 -0
  118. package/dist/types/core/render/header/ResizeHandleBinder.d.ts +110 -0
  119. package/dist/types/core/render/ports.d.ts +218 -0
  120. package/dist/types/core/renderers/CellRenderer.d.ts +7 -0
  121. package/dist/types/core/types.d.ts +572 -22
  122. package/dist/types/index.d.ts +31 -1
  123. package/dist/types/vue/OpenGrid.vue.d.ts +2 -2
  124. package/package.json +8 -9
  125. package/dist/OpenGrid-DgZtbVD0.cjs +0 -7390
  126. package/dist/OpenGrid-E11B7Xa7.js +0 -7403
@@ -1,8 +1,11 @@
1
1
  /**
2
- * 통계가 필요 없는 값 비교/텍스트/날짜 조건과, 열 전역 통계가 필요한 조건(topN·stdBand·duplicate)을
3
- * 1급으로 담는 조건 카탈로그(REQ-T5-042). 각 조건은 순수 판정 술어로 해석된다.
4
- * / First-class condition catalog (REQ-T5-042). Stat-free comparisons plus column-wide stat
5
- * conditions (topN/stdBand/duplicate). Each is interpreted by a pure predicate.
2
+ * 규칙이 걸리는 조건. `type` 으로 종류를 고른다: 값 비교(compare)·글자 포함(textContains)·날짜(dateOccurring)·상위 N(topN·topNpct)·평균 위아래(aboveAvg)·표준편차 띠(stdBand)·중복(duplicate)·등록한 술어(custom).
3
+ *
4
+ * The condition that fires a rule. Pick the kind with `type`: value comparison (compare), text contains (textContains), date (dateOccurring), top N (topN, topNpct), above/below average (aboveAvg), standard-deviation band (stdBand), duplicates (duplicate) or a registered predicate (custom).
5
+ *
6
+ * 規則が掛かる条件。`type` で種類を選びます: 値の比較(compare)・文字を含む(textContains)・日付(dateOccurring)・上位 N(topN・topNpct)・平均の上下(aboveAvg)・標準偏差の帯(stdBand)・重複(duplicate)・登録した述語(custom)。
7
+ *
8
+ * 触发规则的条件。用 `type` 选择种类:数值比较(compare)、包含文字(textContains)、日期(dateOccurring)、前 N 名(topN、topNpct)、高于/低于平均(aboveAvg)、标准差区间(stdBand)、重复(duplicate)、已注册的谓词(custom)。
6
9
  */
7
10
  export type CFCondition = {
8
11
  readonly type: 'compare';
@@ -40,9 +43,13 @@ export type CFCondition = {
40
43
  readonly params?: Readonly<Record<string, unknown>>;
41
44
  };
42
45
  /**
43
- * encode 슬롯 — 4종 시각 인코딩의 판별 유니온. 정직성 파라미터를 각자 소유(§2.1).
44
- * bar: 0기준·음수 양방향·클램프·로그. scale: 이산 기본·연속 옵트인·발산 중립. icon: 이중부호화.
45
- * / encode slot — discriminated union of the 4 visual encodings; each owns its honesty params.
46
+ * 조건에 맞는 칸을 어떻게 보여 줄지. `kind` 로 고른다: 막대(bar)·색 단계(scale)·아이콘(icon)·작은 추세선(sparkline).
47
+ *
48
+ * How matching cells are shown. Pick with `kind`: bar, color scale (scale), icon or a small trend line (sparkline).
49
+ *
50
+ * 条件に合うセルをどう見せるか。`kind` で選びます: バー(bar)・色の段階(scale)・アイコン(icon)・小さな推移線(sparkline)。
51
+ *
52
+ * 如何显示符合条件的单元格。用 `kind` 选择:条形(bar)、色阶(scale)、图标(icon)、小型趋势线(sparkline)。
46
53
  */
47
54
  export type CFEncodeSpec = {
48
55
  readonly kind: 'bar';
@@ -71,22 +78,62 @@ export type CFEncodeSpec = {
71
78
  readonly chart?: 'bar' | 'line' | 'area';
72
79
  readonly normalize?: 'row' | 'column';
73
80
  };
74
- /** 적용 스코프 — 어느 셀 집합에 거는가. columnId 필수 + 선택적 행범위·행상태 술어. / Application scope. */
81
+ /**
82
+ * 규칙을 걸 칸의 범위 — 컬럼 하나(필수)와, 필요하면 행 범위·행 상태.
83
+ *
84
+ * Which cells the rule applies to — one column (required) and optionally a row range or row state.
85
+ *
86
+ * 規則を掛けるセルの範囲 — 列 1 つ(必須)と、必要なら行の範囲・行の状態。
87
+ *
88
+ * 规则作用的单元格范围 — 一列(必需),需要时再加行范围或行状态。
89
+ */
75
90
  export interface CFScope {
76
91
  readonly columnId: string;
77
- /** 반열림 행 범위 [startRow, endRow). 미지정=열 전체. / Half-open row range; absent = whole column. */
92
+ /**
93
+ * 행 범위 [startRow, endRow) — 끝은 포함하지 않는다. 없으면 컬럼 전체.
94
+ *
95
+ * Row range [startRow, endRow) — end excluded. Absent means the whole column.
96
+ *
97
+ * 行の範囲 [startRow, endRow) — 終わりは含みません。なければ列全体。
98
+ *
99
+ * 行范围 [startRow, endRow) — 不含末尾。没有则为整列。
100
+ */
78
101
  readonly range?: {
79
102
  readonly startRow: number;
80
103
  readonly endRow: number;
81
104
  };
82
- /** 행상태 제한(예: 'added'|'edited'|'removed'). / Row-state gate. */
105
+ /**
106
+ * 이 상태의 행에만 건다(추가·수정·삭제된 행).
107
+ *
108
+ * Apply only to rows in this state (added, edited or removed).
109
+ *
110
+ * この状態の行にだけ掛けます(追加・修正・削除された行)。
111
+ *
112
+ * 只作用于该状态的行(新增、修改、删除的行)。
113
+ */
83
114
  readonly rowState?: 'added' | 'edited' | 'removed';
84
115
  }
85
- /** 이름붙인 재사용 스타일 참조(색조정자 단일관리, MCD-DB014). / Named reusable style reference. */
116
+ /**
117
+ * 이름 붙여 등록한 스타일을 가리킨다(여러 규칙이 같은 색을 나눠 쓸 때).
118
+ *
119
+ * Refers to a style registered by name (when several rules share the same colors).
120
+ *
121
+ * 名前を付けて登録したスタイルを指します(複数の規則が同じ色を共有するとき)。
122
+ *
123
+ * 引用按名称注册的样式(多个规则共用同一套颜色时)。
124
+ */
86
125
  export interface CFStyleRef {
87
126
  readonly ref: string;
88
127
  }
89
- /** 인라인 스타일(공용 프리미티브). named style 이 없을 때의 직접 지정. / Inline style primitives. */
128
+ /**
129
+ * 규칙 안에 바로 적는 스타일(글자색·배경·굵게·기울임·밑줄).
130
+ *
131
+ * A style written directly in the rule (text color, background, bold, italic, underline).
132
+ *
133
+ * 規則の中に直接書くスタイル(文字色・背景・太字・斜体・下線)。
134
+ *
135
+ * 直接写在规则里的样式(文字颜色、背景、粗体、斜体、下划线)。
136
+ */
90
137
  export interface CFInlineStyle {
91
138
  readonly color?: string;
92
139
  readonly background?: string;
@@ -97,25 +144,101 @@ export interface CFInlineStyle {
97
144
  /** style 슬롯이 참조형인지 판별(직렬화·해석 분기). / Discriminate a style ref from an inline style. */
98
145
  export declare function isStyleRef(s: CFStyleRef | CFInlineStyle | undefined): s is CFStyleRef;
99
146
  /**
100
- * 조건부서식 규칙 — 직렬화 가능한 선언 값 객체(순수 데이터, DOM·함수 참조 없음). REQ-T5-001/808.
101
- * / A conditional-formatting rule — a serializable declarative value object (pure data).
147
+ * 조건부 서식 규칙 하나. 함수를 담지 않는 데이터라 JSON 으로 저장했다가 그대로 되살릴 수 있다. `grid.setConditionalFormat([규칙…])` 에 넘긴다.
148
+ *
149
+ * One conditional-formatting rule. It holds no functions, so it can be saved as JSON and restored as is. Pass it to `grid.setConditionalFormat([rules…])`.
150
+ *
151
+ * 条件付き書式の規則 1 つ。関数を持たないデータなので JSON で保存してそのまま復元できます。`grid.setConditionalFormat([規則…])` に渡します。
152
+ *
153
+ * 一条条件格式规则。它不包含函数,可以保存为 JSON 后原样还原。传给 `grid.setConditionalFormat([规则…])`。
154
+ *
155
+ * @example
156
+ * const rule: CFRule = {
157
+ * id: 'high-sales', when: { type: 'compare', op: '>', a: 100 }, encode: { kind: 'bar' },
158
+ * scope: { columnId: 'sales' }, priority: 1,
159
+ * };
160
+ * await grid.setConditionalFormat([rule]);
102
161
  */
103
162
  export interface CFRule {
104
- /** 안정 식별자(직렬화·계보·우선순위 tie-break 결정론). / Stable id (serialization/lineage/tie-break). */
163
+ /**
164
+ * 규칙 이름(겹치지 않게). 우선순위가 같을 때 순서를 정하는 데도 쓴다.
165
+ *
166
+ * The rule's id (unique). Also breaks ties between equal priorities.
167
+ *
168
+ * 規則の名前(重ならないように)。優先度が同じときの順番決めにも使います。
169
+ *
170
+ * 规则名称(不重复)。优先级相同时也用它决定顺序。
171
+ */
105
172
  readonly id: string;
106
- /** 발화 조건(1급 카탈로그 중 하나, REQ-T5-042). / Firing condition. */
173
+ /**
174
+ * 걸리는 조건.
175
+ *
176
+ * The condition.
177
+ *
178
+ * 掛かる条件。
179
+ *
180
+ * 触发条件。
181
+ */
107
182
  readonly when: CFCondition;
108
- /** 시각 인코딩 종류(4종 공유 스키마). / Visual encoding (4 kinds share one schema). */
183
+ /**
184
+ * 보여 주는 방식.
185
+ *
186
+ * How it is shown.
187
+ *
188
+ * 見せ方。
189
+ *
190
+ * 显示方式。
191
+ */
109
192
  readonly encode: CFEncodeSpec;
110
- /** named style 참조 또는 인라인 스타일. / Named-style ref or inline style. */
193
+ /**
194
+ * 등록한 스타일 이름 또는 바로 적은 스타일.
195
+ *
196
+ * A registered style name or an inline style.
197
+ *
198
+ * 登録したスタイル名、または直接書いたスタイル。
199
+ *
200
+ * 已注册的样式名或直接写的样式。
201
+ */
111
202
  readonly style?: CFStyleRef | CFInlineStyle;
112
- /** 적용 스코프. / Application scope. */
203
+ /**
204
+ * 거는 범위.
205
+ *
206
+ * Where it applies.
207
+ *
208
+ * 掛ける範囲。
209
+ *
210
+ * 作用范围。
211
+ */
113
212
  readonly scope: CFScope;
114
- /** 우선순위(작을수록 먼저 평가·낮은 층). 동값이면 id 로 결정론 tie-break. / Priority (smaller = earlier/lower). */
213
+ /**
214
+ * 우선순위. 작을수록 먼저 본다. 같으면 `id` 순.
215
+ *
216
+ * Priority; smaller is evaluated first. Ties go by `id`.
217
+ *
218
+ * 優先度。小さいほど先に見ます。同じなら `id` の順。
219
+ *
220
+ * 优先级。数值越小越先判断。相同则按 `id` 排序。
221
+ */
115
222
  readonly priority: number;
116
- /** 참이면 이 규칙 뒤 규칙 평가 중단(엑셀 Stop-If-True). 기본 false. / Stop-If-True (Excel). */
223
+ /**
224
+ * `true` 면 이 규칙이 걸린 칸에는 뒤 규칙을 보지 않는다(엑셀의 「True 이면 중지」). 기본 `false`.
225
+ *
226
+ * When `true`, later rules are skipped for cells this rule matched (Excel's Stop If True). Default `false`.
227
+ *
228
+ * `true` ならこの規則が掛かったセルには後の規則を見ません(Excel の「条件を満たす場合は停止」)。既定 `false`。
229
+ *
230
+ * 为 `true` 时,本规则命中的单元格不再判断后面的规则(Excel 的「如果为真则停止」)。默认 `false`。
231
+ */
117
232
  readonly stopIfTrue?: boolean;
118
- /** 직렬화 스키마 버전(하위호환 진화). / Serialization schema version. */
233
+ /**
234
+ * 저장 형식 판 번호(옛 판을 읽을 때 쓴다).
235
+ *
236
+ * Saved-format version (used when reading older versions).
237
+ *
238
+ * 保存形式の版番号(古い版を読むときに使います)。
239
+ *
240
+ * 保存格式的版本号(读取旧版本时使用)。
241
+ */
119
242
  readonly v?: number;
120
243
  }
121
244
  /** 현재 직렬화 스키마 버전. 로더가 미래(더 큰) 버전 규칙을 안전 skip 하는 기준. / Current schema version. */
@@ -0,0 +1,58 @@
1
+ import { ICellTextPolicy, TextSpec } from './geometryPorts.js';
2
+ export interface CellTextPolicyOptions {
3
+ /** 최소 글자 폭을 글꼴 크기의 몇 배로 볼지(기본 0.2). / Narrowest glyph as a fraction of font size. */
4
+ minGlyphEm?: number;
5
+ /** 덮는 폭을 컬럼 안쪽 폭의 몇 배로 잡을지(기본 2). / Covered width as a multiple of the inner width. */
6
+ headroom?: number;
7
+ /** 한 줄 몫에 더하는 글자 수(기본 16). / Extra characters per line. */
8
+ slack?: number;
9
+ }
10
+ /**
11
+ * 칸에 넣을 글자 수 상한과 그 상한이 덮는 폭을 정하고 안전하게 자르는 유일한 곳. 상태가 없다.
12
+ * 불변: 결과는 원문의 앞부분 · 서로게이트 쌍·결합 문자를 가르지 않음 · 폭 없는 글자가 자를 자리 앞에 있으면 전문.
13
+ *
14
+ * Sole owner of the per-cell character limit, the width it covers, and safe truncation. Stateless.
15
+ */
16
+ export declare class CellTextPolicy implements ICellTextPolicy {
17
+ private readonly _em;
18
+ private readonly _headroom;
19
+ private readonly _slack;
20
+ constructor(opts?: CellTextPolicyOptions);
21
+ /**
22
+ * 상한(글자 수). 자르지 않아야 할 때(상한 끔·자동 높이·템플릿, 보이는 폭 모름, 글꼴 지표가 이상함)는 Infinity.
23
+ * 한 줄: ceil(max(안쪽 폭 × 여유, 보이는 폭) / g) + slack.
24
+ * 여러 줄(행 높이 고정 + 줄바꿈): 줄 수 × (ceil(안쪽 폭 × 여유 / g) + slack).
25
+ *
26
+ * Infinity when the text must not be cut (unlimited, unknown viewport width, bad metrics).
27
+ */
28
+ limit(spec: TextSpec): number;
29
+ /**
30
+ * 이 상한으로 채운 칸이 말줄임을 지키는 최대 컬럼 폭 — 컬럼이 이보다 넓어지면 다시 채운다.
31
+ * 한 줄: (limit − slack) × g + 좌우 여백. 여러 줄: 줄당 글자 수(limit ÷ 줄 수)로 같은 식.
32
+ *
33
+ * Widest column for which this limit still overflows; widen past it and the cell is refilled.
34
+ */
35
+ coverWidth(limit: number, spec: TextSpec): number;
36
+ /**
37
+ * 앞부분 limit 자로 자른다. 자를 자리가 서로게이트 쌍 가운데면 한 자 더 넣는다(길이 ≤ limit + 1).
38
+ * 자를 자리까지(그 바로 뒤 한 자 포함)에 폭 없는 글자가 있으면 전문을 돌려준다 — 결합 문자를 가르지 않는 것도 이 규칙이 맡는다.
39
+ * 짧은 글·Infinity 는 그대로라 새 문자열을 만들지 않는다.
40
+ *
41
+ * Keeps the first `limit` code units, extending by one to keep a surrogate pair whole. Returns the
42
+ * whole text when a zero-width character sits at or before the cut (this also keeps combining sequences intact).
43
+ */
44
+ fit(text: string, limit: number): string;
45
+ /** 최소 글자 폭 px. / Narrowest glyph width in px. */
46
+ private _glyph;
47
+ /** 컬럼 안쪽 폭(여백을 뺀 값, 0 아래로 안 감). / Inner column width, never negative. */
48
+ private _inner;
49
+ /** 여러 줄 칸 한 줄 몫 글자 수. / Characters per line of a wrapped cell. */
50
+ private _perLine;
51
+ /**
52
+ * 넣을 줄 수 = 보이는 줄 수(올림) + 1. 행이 한 줄보다 낮아도 2 줄 아래로 안 내린다(첫 줄을 늘 채움).
53
+ * 줄 높이가 이상하면(0·NaN) Infinity.
54
+ *
55
+ * Visible lines rounded up plus one, never below two. Infinity for a bad line height.
56
+ */
57
+ private _lines;
58
+ }
@@ -0,0 +1,60 @@
1
+ import { Px, LeafColIndex } from './types.js';
2
+ import { GeometryChange, IColumnGeometryWriter, IExtraColumns } from './geometryPorts.js';
3
+ /**
4
+ * 표시 잎 컬럼의 폭·left·전체 폭·고정 오른쪽 끝의 유일한 주인.
5
+ * 불변: leftOf(0) = extra.width() · leftOf(i+1) − leftOf(i) = widthOf(i) · totalWidth() = leftOf(count) ·
6
+ * 값이 바뀌면 version 이 1 오르고, 안 바뀌면 change.none(판 그대로).
7
+ * 반올림의 주인: 끌어서 정한 폭(resize)은 정수 px 로 든다(Math.round). 화면 배율 125%·150% 에서는 포인터 좌표가
8
+ * 소수라 제스처가 소수 폭을 내는데, 그것을 그대로 들면 머리글(표 흐름)과 본문(기하 위치)이 서로 다르게 반올림해
9
+ * 1px 어긋난다. 반올림을 여기 한 곳에서 해 두면 두 쪽이 같은 정수를 본다. 생성자·reset 이 받는 폭은 그대로 든다.
10
+ *
11
+ * Sole owner of column geometry. Version bumps by one on every real change; no-ops return change.none.
12
+ * Widths set by resize are rounded to whole px here (single owner of rounding); constructor/reset keep values as given.
13
+ */
14
+ export declare class ColumnGeometry implements IColumnGeometryWriter {
15
+ private _metrics;
16
+ private _widths;
17
+ private _extra;
18
+ private _offset;
19
+ private _version;
20
+ private _none;
21
+ /** _history[k] = 판 _base + k + 1 로 넘어간 변화. */
22
+ private readonly _history;
23
+ private _base;
24
+ /**
25
+ * @param widths 표시 잎 순서의 폭(px). 복사해서 쥔다 — 바깥 배열을 나중에 고쳐도 기하는 그대로. / copied
26
+ * @param extra 여분 컬럼 / extra columns
27
+ * @param frozenCount 왼쪽 고정 잎 컬럼 수 / left-frozen leaf count
28
+ */
29
+ constructor(widths: readonly number[], extra: IExtraColumns, frozenCount: number);
30
+ get version(): number;
31
+ get count(): number;
32
+ get frozenCount(): number;
33
+ get extra(): IExtraColumns;
34
+ /** 정수가 아닌 번호(NaN 포함)·범위 밖이면 0. */
35
+ widthOf(ci: LeafColIndex): Px;
36
+ /** 범위 밖은 끝으로 자르고, 숫자가 아닌 번호는 0 번으로 본다(NaN 이 퍼지지 않게). */
37
+ leftOf(ci: LeafColIndex): Px;
38
+ /** [ci, ci+span) 폭의 합. 끝을 넘으면 끝에서 자르고, span ≤ 0 이면 0. / Clipped at the end; 0 for span ≤ 0. */
39
+ spanWidth(ci: LeafColIndex, span: number): Px;
40
+ totalWidth(): Px;
41
+ frozenRight(): Px;
42
+ /** 내용 x → 그 x 를 담는 잎 컬럼. 여분 구역·음수면 0, 끝을 넘으면 count−1, 컬럼이 없으면 0. */
43
+ colAt(x: Px): LeafColIndex;
44
+ /** 읽기 전용(얼린) 폭 배열 — 바뀔 때마다 새 배열이라 받아 둔 쪽의 값은 그 판 그대로다. */
45
+ widths(): readonly number[];
46
+ changesSince(version: number): GeometryChange;
47
+ reset(widths: readonly number[], extra: IExtraColumns, frozenCount: number): GeometryChange;
48
+ /**
49
+ * 컬럼 하나의 폭. 끄는 동안 입력마다 불린다. 폭은 정수 px 로 반올림해 [1, 상한] 으로 자르고, 숫자가 아니면 아무것도 안 한다.
50
+ * 번호가 범위 밖·정수 아님이면 RangeError — 배열 밖에 써서 컬럼 수가 늘어나는 일을 막는다.
51
+ *
52
+ * Called per input while dragging. Rounded to whole px and clamped to [1, max]; non-finite is a no-op;
53
+ * bad index throws RangeError.
54
+ */
55
+ resize(ci: LeafColIndex, width: number): GeometryChange;
56
+ private _install;
57
+ private _commit;
58
+ private _structuralBody;
59
+ private _structuralChange;
60
+ }
@@ -0,0 +1,40 @@
1
+ import { LeafColIndex } from './types.js';
2
+ import { IColumnWindow, WindowSegment } from './geometryPorts.js';
3
+ /**
4
+ * DOM 으로 둘 컬럼 집합. 구간은 정규형(오름차순·안 겹침·붙은 구간은 하나로 합침)으로만 들고 있어서,
5
+ * 같은 컬럼 집합이면 늘 같은 구간 목록이다 — `equals` 가 구간을 그대로 견주면 된다.
6
+ * 전 컬럼을 덮으면 `full` 이고 빈칸이 없다(가상화를 안 한 지금 DOM 과 같은 모양).
7
+ *
8
+ * The segments are kept canonical (ascending, disjoint, adjacent ones merged), so equal column sets
9
+ * always have equal segment lists. A window covering every column is `full` and has no gaps.
10
+ */
11
+ export declare class ColumnWindow implements IColumnWindow {
12
+ readonly full: boolean;
13
+ readonly segments: readonly WindowSegment[];
14
+ /** 표시 잎 컬럼 수(창이 어떤 컬럼 구성에서 계산됐나 — 구성이 바뀌면 낡은 창). */
15
+ readonly count: number;
16
+ private readonly _gaps;
17
+ private constructor();
18
+ /** 전 컬럼 창. / Window covering every column. */
19
+ static full(count: number): ColumnWindow;
20
+ /**
21
+ * 구간 목록으로 만든다. 겹치거나 거꾸로 놓였거나 범위 밖이면 RangeError — 그리는 쪽이 같은 칸을 두 번 만들거나
22
+ * 없는 컬럼 정의를 읽는 일을 여기서 막는다. 붙은 구간은 합치고, 넘겨준 배열은 복사해 든다.
23
+ *
24
+ * Throws RangeError on overlap, wrong order or out-of-range indices; adjacent segments are merged
25
+ * and the input array is copied.
26
+ */
27
+ static of(segments: readonly WindowSegment[], count: number): ColumnWindow;
28
+ contains(ci: LeafColIndex): boolean;
29
+ forEachColumn(fn: (ci: LeafColIndex) => void): void;
30
+ /**
31
+ * 빈칸이 덮을 구간: 첫 구간 앞 · 구간 사이 · 마지막 구간 뒤. 첫 구간 앞도 내야 고정 컬럼 없는 그리드에서
32
+ * 가로로 옮긴 창이 왼쪽 0 에 붙어 그려지지 않는다.
33
+ *
34
+ * Gaps before the first segment, between segments and after the last one.
35
+ */
36
+ gaps(): readonly WindowSegment[];
37
+ equals(other: IColumnWindow): boolean;
38
+ private static _checkCount;
39
+ private static _gapsOf;
40
+ }
@@ -0,0 +1,89 @@
1
+ import { Px, LeafColIndex } from './types.js';
2
+ import { IColumnGeometry, IColumnWindow, IColumnWindowPolicy, GridShape, WindowQuery, WindowRule } from './geometryPorts.js';
3
+ import { IWindowingPort } from './ports.js';
4
+ import { ColumnWindow } from './ColumnWindow.js';
5
+ /**
6
+ * 가로 가상화 정책. 「창을 써도 되나」는 조건문이 아니라 규칙 목록이 답한다 — 규칙 하나라도 false 면 전 컬럼.
7
+ * 창 = 고정 컬럼 구간 + 보이는 범위 양옆으로 `max(minMarginPx, 보이는 폭 × marginRatio)` px 를 더한 연속 구간 하나
8
+ * (꼭 넣을 컬럼이 밖에 있으면 그 컬럼까지 넓힌 껍질). 그려 둔 창이 「보이는 범위 + 여유의 절반」을 아직 덮는 동안은
9
+ * 창을 바꾸지 않는다(이력) — 스크롤 몇 px 마다 끝 칸을 붙였다 뗐다 하지 않게.
10
+ * 가로 좌표는 기하의 내용 좌표(여분 칸 왼쪽 끝 = 0)이고, 스크롤 값도 같은 원점으로 받는다.
11
+ *
12
+ * Window = frozen segment + one contiguous segment spanning the visible range plus a pixel margin on each side
13
+ * (hull-widened to include pinned columns). Hysteresis: a drawn window is kept while it still covers the
14
+ * visible range plus half the margin. x is the geometry content coordinate (left edge of extra columns = 0).
15
+ */
16
+ export declare class ColumnWindowPolicy implements IColumnWindowPolicy, Pick<IWindowingPort, 'horizontalWindow'> {
17
+ private readonly _geometry;
18
+ private readonly _rules;
19
+ private readonly _minMargin;
20
+ private readonly _ratio;
21
+ /** 같은 컬럼 수의 전 컬럼 창은 하나만 만들어 돌려쓴다(스크롤마다 새 값을 만들지 않게). */
22
+ private _full;
23
+ /** `next` 가 본 직전 스크롤 값(나아가는 방향·속도). 처음엔 모름(NaN). / Previous scroll seen by `next`. */
24
+ private _lastScroll;
25
+ constructor(geometry: IColumnGeometry, rules: readonly WindowRule[], opts?: {
26
+ minMarginPx?: number;
27
+ marginRatio?: number;
28
+ });
29
+ /**
30
+ * 기본 규칙 넷. 서로 모르고 순서도 상관없다. 전 컬럼으로 그리는 경우는 자동 높이(화면 밖 긴 칸이 행 높이를 정함) ·
31
+ * 폭 모름(숨은 컨테이너 등 — 지금처럼 전 칸) · 병합(가려진 칸 자리를 지금 모양 그대로 지키려고) · 사용자가 끔.
32
+ * 줄바꿈 칸은 행 높이가 옵션 값이라 규칙에 없다 — 줄바꿈 + 고정 행 높이에서도 창을 쓴다.
33
+ * 「병합이 있나」는 모양의 `mergeEmpty` 하나만 본다 — 그 값을 병합 원천에서 읽어 채우는 일은 모양을 만드는 쪽 몫
34
+ * (원천이 둘이면 어긋날 때 어느 쪽이 맞는지 정책이 모른다).
35
+ *
36
+ * Four independent, order-free rules. Wrapped cells with a fixed row height keep the window on.
37
+ * Merge presence is read from `GridShape.mergeEmpty` only.
38
+ */
39
+ static defaultRules(): readonly WindowRule[];
40
+ /**
41
+ * 프레임마다 부르는 입구: 그려 둔 창을 그대로 둘지(모양이 창을 허용하고 이력상 아직 덮음) 새로 셀지를 한 번에 답한다.
42
+ * 새로 셀 때는 직전 프레임에서 움직인 만큼 나아가는 쪽 여유를 더 넓힌다 — 빠르게 긁어도 다음 프레임 자리가 이미 그려져
43
+ * 있게. 뒤쪽은 기본 여유 그대로라 방향을 바꿔도 빈 칸이 생기지 않는다. 더하는 몫은 보이는 폭 한 장까지.
44
+ * 움직임 이력은 이 입구만 쓴다(`compute`·`covers` 는 같은 입력에 늘 같은 답).
45
+ *
46
+ * Per-frame entry: keep the drawn window (shape allows it and it still covers) or compute a new one whose
47
+ * leading margin grows with the last frame's movement. Only this entry keeps movement history.
48
+ */
49
+ next(drawn: IColumnWindow | null, q: WindowQuery, shape: GridShape): IColumnWindow;
50
+ compute(q: WindowQuery, shape: GridShape): ColumnWindow;
51
+ private _window;
52
+ /**
53
+ * 그려 둔 창이 「보이는 범위 + 여유의 절반」을 px 로 아직 덮나. 덮으면 창을 바꾸지 않는다.
54
+ * 컬럼 구성이 바뀐 창(컬럼 수가 다르거나 지금 고정 구간을 담지 않음)은 덮지 않는다 — 옛 번호가 새 구성에서 뜻이 달라지므로.
55
+ * 전 컬럼 창은 늘 false: 그 창이 규칙 때문에 전 컬럼인지(자동 높이·폭 모름 …) 여기서는 모양을 모르므로 compute 에 맡긴다.
56
+ * 규칙이 여전히 전 컬럼을 요구하면 compute 가 같은 전 컬럼 창 객체를 돌려주어 `equals` 가 바로 같다고 답한다.
57
+ * 꼭 넣을 컬럼이 창 밖이면 덮지 않는다.
58
+ *
59
+ * Hysteresis test in pixels. A window built for another column layout never covers; a full window always
60
+ * answers false so that compute (which returns the same cached full window) decides.
61
+ */
62
+ covers(drawn: IColumnWindow, q: WindowQuery): boolean;
63
+ /**
64
+ * 기존 포트 호환: 같은 규칙·같은 여유로 계산한 창의 껍질을 반열림 `{start, end}` 로 돌려준다.
65
+ * 그 포트는 폭 말고는 모양을 모르므로 나머지 규칙 입력은 「허용」으로 둔다(폭 0 이면 여전히 전 컬럼).
66
+ * 고정 컬럼이 있으면 껍질이 0 부터라 가상화 없는 넓은 집합(0..창 끝)이 된다 — 호환용일 뿐, 새 코드는 compute 를 쓴다.
67
+ *
68
+ * Legacy port: hull of the computed window as half-open {start, end}; with frozen columns the hull starts at 0.
69
+ */
70
+ horizontalWindow(scrollLeft: Px, viewportW: Px): {
71
+ start: LeafColIndex;
72
+ end: LeafColIndex;
73
+ };
74
+ private _allows;
75
+ /** 보이는 폭: 유한한 양수가 아니면 0(모름). */
76
+ private static _width;
77
+ /**
78
+ * 스크롤 값을 브라우저처럼 [0, 전체 폭 − 보이는 폭] 에 묶는다. 컬럼을 숨기거나 좁힌 직후 관찰자가 든 값이 한 프레임
79
+ * 낡아 끝 너머여도 실제로 보일 컬럼을 빠뜨리지 않게. 유한수가 아니면 0.
80
+ */
81
+ private _scroll;
82
+ /** 차례대로 놓인 겹침 없는 구간 목록에 컬럼 하나짜리 토막을 제자리에 끼운다(이미 담겨 있으면 그대로). / Inserts a one-column segment in order. */
83
+ private static _insertColumn;
84
+ private _margin;
85
+ /** 내용 x → 컬럼(기하에 물음). 음수·여분 구역은 0, 끝 너머는 마지막 컬럼. */
86
+ private _col;
87
+ private _fullWindow;
88
+ private static _nonNegative;
89
+ }
@@ -0,0 +1,39 @@
1
+ import { Px } from './types.js';
2
+ import { ExtraColumnId, IExtraColumns } from './geometryPorts.js';
3
+ /** fromOptions 가 읽는 옵션. 참거짓은 지금 코드처럼 truthy 로 본다(`=== true` 가 아님). */
4
+ export interface ExtraColumnOptions {
5
+ stateColumn?: boolean;
6
+ draggable?: boolean;
7
+ rowNumber?: boolean;
8
+ checkColumn?: boolean;
9
+ detailExpanderCol?: boolean;
10
+ }
11
+ /**
12
+ * 여분 컬럼의 켜짐·순서·폭을 아는 유일한 곳(불변 값).
13
+ * 불변: width() = Σ 켜진 폭, ids 순서 = state→drag→rowNumber→check→detail.
14
+ *
15
+ * Sole owner of extra-column on/off, order and width (immutable value).
16
+ */
17
+ export declare class ExtraColumns implements IExtraColumns {
18
+ readonly ids: readonly ExtraColumnId[];
19
+ private readonly _width;
20
+ private readonly _left;
21
+ private readonly _total;
22
+ private constructor();
23
+ /**
24
+ * 그리드 옵션에서 만든다. 옵션이 없어도(undefined) 던지지 않고 「여분 없음」을 돌려준다 — 래퍼가 옵션 없이 부를 수 있다.
25
+ *
26
+ * Builds from grid options; undefined yields the empty set instead of throwing.
27
+ */
28
+ static fromOptions(o: ExtraColumnOptions | null | undefined): ExtraColumns;
29
+ /** 꺼진 컬럼이면 0. / 0 when that column is off. */
30
+ widthOf(id: ExtraColumnId): Px;
31
+ /**
32
+ * 고정(sticky) 때 left. 꺼진 컬럼이면 width() — 묻는 쪽에 NaN·undefined 가 퍼지지 않게 끝자리를 준다.
33
+ *
34
+ * Sticky left; for an off column returns width() so callers never see NaN.
35
+ */
36
+ leftOf(id: ExtraColumnId): Px;
37
+ /** Σ 켜진 여분 컬럼 폭. / Sum of enabled extra-column widths. */
38
+ width(): Px;
39
+ }
@@ -0,0 +1,35 @@
1
+ import { CellRangeLike, IColumnGeometry, IRangeRectCalculator } from './geometryPorts.js';
2
+ export interface RangeRectOptions {
3
+ /**
4
+ * 행 아래 테두리 두께(px). 행은 border-box 라 칸 높이 = rowHeight − 이 값이고, 지금 테두리 높이도 그 칸 높이로 잰다(기본 1).
5
+ *
6
+ * Row bottom border thickness; cells are rowHeight minus this, and today's border is measured from cells (default 1).
7
+ */
8
+ rowBorderPx?: number;
9
+ }
10
+ /**
11
+ * 범위 테두리 좌표를 기하·행 번호로 계산하는 곳. 상태가 없어 기하가 바뀌면 다음 호출에 그대로 반영된다.
12
+ * 불변: 칸이 DOM 에 없어도 같은 좌표 · DOM 읽기 0.
13
+ *
14
+ * Stateless: geometry changes show up on the next call.
15
+ */
16
+ export declare class RangeRectCalculator implements IRangeRectCalculator {
17
+ private readonly _geometry;
18
+ private readonly _rowBorder;
19
+ constructor(geometry: IColumnGeometry, opts?: RangeRectOptions);
20
+ /**
21
+ * @param scroll 본문 상자의 scrollTop·scrollLeft / body scroller offsets
22
+ * @param headerHeight top 에 더할 값. 본문 상자 기준이면 0, 컨테이너 기준이면 머리글 높이. / added to top
23
+ */
24
+ rect(range: CellRangeLike, scroll: {
25
+ readonly top: number;
26
+ readonly left: number;
27
+ }, rowHeight: number, headerHeight: number): {
28
+ left: number;
29
+ top: number;
30
+ width: number;
31
+ height: number;
32
+ };
33
+ /** 칸 하나의 보이는 x. 고정 컬럼은 sticky 라 스크롤을 안 탄다. */
34
+ private _cellX;
35
+ }
@@ -0,0 +1,28 @@
1
+ import { IViewportHeightJudge, ViewportSample, ViewportVerdict } from './geometryPorts.js';
2
+ export interface ViewportHeightJudgeOptions {
3
+ /** 보이는 구간 앞뒤로 더 그릴 높이 px(기본 200). / Extra px drawn above and below the visible part. */
4
+ overscanPx?: number;
5
+ }
6
+ /**
7
+ * 컨테이너 높이가 정해졌는지·내용이 높이를 정하는지 판정하고 세로 창에 쓸 높이·잘림을 내는 유일한 곳.
8
+ * 상태가 없다(표본만 읽고 고치지 않음).
9
+ * 불변: 높이가 정해진 컨테이너엔 지금과 같은 값 · 옵트인 사용자엔 지금 클램프 값 · 배치 높이 0(jsdom)엔 bounded ·
10
+ * 이상한 표본엔 bounded · clip ⊂ [0, 전체 내용 높이].
11
+ *
12
+ * Sole owner of the viewport-height verdict. Stateless; never mutates the sample.
13
+ */
14
+ export declare class ViewportHeightJudge implements IViewportHeightJudge {
15
+ private readonly _overscan;
16
+ constructor(opts?: ViewportHeightJudgeOptions);
17
+ judge(sample: ViewportSample): ViewportVerdict;
18
+ /** 「내용이 높이를 정함」 조건. 표본 값이 이상하면 false(지금 동작 쪽). / Content-driven test; odd samples give false. */
19
+ private _isContentDriven;
20
+ /**
21
+ * 보이는 구간을 본문 좌표로 옮겨 내용 범위로 자르고 앞뒤 여유를 더한다.
22
+ * 그리드가 화면 아래에 있으면 맨 위 여유만큼, 이미 지나쳤으면 맨 끝 여유만큼을 낸다(빈 구간을 내지 않음).
23
+ *
24
+ * Visible part in body coordinates, clamped to content, plus overscan. Below the screen: the
25
+ * first overscan px; scrolled past: the last overscan px.
26
+ */
27
+ private _clip;
28
+ }