@eifi1/ui-kit 0.54.0 → 0.56.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 (847) hide show
  1. package/README.md +90 -76
  2. package/dist/admin/plan-change.js +2 -2
  3. package/dist/admin/plan-change.js.map +1 -1
  4. package/dist/admin/user-roster.d.ts +6 -0
  5. package/dist/admin/user-roster.js +4 -0
  6. package/dist/admin/user-roster.js.map +1 -1
  7. package/dist/billing/billing-labels.d.ts +26 -0
  8. package/dist/billing/billing-labels.js +9 -0
  9. package/dist/billing/billing-labels.js.map +1 -1
  10. package/dist/billing/subscription-standing.d.ts +61 -0
  11. package/dist/billing/subscription-standing.js +51 -0
  12. package/dist/billing/subscription-standing.js.map +1 -0
  13. package/dist/billing/usage-meter.d.ts +52 -0
  14. package/dist/billing/usage-meter.js +52 -0
  15. package/dist/billing/usage-meter.js.map +1 -0
  16. package/dist/chart.d.ts +1 -0
  17. package/dist/chart.js +4 -0
  18. package/dist/chart.js.map +1 -1
  19. package/dist/components/alert-banner.js +2 -3
  20. package/dist/components/alert-banner.js.map +1 -1
  21. package/dist/components/amount-input.js +3 -15
  22. package/dist/components/amount-input.js.map +1 -1
  23. package/dist/components/autocomplete.js +2 -2
  24. package/dist/components/autocomplete.js.map +1 -1
  25. package/dist/components/bulk-action-bar.js +2 -1
  26. package/dist/components/bulk-action-bar.js.map +1 -1
  27. package/dist/components/button.d.ts +35 -1
  28. package/dist/components/button.js +6 -9
  29. package/dist/components/button.js.map +1 -1
  30. package/dist/components/calendar-heatmap.js +2 -2
  31. package/dist/components/calendar-heatmap.js.map +1 -1
  32. package/dist/components/camera-button.d.ts +89 -0
  33. package/dist/components/camera-button.js +122 -0
  34. package/dist/components/camera-button.js.map +1 -0
  35. package/dist/components/camera-capture.d.ts +66 -0
  36. package/dist/components/camera-capture.js +190 -0
  37. package/dist/components/camera-capture.js.map +1 -0
  38. package/dist/components/camera-labels.d.ts +20 -0
  39. package/dist/components/camera-labels.js +15 -0
  40. package/dist/components/camera-labels.js.map +1 -0
  41. package/dist/components/chart-edge.d.ts +9 -0
  42. package/dist/components/chart-edge.js +14 -3
  43. package/dist/components/chart-edge.js.map +1 -1
  44. package/dist/components/chart-zoom-core.js +34 -29
  45. package/dist/components/chart-zoom-core.js.map +1 -1
  46. package/dist/components/checkbox-group.js +1 -1
  47. package/dist/components/checkbox-group.js.map +1 -1
  48. package/dist/components/combobox-core.js +3 -2
  49. package/dist/components/combobox-core.js.map +1 -1
  50. package/dist/components/combobox.js +2 -2
  51. package/dist/components/combobox.js.map +1 -1
  52. package/dist/components/consent-again-notice-labels.d.ts +25 -0
  53. package/dist/components/consent-again-notice-labels.js +15 -0
  54. package/dist/components/consent-again-notice-labels.js.map +1 -0
  55. package/dist/components/consent-again-notice.d.ts +85 -0
  56. package/dist/components/consent-again-notice.js +94 -0
  57. package/dist/components/consent-again-notice.js.map +1 -0
  58. package/dist/components/country-select.js +2 -7
  59. package/dist/components/country-select.js.map +1 -1
  60. package/dist/components/currency-select.js +2 -2
  61. package/dist/components/currency-select.js.map +1 -1
  62. package/dist/components/danger-confirm.js +2 -2
  63. package/dist/components/danger-confirm.js.map +1 -1
  64. package/dist/components/data-table-column-settings.js +2 -2
  65. package/dist/components/data-table-column-settings.js.map +1 -1
  66. package/dist/components/data-table-fit.js.map +1 -1
  67. package/dist/components/data-table-virtual.js +13 -3
  68. package/dist/components/data-table-virtual.js.map +1 -1
  69. package/dist/components/date-field.js +2 -2
  70. package/dist/components/date-field.js.map +1 -1
  71. package/dist/components/date-picker.js +2 -2
  72. package/dist/components/date-picker.js.map +1 -1
  73. package/dist/components/date-range-picker.js +2 -6
  74. package/dist/components/date-range-picker.js.map +1 -1
  75. package/dist/components/dialog-frame.d.ts +3 -1
  76. package/dist/components/dialog-frame.js.map +1 -1
  77. package/dist/components/dropdown.js +7 -3
  78. package/dist/components/dropdown.js.map +1 -1
  79. package/dist/components/entity-combobox.js +2 -2
  80. package/dist/components/entity-combobox.js.map +1 -1
  81. package/dist/components/field-parts.d.ts +108 -6
  82. package/dist/components/field-parts.js +59 -6
  83. package/dist/components/field-parts.js.map +1 -1
  84. package/dist/components/field-suggestion-labels.d.ts +2 -0
  85. package/dist/components/field-suggestion-labels.js +10 -0
  86. package/dist/components/field-suggestion-labels.js.map +1 -0
  87. package/dist/components/field.js +1 -1
  88. package/dist/components/field.js.map +1 -1
  89. package/dist/components/file-button.d.ts +1 -1
  90. package/dist/components/file-button.js.map +1 -1
  91. package/dist/components/floating-panel.d.ts +7 -6
  92. package/dist/components/floating-panel.js +3 -17
  93. package/dist/components/floating-panel.js.map +1 -1
  94. package/dist/components/form-actions.d.ts +3 -2
  95. package/dist/components/form-actions.js.map +1 -1
  96. package/dist/components/hover-menu.js +3 -2
  97. package/dist/components/hover-menu.js.map +1 -1
  98. package/dist/components/icon-button.d.ts +23 -5
  99. package/dist/components/icon-button.js +7 -8
  100. package/dist/components/icon-button.js.map +1 -1
  101. package/dist/components/inline-confirm.js +2 -1
  102. package/dist/components/inline-confirm.js.map +1 -1
  103. package/dist/components/inline-entity-combobox.js +2 -2
  104. package/dist/components/inline-entity-combobox.js.map +1 -1
  105. package/dist/components/input.js +2 -2
  106. package/dist/components/input.js.map +1 -1
  107. package/dist/components/jump-calendar.js +3 -3
  108. package/dist/components/jump-calendar.js.map +1 -1
  109. package/dist/components/legal.d.ts +13 -1
  110. package/dist/components/legal.js +12 -0
  111. package/dist/components/legal.js.map +1 -1
  112. package/dist/components/legended-series-chart.d.ts +83 -0
  113. package/dist/components/legended-series-chart.js +77 -0
  114. package/dist/components/legended-series-chart.js.map +1 -0
  115. package/dist/components/lightbox.js +2 -1
  116. package/dist/components/lightbox.js.map +1 -1
  117. package/dist/components/mini-calendar.js +13 -5
  118. package/dist/components/mini-calendar.js.map +1 -1
  119. package/dist/components/modal.d.ts +23 -2
  120. package/dist/components/modal.js +24 -6
  121. package/dist/components/modal.js.map +1 -1
  122. package/dist/components/month-picker.d.ts +1 -1
  123. package/dist/components/month-picker.js +6 -6
  124. package/dist/components/month-picker.js.map +1 -1
  125. package/dist/components/multi-entity-combobox.js +2 -2
  126. package/dist/components/multi-entity-combobox.js.map +1 -1
  127. package/dist/components/multi-select.js +2 -6
  128. package/dist/components/multi-select.js.map +1 -1
  129. package/dist/components/number-input.js +2 -2
  130. package/dist/components/number-input.js.map +1 -1
  131. package/dist/components/page-header-layout.d.ts +18 -0
  132. package/dist/components/page-header-layout.js +23 -0
  133. package/dist/components/page-header-layout.js.map +1 -0
  134. package/dist/components/page-header-skeleton.d.ts +41 -0
  135. package/dist/components/page-header-skeleton.js +52 -0
  136. package/dist/components/page-header-skeleton.js.map +1 -0
  137. package/dist/components/page-header.js +4 -17
  138. package/dist/components/page-header.js.map +1 -1
  139. package/dist/components/popover.js +7 -2
  140. package/dist/components/popover.js.map +1 -1
  141. package/dist/components/release-notes-labels.d.ts +16 -0
  142. package/dist/components/release-notes-labels.js +18 -0
  143. package/dist/components/release-notes-labels.js.map +1 -0
  144. package/dist/components/release-notes.d.ts +65 -0
  145. package/dist/components/release-notes.js +65 -0
  146. package/dist/components/release-notes.js.map +1 -0
  147. package/dist/components/select.js +2 -2
  148. package/dist/components/select.js.map +1 -1
  149. package/dist/components/series-chart-labels.d.ts +9 -0
  150. package/dist/components/series-chart-labels.js +3 -1
  151. package/dist/components/series-chart-labels.js.map +1 -1
  152. package/dist/components/series-chart.d.ts +5 -0
  153. package/dist/components/series-chart.js +89 -36
  154. package/dist/components/series-chart.js.map +1 -1
  155. package/dist/components/toggle-group.js +3 -2
  156. package/dist/components/toggle-group.js.map +1 -1
  157. package/dist/components/treemap-layout.js.map +1 -1
  158. package/dist/components/treemap.d.ts +17 -15
  159. package/dist/components/treemap.js +167 -85
  160. package/dist/components/treemap.js.map +1 -1
  161. package/dist/eslint/index.js +1 -1
  162. package/dist/eslint/role-utilities.d.ts +2 -2
  163. package/dist/eslint/role-utilities.js.map +1 -1
  164. package/dist/feedback/feedback-inbox-page.d.ts +260 -0
  165. package/dist/feedback/feedback-inbox-page.js +207 -0
  166. package/dist/feedback/feedback-inbox-page.js.map +1 -0
  167. package/dist/feedback/feedback-vocabulary.js +2 -2
  168. package/dist/feedback/feedback-vocabulary.js.map +1 -1
  169. package/dist/feedback.d.ts +1 -0
  170. package/dist/feedback.js +6 -0
  171. package/dist/feedback.js.map +1 -1
  172. package/dist/hooks/use-debounce.d.ts +32 -5
  173. package/dist/hooks/use-debounce.js +6 -5
  174. package/dist/hooks/use-debounce.js.map +1 -1
  175. package/dist/hooks/use-file-picker.d.ts +3 -1
  176. package/dist/hooks/use-file-picker.js.map +1 -1
  177. package/dist/hooks/use-focus-trap.d.ts +19 -3
  178. package/dist/hooks/use-focus-trap.js +15 -5
  179. package/dist/hooks/use-focus-trap.js.map +1 -1
  180. package/dist/hooks/use-has-camera.d.ts +36 -0
  181. package/dist/hooks/use-has-camera.js +53 -0
  182. package/dist/hooks/use-has-camera.js.map +1 -0
  183. package/dist/hooks/use-hotkey.js +1 -10
  184. package/dist/hooks/use-hotkey.js.map +1 -1
  185. package/dist/hooks/use-overlay-history.d.ts +6 -1
  186. package/dist/hooks/use-overlay-history.js +10 -2
  187. package/dist/hooks/use-overlay-history.js.map +1 -1
  188. package/dist/i18n/defaults.js +11 -1
  189. package/dist/i18n/defaults.js.map +1 -1
  190. package/dist/i18n/german.js +75 -3
  191. package/dist/i18n/german.js.map +1 -1
  192. package/dist/i18n/kit-labels.d.ts +20 -0
  193. package/dist/i18n/kit-labels.js.map +1 -1
  194. package/dist/i18n/locales/en.js +92 -4
  195. package/dist/i18n/locales/en.js.map +3 -3
  196. package/dist/i18n/locales/es.js +71 -3
  197. package/dist/i18n/locales/es.js.map +1 -1
  198. package/dist/i18n/locales/fr.js +72 -2
  199. package/dist/i18n/locales/fr.js.map +1 -1
  200. package/dist/i18n/locales/hu.js +74 -3
  201. package/dist/i18n/locales/hu.js.map +1 -1
  202. package/dist/i18n/locales/it.js +74 -3
  203. package/dist/i18n/locales/it.js.map +1 -1
  204. package/dist/i18n/locales/zh.js +71 -3
  205. package/dist/i18n/locales/zh.js.map +1 -1
  206. package/dist/i18n/review.js +22 -1
  207. package/dist/i18n/review.js.map +1 -1
  208. package/dist/index.d.ts +24 -5
  209. package/dist/index.js +35 -1
  210. package/dist/index.js.map +1 -1
  211. package/dist/landing/landing-labels.d.ts +8 -0
  212. package/dist/landing/landing-labels.js +2 -1
  213. package/dist/landing/landing-labels.js.map +1 -1
  214. package/dist/lib/changelog.d.ts +130 -0
  215. package/dist/lib/changelog.js +137 -0
  216. package/dist/lib/changelog.js.map +1 -0
  217. package/dist/lib/clipboard-minus.js +2 -2
  218. package/dist/lib/clipboard-minus.js.map +1 -1
  219. package/dist/lib/dates.d.ts +29 -3
  220. package/dist/lib/dates.js +41 -12
  221. package/dist/lib/dates.js.map +1 -1
  222. package/dist/lib/editable-content.d.ts +33 -0
  223. package/dist/lib/editable-content.js +15 -0
  224. package/dist/lib/editable-content.js.map +1 -0
  225. package/dist/lib/focus-left.d.ts +47 -1
  226. package/dist/lib/focus-left.js +11 -2
  227. package/dist/lib/focus-left.js.map +1 -1
  228. package/dist/lib/server-wake.d.ts +49 -9
  229. package/dist/lib/server-wake.js +25 -14
  230. package/dist/lib/server-wake.js.map +1 -1
  231. package/dist/lib/session-refresh.d.ts +53 -0
  232. package/dist/lib/session-refresh.js +27 -1
  233. package/dist/lib/session-refresh.js.map +1 -1
  234. package/dist/rhf/fields.js +3 -3
  235. package/dist/rhf/fields.js.map +1 -1
  236. package/dist/shell/app-shell.d.ts +25 -1
  237. package/dist/shell/app-shell.js +3 -1
  238. package/dist/shell/app-shell.js.map +1 -1
  239. package/dist/shell/dev-menu.d.ts +3 -0
  240. package/dist/shell/dev-menu.js +4 -2
  241. package/dist/shell/dev-menu.js.map +1 -1
  242. package/dist/shell/held-changes-banner-labels.d.ts +23 -0
  243. package/dist/shell/held-changes-banner-labels.js +14 -0
  244. package/dist/shell/held-changes-banner-labels.js.map +1 -0
  245. package/dist/shell/held-changes-banner.d.ts +75 -0
  246. package/dist/shell/held-changes-banner.js +106 -0
  247. package/dist/shell/held-changes-banner.js.map +1 -0
  248. package/dist/shell/sync-status-indicator.d.ts +27 -12
  249. package/dist/shell/sync-status-indicator.js +13 -4
  250. package/dist/shell/sync-status-indicator.js.map +1 -1
  251. package/dist/shell/top-bar-parts-labels.d.ts +5 -0
  252. package/dist/shell/top-bar-parts-labels.js +3 -1
  253. package/dist/shell/top-bar-parts-labels.js.map +1 -1
  254. package/dist/shell.d.ts +2 -0
  255. package/dist/shell.js +3 -0
  256. package/dist/shell.js.map +1 -1
  257. package/dist/sync/engine.d.ts +11 -2
  258. package/dist/sync/engine.js +13 -5
  259. package/dist/sync/engine.js.map +1 -1
  260. package/dist/sync/hooks.d.ts +3 -2
  261. package/dist/sync/hooks.js +4 -2
  262. package/dist/sync/hooks.js.map +1 -1
  263. package/dist/testing/css-variables.generated.d.ts +2 -2
  264. package/dist/testing/css-variables.generated.js +1 -1
  265. package/dist/testing/css-variables.generated.js.map +1 -1
  266. package/dist/theme/chart-palette.d.ts +18 -0
  267. package/dist/theme/chart-palette.js +17 -1
  268. package/dist/theme/chart-palette.js.map +1 -1
  269. package/dist/theme/contrast-tokens.d.ts +3 -3
  270. package/dist/theme/contrast-tokens.js.map +1 -1
  271. package/dist/theme/contrast.d.ts +4 -4
  272. package/dist/theme/contrast.js.map +1 -1
  273. package/dist/tour/tour-overlay.js +2 -1
  274. package/dist/tour/tour-overlay.js.map +1 -1
  275. package/package.json +9 -12
  276. package/tokens.css +19 -54
  277. package/src/account/account-parts.ts +0 -47
  278. package/src/account/account-settings-labels.ts +0 -240
  279. package/src/account/account-settings.tsx +0 -698
  280. package/src/account/data-export-setting-labels.ts +0 -20
  281. package/src/account/data-export-setting.tsx +0 -200
  282. package/src/account/delete-account-setting-labels.ts +0 -33
  283. package/src/account/delete-account-setting.tsx +0 -342
  284. package/src/account/email-change-setting-labels.ts +0 -31
  285. package/src/account/email-change-setting.tsx +0 -443
  286. package/src/account/passkeys-setting.tsx +0 -445
  287. package/src/account/sessions-setting-labels.ts +0 -24
  288. package/src/account/sessions-setting.tsx +0 -283
  289. package/src/admin/admin-action-confirm-labels.ts +0 -19
  290. package/src/admin/admin-action-confirm.tsx +0 -509
  291. package/src/admin/admin-action-log-labels.ts +0 -83
  292. package/src/admin/admin-action-log.tsx +0 -464
  293. package/src/admin/admin-area-labels.ts +0 -114
  294. package/src/admin/admin-forbidden.tsx +0 -75
  295. package/src/admin/admin-overview.tsx +0 -258
  296. package/src/admin/admin-parts.ts +0 -68
  297. package/src/admin/admin-sections.tsx +0 -208
  298. package/src/admin/admin-tool-links.tsx +0 -90
  299. package/src/admin/invitations-panel-labels.ts +0 -31
  300. package/src/admin/invitations-panel.tsx +0 -516
  301. package/src/admin/mail-test-card-labels.ts +0 -19
  302. package/src/admin/mail-test-card.tsx +0 -189
  303. package/src/admin/plan-change-labels.ts +0 -5
  304. package/src/admin/plan-change.tsx +0 -474
  305. package/src/admin/reviewer-scope-editor-labels.ts +0 -16
  306. package/src/admin/reviewer-scope-editor.tsx +0 -224
  307. package/src/admin/role-select-labels.ts +0 -16
  308. package/src/admin/role-select.tsx +0 -282
  309. package/src/admin/transfer-ownership-dialog-labels.ts +0 -20
  310. package/src/admin/transfer-ownership-dialog.tsx +0 -162
  311. package/src/admin/user-roster-labels.ts +0 -17
  312. package/src/admin/user-roster.tsx +0 -559
  313. package/src/auth/accept-invitation-labels.ts +0 -21
  314. package/src/auth/accept-invitation.tsx +0 -210
  315. package/src/auth/auth-errors-labels.ts +0 -23
  316. package/src/auth/auth-errors.ts +0 -439
  317. package/src/auth/complete-name-dialog-labels.ts +0 -16
  318. package/src/auth/complete-name-dialog.tsx +0 -253
  319. package/src/auth/email-tag.ts +0 -75
  320. package/src/auth/forgot-password-form-labels.ts +0 -20
  321. package/src/auth/forgot-password-form.tsx +0 -221
  322. package/src/auth/form-rules.ts +0 -40
  323. package/src/auth/new-password-fields.tsx +0 -85
  324. package/src/auth/not-found-page-labels.ts +0 -12
  325. package/src/auth/not-found-page.tsx +0 -95
  326. package/src/auth/register-form-labels.ts +0 -31
  327. package/src/auth/register-form.tsx +0 -456
  328. package/src/auth/reset-password-form-labels.ts +0 -27
  329. package/src/auth/reset-password-form.tsx +0 -341
  330. package/src/auth/sign-in-form-labels.ts +0 -44
  331. package/src/auth/sign-in-form.tsx +0 -858
  332. package/src/auth/status-parts.tsx +0 -132
  333. package/src/auth/verify-email-labels.ts +0 -26
  334. package/src/auth/verify-email.tsx +0 -445
  335. package/src/billing/billing-banner.tsx +0 -258
  336. package/src/billing/billing-labels.ts +0 -381
  337. package/src/billing/billing-lock.ts +0 -108
  338. package/src/billing/billing-overview.ts +0 -157
  339. package/src/billing/billing-standing.ts +0 -80
  340. package/src/billing/cancel-request.ts +0 -97
  341. package/src/billing/cancel-subscription.tsx +0 -98
  342. package/src/billing/checkout-processing.ts +0 -394
  343. package/src/billing/checkout-return.ts +0 -90
  344. package/src/billing/pay-page.ts +0 -330
  345. package/src/billing/plan-card.tsx +0 -562
  346. package/src/billing/plan-change-labels.ts +0 -66
  347. package/src/billing/plan-limit-notice.tsx +0 -148
  348. package/src/billing/plan-limit-toast.tsx +0 -90
  349. package/src/billing/plan-limit.ts +0 -52
  350. package/src/billing/plan-price.ts +0 -98
  351. package/src/billing/plan-switch.tsx +0 -216
  352. package/src/billing/provider-page.ts +0 -84
  353. package/src/billing/subscription-actions.tsx +0 -247
  354. package/src/billing/subscription-status-chip.tsx +0 -95
  355. package/src/chart.ts +0 -103
  356. package/src/components/account-chips-labels.ts +0 -16
  357. package/src/components/account-chips.tsx +0 -474
  358. package/src/components/alert-banner.tsx +0 -670
  359. package/src/components/amount-input.tsx +0 -816
  360. package/src/components/appearance-labels.ts +0 -63
  361. package/src/components/authed-image-labels.ts +0 -11
  362. package/src/components/authed-image.tsx +0 -209
  363. package/src/components/autocomplete.tsx +0 -645
  364. package/src/components/breadcrumbs-labels.ts +0 -10
  365. package/src/components/breadcrumbs.tsx +0 -205
  366. package/src/components/bulk-action-bar-labels.ts +0 -11
  367. package/src/components/bulk-action-bar.tsx +0 -443
  368. package/src/components/button-group.tsx +0 -223
  369. package/src/components/button-look.ts +0 -256
  370. package/src/components/button.tsx +0 -339
  371. package/src/components/calculator.tsx +0 -341
  372. package/src/components/calendar-heatmap-labels.ts +0 -15
  373. package/src/components/calendar-heatmap.tsx +0 -600
  374. package/src/components/card.tsx +0 -377
  375. package/src/components/chart-edge.ts +0 -106
  376. package/src/components/chart-figure.tsx +0 -35
  377. package/src/components/chart-height.ts +0 -30
  378. package/src/components/chart-zoom-core.tsx +0 -627
  379. package/src/components/chart-zoom.tsx +0 -22
  380. package/src/components/chart.tsx +0 -554
  381. package/src/components/checkbox-group.tsx +0 -247
  382. package/src/components/checkbox.tsx +0 -346
  383. package/src/components/chip-input.tsx +0 -370
  384. package/src/components/chip-labels.ts +0 -13
  385. package/src/components/chip.tsx +0 -843
  386. package/src/components/choice-card.tsx +0 -544
  387. package/src/components/column-mapper-labels.ts +0 -38
  388. package/src/components/column-mapper.tsx +0 -655
  389. package/src/components/combobox-core.tsx +0 -1321
  390. package/src/components/combobox-suggestions.tsx +0 -131
  391. package/src/components/combobox.tsx +0 -716
  392. package/src/components/confirm-context.ts +0 -7
  393. package/src/components/confirm-dialog-labels.ts +0 -13
  394. package/src/components/confirm-dialog.tsx +0 -341
  395. package/src/components/copy-button-labels.ts +0 -13
  396. package/src/components/copy-button.tsx +0 -192
  397. package/src/components/country-select-labels.ts +0 -11
  398. package/src/components/country-select.tsx +0 -539
  399. package/src/components/currency-option-list.tsx +0 -188
  400. package/src/components/currency-select.tsx +0 -343
  401. package/src/components/danger-confirm-labels.ts +0 -20
  402. package/src/components/danger-confirm.tsx +0 -987
  403. package/src/components/data-table-cells.tsx +0 -118
  404. package/src/components/data-table-column-settings.tsx +0 -198
  405. package/src/components/data-table-filter-popover.tsx +0 -289
  406. package/src/components/data-table-filters.ts +0 -315
  407. package/src/components/data-table-fit.ts +0 -301
  408. package/src/components/data-table-groups.tsx +0 -288
  409. package/src/components/data-table-head.tsx +0 -280
  410. package/src/components/data-table-labels.ts +0 -198
  411. package/src/components/data-table-leading-row.tsx +0 -58
  412. package/src/components/data-table-mobile.tsx +0 -1117
  413. package/src/components/data-table-pagination.tsx +0 -202
  414. package/src/components/data-table-resize.ts +0 -188
  415. package/src/components/data-table-row-actions.tsx +0 -302
  416. package/src/components/data-table-row.tsx +0 -496
  417. package/src/components/data-table-selection.ts +0 -71
  418. package/src/components/data-table-shared.tsx +0 -287
  419. package/src/components/data-table-sort.ts +0 -163
  420. package/src/components/data-table-virtual.ts +0 -576
  421. package/src/components/data-table.tsx +0 -2598
  422. package/src/components/date-field.tsx +0 -684
  423. package/src/components/date-format-setting.tsx +0 -64
  424. package/src/components/date-picker.tsx +0 -404
  425. package/src/components/date-range-picker.tsx +0 -518
  426. package/src/components/description-list-labels.ts +0 -9
  427. package/src/components/description-list.tsx +0 -386
  428. package/src/components/dialog-frame-labels.ts +0 -7
  429. package/src/components/dialog-frame.tsx +0 -284
  430. package/src/components/disclosure.tsx +0 -476
  431. package/src/components/dropdown.tsx +0 -461
  432. package/src/components/empty-state.tsx +0 -136
  433. package/src/components/entity-combobox.tsx +0 -422
  434. package/src/components/error-boundary-labels.ts +0 -20
  435. package/src/components/error-boundary.tsx +0 -675
  436. package/src/components/facing-pair.ts +0 -93
  437. package/src/components/field-base-labels.ts +0 -20
  438. package/src/components/field-base.tsx +0 -656
  439. package/src/components/field-parts.tsx +0 -825
  440. package/src/components/field-strip.tsx +0 -129
  441. package/src/components/field.tsx +0 -206
  442. package/src/components/file-button.tsx +0 -295
  443. package/src/components/file-dropzone.tsx +0 -559
  444. package/src/components/floating-panel-labels.ts +0 -10
  445. package/src/components/floating-panel.tsx +0 -828
  446. package/src/components/focus-ring.ts +0 -16
  447. package/src/components/form-actions-labels.ts +0 -11
  448. package/src/components/form-actions.tsx +0 -578
  449. package/src/components/full-bleed-dialog.tsx +0 -294
  450. package/src/components/grouped-picker.tsx +0 -184
  451. package/src/components/help-popover.tsx +0 -117
  452. package/src/components/hover-menu.tsx +0 -343
  453. package/src/components/iban-input-labels.ts +0 -14
  454. package/src/components/iban-input.tsx +0 -236
  455. package/src/components/icon-button.tsx +0 -959
  456. package/src/components/icon-picker-labels.ts +0 -13
  457. package/src/components/icon-picker.tsx +0 -232
  458. package/src/components/image-grid-labels.ts +0 -11
  459. package/src/components/image-grid.tsx +0 -202
  460. package/src/components/inline-confirm.tsx +0 -116
  461. package/src/components/inline-edit-field-labels.ts +0 -11
  462. package/src/components/inline-edit-field.tsx +0 -552
  463. package/src/components/inline-entity-combobox.tsx +0 -849
  464. package/src/components/input.tsx +0 -394
  465. package/src/components/jump-calendar.tsx +0 -265
  466. package/src/components/language-select.tsx +0 -93
  467. package/src/components/legal-labels.ts +0 -105
  468. package/src/components/legal-page.tsx +0 -711
  469. package/src/components/legal.tsx +0 -668
  470. package/src/components/lightbox-labels.ts +0 -18
  471. package/src/components/lightbox.tsx +0 -399
  472. package/src/components/line-items-labels.ts +0 -14
  473. package/src/components/line-items.tsx +0 -602
  474. package/src/components/list-labels.ts +0 -12
  475. package/src/components/list.tsx +0 -870
  476. package/src/components/loading-state.tsx +0 -78
  477. package/src/components/measured-grid-labels.ts +0 -25
  478. package/src/components/measured-grid.tsx +0 -837
  479. package/src/components/menu-item.tsx +0 -241
  480. package/src/components/mini-calendar-labels.ts +0 -17
  481. package/src/components/mini-calendar.tsx +0 -792
  482. package/src/components/modal.tsx +0 -534
  483. package/src/components/money-draft.ts +0 -83
  484. package/src/components/money-field.tsx +0 -76
  485. package/src/components/month-grid.tsx +0 -229
  486. package/src/components/month-picker-labels.ts +0 -22
  487. package/src/components/month-picker.tsx +0 -1087
  488. package/src/components/multi-entity-combobox.tsx +0 -369
  489. package/src/components/multi-select.tsx +0 -376
  490. package/src/components/nav-pills.tsx +0 -198
  491. package/src/components/number-field.tsx +0 -327
  492. package/src/components/number-input.tsx +0 -559
  493. package/src/components/numeric-field.ts +0 -169
  494. package/src/components/numpad-sheet.tsx +0 -285
  495. package/src/components/one-time-code-input.tsx +0 -270
  496. package/src/components/page-contents-labels.ts +0 -9
  497. package/src/components/page-contents.tsx +0 -282
  498. package/src/components/page-header-context.ts +0 -8
  499. package/src/components/page-header.tsx +0 -298
  500. package/src/components/password-strength-labels.ts +0 -22
  501. package/src/components/password-strength.tsx +0 -241
  502. package/src/components/phone-input-labels.ts +0 -10
  503. package/src/components/phone-input.tsx +0 -282
  504. package/src/components/picker-sheet.tsx +0 -330
  505. package/src/components/pie-chart-labels.ts +0 -40
  506. package/src/components/pie-chart.tsx +0 -480
  507. package/src/components/popover-labels.ts +0 -14
  508. package/src/components/popover.tsx +0 -268
  509. package/src/components/progress-bar-labels.ts +0 -10
  510. package/src/components/progress-bar.tsx +0 -479
  511. package/src/components/qr-code.tsx +0 -76
  512. package/src/components/reauth-dialog-labels.ts +0 -13
  513. package/src/components/reauth-dialog.tsx +0 -265
  514. package/src/components/row-actions-labels.ts +0 -12
  515. package/src/components/row-actions.tsx +0 -795
  516. package/src/components/scroll-area.tsx +0 -123
  517. package/src/components/search-field.tsx +0 -192
  518. package/src/components/select.tsx +0 -294
  519. package/src/components/separator.tsx +0 -33
  520. package/src/components/series-chart-axes.ts +0 -342
  521. package/src/components/series-chart-budget.ts +0 -150
  522. package/src/components/series-chart-labels.ts +0 -33
  523. package/src/components/series-chart-thin.ts +0 -180
  524. package/src/components/series-chart-ticks.ts +0 -194
  525. package/src/components/series-chart.tsx +0 -1906
  526. package/src/components/server-wake-labels.ts +0 -11
  527. package/src/components/server-wake.tsx +0 -129
  528. package/src/components/settings-fields.tsx +0 -237
  529. package/src/components/share-card-labels.ts +0 -30
  530. package/src/components/share-card.tsx +0 -675
  531. package/src/components/signature-pad-labels.ts +0 -24
  532. package/src/components/signature-pad.tsx +0 -747
  533. package/src/components/signed-amount-labels.ts +0 -10
  534. package/src/components/signed-amount.tsx +0 -336
  535. package/src/components/skeleton.tsx +0 -80
  536. package/src/components/slider.tsx +0 -338
  537. package/src/components/sparkline-labels.ts +0 -14
  538. package/src/components/sparkline.tsx +0 -322
  539. package/src/components/spinner.tsx +0 -81
  540. package/src/components/stat-tile-labels.ts +0 -15
  541. package/src/components/stat-tile.tsx +0 -754
  542. package/src/components/status-dot.tsx +0 -170
  543. package/src/components/swatch-picker-labels.ts +0 -10
  544. package/src/components/swatch-picker.tsx +0 -283
  545. package/src/components/swipeable-row.tsx +0 -386
  546. package/src/components/switch.tsx +0 -273
  547. package/src/components/table-skeleton.tsx +0 -136
  548. package/src/components/table.tsx +0 -647
  549. package/src/components/tabs-labels.ts +0 -13
  550. package/src/components/tabs.tsx +0 -693
  551. package/src/components/text-link.tsx +0 -359
  552. package/src/components/text.tsx +0 -150
  553. package/src/components/textarea.tsx +0 -330
  554. package/src/components/tile-radio.tsx +0 -332
  555. package/src/components/time-input.tsx +0 -121
  556. package/src/components/toast-labels.ts +0 -12
  557. package/src/components/toast.tsx +0 -519
  558. package/src/components/toggle-group.tsx +0 -752
  559. package/src/components/toggle-legend.tsx +0 -394
  560. package/src/components/tooltip.tsx +0 -1149
  561. package/src/components/translation-review-editor.tsx +0 -290
  562. package/src/components/translation-review-labels.ts +0 -181
  563. package/src/components/translation-review-parts.tsx +0 -272
  564. package/src/components/translation-review.tsx +0 -1240
  565. package/src/components/tree-view.tsx +0 -589
  566. package/src/components/treemap-labels.ts +0 -47
  567. package/src/components/treemap-layout.ts +0 -210
  568. package/src/components/treemap.tsx +0 -1184
  569. package/src/components/trigger-aria.ts +0 -44
  570. package/src/components/use-anchor-dir.ts +0 -20
  571. package/src/components/use-mobile-reveal.ts +0 -62
  572. package/src/components/use-table-state.ts +0 -753
  573. package/src/components/user-avatar.tsx +0 -116
  574. package/src/components/wizard-stepper.tsx +0 -42
  575. package/src/components/write-lock-labels.ts +0 -10
  576. package/src/components/write-lock.tsx +0 -253
  577. package/src/currencies.ts +0 -90
  578. package/src/data-table.ts +0 -42
  579. package/src/demo/demo-banner.tsx +0 -153
  580. package/src/demo/demo-countdown.ts +0 -136
  581. package/src/demo/demo-ended.tsx +0 -90
  582. package/src/demo/demo-labels.ts +0 -78
  583. package/src/demo/demo-session.ts +0 -32
  584. package/src/demo/demo-start.tsx +0 -156
  585. package/src/eslint/index.ts +0 -161
  586. package/src/eslint/role-utilities.generated.ts +0 -146
  587. package/src/eslint/role-utilities.ts +0 -233
  588. package/src/feedback/feedback-attachment-download.tsx +0 -77
  589. package/src/feedback/feedback-attachment-labels.ts +0 -37
  590. package/src/feedback/feedback-attachment.tsx +0 -1239
  591. package/src/feedback/feedback-capture.ts +0 -287
  592. package/src/feedback/feedback-comment-thread.tsx +0 -353
  593. package/src/feedback/feedback-context-labels.ts +0 -11
  594. package/src/feedback/feedback-context.tsx +0 -245
  595. package/src/feedback/feedback-crash.ts +0 -547
  596. package/src/feedback/feedback-diagnostics.tsx +0 -41
  597. package/src/feedback/feedback-dialog-labels.ts +0 -29
  598. package/src/feedback/feedback-dialog.tsx +0 -452
  599. package/src/feedback/feedback-entry-file.tsx +0 -150
  600. package/src/feedback/feedback-inbox.tsx +0 -552
  601. package/src/feedback/feedback-labels.ts +0 -144
  602. package/src/feedback/feedback-menu-labels.ts +0 -12
  603. package/src/feedback/feedback-menu.tsx +0 -177
  604. package/src/feedback/feedback-mutation.ts +0 -20
  605. package/src/feedback/feedback-page-link.ts +0 -90
  606. package/src/feedback/feedback-public-labels.ts +0 -81
  607. package/src/feedback/feedback-public-list.tsx +0 -524
  608. package/src/feedback/feedback-public-switch.tsx +0 -102
  609. package/src/feedback/feedback-public-types.ts +0 -101
  610. package/src/feedback/feedback-record.ts +0 -428
  611. package/src/feedback/feedback-replies-context.ts +0 -9
  612. package/src/feedback/feedback-replies.tsx +0 -343
  613. package/src/feedback/feedback-rework-entry-chip.tsx +0 -18
  614. package/src/feedback/feedback-row-detail-labels.ts +0 -31
  615. package/src/feedback/feedback-row-detail.tsx +0 -871
  616. package/src/feedback/feedback-status-undo.ts +0 -109
  617. package/src/feedback/feedback-submit-dialog.tsx +0 -131
  618. package/src/feedback/feedback-submit.tsx +0 -270
  619. package/src/feedback/feedback-swipe.tsx +0 -192
  620. package/src/feedback/feedback-table-labels.ts +0 -27
  621. package/src/feedback/feedback-table.tsx +0 -912
  622. package/src/feedback/feedback-thread-labels.ts +0 -22
  623. package/src/feedback/feedback-thread-parts-labels.ts +0 -41
  624. package/src/feedback/feedback-thread.tsx +0 -905
  625. package/src/feedback/feedback-vocabulary.ts +0 -263
  626. package/src/feedback/feedback-vote-button.tsx +0 -124
  627. package/src/feedback.ts +0 -116
  628. package/src/hooks/use-anchored-panel.ts +0 -396
  629. package/src/hooks/use-anchored-rect.ts +0 -77
  630. package/src/hooks/use-announce.ts +0 -85
  631. package/src/hooks/use-authed-src.ts +0 -167
  632. package/src/hooks/use-body-scroll-lock.ts +0 -119
  633. package/src/hooks/use-breakpoint.ts +0 -133
  634. package/src/hooks/use-close-transition.ts +0 -107
  635. package/src/hooks/use-copy-to-clipboard.ts +0 -122
  636. package/src/hooks/use-debounce.ts +0 -114
  637. package/src/hooks/use-dismiss.ts +0 -371
  638. package/src/hooks/use-document-title.ts +0 -33
  639. package/src/hooks/use-file-drop.ts +0 -121
  640. package/src/hooks/use-file-picker-labels.ts +0 -28
  641. package/src/hooks/use-file-picker.tsx +0 -359
  642. package/src/hooks/use-focus-trap.ts +0 -199
  643. package/src/hooks/use-hotkey.ts +0 -212
  644. package/src/hooks/use-large-text.ts +0 -41
  645. package/src/hooks/use-long-press.ts +0 -140
  646. package/src/hooks/use-media-query.ts +0 -39
  647. package/src/hooks/use-mounted.ts +0 -39
  648. package/src/hooks/use-noindex.ts +0 -37
  649. package/src/hooks/use-overlay-history.ts +0 -714
  650. package/src/hooks/use-row-swipe.ts +0 -207
  651. package/src/hooks/use-search-param-state.ts +0 -434
  652. package/src/hooks/use-windowed-rows.ts +0 -225
  653. package/src/i18n/defaults.ts +0 -267
  654. package/src/i18n/german.ts +0 -2059
  655. package/src/i18n/kit-labels.tsx +0 -1003
  656. package/src/i18n/languages.ts +0 -349
  657. package/src/i18n/locales/de-CH.ts +0 -24
  658. package/src/i18n/locales/en.ts +0 -267
  659. package/src/i18n/locales/es.ts +0 -1999
  660. package/src/i18n/locales/fr.ts +0 -2037
  661. package/src/i18n/locales/hu.ts +0 -2004
  662. package/src/i18n/locales/it.ts +0 -2014
  663. package/src/i18n/locales/zh.ts +0 -1912
  664. package/src/i18n/plurals.ts +0 -86
  665. package/src/i18n/review.ts +0 -475
  666. package/src/i18n/shared-labels.ts +0 -138
  667. package/src/i18n/swiss.ts +0 -29
  668. package/src/index.ts +0 -1191
  669. package/src/landing/access.ts +0 -93
  670. package/src/landing/landing-actions.tsx +0 -97
  671. package/src/landing/landing-labels.ts +0 -59
  672. package/src/landing/landing-sections.tsx +0 -341
  673. package/src/landing/page-seo.ts +0 -261
  674. package/src/landing/public-header.tsx +0 -121
  675. package/src/landing/public-page.tsx +0 -106
  676. package/src/landing/routing.tsx +0 -225
  677. package/src/lib/broadcast.ts +0 -52
  678. package/src/lib/calc.ts +0 -323
  679. package/src/lib/chip-edge-snap.ts +0 -212
  680. package/src/lib/clipboard-minus.ts +0 -107
  681. package/src/lib/clipping.ts +0 -34
  682. package/src/lib/cn.ts +0 -28
  683. package/src/lib/column-mapping.ts +0 -234
  684. package/src/lib/countries.ts +0 -91
  685. package/src/lib/data-attributes.ts +0 -14
  686. package/src/lib/date-format.ts +0 -227
  687. package/src/lib/dates.ts +0 -288
  688. package/src/lib/day-format.ts +0 -96
  689. package/src/lib/decimal-marks.ts +0 -108
  690. package/src/lib/describe-failure.ts +0 -18
  691. package/src/lib/device-settings.ts +0 -147
  692. package/src/lib/direction.ts +0 -74
  693. package/src/lib/document-navigation.ts +0 -17
  694. package/src/lib/document-title.ts +0 -41
  695. package/src/lib/download.ts +0 -172
  696. package/src/lib/float-clearance.ts +0 -70
  697. package/src/lib/floating-stack.ts +0 -70
  698. package/src/lib/focus-left.ts +0 -156
  699. package/src/lib/format.ts +0 -585
  700. package/src/lib/http-status.ts +0 -38
  701. package/src/lib/iban.ts +0 -251
  702. package/src/lib/ime.ts +0 -24
  703. package/src/lib/intl-cache.ts +0 -27
  704. package/src/lib/iso-day.ts +0 -13
  705. package/src/lib/lazy-with-fallback.ts +0 -82
  706. package/src/lib/logger.ts +0 -69
  707. package/src/lib/minus.ts +0 -50
  708. package/src/lib/path-pattern.ts +0 -55
  709. package/src/lib/person-name.ts +0 -155
  710. package/src/lib/phone.ts +0 -208
  711. package/src/lib/plain-text.ts +0 -22
  712. package/src/lib/presence.ts +0 -18
  713. package/src/lib/qr-encode.ts +0 -444
  714. package/src/lib/quiet-focus.ts +0 -32
  715. package/src/lib/reduced-motion.ts +0 -22
  716. package/src/lib/refs.ts +0 -22
  717. package/src/lib/round.ts +0 -43
  718. package/src/lib/safe-storage.ts +0 -119
  719. package/src/lib/server-wake.ts +0 -315
  720. package/src/lib/session-refresh.ts +0 -472
  721. package/src/lib/share-format.ts +0 -18
  722. package/src/lib/status-tone.ts +0 -43
  723. package/src/lib/strip-fade.ts +0 -287
  724. package/src/lib/table-text.ts +0 -554
  725. package/src/lib/text-case.ts +0 -19
  726. package/src/lib/text-match.ts +0 -169
  727. package/src/lib/thenable.ts +0 -19
  728. package/src/lib/translation-review.ts +0 -769
  729. package/src/notifications/device-zone-report.ts +0 -67
  730. package/src/notifications/feedback-notification-types-labels.ts +0 -33
  731. package/src/notifications/feedback-notification-types.ts +0 -71
  732. package/src/notifications/notification-bell.tsx +0 -119
  733. package/src/notifications/notification-inbox.tsx +0 -309
  734. package/src/notifications/notification-parts.tsx +0 -81
  735. package/src/notifications/notification-types-setting.tsx +0 -406
  736. package/src/notifications/notification-types.ts +0 -89
  737. package/src/notifications/notifications-labels.ts +0 -287
  738. package/src/notifications/push-device-setting.tsx +0 -230
  739. package/src/notifications/push-devices-setting.tsx +0 -374
  740. package/src/notifications/push-worker.ts +0 -168
  741. package/src/notifications/quiet-hours-setting.tsx +0 -238
  742. package/src/notifications/unsubscribe-panel.tsx +0 -200
  743. package/src/notifications/use-push-device.ts +0 -448
  744. package/src/offline/local-first.ts +0 -100
  745. package/src/offline/pwa-update-prompt-labels.ts +0 -9
  746. package/src/offline/pwa-update-prompt.tsx +0 -78
  747. package/src/offline/query-persistence.ts +0 -391
  748. package/src/offline/service-worker-updates.ts +0 -81
  749. package/src/offline/shared-computer-labels.ts +0 -8
  750. package/src/offline/shared-computer.tsx +0 -87
  751. package/src/offline/sign-out-pending-dialog-labels.ts +0 -21
  752. package/src/offline/sign-out-pending-dialog.tsx +0 -135
  753. package/src/offline.ts +0 -37
  754. package/src/push-worker.ts +0 -25
  755. package/src/rhf/fields.tsx +0 -2187
  756. package/src/rhf/form-core.tsx +0 -324
  757. package/src/rhf/form.tsx +0 -12
  758. package/src/rhf/line-items.tsx +0 -135
  759. package/src/rhf/use-rhf-wizard-step.ts +0 -104
  760. package/src/rhf.ts +0 -21
  761. package/src/search/command-palette-labels.ts +0 -16
  762. package/src/search/command-palette.tsx +0 -624
  763. package/src/search/global-search-labels.ts +0 -13
  764. package/src/search/global-search.tsx +0 -660
  765. package/src/search/search-index.ts +0 -283
  766. package/src/search/use-command-key.ts +0 -23
  767. package/src/search.ts +0 -14
  768. package/src/settings/device-reset-setting-labels.ts +0 -20
  769. package/src/settings/device-reset-setting.tsx +0 -116
  770. package/src/settings/settings-card-classes.ts +0 -11
  771. package/src/settings/settings-catalogue.ts +0 -150
  772. package/src/settings/settings-context.ts +0 -33
  773. package/src/settings/settings-heading.tsx +0 -67
  774. package/src/settings/settings-labels.ts +0 -87
  775. package/src/settings/settings-layout.tsx +0 -471
  776. package/src/settings/settings-section.tsx +0 -108
  777. package/src/settings/use-account-appearance.ts +0 -148
  778. package/src/settings/use-account-language.ts +0 -146
  779. package/src/settings/use-settings-focus.ts +0 -128
  780. package/src/settings/use-settings-route.ts +0 -258
  781. package/src/shell/account-menu-language.tsx +0 -130
  782. package/src/shell/account-menu-text-size.tsx +0 -80
  783. package/src/shell/admin-menu.tsx +0 -183
  784. package/src/shell/app-shell-labels.ts +0 -11
  785. package/src/shell/app-shell.tsx +0 -1560
  786. package/src/shell/auth-layout.tsx +0 -186
  787. package/src/shell/company-switcher-labels.ts +0 -13
  788. package/src/shell/company-switcher.tsx +0 -136
  789. package/src/shell/dev-menu.tsx +0 -257
  790. package/src/shell/fill-height.tsx +0 -45
  791. package/src/shell/language-code.ts +0 -5
  792. package/src/shell/option-switcher-menu.tsx +0 -84
  793. package/src/shell/sync-status-indicator.tsx +0 -303
  794. package/src/shell/top-bar-actions.tsx +0 -87
  795. package/src/shell/top-bar-brand.tsx +0 -78
  796. package/src/shell/top-bar-parts-labels.ts +0 -148
  797. package/src/shell/top-bar.tsx +0 -40
  798. package/src/shell/topbar-action-menu.tsx +0 -567
  799. package/src/shell/topbar-controls.tsx +0 -269
  800. package/src/shell/tour-menu.tsx +0 -187
  801. package/src/shell.ts +0 -108
  802. package/src/sync/db.ts +0 -129
  803. package/src/sync/engine.ts +0 -1011
  804. package/src/sync/hooks.ts +0 -98
  805. package/src/sync/testing.ts +0 -73
  806. package/src/sync/wire.ts +0 -61
  807. package/src/sync.ts +0 -37
  808. package/src/table-text.ts +0 -8
  809. package/src/testing/css-variables.generated.ts +0 -112
  810. package/src/testing/css-variables.ts +0 -189
  811. package/src/testing/index.ts +0 -29
  812. package/src/testing/react.ts +0 -58
  813. package/src/testing/tour.ts +0 -41
  814. package/src/testing/viewport.ts +0 -357
  815. package/src/theme/chart-palette.ts +0 -232
  816. package/src/theme/color.ts +0 -272
  817. package/src/theme/contrast-tokens.ts +0 -268
  818. package/src/theme/contrast.ts +0 -250
  819. package/src/theme/palette-derive.ts +0 -825
  820. package/src/theme/palette-presets.ts +0 -544
  821. package/src/theme/palette-store.ts +0 -108
  822. package/src/theme/text-size.ts +0 -289
  823. package/src/theme/theme-store.ts +0 -157
  824. package/src/tour/tour-catalogue-labels.ts +0 -75
  825. package/src/tour/tour-catalogue.tsx +0 -335
  826. package/src/tour/tour-dock.ts +0 -134
  827. package/src/tour/tour-engine.ts +0 -37
  828. package/src/tour/tour-gates.ts +0 -218
  829. package/src/tour/tour-guide-button.tsx +0 -64
  830. package/src/tour/tour-guide-labels.ts +0 -15
  831. package/src/tour/tour-info.ts +0 -144
  832. package/src/tour/tour-labels.ts +0 -23
  833. package/src/tour/tour-overlay.tsx +0 -1170
  834. package/src/tour/tour.tsx +0 -750
  835. package/src/tour/use-tour-progress.ts +0 -671
  836. package/src/tour/use-tour-url-sync.ts +0 -266
  837. package/src/tour.ts +0 -21
  838. package/src/vite-env.d.ts +0 -23
  839. package/src/wizard/stepper-nav.tsx +0 -360
  840. package/src/wizard/types.ts +0 -275
  841. package/src/wizard/use-wizard.ts +0 -560
  842. package/src/wizard/validation.ts +0 -39
  843. package/src/wizard/wizard-context.tsx +0 -74
  844. package/src/wizard/wizard-labels.ts +0 -29
  845. package/src/wizard/wizard-step.tsx +0 -76
  846. package/src/wizard/wizard-summary.tsx +0 -84
  847. package/src/wizard.ts +0 -15
