flexdesk 0.4.7 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1036 -301
- package/css/base.css +2958 -2
- package/css/flexdesk.css +2962 -4
- package/css/overrides.css +4 -2
- package/css/tokens.css +86 -0
- package/dist/canvas.js +390 -0
- package/dist/canvas.js.map +7 -0
- package/dist/charts.js +782 -782
- package/dist/{chunk-LH5TSOZW.js → chunk-6JSOVNID.js} +42 -2
- package/dist/{chunk-LH5TSOZW.js.map → chunk-6JSOVNID.js.map} +3 -3
- package/dist/{chunk-ELXVW542.js → chunk-6NG7YVBG.js} +3 -471
- package/dist/chunk-6NG7YVBG.js.map +7 -0
- package/dist/{chunk-F5FYDCOA.js → chunk-CNXP3SIN.js} +2373 -2373
- package/dist/{chunk-F5FYDCOA.js.map → chunk-CNXP3SIN.js.map} +7 -7
- package/dist/chunk-H4LT43RS.js +475 -0
- package/dist/chunk-H4LT43RS.js.map +7 -0
- package/dist/{chunk-WMGOJ3I6.js → chunk-KH2GJTKR.js} +3702 -2628
- package/dist/chunk-KH2GJTKR.js.map +7 -0
- package/dist/chunk-SN4LSOAR.js +532 -0
- package/dist/chunk-SN4LSOAR.js.map +7 -0
- package/dist/flexdesk.css +2962 -4
- package/dist/flow.js +10030 -0
- package/dist/flow.js.map +7 -0
- package/dist/tiles.js +2195 -2195
- package/dist/tokens.css +86 -0
- package/dist/widgets.js +5824 -5796
- package/dist/widgets.js.map +1 -1
- package/dist/wm.js +8077 -8074
- package/dist/wm.js.map +7 -7
- package/package.json +89 -81
- package/src/canvas/canvas_adapter.js +523 -0
- package/src/canvas/edge_router.js +392 -0
- package/src/canvas/graph/connector_router.js +189 -0
- package/src/canvas/graph/history_service.js +170 -0
- package/src/canvas/graph/node_platform.js +116 -0
- package/src/canvas/index.js +16 -0
- package/src/flow/canvas_editor/editor.js +1081 -0
- package/src/flow/canvas_editor/index.js +16 -0
- package/src/flow/canvas_editor/layout.js +118 -0
- package/src/flow/canvas_editor/strings.js +37 -0
- package/src/flow/kit/always_before.js +325 -0
- package/src/flow/kit/catalogue.js +170 -0
- package/src/flow/kit/chip_input.js +461 -0
- package/src/flow/kit/dom.js +205 -0
- package/src/flow/kit/findings.js +129 -0
- package/src/flow/kit/history.js +173 -0
- package/src/flow/kit/index.js +38 -0
- package/src/flow/kit/keys.js +127 -0
- package/src/flow/kit/logic_graph.js +210 -0
- package/src/flow/kit/references.js +199 -0
- package/src/flow/kit/settings_panel.js +357 -0
- package/src/flow/kit/settings_schema.js +175 -0
- package/src/flow/kit/step_picker.js +209 -0
- package/src/flow/kit/strings.js +102 -0
- package/src/flow/kit/value_picker.js +238 -0
- package/src/flow/kit/widgets.js +763 -0
- package/src/flow/lanes/editor.js +1469 -0
- package/src/flow/lanes/index.js +26 -0
- package/src/flow/lanes/layout.js +525 -0
- package/src/flow/lanes/pipeline.js +327 -0
- package/src/flow/lanes/preview.js +109 -0
- package/src/flow/lanes/strings.js +98 -0
- package/src/flow/outline/editor.js +1511 -0
- package/src/flow/outline/index.js +20 -0
- package/src/flow/outline/mapping.js +286 -0
- package/src/flow/outline/menu.js +154 -0
- package/src/flow/outline/operations.js +738 -0
- package/src/flow/outline/recognise.js +755 -0
- package/src/flow/outline/strings.js +135 -0
- package/src/tiling/landing_table.js +13 -5
- package/src/tiling/wm.js +3916 -3916
- package/src/ui/components/data_table.js +4205 -3294
- package/src/ui/components/row_activation.js +70 -0
- package/src/ui/components/table_values.js +423 -0
- package/dist/chunk-ELXVW542.js.map +0 -7
- package/dist/chunk-WMGOJ3I6.js.map +0 -7
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/ui/utils/raf_resize_observer.js", "../src/ui/components/data_table.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * rAF-coalesced ResizeObserver.\n *\n * Running layout-mutating work \u2014 `Plotly.Plots.resize()`, Monaco's\n * `editor.layout()`, a canvas resize, or a re-render \u2014 *synchronously* inside a\n * ResizeObserver callback makes the engine emit the (spec-defined, benign but\n * console-error-level) \"ResizeObserver loop completed with undelivered\n * notifications\" warning: the callback mutates layout, which produces more\n * resize notifications it can't deliver in the same dispatch.\n *\n * Deferring the work to the next animation frame is the root-cause fix \u2014 the\n * engine delivers all pending notifications first, so there's nothing left\n * \"undelivered\" \u2014 and coalescing collapses a burst of resize events into a\n * single render.\n *\n * @param {(entries: ResizeObserverEntry[]) => void} callback\n * @returns {ResizeObserver}\n */\nexport function createRafResizeObserver(callback) {\n let scheduled = false;\n let latestEntries = [];\n return new ResizeObserver((entries) => {\n latestEntries = entries;\n if (scheduled) return;\n scheduled = true;\n requestAnimationFrame(() => {\n scheduled = false;\n callback(latestEntries);\n });\n });\n}\n", "/**\n * data_table.js\n *\n * Unified, reusable data table component with support for:\n * - Pagination (first/prev/next/last/jump to row)\n * - Row selection (single, range with Shift, toggle with Ctrl/Cmd)\n * - Keyboard shortcuts (Ctrl+A, Ctrl+C, Shift+Ctrl+C, Esc)\n * - Context menu (copy as TSV/CSV)\n * - Column sorting (internal or external via callback)\n * - Column drag-to-resize, and double-click-to-auto-size on the same grip\n * - Per-column filtering (numeric operators, text substring)\n * - Column type detection (numeric/text alignment)\n * - Header icons\n * - Read-only mode\n * - CSV download through the host port (native save dialog), with a\n * Blob + <a download> fallback when no host is supplied\n *\n * Used by: DataPage, PlotPopoutWindow, StatisticsTable, Import Wizard\n */\n\nimport { createRafResizeObserver } from '../utils/raf_resize_observer.js';\n\nconst DEFAULT_PAGE_SIZE = 100;\n\n/** How wide auto-sizing a column is allowed to make it.\n *\n * 520px, which is `_fitColumnWidths`' FIRST_CAP \u2014 the most generous ceiling\n * this file already sanctions for a single column. Auto-size is an explicit\n * gesture asking to see a column's content, so it is not held to the tighter\n * 360px the automatic fit pass applies to the columns it is squeezing; but it\n * is held to SOMETHING, because one 4,000-character note in one cell would\n * otherwise produce a column nobody can scroll past. */\nconst AUTOSIZE_MAX_PX = 520;\n\n/**\n * Configuration options for DataTable\n * @typedef {Object} DataTableConfig\n * @property {string[]} headers - Column headers\n * @property {Array<Array>} rows - Row data (array of arrays)\n * @property {number} [pageSize=100] - Rows per page\n * @property {boolean} [pagination=true] - Enable pagination controls\n * @property {boolean} [selectable=true] - Enable row selection\n * @property {boolean} [copyable=true] - Enable copy shortcuts and context menu\n * @property {boolean} [sortable=false] - Enable column sorting\n * @property {boolean} [filterable=false] - Enable per-column filter inputs\n * @property {boolean} [readonly=false] - Read-only mode (no selection/hover effects)\n * @property {boolean} [showRowNumbers=false] - Show row number column\n * @property {string} [emptyMessage='No data'] - Message when no data\n * @property {Function} [onSort] - Callback when sort changes: (column, ascending) => void\n * @property {boolean} [resetPageOnSort=false] - A client-paged table goes back to its first page on every `sortBy()` (a header click included), the way a new filter already does: on page 3, a new order otherwise draws rows 201\u2013300 OF THE NEW ORDER under \"Page 3 of 3\", which reads as \"it only sorted this page\". OFF by default: before this key existed a sort kept the page, and a table that does not ask keeps that. Server-side paging is untouched either way \u2014 its page is the consumer's `offset`, which `sortBy` never reads or writes.\n * @property {Function} [onSelectionChange] - Callback when selection changes: (selectedIndices) => void\n * @property {Function} [formatValue] - Custom value formatter: (value, colIndex) => string\n * @property {Function} [getHeaderIcon] - Get icon for header: (header, colIndex) => {icon, title}\n * @property {Function} [getColumnType] - Get column type: (colIndex, rows) => 'num'|'text'\n * @property {Object} [services] - App services { eventBus, logger } for notifications\n * @property {number} [totalCount] - Total row count for server-side pagination (when rows only contains current page)\n * @property {number} [offset=0] - Current offset for server-side pagination\n * @property {Function} [onPageChange] - Callback for server-side pagination: (offset, limit) => void\n * @property {Function} [onJumpToRow] - Callback for jump to row: (rowIndex) => void\n * @property {Function} [renderCell] - Custom cell renderer: (td, value, colIdx, rowIdx, row) => boolean (return true if handled)\n * @property {'normal'|'compact'} [mode='normal'] - Rendering density. 'compact' adds `data-table-component--compact` to the wrapper (tighter padding + smaller font for the bottom-panel use case).\n * @property {Function} [onRowClick] - Row click handler: (rowIdx, row, ev) => void. Receives the original (unfiltered) row index.\n * @property {Function} [onRowContextMenu] - Row right-click handler: (rowIdx, row, ev) => void. Fires before the default context menu; call ev.preventDefault() to suppress the default.\n * @property {Function} [onCellContextMenu] - Cell right-click handler: (colIdx, rowIdx, value, td, ev) => void. Fires before onRowContextMenu; same suppression semantics.\n * @property {boolean} [showExportButton=false] - Adds a \"CSV\" download button to the pagination strip that invokes `downloadCSV()`.\n * @property {Object} [host] - A Host (see ui/js/host/host.js). Its `dialogs` capability backs `downloadCSV()`'s native save dialog; without it CSV export falls back to a Blob download.\n * @property {Object} [stateStore] - `{ ready(), get(key), set(key, state) }` \u2014 REQUIRED when `persistKey` is set. Built by `createTableStateStore()`.\n * @property {'container'|'content'} [columnFit='container'] - How the automatic fit pass sizes a column the user has NOT dragged. 'container' squeezes every column into the wrap: a 360px cap, a more generous one for the first column, and water-fill-shrink toward the 40px floor when they do not fit. 'content' sizes each column to its own content through the same `_autoWidth` a grip double-click uses (520px cap) and lets the body scroll sideways rather than squeezing. A pinned column is honoured verbatim under both.\n * @property {boolean|{overscan?: number, rowHeight?: number}} [virtualize=false] - C10. Draw only the rows near the viewport, between a top and a bottom spacer row, and give the body table a `<colgroup>` so its column widths no longer come from whichever row happens to be first. OFF by default: nothing about a table that does not ask changes. `overscan` (rows drawn beyond each edge, default 20) and `rowHeight` (the estimate used until a real row has been measured, default 24) tune it. See `_virtUpdate` for the whole contract.\n * @property {Function} [virtualRowHeight] - `(rowIndex, baseHeight) => number`. Under `virtualize`, the height a row occupies, including anything the embedder injects in front of it (a group header) \u2014 and 0 for a row the embedder hides, which is then not drawn at all. Absent: every row is `baseHeight`, which is measured from a real row.\n * @property {Function} [onRowsRendered] - `({ rows, removed }) => void`. Under `virtualize`, called whenever the window changes after `render()` returned: `rows` are the `<tr>`s the virtualiser ADDED \u2014 the rows an embedder that decorates rows after a render would otherwise never see \u2014 and `removed` the ones it took OUT, already detached (an embedder that injected rows of its own beside them, or holds an editor in one, has to hear that they went). The rows present when `render()` returns are not reported: they are the render's, exactly as without `virtualize`.\n */\n\n/** C10. When the scroll box has no layout \u2014 mounted hidden, or a DOM with no\n * layout engine \u2014 there is no viewport to measure, so the window is sized as if\n * it were this tall. A ResizeObserver corrects it the moment a real size exists. */\nconst VIRTUAL_FALLBACK_VIEWPORT_PX = 1000;\n\nexport class DataTable {\n /**\n * Create a DataTable instance\n * @param {HTMLElement} container - Container element to render into\n * @param {DataTableConfig} config - Configuration options\n */\n constructor(container, config = {}) {\n this.container = container;\n this.config = {\n headers: [],\n rows: [],\n pageSize: DEFAULT_PAGE_SIZE,\n pagination: true,\n selectable: true,\n copyable: true,\n sortable: false,\n filterable: false,\n readonly: false,\n showRowNumbers: false,\n emptyMessage: 'No data',\n onSort: null,\n // OFF unless asked for, for `columnFit`'s reason below: a sort kept\n // the client-side page before this key existed, so turning the\n // reset on for everybody would change every paged table that never\n // asked. See the typedef.\n resetPageOnSort: false,\n onSelectionChange: null,\n formatValue: null,\n getHeaderIcon: null,\n getColumnType: null,\n services: null,\n // Server-side pagination\n totalCount: null,\n offset: 0,\n onPageChange: null,\n onJumpToRow: null,\n // Custom cell rendering\n renderCell: null,\n // Rendering density + bottom-panel hooks (P2)\n mode: 'normal',\n onRowClick: null,\n onRowContextMenu: null,\n onCellContextMenu: null,\n showExportButton: false,\n // The host port. TOP LEVEL, deliberately \u2014 NOT inside `services`,\n // which most call sites never pass. Supplies the native save\n // dialog for downloadCSV(); absent => Blob fallback.\n host: null,\n // Opt-in persistence: when set, this table's sort, filters, and\n // column widths survive teardown/reload, keyed by this string\n // inside the injected `stateStore`. Omit it and the table stays\n // ephemeral. WHERE the store persists is the embedder's business.\n persistKey: null,\n stateStore: null,\n // How the automatic fit pass sizes an undragged column \u2014 see the\n // typedef. 'container' is exactly what every consumer got before\n // this key existed, so the default is not a preference: it is the\n // promise that adding the key changed no existing layout by a\n // pixel. Only a consumer that asks for 'content' sees anything new.\n columnFit: 'container',\n // C10. Off unless asked for \u2014 see the typedef.\n virtualize: false,\n virtualRowHeight: null,\n onRowsRendered: null,\n ...config,\n };\n\n // C10. The render window, or null when this table draws every row.\n this._virt = null;\n // The measured row height outlives a render, so a re-render does not\n // start again from the estimate and jump once it has re-measured.\n this._virtBase = null;\n\n // A persistKey with nowhere to persist is a wiring bug, not a\n // degraded mode. Fail loud at construction: a silent no-op here\n // reads as \"my filters randomly stopped sticking\" months later.\n if (this.config.persistKey && !this.config.stateStore) {\n throw new Error(`DataTable: persistKey \"${this.config.persistKey}\" requires { stateStore }`);\n }\n\n // State\n this._state = {\n offset: 0,\n selected: new Set(),\n anchorIndex: null,\n sortColumn: null,\n sortAscending: true,\n filters: new Map(),\n };\n\n // Column types cache\n this._columnTypes = [];\n\n // Processed rows cache (filtered + sorted)\n this._processedRows = null;\n this._processedIndexMap = null;\n this._filterDebounceTimer = null;\n\n // DOM references\n this._wrapperEl = null;\n this._paginationEl = null;\n this._tableEl = null;\n this._tbodyEl = null;\n this._contextMenuEl = null;\n this._filterDropdownEl = null;\n this._filterDropdownCleanup = null;\n\n // User column-resize overrides, keyed by DOM column index (the\n // row-number column, when shown, is index 0). Persists across\n // re-renders; reset when the header signature changes.\n this._colWidths = {};\n this._colWidthsSig = null;\n\n // Event cleanup\n this._disposers = [];\n this._contextMenuGlobals = [];\n\n // Persistence: seed from whatever's already cached, then \u2014 once\n // the on-disk blob has loaded \u2014 re-apply and re-render if state\n // arrived after this table first painted.\n if (this.config.persistKey) {\n const store = this.config.stateStore;\n this._restorePersisted(store.get(this.config.persistKey));\n store.ready().then(() => {\n const late = store.get(this.config.persistKey);\n if (late && this._restorePersisted(late) && this._wrapperEl) {\n this._invalidateProcessedCache?.();\n this.render();\n }\n });\n }\n }\n\n /** Apply a persisted blob ({sort, asc, filters, widths}) onto this\n * table's live state. Returns true if anything was applied. */\n _restorePersisted(blob) {\n if (!blob) return false;\n let applied = false;\n if (typeof blob.sortColumn === 'number' || blob.sortColumn === null) {\n this._state.sortColumn = blob.sortColumn;\n this._state.sortAscending = blob.sortAscending !== false;\n applied = true;\n }\n if (Array.isArray(blob.filters)) {\n this._state.filters = new Map(blob.filters);\n applied = true;\n }\n if (blob.colWidths && typeof blob.colWidths === 'object') {\n // Stored under string keys (JSON) \u2192 coerce back to ints.\n this._colWidths = {};\n for (const [k, v] of Object.entries(blob.colWidths)) {\n this._colWidths[Number(k)] = v;\n }\n // Stamp the matching signature so the next render keeps these\n // widths instead of treating them as stale.\n this._colWidthsSig = this._colSig();\n applied = true;\n }\n return applied;\n }\n\n /** Identity of the current column set \u2014 restored widths/sort are\n * keyed by position, so a schema change invalidates them. */\n _colSig() {\n return (this.config.headers || []).join('\\x01')\n + (this.config.showRowNumbers ? '|#' : '');\n }\n\n /** Snapshot the persistable slice of state to the project store.\n * No-op unless `persistKey` is set. Debounced inside the store. */\n _savePersisted() {\n if (!this.config.persistKey) return;\n this.config.stateStore.set(this.config.persistKey, {\n sortColumn: this._state.sortColumn,\n sortAscending: this._state.sortAscending,\n filters: [...this._state.filters.entries()],\n colWidths: { ...this._colWidths },\n });\n }\n\n /**\n * Update data and re-render\n * @param {Object} updates - Partial config updates (headers, rows, etc.)\n */\n setData(updates) {\n // Clear filters if headers changed\n if (updates.headers && this._state.filters.size > 0) {\n const oldHeaders = this.config.headers;\n const newHeaders = updates.headers;\n if (oldHeaders.length !== newHeaders.length ||\n oldHeaders.some((h, i) => h !== newHeaders[i])) {\n this._state.filters.clear();\n }\n }\n\n Object.assign(this.config, updates);\n\n // Reset state if rows changed\n if (updates.rows) {\n this._state.selected.clear();\n this._state.anchorIndex = null;\n if (this._state.offset >= updates.rows.length) {\n this._state.offset = 0;\n }\n this._columnTypes = this._detectColumnTypes();\n }\n\n // Invalidate processed cache\n this._processedRows = null;\n this._processedIndexMap = null;\n\n this.render();\n }\n\n /**\n * Show / hide a translucent loading overlay over the table body.\n * Used by server-side consumers between firing a fetch and\n * receiving the new rows so the UI doesn't appear frozen.\n * Callers either:\n * - call `setLoading(true)` before their fetch, `setLoading(false)` after, OR\n * - return a Promise from `onPageChange` / `onSort` callbacks\n * \u2014 the overlay auto-shows during the await.\n * @param {boolean} on\n */\n setLoading(on) {\n if (!this._wrapperEl) return;\n let overlay = this._wrapperEl.querySelector('.twm-data-table__loading');\n if (on) {\n if (!overlay) {\n overlay = document.createElement('div');\n overlay.className = 'twm-data-table__loading';\n overlay.innerHTML =\n '<div class=\"twm-data-table__spinner\"></div>';\n // Ensure positioning context.\n if (!this._wrapperEl.style.position) {\n this._wrapperEl.style.position = 'relative';\n }\n this._wrapperEl.appendChild(overlay);\n }\n } else if (overlay) {\n overlay.remove();\n }\n }\n\n /**\n * Get current selection indices\n * @returns {number[]} Array of selected row indices\n */\n getSelection() {\n return Array.from(this._state.selected).sort((a, b) => a - b);\n }\n\n /**\n * Set selection programmatically\n * @param {number[]} indices - Row indices to select\n */\n setSelection(indices) {\n this._state.selected.clear();\n for (const idx of indices) {\n if (idx >= 0 && idx < this.config.rows.length) {\n this._state.selected.add(idx);\n }\n }\n this._updateRowSelection();\n this._notifySelectionChange();\n }\n\n /**\n * Clear selection\n */\n clearSelection() {\n this._state.selected.clear();\n this._state.anchorIndex = null;\n this._updateRowSelection();\n this._notifySelectionChange();\n }\n\n /**\n * Go to specific page\n * @param {number} page - Page number (0-indexed)\n */\n goToPage(page) {\n const rowCount = this._getProcessedRows().length;\n const maxPage = Math.ceil(rowCount / this.config.pageSize) - 1;\n this._state.offset = Math.max(0, Math.min(page, maxPage)) * this.config.pageSize;\n this.render();\n }\n\n /**\n * Go to specific row\n * @param {number} rowIndex - Row index\n */\n goToRow(rowIndex) {\n const rowCount = this._getProcessedRows().length;\n const idx = Math.max(0, Math.min(rowIndex, rowCount - 1));\n this._state.offset = Math.floor(idx / this.config.pageSize) * this.config.pageSize;\n this.render();\n }\n\n /**\n * Sort by column\n * @param {number} colIndex - Column index\n * @param {boolean} [ascending] - Sort direction (toggles if same column)\n */\n sortBy(colIndex, ascending) {\n if (this._state.sortColumn === colIndex && ascending === undefined) {\n this._state.sortAscending = !this._state.sortAscending;\n } else {\n this._state.sortColumn = colIndex;\n this._state.sortAscending = ascending ?? true;\n }\n\n // Invalidate processed cache\n this._processedRows = null;\n this._processedIndexMap = null;\n // A new order starts at its first page \u2014 when the table asked for it.\n // Staying on page 3 shows rows 201\u2013300 of the NEW order, which reads as\n // \"it only sorted this page\"; but that IS what a sort did before\n // `resetPageOnSort` existed, so a table that does not ask keeps it (D6:\n // additive and back-compatible). `render()` keeps the scroll position\n // only on the same page, so the reset also starts the body at its top.\n if (this.config.resetPageOnSort) this._state.offset = 0;\n\n // Auto-spinner: if the sort handler returns a Promise (i.e.\n // it does a server-side refetch), show the loading overlay\n // until it resolves so the user gets visible feedback.\n const ret = this.config.onSort?.(colIndex, this._state.sortAscending);\n this._awaitWithSpinner(ret);\n this._savePersisted();\n this.render();\n }\n\n /** Internal: if `maybePromise` is a Promise (or thenable),\n * toggle the loading overlay around it. No-op otherwise. */\n _awaitWithSpinner(maybePromise) {\n if (!maybePromise || typeof maybePromise.then !== 'function') return;\n this.setLoading(true);\n Promise.resolve(maybePromise).finally(() => this.setLoading(false));\n }\n\n /**\n * Clear all column filters\n */\n clearFilters() {\n this._state.filters.clear();\n this._processedRows = null;\n this._processedIndexMap = null;\n this._state.offset = 0;\n this._savePersisted();\n this.render();\n }\n\n /**\n * Get the number of rows after filtering\n * @returns {number}\n */\n getFilteredRowCount() {\n return this._getProcessedRows().length;\n }\n\n /**\n * Render the table\n */\n render() {\n // Capture active filter input before re-render\n const activeFilterColIdx = this._getActiveFilterColIdx();\n // KEYBOARD FOCUS SURVIVES A RE-RENDER. Rendering replaces the table\n // element, and a focused element that is removed hands focus to the\n // page body, where the arrow keys reach nobody. A data refresh does\n // exactly that (a record changed on disk, a live reload), so keyboard\n // navigation silently died the first time the store moved.\n const doc = this.container.ownerDocument;\n const hadTableFocus = !!this._tableEl && doc?.activeElement === this._tableEl;\n // SCROLL POSITION SURVIVES A RE-RENDER, for the same reason: the scroll\n // box is rebuilt too, and a new one starts at the top. Folding a tree\n // row, or any refresh, threw a reader scrolled halfway down back to row\n // one. Only on the SAME page \u2014 turning the page should start at its top.\n const prevWrap = this._tableWrapEl;\n const prevScroll = prevWrap?.isConnected && this._renderedOffset === this._state.offset\n ? { top: prevWrap.scrollTop, left: prevWrap.scrollLeft } : null;\n\n this._cleanup();\n this.container.innerHTML = '';\n // C10. A window belongs to one tbody; `_createTable` builds a new one.\n this._virt = null;\n\n const { rows, pagination, emptyMessage } = this.config;\n\n // Drop stale column-resize overrides when the columns change \u2014\n // widths are keyed by position, so a different schema must start\n // from natural widths rather than inherit the old ones. (Restore\n // stamps the matching signature so persisted widths survive the\n // first render.)\n const colSig = this._colSig();\n if (this._colWidthsSig !== colSig) {\n this._colWidths = {};\n this._colWidthsSig = colSig;\n }\n\n // Detect column types if not cached\n if (this._columnTypes.length === 0) {\n this._columnTypes = this._detectColumnTypes();\n }\n\n // Create wrapper. Compact mode adds a modifier class that the\n // CSS uses to tighten padding + drop font size \u2014 opt-in so\n // existing landing/tab use sites stay identical.\n this._wrapperEl = document.createElement('div');\n this._wrapperEl.className = 'twm-data-table-component'\n + (this.config.mode === 'compact' ? ' twm-data-table-component--compact' : '');\n this._wrapperEl.style.cssText = 'display:flex; flex-direction:column; height:100%; min-height:0;';\n\n // Pagination (top). `_createPagination` returns null when the\n // strip would be uninformative (single page, no active filter).\n if (pagination && rows.length > 0) {\n this._paginationEl = this._createPagination();\n if (this._paginationEl) this._wrapperEl.appendChild(this._paginationEl);\n }\n\n // \u2500\u2500 Structural split: thead and tbody live in separate\n // containers so the scrollbar appears only over the body,\n // never over the header / filter row. Column widths are\n // measured from the body after layout and applied to the\n // header via `table-layout: fixed` + explicit cell widths.\n const tableWrap = document.createElement('div');\n tableWrap.className = this.config.readonly\n ? 'twm-preview-table-wrap twm-preview-table-wrap--wizard'\n : 'twm-preview-table-wrap';\n tableWrap.style.cssText = 'flex:1 1 0; min-height:0; min-width:0; overflow:auto;';\n\n if (rows.length === 0) {\n // Empty state \u2014 render the same chrome as the data table\n // (header row in its own non-scrolling wrap) followed by a\n // single virtual row spanning every column with the empty\n // message in italics. NO filter row: there's nothing to\n // filter, so it'd only mislead the user.\n const { headers, showRowNumbers } = this.config;\n const headerWrap = document.createElement('div');\n headerWrap.className = 'twm-preview-table-header-wrap';\n headerWrap.style.cssText\n = 'flex:0 0 auto; overflow:hidden; min-width:0;';\n const headerTable = document.createElement('table');\n headerTable.className = this.config.readonly\n ? 'twm-preview-table twm-preview-table--readonly'\n : 'twm-preview-table';\n const thead = document.createElement('thead');\n const tr = document.createElement('tr');\n if (showRowNumbers) {\n const th = document.createElement('th');\n th.className = 'num';\n th.textContent = '#';\n tr.appendChild(th);\n }\n headers.forEach((h, colIdx) => {\n const th = document.createElement('th');\n th.className = this._columnTypes[colIdx] || 'text';\n th.textContent = h;\n tr.appendChild(th);\n });\n thead.appendChild(tr);\n headerTable.appendChild(thead);\n headerWrap.appendChild(headerTable);\n this._wrapperEl.appendChild(headerWrap);\n this._headerWrapEl = headerWrap;\n this._headerTableEl = headerTable;\n\n // Body: one virtual row across every column with the empty\n // message in italics. Wraps in the standard scroll container\n // so the placeholder sits where data rows would.\n const bodyTable = document.createElement('table');\n bodyTable.className = headerTable.className;\n const tbody = document.createElement('tbody');\n const emptyTr = document.createElement('tr');\n emptyTr.className = 'data-preview-row data-table__empty-row';\n const colCount = headers.length + (showRowNumbers ? 1 : 0);\n const emptyTd = document.createElement('td');\n emptyTd.colSpan = colCount;\n emptyTd.style.cssText\n = 'text-align:center; font-style:italic; color:#888; padding:16px;';\n emptyTd.textContent = emptyMessage;\n emptyTr.appendChild(emptyTd);\n tbody.appendChild(emptyTr);\n bodyTable.appendChild(tbody);\n tableWrap.appendChild(bodyTable);\n this._wrapperEl.appendChild(tableWrap);\n this._tableEl = bodyTable;\n this._tableWrapEl = tableWrap;\n // No column-width sync needed \u2014 the body row has colspan=N\n // so there's nothing per-column to align against.\n } else {\n const fullTable = this._createTable();\n this._tableEl = fullTable;\n // Extract thead \u2192 header table in its own non-scrolling\n // container. The body table keeps tbody only.\n const thead = fullTable.querySelector('thead');\n if (thead) {\n const headerWrap = document.createElement('div');\n headerWrap.className = 'twm-preview-table-header-wrap';\n headerWrap.style.cssText\n = 'flex:0 0 auto; overflow:hidden; min-width:0;';\n const headerTable = document.createElement('table');\n headerTable.className = fullTable.className;\n headerTable.appendChild(thead);\n headerWrap.appendChild(headerTable);\n this._wrapperEl.appendChild(headerWrap);\n this._headerTableEl = headerTable;\n this._headerWrapEl = headerWrap;\n } else {\n this._headerTableEl = null;\n }\n tableWrap.appendChild(fullTable);\n this._wrapperEl.appendChild(tableWrap);\n }\n\n this._tableWrapEl = tableWrap;\n this.container.appendChild(this._wrapperEl);\n if (prevScroll && this._state.offset === this._renderedOffset) {\n tableWrap.scrollTop = prevScroll.top;\n tableWrap.scrollLeft = prevScroll.left;\n }\n this._renderedOffset = this._state.offset;\n\n // C10. NOW THERE IS A VIEWPORT. `_createTable` drew a window sized from\n // an estimate, before the scroll box existed; measure a real row, and\n // redraw the window for the real height and the restored scroll offset.\n // Synchronously, and not reported through `onRowsRendered`: a row present\n // when `render()` returns is the render's, as it is without `virtualize`.\n if (this._virt) {\n const onScroll = () => this._virtUpdate();\n tableWrap.addEventListener('scroll', onScroll, { passive: true });\n this._disposers.push(() => tableWrap.removeEventListener('scroll', onScroll));\n this._virtMeasure();\n this._virtUpdate({ force: true, notify: false });\n }\n\n // Sync header column widths to body after layout. Two-pass: the\n // first frame lets the browser settle natural widths from the\n // body's auto layout, then we lock both tables to those widths\n // via table-layout:fixed + explicit cell widths.\n if (this._headerTableEl && this._tableEl) {\n requestAnimationFrame(() => this._syncHeaderWidths());\n // Re-sync on container resize so columns stay aligned when\n // the parent flex / grid layout changes (window resize,\n // splitter drag, etc.).\n if (this._resizeObserver) {\n try { this._resizeObserver.disconnect(); } catch (_) {}\n }\n if (typeof ResizeObserver !== 'undefined') {\n // C10: a new height is a new window, as well as new widths.\n this._resizeObserver = createRafResizeObserver(() => {\n this._syncHeaderWidths();\n this._virtUpdate();\n });\n this._resizeObserver.observe(this._wrapperEl);\n }\n // The header lives in its own non-scrolling wrap (so it can't\n // escape vertically), but that means it also won't follow the\n // body's HORIZONTAL scroll on its own \u2014 translate it to match.\n this._installHeaderScrollSync();\n // Drag-to-resize handles on each header cell. Only meaningful\n // when there are body rows to size against.\n if (rows.length > 0) this._installColumnResizers();\n }\n\n // Install interactions (readonly only prevents editing, not selection/copy)\n if (rows.length > 0 && (this.config.selectable || this.config.copyable || !this.config.readonly)) {\n this._installInteractions();\n }\n\n // Restore focus to filter input if it was active\n if (activeFilterColIdx !== null) {\n this._restoreFilterFocus(activeFilterColIdx);\n }\n else if (hadTableFocus && this._tableEl) {\n try { this._tableEl.focus({ preventScroll: true }); } catch (_) { /* detached */ }\n }\n }\n\n /**\n * Copy selected rows to clipboard\n * @param {'tsv'|'csv'} [format='tsv'] - Output format\n */\n async copyToClipboard(format = 'tsv') {\n const indices = this.getSelection();\n if (indices.length === 0) {\n this._notify('Copy', 'No rows selected.', 'warn');\n return;\n }\n\n const { headers, rows } = this.config;\n const matrix = [headers];\n\n for (const idx of indices) {\n const row = rows[idx];\n if (row) {\n matrix.push(row.map((val, colIdx) => this._formatValue(val, colIdx)));\n }\n }\n\n const separator = format === 'csv' ? ',' : '\\t';\n const text = format === 'csv'\n ? matrix.map(row => row.map(cell => this._csvEscape(cell)).join(separator)).join('\\n')\n : matrix.map(row => row.join(separator)).join('\\n');\n\n let ok = false;\n try {\n await navigator.clipboard.writeText(text);\n ok = true;\n } catch (_) {\n ok = this._fallbackCopy(text);\n }\n\n if (ok) {\n const desc = indices.length === 1 ? 'row' : 'rows';\n const suffix = format === 'csv' ? ' as CSV' : '';\n this._notify('Copy', `Copied ${indices.length} ${desc}${suffix}.`, 'info');\n } else {\n this._notify('Copy', 'Clipboard unavailable.', 'warn');\n }\n\n this._hideContextMenu();\n }\n\n /**\n * Download all data as CSV\n * @param {string} [filename='data.csv'] - Filename for download\n */\n async downloadCSV(filename = 'data.csv') {\n const { headers, rows } = this.config;\n if (rows.length === 0) {\n this._notify('Download', 'No data to download.', 'warn');\n return;\n }\n\n const lines = [headers.join(',')];\n for (const row of rows) {\n lines.push(row.map((val, colIdx) =>\n this._csvEscape(this._formatValue(val, colIdx))\n ).join(','));\n }\n\n const csv = lines.join('\\n');\n\n // Native save dialog when the embedder supplies one.\n //\n // `saveFile` resolves to null when a host advertises `dialogs` but its\n // transport has no save dialog behind it (host.js: null <=> unavailable).\n // That is NOT a failed save \u2014 it means \"I can't do this, use your own\n // way\", so it must reach the Blob fallback below, not the error toast.\n const dialogs = this.config.host?.dialogs;\n let result = null;\n if (dialogs) {\n try {\n // Send plain text CSV - Python handles text files directly (no base64)\n result = await dialogs.saveFile({ data: csv, filename, kind: 'csv' });\n } catch (err) {\n console.error('[DataTable] CSV download failed:', err);\n this._notify('Download', 'Failed to save file', 'error');\n return;\n }\n }\n if (result) {\n if (result.ok) {\n this._notify('Download', `Saved ${rows.length} rows to ${result.path}`, 'success');\n } else if (!result.cancelled) {\n this._notify('Download', result.error || 'Failed to save file', 'error');\n }\n return;\n }\n\n // Fallback: no `dialogs` capability at all, or a host that has one but\n // cannot actually save. Both mean \"download it yourself\".\n const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });\n const url = URL.createObjectURL(blob);\n const link = document.createElement('a');\n link.href = url;\n link.download = filename;\n link.click();\n URL.revokeObjectURL(url);\n this._notify('Download', 'Download started', 'info');\n }\n\n /**\n * Dispose and cleanup\n */\n dispose() {\n this._cleanup();\n this._closeFilterDropdown();\n this._teardownContextMenu();\n if (this._resizeObserver) {\n try { this._resizeObserver.disconnect(); } catch (_) {}\n this._resizeObserver = null;\n }\n if (this._onBodyScroll && this._scrollSyncEl) {\n try {\n this._scrollSyncEl.removeEventListener('scroll', this._onBodyScroll);\n } catch (_) {}\n this._onBodyScroll = null;\n this._scrollSyncEl = null;\n }\n this.container.innerHTML = '';\n this._wrapperEl = null;\n this._paginationEl = null;\n this._tableEl = null;\n this._tbodyEl = null;\n this._headerTableEl = null;\n this._headerWrapEl = null;\n this._tableWrapEl = null;\n this._processedRows = null;\n this._processedIndexMap = null;\n this._virt = null;\n this._colgroupEl = null;\n }\n\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // Processed rows pipeline (filter \u2192 sort \u2192 cache)\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n _getProcessedRows() {\n if (this._processedRows !== null) return this._processedRows;\n\n const isServerSide = typeof this.config.onPageChange === 'function';\n let rows = this.config.rows;\n let indexMap = rows.map((_, i) => i);\n\n // Apply filters (client-side only)\n if (!isServerSide && this._state.filters.size > 0) {\n const result = this._applyFilters(rows, indexMap);\n rows = result.rows;\n indexMap = result.indexMap;\n }\n\n // Apply sort (client-side, only when no external onSort handler)\n if (!isServerSide && this.config.sortable && this._state.sortColumn !== null && !this.config.onSort) {\n const result = this._applySorting(rows, indexMap);\n rows = result.rows;\n indexMap = result.indexMap;\n }\n\n this._processedRows = rows;\n this._processedIndexMap = indexMap;\n return rows;\n }\n\n _applyFilters(rows, indexMap) {\n const filters = this._state.filters;\n const filteredRows = [];\n const filteredMap = [];\n\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i];\n let pass = true;\n\n for (const [colIdx, filterText] of filters) {\n if (!filterText) continue;\n const value = row[colIdx];\n const colType = this._columnTypes[colIdx];\n\n if (colType === 'num') {\n if (!this._matchNumericFilter(value, filterText)) { pass = false; break; }\n } else {\n if (!this._matchTextFilter(value, filterText)) { pass = false; break; }\n }\n }\n\n if (pass) {\n filteredRows.push(row);\n filteredMap.push(indexMap[i]);\n }\n }\n\n return { rows: filteredRows, indexMap: filteredMap };\n }\n\n _applySorting(rows, indexMap) {\n const colIdx = this._state.sortColumn;\n const asc = this._state.sortAscending;\n\n // Build paired array for stable sort with index tracking\n const paired = rows.map((row, i) => ({ row, origIdx: indexMap[i] }));\n const isNumeric = this._columnTypes[colIdx] === 'num';\n\n paired.sort((a, b) => {\n let valA = a.row[colIdx];\n let valB = b.row[colIdx];\n\n if (valA == null && valB == null) return 0;\n if (valA == null) return 1;\n if (valB == null) return -1;\n\n if (isNumeric) {\n valA = typeof valA === 'number' ? valA : parseFloat(valA);\n valB = typeof valB === 'number' ? valB : parseFloat(valB);\n if (!Number.isFinite(valA)) return 1;\n if (!Number.isFinite(valB)) return -1;\n } else {\n valA = String(valA).toLowerCase();\n valB = String(valB).toLowerCase();\n }\n\n let cmp = 0;\n if (valA < valB) cmp = -1;\n else if (valA > valB) cmp = 1;\n\n return asc ? cmp : -cmp;\n });\n\n return {\n rows: paired.map(p => p.row),\n indexMap: paired.map(p => p.origIdx),\n };\n }\n\n _matchNumericFilter(value, filterText) {\n const text = filterText.trim();\n if (!text) return true;\n\n const numVal = (typeof value === 'number') ? value : parseFloat(value);\n if (!Number.isFinite(numVal)) return false;\n\n // Range: \"10..100\"\n const rangeMatch = text.match(/^(-?[\\d.]+)\\.\\.(-?[\\d.]+)$/);\n if (rangeMatch) {\n const lo = parseFloat(rangeMatch[1]);\n const hi = parseFloat(rangeMatch[2]);\n return numVal >= lo && numVal <= hi;\n }\n\n // Operator prefix: >=, <=, !=, >, <, =\n const opMatch = text.match(/^(>=|<=|!=|>|<|=)\\s*(-?[\\d.]+)$/);\n if (opMatch) {\n const op = opMatch[1];\n const target = parseFloat(opMatch[2]);\n if (!Number.isFinite(target)) return true;\n switch (op) {\n case '>': return numVal > target;\n case '<': return numVal < target;\n case '>=': return numVal >= target;\n case '<=': return numVal <= target;\n case '!=': return Math.abs(numVal - target) > 1e-9;\n case '=': return Math.abs(numVal - target) <= 1e-9;\n }\n }\n\n // Plain number: equality\n const plain = parseFloat(text);\n if (Number.isFinite(plain)) {\n return Math.abs(numVal - plain) <= 1e-9;\n }\n\n return true;\n }\n\n _matchTextFilter(value, filterText) {\n if (!filterText) return true;\n const haystack = (value == null ? '' : String(value)).toLowerCase();\n const text = filterText.trim();\n\n // Exact match: =\"value\"\n if (text.startsWith('=\"') && text.endsWith('\"')) {\n return haystack === text.slice(2, -1).toLowerCase();\n }\n // Not contains: !value\n if (text.startsWith('!')) {\n return !haystack.includes(text.slice(1).toLowerCase());\n }\n // Starts with: ^value\n if (text.startsWith('^')) {\n return haystack.startsWith(text.slice(1).toLowerCase());\n }\n // Ends with: value$\n if (text.endsWith('$')) {\n return haystack.endsWith(text.slice(0, -1).toLowerCase());\n }\n // Contains (default)\n return haystack.includes(text.toLowerCase());\n }\n\n _invalidateProcessedCache() {\n this._processedRows = null;\n this._processedIndexMap = null;\n }\n\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // Filter row\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n _createFilterRow(headers) {\n const { showRowNumbers } = this.config;\n const tr = document.createElement('tr');\n tr.className = 'twm-data-table__filter-row';\n\n if (showRowNumbers) {\n const th = document.createElement('th');\n th.className = 'data-table__filter-cell data-table__filter-cell--empty';\n tr.appendChild(th);\n }\n\n headers.forEach((header, colIdx) => {\n const th = document.createElement('th');\n th.className = 'data-table__filter-cell';\n\n const wrapper = document.createElement('div');\n wrapper.className = 'twm-data-table__filter-wrapper';\n\n const input = document.createElement('input');\n input.type = 'text';\n input.className = 'twm-data-table__filter-input';\n const isNumeric = this._columnTypes[colIdx] === 'num';\n input.placeholder = isNumeric ? 'e.g. >100' : 'Filter...';\n\n // Restore existing filter value\n const existingFilter = this._state.filters.get(colIdx);\n if (existingFilter) {\n input.value = existingFilter;\n }\n\n // Dropdown trigger button\n const dropdownBtn = document.createElement('button');\n dropdownBtn.type = 'button';\n dropdownBtn.className = 'twm-data-table__filter-dropdown-btn';\n dropdownBtn.innerHTML = '<span class=\"material-symbols-outlined\" style=\"font-size:14px;\">tune</span>';\n dropdownBtn.addEventListener('click', (e) => {\n e.stopPropagation();\n this._openFilterDropdown(colIdx, th, input);\n });\n\n // Clear button\n const clearBtn = document.createElement('button');\n clearBtn.type = 'button';\n clearBtn.className = 'twm-data-table__filter-clear';\n clearBtn.innerHTML = '<span class=\"material-symbols-outlined\" style=\"font-size:12px;\">close</span>';\n clearBtn.style.display = existingFilter ? '' : 'none';\n clearBtn.addEventListener('click', (e) => {\n e.stopPropagation();\n input.value = '';\n this._onFilterInput(colIdx, '');\n clearBtn.style.display = 'none';\n input.focus();\n });\n\n input.addEventListener('input', () => {\n clearBtn.style.display = input.value ? '' : 'none';\n this._onFilterInputDebounced(colIdx, input.value);\n });\n\n // Prevent sort from triggering when clicking in filter cell\n th.addEventListener('click', (e) => e.stopPropagation());\n\n wrapper.appendChild(input);\n wrapper.appendChild(dropdownBtn);\n wrapper.appendChild(clearBtn);\n th.appendChild(wrapper);\n tr.appendChild(th);\n });\n\n return tr;\n }\n\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // Filter dropdown\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n _openFilterDropdown(colIdx, anchorEl, filterInput) {\n // Close any existing dropdown\n this._closeFilterDropdown();\n\n const isNumeric = this._columnTypes[colIdx] === 'num';\n const currentFilter = this._state.filters.get(colIdx) || '';\n const parsed = this._parseFilterForDropdown(currentFilter, isNumeric);\n\n // Build dropdown panel\n const panel = document.createElement('div');\n panel.className = 'twm-data-table__filter-dropdown';\n\n // Operator/mode select\n const selectLabel = document.createElement('label');\n selectLabel.className = 'twm-data-table__filter-dropdown-label';\n selectLabel.textContent = isNumeric ? 'Operator' : 'Mode';\n\n const select = document.createElement('select');\n select.className = 'twm-data-table__filter-dropdown-select';\n\n const options = isNumeric\n ? [\n { value: '=', label: 'Equals' },\n { value: '!=', label: 'Not equals' },\n { value: '>', label: 'Greater than' },\n { value: '>=', label: 'Greater or equal' },\n { value: '<', label: 'Less than' },\n { value: '<=', label: 'Less or equal' },\n { value: '..', label: 'Between' },\n ]\n : [\n { value: 'contains', label: 'Contains' },\n { value: 'equals', label: 'Equals' },\n { value: 'starts', label: 'Starts with' },\n { value: 'ends', label: 'Ends with' },\n { value: 'not', label: 'Not contains' },\n ];\n\n for (const opt of options) {\n const optEl = document.createElement('option');\n optEl.value = opt.value;\n optEl.textContent = opt.label;\n if (opt.value === parsed.operator) optEl.selected = true;\n select.appendChild(optEl);\n }\n\n // Value input\n const valueLabel = document.createElement('label');\n valueLabel.className = 'twm-data-table__filter-dropdown-label';\n valueLabel.textContent = 'Value';\n\n const valueInput = document.createElement('input');\n valueInput.type = isNumeric ? 'number' : 'text';\n valueInput.className = 'twm-data-table__filter-dropdown-input';\n valueInput.placeholder = isNumeric ? 'Number...' : 'Text...';\n valueInput.value = parsed.value;\n\n // Second value input (for \"between\")\n const value2Label = document.createElement('label');\n value2Label.className = 'twm-data-table__filter-dropdown-label';\n value2Label.textContent = 'And';\n\n const value2Input = document.createElement('input');\n value2Input.type = 'number';\n value2Input.className = 'twm-data-table__filter-dropdown-input';\n value2Input.placeholder = 'Number...';\n value2Input.value = parsed.value2;\n\n const value2Container = document.createElement('div');\n value2Container.className = 'twm-data-table__filter-dropdown-between';\n value2Container.style.display = (isNumeric && parsed.operator === '..') ? '' : 'none';\n value2Container.appendChild(value2Label);\n value2Container.appendChild(value2Input);\n\n // Toggle between fields when operator changes\n select.addEventListener('change', () => {\n value2Container.style.display = (isNumeric && select.value === '..') ? '' : 'none';\n });\n\n // Actions\n const actions = document.createElement('div');\n actions.className = 'twm-data-table__filter-dropdown-actions';\n\n const clearBtn = document.createElement('button');\n clearBtn.type = 'button';\n clearBtn.className = 'twm-data-table__filter-dropdown-btn-action twm-data-table__filter-dropdown-btn-action--clear';\n clearBtn.textContent = 'Clear';\n clearBtn.addEventListener('click', (e) => {\n e.stopPropagation();\n filterInput.value = '';\n this._onFilterInput(colIdx, '');\n this._closeFilterDropdown();\n });\n\n const applyBtn = document.createElement('button');\n applyBtn.type = 'button';\n applyBtn.className = 'twm-data-table__filter-dropdown-btn-action twm-data-table__filter-dropdown-btn-action--apply';\n applyBtn.textContent = 'Apply';\n applyBtn.addEventListener('click', (e) => {\n e.stopPropagation();\n const composed = this._composeFilterString(select.value, valueInput.value, value2Input.value, isNumeric);\n filterInput.value = composed;\n this._onFilterInput(colIdx, composed);\n this._closeFilterDropdown();\n });\n\n actions.appendChild(clearBtn);\n actions.appendChild(applyBtn);\n\n // Assemble panel\n panel.appendChild(selectLabel);\n panel.appendChild(select);\n panel.appendChild(valueLabel);\n panel.appendChild(valueInput);\n panel.appendChild(value2Container);\n panel.appendChild(actions);\n\n // Add to document and position\n document.body.appendChild(panel);\n\n const anchorRect = anchorEl.getBoundingClientRect();\n let left = anchorRect.left;\n let top = anchorRect.bottom + 4;\n\n // Viewport boundary check\n const panelRect = panel.getBoundingClientRect();\n if (left + panelRect.width > window.innerWidth) {\n left = window.innerWidth - panelRect.width - 8;\n }\n if (top + panelRect.height > window.innerHeight) {\n top = anchorRect.top - panelRect.height - 4;\n }\n\n panel.style.left = `${left}px`;\n panel.style.top = `${top}px`;\n\n // Focus the value input\n requestAnimationFrame(() => valueInput.focus());\n\n // Close on outside click (capture phase)\n const handleOutsideClick = (e) => {\n if (!panel.contains(e.target)) {\n this._closeFilterDropdown();\n }\n };\n const handleEscape = (e) => {\n if (e.key === 'Escape') {\n this._closeFilterDropdown();\n }\n };\n // Enter key applies the filter\n const handleEnter = (e) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n const composed = this._composeFilterString(select.value, valueInput.value, value2Input.value, isNumeric);\n filterInput.value = composed;\n this._onFilterInput(colIdx, composed);\n this._closeFilterDropdown();\n }\n };\n\n // Delay attaching outside-click to avoid catching the trigger click\n setTimeout(() => {\n document.addEventListener('click', handleOutsideClick, true);\n }, 0);\n document.addEventListener('keydown', handleEscape);\n panel.addEventListener('keydown', handleEnter);\n\n this._filterDropdownEl = panel;\n this._filterDropdownCleanup = () => {\n document.removeEventListener('click', handleOutsideClick, true);\n document.removeEventListener('keydown', handleEscape);\n };\n }\n\n _closeFilterDropdown() {\n if (this._filterDropdownEl?.parentNode) {\n this._filterDropdownEl.parentNode.removeChild(this._filterDropdownEl);\n }\n this._filterDropdownCleanup?.();\n this._filterDropdownEl = null;\n this._filterDropdownCleanup = null;\n }\n\n _parseFilterForDropdown(filterText, isNumeric) {\n const text = (filterText || '').trim();\n if (!text) {\n return { operator: isNumeric ? '=' : 'contains', value: '', value2: '' };\n }\n\n if (isNumeric) {\n // Range: \"10..100\"\n const rangeMatch = text.match(/^(-?[\\d.]+)\\.\\.(-?[\\d.]+)$/);\n if (rangeMatch) {\n return { operator: '..', value: rangeMatch[1], value2: rangeMatch[2] };\n }\n // Operator prefix: >=, <=, !=, >, <, =\n const opMatch = text.match(/^(>=|<=|!=|>|<|=)\\s*(-?[\\d.]+)$/);\n if (opMatch) {\n return { operator: opMatch[1], value: opMatch[2], value2: '' };\n }\n // Plain number\n return { operator: '=', value: text, value2: '' };\n }\n\n // Text modes\n if (text.startsWith('=\"') && text.endsWith('\"')) {\n return { operator: 'equals', value: text.slice(2, -1), value2: '' };\n }\n if (text.startsWith('!')) {\n return { operator: 'not', value: text.slice(1), value2: '' };\n }\n if (text.startsWith('^')) {\n return { operator: 'starts', value: text.slice(1), value2: '' };\n }\n if (text.endsWith('$')) {\n return { operator: 'ends', value: text.slice(0, -1), value2: '' };\n }\n return { operator: 'contains', value: text, value2: '' };\n }\n\n _composeFilterString(operator, value, value2, isNumeric) {\n if (!value && operator !== '..') return '';\n\n if (isNumeric) {\n if (operator === '..') {\n return (value && value2) ? `${value}..${value2}` : '';\n }\n if (operator === '=') return value;\n return `${operator}${value}`;\n }\n\n // Text modes\n switch (operator) {\n case 'contains': return value;\n case 'equals': return value ? `=\"${value}\"` : '';\n case 'starts': return value ? `^${value}` : '';\n case 'ends': return value ? `${value}$` : '';\n case 'not': return value ? `!${value}` : '';\n default: return value;\n }\n }\n\n _onFilterInputDebounced(colIdx, value) {\n if (this._filterDebounceTimer) {\n clearTimeout(this._filterDebounceTimer);\n }\n this._filterDebounceTimer = setTimeout(() => {\n this._onFilterInput(colIdx, value);\n }, 200);\n }\n\n _onFilterInput(colIdx, value) {\n if (value) {\n this._state.filters.set(colIdx, value);\n } else {\n this._state.filters.delete(colIdx);\n }\n\n this._invalidateProcessedCache();\n this._state.offset = 0;\n this._state.selected.clear();\n this._state.anchorIndex = null;\n\n this._savePersisted();\n this.render();\n }\n\n _getActiveFilterColIdx() {\n const active = document.activeElement;\n if (!active || !active.classList.contains('twm-data-table__filter-input')) return null;\n const cell = active.closest('.data-table__filter-cell');\n if (!cell) return null;\n const row = cell.parentElement;\n if (!row) return null;\n const cells = Array.from(row.children);\n const idx = cells.indexOf(cell);\n return this.config.showRowNumbers ? idx - 1 : idx;\n }\n\n _restoreFilterFocus(colIdx) {\n const filterRow = this._wrapperEl?.querySelector('.twm-data-table__filter-row');\n if (!filterRow) return;\n const cellIdx = this.config.showRowNumbers ? colIdx + 1 : colIdx;\n const cell = filterRow.children[cellIdx];\n const input = cell?.querySelector('.twm-data-table__filter-input');\n if (input) {\n input.focus();\n input.setSelectionRange(input.value.length, input.value.length);\n }\n }\n\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // Private methods\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\n _cleanup() {\n this._disposers.forEach(dispose => {\n try { dispose?.(); } catch (_) {}\n });\n this._disposers = [];\n this._closeFilterDropdown();\n if (this._filterDebounceTimer) {\n clearTimeout(this._filterDebounceTimer);\n this._filterDebounceTimer = null;\n }\n }\n\n _detectColumnTypes() {\n const { headers, rows, getColumnType } = this.config;\n const types = [];\n\n for (let colIdx = 0; colIdx < headers.length; colIdx++) {\n if (getColumnType) {\n types.push(getColumnType(colIdx, rows));\n continue;\n }\n\n // Auto-detect by sampling first 10 rows\n let numericCount = 0;\n let sampleCount = 0;\n const maxSamples = Math.min(10, rows.length);\n\n for (let i = 0; i < maxSamples; i++) {\n const value = rows[i]?.[colIdx];\n if (value != null && value !== '') {\n sampleCount++;\n if (typeof value === 'number' || /^-?[\\d,.]+%?$/.test(String(value).trim())) {\n numericCount++;\n }\n }\n }\n\n types.push(sampleCount > 0 && numericCount / sampleCount > 0.5 ? 'num' : 'text');\n }\n\n return types;\n }\n\n _createPagination() {\n const { rows, pageSize, totalCount: configTotalCount, offset: configOffset, onPageChange, onJumpToRow } = this.config;\n\n // Server-side pagination uses config offset, client-side uses state offset\n const isServerSide = typeof onPageChange === 'function';\n const offset = isServerSide ? (configOffset || 0) : this._state.offset;\n\n // For client-side, use processed (filtered+sorted) row count\n const processedRows = isServerSide ? rows : this._getProcessedRows();\n const effectiveTotal = isServerSide ? (configTotalCount || rows.length) : processedRows.length;\n const unfilteredTotal = isServerSide ? (configTotalCount || rows.length) : rows.length;\n const isFiltered = !isServerSide && this._state.filters.size > 0;\n\n const displayedRows = isServerSide ? rows.length : Math.min(pageSize, effectiveTotal - offset);\n const endRow = Math.min(offset + displayedRows, effectiveTotal);\n const totalPages = Math.max(1, Math.ceil(effectiveTotal / pageSize));\n // Don't render the strip when there's only one page \u2014 the row\n // count is uninformative (the table itself shows every row) and\n // the nav buttons would all be disabled.\n if (totalPages <= 1 && !isFiltered) return null;\n const currentPage = Math.floor(offset / pageSize) + 1;\n const hasPrev = offset > 0;\n const hasNext = offset + pageSize < effectiveTotal;\n\n const el = document.createElement('div');\n el.className = 'twm-pagination-controls';\n el.style.cssText = 'display:flex; align-items:center; gap:6px; padding:2px 8px; border-bottom:1px solid #2a2a2a; font-size:11px;';\n\n // Info\n const info = document.createElement('span');\n info.style.cssText = 'color:#aaa; white-space:nowrap;';\n if (effectiveTotal === 0) {\n info.textContent = isFiltered\n ? `0 of ${unfilteredTotal.toLocaleString()} rows match`\n : 'No rows';\n } else if (isFiltered) {\n info.textContent = `Rows ${offset + 1}\\u2013${endRow} of ${effectiveTotal.toLocaleString()} (${unfilteredTotal.toLocaleString()} total)`;\n } else {\n info.textContent = `Rows ${offset + 1}\\u2013${endRow} of ${effectiveTotal.toLocaleString()}`;\n }\n\n // Spacer\n const spacer = document.createElement('div');\n spacer.style.flex = '1';\n\n // Page change handler - supports both client-side and server-side pagination\n const handlePageChange = (newOffset) => {\n if (isServerSide) {\n // Auto-spinner if the consumer returns a Promise.\n this._awaitWithSpinner(onPageChange(newOffset, pageSize));\n } else {\n this._state.offset = newOffset;\n this.render();\n }\n };\n\n // Navigation buttons\n const firstBtn = this._createPaginationBtn('first_page', 'First page', !hasPrev, () => {\n handlePageChange(0);\n });\n\n const prevBtn = this._createPaginationBtn('chevron_left', 'Previous page', !hasPrev, () => {\n handlePageChange(Math.max(0, offset - pageSize));\n });\n\n const pageInfo = document.createElement('span');\n pageInfo.style.cssText = 'color:#aaa; font-size:10px; min-width:72px; text-align:center;';\n pageInfo.textContent = `Page ${currentPage} of ${totalPages}`;\n\n const nextBtn = this._createPaginationBtn('chevron_right', 'Next page', !hasNext, () => {\n handlePageChange(offset + pageSize);\n });\n\n const lastBtn = this._createPaginationBtn('last_page', 'Last page', !hasNext, () => {\n handlePageChange(Math.floor((effectiveTotal - 1) / pageSize) * pageSize);\n });\n\n // Jump to row\n const jumpInput = document.createElement('input');\n jumpInput.type = 'number';\n jumpInput.className = 'twm-pagination-input';\n jumpInput.style.cssText = 'width:54px; padding:1px 4px; border:1px solid #444; background:#2a2a2a; color:#ccc; font-size:10px;';\n jumpInput.min = '1';\n jumpInput.max = String(effectiveTotal);\n jumpInput.placeholder = 'Row #';\n\n const jumpBtn = this._createPaginationBtn(null, 'Go to row', false, () => {\n const target = Number(jumpInput.value);\n if (Number.isFinite(target) && target >= 1) {\n if (isServerSide && onJumpToRow) {\n onJumpToRow(target - 1);\n } else if (isServerSide) {\n // Default: calculate page offset for the target row\n const newOffset = Math.floor((target - 1) / pageSize) * pageSize;\n handlePageChange(newOffset);\n } else {\n this.goToRow(target - 1);\n }\n }\n }, 'Go');\n\n el.appendChild(info);\n el.appendChild(spacer);\n el.appendChild(firstBtn);\n el.appendChild(prevBtn);\n el.appendChild(pageInfo);\n el.appendChild(nextBtn);\n el.appendChild(lastBtn);\n el.appendChild(jumpInput);\n el.appendChild(jumpBtn);\n\n // CSV export button (opt-in). Re-uses the existing downloadCSV\n // method which already handles the host save dialog + browser\n // fallback.\n if (this.config.showExportButton) {\n const exportBtn = this._createPaginationBtn(\n 'download', 'Download visible rows as CSV', false,\n () => this.downloadCSV('data.csv'));\n el.appendChild(exportBtn);\n }\n\n return el;\n }\n\n _createPaginationBtn(icon, tooltip, disabled, onClick, textLabel = null) {\n const btn = document.createElement('button');\n btn.type = 'button';\n btn.className = 'hoverbutton twm-pagination-btn twm-has-tooltip';\n btn.setAttribute('data-tooltip', tooltip);\n btn.disabled = disabled;\n btn.style.cssText = 'padding:1px 3px; background:transparent; border:1px solid #444; color:#aaa; cursor:pointer; display:flex; align-items:center; justify-content:center; line-height:1;';\n\n if (disabled) {\n btn.style.opacity = '0.4';\n btn.style.cursor = 'not-allowed';\n }\n\n if (icon) {\n const iconEl = document.createElement('span');\n iconEl.className = 'material-symbols-outlined';\n iconEl.style.fontSize = '14px';\n iconEl.textContent = icon;\n btn.appendChild(iconEl);\n } else if (textLabel) {\n btn.textContent = textLabel;\n btn.style.fontSize = '10px';\n btn.style.padding = '1px 6px';\n }\n\n btn.addEventListener('click', onClick);\n return btn;\n }\n\n _createTable() {\n const { headers, rows, pageSize, sortable, filterable, showRowNumbers, readonly, getHeaderIcon, onPageChange, offset: configOffset } = this.config;\n const { sortColumn, sortAscending } = this._state;\n\n // Server-side pagination: rows already represent current page, use config offset for row numbering\n // Client-side pagination: use processed (filtered+sorted) rows, then slice for current page\n const isServerSide = typeof onPageChange === 'function';\n const processedRows = isServerSide ? rows : this._getProcessedRows();\n const offset = isServerSide ? (configOffset || 0) : this._state.offset;\n // NO PAGINATION MEANS NO PAGES. This used to slice to `pageSize` either\n // way, so a table built with `pagination: false` silently showed its\n // first hundred rows and offered no control to reach the rest.\n const pageRows = isServerSide || !this.config.pagination\n ? processedRows : processedRows.slice(offset, offset + pageSize);\n\n const table = document.createElement('table');\n table.className = readonly ? 'twm-preview-table twm-preview-table--readonly' : 'twm-preview-table';\n table.tabIndex = 0;\n\n // Header\n const thead = document.createElement('thead');\n const headerRow = document.createElement('tr');\n\n if (showRowNumbers) {\n const th = document.createElement('th');\n th.className = 'num';\n th.textContent = '#';\n headerRow.appendChild(th);\n }\n\n headers.forEach((header, colIdx) => {\n const th = document.createElement('th');\n th.className = this._columnTypes[colIdx] || 'text';\n\n if (sortable) {\n th.classList.add('sortable');\n th.style.cursor = 'pointer';\n }\n\n // Header icon\n if (getHeaderIcon) {\n const iconInfo = getHeaderIcon(header, colIdx);\n if (iconInfo) {\n const iconSpan = document.createElement('span');\n iconSpan.className = 'material-symbols-outlined twm-header-icon twm-has-tooltip';\n iconSpan.setAttribute('data-tooltip', iconInfo.title || '');\n iconSpan.style.cssText = 'font-size:16px; vertical-align:middle; margin-right:4px; opacity:0.7;';\n iconSpan.textContent = iconInfo.icon;\n th.appendChild(iconSpan);\n }\n }\n\n th.appendChild(document.createTextNode(header));\n\n // Sort indicator\n if (sortable) {\n const sortIcon = document.createElement('span');\n sortIcon.className = 'material-symbols-outlined twm-sort-icon';\n sortIcon.style.cssText = 'font-size:14px; margin-left:4px; opacity:0.5;';\n if (sortColumn === colIdx) {\n sortIcon.textContent = sortAscending ? 'arrow_upward' : 'arrow_downward';\n sortIcon.style.opacity = '1';\n } else {\n sortIcon.textContent = 'unfold_more';\n }\n th.appendChild(sortIcon);\n\n th.addEventListener('click', () => this.sortBy(colIdx));\n }\n\n th.title = header;\n headerRow.appendChild(th);\n });\n\n thead.appendChild(headerRow);\n\n // Filter row (below header)\n if (filterable) {\n const filterRow = this._createFilterRow(headers);\n thead.appendChild(filterRow);\n }\n\n // C10. THE COLUMN TRACK IS A `<colgroup>`, NOT THE FIRST ROW. Under\n // `table-layout: fixed` a `<col>` with a width decides its column, and a\n // first-row cell only decides one whose `<col>` is `auto` \u2014 so once the\n // widths live here, it stops mattering which row is first. A recycling\n // window changes that row on every scroll; without this the columns\n // would jitter each time it did. Before the `thead`, where the content\n // model puts it; the `thead` leaves for the header table in `render()`\n // and the colgroup stays with the body.\n const virtual = this._isVirtual();\n if (virtual) {\n table.classList.add('twm-dt--virtual');\n table.appendChild(this._createColgroup());\n }\n\n table.appendChild(thead);\n\n // Map back to original config.rows index for selection tracking\n const globalOf = (localIdx) => {\n const processedIdx = offset + localIdx;\n return isServerSide\n ? (configOffset || 0) + localIdx\n : (this._processedIndexMap?.[processedIdx] ?? processedIdx);\n };\n\n // Body\n const tbody = document.createElement('tbody');\n table.appendChild(tbody);\n this._tbodyEl = tbody;\n\n if (virtual) {\n this._virtInit(tbody, pageRows, globalOf, {\n serverSide: isServerSide, offset, configOffset: configOffset || 0,\n });\n } else {\n pageRows.forEach((row, localIdx) => {\n tbody.appendChild(this._buildBodyRow(row, globalOf(localIdx), localIdx));\n });\n }\n\n return table;\n }\n\n /** One body row, fully built. The ONE place a `<tr>` for a row is made, so\n * the full render and the virtual window cannot drift apart: a row drawn\n * on scroll is the same row a render would have drawn. */\n _buildBodyRow(row, globalIdx, localIdx) {\n const { showRowNumbers } = this.config;\n const tr = document.createElement('tr');\n tr.__rowIndex = globalIdx;\n tr.className = 'data-preview-row';\n\n if (this._state.selected.has(globalIdx)) {\n tr.classList.add('selected');\n }\n // C10. The stripe is `tr:nth-child(even)`, which is a question about a\n // row's POSITION among its siblings \u2014 and a window that drops rows off\n // its top changes every answer. `_virtSpacers` keeps the position's\n // parity equal to the row's own, so the stripe needs nothing here; the\n // class is for an embedder that wants to ask about the row itself.\n if (this._virt) tr.classList.toggle('twm-dt-row--alt', localIdx % 2 === 1);\n\n this._fillRowCells(tr, row, globalIdx, showRowNumbers);\n\n // Row-level click + right-click hooks (P2). Bound after\n // cells so per-cell handlers run first.\n if (this.config.onRowClick) {\n tr.addEventListener('click', (ev) => {\n this.config.onRowClick(globalIdx, row, ev);\n });\n }\n if (this.config.onRowContextMenu) {\n tr.addEventListener('contextmenu', (ev) => {\n this.config.onRowContextMenu(globalIdx, row, ev);\n });\n }\n return tr;\n }\n\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n // C10 \u2014 the virtual window\n // \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n //\n // \u2550\u2550 WHAT IT IS \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n //\n // Only the rows near the viewport are in the DOM: a TOP SPACER row whose\n // height is every row above the window, the window's rows, and a BOTTOM\n // SPACER for everything below it. The scrollbar is therefore sized to the\n // whole table and every row is reachable, while the DOM stays bounded by\n // the viewport \u2014 a thousand-row page (or fifty of them) costs the same\n // few dozen `<tr>`s as one screenful.\n //\n // \u2550\u2550 WHAT IT PROMISES \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n //\n // - A row that stays in the window is NEVER MOVED OR REBUILT when the\n // window slides. Rows leave from the edges and arrive at the edges; the\n // ones in the middle are the same nodes. An open editor, a focused\n // cell, a hover \u2014 anything living in a row that is still on screen \u2014\n // survives a scroll. (Moving a node that holds focus blurs it, which in\n // an editable grid is a commit nobody asked for.)\n // - Column widths come from a `<colgroup>`, so the first row changing\n // moves nothing (see `_createTable`).\n // - A spacer is in the DOM only while it has a height. A table that fits\n // in its window has exactly the DOM it had without `virtualize`.\n // - `onRowsRendered` hears about every row added after `render()`, and\n // every row taken out.\n //\n // \u2550\u2550 WHAT IT ASSUMES \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n //\n // That a row's height is knowable without drawing it: `baseHeight`,\n // measured from a real row, or what `virtualRowHeight` says. A row that\n // wraps to two lines is drawn correctly and is simply mis-counted in the\n // spacer arithmetic by the difference \u2014 the overscan absorbs that.\n\n _isVirtual() {\n return !!this.config.virtualize;\n }\n\n _virtOptions() {\n const v = this.config.virtualize;\n const o = v && typeof v === 'object' ? v : {};\n return {\n overscan: Number.isFinite(o.overscan) && o.overscan >= 0 ? Math.floor(o.overscan) : 20,\n rowHeight: Number.isFinite(o.rowHeight) && o.rowHeight > 0 ? o.rowHeight : 24,\n };\n }\n\n /** One `<col>` per DOM column (the row-number column included), carrying\n * any width already pinned for it, so a re-render starts at the widths it\n * had rather than at a content-sized frame that then snaps. */\n _createColgroup() {\n const n = (this.config.headers?.length || 0) + (this.config.showRowNumbers ? 1 : 0);\n const colgroup = document.createElement('colgroup');\n for (let i = 0; i < n; i++) {\n const col = document.createElement('col');\n const w = this._colWidths?.[i];\n if (w != null && this._colWidthsSig === this._colSig()) col.style.width = `${w}px`;\n colgroup.appendChild(col);\n }\n this._colgroupEl = colgroup;\n return colgroup;\n }\n\n /** The `<col>`s, when this table has them. */\n _cols() {\n return this._virt && this._colgroupEl ? this._colgroupEl.children : null;\n }\n\n _virtInit(tbody, rows, globalOf, { serverSide, offset, configOffset }) {\n const { overscan, rowHeight } = this._virtOptions();\n const spacer = (edge) => {\n const tr = document.createElement('tr');\n tr.className = `twm-dt-spacer twm-dt-spacer--${edge}`;\n tr.setAttribute('aria-hidden', 'true');\n const td = document.createElement('td');\n td.colSpan = Math.max(1, (this.config.headers?.length || 0)\n + (this.config.showRowNumbers ? 1 : 0));\n // INLINE, because it must beat every consumer's cell padding and\n // border at any specificity: a spacer that is 1px taller than its\n // arithmetic moves every row below it by that pixel.\n td.style.cssText = 'padding:0;border:0;height:0;min-width:0;max-width:none;';\n tr.appendChild(td);\n return tr;\n };\n // The parity filler: see `_virtSpacers`.\n const filler = document.createElement('tr');\n filler.className = 'twm-dt-spacer twm-dt-spacer--parity';\n filler.setAttribute('aria-hidden', 'true');\n filler.hidden = true;\n this._virt = {\n tbody, rows, globalOf, serverSide, offset, configOffset,\n overscan,\n base: this._virtBase || rowHeight,\n heights: null, offsets: null,\n start: 0, end: 0,\n map: new Map(),\n top: spacer('top'), bottom: spacer('bottom'), filler,\n };\n this._virtComputeOffsets();\n // A first window from an ESTIMATED viewport: the scroll box does not\n // exist yet. `render()` redraws it for the real one once it does.\n const guess = this.container?.clientHeight || 0;\n this._virtUpdate({ force: true, notify: false, viewport: guess || undefined, top: 0 });\n }\n\n /** Heights and their running sum. `offsets[i]` is where row `i` starts;\n * `offsets[n]` is the whole table. O(n), and rerun only when a height can\n * have changed \u2014 a new measurement, or `refreshVirtualLayout()`. */\n _virtComputeOffsets() {\n const v = this._virt;\n if (!v) return;\n const n = v.rows.length;\n const heights = new Float64Array(n);\n const offsets = new Float64Array(n + 1);\n const fn = typeof this.config.virtualRowHeight === 'function'\n ? this.config.virtualRowHeight : null;\n let y = 0;\n for (let i = 0; i < n; i++) {\n let h = v.base;\n if (fn) {\n const asked = fn(v.globalOf(i), v.base);\n h = Number.isFinite(asked) && asked > 0 ? asked : 0;\n }\n heights[i] = h;\n offsets[i] = y;\n y += h;\n }\n offsets[n] = y;\n v.heights = heights;\n v.offsets = offsets;\n }\n\n /** The row whose span contains `y`: the LAST `i` with `offsets[i] <= y`,\n * which steps over rows of zero height at the same offset. */\n _virtIndexAt(y) {\n const v = this._virt;\n const n = v.rows.length;\n if (n === 0) return 0;\n let lo = 0;\n let hi = n - 1;\n while (lo < hi) {\n const mid = (lo + hi + 1) >> 1;\n if (v.offsets[mid] <= y) lo = mid; else hi = mid - 1;\n }\n return lo;\n }\n\n /** Measure one real row. Client pixels, so the zoom is divided back out \u2014\n * `_measureNaturalWidths` explains why \u2014 and NOT `offsetHeight`, which is\n * rounded: 21 for a 21.19px row is a 1,100px error over 6,000 rows. */\n _virtMeasure() {\n const v = this._virt;\n if (!v) return false;\n for (const tr of v.map.values()) {\n if (!tr.isConnected || tr.hidden) continue;\n const zoom = this._tableEl?.currentCSSZoom || 1;\n const h = tr.getBoundingClientRect().height / zoom;\n if (!(h > 0)) return false;\n if (Math.abs(h - v.base) > 0.01) {\n v.base = h;\n this._virtBase = h;\n this._virtComputeOffsets();\n return true;\n }\n return false;\n }\n return false;\n }\n\n /**\n * Slide the window to wherever the scroll box now is.\n *\n * HYSTERESIS, so a scroll of one pixel does not rebuild anything: the\n * window is redrawn only when the visible rows come within a quarter of the\n * overscan of either end of what is drawn, and it is then redrawn with the\n * full overscan on both sides.\n *\n * @param {object} [o]\n * @param {boolean} [o.force] redraw even inside the hysteresis band.\n * @param {boolean} [o.notify] report added and removed rows to `onRowsRendered`.\n * @param {number} [o.top] the scroll offset to draw for, instead of\n * reading one back \u2014 `scrollToRow` passes the offset it has just set,\n * which a DOM with no layout would read back as 0.\n * @param {number} [o.viewport] the viewport height, likewise.\n * @returns {HTMLElement[]} the rows added.\n */\n _virtUpdate({ force = false, notify = true, top = null, viewport = null } = {}) {\n const v = this._virt;\n if (!v || !v.offsets) return [];\n const n = v.rows.length;\n const wrap = this._tableWrapEl;\n const view = viewport || wrap?.clientHeight || VIRTUAL_FALLBACK_VIEWPORT_PX;\n const scrollTop = top ?? (wrap?.scrollTop || 0);\n const vs = this._virtIndexAt(scrollTop);\n const ve = Math.min(n, this._virtIndexAt(scrollTop + view) + 1);\n if (!force && v.end > v.start) {\n const margin = Math.max(1, Math.floor(v.overscan / 4));\n const lowOk = v.start === 0 || vs >= v.start + margin;\n const highOk = v.end === n || ve <= v.end - margin;\n if (lowOk && highOk) return [];\n }\n const start = Math.max(0, vs - v.overscan);\n const end = Math.min(n, ve + v.overscan);\n const removed = [];\n const added = this._virtRender(start, end, removed);\n if (added.length || removed.length) {\n // Only once the columns are fixed: before that the first sync has\n // not run, and it tooltips every cell itself.\n if (added[0]?.isConnected && this._tableEl?.style.tableLayout === 'fixed') {\n this._updateCellTooltips(added);\n }\n if (notify) {\n try { this.config.onRowsRendered?.({ rows: added, removed }); } catch (err) {\n console.error('[DataTable] onRowsRendered threw', err);\n }\n }\n }\n return added;\n }\n\n /** Make the DOM hold exactly the drawable rows of `[start, end)`, without\n * moving a row that is already there. See the promises above. */\n _virtRender(start, end, removed = null) {\n const v = this._virt;\n const tbody = v.tbody;\n const want = [];\n for (let i = start; i < end; i++) if (v.heights[i] > 0) want.push(i);\n const wanted = new Set(want);\n for (const [i, tr] of v.map) {\n if (!wanted.has(i)) { tr.remove(); v.map.delete(i); removed?.push(tr); }\n }\n v.start = start;\n v.end = end;\n this._virtSpacers();\n const added = [];\n // Right to left, so each new row goes in front of the one after it \u2014\n // which is either a row that stayed (and is not moved) or the bottom\n // spacer (or the end of the body).\n let ref = v.bottom.isConnected ? v.bottom : null;\n for (let k = want.length - 1; k >= 0; k--) {\n const i = want[k];\n const have = v.map.get(i);\n if (have) { ref = have; continue; }\n const tr = this._buildBodyRow(v.rows[i], v.globalOf(i), i);\n v.map.set(i, tr);\n tbody.insertBefore(tr, ref);\n ref = tr;\n added.push(tr);\n }\n added.reverse();\n return added;\n }\n\n /**\n * Size the two spacers, and put each in the DOM only while it has a height.\n *\n * AND KEEP THE STRIPE. `tr:nth-child(even)` stripes by POSITION, and in a\n * full render row `i` is child `i + 1`. Here the first drawn row is preceded\n * by the top spacer, so its position is off by one \u2014 and by a different one\n * each time the window's start changes parity, which strobes every stripe\n * on the screen as you scroll. A hidden filler row after the spacer, present\n * exactly when `start` is even, puts the parity back: a `display: none` row\n * is still a child, and so still counted by `nth-child`.\n */\n _virtSpacers() {\n const v = this._virt;\n const n = v.rows.length;\n const above = v.offsets[v.start];\n const below = v.offsets[n] - v.offsets[v.end];\n const tbody = v.tbody;\n if (above > 0) {\n v.top.firstChild.style.height = `${above}px`;\n if (tbody.firstChild !== v.top) tbody.insertBefore(v.top, tbody.firstChild);\n const needFiller = v.start % 2 === 0;\n if (needFiller && v.top.nextSibling !== v.filler) v.top.after(v.filler);\n else if (!needFiller) v.filler.remove();\n } else {\n v.top.remove();\n v.filler.remove();\n }\n if (below > 0) {\n v.bottom.firstChild.style.height = `${below}px`;\n if (tbody.lastChild !== v.bottom) tbody.appendChild(v.bottom);\n } else {\n v.bottom.remove();\n }\n }\n\n /**\n * Recompute every row's height and redraw the window. For an embedder whose\n * `virtualRowHeight` answer has changed \u2014 a group folded, a header added.\n * A no-op on a table that is not virtual.\n */\n refreshVirtualLayout() {\n if (!this._virt) return;\n this._virtMeasure();\n this._virtComputeOffsets();\n this._virtUpdate({ force: true });\n }\n\n /** The element that scrolls the body. Read-only; the table owns it. */\n get scrollElement() {\n return this._tableWrapEl || null;\n }\n\n /** The `<tr>` drawing row `rowIndex` (the `__rowIndex` space), or null when\n * it is not in the DOM \u2014 outside the window, on another page, or hidden. */\n getRowElement(rowIndex) {\n const v = this._virt;\n if (v) {\n const local = this._virtLocalOf(rowIndex);\n return local < 0 ? null : (v.map.get(local) || null);\n }\n const tbody = this._tbodyEl;\n if (!tbody) return null;\n for (const tr of tbody.children) if (tr.__rowIndex === rowIndex) return tr;\n return null;\n }\n\n /** Keep the window's row list and `config.rows` in step for one row. They\n * are the same array in server-side mode; in client mode the window reads\n * the filtered-and-sorted copy, which holds its own reference. */\n _virtSetRow(rowIndex, row) {\n const v = this._virt;\n if (!v) return;\n if (Array.isArray(this.config.rows) && rowIndex >= 0\n && rowIndex < this.config.rows.length) {\n this.config.rows[rowIndex] = row;\n }\n const local = this._virtLocalOf(rowIndex);\n if (local >= 0) v.rows[local] = row;\n }\n\n /** `__rowIndex` \u2192 position in the window's row list, or -1. */\n _virtLocalOf(rowIndex) {\n const v = this._virt;\n if (!v) return -1;\n let local;\n if (v.serverSide) local = rowIndex - v.configOffset;\n else {\n const map = this._processedIndexMap;\n const processed = map ? map.indexOf(rowIndex) : rowIndex;\n local = processed < 0 ? -1 : processed - v.offset;\n }\n return local >= 0 && local < v.rows.length ? local : -1;\n }\n\n /**\n * Scroll the body so row `rowIndex` is on screen, drawing it if it was not,\n * and return its `<tr>` (null when it cannot be shown: another page, or a\n * row the embedder hides). Works with or without `virtualize`.\n *\n * @param {number} rowIndex in the `__rowIndex` space.\n * @param {{block?: 'nearest'|'center'|'start'}} [opts]\n */\n scrollToRow(rowIndex, { block = 'nearest' } = {}) {\n const wrap = this._tableWrapEl;\n const v = this._virt;\n if (!v) {\n const tr = this.getRowElement(rowIndex);\n if (!tr || !wrap) return tr;\n const zoom = this._tableEl?.currentCSSZoom || 1;\n const box = wrap.getBoundingClientRect();\n const r = tr.getBoundingClientRect();\n const rowTop = (r.top - box.top) / zoom + wrap.scrollTop;\n const rowH = r.height / zoom;\n const target = this._scrollTarget(rowTop, rowH, wrap.scrollTop,\n wrap.clientHeight, block);\n if (target !== wrap.scrollTop) wrap.scrollTop = target;\n return tr;\n }\n const local = this._virtLocalOf(rowIndex);\n if (local < 0 || !(v.heights[local] > 0)) return null;\n const view = wrap?.clientHeight || VIRTUAL_FALLBACK_VIEWPORT_PX;\n const current = wrap?.scrollTop || 0;\n let target = this._scrollTarget(v.offsets[local], v.heights[local],\n current, view, block);\n target = Math.max(0, Math.min(target, Math.max(0, v.offsets[v.rows.length] - view)));\n if (wrap && Math.abs(target - current) >= 1) wrap.scrollTop = target;\n this._virtUpdate({ top: Math.abs(target - current) >= 1 ? target : current });\n return v.map.get(local) || null;\n }\n\n _scrollTarget(rowTop, rowH, current, view, block) {\n if (block === 'start') return rowTop;\n if (block === 'center') return rowTop - Math.max(0, (view - rowH) / 2);\n if (rowTop < current) return rowTop;\n if (rowTop + rowH > current + view) return rowTop + rowH - view;\n return current;\n }\n\n /** The first body row that draws a row of data \u2014 never a spacer, and never\n * a row an embedder injected (a group header spans every column with ONE\n * cell, so measuring it would report one column). */\n _firstBodyRow() {\n const tbody = this._tableEl?.querySelector?.('tbody');\n if (!tbody) return null;\n for (const tr of tbody.children) {\n if (tr.__rowIndex !== undefined) return tr;\n }\n return null;\n }\n\n /** Build (or rebuild) one row's cells in place.\n *\n * Extracted from the body loop so that `updateRow` and the initial\n * render share ONE cell-building path. Two paths would drift, and the\n * drift would show as a cell that renders differently after a live\n * update than it did on load. */\n _fillRowCells(tr, row, globalIdx, showRowNumbers) {\n tr.replaceChildren();\n\n if (showRowNumbers) {\n const td = document.createElement('td');\n td.className = 'num';\n td.textContent = String(globalIdx + 1);\n tr.appendChild(td);\n }\n\n for (let colIdx = 0; colIdx < row.length; colIdx++) {\n const td = document.createElement('td');\n td.className = this._columnTypes[colIdx] || 'text';\n\n // Use custom cell renderer if provided\n const value = row[colIdx];\n if (this.config.renderCell) {\n const handled = this.config.renderCell(td, value, colIdx, globalIdx, row);\n if (!handled) {\n td.textContent = this._formatValue(value, colIdx);\n }\n } else {\n td.textContent = this._formatValue(value, colIdx);\n }\n\n // Cell-level right-click hook (P2). Fires before the row-level\n // hook and the built-in context menu \u2014 the caller can\n // ev.preventDefault() to suppress the default copy menu on this\n // cell only.\n if (this.config.onCellContextMenu) {\n const cellColIdx = colIdx;\n td.addEventListener('contextmenu', (ev) => {\n this.config.onCellContextMenu(\n cellColIdx, globalIdx, value, td, ev);\n });\n }\n\n tr.appendChild(td);\n }\n }\n\n /** Re-render ONE row in place, preserving everything around it.\n *\n * `render()` rebuilds the entire `<tbody>`, which takes the scroll\n * position, any open editor, the keyboard focus and the measured column\n * widths with it. That is fine for a sort or a page change and wrong for\n * a single-cell commit or a live update arriving over a socket \u2014 the\n * common case in an editable grid, where a full rebuild once per keystroke\n * is both visible and destructive.\n *\n * What survives, by construction:\n * - scroll position, because the tbody is not replaced;\n * - the separately-rendered thead/tbody column widths, because the\n * explicit widths live on the header cells and on the FIRST body row,\n * and all three of the properties `_setCellWidth` writes are re-applied\n * here when that first row is the one being replaced;\n * - selection, because the `selected` class is recomputed from the\n * selection set rather than carried on the old element;\n * - keyboard focus, because the focused element's position is recorded\n * before the replace and restored after.\n *\n * @param {number} index row index as tracked by `tr.__rowIndex`\n * @param {any[]} row the new cell values\n * @returns {boolean} false when the row is not currently rendered\n * (it is on another page, or outside the render\n * window) \u2014 which is NOT an error: the caller has\n * nothing to update on screen.\n */\n updateRow(index, row) {\n const tbody = this._tbodyEl;\n if (!tbody) return false;\n\n let tr = null;\n for (const candidate of tbody.children) {\n if (candidate.__rowIndex === index) { tr = candidate; break; }\n }\n // C10. OUTSIDE THE WINDOW IS NOT OFF THE PAGE. The row will be drawn the\n // moment it scrolls back in, from the window's own row list \u2014 so the\n // data has to change now, or it comes back showing the value it had\n // before this update. Without `virtualize` a row that is not in the DOM\n // is on another page, and that path is unchanged.\n if (!tr) {\n if (this._virt) this._virtSetRow(index, row);\n return false;\n }\n\n // Keep the caller's data in step, so a later full render agrees with\n // what is on screen. Server-side paging means config.rows may hold only\n // the current page; the index map is what resolves that.\n if (Array.isArray(this.config.rows) && this.config.rows[index]) {\n this.config.rows[index] = row;\n }\n if (this._virt) this._virtSetRow(index, row);\n\n // Record focus BEFORE the replace: `replaceChildren` detaches the\n // focused cell and the browser moves focus to <body>.\n const active = document.activeElement;\n let focusedCol = -1;\n if (active && tr.contains(active)) {\n focusedCol = Array.prototype.indexOf.call(tr.children, active.closest('td'));\n }\n\n // ALL THREE PROPERTIES, not just `width`. `_setCellWidth` writes\n // `width` together with `min-width: 0` and `max-width: none`, precisely\n // to escape the CSS floors on these cells (base.css pins the first\n // column at 120px/min 100px and gives every other column a 80px min).\n // Carrying the width across the rebuild and leaving the other two behind\n // let those floors back in \u2014 so a column measured narrower than its\n // floor SNAPPED WIDER the moment one of its cells was repainted, and\n // under `table-layout: fixed` this row is the column track, so the whole\n // column moved. In an editable grid that is one visible jump per saved\n // cell, which is what it looked like to the person doing the saving.\n const isFirstRow = tr === tbody.firstElementChild;\n const widths = isFirstRow\n ? Array.prototype.map.call(tr.children, (td) => ({\n width: td.style.width,\n minWidth: td.style.minWidth,\n maxWidth: td.style.maxWidth,\n }))\n : null;\n\n const showRowNumbers = this.config.showRowNumbers !== false\n && tr.firstElementChild?.classList.contains('num');\n this._fillRowCells(tr, row, index, showRowNumbers);\n\n // `_syncHeaderWidths` derives column widths from the FIRST body row.\n // Under a recycling virtualiser that row changes on every scroll \u2014 and\n // here it changes on every update \u2014 so the explicit widths have to be\n // carried across the rebuild or the columns jitter.\n if (widths) {\n widths.forEach((saved, i) => {\n const cell = tr.children[i];\n if (!saved.width || !cell) return;\n cell.style.width = saved.width;\n cell.style.minWidth = saved.minWidth;\n cell.style.maxWidth = saved.maxWidth;\n });\n }\n\n tr.classList.toggle('selected', this._state?.selected?.has(index) === true);\n\n if (focusedCol >= 0 && tr.children[focusedCol]) {\n tr.children[focusedCol].focus?.();\n }\n return true;\n }\n\n /** Sync the (separate) header table's column widths to the body\n * table's measured widths. Without this, the two tables compute\n * widths independently and the columns drift apart. Locks both\n * tables to `table-layout: fixed` and writes explicit width onto\n * each header cell of every header row (header + filter row). */\n /**\n * Measure every column's NATURAL content width, in one transient reflow.\n *\n * Extracted from `_syncHeaderWidths` so that auto-size can ask the same\n * question the fit pass asks, and get the same answer. Two measurement\n * passes would drift, and the drift would show as a double-click that\n * sized a column differently from the render that follows it.\n *\n * The pass ignores the CSS caps (the 150px-pinned first column, the 80px\n * min on the rest) and the filter-row inputs: `twm-dt-measuring` flips both\n * tables to `table-layout:auto; width:max-content` with those caps off (via\n * `!important`) for a single reflow, then reverts before paint \u2014 it is\n * never visible. Clearing inline widths first stops the last sync's forced\n * widths from constraining the measure.\n *\n * C10 \u2014 UNDER `virtualize` ONLY THE WINDOW IS IN THE DOM, so `max-content`\n * spans the eighty-odd rows drawn rather than every row loaded. The fit\n * pass that runs on every render is content with that (it is fitting what\n * is on screen). An EXPLICIT auto-size is not: it is a promise to fit the\n * column's content, and the longest value in a 6,000-row table is usually\n * not in the window. So `sample` adds, for the length of this one reflow,\n * the row holding each column's longest value \u2014 see `_virtSampleRows`.\n *\n * @param {{sample?: boolean}} [o]\n * @returns {number[]|null} width per DOM column index, or null when there\n * is nothing laid out to measure.\n */\n _measureNaturalWidths({ sample = false } = {}) {\n const headerTable = this._headerTableEl;\n const bodyTable = this._tableEl;\n if (!headerTable || !bodyTable) return null;\n // A ROW OF DATA, not merely the first `<tr>`: under C10 that is a\n // spacer, and an embedder may inject rows of its own (a group header is\n // one cell spanning every column, which would measure as ONE column).\n const firstRow = this._firstBodyRow();\n if (!firstRow) return null;\n const bodyCells = firstRow.children;\n if (!bodyCells.length) return null;\n\n headerTable.querySelectorAll('thead > tr').forEach((tr) => {\n for (const th of tr.children) this._clearCellWidth(th);\n });\n for (const td of bodyCells) this._clearCellWidth(td);\n // C10: the `<col>`s are what hold the widths, so they are what has to\n // let go for the measure (`.twm-dt-measuring col` also overrides them).\n for (const col of this._cols() || []) col.style.width = '';\n headerTable.style.width = '';\n bodyTable.style.width = '';\n headerTable.classList.add('twm-dt-measuring');\n bodyTable.classList.add('twm-dt-measuring');\n // Appended at the end, where they move no drawn row, and taken out\n // again below before anything paints.\n const sampled = sample ? this._virtSampleRows() : [];\n for (const tr of sampled) this._virt.tbody.appendChild(tr);\n // Force layout flush so measurements are current.\n // eslint-disable-next-line no-unused-expressions\n bodyTable.offsetWidth;\n\n // Natural width per column = the wider of its header label and its\n // body content. `max-content` already spans every rendered body\n // row, so the body cell of the first row reports the whole column.\n const labelRow = headerTable.querySelector('thead > tr');\n const cols = bodyCells.length;\n const natural = new Array(cols);\n // \u2500\u2500 AND CSS `zoom` IS DIVIDED BACK OUT \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n //\n // `getBoundingClientRect()` reports CLIENT pixels, so under a `zoom`\n // anywhere above this table every width read here comes back multiplied\n // by that zoom \u2014 while `_setCellWidth` writes a plain `width` in the\n // cell's OWN pixels, which the same zoom then multiplies again. The two\n // halves of one measure-and-apply loop would be in different units:\n // measured at 200% a column is pinned twice as wide as its text needs,\n // and at 50% it is pinned half as wide and every value ellipsises. The\n // fit pass has the same split, because its `avail` is `clientWidth`,\n // which is NOT zoom-adjusted.\n //\n // `currentCSSZoom` is the effective zoom on this element \u2014 1 when\n // nothing above it zooms, and `undefined` in an engine that predates\n // the property \u2014 so this is exactly a no-op for every consumer that\n // does not zoom, which is all of them but the Tables grid.\n const zoom = bodyTable.currentCSSZoom || 1;\n for (let i = 0; i < cols; i++) {\n const body = bodyCells[i].getBoundingClientRect().width / zoom;\n const head = labelRow && labelRow.children[i]\n ? labelRow.children[i].getBoundingClientRect().width / zoom\n : 0;\n natural[i] = Math.max(body, head);\n }\n\n for (const tr of sampled) tr.remove();\n headerTable.classList.remove('twm-dt-measuring');\n bodyTable.classList.remove('twm-dt-measuring');\n return natural;\n }\n\n /**\n * The rows an explicit auto-size must measure that the window has not\n * drawn: for each column, the drawable row whose value is LONGEST as a\n * string, plus the last row (the widest row number). Built with\n * `_buildBodyRow` \u2014 so a consumer's `renderCell` draws them exactly as it\n * would on screen \u2014 and handed back detached, for `_measureNaturalWidths`\n * to put in and take out around its one reflow.\n *\n * The string length is a proxy, not a measurement: in a proportional font\n * forty `i`s are narrower than thirty `W`s. It is the proxy a spreadsheet's\n * own autofit falls short by, and it is right about the case that matters\n * here \u2014 a value five times longer than anything in the window. One pass\n * over the loaded rows, on a click and never on a scroll or a resize.\n *\n * @returns {HTMLTableRowElement[]}\n */\n _virtSampleRows() {\n const v = this._virt;\n if (!v || !v.rows.length) return [];\n const longest = [];\n const at = [];\n let last = -1;\n for (let i = 0; i < v.rows.length; i++) {\n if (!(v.heights[i] > 0)) continue; // hidden: not drawn, not fitted\n last = i;\n const row = v.rows[i];\n if (!Array.isArray(row)) continue;\n for (let c = 0; c < row.length; c++) {\n const value = row[c];\n const len = value == null ? 0 : String(value).length;\n if (len > (longest[c] ?? -1)) { longest[c] = len; at[c] = i; }\n }\n }\n const want = new Set(at.filter((i) => i !== undefined));\n if (last >= 0) want.add(last);\n const rows = [];\n for (const i of want) {\n if (v.map.has(i)) continue; // drawn already; measured anyway\n const tr = this._buildBodyRow(v.rows[i], v.globalOf(i), i);\n tr.setAttribute('aria-hidden', 'true');\n rows.push(tr);\n }\n return rows;\n }\n\n /**\n * Fit one column to its widest value and pin it there \u2014 every loaded\n * row's, under `virtualize` (see `_virtSampleRows`), not only the window's.\n *\n * The gesture is a double-click on the column's resize grip, which is where\n * every spreadsheet has put it \u2014 and the grip is this component's, which is\n * why the behaviour is too. A consumer that wanted this had no hook to hang\n * it on: `_installColumnResizers` bound `mousedown` and a `click` that only\n * suppressed the sort, and the measurement, the pin, the table-width\n * invariant and the write-through to `stateStore` are all private here.\n *\n * @param {number} domIdx column index INCLUDING the row-number column when\n * `showRowNumbers` is on \u2014 the same index space as `_colWidths`.\n * @param {{maxWidth?: number}} [opts] ceiling; defaults to AUTOSIZE_MAX_PX.\n * @returns {boolean} whether it had a layout to measure.\n */\n autoSizeColumn(domIdx, opts = {}) {\n const natural = this._measureNaturalWidths({ sample: true });\n if (!natural || domIdx < 0 || domIdx >= natural.length) return false;\n this._colWidths[domIdx] = this._autoWidth(natural[domIdx], opts);\n this._colWidthsSig = this._colSig();\n this._savePersisted();\n this._syncHeaderWidths();\n return true;\n }\n\n /**\n * The same for every column at once.\n *\n * It REPLACES existing drag overrides rather than sizing around them: \"fit\n * every column to its content\" that quietly excepted the three columns you\n * had dragged would be a button whose result depends on history nobody can\n * see.\n *\n * The result may well be wider than the container \u2014 forty columns of real\n * content usually are \u2014 and that is the intended answer, not a failure:\n * `_syncHeaderWidths` honours overrides verbatim, sizes both tables to their\n * total and the body wrap scrolls sideways with the header following it.\n * Squeezing them to fit is what the automatic fit pass does on every render\n * already, so a button that did that would be a button that does nothing.\n */\n autoSizeColumns(opts = {}) {\n const natural = this._measureNaturalWidths({ sample: true });\n if (!natural) return false;\n this._colWidths = {};\n for (let i = 0; i < natural.length; i++) {\n this._colWidths[i] = this._autoWidth(natural[i], opts);\n }\n this._colWidthsSig = this._colSig();\n this._savePersisted();\n this._syncHeaderWidths();\n return true;\n }\n\n /** One measured width, floored at the drag-resize minimum and capped, with\n * the same sub-pixel pad `_fitColumnWidths` adds against ellipsis. */\n _autoWidth(natural, opts = {}) {\n const max = opts.maxWidth ?? AUTOSIZE_MAX_PX;\n return Math.min(max, Math.max(40, Math.ceil((natural || 0) + 2)));\n }\n\n /**\n * Does every one of the `n` DOM columns already carry an override taken\n * against the column set that is on screen right now?\n *\n * The signature half is not belt-and-braces. `render()` drops `_colWidths`\n * when `_colSig` changes, but `_syncHeaderWidths` is also reached straight\n * from the ResizeObserver, which never goes through `render()` \u2014 so a set\n * of overrides measured against the PREVIOUS headers can still be sitting\n * in `_colWidths` when this is asked. Answering \"pinned\" then would skip\n * the measure and hand `_fitColumnWidths` widths keyed to columns that are\n * no longer there, each one landing on its neighbour.\n *\n * `== null` rather than a falsy test, to match `_fitColumnWidths`' own\n * `overrides[i] != null`: a legitimately-stored 0 must be read the same way\n * in both places or the two disagree about which columns are flexible.\n */\n _allColumnsPinned(n) {\n if (!n || this._colWidthsSig !== this._colSig()) return false;\n for (let i = 0; i < n; i++) {\n if (this._colWidths[i] == null) return false;\n }\n return true;\n }\n\n /** Sync the (separate) header table's column widths to the body\n * table's measured widths. Without this, the two tables compute\n * widths independently and the columns drift apart. Locks both\n * tables to `table-layout: fixed` and writes explicit width onto\n * each header cell of every header row (header + filter row). */\n _syncHeaderWidths() {\n const headerTable = this._headerTableEl;\n const bodyTable = this._tableEl;\n if (!headerTable || !bodyTable) return;\n // C10. UNDER `virtualize` THE COLUMN TRACK IS THE `<colgroup>`, and the\n // column count is ITS length \u2014 not the first row's, which is whatever\n // row the window happens to start at (or a spacer). Without it, the\n // first ROW OF DATA; see `_firstBodyRow` for why not merely the first `<tr>`.\n const cols = this._cols();\n const firstRow = this._firstBodyRow();\n const bodyCells = cols ? [] : firstRow?.children;\n const n = cols ? cols.length : (bodyCells?.length || 0);\n if (!n) return;\n\n const headerRows = headerTable.querySelectorAll('thead > tr');\n // DO NOT MEASURE WHAT NOTHING WILL READ.\n //\n // `_measureNaturalWidths` flips BOTH tables to\n // `table-layout:auto; width:max-content` with the CSS caps lifted, for\n // a full synchronous reflow (`.twm-dt-measuring`, css/base.css). This\n // method is the ResizeObserver's callback, so that reflow fires once\n // per animation frame for the whole of a splitter drag \u2014 and an\n // embedder that pages a thousand rows at a time across twenty columns\n // re-lays-out ~20,000 cells per frame for it.\n //\n // When every column is pinned, `_fitColumnWidths` reads `natural[i]`\n // for no `i` at all: each column takes its override verbatim, and the\n // only thing left that the array supplies is `n`, which is its length.\n // So zeroes of the right length are not an approximation of the\n // measurement, they are indistinguishable from it.\n const natural = this._allColumnsPinned(n)\n ? new Array(n).fill(0)\n : this._measureNaturalWidths();\n if (!natural) return;\n\n // \u2500\u2500 Fit pass: turn natural widths into final widths that respect\n // the available space, favour the first column, and cap runaways.\n // User-dragged columns (`_colWidths`) are honored as-is inside.\n const wrap = this._tableWrapEl;\n const headerWrap = this._headerWrapEl;\n const avail = wrap ? wrap.clientWidth : 0;\n const firstIdx = this.config.showRowNumbers && n > 1 ? 1 : 0;\n const widths = this._fitColumnWidths(natural, avail, {\n firstIdx,\n overrides: this._colWidths,\n fit: this.config.columnFit,\n });\n const total = widths.reduce((a, b) => a + b, 0);\n\n // Apply measured widths to every header row at the matching\n // column index AND the body's first row, so both tables compute\n // the SAME column track. `_setCellWidth` also clears any CSS\n // min/max-width (e.g. the 150px-pinned first \"time\" column) so\n // the explicit width is actually honored.\n headerRows.forEach((tr) => {\n for (let i = 0; i < tr.children.length && i < widths.length; i++) {\n this._setCellWidth(tr.children[i], widths[i]);\n }\n });\n if (cols) {\n for (let i = 0; i < cols.length && i < widths.length; i++) {\n cols[i].style.width = `${widths[i]}px`;\n }\n } else {\n for (let i = 0; i < bodyCells.length && i < widths.length; i++) {\n this._setCellWidth(bodyCells[i], widths[i]);\n }\n }\n\n // Lock both tables so the widths stick even when content changes.\n headerTable.style.tableLayout = 'fixed';\n bodyTable.style.tableLayout = 'fixed';\n\n // Size both tables to the explicit column TOTAL (not the CSS\n // `width: 100%`) so a widened column GROWS the table and the\n // body wrap scrolls horizontally, instead of squeezing into a\n // fixed budget and stealing from its neighbours. When the\n // columns fit and the user hasn't dragged, stay at 100% to fill\n // the container exactly with no phantom scrollbar.\n const hasOverride = Object.keys(this._colWidths).length > 0;\n if (hasOverride || total > avail + 1) {\n headerTable.style.width = `${total}px`;\n bodyTable.style.width = `${total}px`;\n } else {\n headerTable.style.width = '';\n bodyTable.style.width = '';\n }\n\n // Scrollbar gutter: when the body shows a vertical scrollbar, its\n // content is narrower than the wrap by `scrollbarW`. The header\n // wrap has no scrollbar, so pad it on the right to match.\n //\n // C29b. AND THE SAME NUMBER IS PUBLISHED AS A CUSTOM PROPERTY, because\n // padding does not help the one thing C29 was for. A `position: sticky`\n // cell pins to its scroll container's SCROLLPORT, and the scrollport of\n // a box with a classic scrollbar excludes that scrollbar while padding\n // is inside it \u2014 so `right: 0` in the body pins `sbw` px to the LEFT of\n // `right: 0` in the header, and a pinned trailing column would sit\n // visibly out of line with its own heading. There is nothing a\n // stylesheet can measure this from: it is the platform's scrollbar\n // width, known here and nowhere else. Written on the WRAPPER rather\n // than either box so a consumer's rule can read it from whichever of\n // the two it is styling, and written on every sync because a scrollbar\n // appears and disappears with the row count.\n if (wrap && headerWrap) {\n const sbw = Math.max(0, wrap.offsetWidth - wrap.clientWidth);\n headerWrap.style.paddingRight = sbw ? `${sbw}px` : '';\n this._wrapperEl?.style?.setProperty('--twm-dt-gutter', `${sbw}px`);\n }\n\n // Keep the header aligned with the body's current horizontal\n // scroll (a resize can clamp scrollLeft).\n this._syncHeaderScroll();\n\n // Columns are now fixed-width: any cell whose text was clipped\n // gets a hover tooltip carrying the full value.\n this._updateCellTooltips();\n }\n\n /**\n * Convert measured natural content widths into final column widths.\n *\n * Goals (the \"intelligent\" sizing):\n * - every column wants its content width (+a hair), clamped to a\n * sane [floor, cap]; the FIRST content column gets a more generous\n * cap so it shows its full value;\n * - user-dragged columns (`overrides`) are pinned, never grown/shrunk;\n * - if everything fits, grow the flexible columns evenly to fill the\n * width (no dead gap on the right);\n * - if it doesn't fit, protect the first column and water-fill-shrink\n * the rest (trim the widest first) until it fits; only if even the\n * floors overflow do we give up and let the body scroll sideways.\n *\n * Under `fit: 'content'` the first and last of those goals invert: each\n * unpinned column asks for its own content width through the same\n * `_autoWidth` the grip double-click uses, and an overflow is the answer\n * rather than a problem \u2014 the caller wanted a table that scrolls sideways,\n * not one squeezed toward the floor. The grow-to-fill branch is shared by\n * both, because a table narrower than its container leaves a dead gap on\n * the right under either reading.\n *\n * @param {number[]} natural measured content width per column (px)\n * @param {number} avail usable width of the body wrap (px)\n * @param {{firstIdx?:number, overrides?:Object, fit?:'container'|'content'}} [opts]\n * @returns {number[]} final width per column (px)\n */\n _fitColumnWidths(natural, avail, opts = {}) {\n const FLOOR = 40; // matches the drag-resize minimum\n const CAP = 360; // general per-column ceiling\n const FIRST_CAP = 520; // the first column may run wider\n const PAD = 2; // sub-pixel safety against ellipsis\n\n const n = natural.length;\n const firstIdx = opts.firstIdx ?? 0;\n const overrides = opts.overrides || {};\n // Anything that is not the literal opt-in is the historical behaviour.\n // Read once, so an embedder that passes a typo gets the old layout\n // rather than half of each.\n const toContent = opts.fit === 'content';\n\n // Desired (pre-fit) width per column. Pinned columns take their\n // override verbatim and sit out the grow/shrink redistribution.\n const desired = new Array(n);\n const pinned = new Array(n).fill(false);\n for (let i = 0; i < n; i++) {\n if (overrides[i] != null) {\n desired[i] = Math.max(FLOOR, Math.round(overrides[i]));\n pinned[i] = true;\n continue;\n }\n if (toContent) {\n // THE SAME CALL THE GRIP DOUBLE-CLICK MAKES \u2014 `autoSizeColumn`\n // \u2192 `_autoWidth` \u2014 and deliberately not a second arithmetic\n // that happens to agree with it today. Two width formulas\n // drift, and the drift shows up as a column that jumps the\n // first time anyone double-clicks its grip.\n //\n // FIRST_CAP has nothing to say here. It exists to favour one\n // column while the others are being squeezed; under a content\n // fit nothing is being squeezed, so there is no column to\n // favour and every one of them is held to the same ceiling.\n desired[i] = this._autoWidth(natural[i]);\n continue;\n }\n const cap = i === firstIdx ? FIRST_CAP : CAP;\n desired[i] = Math.min(cap, Math.max(FLOOR, Math.ceil(natural[i] + PAD)));\n }\n\n const widths = desired.slice();\n const sum = widths.reduce((a, b) => a + b, 0);\n\n // Not laid out yet (or content already exactly fits): hand back the\n // desired widths; the caller decides fill vs horizontal scroll.\n if (avail <= 1) return widths;\n\n if (sum <= avail) {\n // Grow flexible columns evenly to fill the remaining space so\n // the table doesn't leave a dead gap on the right. When EVERY\n // column is pinned (e.g. after the user has dragged a column \u2014\n // the resize freezes all columns as overrides), fall back to\n // the last column so the table still spans the full container:\n // the width invariant \u2014 a table never renders narrower than\n // 100% of its wrap.\n const flex = [];\n for (let i = 0; i < n; i++) if (!pinned[i]) flex.push(i);\n const slack = avail - sum;\n if (slack > 0) {\n const targets = flex.length ? flex : [n - 1];\n const per = Math.floor(slack / targets.length);\n for (const i of targets) widths[i] += per;\n widths[targets[targets.length - 1]] += slack - per * targets.length;\n }\n return widths;\n }\n\n // OVERFLOW IS THE ANSWER UNDER A CONTENT FIT, not a case to recover\n // from. Everything below squeezes the unprotected columns toward the\n // 40px floor so that forty columns can be made to fit a pane \u2014 which is\n // precisely the outcome `columnFit: 'content'` opted out of. Handing\n // back the content widths lets the caller's `total > avail + 1` test\n // size both tables to the total, and the body wrap then scrolls\n // sideways with the header following it.\n if (toContent) return widths;\n\n // Overflow: protect the first column + pinned columns, water-fill\n // the rest down toward the floor.\n let protectedSum = 0;\n const shrinkable = [];\n for (let i = 0; i < n; i++) {\n if (pinned[i] || i === firstIdx) protectedSum += widths[i];\n else shrinkable.push(i);\n }\n const budget = avail - protectedSum;\n if (budget < shrinkable.length * FLOOR) {\n // Even at the floor we overflow \u2192 let the body scroll sideways.\n for (const i of shrinkable) widths[i] = FLOOR;\n return widths;\n }\n // Max-min fair allocation: the narrow columns keep their content,\n // the widest share the remaining budget equally.\n shrinkable.sort((a, b) => desired[a] - desired[b]);\n let remaining = budget;\n for (let k = 0; k < shrinkable.length; k++) {\n const colsLeft = shrinkable.length - k;\n const fair = Math.floor(remaining / colsLeft);\n const i = shrinkable[k];\n if (desired[i] <= fair) {\n widths[i] = desired[i];\n remaining -= desired[i];\n } else {\n const level = Math.max(FLOOR, fair);\n for (let j = k; j < shrinkable.length; j++) {\n widths[shrinkable[j]] = level;\n }\n // Dump any rounding remainder onto the widest column.\n const leftover = remaining - colsLeft * level;\n if (leftover > 0) widths[shrinkable[shrinkable.length - 1]] += leftover;\n break;\n }\n }\n return widths;\n }\n\n /** Set an explicit width on a table cell, clearing any CSS min/max\n * width constraint so the width is honored exactly. The first\n * (\"time\") column is pinned to 150px by `min/max-width` in CSS;\n * without this, dragging it does nothing and the slack leaks to the\n * other columns. */\n _setCellWidth(cell, w) {\n cell.style.width = `${w}px`;\n cell.style.minWidth = '0';\n cell.style.maxWidth = 'none';\n }\n\n /** Undo `_setCellWidth` so a re-measure sees the cell's natural,\n * CSS-constrained width again. */\n _clearCellWidth(cell) {\n cell.style.width = '';\n cell.style.minWidth = '';\n cell.style.maxWidth = '';\n }\n\n /** Wire the body wrap's horizontal scroll to the header. The header\n * sits in an overflow:hidden wrap, so it can't scroll sideways on\n * its own \u2014 `_syncHeaderScroll` scrolls it programmatically to the\n * body's `scrollLeft`. Re-installed each render against the freshly-built\n * wrap. */\n _installHeaderScrollSync() {\n const wrap = this._tableWrapEl;\n if (!wrap) return;\n if (this._onBodyScroll && this._scrollSyncEl) {\n this._scrollSyncEl.removeEventListener('scroll', this._onBodyScroll);\n }\n this._onBodyScroll = () => this._syncHeaderScroll();\n this._scrollSyncEl = wrap;\n wrap.addEventListener('scroll', this._onBodyScroll, { passive: true });\n this._syncHeaderScroll();\n }\n\n /**\n * Scroll the header wrap to match the body's horizontal scroll so the\n * columns stay aligned when the table overflows sideways.\n *\n * \u2550\u2550 C29. A TRANSFORM IS WHAT MAKES A STICKY COLUMN IMPOSSIBLE \u2550\u2550\u2550\u2550\u2550\u2550\u2550\n *\n * This wrote `headerTable.style.transform = translateX(-scrollLeft)`. It\n * aligns the two tables perfectly and it forecloses `position: sticky`\n * entirely, because the two halves of the table then pin against different\n * things: a sticky cell in the BODY pins to the body wrap's scrollport,\n * while its header counterpart is moved by a transform inside a box that\n * never scrolls at all. Scroll sideways and the pinned body column stands\n * still while its header slides away with everything else \u2014 so a table\n * with a trailing verb column (the row-actions column Tables needs pinned\n * to the right edge) can have a sticky body or an aligned header, never\n * both. A transform also establishes a containing block for fixed/sticky\n * descendants, which breaks the header cell independently of the offset.\n *\n * AN `overflow: hidden` BOX IS STILL A SCROLL CONTAINER. It has no\n * scrollbar and no user affordance, and `scrollLeft` moves it exactly like\n * any other. Scrolling the wrap rather than transforming its child gives\n * the header a real scrollport at the same offset as the body's, which is\n * the one arrangement in which a sticky cell on each side pins to the same\n * place. Identical for ordinary content: same pixels, no transform, no new\n * containing block.\n *\n * THE CLAMP IS ALREADY PAID FOR. A scroll container clamps `scrollLeft` to\n * `scrollWidth - clientWidth`, and the body wrap carries a vertical\n * scrollbar the header wrap does not \u2014 so the header would clamp short by\n * the scrollbar width and desync at the far right. `_syncHeaderWidths`\n * already pads the header wrap by exactly that gutter (`paddingRight`,\n * :1905), and end padding counts toward `scrollWidth`, so the two maxima\n * coincide. The residual below is the honest belt for the day some engine\n * disagrees about that: it is zero in the ordinary case, so the transform\n * is not set and sticky keeps working, and it is the difference rather\n * than the whole offset if it is ever not.\n */\n _syncHeaderScroll() {\n const wrap = this._tableWrapEl;\n const headerTable = this._headerTableEl;\n if (!wrap || !headerTable) return;\n const x = wrap.scrollLeft;\n const headerWrap = this._headerWrapEl;\n if (!headerWrap) {\n // No wrap to scroll \u2014 a consumer that built the header some other\n // way still gets the behaviour it always had.\n headerTable.style.transform = x ? `translateX(${-x}px)` : '';\n return;\n }\n headerWrap.scrollLeft = x;\n const residual = x - headerWrap.scrollLeft;\n headerTable.style.transform = residual ? `translateX(${-residual}px)` : '';\n }\n\n /** Drag-to-resize: hang a thin grab handle off the right edge of\n * every header cell. Dragging it writes a per-column width override\n * (keyed by DOM index) that `_syncHeaderWidths` then honors. */\n _installColumnResizers() {\n const headerTable = this._headerTableEl;\n if (!headerTable) return;\n const headRow = headerTable.querySelector('thead > tr');\n if (!headRow) return;\n [...headRow.children].forEach((th, domIdx) => {\n if (th.querySelector('.twm-dt-col-resizer')) return;\n th.classList.add('twm-dt-col');\n const grip = document.createElement('div');\n grip.className = 'twm-dt-col-resizer';\n grip.addEventListener('mousedown',\n (ev) => this._beginColResize(ev, domIdx));\n // Keep a resize gesture from registering as a sort click.\n grip.addEventListener('click', (ev) => ev.stopPropagation());\n // Double-click the grip: fit the column to its content. The gesture\n // every spreadsheet has, on the affordance it has always been on.\n // Stopped as well as prevented, or a consumer that opens a column\n // menu from the header (Tables does) opens it on the way past.\n grip.addEventListener('dblclick', (ev) => {\n ev.preventDefault();\n ev.stopPropagation();\n this.autoSizeColumn(domIdx);\n });\n th.appendChild(grip);\n });\n }\n\n /**\n * CSS px per screen px. Content inside a zoomed tile reports rects and\n * pointer coordinates in screen pixels, while `style.width` is CSS pixels;\n * mixing them widened every column by the zoom factor on a mere click.\n */\n _zoomFactor() {\n const el = this._tableWrapEl || this._tableEl;\n const css = el?.offsetWidth || 0;\n const screen = el?.getBoundingClientRect?.().width || 0;\n return css > 0 && screen > 0 ? screen / css : 1;\n }\n\n _beginColResize(ev, domIdx) {\n if (ev.button != null && ev.button !== 0) return;\n ev.preventDefault();\n ev.stopPropagation();\n const headerTable = this._headerTableEl;\n const bodyTable = this._tableEl;\n const headRow = headerTable && headerTable.querySelector('thead > tr');\n if (!headRow) return;\n\n // NOTHING HAPPENS UNTIL THE POINTER MOVES. Freezing on mousedown pinned\n // every column on a plain click, and the first click of a double-click,\n // so a click on a grip was already a resize and switched auto-fit off\n // for every column for good.\n //\n // Once the drag is real: freeze EVERY column at its current width on\n // BOTH tables and lock fixed layout, so the drag moves only the grabbed\n // column and a neighbour can never absorb it. Widths come from the\n // header row (the column source of truth), in CSS pixels.\n const startX = ev.clientX;\n const THRESHOLD = 3;\n const MIN = 40;\n let startWidths = null;\n const begin = () => {\n const z = this._zoomFactor();\n startWidths = [...headRow.children].map((c) => {\n const set = parseFloat(c.style.width);\n return Number.isFinite(set) ? set : c.getBoundingClientRect().width / z;\n });\n headerTable.style.tableLayout = 'fixed';\n if (bodyTable) bodyTable.style.tableLayout = 'fixed';\n startWidths.forEach((w, i) => this._pinColumnWidth(i, w));\n this._applyTableWidth();\n document.body.classList.add('twm-dt-col-resizing');\n };\n const onMove = (mv) => {\n const dx = mv.clientX - startX;\n if (!startWidths) {\n if (Math.abs(dx) < THRESHOLD) return;\n begin();\n }\n const w = Math.max(MIN, Math.round(startWidths[domIdx] + dx / this._zoomFactor()));\n this._pinColumnWidth(domIdx, w);\n // Pass the dragged column so the fill invariant reclaims any\n // freed width into a DIFFERENT (flexible/last) column, never\n // shrinking the table below the container.\n this._applyTableWidth(domIdx);\n this._syncHeaderScroll();\n };\n const onUp = () => {\n document.removeEventListener('mousemove', onMove);\n document.removeEventListener('mouseup', onUp);\n if (!startWidths) return; // a click: nothing changed\n document.body.classList.remove('twm-dt-col-resizing');\n this._updateCellTooltips();\n this._savePersisted();\n };\n document.addEventListener('mousemove', onMove);\n document.addEventListener('mouseup', onUp);\n }\n\n /** Pin one column to an explicit width across BOTH tables (every\n * header row + the body's first row) and record it as a user\n * override so `_syncHeaderWidths` honors it on later renders. The\n * single place that writes a column width during a drag / fill. */\n _pinColumnWidth(i, w) {\n const headerTable = this._headerTableEl;\n const bodyTable = this._tableEl;\n if (!headerTable) return;\n this._colWidths[i] = w;\n headerTable.querySelectorAll('thead > tr').forEach((tr) => {\n if (tr.children[i]) this._setCellWidth(tr.children[i], w);\n });\n // C10: the `<col>` is the track; without one, the first row of data.\n const cols = this._cols();\n if (cols) {\n if (cols[i]) cols[i].style.width = `${w}px`;\n return;\n }\n const bodyRow = bodyTable && this._firstBodyRow();\n if (bodyRow && bodyRow.children[i]) this._setCellWidth(bodyRow.children[i], w);\n }\n\n /** Size both tables so a widened column grows the table (\u2192 horizontal\n * scroll) rather than stealing from its neighbours \u2014 while enforcing\n * the TABLE WIDTH INVARIANT: the table is never narrower than its\n * container. Any width freed by dragging a column in stretches a\n * flexible column (the last one, stepping off the column being\n * dragged) so the table always spans \u2265100% of the wrap.\n *\n * @param {number|null} dragIdx column the user is actively dragging,\n * so the fill lands on a DIFFERENT column and doesn't fight the\n * drag. Null (non-drag callers) lets the last column flex. */\n _applyTableWidth(dragIdx = null) {\n const headerTable = this._headerTableEl;\n const bodyTable = this._tableEl;\n const headRow = headerTable && headerTable.querySelector('thead > tr');\n if (!headRow) return;\n const cells = [...headRow.children];\n const cols = cells.length;\n if (cols === 0) return;\n\n const FLOOR = 40; // matches the drag-resize minimum\n const widthOf = (th) => {\n const px = parseFloat(th.style.width);\n return Number.isFinite(px) ? px : th.getBoundingClientRect().width;\n };\n const cur = cells.map(widthOf);\n\n // Fill invariant: pick a flexible column and stretch it to soak up\n // any freed width so the summed total is never below the container.\n const wrap = this._tableWrapEl;\n const avail = wrap ? wrap.clientWidth : 0;\n let flexIdx = cols - 1;\n if (dragIdx != null && flexIdx === dragIdx) flexIdx -= 1; // step off the dragged col\n if (avail > 1 && flexIdx >= 0 && flexIdx !== dragIdx) {\n let rest = 0;\n for (let i = 0; i < cols; i++) if (i !== flexIdx) rest += cur[i];\n const fill = Math.max(FLOOR, Math.round(avail - rest));\n if (Math.round(fill) !== Math.round(cur[flexIdx])) {\n this._pinColumnWidth(flexIdx, fill);\n cur[flexIdx] = fill;\n }\n }\n\n let total = 0;\n for (const w of cur) total += w;\n total = Math.ceil(total);\n headerTable.style.width = `${total}px`;\n if (bodyTable) bodyTable.style.width = `${total}px`;\n }\n\n /** Add a native `title` tooltip to any body cell whose text is\n * clipped by its column width; remove ours once it fits again.\n * Leaves caller-supplied titles (e.g. from renderCell) untouched. */\n _updateCellTooltips(rows = null) {\n const bodyTable = this._tableEl;\n if (!bodyTable) return;\n // `rows`: only these (C10 \u2014 the rows a window slide just added).\n const cells = rows\n ? rows.flatMap((tr) => [...tr.children])\n : bodyTable.querySelectorAll('tbody td');\n cells.forEach((td) => {\n if (td.parentElement?.classList.contains('twm-dt-spacer')) return;\n const clipped = td.scrollWidth > td.clientWidth + 1;\n if (clipped) {\n if (!td.title) td.title = td.textContent;\n } else if (td.title && td.title === td.textContent) {\n td.removeAttribute('title');\n }\n });\n }\n\n _installInteractions() {\n if (!this._tbodyEl || !this._tableEl) return;\n\n const { selectable, copyable } = this.config;\n const tbody = this._tbodyEl;\n const table = this._tableEl;\n\n if (selectable) {\n const handleRowClick = (event) => {\n const rowEl = event.target.closest('tr');\n if (!rowEl || rowEl.__rowIndex === undefined) return;\n\n const idx = rowEl.__rowIndex;\n const selected = this._state.selected;\n\n if (event.shiftKey && this._state.anchorIndex != null) {\n const start = Math.min(this._state.anchorIndex, idx);\n const end = Math.max(this._state.anchorIndex, idx);\n selected.clear();\n for (let i = start; i <= end; i++) selected.add(i);\n } else if (event.metaKey || event.ctrlKey) {\n if (selected.has(idx)) selected.delete(idx);\n else selected.add(idx);\n this._state.anchorIndex = idx;\n } else {\n selected.clear();\n selected.add(idx);\n this._state.anchorIndex = idx;\n }\n\n this._updateRowSelection();\n this._notifySelectionChange();\n try { table.focus({ preventScroll: true }); } catch (_) {}\n };\n\n tbody.addEventListener('click', handleRowClick);\n this._disposers.push(() => tbody.removeEventListener('click', handleRowClick));\n }\n\n if (copyable) {\n const handleContextMenu = (event) => {\n const rowEl = event.target.closest('tr');\n if (!rowEl) {\n this._hideContextMenu();\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n\n const idx = rowEl.__rowIndex;\n if (idx !== undefined && !this._state.selected.has(idx)) {\n this._state.selected.clear();\n this._state.selected.add(idx);\n this._state.anchorIndex = idx;\n this._updateRowSelection();\n this._notifySelectionChange();\n }\n\n try { table.focus({ preventScroll: true }); } catch (_) {}\n setTimeout(() => this._showContextMenu(event.clientX, event.clientY), 0);\n };\n\n tbody.addEventListener('contextmenu', handleContextMenu);\n this._disposers.push(() => tbody.removeEventListener('contextmenu', handleContextMenu));\n\n const handleKeyDown = (event) => {\n const ctrlLike = event.ctrlKey || event.metaKey;\n if (ctrlLike && !event.altKey) {\n const key = String(event.key || '').toLowerCase();\n if (key === 'a' && selectable) {\n event.preventDefault();\n this._state.selected.clear();\n // Select only visible (filtered) rows via index map\n const indexMap = this._processedIndexMap;\n if (indexMap) {\n for (const originalIdx of indexMap) {\n this._state.selected.add(originalIdx);\n }\n } else {\n for (let i = 0; i < this.config.rows.length; i++) {\n this._state.selected.add(i);\n }\n }\n this._state.anchorIndex = this.config.rows.length - 1;\n this._updateRowSelection();\n this._notifySelectionChange();\n } else if (key === 'c') {\n event.preventDefault();\n this.copyToClipboard(event.shiftKey ? 'csv' : 'tsv');\n }\n } else if (event.key === 'Escape') {\n if (this._state.selected.size) {\n this.clearSelection();\n }\n this._hideContextMenu();\n }\n };\n\n table.addEventListener('keydown', handleKeyDown);\n this._disposers.push(() => table.removeEventListener('keydown', handleKeyDown));\n }\n }\n\n _updateRowSelection() {\n if (!this._tbodyEl) return;\n this._tbodyEl.querySelectorAll('tr').forEach(tr => {\n const idx = tr.__rowIndex;\n if (idx !== undefined) {\n tr.classList.toggle('selected', this._state.selected.has(idx));\n }\n });\n }\n\n _notifySelectionChange() {\n this.config.onSelectionChange?.(this.getSelection());\n }\n\n _ensureContextMenu() {\n if (this._contextMenuEl) return this._contextMenuEl;\n\n const menu = document.createElement('div');\n menu.className = 'twm-context-menu data-context-menu';\n menu.style.display = 'none';\n menu.style.position = 'fixed';\n menu.style.zIndex = '10001';\n menu.innerHTML = `\n <div class=\"twm-context-menu-item\" data-action=\"copy-tsv\">\n <span class=\"material-symbols-outlined\">content_copy</span>\n <span class=\"label\">Copy Row(s)</span>\n </div>\n <div class=\"twm-context-menu-item\" data-action=\"copy-csv\">\n <span class=\"material-symbols-outlined\">table</span>\n <span class=\"label\">Copy as CSV</span>\n </div>\n `;\n document.body.appendChild(menu);\n\n menu.addEventListener('click', (event) => {\n const item = event.target.closest('.twm-context-menu-item');\n if (!item || item.classList.contains('disabled')) return;\n const action = item.getAttribute('data-action');\n if (action === 'copy-tsv') this.copyToClipboard('tsv');\n else if (action === 'copy-csv') this.copyToClipboard('csv');\n event.stopPropagation();\n event.preventDefault();\n }, { capture: true });\n\n menu.addEventListener('contextmenu', (e) => {\n e.preventDefault();\n e.stopPropagation();\n });\n\n const hideOnGlobal = (event) => {\n if (event?.target && menu.contains(event.target)) return;\n this._hideContextMenu();\n };\n const hideOnEscape = (event) => {\n if (event.key === 'Escape') this._hideContextMenu();\n };\n const hideOnResize = () => this._hideContextMenu();\n\n document.addEventListener('click', hideOnGlobal, true);\n document.addEventListener('scroll', hideOnGlobal, true);\n window.addEventListener('resize', hideOnResize);\n document.addEventListener('keydown', hideOnEscape);\n\n this._contextMenuGlobals.push(() => document.removeEventListener('click', hideOnGlobal, true));\n this._contextMenuGlobals.push(() => document.removeEventListener('scroll', hideOnGlobal, true));\n this._contextMenuGlobals.push(() => document.removeEventListener('keydown', hideOnEscape));\n this._contextMenuGlobals.push(() => window.removeEventListener('resize', hideOnResize));\n\n this._contextMenuEl = menu;\n return menu;\n }\n\n _hideContextMenu() {\n if (this._contextMenuEl) {\n this._contextMenuEl.style.display = 'none';\n }\n }\n\n _showContextMenu(clientX, clientY) {\n const menu = this._ensureContextMenu();\n const hasSelection = this._state.selected.size > 0;\n\n menu.querySelectorAll('.twm-context-menu-item').forEach(item => {\n item.classList.toggle('disabled', !hasSelection);\n item.style.pointerEvents = hasSelection ? '' : 'none';\n });\n\n menu.style.display = 'block';\n const rect = menu.getBoundingClientRect();\n let left = clientX;\n let top = clientY;\n\n if (left + rect.width > window.innerWidth) {\n left = window.innerWidth - rect.width - 8;\n }\n if (top + rect.height > window.innerHeight) {\n top = window.innerHeight - rect.height - 8;\n }\n\n menu.style.left = `${left}px`;\n menu.style.top = `${top}px`;\n }\n\n _teardownContextMenu() {\n this._contextMenuGlobals.forEach(dispose => {\n try { dispose?.(); } catch (_) {}\n });\n this._contextMenuGlobals = [];\n if (this._contextMenuEl?.parentNode) {\n this._contextMenuEl.parentNode.removeChild(this._contextMenuEl);\n }\n this._contextMenuEl = null;\n }\n\n _formatValue(value, colIndex) {\n if (this.config.formatValue) {\n return this.config.formatValue(value, colIndex);\n }\n if (value === undefined || value === null) return '-';\n if (typeof value === 'number') {\n if (!Number.isFinite(value)) return '-';\n return Number(value.toFixed(4)).toString();\n }\n return String(value);\n }\n\n _csvEscape(value) {\n if (value == null) return '';\n const str = String(value);\n if (/[\",\\n]/.test(str)) {\n return `\"${str.replace(/\"/g, '\"\"')}\"`;\n }\n return str;\n }\n\n _fallbackCopy(text) {\n try {\n const textarea = document.createElement('textarea');\n textarea.value = text;\n textarea.setAttribute('readonly', '');\n textarea.style.position = 'absolute';\n textarea.style.left = '-9999px';\n document.body.appendChild(textarea);\n textarea.select();\n const ok = document.execCommand('copy');\n document.body.removeChild(textarea);\n return ok;\n } catch (_) {\n return false;\n }\n }\n\n _notify(title, message, type = 'info') {\n this.config.services?.eventBus?.emit?.('toast:show', { title, message, type });\n }\n}\n\nexport default DataT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