@@ -4,7 +4,7 @@ import { useId, useLayoutEffect, useRef } from "react";
4
4
  import { X } from "lucide-react";
5
5
  import { cn } from "../lib/cn.js";
6
6
  import { claimEscape } from "../hooks/use-dismiss.js";
7
- import { firstTabStop } from "../lib/focus-left.js";
7
+ import { firstTabStop, returnFocus } from "../lib/focus-left.js";
8
8
  import { Tooltip } from "./tooltip.js";
9
9
  import { isTableOwnColumn } from "./data-table-row-actions.js";
10
10
  import { columnLabel } from "./data-table-shared.js";
@@ -32,8 +32,8 @@ function ColumnSettingsPanel({
32
32
  (drawer.querySelector('input[type="checkbox"]') ?? firstTabStop(drawer, { includeSelf: false }))?.focus();
33
33
  }, [showSettings]);
34
34
  const close = () => {
35
+ returnFocus({ opener: columnsRail.current, closing: drawerRef.current });
35
36
  setShowSettings(false);
36
- columnsRail.current?.focus();
37
37
  };
38
38
  return /* @__PURE__ */ jsxs(Fragment, { children: [
39
39
  /* @__PURE__ */ jsx(Tooltip, { label: columnsCountLabel, portal: true, children: /* @__PURE__ */ jsx(
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/data-table-column-settings.tsx"],"sourcesContent":["import { useId, useLayoutEffect, useRef } from \"react\";\nimport type { Dispatch, SetStateAction } from \"react\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { claimEscape } from \"../hooks/use-dismiss\";\nimport { firstTabStop } from \"../lib/focus-left\";\nimport { Tooltip } from \"./tooltip\";\nimport type { DataTableLabels } from \"./data-table-labels\";\nimport { isTableOwnColumn } from \"./data-table-row-actions\";\nimport { columnLabel } from \"./data-table-shared\";\nimport type { DataTableColumn } from \"./data-table\";\n\n// DataTable's column settings on a wide screen: the vertical \"Columns (n/m)\" rail and\n// the drawer it opens, with \"Auto-size\" and a show/hide box per column. Moved out of\n// data-table.tsx whole (refactor audit 2026-10, MOD-3 step 5).\n\n/** The \"Columns\" rail and its drawer (`columnSettings`). */\nexport function ColumnSettingsPanel<T>({\n columns,\n hiddenCols,\n setHiddenCols,\n autoHidden,\n keepColumn,\n showSettings,\n setShowSettings,\n columnsCountLabel,\n labels,\n autoSizeAll,\n}: {\n /** Every column, hidden ones included; the actions column is left out here. */\n columns: readonly DataTableColumn<T>[];\n hiddenCols: Set<string>;\n setHiddenCols: Dispatch<SetStateAction<Set<string>>>;\n /** The columns the table's width leaves out (`fitPriority`, 0.48): unticked, and\n * marked \"hidden for width\". */\n autoHidden: Set<string>;\n /** A tick keeps a column in whatever the width; an untick drops that (data-table-fit.ts). */\n keepColumn: (key: string, on: boolean) => void;\n showSettings: boolean;\n setShowSettings: (open: boolean) => void;\n /** \"Columns (n/m)\", the rail's text and name. */\n columnsCountLabel: string;\n labels: DataTableLabels;\n autoSizeAll: () => void;\n}) {\n // The \"Columns\" rail button — where the drawer's X hands focus back (BUG-7a).\n const columnsRail = useRef<HTMLButtonElement | null>(null);\n const drawerRef = useRef<HTMLDivElement | null>(null);\n const drawerId = useId();\n // The opening half (refactor audit 2026-10-30, DSP-13). Opened from the rail, the focus\n // goes into the drawer: the rail it was on turns zero wide and leaves the tab order in\n // the same render, and the focus sat in a control nobody could see. To the first column\n // box — what the drawer is opened for — or, with none, its first control. Only when the\n // rail opened it: a drawer that starts open (its state is the table's) takes nothing.\n const focusOnOpen = useRef(false);\n useLayoutEffect(() => {\n if (!showSettings || !focusOnOpen.current) return;\n focusOnOpen.current = false;\n const drawer = drawerRef.current;\n if (!drawer) return;\n (\n drawer.querySelector<HTMLElement>('input[type=\"checkbox\"]') ?? firstTabStop(drawer, { includeSelf: false })\n )?.focus();\n }, [showSettings]);\n const close = () => {\n setShowSettings(false);\n // Back to the rail that opened it: the drawer is about to go inert, and focus would\n // fall to <body> with it (BUG-7a).\n columnsRail.current?.focus();\n };\n return (\n <>\n <Tooltip label={columnsCountLabel} portal>\n <button\n ref={columnsRail}\n type=\"button\"\n onClick={() => {\n focusOnOpen.current = true;\n setShowSettings(true);\n }}\n aria-label={columnsCountLabel}\n // A disclosure: it says whether the drawer is open, and never hides itself from\n // a screen reader — `aria-hidden` on it while it held the focus left the reader\n // with nothing to say (DSP-13). Zero wide and out of the tab order while open.\n aria-expanded={showSettings}\n aria-controls={drawerId}\n tabIndex={showSettings ? -1 : 0}\n className={cn(\n \"group flex shrink-0 items-start justify-center overflow-hidden pt-3 transition-[width] duration-200 ease-out\",\n \"border-s border-subtle\",\n \"hover:bg-hover\",\n showSettings ? \"w-0 border-s-0\" : \"w-8 cursor-pointer\",\n )}\n >\n <span\n className=\"whitespace-nowrap text-xs font-medium tracking-wide text-muted group-hover:text-secondary\"\n style={{ writingMode: \"vertical-rl\", transform: \"rotate(180deg)\" }}\n >\n {columnsCountLabel}\n </span>\n </button>\n </Tooltip>\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- Escape\n for whatever control in the drawer holds the focus; the group itself is no control. */}\n <div\n ref={drawerRef}\n id={drawerId}\n // Named by its own heading's words, so a reader entering it hears \"Columns (4/9),\n // group\" before the first box (DSP-13).\n role=\"group\"\n aria-label={columnsCountLabel}\n // Closed, the drawer is only `w-0`: without `inert` its X, Auto-size and one\n // checkbox per column stayed tab stops and in the accessibility tree, and Tab\n // after the last cell walked into controls nobody could see (BUG-7a).\n inert={!showSettings || undefined}\n // Escape closes it onto the rail, as its X does. Claimed, not handed to the Escape\n // stack: inside a dialog the drawer is what the key closes, not the dialog.\n onKeyDown={(e) => {\n if (e.key !== \"Escape\" || !showSettings) return;\n claimEscape(e);\n close();\n }}\n className={cn(\n \"shrink-0 overflow-hidden transition-[width] duration-200 ease-out\",\n showSettings ? \"w-56\" : \"w-0\",\n )}\n >\n <div className=\"flex w-56 flex-col border-s border-subtle p-2\">\n <div className=\"mb-2 flex items-center justify-between gap-1\">\n <div className=\"text-xs font-medium uppercase tracking-wide text-muted\">{columnsCountLabel}</div>\n <Tooltip label={labels.close} portal>\n <button\n type=\"button\"\n onClick={close}\n aria-label={labels.close}\n className=\"rounded p-0.5 text-placeholder hover:bg-hover hover:text-secondary\"\n >\n <X className=\"size-4\" />\n </button>\n </Tooltip>\n </div>\n <button\n type=\"button\"\n onClick={autoSizeAll}\n className=\"mb-2 rounded border border-subtle px-2 py-1 text-xs font-medium text-secondary hover:bg-hover\"\n >\n {labels.autoSize}\n </button>\n <div className=\"flex flex-col gap-0.5\">\n {columns.map((col) => {\n if (isTableOwnColumn(col.key)) return null;\n // Ticked = drawn: a column left out for width is unticked, so the boxes\n // and \"Columns (8/10)\" say the same (keksdose live #451).\n const forWidth = !hiddenCols.has(col.key) && autoHidden.has(col.key);\n const checked = !hiddenCols.has(col.key) && !forWidth;\n const headerLabel = columnLabel(col);\n return (\n <label\n key={col.key}\n className=\"inline-flex cursor-pointer items-center gap-1.5 rounded px-1 py-0.5 text-xs hover:bg-hover\"\n >\n <input\n type=\"checkbox\"\n className=\"size-3.5 shrink-0\"\n checked={checked}\n onChange={(e) => {\n keepColumn(col.key, e.target.checked);\n setHiddenCols((s) => {\n const next = new Set(s);\n if (e.target.checked) next.delete(col.key);\n else next.add(col.key);\n return next;\n });\n }}\n />\n {/* The panel is `w-56`: a long column name wraps from Large up rather\n than reading \"Accoun…\" beside its box (text size §10.17, round\n 0.34 T1). */}\n {forWidth ? (\n // Under the name, as part of the box's name: \"Email, hidden for width\".\n <span className=\"flex min-w-0 flex-col\">\n <span className=\"truncate-until-large\">{headerLabel}</span>\n <span className=\"text-micro text-muted\" data-hidden-for-width=\"\">\n {labels.hiddenForWidth}\n </span>\n </span>\n ) : (\n <span className=\"min-w-0 truncate-until-large\">{headerLabel}</span>\n )}\n </label>\n );\n })}\n </div>\n </div>\n </div>\n </>\n );\n}\n"],"mappings":";AAuEI,mBAuBM,KAkCA,YAzDN;AAvEJ,SAAS,OAAO,iBAAiB,cAAc;AAE/C,SAAS,SAAS;AAClB,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAC7B,SAAS,eAAe;AAExB,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAQrB,SAAS,oBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAgBG;AAED,QAAM,cAAc,OAAiC,IAAI;AACzD,QAAM,YAAY,OAA8B,IAAI;AACpD,QAAM,WAAW,MAAM;AAMvB,QAAM,cAAc,OAAO,KAAK;AAChC,kBAAgB,MAAM;AACpB,QAAI,CAAC,gBAAgB,CAAC,YAAY,QAAS;AAC3C,gBAAY,UAAU;AACtB,UAAM,SAAS,UAAU;AACzB,QAAI,CAAC,OAAQ;AACb,KACE,OAAO,cAA2B,wBAAwB,KAAK,aAAa,QAAQ,EAAE,aAAa,MAAM,CAAC,IACzG,MAAM;AAAA,EACX,GAAG,CAAC,YAAY,CAAC;AACjB,QAAM,QAAQ,MAAM;AAClB,oBAAgB,KAAK;AAGrB,gBAAY,SAAS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,cACL,SAAS;AAAA,cACT,WAAU;AAAA,cAET,iBAAO;AAAA;AAAA,UACV;AAAA,UACA,oBAAC,SAAI,WAAU,yBACZ,kBAAQ,IAAI,CAAC,QAAQ;AACpB,gBAAI,iBAAiB,IAAI,GAAG,EAAG,QAAO;AAGtC,kBAAM,WAAW,CAAC,WAAW,IAAI,IAAI,GAAG,KAAK,WAAW,IAAI,IAAI,GAAG;AACnE,kBAAM,UAAU,CAAC,WAAW,IAAI,IAAI,GAAG,KAAK,CAAC;AAC7C,kBAAM,cAAc,YAAY,GAAG;AACnC,mBACE;AAAA,cAAC;AAAA;AAAA,gBAEC,WAAU;AAAA,gBAEV;AAAA;AAAA,oBAAC;AAAA;AAAA,sBACC,MAAK;AAAA,sBACL,WAAU;AAAA,sBACV;AAAA,sBACA,UAAU,CAAC,MAAM;AACf,mCAAW,IAAI,KAAK,EAAE,OAAO,OAAO;AACpC,sCAAc,CAAC,MAAM;AACnB,gCAAM,OAAO,IAAI,IAAI,CAAC;AACtB,8BAAI,EAAE,OAAO,QAAS,MAAK,OAAO,IAAI,GAAG;AAAA,8BACpC,MAAK,IAAI,IAAI,GAAG;AACrB,iCAAO;AAAA,wBACT,CAAC;AAAA,sBACH;AAAA;AAAA,kBACF;AAAA,kBAIC;AAAA;AAAA,oBAEC,qBAAC,UAAK,WAAU,yBACd;AAAA,0CAAC,UAAK,WAAU,wBAAwB,uBAAY;AAAA,sBACpD,oBAAC,UAAK,WAAU,yBAAwB,yBAAsB,IAC3D,iBAAO,gBACV;AAAA,uBACF;AAAA,sBAEA,oBAAC,UAAK,WAAU,gCAAgC,uBAAY;AAAA;AAAA;AAAA,cA7BzD,IAAI;AAAA,YA+BX;AAAA,UAEJ,CAAC,GACH;AAAA,WACF;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/data-table-column-settings.tsx"],"sourcesContent":["import { useId, useLayoutEffect, useRef } from \"react\";\nimport type { Dispatch, SetStateAction } from \"react\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { claimEscape } from \"../hooks/use-dismiss\";\nimport { firstTabStop, returnFocus } from \"../lib/focus-left\";\nimport { Tooltip } from \"./tooltip\";\nimport type { DataTableLabels } from \"./data-table-labels\";\nimport { isTableOwnColumn } from \"./data-table-row-actions\";\nimport { columnLabel } from \"./data-table-shared\";\nimport type { DataTableColumn } from \"./data-table\";\n\n// DataTable's column settings on a wide screen: the vertical \"Columns (n/m)\" rail and\n// the drawer it opens, with \"Auto-size\" and a show/hide box per column. Moved out of\n// data-table.tsx whole (refactor audit 2026-10, MOD-3 step 5).\n\n/** The \"Columns\" rail and its drawer (`columnSettings`). */\nexport function ColumnSettingsPanel<T>({\n columns,\n hiddenCols,\n setHiddenCols,\n autoHidden,\n keepColumn,\n showSettings,\n setShowSettings,\n columnsCountLabel,\n labels,\n autoSizeAll,\n}: {\n /** Every column, hidden ones included; the actions column is left out here. */\n columns: readonly DataTableColumn<T>[];\n hiddenCols: Set<string>;\n setHiddenCols: Dispatch<SetStateAction<Set<string>>>;\n /** The columns the table's width leaves out (`fitPriority`, 0.48): unticked, and\n * marked \"hidden for width\". */\n autoHidden: Set<string>;\n /** A tick keeps a column in whatever the width; an untick drops that (data-table-fit.ts). */\n keepColumn: (key: string, on: boolean) => void;\n showSettings: boolean;\n setShowSettings: (open: boolean) => void;\n /** \"Columns (n/m)\", the rail's text and name. */\n columnsCountLabel: string;\n labels: DataTableLabels;\n autoSizeAll: () => void;\n}) {\n // The \"Columns\" rail button — where the drawer's X hands focus back (BUG-7a).\n const columnsRail = useRef<HTMLButtonElement | null>(null);\n const drawerRef = useRef<HTMLDivElement | null>(null);\n const drawerId = useId();\n // The opening half (refactor audit 2026-10-30, DSP-13). Opened from the rail, the focus\n // goes into the drawer: the rail it was on turns zero wide and leaves the tab order in\n // the same render, and the focus sat in a control nobody could see. To the first column\n // box — what the drawer is opened for — or, with none, its first control. Only when the\n // rail opened it: a drawer that starts open (its state is the table's) takes nothing.\n const focusOnOpen = useRef(false);\n useLayoutEffect(() => {\n if (!showSettings || !focusOnOpen.current) return;\n focusOnOpen.current = false;\n const drawer = drawerRef.current;\n if (!drawer) return;\n (\n drawer.querySelector<HTMLElement>('input[type=\"checkbox\"]') ?? firstTabStop(drawer, { includeSelf: false })\n )?.focus();\n }, [showSettings]);\n const close = () => {\n // Back to the rail that opened it: the drawer is about to go inert, and focus would\n // fall to <body> with it (BUG-7a). By the kit's one rule (lib/focus-left\n // `returnFocus`; 0.52 code review 2026-10-31, held to 0.55): from inside the drawer or\n // from nowhere, and checked it took — not over a focus the page already holds.\n returnFocus({ opener: columnsRail.current, closing: drawerRef.current });\n setShowSettings(false);\n };\n return (\n <>\n <Tooltip label={columnsCountLabel} portal>\n <button\n ref={columnsRail}\n type=\"button\"\n onClick={() => {\n focusOnOpen.current = true;\n setShowSettings(true);\n }}\n aria-label={columnsCountLabel}\n // A disclosure: it says whether the drawer is open, and never hides itself from\n // a screen reader — `aria-hidden` on it while it held the focus left the reader\n // with nothing to say (DSP-13). Zero wide and out of the tab order while open.\n aria-expanded={showSettings}\n aria-controls={drawerId}\n tabIndex={showSettings ? -1 : 0}\n className={cn(\n \"group flex shrink-0 items-start justify-center overflow-hidden pt-3 transition-[width] duration-200 ease-out\",\n \"border-s border-subtle\",\n \"hover:bg-hover\",\n showSettings ? \"w-0 border-s-0\" : \"w-8 cursor-pointer\",\n )}\n >\n <span\n className=\"whitespace-nowrap text-xs font-medium tracking-wide text-muted group-hover:text-secondary\"\n style={{ writingMode: \"vertical-rl\", transform: \"rotate(180deg)\" }}\n >\n {columnsCountLabel}\n </span>\n </button>\n </Tooltip>\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- Escape\n for whatever control in the drawer holds the focus; the group itself is no control. */}\n <div\n ref={drawerRef}\n id={drawerId}\n // Named by its own heading's words, so a reader entering it hears \"Columns (4/9),\n // group\" before the first box (DSP-13).\n role=\"group\"\n aria-label={columnsCountLabel}\n // Closed, the drawer is only `w-0`: without `inert` its X, Auto-size and one\n // checkbox per column stayed tab stops and in the accessibility tree, and Tab\n // after the last cell walked into controls nobody could see (BUG-7a).\n inert={!showSettings || undefined}\n // Escape closes it onto the rail, as its X does. Claimed, not handed to the Escape\n // stack: inside a dialog the drawer is what the key closes, not the dialog.\n onKeyDown={(e) => {\n if (e.key !== \"Escape\" || !showSettings) return;\n claimEscape(e);\n close();\n }}\n className={cn(\n \"shrink-0 overflow-hidden transition-[width] duration-200 ease-out\",\n showSettings ? \"w-56\" : \"w-0\",\n )}\n >\n <div className=\"flex w-56 flex-col border-s border-subtle p-2\">\n <div className=\"mb-2 flex items-center justify-between gap-1\">\n <div className=\"text-xs font-medium uppercase tracking-wide text-muted\">{columnsCountLabel}</div>\n <Tooltip label={labels.close} portal>\n <button\n type=\"button\"\n onClick={close}\n aria-label={labels.close}\n className=\"rounded p-0.5 text-placeholder hover:bg-hover hover:text-secondary\"\n >\n <X className=\"size-4\" />\n </button>\n </Tooltip>\n </div>\n <button\n type=\"button\"\n onClick={autoSizeAll}\n className=\"mb-2 rounded border border-subtle px-2 py-1 text-xs font-medium text-secondary hover:bg-hover\"\n >\n {labels.autoSize}\n </button>\n <div className=\"flex flex-col gap-0.5\">\n {columns.map((col) => {\n if (isTableOwnColumn(col.key)) return null;\n // Ticked = drawn: a column left out for width is unticked, so the boxes\n // and \"Columns (8/10)\" say the same (keksdose live #451).\n const forWidth = !hiddenCols.has(col.key) && autoHidden.has(col.key);\n const checked = !hiddenCols.has(col.key) && !forWidth;\n const headerLabel = columnLabel(col);\n return (\n <label\n key={col.key}\n className=\"inline-flex cursor-pointer items-center gap-1.5 rounded px-1 py-0.5 text-xs hover:bg-hover\"\n >\n <input\n type=\"checkbox\"\n className=\"size-3.5 shrink-0\"\n checked={checked}\n onChange={(e) => {\n keepColumn(col.key, e.target.checked);\n setHiddenCols((s) => {\n const next = new Set(s);\n if (e.target.checked) next.delete(col.key);\n else next.add(col.key);\n return next;\n });\n }}\n />\n {/* The panel is `w-56`: a long column name wraps from Large up rather\n than reading \"Accoun…\" beside its box (text size §10.17, round\n 0.34 T1). */}\n {forWidth ? (\n // Under the name, as part of the box's name: \"Email, hidden for width\".\n <span className=\"flex min-w-0 flex-col\">\n <span className=\"truncate-until-large\">{headerLabel}</span>\n <span className=\"text-micro text-muted\" data-hidden-for-width=\"\">\n {labels.hiddenForWidth}\n </span>\n </span>\n ) : (\n <span className=\"min-w-0 truncate-until-large\">{headerLabel}</span>\n )}\n </label>\n );\n })}\n </div>\n </div>\n </div>\n </>\n );\n}\n"],"mappings":";AAyEI,mBAuBM,KAkCA,YAzDN;AAzEJ,SAAS,OAAO,iBAAiB,cAAc;AAE/C,SAAS,SAAS;AAClB,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,cAAc,mBAAmB;AAC1C,SAAS,eAAe;AAExB,SAAS,wBAAwB;AACjC,SAAS,mBAAmB;AAQrB,SAAS,oBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAgBG;AAED,QAAM,cAAc,OAAiC,IAAI;AACzD,QAAM,YAAY,OAA8B,IAAI;AACpD,QAAM,WAAW,MAAM;AAMvB,QAAM,cAAc,OAAO,KAAK;AAChC,kBAAgB,MAAM;AACpB,QAAI,CAAC,gBAAgB,CAAC,YAAY,QAAS;AAC3C,gBAAY,UAAU;AACtB,UAAM,SAAS,UAAU;AACzB,QAAI,CAAC,OAAQ;AACb,KACE,OAAO,cAA2B,wBAAwB,KAAK,aAAa,QAAQ,EAAE,aAAa,MAAM,CAAC,IACzG,MAAM;AAAA,EACX,GAAG,CAAC,YAAY,CAAC;AACjB,QAAM,QAAQ,MAAM;AAKlB,gBAAY,EAAE,QAAQ,YAAY,SAAS,SAAS,UAAU,QAAQ,CAAC;AACvE,oBAAgB,KAAK;AAAA,EACvB;AACA,SAC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;AAAA,cAET,iBAAO;AAAA;AAAA,UACV;AAAA,UACA,oBAAC,SAAI,WAAU,yBACZ,kBAAQ,IAAI,CAAC,QAAQ;AACpB,gBAAI,iBAAiB,IAAI,GAAG,EAAG,QAAO;AAGtC,kBAAM,WAAW,CAAC,WAAW,IAAI,IAAI,GAAG,KAAK,WAAW,IAAI,IAAI,GAAG;AACnE,kBAAM,UAAU,CAAC,WAAW,IAAI,IAAI,GAAG,KAAK,CAAC;AAC7C,kBAAM,cAAc,YAAY,GAAG;AACnC,mBACE;AAAA,cAAC;AAAA;AAAA,gBAEC,WAAU;AAAA,gBAEV;AAAA;AAAA,oBAAC;AAAA;AAAA,sBACC,MAAK;AAAA,sBACL,WAAU;AAAA,sBACV;AAAA,sBACA,UAAU,CAAC,MAAM;AACf,mCAAW,IAAI,KAAK,EAAE,OAAO,OAAO;AACpC,sCAAc,CAAC,MAAM;AACnB,gCAAM,OAAO,IAAI,IAAI,CAAC;AACtB,8BAAI,EAAE,OAAO,QAAS,MAAK,OAAO,IAAI,GAAG;AAAA,8BACpC,MAAK,IAAI,IAAI,GAAG;AACrB,iCAAO;AAAA,wBACT,CAAC;AAAA,sBACH;AAAA;AAAA,kBACF;AAAA,kBAIC;AAAA;AAAA,oBAEC,qBAAC,UAAK,WAAU,yBACd;AAAA,0CAAC,UAAK,WAAU,wBAAwB,uBAAY;AAAA,sBACpD,oBAAC,UAAK,WAAU,yBAAwB,yBAAsB,IAC3D,iBAAO,gBACV;AAAA,uBACF;AAAA,sBAEA,oBAAC,UAAK,WAAU,gCAAgC,uBAAY;AAAA;AAAA;AAAA,cA7BzD,IAAI;AAAA,YA+BX;AAAA,UAEJ,CAAC,GACH;AAAA,WACF;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/data-table-fit.ts"],"sourcesContent":["import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport type { DataTableColumn } from \"./data-table\";\n\n// DataTable's fit to its own width (0.48, keksdose live #451: \"On expanded sidebar for\n// desktop the table scrolls horizontally. On collapsed sidebar it fits […] Compute the\n// width selectively\"). Two column options, both opt-in:\n//\n// - `grow`: the column takes what the others leave and ellipsises (`w-full max-w-0` on\n// its cells: in an auto table layout that is \"the rest of the row\", never its content's\n// width), so one long title can no longer widen the table.\n// - `fitPriority`: while the table is wider than its scroller — or, with a `grow` column,\n// while that column would get less than {@link GROW_MIN_REM} — the table leaves out\n// its `fitPriority` columns, the LOWEST number first (ties: the later column first),\n// and brings them back in the reverse order as soon as the table, as it is NOW, has\n// room for them (its need re-measured, plus the column's own header width from when\n// it was left out), so narrower content (a filter, another page) counts as much as a\n// wider scroller. The scroller's own width, through a ResizeObserver: a sidebar, a\n// narrower window, the Columns drawer and Large text all count the same. A column\n// whose return the very next measure undoes stays out until the table has more room\n// for it than it had then (0.48.3, keksdose B2: see the bring-back in `measure`). And\n// the TABLE's own width, through the same observer (0.51.2): anything that widens it\n// after a measure — rows drawn a frame later, `virtualize` locking its column widths —\n// is measured again, so the table never stays wider than its scroller.\n\n/** The least a `grow` column keeps before the table starts leaving columns out: about\n * a sentence of a title. In rem, so Large text asks for more. */\nexport const GROW_MIN_REM = 10;\n\n/** The `<th>`/`<td>` classes of a `grow` column. `truncate-until-large`: one line and an\n * ellipsis at Normal, a wrap from Large up (text size §10.17), as every kit title. The\n * header's `min-w-[10rem]` ({@link GROW_MIN_REM}) is the floor once no `fitPriority`\n * column is left to leave out: the table then scrolls sideways rather than crushing the\n * column it exists for (Kurvenschmiede S1, 0.48: Subject was 24px at 1100px). */\nexport const GROW_HEAD_CLASS = \"w-full max-w-0 min-w-[10rem]\";\nexport const GROW_CELL_CLASS = \"w-full max-w-0 truncate-until-large\";\n\n/** Every OTHER cell of a table with a `grow` column (kastlan S2, 0.48). A `w-full` column\n * squeezes the rest to their min-content width, so any text with a space broke in two\n * even at 1920px (\"CHF 2'568.38\", \"Peter Mueller\", a date with its time). One line at\n * Normal, so a column is never narrower than its text and `fitPriority` measures what\n * the columns really need; from Large up the cell wraps as before (§10.17). The headers\n * are `whitespace-nowrap` already. A column whose prose should wrap anyway passes\n * `not-large:whitespace-normal` in its `className`. */\nexport const GROW_PEER_CELL_CLASS = \"not-large:whitespace-nowrap\";\n\n// A cell's own flex-wrap row (chips) is left to wrap beside a `grow` column: a row of\n// badges reads as well stacked, and held to one line it widened the user roster's Status\n// until kastlan's admin pane scrolled 21px at 1280px (0.48 build review 2, kastlan S1).\n\n/** The auto-hide order: lowest `fitPriority` first, the later column first on a tie. */\nexport function fitHideOrder<T>(columns: readonly DataTableColumn<T>[]): DataTableColumn<T>[] {\n return columns\n .map((col, index) => ({ col, index }))\n .filter(({ col }) => col.fitPriority != null)\n .sort((a, b) => a.col.fitPriority! - b.col.fitPriority! || b.index - a.index)\n .map(({ col }) => col);\n}\n\n/**\n * Which columns the table leaves out for width, and the Columns panel's \"keep it\".\n *\n * A column the user TICKS in the Columns panel is theirs: it is never left out for width\n * again while the table is mounted (`keep`): the table makes room by leaving out the next\n * candidate, and scrolls sideways once none is left — what they asked for. Unticking it hides it as before (the persisted `hiddenCols`) and\n * drops the keep. Keeps are not persisted: on the next visit the table fits again.\n */\nexport function useColumnFit<T>({\n columns,\n hiddenCols,\n headRefs,\n scroller,\n enabled,\n content,\n}: {\n columns: readonly DataTableColumn<T>[];\n /** The user's hidden columns: never candidates (they are out already). */\n hiddenCols: Set<string>;\n headRefs: Map<string, HTMLTableCellElement>;\n /** The desktop scroller, read after render (it is declared below the call). */\n scroller: () => HTMLElement | null;\n /** The wide layout. On a phone (the card list) nothing is left out for width. */\n enabled: boolean;\n /**\n * What can change the columns' widths besides the scroller (0.48.2): the rows on\n * screen, the columns, the stored widths, the text size. Compared item by item after\n * each render (`Object.is`), and the table is measured only when one changed — a\n * selection tick no longer forces a layout of the whole table. Without it, every render\n * measures. So each item must keep its identity while it means the same: the page's\n * rows memoised, the columns as their keys (DSP-19).\n */\n content?: readonly unknown[];\n}): {\n /** The columns left out for width now — empty while off. */\n autoHidden: Set<string>;\n /** The user's choice in the Columns panel: `true` keeps the column in whatever the width. */\n keep: (key: string, on: boolean) => void;\n} {\n const [kept, setKept] = useState<ReadonlySet<string>>(() => new Set());\n const [hidden, setHidden] = useState<string[]>([]);\n // A column's own header width, written when it is left out: it comes back once the\n // table's need as it is now, plus this, fits the scroller (keksdose S3, 0.48: not the\n // whole table's need at hide time, which went stale when the content narrowed).\n const ownWidth = useRef(new Map<string, number>());\n // A column whose return the very next measure undid, at the same scroller width: the\n // room the table had for it when it came back (keksdose B2, 0.48.3). It stays out\n // until the table has more. Dropped once the column is no longer left out for width.\n const stuck = useRef(new Map<string, number>());\n // What the last measure brought back, each column with the room it had then, and at\n // which scroller width: read (and cleared) by the measure right after it.\n const lastShown = useRef<{ avail: number; rooms: Map<string, number> } | null>(null);\n\n const hasFit = columns.some((c) => c.fitPriority != null);\n const active = enabled && hasFit;\n const order = useMemo(\n () => fitHideOrder(columns).filter((c) => !hiddenCols.has(c.key) && !kept.has(c.key)),\n [columns, hiddenCols, kept],\n );\n // Only the candidates still in play, in hide order — a column the user hid or kept\n // since, or one the app dropped, is no longer \"hidden for width\".\n const current = useMemo(\n () => (active ? order.filter((c) => hidden.includes(c.key)).map((c) => c.key) : []),\n [active, order, hidden],\n );\n const growCol = columns.find((c) => c.grow && !hiddenCols.has(c.key));\n const growKey = growCol?.key;\n const growMin = growCol?.growMin ?? GROW_MIN_REM;\n\n // What `measure` reads, refreshed after each render (before the measure below runs):\n // the ResizeObserver's callback is set up once and must see the current columns.\n const latest = useRef({ order, current, growKey, growMin, active, scroller });\n useLayoutEffect(() => {\n latest.current = { order, current, growKey, growMin, active, scroller };\n });\n\n const measure = useCallback(() => {\n const { order, current, growKey, growMin, active, scroller } = latest.current;\n // Only the measure right after a bring-back can undo it.\n const flip = lastShown.current;\n lastShown.current = null;\n for (const k of stuck.current.keys()) if (!current.includes(k)) stuck.current.delete(k);\n const el = scroller();\n if (!active || !el) return;\n const table = el.querySelector(\"table\");\n const avail = el.clientWidth;\n // Not laid out (display:none, jsdom): nothing to fit to.\n if (!table || avail <= 0) return;\n const growTh = growKey ? headRefs.get(growKey) : undefined;\n const rem = parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;\n let need = growTh ? table.offsetWidth - growTh.offsetWidth + growMin * rem : table.offsetWidth;\n if (!growTh && need <= avail + 0.5 && current.length > 0) {\n // A `w-full` table is at least the scroller's width, which says nothing about how\n // much room its content leaves: probe its content's width (what it takes once it\n // overflows) for the bring-back below. Read and put back in one layout pass.\n const before = table.style.width;\n table.style.width = \"min-content\";\n need = table.offsetWidth;\n table.style.width = before;\n }\n if (need > avail + 0.5) {\n // Leave out, in order, until the rest fits: each column saves its header's width\n // (the others are at their content's width while a `grow` column takes the rest).\n const next = [...current];\n for (const col of order) {\n if (need <= avail + 0.5) break;\n if (next.includes(col.key)) continue;\n const w = headRefs.get(col.key)?.offsetWidth ?? 0;\n ownWidth.current.set(col.key, w);\n need -= w;\n next.push(col.key);\n }\n if (next.length === current.length) return;\n // The last measure brought these back at this same width, and the table cannot\n // hold them: their header width fell short of what they cost drawn (see below).\n if (flip && Math.abs(flip.avail - avail) <= 0.5)\n for (const k of next.slice(current.length)) {\n const room = flip.rooms.get(k);\n if (room != null) stuck.current.set(k, room);\n }\n setHidden(next);\n return;\n }\n // Bring back, the last left out first, while the table as it is now has room for\n // them by their recorded header width. A column that costs more drawn than that is\n // left out again by the next measure, before paint. That alone does not settle it:\n // the re-hide records its header's width again, and the header can measure the same\n // while the column costs more (`virtualize`'s locked widths, keksdose B2, 0.48.3: the\n // drawn column cost the table ~80–110px more than its header), so it came back, went, came back … until React's\n // update limit (#185). So a column whose return the next measure undid, at the same\n // scroller width, waits for more room than it had then: a wider scroller or narrower\n // content. Whatever the error in its width, that is one invisible flip per room it is\n // tried at.\n let n = current.length;\n const rooms = new Map<string, number>();\n while (n > 0) {\n const k = current[n - 1];\n const w = ownWidth.current.get(k);\n if (w == null || need + w > avail + 0.5) break;\n const room = stuck.current.get(k);\n if (room != null && avail - need <= room + 0.5) break;\n rooms.set(k, avail - need);\n need += w;\n n--;\n }\n if (n === current.length) return;\n lastShown.current = { avail, rooms };\n setHidden(current.slice(0, n));\n }, [headRefs]);\n\n // The table the observer below watches, kept to this render's.\n const observer = useRef<ResizeObserver | null>(null);\n const watched = useRef<{ table: Element; width: number } | null>(null);\n const watchTable = useCallback(() => {\n const ro = observer.current;\n const table = latest.current.scroller()?.querySelector(\"table\") ?? null;\n if (!ro || table === (watched.current?.table ?? null)) return;\n if (watched.current) ro.unobserve(watched.current.table);\n // Its width now, as the measure that just ran saw it: a report of the same width is\n // not news, one that differs is (it may come a frame later, rows drawn by then).\n watched.current = table ? { table, width: (table as HTMLElement).offsetWidth } : null;\n if (table) ro.observe(table);\n }, []);\n\n // After a render that changed what is drawn: rows, a filter or a page can widen a\n // column as much as a resize. Before paint, so a column the table cannot hold is never\n // drawn first. A render that changed none of it (a ticked box, a focused row) skips the\n // measure, which forces a layout of the whole table (0.48.2, keksdose dev #632).\n const lastContent = useRef<readonly unknown[] | null>(null);\n // The candidates by their keys, not by identity (refactor audit 2026-10-30, DSP-19):\n // both are memoised on `columns`, which a call site writes inline — a new array, and\n // so a \"change\", on every render of the page around the table.\n const orderSig = order.map((c) => c.key).join(\"\\u0000\");\n const currentSig = current.join(\"\\u0000\");\n useLayoutEffect(() => {\n // The table the observer watches is this render's (a table drawn after a loading\n // state, or remounted, is a new element).\n watchTable();\n // And what the fit measures under the same keys (0.52 code review, data-table.tsx):\n // the headers' text as drawn — a locale switch keeps every key and changes every\n // header, and German → English left out the columns German had no room for, on a\n // table with room to spare (narrower, a `w-full` table keeps the scroller's width,\n // which the observer below watches) — and the grow column's floor. Text is read\n // without a layout.\n const headText = active ? (scroller()?.querySelector(\"thead\")?.textContent ?? \"\") : \"\";\n const now = content ? [...content, orderSig, currentSig, growKey, growMin, active, headText] : null;\n const prev = lastContent.current;\n lastContent.current = now;\n if (now && prev && prev.length === now.length && prev.every((v, i) => Object.is(v, now[i]))) return;\n measure();\n });\n\n // The scroller, and the table in it (0.51.2, keksdose's register). The fit measured\n // after a render that changed `content` and when the SCROLLER changed size, but the table\n // also widens on its own after that: under `virtualize` the rows actually drawn are the\n // window's, set a frame later, and its column-width lock lands a frame later still —\n // neither is `content`, and the scroller keeps its size. A load whose first measure saw\n // the table before its rows were in kept every `fitPriority` column and then overflowed\n // for good (893px in 757 at 1124, 1058 in 913 at 1280, on 0.50.1 as on 0.51). Watched,\n // a table that grows past what was measured is measured again. Only a WIDTH change of\n // the table counts: its height moves with every row the window draws, and each measure\n // lays the whole table out.\n useEffect(() => {\n const el = latest.current.scroller();\n if (!active || !el || typeof ResizeObserver === \"undefined\") return;\n const ro = new ResizeObserver((entries) => {\n let changed = false;\n for (const entry of entries) {\n if (entry.target === el) changed = true;\n else if (watched.current && entry.target === watched.current.table) {\n // The border box, as `offsetWidth` reads it (the content rect leaves the border out).\n const width = entry.borderBoxSize?.[0]?.inlineSize ?? entry.contentRect.width;\n if (Math.abs(width - watched.current.width) > 0.5) {\n watched.current.width = width;\n changed = true;\n }\n }\n }\n if (changed) measure();\n });\n ro.observe(el);\n observer.current = ro;\n watchTable();\n return () => {\n ro.disconnect();\n observer.current = null;\n watched.current = null;\n };\n }, [active, measure, watchTable]);\n\n const keep = useCallback((key: string, on: boolean) => {\n setKept((s) => {\n if (s.has(key) === on) return s;\n const next = new Set(s);\n if (on) next.add(key);\n else next.delete(key);\n return next;\n });\n }, []);\n\n const autoHidden = useMemo(() => new Set(current), [current]);\n return { autoHidden, keep };\n}\n"],"mappings":";AAAA,SAAS,aAAa,WAAW,iBAAiB,SAAS,QAAQ,gBAAgB;AA0B5E,MAAM,eAAe;AAOrB,MAAM,kBAAkB;AACxB,MAAM,kBAAkB;AASxB,MAAM,uBAAuB;AAO7B,SAAS,aAAgB,SAA8D;AAC5F,SAAO,QACJ,IAAI,CAAC,KAAK,WAAW,EAAE,KAAK,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B,cAAQ,UAAU;AAAA,IACpB;AAAA,EACF,GAAG,CAAC,QAAQ,SAAS,UAAU,CAAC;AAEhC,QAAM,OAAO,YAAY,CAAC,KAAa,OAAgB;AACrD,YAAQ,CAAC,MAAM;AACb,UAAI,EAAE,IAAI,GAAG,MAAM,GAAI,QAAO;AAC9B,YAAM,OAAO,IAAI,IAAI,CAAC;AACtB,UAAI,GAAI,MAAK,IAAI,GAAG;AAAA,UACf,MAAK,OAAO,GAAG;AACpB,aAAO;AAAA,IACT,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,QAAM,aAAa,QAAQ,MAAM,IAAI,IAAI,OAAO,GAAG,CAAC,OAAO,CAAC;AAC5D,SAAO,EAAE,YAAY,KAAK;AAC5B;","names":["order","current","growKey","growMin","active","scroller"]}
1
+ {"version":3,"sources":["../../src/components/data-table-fit.ts"],"sourcesContent":["import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport type { DataTableColumn } from \"./data-table\";\n\n// DataTable's fit to its own width (0.48, keksdose live #451: \"On expanded sidebar for\n// desktop the table scrolls horizontally. On collapsed sidebar it fits […] Compute the\n// width selectively\"). Two column options, both opt-in:\n//\n// - `grow`: the column takes what the others leave and ellipsises (`w-full max-w-0` on\n// its cells: in an auto table layout that is \"the rest of the row\", never its content's\n// width), so one long title can no longer widen the table.\n// - `fitPriority`: while the table is wider than its scroller — or, with a `grow` column,\n// while that column would get less than {@link GROW_MIN_REM} — the table leaves out\n// its `fitPriority` columns, the LOWEST number first (ties: the later column first),\n// and brings them back in the reverse order as soon as the table, as it is NOW, has\n// room for them (its need re-measured, plus the column's own header width from when\n// it was left out), so narrower content (a filter, another page) counts as much as a\n// wider scroller. The scroller's own width, through a ResizeObserver: a sidebar, a\n// narrower window, the Columns drawer and Large text all count the same. A column\n// whose return the very next measure undoes stays out until the table has more room\n// for it than it had then (0.48.3, keksdose B2: see the bring-back in `measure`). And\n// the TABLE's own width, through the same observer (0.51.2): anything that widens it\n// after a measure — rows scrolled into `virtualize`'s window, its column-width lock, a\n// font that lands — is measured again, so the table never stays wider than its\n// scroller. Rows that ARRIVE are no longer among them: the window draws them in the\n// render they come in, so the measure after that render fits them before a paint\n// (keksdose register fit, 0.51.2 leftovers; data-table-virtual.ts).\n\n/** The least a `grow` column keeps before the table starts leaving columns out: about\n * a sentence of a title. In rem, so Large text asks for more. */\nexport const GROW_MIN_REM = 10;\n\n/** The `<th>`/`<td>` classes of a `grow` column. `truncate-until-large`: one line and an\n * ellipsis at Normal, a wrap from Large up (text size §10.17), as every kit title. The\n * header's `min-w-[10rem]` ({@link GROW_MIN_REM}) is the floor once no `fitPriority`\n * column is left to leave out: the table then scrolls sideways rather than crushing the\n * column it exists for (Kurvenschmiede S1, 0.48: Subject was 24px at 1100px). */\nexport const GROW_HEAD_CLASS = \"w-full max-w-0 min-w-[10rem]\";\nexport const GROW_CELL_CLASS = \"w-full max-w-0 truncate-until-large\";\n\n/** Every OTHER cell of a table with a `grow` column (kastlan S2, 0.48). A `w-full` column\n * squeezes the rest to their min-content width, so any text with a space broke in two\n * even at 1920px (\"CHF 2'568.38\", \"Peter Mueller\", a date with its time). One line at\n * Normal, so a column is never narrower than its text and `fitPriority` measures what\n * the columns really need; from Large up the cell wraps as before (§10.17). The headers\n * are `whitespace-nowrap` already. A column whose prose should wrap anyway passes\n * `not-large:whitespace-normal` in its `className`. */\nexport const GROW_PEER_CELL_CLASS = \"not-large:whitespace-nowrap\";\n\n// A cell's own flex-wrap row (chips) is left to wrap beside a `grow` column: a row of\n// badges reads as well stacked, and held to one line it widened the user roster's Status\n// until kastlan's admin pane scrolled 21px at 1280px (0.48 build review 2, kastlan S1).\n\n/** The auto-hide order: lowest `fitPriority` first, the later column first on a tie. */\nexport function fitHideOrder<T>(columns: readonly DataTableColumn<T>[]): DataTableColumn<T>[] {\n return columns\n .map((col, index) => ({ col, index }))\n .filter(({ col }) => col.fitPriority != null)\n .sort((a, b) => a.col.fitPriority! - b.col.fitPriority! || b.index - a.index)\n .map(({ col }) => col);\n}\n\n/**\n * Which columns the table leaves out for width, and the Columns panel's \"keep it\".\n *\n * A column the user TICKS in the Columns panel is theirs: it is never left out for width\n * again while the table is mounted (`keep`): the table makes room by leaving out the next\n * candidate, and scrolls sideways once none is left — what they asked for. Unticking it hides it as before (the persisted `hiddenCols`) and\n * drops the keep. Keeps are not persisted: on the next visit the table fits again.\n */\nexport function useColumnFit<T>({\n columns,\n hiddenCols,\n headRefs,\n scroller,\n enabled,\n content,\n}: {\n columns: readonly DataTableColumn<T>[];\n /** The user's hidden columns: never candidates (they are out already). */\n hiddenCols: Set<string>;\n headRefs: Map<string, HTMLTableCellElement>;\n /** The desktop scroller, read after render (it is declared below the call). */\n scroller: () => HTMLElement | null;\n /** The wide layout. On a phone (the card list) nothing is left out for width. */\n enabled: boolean;\n /**\n * What can change the columns' widths besides the scroller (0.48.2): the rows on\n * screen, the columns, the stored widths, the text size. Compared item by item after\n * each render (`Object.is`), and the table is measured only when one changed — a\n * selection tick no longer forces a layout of the whole table. Without it, every render\n * measures. So each item must keep its identity while it means the same: the page's\n * rows memoised, the columns as their keys (DSP-19).\n */\n content?: readonly unknown[];\n}): {\n /** The columns left out for width now — empty while off. */\n autoHidden: Set<string>;\n /** The user's choice in the Columns panel: `true` keeps the column in whatever the width. */\n keep: (key: string, on: boolean) => void;\n} {\n const [kept, setKept] = useState<ReadonlySet<string>>(() => new Set());\n const [hidden, setHidden] = useState<string[]>([]);\n // A column's own header width, written when it is left out: it comes back once the\n // table's need as it is now, plus this, fits the scroller (keksdose S3, 0.48: not the\n // whole table's need at hide time, which went stale when the content narrowed).\n const ownWidth = useRef(new Map<string, number>());\n // A column whose return the very next measure undid, at the same scroller width: the\n // room the table had for it when it came back (keksdose B2, 0.48.3). It stays out\n // until the table has more. Dropped once the column is no longer left out for width.\n const stuck = useRef(new Map<string, number>());\n // What the last measure brought back, each column with the room it had then, and at\n // which scroller width: read (and cleared) by the measure right after it.\n const lastShown = useRef<{ avail: number; rooms: Map<string, number> } | null>(null);\n\n const hasFit = columns.some((c) => c.fitPriority != null);\n const active = enabled && hasFit;\n const order = useMemo(\n () => fitHideOrder(columns).filter((c) => !hiddenCols.has(c.key) && !kept.has(c.key)),\n [columns, hiddenCols, kept],\n );\n // Only the candidates still in play, in hide order — a column the user hid or kept\n // since, or one the app dropped, is no longer \"hidden for width\".\n const current = useMemo(\n () => (active ? order.filter((c) => hidden.includes(c.key)).map((c) => c.key) : []),\n [active, order, hidden],\n );\n const growCol = columns.find((c) => c.grow && !hiddenCols.has(c.key));\n const growKey = growCol?.key;\n const growMin = growCol?.growMin ?? GROW_MIN_REM;\n\n // What `measure` reads, refreshed after each render (before the measure below runs):\n // the ResizeObserver's callback is set up once and must see the current columns.\n const latest = useRef({ order, current, growKey, growMin, active, scroller });\n useLayoutEffect(() => {\n latest.current = { order, current, growKey, growMin, active, scroller };\n });\n\n const measure = useCallback(() => {\n const { order, current, growKey, growMin, active, scroller } = latest.current;\n // Only the measure right after a bring-back can undo it.\n const flip = lastShown.current;\n lastShown.current = null;\n for (const k of stuck.current.keys()) if (!current.includes(k)) stuck.current.delete(k);\n const el = scroller();\n if (!active || !el) return;\n const table = el.querySelector(\"table\");\n const avail = el.clientWidth;\n // Not laid out (display:none, jsdom): nothing to fit to.\n if (!table || avail <= 0) return;\n const growTh = growKey ? headRefs.get(growKey) : undefined;\n const rem = parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;\n let need = growTh ? table.offsetWidth - growTh.offsetWidth + growMin * rem : table.offsetWidth;\n if (!growTh && need <= avail + 0.5 && current.length > 0) {\n // A `w-full` table is at least the scroller's width, which says nothing about how\n // much room its content leaves: probe its content's width (what it takes once it\n // overflows) for the bring-back below. Read and put back in one layout pass.\n const before = table.style.width;\n table.style.width = \"min-content\";\n need = table.offsetWidth;\n table.style.width = before;\n }\n if (need > avail + 0.5) {\n // Leave out, in order, until the rest fits: each column saves its header's width\n // (the others are at their content's width while a `grow` column takes the rest).\n const next = [...current];\n for (const col of order) {\n if (need <= avail + 0.5) break;\n if (next.includes(col.key)) continue;\n const w = headRefs.get(col.key)?.offsetWidth ?? 0;\n ownWidth.current.set(col.key, w);\n need -= w;\n next.push(col.key);\n }\n if (next.length === current.length) return;\n // The last measure brought these back at this same width, and the table cannot\n // hold them: their header width fell short of what they cost drawn (see below).\n if (flip && Math.abs(flip.avail - avail) <= 0.5)\n for (const k of next.slice(current.length)) {\n const room = flip.rooms.get(k);\n if (room != null) stuck.current.set(k, room);\n }\n setHidden(next);\n return;\n }\n // Bring back, the last left out first, while the table as it is now has room for\n // them by their recorded header width. A column that costs more drawn than that is\n // left out again by the next measure, before paint. That alone does not settle it:\n // the re-hide records its header's width again, and the header can measure the same\n // while the column costs more (`virtualize`'s locked widths, keksdose B2, 0.48.3: the\n // drawn column cost the table ~80–110px more than its header), so it came back, went, came back … until React's\n // update limit (#185). So a column whose return the next measure undid, at the same\n // scroller width, waits for more room than it had then: a wider scroller or narrower\n // content. Whatever the error in its width, that is one invisible flip per room it is\n // tried at. (0.51, keksdose N2: under `virtualize` that excess was the table coming\n // back at an OLD lock's ratcheted widths, not the ones measured here; the lock now goes\n // when the columns change, data-table-virtual.ts. The guard stays for the rest: a\n // column whose drawn cells are wider than its header.)\n let n = current.length;\n const rooms = new Map<string, number>();\n while (n > 0) {\n const k = current[n - 1];\n const w = ownWidth.current.get(k);\n if (w == null || need + w > avail + 0.5) break;\n const room = stuck.current.get(k);\n if (room != null && avail - need <= room + 0.5) break;\n rooms.set(k, avail - need);\n need += w;\n n--;\n }\n if (n === current.length) return;\n lastShown.current = { avail, rooms };\n setHidden(current.slice(0, n));\n }, [headRefs]);\n\n // The table the observer below watches, kept to this render's.\n const observer = useRef<ResizeObserver | null>(null);\n const watched = useRef<{ table: Element; width: number } | null>(null);\n const watchTable = useCallback(() => {\n const ro = observer.current;\n const table = latest.current.scroller()?.querySelector(\"table\") ?? null;\n if (!ro || table === (watched.current?.table ?? null)) return;\n if (watched.current) ro.unobserve(watched.current.table);\n // Its width now, as the measure that just ran saw it: a report of the same width is\n // not news, one that differs is (it may come a frame later, rows drawn by then).\n watched.current = table ? { table, width: (table as HTMLElement).offsetWidth } : null;\n if (table) ro.observe(table);\n }, []);\n\n // After a render that changed what is drawn: rows, a filter or a page can widen a\n // column as much as a resize. Before paint, so a column the table cannot hold is never\n // drawn first. A render that changed none of it (a ticked box, a focused row) skips the\n // measure, which forces a layout of the whole table (0.48.2, keksdose dev #632).\n const lastContent = useRef<readonly unknown[] | null>(null);\n // The candidates by their keys, not by identity (refactor audit 2026-10-30, DSP-19):\n // both are memoised on `columns`, which a call site writes inline — a new array, and\n // so a \"change\", on every render of the page around the table.\n const orderSig = order.map((c) => c.key).join(\"\\u0000\");\n const currentSig = current.join(\"\\u0000\");\n useLayoutEffect(() => {\n // The table the observer watches is this render's (a table drawn after a loading\n // state, or remounted, is a new element).\n watchTable();\n // And what the fit measures under the same keys (0.52 code review, data-table.tsx):\n // the headers' text as drawn — a locale switch keeps every key and changes every\n // header, and German → English left out the columns German had no room for, on a\n // table with room to spare (narrower, a `w-full` table keeps the scroller's width,\n // which the observer below watches) — and the grow column's floor. Text is read\n // without a layout.\n const headText = active ? (scroller()?.querySelector(\"thead\")?.textContent ?? \"\") : \"\";\n const now = content ? [...content, orderSig, currentSig, growKey, growMin, active, headText] : null;\n const prev = lastContent.current;\n lastContent.current = now;\n if (now && prev && prev.length === now.length && prev.every((v, i) => Object.is(v, now[i]))) return;\n measure();\n });\n\n // The scroller, and the table in it (0.51.2, keksdose's register). The fit measured\n // after a render that changed `content` and when the SCROLLER changed size, but the table\n // also widens on its own after that: under `virtualize` the rows actually drawn are the\n // window's, set a frame later, and its column-width lock lands a frame later still —\n // neither is `content`, and the scroller keeps its size. A load whose first measure saw\n // the table before its rows were in kept every `fitPriority` column and then overflowed\n // for good (893px in 757 at 1124, 1058 in 913 at 1280, on 0.50.1 as on 0.51). Watched,\n // a table that grows past what was measured is measured again. Only a WIDTH change of\n // the table counts: its height moves with every row the window draws, and each measure\n // lays the whole table out. A re-fit from here comes after a painted frame (the\n // observer reports before the paint, React renders after it); the rows a load brings\n // no longer wait for it, as the window draws them in their own render (0.51.2\n // leftovers: every too-wide frame of a load in scripts/register-fit-frames.mjs was\n // theirs).\n useEffect(() => {\n const el = latest.current.scroller();\n if (!active || !el || typeof ResizeObserver === \"undefined\") return;\n const ro = new ResizeObserver((entries) => {\n let changed = false;\n for (const entry of entries) {\n if (entry.target === el) changed = true;\n else if (watched.current && entry.target === watched.current.table) {\n // The border box, as `offsetWidth` reads it (the content rect leaves the border out).\n const width = entry.borderBoxSize?.[0]?.inlineSize ?? entry.contentRect.width;\n if (Math.abs(width - watched.current.width) > 0.5) {\n watched.current.width = width;\n changed = true;\n }\n }\n }\n if (changed) measure();\n });\n ro.observe(el);\n observer.current = ro;\n watchTable();\n return () => {\n ro.disconnect();\n observer.current = null;\n watched.current = null;\n };\n }, [active, measure, watchTable]);\n\n const keep = useCallback((key: string, on: boolean) => {\n setKept((s) => {\n if (s.has(key) === on) return s;\n const next = new Set(s);\n if (on) next.add(key);\n else next.delete(key);\n return next;\n });\n }, []);\n\n const autoHidden = useMemo(() => new Set(current), [current]);\n return { autoHidden, keep };\n}\n"],"mappings":";AAAA,SAAS,aAAa,WAAW,iBAAiB,SAAS,QAAQ,gBAAgB;AA6B5E,MAAM,eAAe;AAOrB,MAAM,kBAAkB;AACxB,MAAM,kBAAkB;AASxB,MAAM,uBAAuB;AAO7B,SAAS,aAAgB,SAA8D;AAC5F,SAAO,QACJ,IAAI,CAAC,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,EACpC,OAAO,CAAC,EAAE,IAAI,MAAM,IAAI,eAAe,IAAI,EAC3C,KAAK,CAAC,GAAG,MAAM,EAAE,IAAI,cAAe,EAAE,IAAI,eAAgB,EAAE,QAAQ,EAAE,KAAK,EAC3E,IAAI,CAAC,EAAE,IAAI,MAAM,GAAG;AACzB;AAUO,SAAS,aAAgB;AAAA,EAC9B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I,GAAI,MAAK,IAAI,GAAG;AAAA,UACf,MAAK,OAAO,GAAG;AACpB,aAAO;AAAA,IACT,CAAC;AAAA,EACH,GAAG,CAAC,CAAC;AAEL,QAAM,aAAa,QAAQ,MAAM,IAAI,IAAI,OAAO,GAAG,CAAC,OAAO,CAAC;AAC5D,SAAO,EAAE,YAAY,KAAK;AAC5B;","names":["order","current","growKey","growMin","active","scroller"]}
@@ -94,11 +94,11 @@ function useRowWindow({
94
94
  count: 0,
95
95
  band: [estimate, estimate * 0.8]
96
96
  }));
97
- const initialEnd = () => Math.min(
97
+ const screenful = () => Math.min(
98
98
  n,
99
99
  Math.ceil((typeof window === "undefined" ? 800 : Math.min(window.innerHeight || 800, 1600)) / estimate) + overscan
100
100
  );
101
- const [range, setRange] = useState(() => ({ start: 0, end: initialEnd() }));
101
+ const [range, setRange] = useState(() => ({ start: 0, end: screenful() }));
102
102
  const [focusTarget, setFocusTarget] = useState(null);
103
103
  const [focusKey, setFocusKey] = useState(null);
104
104
  const [scrollerWidth, setScrollerWidth] = useState(0);
@@ -138,6 +138,16 @@ function useRowWindow({
138
138
  tops[n] = y;
139
139
  return { n, keys, tops, h, gTop, total: y, ariaRows, ariaBands, rowCount: aria - 1 + rowsAfter };
140
140
  }, [enabled, rows, rowKey, groupsSig, expandedSig, measured, estimate, n, rowsBefore, rowsAfter]);
141
+ const dataSig = n > 0 && model ? `${n}:${String(model.keys[0])}:${String(model.keys[n - 1])}` : "0";
142
+ const [rangeData, setRangeData] = useState(dataSig);
143
+ if (enabled && rangeData !== dataSig) {
144
+ setRangeData(dataSig);
145
+ const fill = screenful();
146
+ if (Math.min(range.end, n) - Math.min(range.start, n) < fill) {
147
+ const from = Math.max(0, Math.min(range.start, n - fill));
148
+ setRange({ start: from, end: from + fill });
149
+ }
150
+ }
141
151
  const pinned = useMemo(() => {
142
152
  if (!model) return [];
143
153
  const out = [...expanded];
@@ -158,6 +168,7 @@ function useRowWindow({
158
168
  [model, groupsSig, start, end, pinnedSig]
159
169
  );
160
170
  const lockSig = `${resetKey}|${scrollerWidth}|${colKeys.join(",")}`;
171
+ if (lock !== null && lock.sig !== lockSig) setLock(null);
161
172
  const colWidths = lock && lock.sig === lockSig ? lock.widths : null;
162
173
  const latest = useRef({ model, colWidths, lockSig, colKeys, lockable, overscan });
163
174
  useLayoutEffect(() => {
@@ -322,7 +333,6 @@ function useRowWindow({
322
333
  table.removeEventListener("focusout", onOut);
323
334
  };
324
335
  }, [enabled, tableRef]);
325
- const dataSig = n > 0 && model ? `${n}:${String(model.keys[0])}:${String(model.keys[n - 1])}` : "0";
326
336
  const renderSig = `${start}:${end}:${dataSig}:${expandedSig}:${pinnedSig}:${lockSig}:${colWidths ? 1 : 0}`;
327
337
  const lastRender = useRef("");
328
338
  useLayoutEffect(() => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/data-table-virtual.ts"],"sourcesContent":["import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport type { RefObject } from \"react\";\n\n// DataTable's row windowing (0.48.2, keksdose dev #632 — Marcel: \"The table is extremely\n// slow. Is it virtualised or is everytime the whole table rendered?\"). Opt-in through\n// `virtualize`: the desktop table renders the rows near the visible part of its scroller\n// (plus `overscan`) and stands spacer rows in for the rest, inside each group's own\n// `<tbody>`, so the sticky group bands keep working as they do on a full table — a band\n// cell's sticky containing block is the TABLE, and the latest band of each level that has\n// scrolled past is the one drawn (Chromium, checked with a probe at the group's middle,\n// its end and the next group's start).\n//\n// What it keeps rendered whatever the scroll: the header, the leading row, the band rows\n// of every group that has a rendered row (and the first day of the period the window\n// starts in, whose band is the period's), every OPEN row (`isExpanded`, so an inline\n// editor keeps its state), the roving tab stop, a row holding the focus, and the row the\n// keyboard is moving to.\n//\n// Heights: each rendered row is measured after render (the distance to the next row's\n// top, which is exact under collapsed borders where a row's own box is half a border\n// short) and remembered by its key; a row never rendered counts as the average of the\n// measured ones, or `estimateRowHeight` before any. The spacers are the sums, so the\n// scroll height settles as rows are seen. Scroll anchoring (the browser's) keeps the rows\n// in view still while a spacer above them is corrected.\n//\n// Column widths: in an auto table layout a column is as wide as its widest RENDERED\n// cell, so rows coming and going would move the columns. The header cells' widths are\n// read after the first render and locked into a `<colgroup>`, only ever growing while the\n// rows scroll (a wider cell arriving widens its column once; one leaving narrows\n// nothing). Re-measured from scratch when the data, the columns, a user width, the text\n// size or the scroller's width change — and when a grown column would push the table\n// past its scroller, which it fit before. A `grow` column and a user-resized one are not\n// locked (the first takes the rest, the second is pinned already).\n\n/** {@link DataTableProps.virtualize}'s options. */\nexport interface DataTableVirtualize {\n /** Rows rendered beyond each edge of the visible part. Default 12. */\n overscan?: number;\n /** A row's height in px before it has been measured. Default: 37 (`comfortable`) /\n * 29 (`compact`) — the kit's one-line rows. */\n estimateRowHeight?: number;\n}\n\n/** One innermost group's run of rows, `[start, end)` in the rows on screen, with the\n * band levels its `<tbody>` opens with. `first` is the index of the innermost group that\n * opens its level-1 group (itself with one level). Ungrouped: one run with no bands. */\nexport interface VirtualGroup {\n start: number;\n end: number;\n bands: readonly (1 | 2)[];\n first: number;\n}\n\n/** A row, or a spacer standing in for the rows between two rendered ones. */\nexport type VirtualItem = { kind: \"row\"; index: number } | { kind: \"gap\"; key: string; height: number };\n\n/** A group's `<tbody>` with its rendered rows, or one spacer `<tbody>` for a run of\n * groups of which nothing is rendered. */\nexport type VirtualBody =\n { kind: \"spacer\"; key: string; height: number } | { kind: \"group\"; group: number; items: VirtualItem[] };\n\nexport interface RowWindow {\n bodies: VirtualBody[];\n /** `aria-rowcount`: every row of the table, header, bands, details and footer included. */\n rowCount: number;\n /** `aria-rowindex` of data row `i`; its detail row (open) is the next one. */\n ariaRow: (i: number) => number;\n /** `aria-rowindex` of group `g`'s band of `level`. */\n ariaBand: (g: number, level: 1 | 2) => number;\n /** The locked widths for the `<colgroup>`, by column key; null while measuring. */\n colWidths: Record<string, number> | null;\n /** Move the focus to row `i`, rendering it first when it is not. */\n focusRow: (i: number) => void;\n}\n\n/** The heights measured so far, by row key; the bands' by level. */\ninterface Measured {\n heights: Map<string | number, number>;\n details: Map<string | number, number>;\n sum: number;\n count: number;\n band: [number, number];\n}\n\nconst SELECT_KEY = \"\\u0000select\";\n/** The `<colgroup>` key of the selection column. */\nexport const VIRTUAL_SELECT_COL = SELECT_KEY;\n\ninterface Model {\n n: number;\n keys: (string | number)[];\n /** Top of row i, from the top of the first group's `<tbody>`. */\n tops: Float64Array;\n /** Full height of row i (its detail row included while open). */\n h: Float64Array;\n /** Top of group g's `<tbody>`; [groups.length] is the total. */\n gTop: Float64Array;\n total: number;\n ariaRows: Int32Array;\n ariaBands: Int32Array;\n rowCount: number;\n}\n\n/** First index whose bottom is below `y` (n when none). */\nfunction firstBelow(m: Model, y: number): number {\n let lo = 0;\n let hi = m.n;\n while (lo < hi) {\n const mid = (lo + hi) >> 1;\n if (m.tops[mid] + m.h[mid] > y) hi = mid;\n else lo = mid + 1;\n }\n return lo;\n}\n\n/** One past the last index whose top is above `y`. */\nfunction lastAbove(m: Model, y: number): number {\n let lo = 0;\n let hi = m.n;\n while (lo < hi) {\n const mid = (lo + hi) >> 1;\n if (m.tops[mid] < y) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n}\n\n/** The `<tbody>`s to render: the groups holding a rendered row (or the period's first\n * day, for its band), and one spacer for each run of groups in between. Pure. */\nexport function planBodies(\n m: Pick<Model, \"n\" | \"tops\" | \"h\" | \"gTop\">,\n groups: readonly VirtualGroup[],\n start: number,\n end: number,\n pinned: readonly number[],\n): VirtualBody[] {\n const rendered = new Set<number>();\n for (let i = Math.max(0, start); i < Math.min(m.n, end); i++) rendered.add(i);\n for (const p of pinned) if (p >= 0 && p < m.n) rendered.add(p);\n const sorted = [...rendered].sort((a, b) => a - b);\n // The group the window starts in, and the first day of its period.\n let anchor = -1;\n if (sorted.length > 0 && start < m.n) {\n const s = Math.max(0, start);\n const g = groups.findIndex((gr) => s >= gr.start && s < gr.end);\n if (g >= 0) anchor = groups[g].first;\n }\n const bottom = (i: number) => m.tops[i] + m.h[i];\n const out: VirtualBody[] = [];\n let k = 0;\n let skippedFrom = -1;\n const flushSkipped = (upTo: number) => {\n if (skippedFrom < 0) return;\n out.push({ kind: \"spacer\", key: `vs:${skippedFrom}`, height: m.gTop[upTo] - m.gTop[skippedFrom] });\n skippedFrom = -1;\n };\n groups.forEach((g, gi) => {\n while (k < sorted.length && sorted[k] < g.start) k++;\n const items: VirtualItem[] = [];\n let prevBottom = m.tops[g.start] ?? m.gTop[gi + 1];\n let any = false;\n while (k < sorted.length && sorted[k] < g.end) {\n const i = sorted[k++];\n const gap = m.tops[i] - prevBottom;\n if (gap > 0.01) items.push({ kind: \"gap\", key: `gap:${i}`, height: gap });\n items.push({ kind: \"row\", index: i });\n prevBottom = bottom(i);\n any = true;\n }\n if (!any && gi !== anchor) {\n if (skippedFrom < 0) skippedFrom = gi;\n return;\n }\n flushSkipped(gi);\n const rest = m.gTop[gi + 1] - prevBottom;\n if (rest > 0.01) items.push({ kind: \"gap\", key: `gap:end:${gi}`, height: rest });\n out.push({ kind: \"group\", group: gi, items });\n });\n flushSkipped(groups.length);\n return out;\n}\n\nexport function useRowWindow<T>({\n enabled,\n rows,\n rowKey,\n groups,\n expanded,\n pinnedKeys,\n scrollerRef,\n tableRef,\n options,\n compact,\n rowsBefore,\n rowsAfter,\n colKeys,\n lockable,\n resetKey,\n}: {\n enabled: boolean;\n /** The rows on screen, in order. */\n rows: readonly T[];\n rowKey: (row: T) => string | number;\n groups: readonly VirtualGroup[];\n /** Indices of the open rows: always rendered, their detail rows counted. */\n expanded: readonly number[];\n /** Keys always rendered (the roving tab stop). */\n pinnedKeys: readonly (string | number | null)[];\n scrollerRef: RefObject<HTMLElement | null>;\n tableRef: RefObject<HTMLTableElement | null>;\n options: DataTableVirtualize;\n compact: boolean;\n /** Rows above the first group: the header, the leading row. */\n rowsBefore: number;\n /** Rows after the last: the totals row. */\n rowsAfter: number;\n /** The header cells' keys, in order (the selection column as {@link VIRTUAL_SELECT_COL}). */\n colKeys: readonly string[];\n /** The keys whose width is locked (not a `grow` column, not a user-resized one). */\n lockable: ReadonlySet<string>;\n /** Anything that re-measures the column widths from scratch when it changes. */\n resetKey: string;\n}): RowWindow | null {\n const overscan = Math.max(1, options.overscan ?? 12);\n const estimate = options.estimateRowHeight ?? (compact ? 29 : 37);\n const n = rows.length;\n\n const [measured, setMeasured] = useState<Measured>(() => ({\n heights: new Map(),\n details: new Map(),\n sum: 0,\n count: 0,\n band: [estimate, estimate * 0.8],\n }));\n const initialEnd = () =>\n Math.min(\n n,\n Math.ceil((typeof window === \"undefined\" ? 800 : Math.min(window.innerHeight || 800, 1600)) / estimate) +\n overscan,\n );\n const [range, setRange] = useState(() => ({ start: 0, end: initialEnd() }));\n const [focusTarget, setFocusTarget] = useState<number | null>(null);\n const [focusKey, setFocusKey] = useState<string | number | null>(null);\n const [scrollerWidth, setScrollerWidth] = useState(0);\n const [lock, setLock] = useState<{ sig: string; widths: Record<string, number> } | null>(null);\n const naturalOverflow = useRef(false);\n\n const expandedSig = expanded.join(\",\");\n // The groups by what they say, not by identity (0.52 code review, data-table.tsx): the\n // table builds them afresh on every render, and the model — `rowKey` on every row, and\n // its arrays — was rebuilt with them: 3000 rows, ~6000 `rowKey` calls per arrow step.\n const groupsSig = groups.map((g) => `${g.start}:${g.end}:${g.bands.join(\".\")}:${g.first}`).join(\",\");\n const model = useMemo<Model | null>(() => {\n if (!enabled) return null;\n const keys = rows.map(rowKey);\n const avg = measured.count > 0 ? measured.sum / measured.count : estimate;\n const open = new Set(expanded);\n const h = new Float64Array(n);\n for (let i = 0; i < n; i++) {\n h[i] = (measured.heights.get(keys[i]) ?? avg) + (open.has(i) ? (measured.details.get(keys[i]) ?? 0) : 0);\n }\n const tops = new Float64Array(n + 1);\n const gTop = new Float64Array(groups.length + 1);\n const ariaRows = new Int32Array(n);\n const ariaBands = new Int32Array(groups.length * 2);\n let y = 0;\n let aria = rowsBefore + 1;\n groups.forEach((g, gi) => {\n gTop[gi] = y;\n for (const level of g.bands) {\n y += measured.band[level - 1];\n ariaBands[gi * 2 + level - 1] = aria++;\n }\n for (let i = g.start; i < g.end; i++) {\n tops[i] = y;\n y += h[i];\n ariaRows[i] = aria++;\n if (open.has(i)) aria++;\n }\n });\n gTop[groups.length] = y;\n tops[n] = y;\n return { n, keys, tops, h, gTop, total: y, ariaRows, ariaBands, rowCount: aria - 1 + rowsAfter };\n // `expanded` and `groups` by their signatures.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [enabled, rows, rowKey, groupsSig, expandedSig, measured, estimate, n, rowsBefore, rowsAfter]);\n\n // The rows outside the range that stay: open rows, the tab stop, the focused row and\n // the keyboard's target.\n const pinned = useMemo(() => {\n if (!model) return [];\n const out = [...expanded];\n for (const key of [...pinnedKeys, focusKey]) {\n if (key === null) continue;\n const i = model.keys.indexOf(key);\n if (i >= 0) out.push(i);\n }\n if (focusTarget !== null) out.push(focusTarget);\n return out;\n }, [model, expanded, pinnedKeys, focusKey, focusTarget]);\n const pinnedSig = pinned.join(\",\");\n\n const start = Math.min(range.start, n);\n const end = Math.min(range.end, n);\n const bodies = useMemo(\n () => (model ? planBodies(model, groups, start, end, pinned) : []),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [model, groupsSig, start, end, pinnedSig],\n );\n\n const lockSig = `${resetKey}|${scrollerWidth}|${colKeys.join(\",\")}`;\n const colWidths = lock && lock.sig === lockSig ? lock.widths : null;\n\n // What the scroll handler and the frame's measure read: this render's model and lock.\n const latest = useRef({ model, colWidths, lockSig, colKeys, lockable, overscan });\n useLayoutEffect(() => {\n latest.current = { model, colWidths, lockSig, colKeys, lockable, overscan };\n });\n\n // Which rows the visible part of the scroller (and of the window, for a table in a page\n // that scrolls) shows, and a new range around them when the rendered one no longer\n // covers them. Read from the client rects, which a scroll leaves laid out.\n const update = useCallback(() => {\n const { model: m, overscan: over } = latest.current;\n const sc = scrollerRef.current;\n const table = tableRef.current;\n if (!m || !sc || !table) return;\n const origin = table.querySelector<HTMLElement>(\":scope > tbody[data-vt-body]\");\n if (!origin) return;\n const sr = sc.getBoundingClientRect();\n const top = Math.max(sr.top, 0);\n const bottom = Math.min(sr.bottom, window.innerHeight || sr.bottom);\n if (!(bottom > top)) return;\n const o = origin.getBoundingClientRect().top;\n const a = Math.min(firstBelow(m, top - o), m.n);\n const b = Math.max(a, Math.min(lastAbove(m, bottom - o), m.n));\n setRange((prev) =>\n prev.start <= a && prev.end >= b && prev.end <= m.n && prev.end - prev.start <= b - a + 4 * over\n ? prev\n : { start: Math.max(0, a - over), end: Math.min(m.n, b + over) },\n );\n }, [scrollerRef, tableRef]);\n\n // After a render that changed what is drawn: measure the rendered rows and bands, and\n // the header cells for the lock. Not after a render that only ticked a box. In the next\n // animation frame rather than in the commit: there the browser lays the table out once\n // for the frame anyway, where a read in the commit forced a layout of its own, and the\n // re-render the heights cause forced another (Chromium, 3000 rows: 35–130 ms of forced\n // layout per scrolled step, against one layout per frame now).\n const measure = useCallback(() => {\n const { model: m, colWidths: locked, lockSig: sig, colKeys: cols, lockable: lockKeys } = latest.current;\n const table = tableRef.current;\n const sc = scrollerRef.current;\n if (!m || !table || !sc) return;\n const trs = table.rows;\n const rects = Array.from(trs, (tr) => tr.getBoundingClientRect());\n const rowSamples: [string | number, number][] = [];\n const detailSamples: [string | number, number][] = [];\n const bandSamples: [0 | 1, number][] = [];\n for (let k = 0; k < trs.length; k++) {\n const own = rects[k];\n const next = rects[k + 1];\n // The distance to the next row's top: exact under collapsed borders.\n const h = next && next.top > own.top ? next.top - own.top : own.height;\n if (!(h > 0)) continue;\n const ds = trs[k].dataset;\n if (ds.rowIndex !== undefined) {\n const key = m.keys[Number(ds.rowIndex)];\n if (key !== undefined) rowSamples.push([key, h]);\n } else if (ds.rowDetail !== undefined) {\n const key = m.keys[Number(ds.rowDetail)];\n if (key !== undefined) detailSamples.push([key, h]);\n } else if (ds.groupRow === \"1\" || ds.groupRow === \"2\") {\n bandSamples.push([ds.groupRow === \"1\" ? 0 : 1, h]);\n }\n }\n if (rowSamples.length + detailSamples.length + bandSamples.length > 0) {\n setMeasured((prev) => {\n let { heights, details, sum, count } = prev;\n let band = prev.band;\n for (const [key, h] of rowSamples) {\n const old = heights.get(key);\n if (old !== undefined && Math.abs(old - h) <= 0.5) continue;\n if (heights === prev.heights) heights = new Map(heights);\n heights.set(key, h);\n sum += h - (old ?? 0);\n if (old === undefined) count++;\n }\n for (const [key, h] of detailSamples) {\n const old = details.get(key);\n if (old !== undefined && Math.abs(old - h) <= 0.5) continue;\n if (details === prev.details) details = new Map(details);\n details.set(key, h);\n }\n for (const [level, h] of bandSamples) {\n if (Math.abs(band[level] - h) <= 0.5) continue;\n band = level === 0 ? [h, band[1]] : [band[0], h];\n }\n return heights === prev.heights && details === prev.details && band === prev.band\n ? prev\n : { heights, details, sum, count, band };\n });\n }\n // The column lock.\n const cells = table.tHead?.rows[0]?.cells;\n if (!cells || cells.length !== cols.length) return;\n const widths: Record<string, number> = {};\n let anyWidth = false;\n for (let c = 0; c < cells.length; c++) {\n if (!lockKeys.has(cols[c])) continue;\n const w = cells[c].getBoundingClientRect().width;\n if (w > 0) {\n widths[cols[c]] = w;\n anyWidth = true;\n }\n }\n if (!anyWidth) return;\n const over = table.getBoundingClientRect().width > sc.clientWidth + 1;\n if (!locked) {\n naturalOverflow.current = over;\n setLock({ sig, widths });\n } else if (over && !naturalOverflow.current) {\n // A grown column pushed the table past a scroller it fit: measure afresh.\n setLock(null);\n } else {\n let grew = false;\n const merged = { ...locked };\n for (const [key, w] of Object.entries(widths)) {\n if (w > (merged[key] ?? 0) + 0.5) {\n merged[key] = w;\n grew = true;\n }\n }\n if (grew) setLock({ sig, widths: merged });\n }\n }, [scrollerRef, tableRef]);\n\n const frame = useRef(0);\n const schedule = useCallback(() => {\n if (frame.current) return;\n const run = () => {\n frame.current = 0;\n measure();\n update();\n };\n frame.current =\n typeof requestAnimationFrame === \"undefined\"\n ? -(setTimeout(run, 16) as unknown as number)\n : requestAnimationFrame(run);\n }, [measure, update]);\n useEffect(\n () => () => {\n if (frame.current > 0) cancelAnimationFrame(frame.current);\n else if (frame.current < 0) clearTimeout(-frame.current);\n frame.current = 0;\n },\n [],\n );\n\n useEffect(() => {\n if (!enabled) return;\n const onScroll = () => update();\n window.addEventListener(\"scroll\", onScroll, { capture: true, passive: true });\n window.addEventListener(\"resize\", onScroll, { passive: true });\n const sc = scrollerRef.current;\n let ro: ResizeObserver | undefined;\n if (sc && typeof ResizeObserver !== \"undefined\") {\n ro = new ResizeObserver(() => {\n setScrollerWidth(Math.round(sc.clientWidth));\n update();\n });\n ro.observe(sc);\n }\n return () => {\n window.removeEventListener(\"scroll\", onScroll, { capture: true });\n window.removeEventListener(\"resize\", onScroll);\n ro?.disconnect();\n };\n }, [enabled, update, scrollerRef]);\n\n // The row holding the focus (a row, or a control in it or in its open detail) stays.\n useEffect(() => {\n const table = tableRef.current;\n if (!enabled || !table) return;\n const onIn = (e: FocusEvent) => {\n const tr = ownRowOf(table, e.target as Element | null);\n const index = tr ? Number(tr.dataset.rowIndex ?? tr.dataset.rowDetail) : NaN;\n const key = Number.isNaN(index) ? undefined : latest.current.model?.keys[index];\n setFocusKey(key ?? null);\n setFocusTarget(null);\n };\n const onOut = (e: FocusEvent) => {\n const to = e.relatedTarget as Node | null;\n if (!to || !table.contains(to)) setFocusKey(null);\n };\n table.addEventListener(\"focusin\", onIn);\n table.addEventListener(\"focusout\", onOut);\n return () => {\n table.removeEventListener(\"focusin\", onIn);\n table.removeEventListener(\"focusout\", onOut);\n };\n }, [enabled, tableRef]);\n\n const dataSig = n > 0 && model ? `${n}:${String(model.keys[0])}:${String(model.keys[n - 1])}` : \"0\";\n const renderSig = `${start}:${end}:${dataSig}:${expandedSig}:${pinnedSig}:${lockSig}:${colWidths ? 1 : 0}`;\n const lastRender = useRef(\"\");\n useLayoutEffect(() => {\n if (!enabled || lastRender.current === renderSig) return;\n lastRender.current = renderSig;\n schedule();\n });\n\n // A new layout (heights measured, rows added): the range may no longer cover the view.\n const total = model?.total ?? 0;\n useLayoutEffect(() => {\n if (enabled) schedule();\n }, [enabled, schedule, total, n]);\n\n // The keyboard's target: rendered (pinned), then focused — its focus scrolls it into\n // view, and the scroll renders the rows around it.\n useLayoutEffect(() => {\n if (focusTarget === null) return;\n // Released by the focus it receives (the `focusin` above), which pins it as the\n // focused row from then on.\n const table = tableRef.current;\n if (table) ownRowAt(table, focusTarget)?.focus();\n }, [focusTarget, bodies, tableRef]);\n\n const focusRow = useCallback(\n (i: number) => {\n const table = tableRef.current;\n const el = table && ownRowAt(table, i);\n if (el) el.focus();\n else setFocusTarget(i);\n },\n [tableRef],\n );\n\n if (!enabled || !model) return null;\n return {\n bodies,\n rowCount: model.rowCount,\n ariaRow: (i) => model.ariaRows[i],\n ariaBand: (g, level) => model.ariaBands[g * 2 + level - 1],\n colWidths,\n focusRow,\n };\n}\n\n// The window's rows are the table's OWN (0.52 code review, data-table-row.tsx): every\n// desktop row carries `data-row-index` since DSP-4, a nested DataTable's in an open row\n// too, and a lookup over the whole subtree answered for the outer table with the nested\n// one's rows — ArrowDown from row 0 went to the nested row 1, the first in document order.\n\n/** This table's row at `index`, if it is drawn. */\nfunction ownRowAt(table: HTMLTableElement, index: number): HTMLElement | null {\n return table.querySelector<HTMLElement>(`:scope > tbody > tr[data-row-index=\"${index}\"]`);\n}\n\n/** This table's row (or open detail row) that holds `node` — past a nested table's own. */\nfunction ownRowOf(table: HTMLTableElement, node: Element | null): HTMLElement | null {\n const ROW = \"tr[data-row-index], tr[data-row-detail]\";\n for (let tr = node?.closest?.<HTMLElement>(ROW) ?? null; tr; tr = tr.parentElement?.closest<HTMLElement>(ROW) ?? null)\n if (tr.parentElement?.parentElement === table) return tr;\n return null;\n}\n\n/** The roving rows' Arrow/Home/End target over ALL the rows, rendered or not. */\nexport function rowNavTarget(from: number, key: string, n: number): number | null {\n if (n === 0) return null;\n if (key === \"ArrowDown\") return Math.min(n - 1, from + 1);\n if (key === \"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../src/components/data-table-virtual.ts"],"sourcesContent":["import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport type { RefObject } from \"react\";\n\n// DataTable's row windowing (0.48.2, keksdose dev #632 — Marcel: \"The table is extremely\n// slow. Is it virtualised or is everytime the whole table rendered?\"). Opt-in through\n// `virtualize`: the desktop table renders the rows near the visible part of its scroller\n// (plus `overscan`) and stands spacer rows in for the rest, inside each group's own\n// `<tbody>`, so the sticky group bands keep working as they do on a full table — a band\n// cell's sticky containing block is the TABLE, and the latest band of each level that has\n// scrolled past is the one drawn (Chromium, checked with a probe at the group's middle,\n// its end and the next group's start).\n//\n// What it keeps rendered whatever the scroll: the header, the leading row, the band rows\n// of every group that has a rendered row (and the first day of the period the window\n// starts in, whose band is the period's), every OPEN row (`isExpanded`, so an inline\n// editor keeps its state), the roving tab stop, a row holding the focus, and the row the\n// keyboard is moving to. Rows that arrive into a window holding fewer (a load, a filter\n// lifted) are drawn in the render they arrive in, a screenful from the window's height, so\n// a `fitPriority` table is fitted on them before it paints (keksdose register fit, 0.51.2\n// leftovers).\n//\n// Heights: each rendered row is measured after render (the distance to the next row's\n// top, which is exact under collapsed borders where a row's own box is half a border\n// short) and remembered by its key; a row never rendered counts as the average of the\n// measured ones, or `estimateRowHeight` before any. The spacers are the sums, so the\n// scroll height settles as rows are seen. Scroll anchoring (the browser's) keeps the rows\n// in view still while a spacer above them is corrected.\n//\n// Column widths: in an auto table layout a column is as wide as its widest RENDERED\n// cell, so rows coming and going would move the columns. The header cells' widths are\n// read after the first render and locked into a `<colgroup>`, only ever growing while the\n// rows scroll (a wider cell arriving widens its column once; one leaving narrows\n// nothing). Re-measured from scratch when the data, the columns, a user width, the text\n// size or the scroller's width change — and when a grown column would push the table\n// past its scroller, which it fit before. A `grow` column and a user-resized one are not\n// locked (the first takes the rest, the second is pinned already). A lock replaced is\n// gone: changing back (a column the fit leaves out and brings back) measures again\n// (0.51, keksdose N2; reverted in 0.51.1, back with the 0.51.2 leftovers).\n\n/** {@link DataTableProps.virtualize}'s options. */\nexport interface DataTableVirtualize {\n /** Rows rendered beyond each edge of the visible part. Default 12. */\n overscan?: number;\n /** A row's height in px before it has been measured. Default: 37 (`comfortable`) /\n * 29 (`compact`) — the kit's one-line rows. */\n estimateRowHeight?: number;\n}\n\n/** One innermost group's run of rows, `[start, end)` in the rows on screen, with the\n * band levels its `<tbody>` opens with. `first` is the index of the innermost group that\n * opens its level-1 group (itself with one level). Ungrouped: one run with no bands. */\nexport interface VirtualGroup {\n start: number;\n end: number;\n bands: readonly (1 | 2)[];\n first: number;\n}\n\n/** A row, or a spacer standing in for the rows between two rendered ones. */\nexport type VirtualItem = { kind: \"row\"; index: number } | { kind: \"gap\"; key: string; height: number };\n\n/** A group's `<tbody>` with its rendered rows, or one spacer `<tbody>` for a run of\n * groups of which nothing is rendered. */\nexport type VirtualBody =\n { kind: \"spacer\"; key: string; height: number } | { kind: \"group\"; group: number; items: VirtualItem[] };\n\nexport interface RowWindow {\n bodies: VirtualBody[];\n /** `aria-rowcount`: every row of the table, header, bands, details and footer included. */\n rowCount: number;\n /** `aria-rowindex` of data row `i`; its detail row (open) is the next one. */\n ariaRow: (i: number) => number;\n /** `aria-rowindex` of group `g`'s band of `level`. */\n ariaBand: (g: number, level: 1 | 2) => number;\n /** The locked widths for the `<colgroup>`, by column key; null while measuring. */\n colWidths: Record<string, number> | null;\n /** Move the focus to row `i`, rendering it first when it is not. */\n focusRow: (i: number) => void;\n}\n\n/** The heights measured so far, by row key; the bands' by level. */\ninterface Measured {\n heights: Map<string | number, number>;\n details: Map<string | number, number>;\n sum: number;\n count: number;\n band: [number, number];\n}\n\nconst SELECT_KEY = \"\\u0000select\";\n/** The `<colgroup>` key of the selection column. */\nexport const VIRTUAL_SELECT_COL = SELECT_KEY;\n\ninterface Model {\n n: number;\n keys: (string | number)[];\n /** Top of row i, from the top of the first group's `<tbody>`. */\n tops: Float64Array;\n /** Full height of row i (its detail row included while open). */\n h: Float64Array;\n /** Top of group g's `<tbody>`; [groups.length] is the total. */\n gTop: Float64Array;\n total: number;\n ariaRows: Int32Array;\n ariaBands: Int32Array;\n rowCount: number;\n}\n\n/** First index whose bottom is below `y` (n when none). */\nfunction firstBelow(m: Model, y: number): number {\n let lo = 0;\n let hi = m.n;\n while (lo < hi) {\n const mid = (lo + hi) >> 1;\n if (m.tops[mid] + m.h[mid] > y) hi = mid;\n else lo = mid + 1;\n }\n return lo;\n}\n\n/** One past the last index whose top is above `y`. */\nfunction lastAbove(m: Model, y: number): number {\n let lo = 0;\n let hi = m.n;\n while (lo < hi) {\n const mid = (lo + hi) >> 1;\n if (m.tops[mid] < y) lo = mid + 1;\n else hi = mid;\n }\n return lo;\n}\n\n/** The `<tbody>`s to render: the groups holding a rendered row (or the period's first\n * day, for its band), and one spacer for each run of groups in between. Pure. */\nexport function planBodies(\n m: Pick<Model, \"n\" | \"tops\" | \"h\" | \"gTop\">,\n groups: readonly VirtualGroup[],\n start: number,\n end: number,\n pinned: readonly number[],\n): VirtualBody[] {\n const rendered = new Set<number>();\n for (let i = Math.max(0, start); i < Math.min(m.n, end); i++) rendered.add(i);\n for (const p of pinned) if (p >= 0 && p < m.n) rendered.add(p);\n const sorted = [...rendered].sort((a, b) => a - b);\n // The group the window starts in, and the first day of its period.\n let anchor = -1;\n if (sorted.length > 0 && start < m.n) {\n const s = Math.max(0, start);\n const g = groups.findIndex((gr) => s >= gr.start && s < gr.end);\n if (g >= 0) anchor = groups[g].first;\n }\n const bottom = (i: number) => m.tops[i] + m.h[i];\n const out: VirtualBody[] = [];\n let k = 0;\n let skippedFrom = -1;\n const flushSkipped = (upTo: number) => {\n if (skippedFrom < 0) return;\n out.push({ kind: \"spacer\", key: `vs:${skippedFrom}`, height: m.gTop[upTo] - m.gTop[skippedFrom] });\n skippedFrom = -1;\n };\n groups.forEach((g, gi) => {\n while (k < sorted.length && sorted[k] < g.start) k++;\n const items: VirtualItem[] = [];\n let prevBottom = m.tops[g.start] ?? m.gTop[gi + 1];\n let any = false;\n while (k < sorted.length && sorted[k] < g.end) {\n const i = sorted[k++];\n const gap = m.tops[i] - prevBottom;\n if (gap > 0.01) items.push({ kind: \"gap\", key: `gap:${i}`, height: gap });\n items.push({ kind: \"row\", index: i });\n prevBottom = bottom(i);\n any = true;\n }\n if (!any && gi !== anchor) {\n if (skippedFrom < 0) skippedFrom = gi;\n return;\n }\n flushSkipped(gi);\n const rest = m.gTop[gi + 1] - prevBottom;\n if (rest > 0.01) items.push({ kind: \"gap\", key: `gap:end:${gi}`, height: rest });\n out.push({ kind: \"group\", group: gi, items });\n });\n flushSkipped(groups.length);\n return out;\n}\n\nexport function useRowWindow<T>({\n enabled,\n rows,\n rowKey,\n groups,\n expanded,\n pinnedKeys,\n scrollerRef,\n tableRef,\n options,\n compact,\n rowsBefore,\n rowsAfter,\n colKeys,\n lockable,\n resetKey,\n}: {\n enabled: boolean;\n /** The rows on screen, in order. */\n rows: readonly T[];\n rowKey: (row: T) => string | number;\n groups: readonly VirtualGroup[];\n /** Indices of the open rows: always rendered, their detail rows counted. */\n expanded: readonly number[];\n /** Keys always rendered (the roving tab stop). */\n pinnedKeys: readonly (string | number | null)[];\n scrollerRef: RefObject<HTMLElement | null>;\n tableRef: RefObject<HTMLTableElement | null>;\n options: DataTableVirtualize;\n compact: boolean;\n /** Rows above the first group: the header, the leading row. */\n rowsBefore: number;\n /** Rows after the last: the totals row. */\n rowsAfter: number;\n /** The header cells' keys, in order (the selection column as {@link VIRTUAL_SELECT_COL}). */\n colKeys: readonly string[];\n /** The keys whose width is locked (not a `grow` column, not a user-resized one). */\n lockable: ReadonlySet<string>;\n /** Anything that re-measures the column widths from scratch when it changes. */\n resetKey: string;\n}): RowWindow | null {\n const overscan = Math.max(1, options.overscan ?? 12);\n const estimate = options.estimateRowHeight ?? (compact ? 29 : 37);\n const n = rows.length;\n\n const [measured, setMeasured] = useState<Measured>(() => ({\n heights: new Map(),\n details: new Map(),\n sum: 0,\n count: 0,\n band: [estimate, estimate * 0.8],\n }));\n // A screenful of rows and the overscan: what the window draws before it has looked.\n const screenful = () =>\n Math.min(\n n,\n Math.ceil((typeof window === \"undefined\" ? 800 : Math.min(window.innerHeight || 800, 1600)) / estimate) +\n overscan,\n );\n const [range, setRange] = useState(() => ({ start: 0, end: screenful() }));\n const [focusTarget, setFocusTarget] = useState<number | null>(null);\n const [focusKey, setFocusKey] = useState<string | number | null>(null);\n const [scrollerWidth, setScrollerWidth] = useState(0);\n const [lock, setLock] = useState<{ sig: string; widths: Record<string, number> } | null>(null);\n const naturalOverflow = useRef(false);\n\n const expandedSig = expanded.join(\",\");\n // The groups by what they say, not by identity (0.52 code review, data-table.tsx): the\n // table builds them afresh on every render, and the model — `rowKey` on every row, and\n // its arrays — was rebuilt with them: 3000 rows, ~6000 `rowKey` calls per arrow step.\n const groupsSig = groups.map((g) => `${g.start}:${g.end}:${g.bands.join(\".\")}:${g.first}`).join(\",\");\n const model = useMemo<Model | null>(() => {\n if (!enabled) return null;\n const keys = rows.map(rowKey);\n const avg = measured.count > 0 ? measured.sum / measured.count : estimate;\n const open = new Set(expanded);\n const h = new Float64Array(n);\n for (let i = 0; i < n; i++) {\n h[i] = (measured.heights.get(keys[i]) ?? avg) + (open.has(i) ? (measured.details.get(keys[i]) ?? 0) : 0);\n }\n const tops = new Float64Array(n + 1);\n const gTop = new Float64Array(groups.length + 1);\n const ariaRows = new Int32Array(n);\n const ariaBands = new Int32Array(groups.length * 2);\n let y = 0;\n let aria = rowsBefore + 1;\n groups.forEach((g, gi) => {\n gTop[gi] = y;\n for (const level of g.bands) {\n y += measured.band[level - 1];\n ariaBands[gi * 2 + level - 1] = aria++;\n }\n for (let i = g.start; i < g.end; i++) {\n tops[i] = y;\n y += h[i];\n ariaRows[i] = aria++;\n if (open.has(i)) aria++;\n }\n });\n gTop[groups.length] = y;\n tops[n] = y;\n return { n, keys, tops, h, gTop, total: y, ariaRows, ariaBands, rowCount: aria - 1 + rowsAfter };\n // `expanded` and `groups` by their signatures.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [enabled, rows, rowKey, groupsSig, expandedSig, measured, estimate, n, rowsBefore, rowsAfter]);\n\n // Rows that arrive in a window set for fewer are drawn in the render they arrive in, a\n // screenful of them (keksdose register fit, 0.51.2 leftovers). The range is the last\n // `update`'s, and a table mounted while its rows loaded had none: it drew the tab stop's\n // row alone, and the rows came a frame later, once `update` had looked at the scroller.\n // So the fit, which measures in the commit that brings new rows, measured a table without\n // them; the rows then widened it, its ResizeObserver re-fitted it only after a painted\n // frame (keksdose: too wide for 31–215 ms in 21 of 30 loads), and WHICH rows came hung on\n // the scroller's height at that frame — whether the tiles above it had arrived: 48 or 52\n // rows in keksdose's loads, 33 or 35 in scripts/register-fit-frames.mjs's, and a wide cell\n // in between chose the columns. A screenful from the window's height is the same on every\n // load, and `update` keeps it while it covers the view. Adjusted during render (React's\n // \"storing information from previous renders\"): an effect would paint the empty window.\n const dataSig = n > 0 && model ? `${n}:${String(model.keys[0])}:${String(model.keys[n - 1])}` : \"0\";\n const [rangeData, setRangeData] = useState(dataSig);\n if (enabled && rangeData !== dataSig) {\n setRangeData(dataSig);\n const fill = screenful();\n if (Math.min(range.end, n) - Math.min(range.start, n) < fill) {\n // From where it was, as far as the rows go: a list cut short by a filter is drawn\n // to its end, where the scroller, clamped, now shows it.\n const from = Math.max(0, Math.min(range.start, n - fill));\n setRange({ start: from, end: from + fill });\n }\n }\n\n // The rows outside the range that stay: open rows, the tab stop, the focused row and\n // the keyboard's target.\n const pinned = useMemo(() => {\n if (!model) return [];\n const out = [...expanded];\n for (const key of [...pinnedKeys, focusKey]) {\n if (key === null) continue;\n const i = model.keys.indexOf(key);\n if (i >= 0) out.push(i);\n }\n if (focusTarget !== null) out.push(focusTarget);\n return out;\n }, [model, expanded, pinnedKeys, focusKey, focusTarget]);\n const pinnedSig = pinned.join(\",\");\n\n const start = Math.min(range.start, n);\n const end = Math.min(range.end, n);\n const bodies = useMemo(\n () => (model ? planBodies(model, groups, start, end, pinned) : []),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [model, groupsSig, start, end, pinnedSig],\n );\n\n const lockSig = `${resetKey}|${scrollerWidth}|${colKeys.join(\",\")}`;\n // A lock is the table it was measured on, so it goes as soon as the signature moves on\n // — not merely set aside until the signature comes BACK (0.51, keksdose N2). The fit\n // leaves a column out and, measuring the table afresh without it, brings it back in the\n // same frame, before this hook measures anything: the signature was then the old one\n // again, and the column came back at the widths that had ratcheted up while rows\n // scrolled (a wider cell widens its column once), 80–110px more than the fit had just\n // measured (606 + 93 estimated, 778–812 drawn, at 757), and B2's guard kept it out\n // although it fitted. Dropped here, the table it comes back to is drawn as measured,\n // and the next frame locks that. Adjusted during render, as React's \"storing\n // information from previous renders\": an effect would draw the stale widths first.\n // (c53c692; reverted in 0.51.1 when keksdose's register overflowed on load, which\n // 0.50.1 did as well — the rows came a frame after the fit, 0.51.2 and the screenful\n // above. Back since the 0.51.2 leftovers, measured: scripts/register-fit-frames.mjs\n // `--scenario edit`, a refetch after a scroll, left Accounts out on 10 of 18 runs\n // where a fresh load of the same rows drew it; with the drop, 0 of 18, and the loads\n // are as they were.)\n if (lock !== null && lock.sig !== lockSig) setLock(null);\n const colWidths = lock && lock.sig === lockSig ? lock.widths : null;\n\n // What the scroll handler and the frame's measure read: this render's model and lock.\n const latest = useRef({ model, colWidths, lockSig, colKeys, lockable, overscan });\n useLayoutEffect(() => {\n latest.current = { model, colWidths, lockSig, colKeys, lockable, overscan };\n });\n\n // Which rows the visible part of the scroller (and of the window, for a table in a page\n // that scrolls) shows, and a new range around them when the rendered one no longer\n // covers them. Read from the client rects, which a scroll leaves laid out.\n const update = useCallback(() => {\n const { model: m, overscan: over } = latest.current;\n const sc = scrollerRef.current;\n const table = tableRef.current;\n if (!m || !sc || !table) return;\n const origin = table.querySelector<HTMLElement>(\":scope > tbody[data-vt-body]\");\n if (!origin) return;\n const sr = sc.getBoundingClientRect();\n const top = Math.max(sr.top, 0);\n const bottom = Math.min(sr.bottom, window.innerHeight || sr.bottom);\n if (!(bottom > top)) return;\n const o = origin.getBoundingClientRect().top;\n const a = Math.min(firstBelow(m, top - o), m.n);\n const b = Math.max(a, Math.min(lastAbove(m, bottom - o), m.n));\n setRange((prev) =>\n prev.start <= a && prev.end >= b && prev.end <= m.n && prev.end - prev.start <= b - a + 4 * over\n ? prev\n : { start: Math.max(0, a - over), end: Math.min(m.n, b + over) },\n );\n }, [scrollerRef, tableRef]);\n\n // After a render that changed what is drawn: measure the rendered rows and bands, and\n // the header cells for the lock. Not after a render that only ticked a box. In the next\n // animation frame rather than in the commit: there the browser lays the table out once\n // for the frame anyway, where a read in the commit forced a layout of its own, and the\n // re-render the heights cause forced another (Chromium, 3000 rows: 35–130 ms of forced\n // layout per scrolled step, against one layout per frame now).\n const measure = useCallback(() => {\n const { model: m, colWidths: locked, lockSig: sig, colKeys: cols, lockable: lockKeys } = latest.current;\n const table = tableRef.current;\n const sc = scrollerRef.current;\n if (!m || !table || !sc) return;\n const trs = table.rows;\n const rects = Array.from(trs, (tr) => tr.getBoundingClientRect());\n const rowSamples: [string | number, number][] = [];\n const detailSamples: [string | number, number][] = [];\n const bandSamples: [0 | 1, number][] = [];\n for (let k = 0; k < trs.length; k++) {\n const own = rects[k];\n const next = rects[k + 1];\n // The distance to the next row's top: exact under collapsed borders.\n const h = next && next.top > own.top ? next.top - own.top : own.height;\n if (!(h > 0)) continue;\n const ds = trs[k].dataset;\n if (ds.rowIndex !== undefined) {\n const key = m.keys[Number(ds.rowIndex)];\n if (key !== undefined) rowSamples.push([key, h]);\n } else if (ds.rowDetail !== undefined) {\n const key = m.keys[Number(ds.rowDetail)];\n if (key !== undefined) detailSamples.push([key, h]);\n } else if (ds.groupRow === \"1\" || ds.groupRow === \"2\") {\n bandSamples.push([ds.groupRow === \"1\" ? 0 : 1, h]);\n }\n }\n if (rowSamples.length + detailSamples.length + bandSamples.length > 0) {\n setMeasured((prev) => {\n let { heights, details, sum, count } = prev;\n let band = prev.band;\n for (const [key, h] of rowSamples) {\n const old = heights.get(key);\n if (old !== undefined && Math.abs(old - h) <= 0.5) continue;\n if (heights === prev.heights) heights = new Map(heights);\n heights.set(key, h);\n sum += h - (old ?? 0);\n if (old === undefined) count++;\n }\n for (const [key, h] of detailSamples) {\n const old = details.get(key);\n if (old !== undefined && Math.abs(old - h) <= 0.5) continue;\n if (details === prev.details) details = new Map(details);\n details.set(key, h);\n }\n for (const [level, h] of bandSamples) {\n if (Math.abs(band[level] - h) <= 0.5) continue;\n band = level === 0 ? [h, band[1]] : [band[0], h];\n }\n return heights === prev.heights && details === prev.details && band === prev.band\n ? prev\n : { heights, details, sum, count, band };\n });\n }\n // The column lock.\n const cells = table.tHead?.rows[0]?.cells;\n if (!cells || cells.length !== cols.length) return;\n const widths: Record<string, number> = {};\n let anyWidth = false;\n for (let c = 0; c < cells.length; c++) {\n if (!lockKeys.has(cols[c])) continue;\n const w = cells[c].getBoundingClientRect().width;\n if (w > 0) {\n widths[cols[c]] = w;\n anyWidth = true;\n }\n }\n if (!anyWidth) return;\n const over = table.getBoundingClientRect().width > sc.clientWidth + 1;\n if (!locked) {\n naturalOverflow.current = over;\n setLock({ sig, widths });\n } else if (over && !naturalOverflow.current) {\n // A grown column pushed the table past a scroller it fit: measure afresh.\n setLock(null);\n } else {\n let grew = false;\n const merged = { ...locked };\n for (const [key, w] of Object.entries(widths)) {\n if (w > (merged[key] ?? 0) + 0.5) {\n merged[key] = w;\n grew = true;\n }\n }\n if (grew) setLock({ sig, widths: merged });\n }\n }, [scrollerRef, tableRef]);\n\n const frame = useRef(0);\n const schedule = useCallback(() => {\n if (frame.current) return;\n const run = () => {\n frame.current = 0;\n measure();\n update();\n };\n frame.current =\n typeof requestAnimationFrame === \"undefined\"\n ? -(setTimeout(run, 16) as unknown as number)\n : requestAnimationFrame(run);\n }, [measure, update]);\n useEffect(\n () => () => {\n if (frame.current > 0) cancelAnimationFrame(frame.current);\n else if (frame.current < 0) clearTimeout(-frame.current);\n frame.current = 0;\n },\n [],\n );\n\n useEffect(() => {\n if (!enabled) return;\n const onScroll = () => update();\n window.addEventListener(\"scroll\", onScroll, { capture: true, passive: true });\n window.addEventListener(\"resize\", onScroll, { passive: true });\n const sc = scrollerRef.current;\n let ro: ResizeObserver | undefined;\n if (sc && typeof ResizeObserver !== \"undefined\") {\n ro = new ResizeObserver(() => {\n setScrollerWidth(Math.round(sc.clientWidth));\n update();\n });\n ro.observe(sc);\n }\n return () => {\n window.removeEventListener(\"scroll\", onScroll, { capture: true });\n window.removeEventListener(\"resize\", onScroll);\n ro?.disconnect();\n };\n }, [enabled, update, scrollerRef]);\n\n // The row holding the focus (a row, or a control in it or in its open detail) stays.\n useEffect(() => {\n const table = tableRef.current;\n if (!enabled || !table) return;\n const onIn = (e: FocusEvent) => {\n const tr = ownRowOf(table, e.target as Element | null);\n const index = tr ? Number(tr.dataset.rowIndex ?? tr.dataset.rowDetail) : NaN;\n const key = Number.isNaN(index) ? undefined : latest.current.model?.keys[index];\n setFocusKey(key ?? null);\n setFocusTarget(null);\n };\n const onOut = (e: FocusEvent) => {\n const to = e.relatedTarget as Node | null;\n if (!to || !table.contains(to)) setFocusKey(null);\n };\n table.addEventListener(\"focusin\", onIn);\n table.addEventListener(\"focusout\", onOut);\n return () => {\n table.removeEventListener(\"focusin\", onIn);\n table.removeEventListener(\"focusout\", onOut);\n };\n }, [enabled, tableRef]);\n\n const renderSig = `${start}:${end}:${dataSig}:${expandedSig}:${pinnedSig}:${lockSig}:${colWidths ? 1 : 0}`;\n const lastRender = useRef(\"\");\n useLayoutEffect(() => {\n if (!enabled || lastRender.current === renderSig) return;\n lastRender.current = renderSig;\n schedule();\n });\n\n // A new layout (heights measured, rows added): the range may no longer cover the view.\n const total = model?.total ?? 0;\n useLayoutEffect(() => {\n if (enabled) schedule();\n }, [enabled, schedule, total, n]);\n\n // The keyboard's target: rendered (pinned), then focused — its focus scrolls it into\n // view, and the scroll renders the rows around it.\n useLayoutEffect(() => {\n if (focusTarget === null) return;\n // Released by the focus it receives (the `focusin` above), which pins it as the\n // focused row from then on.\n const table = tableRef.current;\n if (table) ownRowAt(table, focusTarget)?.focus();\n }, [focusTarget, bodies, tableRef]);\n\n const focusRow = useCallback(\n (i: number) => {\n const table = tableRef.current;\n const el = table && ownRowAt(table, i);\n if (el) el.focus();\n else setFocusTarget(i);\n },\n [tableRef],\n );\n\n if (!enabled || !model) return null;\n return {\n bodies,\n rowCount: model.rowCount,\n ariaRow: (i) => model.ariaRows[i],\n ariaBand: (g, level) => model.ariaBands[g * 2 + level - 1],\n colWidths,\n focusRow,\n };\n}\n\n// The window's rows are the table's OWN (0.52 code review, data-table-row.tsx): every\n// desktop row carries `data-row-index` since DSP-4, a nested DataTable's in an open row\n// too, and a lookup over the whole subtree answered for the outer table with the nested\n// one's rows — ArrowDown from row 0 went to the nested row 1, the first in document order.\n\n/** This table's row at `index`, if it is drawn. */\nfunction ownRowAt(table: HTMLTableElement, index: number): HTMLElement | null {\n return table.querySelector<HTMLElement>(`:scope > tbody > tr[data-row-index=\"${index}\"]`);\n}\n\n/** This table's row (or open detail row) that holds `node` — past a nested table's own. */\nfunction ownRowOf(table: HTMLTableElement, node: Element | null): HTMLElement | null {\n const ROW = \"tr[data-row-index], tr[data-row-detail]\";\n for (let tr = node?.closest?.<HTMLElement>(ROW) ?? null; tr; tr = tr.parentElement?.closest<HTMLElement>(ROW) ?? null)\n if (tr.parentElement?.parentElement === table) return tr;\n return null;\n}\n\n/** The roving rows' Arrow/Home/End target over ALL the rows, rendered or not. */\nexport function rowNavTarget(from: number, key: string, n: number): number | null {\n if (n === 0) return null;\n if (key === \"ArrowDown\") return Math.min(n - 1, from + 1);\n if (key === \"ArrowUp\") return Math.max(0, from - 1);\n if (key === \"Home\") return 0;\n if (key === \"End\") return n - 1;\n return null;\n}\n"],"mappings":";AAAA,SAAS,aAAa,WAAW,iBAAiB,SAAS,QAAQ,gBAAgB;AAyFnF,MAAM,aAAa;AAEZ,MAAM,qBAAqB;AAkBlC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MAAI,QAAQ,YAAa,QAAO,KAAK,IAAI,IAAI,GAAG,OAAO,CAAC;AACxD,MAAI,QAAQ,UAAW,QAAO,KAAK,IAAI,GAAG,OAAO,CAAC;AAClD,MAAI,QAAQ,OAAQ,QAAO;AAC3B,MAAI,QAAQ,MAAO,QAAO,IAAI;AAC9B,SAAO;AACT;","names":[]}
@@ -5,6 +5,7 @@ import { Calendar, X } from "lucide-react";
5
5
  import { cn } from "../lib/cn.js";
6
6
  import { dirOf } from "../lib/direction.js";
7
7
  import { formatIsoDate } from "../lib/dates.js";
8
+ import { returnFocus } from "../lib/focus-left.js";
8
9
  import {
9
10
  DEFAULT_DATE_PICKER_LABELS,
10
11
  DEFAULT_PICKER_SHEET_LABELS,
@@ -62,8 +63,7 @@ function DateFieldTrigger({
62
63
  const justClosed = wasOpen.current && !open;
63
64
  wasOpen.current = open;
64
65
  if (!justClosed) return;
65
- const active = document.activeElement;
66
- if (!active || active === document.body) triggerRef.current?.focus();
66
+ returnFocus({ opener: triggerRef.current });
67
67
  }, [open, triggerRef]);
68
68
  useLayoutEffect(() => {
69
69
  if (!fieldRef) return;