@ai-matrx/design-system 0.21.4 → 0.21.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/data-table/copy-helpers.d.cts +1 -1
  3. package/dist/data-table/copy-helpers.d.ts +1 -1
  4. package/dist/data-table/data-row-inspector.cjs.map +1 -1
  5. package/dist/data-table/data-row-inspector.js.map +1 -1
  6. package/dist/data-table/data-row-window.cjs.map +1 -1
  7. package/dist/data-table/data-row-window.js.map +1 -1
  8. package/dist/data-table/filter-engine.d.cts +1 -1
  9. package/dist/data-table/filter-engine.d.ts +1 -1
  10. package/dist/data-table/host.d.cts +1 -1
  11. package/dist/data-table/host.d.ts +1 -1
  12. package/dist/data-table/index.cjs +101 -22
  13. package/dist/data-table/index.cjs.map +1 -1
  14. package/dist/data-table/index.d.cts +10 -3
  15. package/dist/data-table/index.d.ts +10 -3
  16. package/dist/data-table/index.js +101 -22
  17. package/dist/data-table/index.js.map +1 -1
  18. package/dist/data-table/infer-filter.cjs +16 -0
  19. package/dist/data-table/infer-filter.cjs.map +1 -1
  20. package/dist/data-table/infer-filter.d.cts +1 -1
  21. package/dist/data-table/infer-filter.d.ts +1 -1
  22. package/dist/data-table/infer-filter.js +16 -0
  23. package/dist/data-table/infer-filter.js.map +1 -1
  24. package/dist/data-table/layered-filters.d.cts +1 -1
  25. package/dist/data-table/layered-filters.d.ts +1 -1
  26. package/dist/data-table/pagination.cjs.map +1 -1
  27. package/dist/data-table/pagination.js.map +1 -1
  28. package/dist/data-table/query-control.cjs +19 -0
  29. package/dist/data-table/query-control.cjs.map +1 -1
  30. package/dist/data-table/query-control.d.cts +1 -1
  31. package/dist/data-table/query-control.d.ts +1 -1
  32. package/dist/data-table/query-control.js +19 -0
  33. package/dist/data-table/query-control.js.map +1 -1
  34. package/dist/data-table/types.cjs.map +1 -1
  35. package/dist/data-table/types.d.cts +1 -1
  36. package/dist/data-table/types.d.ts +1 -1
  37. package/dist/data-table/url-state.d.cts +1 -1
  38. package/dist/data-table/url-state.d.ts +1 -1
  39. package/dist/data-table/uuid-cell.cjs.map +1 -1
  40. package/dist/data-table/uuid-cell.js.map +1 -1
  41. package/dist/data-table/xlsx.d.cts +1 -1
  42. package/dist/data-table/xlsx.d.ts +1 -1
  43. package/dist/{types-CbGNfo7r.d.ts → types-Dpl8OW_m.d.ts} +17 -1
  44. package/dist/{types-DRusLYrU.d.cts → types-DsmrqJHN.d.cts} +17 -1
  45. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/data-table/filter-engine.ts","../../src/data-table/infer-filter.ts","../../src/data-table/query-control.ts"],"sourcesContent":["import type {\n ColumnFilterValue,\n ColumnFiltersState,\n MatrxColumnDef,\n SortState,\n TableSearchMatchMode,\n} from \"./types\";\nimport {\n completeLayeredFilterRules,\n layeredFilterMatchesValue,\n type LayeredFilterRule,\n} from \"./layered-filters\";\n\n/**\n * Sentinel select-filter values for \"no value\" / \"any value\" — every select\n * filter offers them automatically when the column has empty cells, so any\n * table can isolate rows missing a value (or having one) without extra config.\n */\nexport const SELECT_EMPTY_VALUE = \"__empty__\";\nexport const SELECT_NOT_EMPTY_VALUE = \"__not_empty__\";\n\nexport function columnId<T>(col: MatrxColumnDef<T>): string {\n if (col.id) return col.id;\n if (col.accessorKey) return String(col.accessorKey);\n throw new Error(\"MatrxDataTable column requires `id` or `accessorKey`\");\n}\n\nexport function getCellValue<T>(row: T, col: MatrxColumnDef<T>): unknown {\n if (col.accessorFn) return col.accessorFn(row);\n if (col.accessorKey) {\n return (row as Record<string, unknown>)[col.accessorKey];\n }\n return undefined;\n}\n\nexport function getFilterValue<T>(row: T, col: MatrxColumnDef<T>): unknown {\n return col.filterValue ? col.filterValue(row) : getCellValue(row, col);\n}\n\nexport function getSortValue<T>(row: T, col: MatrxColumnDef<T>): unknown {\n return col.sortValue ? col.sortValue(row) : getCellValue(row, col);\n}\n\nexport function stringifyCellValue(value: unknown): string {\n if (value == null) return \"\";\n if (typeof value === \"string\") return value;\n if (typeof value === \"number\" || typeof value === \"boolean\") {\n return String(value);\n }\n if (value instanceof Date) return value.toISOString();\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n}\n\n/** Unicode-aware tokenization shared by whole-word table search. */\nexport function tableSearchWords(value: string): string[] {\n return value\n .toLocaleLowerCase()\n .split(/[^\\p{L}\\p{N}]+/u)\n .filter(Boolean);\n}\n\n/**\n * Match the primary table search against one row's searchable text. In\n * whole-word mode every entered word must exist as a complete token, so\n * `are` matches `we are ready` but never `hardware`.\n */\nexport function matchesTableSearch(\n searchableText: string,\n query: string,\n mode: TableSearchMatchMode = \"contains\",\n): boolean {\n const normalizedQuery = query.trim().toLocaleLowerCase();\n if (!normalizedQuery) return true;\n if (mode === \"contains\") {\n return searchableText.toLocaleLowerCase().includes(normalizedQuery);\n }\n const actualWords = new Set(tableSearchWords(searchableText));\n const expectedWords = tableSearchWords(normalizedQuery);\n return (\n expectedWords.length > 0 &&\n expectedWords.every((word) => actualWords.has(word))\n );\n}\n\nfunction compareValues(a: unknown, b: unknown): number {\n if (a == null && b == null) return 0;\n if (a == null) return -1;\n if (b == null) return 1;\n if (typeof a === \"number\" && typeof b === \"number\") return a - b;\n if (typeof a === \"boolean\" && typeof b === \"boolean\") {\n return Number(a) - Number(b);\n }\n return stringifyCellValue(a).localeCompare(stringifyCellValue(b), undefined, {\n numeric: true,\n sensitivity: \"base\",\n });\n}\n\n/** Select filters treat array-valued cells as sets, never as serialized JSON choices. */\nexport function selectCellValues(value: unknown): string[] {\n return (Array.isArray(value) ? value : [value])\n .map(stringifyCellValue)\n .filter((item) => item !== \"\");\n}\n\nexport function passesColumnFilter(\n value: unknown,\n filter: ColumnFilterValue,\n): boolean {\n const matches = (() => {\n switch (filter.kind) {\n case \"text\": {\n const s = stringifyCellValue(value);\n if (filter.mode === \"null\") return value == null;\n if (filter.mode === \"not_null\") return value != null;\n if (filter.mode === \"empty\") return s.trim() === \"\";\n if (filter.mode === \"not_empty\") return s.trim() !== \"\";\n const q = filter.value.trim().toLowerCase();\n if (!q) return true;\n return s.toLowerCase().includes(q);\n }\n case \"select\": {\n const selected =\n filter.values ??\n (filter.value && filter.value !== \"__all__\" ? [filter.value] : []);\n if (selected.length === 0) return true;\n const values = selectCellValues(value);\n // OR semantics across the set; sentinels compose (\"A or (empty)\").\n return selected.some((v) =>\n v === SELECT_EMPTY_VALUE\n ? values.length === 0\n : v === SELECT_NOT_EMPTY_VALUE\n ? values.length > 0\n : values.includes(v),\n );\n }\n case \"boolean\": {\n return Boolean(value) === filter.value;\n }\n case \"number\": {\n const n =\n typeof value === \"number\"\n ? value\n : Number(stringifyCellValue(value).replace(/[^0-9.-]/g, \"\"));\n if (Number.isNaN(n)) return false;\n if (filter.min !== undefined && n < filter.min) return false;\n if (filter.max !== undefined && n > filter.max) return false;\n return true;\n }\n }\n })();\n return filter.negated ? !matches : matches;\n}\n\nexport function filterAndSortRows<T>(\n rows: T[],\n columns: MatrxColumnDef<T>[],\n columnFilters: ColumnFiltersState,\n sort: SortState | null,\n globalSearch: string,\n anyOf?: { columnIds: string[]; query: string },\n layeredFilters?: readonly LayeredFilterRule[],\n globalSearchMode: TableSearchMatchMode = \"contains\",\n searchText?: (row: T) => string,\n): T[] {\n const colById = new Map(columns.map((c) => [columnId(c), c]));\n const q = globalSearch.trim().toLowerCase();\n const anyQ = anyOf?.query.trim().toLowerCase() ?? \"\";\n const activeLayeredFilters = completeLayeredFilterRules(layeredFilters);\n\n let result = rows.filter((row) => {\n for (const [id, filter] of Object.entries(columnFilters)) {\n if (!filter) continue;\n const col = colById.get(id);\n if (!col || col.filter === false) continue;\n if (!passesColumnFilter(getFilterValue(row, col), filter)) return false;\n }\n\n for (const rule of activeLayeredFilters) {\n const col = colById.get(rule.field);\n if (!col || !layeredFilterMatchesValue(getFilterValue(row, col), rule)) {\n return false;\n }\n }\n\n if (anyQ && anyOf) {\n const hit = anyOf.columnIds.some((id) => {\n const col = colById.get(id);\n if (!col) return false;\n return stringifyCellValue(getFilterValue(row, col))\n .toLowerCase()\n .includes(anyQ);\n });\n if (!hit) return false;\n }\n\n if (!q) return true;\n const searchableValues = columns\n .filter(\n (col) =>\n col.filter !== false || Boolean(col.accessorKey || col.accessorFn),\n )\n .map((col) => stringifyCellValue(getFilterValue(row, col)));\n const additionalSearchText = searchText?.(row);\n if (additionalSearchText) searchableValues.push(additionalSearchText);\n if (globalSearchMode === \"contains\") {\n return searchableValues.some((value) =>\n matchesTableSearch(value, q, \"contains\"),\n );\n }\n return matchesTableSearch(searchableValues.join(\" \"), q, \"whole_words\");\n });\n\n if (sort) {\n const col = colById.get(sort.id);\n if (col && col.sortable !== false) {\n const dir = sort.direction === \"asc\" ? 1 : -1;\n result = [...result].sort((a, b) => {\n const va = getSortValue(a, col);\n const vb = getSortValue(b, col);\n // Empty cells (null / \"\") sort LAST in both directions — sorting a\n // column should surface its values, never a wall of blanks.\n const ea = va == null || stringifyCellValue(va) === \"\";\n const eb = vb == null || stringifyCellValue(vb) === \"\";\n if (ea !== eb) return ea ? 1 : -1;\n return compareValues(va, vb) * dir;\n });\n }\n }\n\n return result;\n}\n\nexport function countActiveColumnFilters(filters: ColumnFiltersState): number {\n let n = 0;\n for (const f of Object.values(filters)) {\n if (!f) continue;\n switch (f.kind) {\n case \"text\":\n if (f.value.trim() || (f.mode && f.mode !== \"contains\")) n += 1;\n break;\n case \"select\":\n if (f.values ? f.values.length > 0 : f.value && f.value !== \"__all__\")\n n += 1;\n break;\n case \"boolean\":\n n += 1;\n break;\n case \"number\":\n if (f.min !== undefined || f.max !== undefined) n += 1;\n break;\n }\n }\n return n;\n}\n\nexport function isColumnFilterActive(\n filter: ColumnFilterValue | undefined,\n): boolean {\n if (!filter) return false;\n switch (filter.kind) {\n case \"text\":\n return (\n filter.value.trim().length > 0 ||\n (filter.mode !== undefined && filter.mode !== \"contains\")\n );\n case \"select\":\n return filter.values\n ? filter.values.length > 0\n : Boolean(filter.value) && filter.value !== \"__all__\";\n case \"boolean\":\n return true;\n case \"number\":\n return filter.min !== undefined || filter.max !== undefined;\n }\n}\n\n/** Apply draft edits onto a row for display (shallow field merge). */\nexport function applyRowEdits<T>(\n row: T,\n edits: Record<string, unknown> | undefined,\n): T {\n if (!edits || Object.keys(edits).length === 0) return row;\n return { ...row, ...edits };\n}\n","import type { ColumnFilterKind, MatrxColumnDef } from \"./types\";\nimport {\n SELECT_EMPTY_VALUE,\n SELECT_NOT_EMPTY_VALUE,\n getCellValue,\n selectCellValues,\n} from \"./filter-engine\";\n\n/** Auto-inference switches to text above this many distinct values… */\nconst SELECT_CARDINALITY_CAP = 24;\n\nexport type ResolvedFilterKind = \"text\" | \"select\" | \"boolean\" | \"number\";\n\n/**\n * Infer a filter UI from sample row values. Prefer select for low-cardinality\n * string/enum columns, boolean for booleans, number for numeric, else text.\n */\nexport function resolveFilterKind<T>(\n col: MatrxColumnDef<T>,\n sampleRows: T[],\n): ResolvedFilterKind | null {\n if (col.filter === false) return null;\n if (col.filter && col.filter !== \"auto\") return col.filter;\n\n const values = sampleRows\n .slice(0, 200)\n .map((row) => getCellValue(row, col))\n .filter((v) => v != null);\n\n if (values.length === 0) return \"text\";\n\n if (values.every((v) => typeof v === \"boolean\")) return \"boolean\";\n if (values.every((v) => typeof v === \"number\" && Number.isFinite(v))) {\n return \"number\";\n }\n\n const strings = values.flatMap(selectCellValues);\n const unique = new Set(strings);\n if (\n unique.size >= 1 &&\n unique.size <= SELECT_CARDINALITY_CAP &&\n unique.size < strings.length * 0.6\n ) {\n return \"select\";\n }\n\n return \"text\";\n}\n\nexport function collectSelectOptions<T>(\n col: MatrxColumnDef<T>,\n rows: T[],\n): Array<{ value: string; label: string }> {\n const seen = new Set<string>();\n const options: Array<{ value: string; label: string }> = [];\n let hasEmpty = false;\n for (const row of rows) {\n const values = selectCellValues(getCellValue(row, col));\n if (values.length === 0) {\n hasEmpty = true;\n continue;\n }\n for (const value of values) {\n if (col.filterOptions?.length || seen.has(value)) continue;\n seen.add(value);\n options.push({ value, label: value });\n }\n }\n const base = col.filterOptions?.length\n ? [...col.filterOptions]\n : options.sort((a, b) => a.label.localeCompare(b.label));\n // Emptiness sentinels: whenever the column has blank cells, every select\n // filter can isolate them — or exclude them — with zero per-table config.\n if (hasEmpty) {\n base.unshift(\n { value: SELECT_EMPTY_VALUE, label: \"(empty)\" },\n { value: SELECT_NOT_EMPTY_VALUE, label: \"(not empty)\" },\n );\n }\n return base;\n}\n\nexport function filterKindLabel(\n kind: ColumnFilterKind | ResolvedFilterKind,\n): string {\n switch (kind) {\n case \"text\":\n return \"Text\";\n case \"select\":\n return \"Select\";\n case \"boolean\":\n return \"Boolean\";\n case \"number\":\n return \"Number\";\n case \"auto\":\n return \"Auto\";\n case false:\n return \"Off\";\n }\n}\n","import {\n collectSelectOptions,\n resolveFilterKind,\n type ResolvedFilterKind,\n} from \"./infer-filter\";\nimport type { MatrxColumnDef, MatrxDataTableQueryState } from \"./types\";\n\nexport interface QueryFilterMeta {\n kind: ResolvedFilterKind | null;\n options: Array<{ value: string; label: string }>;\n}\n\n/**\n * Resolve header-filter metadata without inferring remote cardinality from the\n * current page. Controlled callers must declare select options explicitly;\n * local tables preserve the original inference behavior.\n */\nexport function resolveQueryFilterMeta<T>(\n column: MatrxColumnDef<T>,\n rows: T[],\n controlled: boolean,\n): QueryFilterMeta {\n if (!controlled) {\n const kind = resolveFilterKind(column, rows);\n return {\n kind,\n options: kind === \"select\" ? collectSelectOptions(column, rows) : [],\n };\n }\n if (column.filter === false) return { kind: null, options: [] };\n const declared = column.filter;\n const kind: ResolvedFilterKind =\n declared && declared !== \"auto\"\n ? declared\n : column.filterOptions?.length\n ? \"select\"\n : \"text\";\n return {\n kind,\n options: kind === \"select\" ? (column.filterOptions ?? []) : [],\n };\n}\n\nexport interface QueryStateChangeOptions {\n /** Reset to the first page after a query-shape change. */\n resetPage?: boolean;\n}\n\n/**\n * Build the next controlled query state without mutating the caller's object.\n * Search, filters, sort, facets, and page-size changes pass `resetPage: true`;\n * direct pagination passes a page patch without resetting it.\n */\nexport function nextQueryState(\n current: MatrxDataTableQueryState,\n patch: Partial<MatrxDataTableQueryState>,\n options: QueryStateChangeOptions = {},\n): MatrxDataTableQueryState {\n return {\n ...current,\n ...patch,\n page: options.resetPage ? 1 : (patch.page ?? current.page),\n };\n}\n\n/** Resolve a safe one-based page for the latest remote total. */\nexport function safeQueryPage(\n requestedPage: number,\n totalItems: number,\n pageSize: number,\n): number {\n const safeTotal = Math.max(0, totalItems);\n const safeSize = Math.max(1, pageSize);\n const pageCount = Math.max(1, Math.ceil(safeTotal / safeSize));\n return Math.min(Math.max(1, requestedPage), pageCount);\n}\n\n"],"mappings":";;AAkBO,IAAM,qBAAqB;AAC3B,IAAM,yBAAyB;AAQ/B,SAAS,aAAgB,KAAQ,KAAiC;AACvE,MAAI,IAAI,WAAY,QAAO,IAAI,WAAW,GAAG;AAC7C,MAAI,IAAI,aAAa;AACnB,WAAQ,IAAgC,IAAI,WAAW;AAAA,EACzD;AACA,SAAO;AACT;AAUO,SAAS,mBAAmB,OAAwB;AACzD,MAAI,SAAS,KAAM,QAAO;AAC1B,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,MAAI,OAAO,UAAU,YAAY,OAAO,UAAU,WAAW;AAC3D,WAAO,OAAO,KAAK;AAAA,EACrB;AACA,MAAI,iBAAiB,KAAM,QAAO,MAAM,YAAY;AACpD,MAAI;AACF,WAAO,KAAK,UAAU,KAAK;AAAA,EAC7B,QAAQ;AACN,WAAO,OAAO,KAAK;AAAA,EACrB;AACF;AAgDO,SAAS,iBAAiB,OAA0B;AACzD,UAAQ,MAAM,QAAQ,KAAK,IAAI,QAAQ,CAAC,KAAK,GAC1C,IAAI,kBAAkB,EACtB,OAAO,CAAC,SAAS,SAAS,EAAE;AACjC;;;AClGA,IAAM,yBAAyB;AAQxB,SAAS,kBACd,KACA,YAC2B;AAC3B,MAAI,IAAI,WAAW,MAAO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C,EAAE,OAAO,wBAAwB,OAAO,cAAc;AAAA,IACxD;AAAA,EACF;AACA,SAAO;AACT;;;AC/DO,SAAS,uBACd,QACA,MACA,YACiB;AACjB,MAAI,CAAC,YAAY;AACf,UAAMA,QAAO,kBAAkB,QAAQ,IAAI;AAC3C,WAAO;AAAA,MACL,MAAAA;AAAA,MACA,SAASA,UAAS,WAAW,qBAAqB,QAAQ,IAAI,IAAI,CAAC;AAAA,IACrE;AAAA,EACF;AACA,MAAI,OAAO,WAAW,MAAO,QAAO,EAAE,MAAM,MAAM,SAAS,CAAC,EAAE;AAC9D,QAAM,WAAW,OAAO;AACxB,QAAM,OACJ,YAAY,aAAa,SACrB,WACA,OAAO,eAAe,SACpB,WACA;AACR,SAAO;AAAA,IACL;AAAA,IACA,SAAS,SAAS,WAAY,OAAO,iBAAiB,CAAC,IAAK,CAAC;AAAA,EAC/D;AACF;AAYO,SAAS,eACd,SACA,OACA,UAAmC,CAAC,GACV;AAC1B,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,IACH,MAAM,QAAQ,YAAY,IAAK,MAAM,QAAQ,QAAQ;AAAA,EACvD;AACF;AAGO,SAAS,cACd,eACA,YACA,UACQ;AACR,QAAM,YAAY,KAAK,IAAI,GAAG,UAAU;AACxC,QAAM,WAAW,KAAK,IAAI,GAAG,QAAQ;AACrC,QAAM,YAAY,KAAK,IAAI,GAAG,KAAK,KAAK,YAAY,QAAQ,CAAC;AAC7D,SAAO,KAAK,IAAI,KAAK,IAAI,GAAG,aAAa,GAAG,SAAS;AACvD;","names":["kind"]}
1
+ {"version":3,"sources":["../../src/data-table/column-marker.ts","../../src/data-table/filter-engine.ts","../../src/data-table/infer-filter.ts","../../src/data-table/query-control.ts"],"sourcesContent":["import type { ColumnMarker, MatrxColumnDef } from \"./types\";\n\nexport type ResolvedColumnMarker = Exclude<ColumnMarker, false>;\n\nconst MARKER_ACCESSORS: Readonly<Record<string, ResolvedColumnMarker>> = {\n favorite: \"favorite\",\n is_favorite: \"favorite\",\n favourite: \"favorite\",\n is_favourite: \"favorite\",\n pinned: \"pin\",\n is_pinned: \"pin\",\n};\n\n/**\n * Resolve the semantic without guessing from partial names. A field such as\n * `favorite_count` is not a marker; consumers can always opt in explicitly.\n */\nexport function resolveColumnMarker<T>(\n column: MatrxColumnDef<T>,\n): ResolvedColumnMarker | undefined {\n if (column.marker === false) return undefined;\n if (column.marker) return column.marker;\n return column.accessorKey ? MARKER_ACCESSORS[column.accessorKey] : undefined;\n}\n\nexport function markerCopy(marker: ResolvedColumnMarker): {\n label: string;\n lowerLabel: string;\n onlyLabel: string;\n notLabel: string;\n} {\n return marker === \"favorite\"\n ? {\n label: \"Favorites\",\n lowerLabel: \"favorites\",\n onlyLabel: \"Favorites only\",\n notLabel: \"Not favorites\",\n }\n : {\n label: \"Pins\",\n lowerLabel: \"pins\",\n onlyLabel: \"Pins only\",\n notLabel: \"Not pinned\",\n };\n}\n","import type {\n ColumnFilterValue,\n ColumnFiltersState,\n MatrxColumnDef,\n SortState,\n TableSearchMatchMode,\n} from \"./types\";\nimport {\n completeLayeredFilterRules,\n layeredFilterMatchesValue,\n type LayeredFilterRule,\n} from \"./layered-filters\";\n\n/**\n * Sentinel select-filter values for \"no value\" / \"any value\" — every select\n * filter offers them automatically when the column has empty cells, so any\n * table can isolate rows missing a value (or having one) without extra config.\n */\nexport const SELECT_EMPTY_VALUE = \"__empty__\";\nexport const SELECT_NOT_EMPTY_VALUE = \"__not_empty__\";\n\nexport function columnId<T>(col: MatrxColumnDef<T>): string {\n if (col.id) return col.id;\n if (col.accessorKey) return String(col.accessorKey);\n throw new Error(\"MatrxDataTable column requires `id` or `accessorKey`\");\n}\n\nexport function getCellValue<T>(row: T, col: MatrxColumnDef<T>): unknown {\n if (col.accessorFn) return col.accessorFn(row);\n if (col.accessorKey) {\n return (row as Record<string, unknown>)[col.accessorKey];\n }\n return undefined;\n}\n\nexport function getFilterValue<T>(row: T, col: MatrxColumnDef<T>): unknown {\n return col.filterValue ? col.filterValue(row) : getCellValue(row, col);\n}\n\nexport function getSortValue<T>(row: T, col: MatrxColumnDef<T>): unknown {\n return col.sortValue ? col.sortValue(row) : getCellValue(row, col);\n}\n\nexport function stringifyCellValue(value: unknown): string {\n if (value == null) return \"\";\n if (typeof value === \"string\") return value;\n if (typeof value === \"number\" || typeof value === \"boolean\") {\n return String(value);\n }\n if (value instanceof Date) return value.toISOString();\n try {\n return JSON.stringify(value);\n } catch {\n return String(value);\n }\n}\n\n/** Unicode-aware tokenization shared by whole-word table search. */\nexport function tableSearchWords(value: string): string[] {\n return value\n .toLocaleLowerCase()\n .split(/[^\\p{L}\\p{N}]+/u)\n .filter(Boolean);\n}\n\n/**\n * Match the primary table search against one row's searchable text. In\n * whole-word mode every entered word must exist as a complete token, so\n * `are` matches `we are ready` but never `hardware`.\n */\nexport function matchesTableSearch(\n searchableText: string,\n query: string,\n mode: TableSearchMatchMode = \"contains\",\n): boolean {\n const normalizedQuery = query.trim().toLocaleLowerCase();\n if (!normalizedQuery) return true;\n if (mode === \"contains\") {\n return searchableText.toLocaleLowerCase().includes(normalizedQuery);\n }\n const actualWords = new Set(tableSearchWords(searchableText));\n const expectedWords = tableSearchWords(normalizedQuery);\n return (\n expectedWords.length > 0 &&\n expectedWords.every((word) => actualWords.has(word))\n );\n}\n\nfunction compareValues(a: unknown, b: unknown): number {\n if (a == null && b == null) return 0;\n if (a == null) return -1;\n if (b == null) return 1;\n if (typeof a === \"number\" && typeof b === \"number\") return a - b;\n if (typeof a === \"boolean\" && typeof b === \"boolean\") {\n return Number(a) - Number(b);\n }\n return stringifyCellValue(a).localeCompare(stringifyCellValue(b), undefined, {\n numeric: true,\n sensitivity: \"base\",\n });\n}\n\n/** Select filters treat array-valued cells as sets, never as serialized JSON choices. */\nexport function selectCellValues(value: unknown): string[] {\n return (Array.isArray(value) ? value : [value])\n .map(stringifyCellValue)\n .filter((item) => item !== \"\");\n}\n\nexport function passesColumnFilter(\n value: unknown,\n filter: ColumnFilterValue,\n): boolean {\n const matches = (() => {\n switch (filter.kind) {\n case \"text\": {\n const s = stringifyCellValue(value);\n if (filter.mode === \"null\") return value == null;\n if (filter.mode === \"not_null\") return value != null;\n if (filter.mode === \"empty\") return s.trim() === \"\";\n if (filter.mode === \"not_empty\") return s.trim() !== \"\";\n const q = filter.value.trim().toLowerCase();\n if (!q) return true;\n return s.toLowerCase().includes(q);\n }\n case \"select\": {\n const selected =\n filter.values ??\n (filter.value && filter.value !== \"__all__\" ? [filter.value] : []);\n if (selected.length === 0) return true;\n const values = selectCellValues(value);\n // OR semantics across the set; sentinels compose (\"A or (empty)\").\n return selected.some((v) =>\n v === SELECT_EMPTY_VALUE\n ? values.length === 0\n : v === SELECT_NOT_EMPTY_VALUE\n ? values.length > 0\n : values.includes(v),\n );\n }\n case \"boolean\": {\n return Boolean(value) === filter.value;\n }\n case \"number\": {\n const n =\n typeof value === \"number\"\n ? value\n : Number(stringifyCellValue(value).replace(/[^0-9.-]/g, \"\"));\n if (Number.isNaN(n)) return false;\n if (filter.min !== undefined && n < filter.min) return false;\n if (filter.max !== undefined && n > filter.max) return false;\n return true;\n }\n }\n })();\n return filter.negated ? !matches : matches;\n}\n\nexport function filterAndSortRows<T>(\n rows: T[],\n columns: MatrxColumnDef<T>[],\n columnFilters: ColumnFiltersState,\n sort: SortState | null,\n globalSearch: string,\n anyOf?: { columnIds: string[]; query: string },\n layeredFilters?: readonly LayeredFilterRule[],\n globalSearchMode: TableSearchMatchMode = \"contains\",\n searchText?: (row: T) => string,\n): T[] {\n const colById = new Map(columns.map((c) => [columnId(c), c]));\n const q = globalSearch.trim().toLowerCase();\n const anyQ = anyOf?.query.trim().toLowerCase() ?? \"\";\n const activeLayeredFilters = completeLayeredFilterRules(layeredFilters);\n\n let result = rows.filter((row) => {\n for (const [id, filter] of Object.entries(columnFilters)) {\n if (!filter) continue;\n const col = colById.get(id);\n if (!col || col.filter === false) continue;\n if (!passesColumnFilter(getFilterValue(row, col), filter)) return false;\n }\n\n for (const rule of activeLayeredFilters) {\n const col = colById.get(rule.field);\n if (!col || !layeredFilterMatchesValue(getFilterValue(row, col), rule)) {\n return false;\n }\n }\n\n if (anyQ && anyOf) {\n const hit = anyOf.columnIds.some((id) => {\n const col = colById.get(id);\n if (!col) return false;\n return stringifyCellValue(getFilterValue(row, col))\n .toLowerCase()\n .includes(anyQ);\n });\n if (!hit) return false;\n }\n\n if (!q) return true;\n const searchableValues = columns\n .filter(\n (col) =>\n col.filter !== false || Boolean(col.accessorKey || col.accessorFn),\n )\n .map((col) => stringifyCellValue(getFilterValue(row, col)));\n const additionalSearchText = searchText?.(row);\n if (additionalSearchText) searchableValues.push(additionalSearchText);\n if (globalSearchMode === \"contains\") {\n return searchableValues.some((value) =>\n matchesTableSearch(value, q, \"contains\"),\n );\n }\n return matchesTableSearch(searchableValues.join(\" \"), q, \"whole_words\");\n });\n\n if (sort) {\n const col = colById.get(sort.id);\n if (col && col.sortable !== false) {\n const dir = sort.direction === \"asc\" ? 1 : -1;\n result = [...result].sort((a, b) => {\n const va = getSortValue(a, col);\n const vb = getSortValue(b, col);\n // Empty cells (null / \"\") sort LAST in both directions — sorting a\n // column should surface its values, never a wall of blanks.\n const ea = va == null || stringifyCellValue(va) === \"\";\n const eb = vb == null || stringifyCellValue(vb) === \"\";\n if (ea !== eb) return ea ? 1 : -1;\n return compareValues(va, vb) * dir;\n });\n }\n }\n\n return result;\n}\n\nexport function countActiveColumnFilters(filters: ColumnFiltersState): number {\n let n = 0;\n for (const f of Object.values(filters)) {\n if (!f) continue;\n switch (f.kind) {\n case \"text\":\n if (f.value.trim() || (f.mode && f.mode !== \"contains\")) n += 1;\n break;\n case \"select\":\n if (f.values ? f.values.length > 0 : f.value && f.value !== \"__all__\")\n n += 1;\n break;\n case \"boolean\":\n n += 1;\n break;\n case \"number\":\n if (f.min !== undefined || f.max !== undefined) n += 1;\n break;\n }\n }\n return n;\n}\n\nexport function isColumnFilterActive(\n filter: ColumnFilterValue | undefined,\n): boolean {\n if (!filter) return false;\n switch (filter.kind) {\n case \"text\":\n return (\n filter.value.trim().length > 0 ||\n (filter.mode !== undefined && filter.mode !== \"contains\")\n );\n case \"select\":\n return filter.values\n ? filter.values.length > 0\n : Boolean(filter.value) && filter.value !== \"__all__\";\n case \"boolean\":\n return true;\n case \"number\":\n return filter.min !== undefined || filter.max !== undefined;\n }\n}\n\n/** Apply draft edits onto a row for display (shallow field merge). */\nexport function applyRowEdits<T>(\n row: T,\n edits: Record<string, unknown> | undefined,\n): T {\n if (!edits || Object.keys(edits).length === 0) return row;\n return { ...row, ...edits };\n}\n","import type { ColumnFilterKind, MatrxColumnDef } from \"./types\";\nimport { resolveColumnMarker } from \"./column-marker\";\nimport {\n SELECT_EMPTY_VALUE,\n SELECT_NOT_EMPTY_VALUE,\n getCellValue,\n selectCellValues,\n} from \"./filter-engine\";\n\n/** Auto-inference switches to text above this many distinct values… */\nconst SELECT_CARDINALITY_CAP = 24;\n\nexport type ResolvedFilterKind = \"text\" | \"select\" | \"boolean\" | \"number\";\n\n/**\n * Infer a filter UI from sample row values. Prefer select for low-cardinality\n * string/enum columns, boolean for booleans, number for numeric, else text.\n */\nexport function resolveFilterKind<T>(\n col: MatrxColumnDef<T>,\n sampleRows: T[],\n): ResolvedFilterKind | null {\n if (col.filter === false) return null;\n if (col.filter && col.filter !== \"auto\") return col.filter;\n if (resolveColumnMarker(col)) return \"boolean\";\n\n const values = sampleRows\n .slice(0, 200)\n .map((row) => getCellValue(row, col))\n .filter((v) => v != null);\n\n if (values.length === 0) return \"text\";\n\n if (values.every((v) => typeof v === \"boolean\")) return \"boolean\";\n if (values.every((v) => typeof v === \"number\" && Number.isFinite(v))) {\n return \"number\";\n }\n\n const strings = values.flatMap(selectCellValues);\n const unique = new Set(strings);\n if (\n unique.size >= 1 &&\n unique.size <= SELECT_CARDINALITY_CAP &&\n unique.size < strings.length * 0.6\n ) {\n return \"select\";\n }\n\n return \"text\";\n}\n\nexport function collectSelectOptions<T>(\n col: MatrxColumnDef<T>,\n rows: T[],\n): Array<{ value: string; label: string }> {\n const seen = new Set<string>();\n const options: Array<{ value: string; label: string }> = [];\n let hasEmpty = false;\n for (const row of rows) {\n const values = selectCellValues(getCellValue(row, col));\n if (values.length === 0) {\n hasEmpty = true;\n continue;\n }\n for (const value of values) {\n if (col.filterOptions?.length || seen.has(value)) continue;\n seen.add(value);\n options.push({ value, label: value });\n }\n }\n const base = col.filterOptions?.length\n ? [...col.filterOptions]\n : options.sort((a, b) => a.label.localeCompare(b.label));\n // Emptiness sentinels: whenever the column has blank cells, every select\n // filter can isolate them — or exclude them — with zero per-table config.\n if (hasEmpty) {\n base.unshift(\n { value: SELECT_EMPTY_VALUE, label: \"(empty)\" },\n { value: SELECT_NOT_EMPTY_VALUE, label: \"(not empty)\" },\n );\n }\n return base;\n}\n\nexport function filterKindLabel(\n kind: ColumnFilterKind | ResolvedFilterKind,\n): string {\n switch (kind) {\n case \"text\":\n return \"Text\";\n case \"select\":\n return \"Select\";\n case \"boolean\":\n return \"Boolean\";\n case \"number\":\n return \"Number\";\n case \"auto\":\n return \"Auto\";\n case false:\n return \"Off\";\n }\n}\n","import {\n collectSelectOptions,\n resolveFilterKind,\n type ResolvedFilterKind,\n} from \"./infer-filter\";\nimport type { MatrxColumnDef, MatrxDataTableQueryState } from \"./types\";\nimport { resolveColumnMarker } from \"./column-marker\";\n\nexport interface QueryFilterMeta {\n kind: ResolvedFilterKind | null;\n options: Array<{ value: string; label: string }>;\n}\n\n/**\n * Resolve header-filter metadata without inferring remote cardinality from the\n * current page. Controlled callers must declare select options explicitly;\n * local tables preserve the original inference behavior.\n */\nexport function resolveQueryFilterMeta<T>(\n column: MatrxColumnDef<T>,\n rows: T[],\n controlled: boolean,\n): QueryFilterMeta {\n if (!controlled) {\n const kind = resolveFilterKind(column, rows);\n return {\n kind,\n options: kind === \"select\" ? collectSelectOptions(column, rows) : [],\n };\n }\n if (column.filter === false) return { kind: null, options: [] };\n if (resolveColumnMarker(column) && (column.filter === undefined || column.filter === \"auto\")) {\n return { kind: \"boolean\", options: [] };\n }\n const declared = column.filter;\n const kind: ResolvedFilterKind =\n declared && declared !== \"auto\"\n ? declared\n : column.filterOptions?.length\n ? \"select\"\n : \"text\";\n return {\n kind,\n options: kind === \"select\" ? (column.filterOptions ?? []) : [],\n };\n}\n\nexport interface QueryStateChangeOptions {\n /** Reset to the first page after a query-shape change. */\n resetPage?: boolean;\n}\n\n/**\n * Build the next controlled query state without mutating the caller's object.\n * Search, filters, sort, facets, and page-size changes pass `resetPage: true`;\n * direct pagination passes a page patch without resetting it.\n */\nexport function nextQueryState(\n current: MatrxDataTableQueryState,\n patch: Partial<MatrxDataTableQueryState>,\n options: QueryStateChangeOptions = {},\n): MatrxDataTableQueryState {\n return {\n ...current,\n ...patch,\n page: options.resetPage ? 1 : (patch.page ?? current.page),\n };\n}\n\n/** Resolve a safe one-based page for the latest remote total. */\nexport function safeQueryPage(\n requestedPage: number,\n totalItems: number,\n pageSize: number,\n): number {\n const safeTotal = Math.max(0, totalItems);\n const safeSize = Math.max(1, pageSize);\n const pageCount = Math.max(1, Math.ceil(safeTotal / safeSize));\n return Math.min(Math.max(1, requestedPage), pageCount);\n}\n"],"mappings":";;AAIA,IAAM,mBAAmE;AAAA,EACvE,UAAU;AAAA,EACV,aAAa;AAAA,EACb,WAAW;AAAA,EACX,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,WAAW;AACb;AAMO,SAAS,oBACd,QACkC;AAClC,MAAI,OAAO,WAAW,MAAO,QAAO;AACpC,MAAI,OAAO,OAAQ,QAAO,OAAO;AACjC,SAAO,OAAO,cAAc,iBAAiB,OAAO,WAAW,IAAI;AACrE;;;ACLO,IAAM,qBAAqB;AAC3B,IAAM,yBAAyB;AAQ/B,SAAS,aAAgB,KAAQ,KAAiC;AACvE,MAAI,IAAI,WAAY,QAAO,IAAI,WAAW,GAAG;AAC7C,MAAI,IAAI,aAAa;AACnB,WAAQ,IAAgC,IAAI,WAAW;AAAA,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AAS,SAAS,WAAY,OAAO,iBAAiB,CAAC,IAAK,CAAC;AAAA,EAC/D;AACF;AAYO,SAAS,eACd,SACA,OACA,UAAmC,CAAC,GACV;AAC1B,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,IACH,MAAM,QAAQ,YAAY,IAAK,MAAM,QAAQ,QAAQ;AAAA,EACvD;AACF;AAGO,SAAS,cACd,eACA,YACA,UACQ;AACR,QAAM,YAAY,KAAK,IAAI,GAAG,UAAU;AACxC,QAAM,WAAW,KAAK,IAAI,GAAG,QAAQ;AACrC,QAAM,YAAY,KAAK,IAAI,GAAG,KAAK,KAAK,YAAY,QAAQ,CAAC;AAC7D,SAAO,KAAK,IAAI,KAAK,IAAI,GAAG,aAAa,GAAG,SAAS;AACvD;","names":["kind"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/data-table/types.ts"],"sourcesContent":["import type { ContentTransferReference } from \"../content-transfer/extensions\";\nimport type { ReactNode } from \"react\";\nimport type { TableSearchRole, TableSearchScope } from \"./ranked-search\";\nimport type { AgentPayloadInput } from \"./copy\";\nimport type { CopyExportConfig } from \"./copy-types\";\nimport type {\n AiCustomSource,\n AiVariant,\n} from \"./copy\";\nimport type { LayeredFilterField, LayeredFilterRule } from \"./layered-filters\";\n\n/** How a column's filter UI behaves. `auto` infers from sample values. */\nexport type ColumnFilterKind =\n \"auto\" | \"text\" | \"select\" | \"boolean\" | \"number\" | false;\n\nexport type SortDirection = \"asc\" | \"desc\";\n\n/** How the table's primary search text is matched. */\nexport type TableSearchMatchMode = \"contains\" | \"whole_words\";\n\n/** Cell value type for typed inline editors (Supabase-style popovers for non-strings). */\nexport type CellEditType =\n | \"string\"\n | \"number\"\n | \"boolean\"\n | \"select\"\n /** Free-text multi-value chips (string[] cells: tags, labels, aliases). */\n | \"tags\"\n | \"date\"\n | false;\n\nexport interface MatrxColumnDef<T> {\n /** Stable id used for sort/filter state. Defaults to `accessorKey` when set. */\n id?: string;\n /** Dot-free key on the row for default value access + auto filter. */\n accessorKey?: keyof T & string;\n /** Custom value for sort/filter when `accessorKey` is insufficient. */\n accessorFn?: (row: T) => unknown;\n /** Value used only for local sort. Falls back to `accessorFn` / `accessorKey`. */\n sortValue?: (row: T) => unknown;\n /** Value used only for local filters. Falls back to `accessorFn` / `accessorKey`. */\n filterValue?: (row: T) => unknown;\n header: ReactNode;\n /** Plain-text name used for header controls when `header` is visual-only. */\n label?: string;\n /** Cell renderer. Defaults to stringified accessor value. */\n cell?: (row: T, index: number) => ReactNode;\n /** Sortable unless explicitly false. Default true. */\n sortable?: boolean;\n /** Direction used by the first header-click sort. Default `\"asc\"`. */\n defaultSortDirection?: SortDirection;\n /**\n * Filter kind. Default `\"auto\"` — every column gets a filter.\n * Pass `false` only when a column truly must not filter (e.g. actions).\n */\n filter?: ColumnFilterKind;\n /** Explicit select options (when filter is `\"select\"` or auto-detected). */\n filterOptions?: Array<{ value: string; label: string }>;\n /**\n * Single-choice select filter. The default select filter is a multi-select\n * that APPENDS (OR semantics) — correct for a status column, wrong for a\n * column whose options are mutually exclusive VIEWS of the list (a\n * record-class scope, a relative-date bucket). There, appending makes the\n * filter inert: the consumer reads one value, the popover accumulates a set,\n * and the first-selected value wins forever (D218). With `filterSingle`,\n * choosing an option REPLACES the selection, and choosing the active option\n * again clears it.\n */\n filterSingle?: boolean;\n /**\n * Inline edit. Default false. `\"string\"` edits in-cell; other types open a\n * small popover (Supabase-style). Edits stay local until Save on the dirty pill.\n */\n editable?: CellEditType;\n /**\n * Per-row edit gate for an `editable` column. Return false to render the\n * plain cell (no pencil, no click-to-edit) for that row — for heterogeneous\n * lists where some kinds cannot take the write (e.g. a transcripts row of\n * kind \"unsorted\" has no user-facing title). Default: every row editable.\n */\n editableIf?: (row: T) => boolean;\n /**\n * How inline edit starts. Default `\"click\"` (click the cell body). `\"pencil\"`\n * shows a hover/focus pencil; the cell body no longer starts edit — so a\n * whole-row click can own that gesture. Forced to `\"pencil\"` when `href` is\n * set (D112 — the body is a real link).\n */\n editTrigger?: \"click\" | \"pencil\";\n /**\n * Options when `editable === \"select\"`. Also used by `\"tags\"` as the\n * suggestion list (existing values), while still allowing new entries.\n */\n editOptions?: Array<{ value: string; label: string }>;\n /**\n * Row link for the primary/title cell (D112): renders the cell content as a\n * real `next/link` anchor, so the row is reachable by keyboard, announced as\n * a link by screen readers, and cmd/middle-clickable into a new tab. The\n * whole-row `onRowOpen` click stays as a mouse convenience; clicks on the\n * anchor never double-fire it. Combine with `editable` and the link renders\n * with a hover/focus pencil that opens the inline editor instead of\n * click-text-to-edit.\n */\n href?: (row: T) => string | undefined;\n /**\n * Canonical entity token for the record this column NAMES. When set, the cell\n * renders through `EntityRef`, so the name carries the full door set — Open,\n * new tab, and Peek — instead of the Open-only `<Link>` that `href` alone\n * produces.\n *\n * THE INVENTORY LAW, applied to this component: the table grew its own door\n * (`href`) beside the platform's (`EntityRef`), and every column that named a\n * record picked one and silently lost the other half. This field collapses\n * them — `href` still works and still forces the pencil trigger, and it\n * OVERRIDES the registry route when both are set (for an admin-side route on\n * a satellite deployment).\n *\n * Needs the record's id: `entityToken` is paired with `entityId`, defaulting\n * to the table's own `getRowId`.\n *\n * **PER ROW, not per column** — a hub can be heterogeneous. `/transcripts`\n * lists transcripts, studio sessions, cleanup runs and an \"unsorted\" bucket\n * in one table, each with its own destination; a constant token would have\n * sent a session id to the transcript processor route and opened the\n * transcript peek on a record that is not one. Return `undefined` for a row\n * that names no entity — it falls back to the plain `href` link, or to inert\n * text. Pair with a per-row `href` when the kinds diverge.\n */\n entityToken?: string | ((row: T) => string | undefined);\n /**\n * NOTE: give the column a `cell` when you set this. Without one, a\n * UUID-shaped value renders the default `MatrxUuidCell`, which has its own\n * controls — wrapping those in the door's anchor would nest interactive\n * elements inside a link, and is redundant besides. The shell detects that\n * combination, skips the door, and screams once per column.\n */\n /** The id `entityToken` refers to. Defaults to the table's `getRowId(row)`. */\n entityId?: (row: T) => string | undefined;\n /**\n * Drop this column below `sm` (the phone breakpoint).\n *\n * A wide table on a phone becomes a horizontal scroller: the frozen\n * identity column stays, and everything after the second column sits off\n * the right edge where a reviewer will never find it. Marking the columns\n * that do NOT earn their width on a phone is how a surface declares an\n * INTENTIONAL mobile column set instead of an accidental one.\n *\n * The column is still fully sortable/filterable from the toolbar and still\n * rides every copy/export payload — this hides the CELL, not the data.\n * Default `false` = today's behavior everywhere.\n */\n mobileHidden?: boolean;\n /**\n * Built-in cell kinds. `\"uuid\"` / `\"fk\"` use MatrxUuidCell (short + copy +\n * optional open). `\"auto\"` (default) detects UUID-shaped strings.\n */\n cellKind?: \"auto\" | \"uuid\" | \"fk\" | \"text\";\n /**\n * FK / UUID navigation. Prefer `onOpen` → WindowPanel of the target.\n * Return `\"forbidden\"` when the caller lacks access.\n */\n fk?: {\n label?: string;\n /**\n * Canonical entity token this column's ids point at (`agent`, `note`, …).\n * THE DOOR LAW made declarative: the cell resolves route + new tab + peek\n * from the registries, so a column of ids stops being a dead end without\n * hand-wiring a link. `href` / `onOpen` still win when both are set.\n * A function form resolves the token per row (an audit log whose target\n * type varies by row).\n *\n * `\"auto\"` derives the token from the COLUMN NAME (`task_id` → `task`).\n * It is opt-in on purpose: the guess is only correct when you have checked\n * the actual FK. `scheduler.sch_run.task_id` references `scheduler.sch_task`,\n * not the workspace `task` the name implies, and `app_id` /\n * `conversation_id` / `file_id` / `workflow_id` each have several candidate\n * tables. A wrong door opens a DIFFERENT record — worse than no door.\n */\n token?: string | null | \"auto\" | ((row: T) => string | null | undefined);\n href?: (id: string, row: T) => string | null | undefined;\n onOpen?: (\n id: string,\n row: T,\n ) => void | \"forbidden\" | Promise<void | \"forbidden\">;\n /** Force non-navigable for this column. */\n forbidden?: boolean | ((id: string, row: T) => boolean);\n };\n className?: string;\n headerClassName?: string;\n width?: string | number;\n /** Enable desktop resizing for this column. Defaults to true when the table enables it. */\n resizable?: boolean;\n /** Desktop resize boundary. Defaults to 80px. */\n minWidth?: number;\n /** Desktop resize boundary. Defaults to 1200px. */\n maxWidth?: number;\n align?: \"left\" | \"center\" | \"right\";\n /**\n * ICON COLUMN. A column whose whole content is one glyph — a star, a lock, a\n * status dot — and whose `width` is therefore a lie without this flag.\n *\n * `width` is only a hint on a table cell: min-content wins. A 40px star column\n * still rendered ~70px wide because the HEADER carried three separate\n * controls beside the glyph (the sort button, its arrow, the filter funnel),\n * and the cell carried the default `px-2` on both sides. Every surface that\n * wanted a tight icon column was paying for chrome it never used.\n *\n * `compact` fixes it AT THE PRIMITIVE, and does NOT cost the column anything:\n * horizontal padding drops to `px-1`, and the header collapses its three\n * controls into ONE popover trigger that still offers Sort ascending / Sort\n * descending / Clear sort / the full filter body. The column stays fully\n * sortable and filterable — the affordances moved into the menu, they did not\n * disappear. Active sort/filter still show, as a 2px dot on the trigger.\n *\n * Pair it with `width` and `align: \"center\"`.\n */\n compact?: boolean;\n /** Hide from the table (still available in column picker when we add it). */\n hidden?: boolean;\n /** Whether the package-owned Columns dialog may hide this column. Default true. */\n hideable?: boolean;\n}\n\n/** How a text filter matches. Default `\"contains\"`. */\nexport type TextFilterMode = \"contains\" | \"empty\" | \"not_empty\" | \"null\" | \"not_null\";\n\n/** Active per-column filter value. Shape depends on filter kind. */\nexport type ColumnFilterValue =\n | { kind: \"text\"; value: string; mode?: TextFilterMode; negated?: boolean }\n | {\n kind: \"select\";\n /** Single-choice value (legacy writers). Ignored when `values` is set. */\n value: string;\n /** Multi-choice OR set — a row passes if it matches ANY entry. */\n values?: string[];\n /** Exclude matching values instead of including them. */\n negated?: boolean;\n }\n | { kind: \"boolean\"; value: boolean; negated?: boolean }\n | { kind: \"number\"; min?: number | undefined; max?: number | undefined; negated?: boolean };\n\nexport type ColumnFiltersState = Record<string, ColumnFilterValue | undefined>;\n\nexport interface SortState {\n id: string;\n direction: SortDirection;\n}\n\n/**\n * Opt-in durable URL state for a local table.\n *\n * Every table gets an explicit stable id, producing namespaced parameters such\n * as `table.accounts.q` and `table.accounts.sort`. This prevents collisions\n * with page-owned parameters and with sibling tables on the same route.\n */\nexport interface MatrxDataTableUrlStateConfig {\n /** Stable lowercase identifier: letters, numbers, and hyphens; max 64 chars. */\n id: string;\n /** Initial sort when the URL carries none. Default: none. */\n defaultSort?: SortState | null | undefined;\n /** Browser history behavior for table transitions. Default: `push`. */\n history?: \"push\" | \"replace\" | undefined;\n /**\n * History behavior while typing search/any-of text. `session` pushes the\n * first edit, then replaces rapid keystrokes. Default: `session`.\n */\n textHistory?: \"session\" | \"push\" | \"replace\" | undefined;\n /** Persist the open side-panel row. Default true. */\n selectedRow?: boolean;\n /** Persist the open table-owned window row. Default true. */\n windowRow?: boolean;\n /** Persist checkbox selection. Opt-in because large selections lengthen URLs. */\n selection?: boolean;\n}\n\n/**\n * Complete view state for a remotely queried table page. The table owns none\n * of this state in controlled mode: callers may mirror it to URL search params\n * and use it as part of a direct database-query cache key.\n */\nexport interface MatrxDataTableQueryState {\n /** One-based page number, matching the table's pagination UI. */\n page: number;\n pageSize: number;\n search: string;\n /** Defaults to `contains` when omitted, preserving every existing table. */\n searchMatchMode?: TableSearchMatchMode;\n /** Selected intelligent-search scope. Omitted means the backward-compatible All scope. */\n searchScope?: string;\n anyOf: string;\n /** Ordered AND rules from the compact advanced-filter builder. */\n layeredFilters?: LayeredFilterRule[];\n columnFilters: ColumnFiltersState;\n sort: SortState | null;\n}\n\n/**\n * Optional data-processing contract. Omit it (or use `local`) to preserve the\n * original in-memory filter/sort/pagination behavior. In controlled mode,\n * `data` is already the current page and the caller performs all querying.\n */\n/** Structural match for @ai-matrx/data/react usePaginatedData. */\nexport interface MatrxTablePagination<T> {\n queryKey: string;\n rows: T[];\n loading: boolean;\n isFetchingNextPage: boolean;\n error: Error | null;\n hasNextPage: boolean;\n loadNextPage: () => Promise<void>;\n refresh: () => void;\n totalItems: number | undefined;\n loadAll?: { isLoading: boolean; request: () => void; stop: () => void };\n retrySource?: () => void;\n sourceUntil?: string;\n sourcePageSize?: { value: number; options: readonly number[]; onChange: (value: number) => void };\n}\n\n/**\n * A controlled-local table can retain local search/pagination while its source\n * owns column filters and/or sorting. `sourceTotal` is display metadata only:\n * it never changes local page slicing, because the loaded rows remain local.\n */\nexport interface MatrxDataTableSourceProcessing {\n search?: \"local\" | \"source\";\n /** Source accepts and ranks `searchScope`; omit to keep scope UI local-only. */\n intelligentSearch?: \"local\" | \"source\";\n columnFilters?: \"local\" | \"source\";\n sort?: \"local\" | \"source\";\n sourceTotal?: number;\n}\n\nexport type MatrxDataTableQueryControl<T = unknown> =\n | { mode: \"local\" }\n | {\n /** Accumulated server rows; page stays 1 and sort/filter remain server-owned. */\n mode: \"controlled-append\";\n state: MatrxDataTableQueryState;\n onStateChange: (next: MatrxDataTableQueryState) => void;\n pagination: MatrxTablePagination<T>;\n sourceProcessing?: MatrxDataTableSourceProcessing;\n /** Source-connected tables append on user scroll by default. */\n scroll?: { thresholdPx?: number; intentTimeoutMs?: number } & (\n | { mode?: \"scroll\" }\n | { mode: \"manual\"; reason: string; approvedBy: string }\n /** Temporary configuration state: automatic append is off, but Load more stays available. */\n | { mode: \"suspended\"; reason: string }\n );\n }\n | {\n /** Local rows, but every query control is owned by the caller (for URL state). */\n mode: \"controlled-local\";\n state: MatrxDataTableQueryState;\n onStateChange: (next: MatrxDataTableQueryState) => void;\n sourceProcessing?: MatrxDataTableSourceProcessing;\n }\n | {\n mode: \"controlled\";\n state: MatrxDataTableQueryState;\n /** Total rows matching the controlled query, not just `data.length`. */\n totalItems: number;\n onStateChange: (next: MatrxDataTableQueryState) => void;\n /** Declare source-owned query behavior before enabling source-aware controls. */\n sourceProcessing?: MatrxDataTableSourceProcessing;\n };\n\n/**\n * Toolbar facets — first-class, Mars-extensible filter controls above the grid.\n * Start with button-group; add radio / switch / complex later without forking.\n */\nexport type ToolbarFacet =\n | {\n type: \"button-group\";\n id: string;\n label?: string;\n value: string;\n /** Reset target for per-facet + global clear. Default: first option value. */\n defaultValue?: string;\n options: Array<{\n value: string;\n label: string;\n icon?: ReactNode;\n }>;\n onChange: (value: string) => void;\n }\n | {\n type: \"custom\";\n id: string;\n render: () => ReactNode;\n /** Declare filter state and its reset together so global Clear includes custom controls. */\n filter?: { active: boolean; onReset: () => void };\n };\n\n/**\n * Cross-column OR search — matches if ANY listed column contains the query.\n * Relationships use case: filter by entity type without picking source vs target.\n */\nexport interface AnyOfColumnSearch {\n columnIds: string[];\n placeholder?: string;\n /** Controlled value. Uncontrolled if omitted. */\n value?: string;\n onChange?: (value: string) => void;\n}\n\nexport interface MatrxDataTableToolbar {\n /** Optional human-readable table title, rendered by the shared title row. */\n title?: string;\n /** Global search across all accessor values. Default true. */\n search?: boolean;\n searchPlaceholder?: string;\n searchValue?: string;\n onSearchChange?: (value: string) => void;\n /**\n * Show a compact, visible choice between substring and whole-word search.\n * Omit it when a data source cannot honor both modes server-side.\n */\n searchMatch?: {\n defaultMode?: TableSearchMatchMode;\n };\n /** Optional field-scope controls. Local search always ranks all loaded fields before pagination. */\n intelligentSearch?: {\n roles?: Readonly<Record<string, TableSearchRole>>;\n scopes?: readonly TableSearchScope[];\n };\n /**\n * OR-search across specific columns (e.g. source_type OR target_type).\n * Shown as its own input beside global search when set.\n */\n anyOf?: AnyOfColumnSearch;\n /**\n * Optional compact advanced-filter builder beside the regular search. In\n * controlled mode rules live in `query.state.layeredFilters`; local tables\n * evaluate them against matching column ids.\n */\n layeredFilters?: {\n fields: readonly LayeredFilterField[];\n maxRules?: number;\n label?: string;\n };\n /** Extensible facet strip (button groups, later radios/switches/…). */\n facets?: ToolbarFacet[];\n /** Source controls in a separate wrapping row below the standard toolbar. */\n leading?: ReactNode;\n /**\n * Standard host refresh affordance. The package owns its placement, busy\n * state, accessible tooltip, and glyphs (refresh arrows at rest, spinner\n * only while busy); the host remains the sole data owner.\n */\n refresh?: {\n onRefresh: () => void | Promise<void>;\n label?: string;\n };\n /**\n * Standard create affordance. The host owns authorization and the actual\n * create flow; disabledReason is exposed through the shared tooltip.\n */\n add?: {\n onAdd: () => void | Promise<void>;\n disabled?: boolean;\n disabledReason?: string;\n };\n /** Right-side domain actions, rendered after standard table controls. */\n actions?: ReactNode;\n}\n\n/** Query fields safe to persist in a named table view. */\nexport type TableViewQuery = Omit<MatrxDataTableQueryState, \"page\">;\n\n/** Portable, persistence-neutral table state saved by a host adapter. */\nexport interface TableViewSnapshot {\n __kind: \"matrx-table-view\";\n version: 1;\n /** Page/cursor/selection/loaded rows are deliberately never saved. */\n query: TableViewQuery;\n /** `widths` is sparse so views saved before resize remain valid. */\n columns: { order: string[]; hidden: string[]; widths?: Record<string, number> };\n}\n\n/** Host port for durable named views. The host owns actor, tenancy and CRUD. */\nexport interface TableSavedViewsProps {\n tableId: string;\n snapshot: TableViewSnapshot;\n defaultSnapshot: TableViewSnapshot;\n onApply: (snapshot: TableViewSnapshot) => void;\n}\n\n/** Optional deferred-apply copy for column filter popovers. */\nexport interface MatrxDataTableFilterUi {\n /** Enables the Include/Exclude control. Default false for remote-safe filters. */\n allowNegation?: boolean;\n /** Enables null/not-null text modes. Default false for remote-safe filters. */\n allowNullModes?: boolean;\n applyLabel?: string;\n showCancel?: boolean;\n footerHint?: ReactNode;\n}\n\nexport interface MatrxDataTableCopyConfig<T> {\n /** Explicit registered identities; never inferred from table labels or row shapes. */\n rowReferences?: (row: T) => readonly ContentTransferReference[];\n references?: (visible: T[], all: T[]) => readonly ContentTransferReference[];\n triggerVariant?: \"transparent\" | \"glass\" | \"outline\";\n /** Toast / tooltip label base, e.g. \"Relationship rule\". */\n label: string;\n listLabel?: string;\n location: string;\n rowKind: string;\n listKind: string;\n rowDescription?: string;\n listDescription?: string;\n humanRow: (row: T) => string;\n /** Project row for agent JSON. Default: full row. */\n agentRow?: (row: T) => unknown;\n rowAttributes?: (\n row: T,\n ) => Record<string, string | number | boolean | null | undefined>;\n listAttributes?: (\n visible: T[],\n all: T[],\n ) => Record<string, string | number | boolean | null | undefined>;\n /**\n * Live view state rendered inside the list payload's <context>. Unlike\n * per-row data, this remains present when the current view has zero rows.\n */\n listContext?: (\n visible: T[],\n all: T[],\n ) => Record<string, string | number | boolean | null | undefined>;\n /**\n * Additional row-scoped AI actions. Use this to fold a domain action such\n * as a paste-ready repair brief into the table-owned row copy menu instead\n * of rendering a separate third control. Builders run at click time.\n */\n rowAiVariants?: (row: T) => AiVariant[];\n /**\n * Graded AI variants for the toolbar's view copy (e.g. \"Top 25\", \"Summary\n * only\"). When set, the toolbar's Copy-for-AI upgrades to a dropdown with\n * these variants + the full-view payload as the automatic \"Everything\"\n * escape hatch. Receives (visible, all) rows at render; builders run at\n * click time.\n */\n aiVariants?: (visible: T[], all: T[]) => AiVariant[];\n /** Custom-preview source (options dialog + live size counts) for the view. */\n aiCustom?: (visible: T[], all: T[]) => AiCustomSource;\n /** Additional domain exports in the same canonical menu; builders run on demand. */\n export?: (visible: T[], all: T[]) => CopyExportConfig;\n /** Show toolbar copy (this view). Default true when copy is set. */\n showToolbar?: boolean;\n /** Show per-row copy. Default true when copy is set. */\n showRow?: boolean;\n}\n\nexport interface MatrxDataTableDetailConfig<T> {\n /** Side-panel title. Default: first string column or \"Details\". */\n title?: (row: T) => ReactNode;\n description?: (row: T) => ReactNode | undefined;\n /** Override the default key/value inspector. */\n render?: (row: T, controls: MatrxDataTableRecordControls) => ReactNode;\n /** Header actions inside the side panel. */\n headerActions?: (row: T) => ReactNode;\n defaultWidth?: number;\n enabled?: boolean;\n /**\n * Maps a field name to the entity token its id points at, turning that field\n * into a door (route + peek) in the default inspector — side panel AND row\n * window.\n *\n * There is no default guess: this inspector renders whatever columns the row\n * has, and a wrong door opens a DIFFERENT record (`sch_run.task_id` is a\n * SCHEDULED task, not a workspace `task`). A table whose FKs you HAVE checked\n * can pass `tokenFromColumnName` (`components/official/entity-ref/doors`) to\n * open every `<token>_id` field at once.\n *\n * The ROW is passed too, because a table whose target type varies per row (an\n * audit log, an exposure report) cannot answer from the column name alone.\n */\n tokenForField?: (key: string, row: T) => string | null;\n}\n\n/** Actions a record-owned control can use without reaching into table state. */\nexport interface MatrxDataTableRecordControls {\n /** Close the row's side-panel detail, if open. */\n closeDetail: () => void;\n /** Open the row in the canonical adjustable side panel. */\n openDetail: () => void;\n /** Open the row in its canonical table-owned WindowPanel. */\n openWindow: () => void;\n /** Close the row's table-owned WindowPanel, if open. */\n closeWindow: () => void;\n /** Whether this row currently has visible, unpersisted inline edits. */\n hasPendingEdits: boolean;\n /**\n * Discard this row's pending inline edits.\n *\n * Row actions that persist the already-merged visible row (for example an\n * explicit Confirm action) call this only after that write succeeds. This\n * prevents the floating Save pill from later replaying the same draft as a\n * different, weaker write.\n */\n discardPendingEdits: () => void;\n beginEdit?: () => void;\n saveEdits?: () => void | Promise<void>;\n cancelEdits?: () => void;\n}\n\n/** Opaque host-owned row menu descriptor. The package never interprets it. */\nexport interface MatrxDataTableContextMenuConfig<T> {\n resolveRowContext: (row: T, controls: MatrxDataTableRecordControls) => unknown;\n}\n\nexport interface MatrxDataTableWindowConfig<T> {\n /** Window title. */\n title?: (row: T) => string;\n /**\n * @deprecated Prefer `renderView` + `renderEdit` so the window stays editable.\n * Full-body override with no View/Edit tabs.\n */\n render?: (row: T, controls: MatrxDataTableRecordControls) => ReactNode;\n /** View tab body. Defaults to DataRowInspector. */\n renderView?: (row: T, controls: MatrxDataTableRecordControls) => ReactNode;\n /**\n * Edit tab body. When set, the WindowPanel shows View / Edit sidebar tabs\n * (WindowPanel built-in sidebar). Defaults to `detail.render` when present.\n * Pass `false` to keep a view-only window even when `detail.render` exists.\n */\n renderEdit?:\n ((row: T, controls: MatrxDataTableRecordControls) => ReactNode) | false;\n /**\n * Called when the panel icon opens the window — hydrate edit state here\n * without opening the side panel (prefer this over `onRowOpen` for windows).\n */\n onOpen?: (row: T) => void;\n /**\n * Make full-row click open the WindowPanel instead of the side panel.\n * The trailing row action and the window header then expose the side panel\n * as the explicit secondary presentation. Default false.\n */\n openOnRowClick?: boolean;\n /** Which tab to open. Default: `\"edit\"` when an edit body exists. */\n defaultTab?: \"view\" | \"edit\";\n /** Show the panel-icon that opens the window. Default true when detail enabled. */\n enabled?: boolean;\n width?: number;\n height?: number;\n}\n\nexport interface MatrxDataTableEmptyState {\n icon?: ReactNode;\n title: string;\n description?: string;\n action?: ReactNode;\n}\n\n/** Pending cell edits keyed by row id → partial field map. */\nexport type CellEditsMap = Record<string, Record<string, unknown>>;\n\nexport interface MatrxDataTableEditConfig<T> {\n /** Enable inline editing for columns with `editable` set. */\n enabled?: boolean;\n /**\n * Persist all pending edits. Called when the user clicks Save on the dirty pill.\n * Return resolved when done; throw/reject to keep the draft (with toast).\n */\n onSave: (edits: CellEditsMap, rows: T[]) => void | Promise<void>;\n /** Persist each committed cell immediately. Failed writes remain in the\n * dirty pill so the user can retry or cancel them. */\n autoSave?: boolean;\n /** Optional cancel hook (draft already discarded). */\n onCancel?: () => void;\n}\n\nexport interface MatrxDataTableHierarchyConfig<T> {\n /** Complete hierarchy when `data` is only the current controlled page. */\n rows?: T[];\n getParentId: (row: T) => string | null;\n /** Persist the exact structural intent represented by the drop shadow. */\n onMove: (row: T, move: MatrxDataTableHierarchyMove) => void | Promise<void>;\n /** Enables sibling insertion shadows in addition to parent/root drops. */\n manualOrder?: boolean;\n canReparent?: (row: T) => boolean;\n itemLabel?: (row: T) => string;\n rootDropLabel?: string;\n}\n\nexport interface MatrxDataTableHierarchyMove {\n parentId: string | null;\n /**\n * Insert immediately before this sibling. Null means first child for\n * \"inside\"/\"root\", and LAST sibling for \"after\" (target had no successor).\n */\n beforeId: string | null;\n position: \"before\" | \"after\" | \"inside\" | \"root\";\n targetId: string | null;\n}\n\n/**\n * Multi-row selection — a leading checkbox column plus a bulk bar that appears\n * only while rows are checked.\n *\n * OPT-IN and fully CONTROLLED: the consumer owns the id set, so selection\n * survives (or is deliberately cleared by) a re-fetch, a filter change, or an\n * optimistic list update — the table never holds hidden selection state that\n * can disagree with the surface around it.\n *\n * Why this is a primitive and not a per-surface checkbox column: a register\n * the user cannot clear in bulk is a register they stop reading, and the fifth\n * hand-rolled selection column — each with its own shift-click, its own\n * select-all semantics, its own bar — is exactly the fork `components/official/`\n * exists to prevent.\n *\n * Selection does not alter mobile horizontal scrolling. The complete row moves\n * as one surface below `sm`; no leading column is allowed to pin over the data.\n */\nexport interface MatrxDataTableSelectionConfig<T> {\n /** Selected row ids (`getRowId`). Ids not on the current page are kept. */\n selectedIds: string[];\n onSelectedIdsChange: (ids: string[]) => void;\n /**\n * The bulk bar's actions, given the currently-selected rows THAT ARE LOADED.\n * Selection can outlive a page change, so also take `selectedIds` when an\n * action only needs ids.\n */\n actions?: (selected: T[], selectedIds: string[]) => ReactNode;\n /**\n * Rows that cannot be acted on in bulk render NO checkbox at all — the cell\n * stays for alignment, the control is absent from the DOM. A greyed control\n * still advertises a choice the surface underneath would refuse.\n */\n isRowSelectable?: (row: T) => boolean;\n /** Singular noun for the bar's count (\"finding\" → \"3 findings selected\"). */\n noun?: string;\n}\n\n/** Table-owned state and actions exposed to an opt-in phone card renderer. */\nexport interface MatrxDataTableMobileCardControls {\n /** Render a declared column with the same editable/draft/link behavior as the grid. */\n renderCell: (columnId: string) => ReactNode;\n /** Whether this row is in the canonical selection set. */\n selected: boolean;\n /** Whether the consumer allows this row to be selected. */\n selectable: boolean;\n /** Update selection through the table's controlled/URL-backed contract. */\n onSelectedChange: (selected: boolean) => void;\n /**\n * The table's canonical per-row copy controls plus consumer row actions.\n * Render this instead of rebuilding either action path inside the card.\n */\n actions: ReactNode;\n}\n\nexport type MatrxDataTableDensity = \"condensed\" | \"normal\" | \"spacious\";\n\nexport interface MatrxDataTableProps<T> {\n data: T[];\n columns: MatrxColumnDef<T>[];\n /** Table-local visual density. An explicit value wins over the host default. */\n density?: MatrxDataTableDensity;\n /** Stable persistence identity for host-installed named views. */\n tableId?: string;\n /** Declared reset state for the host Saved Views control. */\n defaultViewSnapshot?: TableViewSnapshot;\n /** Working view tabs, on by default. Disable for embedded/single-purpose tables. */\n viewTabs?: boolean;\n /** Related-data controls shown at the right of the working-view tab strip. */\n relatedTableActions?: ReactNode;\n /** Optional URL/source-owned column order and visibility. */\n columnState?: {\n order: string[];\n hidden: string[];\n onChange: (next: { order: string[]; hidden: string[] }) => void;\n /** Optional source-owned desktop widths keyed by canonical column id. */\n widths?: Record<string, number>;\n /** Required to persist controlled width changes across remounts. */\n onWidthsChange?: (widths: Record<string, number>) => void;\n };\n /** Enables package-owned drag reordering in table headers. Default true. */\n reorderableColumns?: boolean;\n /** Enables desktop column resizing. Default true; handles are absent below `sm`. */\n resizableColumns?: boolean;\n columnManager?: { open: boolean; onOpenChange: (open: boolean) => void };\n getRowId: (row: T) => string;\n /**\n * Additional row identity included in local global search without becoming\n * a visible/sortable/filterable column. Use for canonical composite keys or\n * aliases whose displayed parts live in separate columns.\n *\n * Ignored in remote controlled mode, where the query owner applies search.\n */\n searchText?: (row: T) => string;\n /**\n * Hierarchy-aware local processing seam. The canonical table still owns the\n * toolbar, URL state, headers, pagination, editing, copy, and rendering; the\n * consumer only preserves domain ordering that a flat sort would destroy.\n *\n * The processor must honor every active query control in `state` and return\n * the complete filtered/sorted local result before pagination. It is ignored\n * in remote controlled mode, where `data` is already the queried page.\n */\n processLocalRows?: (rows: T[], state: MatrxDataTableQueryState) => T[];\n /** Initial local sort when neither URL state nor a controlled query owns it. */\n defaultSort?: SortState | null;\n isLoading?: boolean;\n /**\n * Background refresh state. Unlike `isLoading`, this preserves rendered rows\n * and shows only the table's non-blocking refresh indicator.\n */\n isFetching?: boolean;\n /**\n * Controlled query state for direct remote data sources. The component never\n * fetches data itself; it only emits state changes to the caller.\n */\n query?: MatrxDataTableQueryControl<T>;\n /**\n * Persist local query and record-view state in namespaced URL parameters.\n * This is intentionally opt-in and cannot be combined with controlled query\n * mode; remote tables use `useTableUrlState({ tableId })` in their query owner.\n */\n urlState?: MatrxDataTableUrlStateConfig;\n\n toolbar?: MatrxDataTableToolbar;\n /** Hide the package toolbar while retaining table-owned query behavior. */\n hideToolbar?: boolean;\n /** Hide numbered pagination; local rows remain available to the caller. */\n hidePagination?: boolean;\n /** Optional deferred Apply/Cancel copy for column filter popovers. */\n filterUi?: MatrxDataTableFilterUi;\n /** Row click opens the side panel unless `window.openOnRowClick` is true. */\n detail?: MatrxDataTableDetailConfig<T>;\n /** Panel icon opens a WindowPanel (page-local; supports ReactNode override). */\n window?: MatrxDataTableWindowConfig<T>;\n /** Copy + Copy for AI (rows + this view). Omit for the declared-column default; false suppresses it. */\n copy?: false | MatrxDataTableCopyConfig<T>;\n /** Where canonical per-row Alchemy appears. Inline preserves current behavior. */\n rowCopyPlacement?: \"inline\" | \"menu\";\n /** One pane-level right-click resolver; host owns the opaque descriptor. */\n contextMenu?: MatrxDataTableContextMenuConfig<T>;\n /** Inline edit session with floating Save/Cancel pill. */\n edit?: MatrxDataTableEditConfig<T>;\n /** Opt-in tree reparenting owned by the canonical row renderer. */\n hierarchy?: MatrxDataTableHierarchyConfig<T>;\n\n /** Controlled selection (selected row id for highlight). */\n selectedId?: string | null | undefined;\n onSelectedIdChange?: ((id: string | null) => void) | undefined;\n\n /** Controlled table-owned window row (normally supplied by URL state). */\n windowRowId?: string | null | undefined;\n onWindowRowIdChange?: ((id: string | null) => void) | undefined;\n\n /** Opt-in multi-row checkbox selection + a bulk action bar. */\n selection?: MatrxDataTableSelectionConfig<T>;\n\n /** Extra row actions rendered in a trailing Actions column. */\n rowActions?: (row: T, controls: MatrxDataTableRecordControls) => ReactNode;\n /** Extra rows rendered in the table footer with the same columns as data rows. */\n footerRows?: T[];\n /** Per-row presentation class, after canonical selection/highlight state. */\n rowClassName?: (row: T, index: number) => string | undefined;\n /** Highlight an index in the currently rendered page without selecting it. */\n highlightedIndex?: number | undefined;\n /** Receives the complete visible local view after local processing, before paging. Attaching after absence receives one snapshot; callback identity changes alone do not notify. */\n onViewChange?: (rows: T[]) => void;\n /**\n * Wrap the whole `<tr>`. Return `children` unchanged for no-op.\n *\n * `rowActions` only reaches the actions CELL, so anything that must own the\n * entire row — a right-click menu, a drag handle, a drop target — had no\n * seam and would have forced a surface to fork the table. THE INVENTORY LAW:\n * the fork is the defect, so the seam exists instead.\n *\n * Whatever you return must render `children` as a direct `<tbody>` child, so\n * the wrapper has to be a component that emits the `<tr>` unchanged\n * (`ItemContextMenu` does — it renders a Radix trigger with `asChild`).\n */\n rowWrapper?: (row: T, children: ReactNode) => ReactNode;\n\n emptyState?: MatrxDataTableEmptyState;\n /** Default 25. Pass 0 to show all. */\n pageSize?: number;\n /** Complete local results reveal on physical scroll by default. Numbered\n * paging is an explicit exception requiring its reason and approving owner. */\n localPagination?:\n | { mode?: \"progressive\" }\n | { mode: \"numbered\"; reason: string; approvedBy: string };\n pageSizeOptions?: number[];\n zebra?: boolean;\n /**\n * Keep the one semantic table header visible while its nearest vertical\n * scroll surface moves. Defaults to true. Set false only where surrounding\n * chrome already supplies the column labels.\n */\n stickyHeader?: boolean;\n className?: string;\n tableClassName?: string;\n /**\n * Optional compact row presentation rendered below `mobileCardsBreakpoint`\n * in place of the horizontal table. The caller supplies the record summary\n * because only the product surface knows which values and actions are\n * essential at narrow widths; MatrxDataTable still owns query state,\n * loading/empty states, and pagination.\n *\n * `controls.actions` carries the table-owned copy controls and consumer row\n * actions, so a card does not fork them. Prefer the default horizontal table\n * unless the product explicitly requires every essential value/action to be\n * discoverable without horizontal scrolling.\n */\n mobileCards?: (\n row: T,\n index: number,\n controls: MatrxDataTableMobileCardControls,\n ) => ReactNode;\n /** Card/table handoff. `sm` is phone-only; `lg` includes portrait tablets. */\n mobileCardsBreakpoint?: \"sm\" | \"lg\";\n /** Called after a row is selected for detail (in addition to opening the panel). */\n onRowOpen?: (row: T) => void;\n}\n\n/** Re-export for callers building custom agent payloads. */\nexport type { AgentPayloadInput };\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/data-table/types.ts"],"sourcesContent":["import type { ContentTransferReference } from \"../content-transfer/extensions\";\nimport type { ReactNode } from \"react\";\nimport type { TableSearchRole, TableSearchScope } from \"./ranked-search\";\nimport type { AgentPayloadInput } from \"./copy\";\nimport type { CopyExportConfig } from \"./copy-types\";\nimport type {\n AiCustomSource,\n AiVariant,\n} from \"./copy\";\nimport type { LayeredFilterField, LayeredFilterRule } from \"./layered-filters\";\n\n/** How a column's filter UI behaves. `auto` infers from sample values. */\nexport type ColumnFilterKind =\n \"auto\" | \"text\" | \"select\" | \"boolean\" | \"number\" | false;\n\nexport type SortDirection = \"asc\" | \"desc\";\n\n/**\n * A compact boolean marker with the language people expect for a saved item.\n *\n * `undefined` recognizes only the exact conventional boolean accessor names\n * (`favorite`, `is_favorite`, `favourite`, `is_favourite`, `pinned`, and\n * `is_pinned`). Pass `false` to keep one of those fields as an ordinary\n * boolean column. `\"favorite\"` and `\"pin\"` make the intent explicit for\n * differently named fields.\n */\nexport type ColumnMarker = \"favorite\" | \"pin\" | false;\n\n/** How the table's primary search text is matched. */\nexport type TableSearchMatchMode = \"contains\" | \"whole_words\";\n\n/** Cell value type for typed inline editors (Supabase-style popovers for non-strings). */\nexport type CellEditType =\n | \"string\"\n | \"number\"\n | \"boolean\"\n | \"select\"\n /** Free-text multi-value chips (string[] cells: tags, labels, aliases). */\n | \"tags\"\n | \"date\"\n | false;\n\nexport interface MatrxColumnDef<T> {\n /** Stable id used for sort/filter state. Defaults to `accessorKey` when set. */\n id?: string;\n /** Dot-free key on the row for default value access + auto filter. */\n accessorKey?: keyof T & string;\n /** Custom value for sort/filter when `accessorKey` is insufficient. */\n accessorFn?: (row: T) => unknown;\n /** Value used only for local sort. Falls back to `accessorFn` / `accessorKey`. */\n sortValue?: (row: T) => unknown;\n /** Value used only for local filters. Falls back to `accessorFn` / `accessorKey`. */\n filterValue?: (row: T) => unknown;\n header: ReactNode;\n /** Plain-text name used for header controls when `header` is visual-only. */\n label?: string;\n /** Cell renderer. Defaults to stringified accessor value. */\n cell?: (row: T, index: number) => ReactNode;\n /** Sortable unless explicitly false. Default true. */\n sortable?: boolean;\n /** Direction used by the first header-click sort. Default `\"asc\"`. */\n defaultSortDirection?: SortDirection;\n /**\n * Filter kind. Default `\"auto\"` — every column gets a filter.\n * Pass `false` only when a column truly must not filter (e.g. actions).\n */\n filter?: ColumnFilterKind;\n /** Explicit select options (when filter is `\"select\"` or auto-detected). */\n filterOptions?: Array<{ value: string; label: string }>;\n /**\n * Single-choice select filter. The default select filter is a multi-select\n * that APPENDS (OR semantics) — correct for a status column, wrong for a\n * column whose options are mutually exclusive VIEWS of the list (a\n * record-class scope, a relative-date bucket). There, appending makes the\n * filter inert: the consumer reads one value, the popover accumulates a set,\n * and the first-selected value wins forever (D218). With `filterSingle`,\n * choosing an option REPLACES the selection, and choosing the active option\n * again clears it.\n */\n filterSingle?: boolean;\n /**\n * Inline edit. Default false. `\"string\"` edits in-cell; other types open a\n * small popover (Supabase-style). Edits stay local until Save on the dirty pill.\n */\n editable?: CellEditType;\n /**\n * Per-row edit gate for an `editable` column. Return false to render the\n * plain cell (no pencil, no click-to-edit) for that row — for heterogeneous\n * lists where some kinds cannot take the write (e.g. a transcripts row of\n * kind \"unsorted\" has no user-facing title). Default: every row editable.\n */\n editableIf?: (row: T) => boolean;\n /**\n * How inline edit starts. Default `\"click\"` (click the cell body). `\"pencil\"`\n * shows a hover/focus pencil; the cell body no longer starts edit — so a\n * whole-row click can own that gesture. Forced to `\"pencil\"` when `href` is\n * set (D112 — the body is a real link).\n */\n editTrigger?: \"click\" | \"pencil\";\n /**\n * Options when `editable === \"select\"`. Also used by `\"tags\"` as the\n * suggestion list (existing values), while still allowing new entries.\n */\n editOptions?: Array<{ value: string; label: string }>;\n /**\n * Row link for the primary/title cell (D112): renders the cell content as a\n * real `next/link` anchor, so the row is reachable by keyboard, announced as\n * a link by screen readers, and cmd/middle-clickable into a new tab. The\n * whole-row `onRowOpen` click stays as a mouse convenience; clicks on the\n * anchor never double-fire it. Combine with `editable` and the link renders\n * with a hover/focus pencil that opens the inline editor instead of\n * click-text-to-edit.\n */\n href?: (row: T) => string | undefined;\n /**\n * Canonical entity token for the record this column NAMES. When set, the cell\n * renders through `EntityRef`, so the name carries the full door set — Open,\n * new tab, and Peek — instead of the Open-only `<Link>` that `href` alone\n * produces.\n *\n * THE INVENTORY LAW, applied to this component: the table grew its own door\n * (`href`) beside the platform's (`EntityRef`), and every column that named a\n * record picked one and silently lost the other half. This field collapses\n * them — `href` still works and still forces the pencil trigger, and it\n * OVERRIDES the registry route when both are set (for an admin-side route on\n * a satellite deployment).\n *\n * Needs the record's id: `entityToken` is paired with `entityId`, defaulting\n * to the table's own `getRowId`.\n *\n * **PER ROW, not per column** — a hub can be heterogeneous. `/transcripts`\n * lists transcripts, studio sessions, cleanup runs and an \"unsorted\" bucket\n * in one table, each with its own destination; a constant token would have\n * sent a session id to the transcript processor route and opened the\n * transcript peek on a record that is not one. Return `undefined` for a row\n * that names no entity — it falls back to the plain `href` link, or to inert\n * text. Pair with a per-row `href` when the kinds diverge.\n */\n entityToken?: string | ((row: T) => string | undefined);\n /**\n * NOTE: give the column a `cell` when you set this. Without one, a\n * UUID-shaped value renders the default `MatrxUuidCell`, which has its own\n * controls — wrapping those in the door's anchor would nest interactive\n * elements inside a link, and is redundant besides. The shell detects that\n * combination, skips the door, and screams once per column.\n */\n /** The id `entityToken` refers to. Defaults to the table's `getRowId(row)`. */\n entityId?: (row: T) => string | undefined;\n /**\n * Drop this column below `sm` (the phone breakpoint).\n *\n * A wide table on a phone becomes a horizontal scroller: the frozen\n * identity column stays, and everything after the second column sits off\n * the right edge where a reviewer will never find it. Marking the columns\n * that do NOT earn their width on a phone is how a surface declares an\n * INTENTIONAL mobile column set instead of an accidental one.\n *\n * The column is still fully sortable/filterable from the toolbar and still\n * rides every copy/export payload — this hides the CELL, not the data.\n * Default `false` = today's behavior everywhere.\n */\n mobileHidden?: boolean;\n /**\n * Built-in cell kinds. `\"uuid\"` / `\"fk\"` use MatrxUuidCell (short + copy +\n * optional open). `\"auto\"` (default) detects UUID-shaped strings.\n */\n cellKind?: \"auto\" | \"uuid\" | \"fk\" | \"text\";\n /**\n * FK / UUID navigation. Prefer `onOpen` → WindowPanel of the target.\n * Return `\"forbidden\"` when the caller lacks access.\n */\n fk?: {\n label?: string;\n /**\n * Canonical entity token this column's ids point at (`agent`, `note`, …).\n * THE DOOR LAW made declarative: the cell resolves route + new tab + peek\n * from the registries, so a column of ids stops being a dead end without\n * hand-wiring a link. `href` / `onOpen` still win when both are set.\n * A function form resolves the token per row (an audit log whose target\n * type varies by row).\n *\n * `\"auto\"` derives the token from the COLUMN NAME (`task_id` → `task`).\n * It is opt-in on purpose: the guess is only correct when you have checked\n * the actual FK. `scheduler.sch_run.task_id` references `scheduler.sch_task`,\n * not the workspace `task` the name implies, and `app_id` /\n * `conversation_id` / `file_id` / `workflow_id` each have several candidate\n * tables. A wrong door opens a DIFFERENT record — worse than no door.\n */\n token?: string | null | \"auto\" | ((row: T) => string | null | undefined);\n href?: (id: string, row: T) => string | null | undefined;\n onOpen?: (\n id: string,\n row: T,\n ) => void | \"forbidden\" | Promise<void | \"forbidden\">;\n /** Force non-navigable for this column. */\n forbidden?: boolean | ((id: string, row: T) => boolean);\n };\n className?: string;\n headerClassName?: string;\n width?: string | number;\n /** Enable desktop resizing for this column. Defaults to true when the table enables it. */\n resizable?: boolean;\n /** Desktop resize boundary. Defaults to 80px. */\n minWidth?: number;\n /** Desktop resize boundary. Defaults to 1200px. */\n maxWidth?: number;\n align?: \"left\" | \"center\" | \"right\";\n /**\n * ICON COLUMN. A column whose whole content is one glyph — a star, a lock, a\n * status dot — and whose `width` is therefore a lie without this flag.\n *\n * `width` is only a hint on a table cell: min-content wins. A 40px star column\n * still rendered ~70px wide because the HEADER carried three separate\n * controls beside the glyph (the sort button, its arrow, the filter funnel),\n * and the cell carried the default `px-2` on both sides. Every surface that\n * wanted a tight icon column was paying for chrome it never used.\n *\n * `compact` fixes it AT THE PRIMITIVE, and does NOT cost the column anything:\n * horizontal padding drops to `px-1`, and the header collapses its three\n * controls into ONE popover trigger that still offers Sort ascending / Sort\n * descending / Clear sort / the full filter body. The column stays fully\n * sortable and filterable — the affordances moved into the menu, they did not\n * disappear. Active sort/filter still show, as a 2px dot on the trigger.\n *\n * Pair it with `width` and `align: \"center\"`.\n */\n compact?: boolean;\n /**\n * Saved-item marker semantics for a compact boolean column. Markers default\n * to 40px, keep the existing sort/filter menu, and name its choices as\n * Favorites/Pins. See `ColumnMarker` for automatic recognition and opt-out.\n */\n marker?: ColumnMarker;\n /** Hide from the table (still available in column picker when we add it). */\n hidden?: boolean;\n /** Whether the package-owned Columns dialog may hide this column. Default true. */\n hideable?: boolean;\n}\n\n/** How a text filter matches. Default `\"contains\"`. */\nexport type TextFilterMode = \"contains\" | \"empty\" | \"not_empty\" | \"null\" | \"not_null\";\n\n/** Active per-column filter value. Shape depends on filter kind. */\nexport type ColumnFilterValue =\n | { kind: \"text\"; value: string; mode?: TextFilterMode; negated?: boolean }\n | {\n kind: \"select\";\n /** Single-choice value (legacy writers). Ignored when `values` is set. */\n value: string;\n /** Multi-choice OR set — a row passes if it matches ANY entry. */\n values?: string[];\n /** Exclude matching values instead of including them. */\n negated?: boolean;\n }\n | { kind: \"boolean\"; value: boolean; negated?: boolean }\n | { kind: \"number\"; min?: number | undefined; max?: number | undefined; negated?: boolean };\n\nexport type ColumnFiltersState = Record<string, ColumnFilterValue | undefined>;\n\nexport interface SortState {\n id: string;\n direction: SortDirection;\n}\n\n/**\n * Opt-in durable URL state for a local table.\n *\n * Every table gets an explicit stable id, producing namespaced parameters such\n * as `table.accounts.q` and `table.accounts.sort`. This prevents collisions\n * with page-owned parameters and with sibling tables on the same route.\n */\nexport interface MatrxDataTableUrlStateConfig {\n /** Stable lowercase identifier: letters, numbers, and hyphens; max 64 chars. */\n id: string;\n /** Initial sort when the URL carries none. Default: none. */\n defaultSort?: SortState | null | undefined;\n /** Browser history behavior for table transitions. Default: `push`. */\n history?: \"push\" | \"replace\" | undefined;\n /**\n * History behavior while typing search/any-of text. `session` pushes the\n * first edit, then replaces rapid keystrokes. Default: `session`.\n */\n textHistory?: \"session\" | \"push\" | \"replace\" | undefined;\n /** Persist the open side-panel row. Default true. */\n selectedRow?: boolean;\n /** Persist the open table-owned window row. Default true. */\n windowRow?: boolean;\n /** Persist checkbox selection. Opt-in because large selections lengthen URLs. */\n selection?: boolean;\n}\n\n/**\n * Complete view state for a remotely queried table page. The table owns none\n * of this state in controlled mode: callers may mirror it to URL search params\n * and use it as part of a direct database-query cache key.\n */\nexport interface MatrxDataTableQueryState {\n /** One-based page number, matching the table's pagination UI. */\n page: number;\n pageSize: number;\n search: string;\n /** Defaults to `contains` when omitted, preserving every existing table. */\n searchMatchMode?: TableSearchMatchMode;\n /** Selected intelligent-search scope. Omitted means the backward-compatible All scope. */\n searchScope?: string;\n anyOf: string;\n /** Ordered AND rules from the compact advanced-filter builder. */\n layeredFilters?: LayeredFilterRule[];\n columnFilters: ColumnFiltersState;\n sort: SortState | null;\n}\n\n/**\n * Optional data-processing contract. Omit it (or use `local`) to preserve the\n * original in-memory filter/sort/pagination behavior. In controlled mode,\n * `data` is already the current page and the caller performs all querying.\n */\n/** Structural match for @ai-matrx/data/react usePaginatedData. */\nexport interface MatrxTablePagination<T> {\n queryKey: string;\n rows: T[];\n loading: boolean;\n isFetchingNextPage: boolean;\n error: Error | null;\n hasNextPage: boolean;\n loadNextPage: () => Promise<void>;\n refresh: () => void;\n totalItems: number | undefined;\n loadAll?: { isLoading: boolean; request: () => void; stop: () => void };\n retrySource?: () => void;\n sourceUntil?: string;\n sourcePageSize?: { value: number; options: readonly number[]; onChange: (value: number) => void };\n}\n\n/**\n * A controlled-local table can retain local search/pagination while its source\n * owns column filters and/or sorting. `sourceTotal` is display metadata only:\n * it never changes local page slicing, because the loaded rows remain local.\n */\nexport interface MatrxDataTableSourceProcessing {\n search?: \"local\" | \"source\";\n /** Source accepts and ranks `searchScope`; omit to keep scope UI local-only. */\n intelligentSearch?: \"local\" | \"source\";\n columnFilters?: \"local\" | \"source\";\n sort?: \"local\" | \"source\";\n sourceTotal?: number;\n}\n\nexport type MatrxDataTableQueryControl<T = unknown> =\n | { mode: \"local\" }\n | {\n /** Accumulated server rows; page stays 1 and sort/filter remain server-owned. */\n mode: \"controlled-append\";\n state: MatrxDataTableQueryState;\n onStateChange: (next: MatrxDataTableQueryState) => void;\n pagination: MatrxTablePagination<T>;\n sourceProcessing?: MatrxDataTableSourceProcessing;\n /** Source-connected tables append on user scroll by default. */\n scroll?: { thresholdPx?: number; intentTimeoutMs?: number } & (\n | { mode?: \"scroll\" }\n | { mode: \"manual\"; reason: string; approvedBy: string }\n /** Temporary configuration state: automatic append is off, but Load more stays available. */\n | { mode: \"suspended\"; reason: string }\n );\n }\n | {\n /** Local rows, but every query control is owned by the caller (for URL state). */\n mode: \"controlled-local\";\n state: MatrxDataTableQueryState;\n onStateChange: (next: MatrxDataTableQueryState) => void;\n sourceProcessing?: MatrxDataTableSourceProcessing;\n }\n | {\n mode: \"controlled\";\n state: MatrxDataTableQueryState;\n /** Total rows matching the controlled query, not just `data.length`. */\n totalItems: number;\n onStateChange: (next: MatrxDataTableQueryState) => void;\n /** Declare source-owned query behavior before enabling source-aware controls. */\n sourceProcessing?: MatrxDataTableSourceProcessing;\n };\n\n/**\n * Toolbar facets — first-class, Mars-extensible filter controls above the grid.\n * Start with button-group; add radio / switch / complex later without forking.\n */\nexport type ToolbarFacet =\n | {\n type: \"button-group\";\n id: string;\n label?: string;\n value: string;\n /** Reset target for per-facet + global clear. Default: first option value. */\n defaultValue?: string;\n options: Array<{\n value: string;\n label: string;\n icon?: ReactNode;\n }>;\n onChange: (value: string) => void;\n }\n | {\n type: \"custom\";\n id: string;\n render: () => ReactNode;\n /** Declare filter state and its reset together so global Clear includes custom controls. */\n filter?: { active: boolean; onReset: () => void };\n };\n\n/**\n * Cross-column OR search — matches if ANY listed column contains the query.\n * Relationships use case: filter by entity type without picking source vs target.\n */\nexport interface AnyOfColumnSearch {\n columnIds: string[];\n placeholder?: string;\n /** Controlled value. Uncontrolled if omitted. */\n value?: string;\n onChange?: (value: string) => void;\n}\n\nexport interface MatrxDataTableToolbar {\n /** Optional human-readable table title, rendered by the shared title row. */\n title?: string;\n /** Global search across all accessor values. Default true. */\n search?: boolean;\n searchPlaceholder?: string;\n searchValue?: string;\n onSearchChange?: (value: string) => void;\n /**\n * Show a compact, visible choice between substring and whole-word search.\n * Omit it when a data source cannot honor both modes server-side.\n */\n searchMatch?: {\n defaultMode?: TableSearchMatchMode;\n };\n /** Optional field-scope controls. Local search always ranks all loaded fields before pagination. */\n intelligentSearch?: {\n roles?: Readonly<Record<string, TableSearchRole>>;\n scopes?: readonly TableSearchScope[];\n };\n /**\n * OR-search across specific columns (e.g. source_type OR target_type).\n * Shown as its own input beside global search when set.\n */\n anyOf?: AnyOfColumnSearch;\n /**\n * Optional compact advanced-filter builder beside the regular search. In\n * controlled mode rules live in `query.state.layeredFilters`; local tables\n * evaluate them against matching column ids.\n */\n layeredFilters?: {\n fields: readonly LayeredFilterField[];\n maxRules?: number;\n label?: string;\n };\n /** Extensible facet strip (button groups, later radios/switches/…). */\n facets?: ToolbarFacet[];\n /** Source controls in a separate wrapping row below the standard toolbar. */\n leading?: ReactNode;\n /**\n * Standard host refresh affordance. The package owns its placement, busy\n * state, accessible tooltip, and glyphs (refresh arrows at rest, spinner\n * only while busy); the host remains the sole data owner.\n */\n refresh?: {\n onRefresh: () => void | Promise<void>;\n label?: string;\n };\n /**\n * Standard create affordance. The host owns authorization and the actual\n * create flow; disabledReason is exposed through the shared tooltip.\n */\n add?: {\n onAdd: () => void | Promise<void>;\n disabled?: boolean;\n disabledReason?: string;\n };\n /** Right-side domain actions, rendered after standard table controls. */\n actions?: ReactNode;\n}\n\n/** Query fields safe to persist in a named table view. */\nexport type TableViewQuery = Omit<MatrxDataTableQueryState, \"page\">;\n\n/** Portable, persistence-neutral table state saved by a host adapter. */\nexport interface TableViewSnapshot {\n __kind: \"matrx-table-view\";\n version: 1;\n /** Page/cursor/selection/loaded rows are deliberately never saved. */\n query: TableViewQuery;\n /** `widths` is sparse so views saved before resize remain valid. */\n columns: { order: string[]; hidden: string[]; widths?: Record<string, number> };\n}\n\n/** Host port for durable named views. The host owns actor, tenancy and CRUD. */\nexport interface TableSavedViewsProps {\n tableId: string;\n snapshot: TableViewSnapshot;\n defaultSnapshot: TableViewSnapshot;\n onApply: (snapshot: TableViewSnapshot) => void;\n}\n\n/** Optional deferred-apply copy for column filter popovers. */\nexport interface MatrxDataTableFilterUi {\n /** Enables the Include/Exclude control. Default false for remote-safe filters. */\n allowNegation?: boolean;\n /** Enables null/not-null text modes. Default false for remote-safe filters. */\n allowNullModes?: boolean;\n applyLabel?: string;\n showCancel?: boolean;\n footerHint?: ReactNode;\n}\n\nexport interface MatrxDataTableCopyConfig<T> {\n /** Explicit registered identities; never inferred from table labels or row shapes. */\n rowReferences?: (row: T) => readonly ContentTransferReference[];\n references?: (visible: T[], all: T[]) => readonly ContentTransferReference[];\n triggerVariant?: \"transparent\" | \"glass\" | \"outline\";\n /** Toast / tooltip label base, e.g. \"Relationship rule\". */\n label: string;\n listLabel?: string;\n location: string;\n rowKind: string;\n listKind: string;\n rowDescription?: string;\n listDescription?: string;\n humanRow: (row: T) => string;\n /** Project row for agent JSON. Default: full row. */\n agentRow?: (row: T) => unknown;\n rowAttributes?: (\n row: T,\n ) => Record<string, string | number | boolean | null | undefined>;\n listAttributes?: (\n visible: T[],\n all: T[],\n ) => Record<string, string | number | boolean | null | undefined>;\n /**\n * Live view state rendered inside the list payload's <context>. Unlike\n * per-row data, this remains present when the current view has zero rows.\n */\n listContext?: (\n visible: T[],\n all: T[],\n ) => Record<string, string | number | boolean | null | undefined>;\n /**\n * Additional row-scoped AI actions. Use this to fold a domain action such\n * as a paste-ready repair brief into the table-owned row copy menu instead\n * of rendering a separate third control. Builders run at click time.\n */\n rowAiVariants?: (row: T) => AiVariant[];\n /**\n * Graded AI variants for the toolbar's view copy (e.g. \"Top 25\", \"Summary\n * only\"). When set, the toolbar's Copy-for-AI upgrades to a dropdown with\n * these variants + the full-view payload as the automatic \"Everything\"\n * escape hatch. Receives (visible, all) rows at render; builders run at\n * click time.\n */\n aiVariants?: (visible: T[], all: T[]) => AiVariant[];\n /** Custom-preview source (options dialog + live size counts) for the view. */\n aiCustom?: (visible: T[], all: T[]) => AiCustomSource;\n /** Additional domain exports in the same canonical menu; builders run on demand. */\n export?: (visible: T[], all: T[]) => CopyExportConfig;\n /** Show toolbar copy (this view). Default true when copy is set. */\n showToolbar?: boolean;\n /** Show per-row copy. Default true when copy is set. */\n showRow?: boolean;\n}\n\nexport interface MatrxDataTableDetailConfig<T> {\n /** Side-panel title. Default: first string column or \"Details\". */\n title?: (row: T) => ReactNode;\n description?: (row: T) => ReactNode | undefined;\n /** Override the default key/value inspector. */\n render?: (row: T, controls: MatrxDataTableRecordControls) => ReactNode;\n /** Header actions inside the side panel. */\n headerActions?: (row: T) => ReactNode;\n defaultWidth?: number;\n enabled?: boolean;\n /**\n * Maps a field name to the entity token its id points at, turning that field\n * into a door (route + peek) in the default inspector — side panel AND row\n * window.\n *\n * There is no default guess: this inspector renders whatever columns the row\n * has, and a wrong door opens a DIFFERENT record (`sch_run.task_id` is a\n * SCHEDULED task, not a workspace `task`). A table whose FKs you HAVE checked\n * can pass `tokenFromColumnName` (`components/official/entity-ref/doors`) to\n * open every `<token>_id` field at once.\n *\n * The ROW is passed too, because a table whose target type varies per row (an\n * audit log, an exposure report) cannot answer from the column name alone.\n */\n tokenForField?: (key: string, row: T) => string | null;\n}\n\n/** Actions a record-owned control can use without reaching into table state. */\nexport interface MatrxDataTableRecordControls {\n /** Close the row's side-panel detail, if open. */\n closeDetail: () => void;\n /** Open the row in the canonical adjustable side panel. */\n openDetail: () => void;\n /** Open the row in its canonical table-owned WindowPanel. */\n openWindow: () => void;\n /** Close the row's table-owned WindowPanel, if open. */\n closeWindow: () => void;\n /** Whether this row currently has visible, unpersisted inline edits. */\n hasPendingEdits: boolean;\n /**\n * Discard this row's pending inline edits.\n *\n * Row actions that persist the already-merged visible row (for example an\n * explicit Confirm action) call this only after that write succeeds. This\n * prevents the floating Save pill from later replaying the same draft as a\n * different, weaker write.\n */\n discardPendingEdits: () => void;\n beginEdit?: () => void;\n saveEdits?: () => void | Promise<void>;\n cancelEdits?: () => void;\n}\n\n/** Opaque host-owned row menu descriptor. The package never interprets it. */\nexport interface MatrxDataTableContextMenuConfig<T> {\n resolveRowContext: (row: T, controls: MatrxDataTableRecordControls) => unknown;\n}\n\nexport interface MatrxDataTableWindowConfig<T> {\n /** Window title. */\n title?: (row: T) => string;\n /**\n * @deprecated Prefer `renderView` + `renderEdit` so the window stays editable.\n * Full-body override with no View/Edit tabs.\n */\n render?: (row: T, controls: MatrxDataTableRecordControls) => ReactNode;\n /** View tab body. Defaults to DataRowInspector. */\n renderView?: (row: T, controls: MatrxDataTableRecordControls) => ReactNode;\n /**\n * Edit tab body. When set, the WindowPanel shows View / Edit sidebar tabs\n * (WindowPanel built-in sidebar). Defaults to `detail.render` when present.\n * Pass `false` to keep a view-only window even when `detail.render` exists.\n */\n renderEdit?:\n ((row: T, controls: MatrxDataTableRecordControls) => ReactNode) | false;\n /**\n * Called when the panel icon opens the window — hydrate edit state here\n * without opening the side panel (prefer this over `onRowOpen` for windows).\n */\n onOpen?: (row: T) => void;\n /**\n * Make full-row click open the WindowPanel instead of the side panel.\n * The trailing row action and the window header then expose the side panel\n * as the explicit secondary presentation. Default false.\n */\n openOnRowClick?: boolean;\n /** Which tab to open. Default: `\"edit\"` when an edit body exists. */\n defaultTab?: \"view\" | \"edit\";\n /** Show the panel-icon that opens the window. Default true when detail enabled. */\n enabled?: boolean;\n width?: number;\n height?: number;\n}\n\nexport interface MatrxDataTableEmptyState {\n icon?: ReactNode;\n title: string;\n description?: string;\n action?: ReactNode;\n}\n\n/** Pending cell edits keyed by row id → partial field map. */\nexport type CellEditsMap = Record<string, Record<string, unknown>>;\n\nexport interface MatrxDataTableEditConfig<T> {\n /** Enable inline editing for columns with `editable` set. */\n enabled?: boolean;\n /**\n * Persist all pending edits. Called when the user clicks Save on the dirty pill.\n * Return resolved when done; throw/reject to keep the draft (with toast).\n */\n onSave: (edits: CellEditsMap, rows: T[]) => void | Promise<void>;\n /** Persist each committed cell immediately. Failed writes remain in the\n * dirty pill so the user can retry or cancel them. */\n autoSave?: boolean;\n /** Optional cancel hook (draft already discarded). */\n onCancel?: () => void;\n}\n\nexport interface MatrxDataTableHierarchyConfig<T> {\n /** Complete hierarchy when `data` is only the current controlled page. */\n rows?: T[];\n getParentId: (row: T) => string | null;\n /** Persist the exact structural intent represented by the drop shadow. */\n onMove: (row: T, move: MatrxDataTableHierarchyMove) => void | Promise<void>;\n /** Enables sibling insertion shadows in addition to parent/root drops. */\n manualOrder?: boolean;\n canReparent?: (row: T) => boolean;\n itemLabel?: (row: T) => string;\n rootDropLabel?: string;\n}\n\nexport interface MatrxDataTableHierarchyMove {\n parentId: string | null;\n /**\n * Insert immediately before this sibling. Null means first child for\n * \"inside\"/\"root\", and LAST sibling for \"after\" (target had no successor).\n */\n beforeId: string | null;\n position: \"before\" | \"after\" | \"inside\" | \"root\";\n targetId: string | null;\n}\n\n/**\n * Multi-row selection — a leading checkbox column plus a bulk bar that appears\n * only while rows are checked.\n *\n * OPT-IN and fully CONTROLLED: the consumer owns the id set, so selection\n * survives (or is deliberately cleared by) a re-fetch, a filter change, or an\n * optimistic list update — the table never holds hidden selection state that\n * can disagree with the surface around it.\n *\n * Why this is a primitive and not a per-surface checkbox column: a register\n * the user cannot clear in bulk is a register they stop reading, and the fifth\n * hand-rolled selection column — each with its own shift-click, its own\n * select-all semantics, its own bar — is exactly the fork `components/official/`\n * exists to prevent.\n *\n * Selection does not alter mobile horizontal scrolling. The complete row moves\n * as one surface below `sm`; no leading column is allowed to pin over the data.\n */\nexport interface MatrxDataTableSelectionConfig<T> {\n /** Selected row ids (`getRowId`). Ids not on the current page are kept. */\n selectedIds: string[];\n onSelectedIdsChange: (ids: string[]) => void;\n /**\n * The bulk bar's actions, given the currently-selected rows THAT ARE LOADED.\n * Selection can outlive a page change, so also take `selectedIds` when an\n * action only needs ids.\n */\n actions?: (selected: T[], selectedIds: string[]) => ReactNode;\n /**\n * Rows that cannot be acted on in bulk render NO checkbox at all — the cell\n * stays for alignment, the control is absent from the DOM. A greyed control\n * still advertises a choice the surface underneath would refuse.\n */\n isRowSelectable?: (row: T) => boolean;\n /** Singular noun for the bar's count (\"finding\" → \"3 findings selected\"). */\n noun?: string;\n}\n\n/** Table-owned state and actions exposed to an opt-in phone card renderer. */\nexport interface MatrxDataTableMobileCardControls {\n /** Render a declared column with the same editable/draft/link behavior as the grid. */\n renderCell: (columnId: string) => ReactNode;\n /** Whether this row is in the canonical selection set. */\n selected: boolean;\n /** Whether the consumer allows this row to be selected. */\n selectable: boolean;\n /** Update selection through the table's controlled/URL-backed contract. */\n onSelectedChange: (selected: boolean) => void;\n /**\n * The table's canonical per-row copy controls plus consumer row actions.\n * Render this instead of rebuilding either action path inside the card.\n */\n actions: ReactNode;\n}\n\nexport type MatrxDataTableDensity = \"condensed\" | \"normal\" | \"spacious\";\n\nexport interface MatrxDataTableProps<T> {\n data: T[];\n columns: MatrxColumnDef<T>[];\n /** Table-local visual density. An explicit value wins over the host default. */\n density?: MatrxDataTableDensity;\n /** Stable persistence identity for host-installed named views. */\n tableId?: string;\n /** Declared reset state for the host Saved Views control. */\n defaultViewSnapshot?: TableViewSnapshot;\n /** Working view tabs, on by default. Disable for embedded/single-purpose tables. */\n viewTabs?: boolean;\n /** Related-data controls shown at the right of the working-view tab strip. */\n relatedTableActions?: ReactNode;\n /** Optional URL/source-owned column order and visibility. */\n columnState?: {\n order: string[];\n hidden: string[];\n onChange: (next: { order: string[]; hidden: string[] }) => void;\n /** Optional source-owned desktop widths keyed by canonical column id. */\n widths?: Record<string, number>;\n /** Required to persist controlled width changes across remounts. */\n onWidthsChange?: (widths: Record<string, number>) => void;\n };\n /** Enables package-owned drag reordering in table headers. Default true. */\n reorderableColumns?: boolean;\n /** Enables desktop column resizing. Default true; handles are absent below `sm`. */\n resizableColumns?: boolean;\n columnManager?: { open: boolean; onOpenChange: (open: boolean) => void };\n getRowId: (row: T) => string;\n /**\n * Additional row identity included in local global search without becoming\n * a visible/sortable/filterable column. Use for canonical composite keys or\n * aliases whose displayed parts live in separate columns.\n *\n * Ignored in remote controlled mode, where the query owner applies search.\n */\n searchText?: (row: T) => string;\n /**\n * Hierarchy-aware local processing seam. The canonical table still owns the\n * toolbar, URL state, headers, pagination, editing, copy, and rendering; the\n * consumer only preserves domain ordering that a flat sort would destroy.\n *\n * The processor must honor every active query control in `state` and return\n * the complete filtered/sorted local result before pagination. It is ignored\n * in remote controlled mode, where `data` is already the queried page.\n */\n processLocalRows?: (rows: T[], state: MatrxDataTableQueryState) => T[];\n /** Initial local sort when neither URL state nor a controlled query owns it. */\n defaultSort?: SortState | null;\n isLoading?: boolean;\n /**\n * Background refresh state. Unlike `isLoading`, this preserves rendered rows\n * and shows only the table's non-blocking refresh indicator.\n */\n isFetching?: boolean;\n /**\n * Controlled query state for direct remote data sources. The component never\n * fetches data itself; it only emits state changes to the caller.\n */\n query?: MatrxDataTableQueryControl<T>;\n /**\n * Persist local query and record-view state in namespaced URL parameters.\n * This is intentionally opt-in and cannot be combined with controlled query\n * mode; remote tables use `useTableUrlState({ tableId })` in their query owner.\n */\n urlState?: MatrxDataTableUrlStateConfig;\n\n toolbar?: MatrxDataTableToolbar;\n /** Hide the package toolbar while retaining table-owned query behavior. */\n hideToolbar?: boolean;\n /** Hide numbered pagination; local rows remain available to the caller. */\n hidePagination?: boolean;\n /** Optional deferred Apply/Cancel copy for column filter popovers. */\n filterUi?: MatrxDataTableFilterUi;\n /** Row click opens the side panel unless `window.openOnRowClick` is true. */\n detail?: MatrxDataTableDetailConfig<T>;\n /** Panel icon opens a WindowPanel (page-local; supports ReactNode override). */\n window?: MatrxDataTableWindowConfig<T>;\n /** Copy + Copy for AI (rows + this view). Omit for the declared-column default; false suppresses it. */\n copy?: false | MatrxDataTableCopyConfig<T>;\n /** Where canonical per-row Alchemy appears. Inline preserves current behavior. */\n rowCopyPlacement?: \"inline\" | \"menu\";\n /** One pane-level right-click resolver; host owns the opaque descriptor. */\n contextMenu?: MatrxDataTableContextMenuConfig<T>;\n /** Inline edit session with floating Save/Cancel pill. */\n edit?: MatrxDataTableEditConfig<T>;\n /** Opt-in tree reparenting owned by the canonical row renderer. */\n hierarchy?: MatrxDataTableHierarchyConfig<T>;\n\n /** Controlled selection (selected row id for highlight). */\n selectedId?: string | null | undefined;\n onSelectedIdChange?: ((id: string | null) => void) | undefined;\n\n /** Controlled table-owned window row (normally supplied by URL state). */\n windowRowId?: string | null | undefined;\n onWindowRowIdChange?: ((id: string | null) => void) | undefined;\n\n /** Opt-in multi-row checkbox selection + a bulk action bar. */\n selection?: MatrxDataTableSelectionConfig<T>;\n\n /** Extra row actions rendered in a trailing Actions column. */\n rowActions?: (row: T, controls: MatrxDataTableRecordControls) => ReactNode;\n /** Extra rows rendered in the table footer with the same columns as data rows. */\n footerRows?: T[];\n /** Per-row presentation class, after canonical selection/highlight state. */\n rowClassName?: (row: T, index: number) => string | undefined;\n /** Highlight an index in the currently rendered page without selecting it. */\n highlightedIndex?: number | undefined;\n /** Receives the complete visible local view after local processing, before paging. Attaching after absence receives one snapshot; callback identity changes alone do not notify. */\n onViewChange?: (rows: T[]) => void;\n /**\n * Wrap the whole `<tr>`. Return `children` unchanged for no-op.\n *\n * `rowActions` only reaches the actions CELL, so anything that must own the\n * entire row — a right-click menu, a drag handle, a drop target — had no\n * seam and would have forced a surface to fork the table. THE INVENTORY LAW:\n * the fork is the defect, so the seam exists instead.\n *\n * Whatever you return must render `children` as a direct `<tbody>` child, so\n * the wrapper has to be a component that emits the `<tr>` unchanged\n * (`ItemContextMenu` does — it renders a Radix trigger with `asChild`).\n */\n rowWrapper?: (row: T, children: ReactNode) => ReactNode;\n\n emptyState?: MatrxDataTableEmptyState;\n /** Default 25. Pass 0 to show all. */\n pageSize?: number;\n /** Complete local results reveal on physical scroll by default. Numbered\n * paging is an explicit exception requiring its reason and approving owner. */\n localPagination?:\n | { mode?: \"progressive\" }\n | { mode: \"numbered\"; reason: string; approvedBy: string };\n pageSizeOptions?: number[];\n zebra?: boolean;\n /**\n * Keep the one semantic table header visible while its nearest vertical\n * scroll surface moves. Defaults to true. Set false only where surrounding\n * chrome already supplies the column labels.\n */\n stickyHeader?: boolean;\n className?: string;\n tableClassName?: string;\n /**\n * Optional compact row presentation rendered below `mobileCardsBreakpoint`\n * in place of the horizontal table. The caller supplies the record summary\n * because only the product surface knows which values and actions are\n * essential at narrow widths; MatrxDataTable still owns query state,\n * loading/empty states, and pagination.\n *\n * `controls.actions` carries the table-owned copy controls and consumer row\n * actions, so a card does not fork them. Prefer the default horizontal table\n * unless the product explicitly requires every essential value/action to be\n * discoverable without horizontal scrolling.\n */\n mobileCards?: (\n row: T,\n index: number,\n controls: MatrxDataTableMobileCardControls,\n ) => ReactNode;\n /** Card/table handoff. `sm` is phone-only; `lg` includes portrait tablets. */\n mobileCardsBreakpoint?: \"sm\" | \"lg\";\n /** Called after a row is selected for detail (in addition to opening the panel). */\n onRowOpen?: (row: T) => void;\n}\n\n/** Re-export for callers building custom agent payloads. */\nexport type { AgentPayloadInput };\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import '../content-transfer.cjs';
2
2
  import 'react';
3
- export { A as AnyOfColumnSearch, j as CellEditType, k as CellEditsMap, f as ColumnFilterKind, a as ColumnFilterValue, C as ColumnFiltersState, M as MatrxColumnDef, l as MatrxDataTableContextMenuConfig, g as MatrxDataTableCopyConfig, d as MatrxDataTableDensity, m as MatrxDataTableDetailConfig, n as MatrxDataTableEditConfig, o as MatrxDataTableEmptyState, p as MatrxDataTableFilterUi, q as MatrxDataTableHierarchyConfig, r as MatrxDataTableHierarchyMove, s as MatrxDataTableMobileCardControls, h as MatrxDataTableProps, t as MatrxDataTableQueryControl, e as MatrxDataTableQueryState, c as MatrxDataTableRecordControls, u as MatrxDataTableSelectionConfig, v as MatrxDataTableSourceProcessing, w as MatrxDataTableToolbar, x as MatrxDataTableUrlStateConfig, y as MatrxDataTableWindowConfig, z as MatrxTablePagination, B as SortDirection, S as SortState, b as TableSavedViewsProps, T as TableSearchMatchMode, D as TableViewQuery, i as TableViewSnapshot, E as TextFilterMode, F as ToolbarFacet } from '../types-DRusLYrU.cjs';
3
+ export { A as AnyOfColumnSearch, k as CellEditType, l as CellEditsMap, f as ColumnFilterKind, a as ColumnFilterValue, C as ColumnFiltersState, j as ColumnMarker, M as MatrxColumnDef, m as MatrxDataTableContextMenuConfig, g as MatrxDataTableCopyConfig, d as MatrxDataTableDensity, n as MatrxDataTableDetailConfig, o as MatrxDataTableEditConfig, p as MatrxDataTableEmptyState, q as MatrxDataTableFilterUi, r as MatrxDataTableHierarchyConfig, s as MatrxDataTableHierarchyMove, t as MatrxDataTableMobileCardControls, h as MatrxDataTableProps, u as MatrxDataTableQueryControl, e as MatrxDataTableQueryState, c as MatrxDataTableRecordControls, v as MatrxDataTableSelectionConfig, w as MatrxDataTableSourceProcessing, x as MatrxDataTableToolbar, y as MatrxDataTableUrlStateConfig, z as MatrxDataTableWindowConfig, B as MatrxTablePagination, D as SortDirection, S as SortState, b as TableSavedViewsProps, T as TableSearchMatchMode, E as TableViewQuery, i as TableViewSnapshot, F as TextFilterMode, G as ToolbarFacet } from '../types-DsmrqJHN.cjs';
4
4
  export { AgentPayloadInput } from './copy-types.cjs';
5
5
  import '@ai-matrx/kit/content-transfer';
6
6
  import '../content-transfer/icon.cjs';
@@ -1,6 +1,6 @@
1
1
  import '../content-transfer.js';
2
2
  import 'react';
3
- export { A as AnyOfColumnSearch, j as CellEditType, k as CellEditsMap, f as ColumnFilterKind, a as ColumnFilterValue, C as ColumnFiltersState, M as MatrxColumnDef, l as MatrxDataTableContextMenuConfig, g as MatrxDataTableCopyConfig, d as MatrxDataTableDensity, m as MatrxDataTableDetailConfig, n as MatrxDataTableEditConfig, o as MatrxDataTableEmptyState, p as MatrxDataTableFilterUi, q as MatrxDataTableHierarchyConfig, r as MatrxDataTableHierarchyMove, s as MatrxDataTableMobileCardControls, h as MatrxDataTableProps, t as MatrxDataTableQueryControl, e as MatrxDataTableQueryState, c as MatrxDataTableRecordControls, u as MatrxDataTableSelectionConfig, v as MatrxDataTableSourceProcessing, w as MatrxDataTableToolbar, x as MatrxDataTableUrlStateConfig, y as MatrxDataTableWindowConfig, z as MatrxTablePagination, B as SortDirection, S as SortState, b as TableSavedViewsProps, T as TableSearchMatchMode, D as TableViewQuery, i as TableViewSnapshot, E as TextFilterMode, F as ToolbarFacet } from '../types-CbGNfo7r.js';
3
+ export { A as AnyOfColumnSearch, k as CellEditType, l as CellEditsMap, f as ColumnFilterKind, a as ColumnFilterValue, C as ColumnFiltersState, j as ColumnMarker, M as MatrxColumnDef, m as MatrxDataTableContextMenuConfig, g as MatrxDataTableCopyConfig, d as MatrxDataTableDensity, n as MatrxDataTableDetailConfig, o as MatrxDataTableEditConfig, p as MatrxDataTableEmptyState, q as MatrxDataTableFilterUi, r as MatrxDataTableHierarchyConfig, s as MatrxDataTableHierarchyMove, t as MatrxDataTableMobileCardControls, h as MatrxDataTableProps, u as MatrxDataTableQueryControl, e as MatrxDataTableQueryState, c as MatrxDataTableRecordControls, v as MatrxDataTableSelectionConfig, w as MatrxDataTableSourceProcessing, x as MatrxDataTableToolbar, y as MatrxDataTableUrlStateConfig, z as MatrxDataTableWindowConfig, B as MatrxTablePagination, D as SortDirection, S as SortState, b as TableSavedViewsProps, T as TableSearchMatchMode, E as TableViewQuery, i as TableViewSnapshot, F as TextFilterMode, G as ToolbarFacet } from '../types-Dpl8OW_m.js';
4
4
  export { AgentPayloadInput } from './copy-types.js';
5
5
  import '@ai-matrx/kit/content-transfer';
6
6
  import '../content-transfer/icon.js';
@@ -1,4 +1,4 @@
1
- import { S as SortState, e as MatrxDataTableQueryState } from '../types-DRusLYrU.cjs';
1
+ import { S as SortState, e as MatrxDataTableQueryState } from '../types-DsmrqJHN.cjs';
2
2
  import { UrlHistoryMode } from '@ai-matrx/kit/url-state';
3
3
  import '../content-transfer.cjs';
4
4
  import 'react';
@@ -1,4 +1,4 @@
1
- import { S as SortState, e as MatrxDataTableQueryState } from '../types-CbGNfo7r.js';
1
+ import { S as SortState, e as MatrxDataTableQueryState } from '../types-Dpl8OW_m.js';
2
2
  import { UrlHistoryMode } from '@ai-matrx/kit/url-state';
3
3
  import '../content-transfer.js';
4
4
  import 'react';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/data-table/MatrxUuidCell.tsx","../../src/data-table/icons.tsx","../../src/data-table/useTableNotice.tsx","../../src/data-table/host.tsx","../../src/tooltip.tsx","../../src/cn.ts","../../src/motion.ts","../../src/portal-container.tsx"],"sourcesContent":["\"use client\";\n\n/**\n * MatrxUuidCell — canonical UUID / FK display for dense tables.\n *\n * Port of aidream `UuidDisplay` + AI Models `UuidCell` + tool-call `ShortId`:\n * short prefix (8 chars), full value on hover, always-visible copy of the full\n * id. Optional FK open: in-app WindowPanel (`onOpen`) and/or route (`href`).\n * Forbidden targets stay copyable but are not navigable.\n *\n * THE DOOR LAW: \"never render an id you can't open\". Pass `token` (the canonical\n * entity token this id points at) and the cell resolves its own doors from the\n * registries — route, new tab, and peek — with no per-callsite wiring. Prefer\n * `EntityRef` whenever the record's NAME is available; this is the fallback for\n * a raw FK column where it genuinely isn't.\n */\n\nimport {\n useEffect,\n useRef,\n useState,\n type MouseEvent,\n type ReactNode,\n} from \"react\";\nimport {\n Check,\n Copy,\n ExternalLink,\n Lightbulb,\n PanelRight,\n ShieldOff,\n} from \"./icons\";\nimport { useTableNotice } from \"./useTableNotice\";\nimport { useMatrxDataTableHost } from \"./host\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from \"../tooltip\";\nimport { cn } from \"../cn\";\n\nconst SHORT_LEN = 8;\n\nexport function shortUuid(id: string, len = SHORT_LEN): string {\n return id.slice(0, len);\n}\n\nasync function copyText(text: string): Promise<boolean> {\n try {\n if (navigator.clipboard?.writeText) {\n await navigator.clipboard.writeText(text);\n return true;\n }\n } catch {\n // fall through\n }\n try {\n const ta = document.createElement(\"textarea\");\n ta.value = text;\n ta.style.position = \"fixed\";\n ta.style.opacity = \"0\";\n document.body.appendChild(ta);\n ta.select();\n const ok = document.execCommand(\"copy\");\n document.body.removeChild(ta);\n return ok;\n } catch {\n return false;\n }\n}\n\nexport type MatrxUuidOpenResult = void | \"forbidden\";\n\nexport interface MatrxUuidCellProps {\n value: string | null | undefined;\n /** Tooltip / copy label prefix (e.g. column name). */\n label?: string | undefined;\n /**\n * Open the referenced record in-app (prefer WindowPanel).\n * Return `\"forbidden\"` to block navigation and show a muted state.\n */\n onOpen?: (id: string) => MatrxUuidOpenResult | Promise<MatrxUuidOpenResult>;\n /** Optional real href (new tab / cmd-click). Used when navigation is allowed. */\n href?: string | null | undefined;\n /**\n * Canonical entity token this id points at (`agent`, `note`, `task`, …).\n * Supplies the route and the peek automatically — THE DOOR LAW, resolved\n * from the registries instead of wired per callsite. An explicit `href` /\n * `onOpen` still wins.\n */\n token?: string | null | undefined;\n /** Force non-navigable (still copyable). */\n forbidden?: boolean;\n className?: string;\n trailing?: ReactNode;\n}\n\nexport function MatrxUuidCell({\n value,\n label,\n onOpen,\n href,\n token,\n forbidden = false,\n className,\n trailing,\n}: MatrxUuidCellProps) {\n const { resolveEntityDoors, ResourcePeek } = useMatrxDataTableHost();\n const { notify, notice } = useTableNotice();\n const [copied, setCopied] = useState(false);\n const [opening, setOpening] = useState(false);\n const [peekOpen, setPeekOpen] = useState(false);\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(\n () => () => {\n if (timer.current) clearTimeout(timer.current);\n },\n [],\n );\n\n if (!value) {\n return <span className=\"text-muted-foreground/40\">—</span>;\n }\n\n const doors = token ? resolveEntityDoors?.(token, value, href) ?? null : null;\n const resolvedHref = doors?.href ?? href ?? null;\n const canPeek = Boolean(doors?.canPeek) && !forbidden;\n const display = shortUuid(value);\n const tip = label ? `${label}: ${value}` : value;\n\n const stop = (e: MouseEvent) => {\n e.stopPropagation();\n };\n\n const onCopy = (e: MouseEvent) => {\n stop(e);\n e.preventDefault();\n void copyText(value).then((ok) => {\n if (!ok) {\n notify?.error(\"Couldn't copy ID\");\n return;\n }\n setCopied(true);\n if (timer.current) clearTimeout(timer.current);\n timer.current = setTimeout(() => setCopied(false), 1500);\n });\n };\n\n const handleOpen = async (e: MouseEvent) => {\n stop(e);\n e.preventDefault();\n if (!onOpen || forbidden || opening) return;\n setOpening(true);\n try {\n const result = await onOpen(value);\n if (result === \"forbidden\") {\n // access-errors: ok — relays the onOpen contract's explicit verdict: the caller's opener returns \"forbidden\" only after ITS OWN access check; the cell performs no read and never guesses\n notify?.error(\"You don't have access to open this record\");\n }\n } catch (err) {\n notify?.error(\n `Couldn't open: ${err instanceof Error ? err.message : String(err)}`,\n );\n } finally {\n setOpening(false);\n }\n };\n\n const idNode = (() => {\n if (forbidden) {\n return (\n <span className=\"inline-flex min-w-0 items-center gap-1 font-mono text-xs text-muted-foreground/70 tabular-nums\">\n <span className=\"min-w-0 truncate\">{display}</span>\n <ShieldOff className=\"h-3 w-3 shrink-0 opacity-60\" aria-hidden />\n </span>\n );\n }\n\n if (onOpen) {\n return (\n <button\n type=\"button\"\n aria-label={`Open ${label ?? \"record\"} ${display}`}\n onClick={(e) => void handleOpen(e)}\n disabled={opening}\n className=\"inline-flex min-w-0 items-center gap-1 font-mono text-xs text-sky-600 hover:underline dark:text-sky-400 disabled:opacity-60\"\n >\n <span className=\"min-w-0 truncate tabular-nums\">{display}</span>\n <PanelRight className=\"h-3 w-3 shrink-0 opacity-50\" />\n </button>\n );\n }\n\n if (resolvedHref) {\n return (\n <a\n href={resolvedHref}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n aria-label={`Open ${label ?? \"record\"} ${display} in a new tab`}\n onClick={stop}\n className=\"inline-flex min-w-0 items-center gap-1 font-mono text-xs text-sky-600 hover:underline dark:text-sky-400\"\n >\n <span className=\"min-w-0 truncate tabular-nums\">{display}</span>\n <ExternalLink className=\"h-3 w-3 shrink-0 opacity-50\" />\n </a>\n );\n }\n\n return (\n <span className=\"min-w-0 truncate font-mono text-xs text-muted-foreground tabular-nums select-all\">\n {display}\n </span>\n );\n })();\n\n return (\n <TooltipProvider delayDuration={200}>\n <span\n data-matrx-cell-control\n className={cn(\n \"inline-flex min-w-0 max-w-full items-center gap-0.5 whitespace-nowrap\",\n className,\n )}\n onClick={stop}\n >\n <Tooltip>\n <TooltipTrigger asChild>\n <span className=\"inline-flex min-w-0 max-w-full items-center\">\n {idNode}\n </span>\n </TooltipTrigger>\n <TooltipContent side=\"top\" className=\"max-w-sm break-all font-mono\">\n {forbidden ? `No access · ${tip}` : tip}\n </TooltipContent>\n </Tooltip>\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n onClick={onCopy}\n aria-label={copied ? \"Copied\" : `Copy ${label ?? \"id\"}`}\n className={cn(\n \"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none\",\n copied && \"text-primary\",\n )}\n >\n {copied ? <Check className=\"h-3 w-3\" /> : <Copy className=\"h-3 w-3\" />}\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"top\">{copied ? \"Copied\" : `Copy ${label ?? \"id\"}: ${value}`}</TooltipContent>\n </Tooltip>\n {canPeek ? (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n onClick={(e) => {\n stop(e);\n setPeekOpen(true);\n }}\n aria-label={`Quick look at ${label ?? \"record\"}`}\n className=\"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none\"\n >\n <Lightbulb className=\"h-3 w-3\" />\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"top\">Quick look at {label ?? \"record\"}</TooltipContent>\n </Tooltip>\n ) : null}\n {onOpen && resolvedHref && !forbidden ? (\n <Tooltip>\n <TooltipTrigger asChild>\n <a\n href={resolvedHref}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n onClick={stop}\n aria-label={`Open ${label ?? \"record\"} in a new tab`}\n className=\"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none\"\n >\n <ExternalLink className=\"h-3 w-3\" />\n </a>\n </TooltipTrigger>\n <TooltipContent side=\"top\">Open {label ?? \"record\"} in a new tab</TooltipContent>\n </Tooltip>\n ) : null}\n {trailing}\n {notice}\n {canPeek && peekOpen && ResourcePeek ? (\n <ResourcePeek\n kind={doors?.peekKind ?? token ?? \"record\"}\n id={value}\n onClose={() => setPeekOpen(false)}\n // Same contract as `EntityDoorControls`: forward the CALLER's raw\n // `href` so the peek's \"Open\" cannot send the user somewhere this\n // cell's own link does not go. `doors.ts` names EntityRef and this\n // cell as the two presentations that must not drift — the peek\n // override shipped on one of them first, which is exactly the drift\n // that file warns about.\n {...(href == null ? {} : { href })}\n />\n ) : null}\n </span>\n </TooltipProvider>\n );\n}\n","import type { SVGProps } from \"react\";\n\ntype IconProps = SVGProps<SVGSVGElement>;\nfunction Icon({ children, ...props }: IconProps) {\n return <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\" {...props}>{children}</svg>;\n}\nconst path = <path d=\"M4 12h16M12 4v16\" />;\nexport const ChevronLeft = (p: IconProps) => <Icon {...p}><path d=\"m15 18-6-6 6-6\" /></Icon>;\nexport const ChevronRight = (p: IconProps) => <Icon {...p}><path d=\"m9 18 6-6-6-6\" /></Icon>;\nexport const ChevronDown = (p: IconProps) => <Icon {...p}><path d=\"m6 9 6 6 6-6\" /></Icon>;\nexport const ArrowDown = (p: IconProps) => <Icon {...p}><path d=\"M12 4v16m-6-6 6 6 6-6\" /></Icon>;\nexport const ArrowUp = (p: IconProps) => <Icon {...p}><path d=\"M12 20V4m-6 6 6-6 6 6\" /></Icon>;\nexport const ArrowUpDown = (p: IconProps) => <Icon {...p}><path d=\"M12 4v16m-4-12 4-4 4 4m-8 8 4 4 4-4\" /></Icon>;\nexport const Check = (p: IconProps) => <Icon {...p}><path d=\"m5 12 4 4L19 6\" /></Icon>;\nexport const X = (p: IconProps) => <Icon {...p}><path d=\"M6 6l12 12M18 6 6 18\" /></Icon>;\nexport const Search = (p: IconProps) => <Icon {...p}><circle cx=\"11\" cy=\"11\" r=\"6\" /><path d=\"m16 16 4 4\" /></Icon>;\nexport const Plus = (p: IconProps) => <Icon {...p}>{path}</Icon>;\nexport const Minus = (p: IconProps) => <Icon {...p}><path d=\"M4 12h16\" /></Icon>;\nexport const Eraser = (p: IconProps) => <Icon {...p}><path d=\"m16 3 5 5-11 11H5l-3-3L13 5l3-2Z M8 10l6 6 M10 19h12\" /></Icon>;\nexport const GripVertical = (p: IconProps) => <Icon {...p}><circle cx=\"9\" cy=\"6\" r=\"1\" /><circle cx=\"15\" cy=\"6\" r=\"1\" /><circle cx=\"9\" cy=\"12\" r=\"1\" /><circle cx=\"15\" cy=\"12\" r=\"1\" /><circle cx=\"9\" cy=\"18\" r=\"1\" /><circle cx=\"15\" cy=\"18\" r=\"1\" /></Icon>;\n/** lucide `sliders-horizontal` — used for the table column manager. */\nexport const SlidersHorizontal = (p: IconProps) => <Icon {...p}>\n <path d=\"M21 4h-7M10 4H3M21 12h-9M8 12H3M21 20h-5M12 20H3M14 2v4M8 10v4M16 18v4\" />\n</Icon>;\nexport const Trash2 = (p: IconProps) => <Icon {...p}><path d=\"M4 7h16M10 11v6M14 11v6M9 7l1-2h4l1 2M6 7l1 13h10l1-13\" /></Icon>;\n/**\n * Spinner-only incomplete arc. Never a resting glyph — at rest this reads as a\n * broken half-circle. Pair it with `animate-spin` / `matrx-spin` only while\n * work is actually running. Refresh controls use `RefreshControlIcon`.\n */\nexport const Loader2 = (p: IconProps) => <Icon {...p}><path d=\"M20 12a8 8 0 1 1-2.3-5.7\" /></Icon>;\n/** lucide `refresh-cw` — the resting refresh arrows. */\nexport const RefreshCw = (p: IconProps) => (\n <Icon {...p}>\n <path d=\"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8\" />\n <path d=\"M21 3v5h-5\" />\n <path d=\"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16\" />\n <path d=\"M8 16H3v5\" />\n </Icon>\n);\n/** Refresh affordance: arrows at rest, spinner only while busy. */\nexport function RefreshControlIcon({\n spinning = false,\n className,\n ...props\n}: IconProps & { spinning?: boolean }) {\n if (spinning) {\n return (\n <Loader2\n className={[className, \"animate-spin\"].filter(Boolean).join(\" \")}\n {...props}\n />\n );\n }\n return <RefreshCw className={className} {...props} />;\n}\nexport const Save = (p: IconProps) => <Icon {...p}><path d=\"M5 3h12l2 2v16H5zM8 3v6h8V3M8 21v-7h8v7\" /></Icon>;\nexport const Pencil = (p: IconProps) => <Icon {...p}><path d=\"m4 20 4-1 11-11-3-3L5 16l-1 4z\" /></Icon>;\nexport const Eye = (p: IconProps) => <Icon {...p}><path d=\"M2 12s3-6 10-6 10 6 10 6-3 6-10 6S2 12 2 12z\" /><circle cx=\"12\" cy=\"12\" r=\"2\" /></Icon>;\nexport const PanelRight = (p: IconProps) => <Icon {...p}><rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\" /><path d=\"M15 4v16\" /></Icon>;\nexport const PanelRightOpen = PanelRight;\nexport const WholeWord = (p: IconProps) => <Icon {...p}><path d=\"M4 6l3 12 3-8 3 8 3-12M17 15h4\" /></Icon>;\nexport const ExternalLink = (p: IconProps) => <Icon {...p}><path d=\"M14 4h6v6M20 4l-9 9M19 13v6H5V5h6\" /></Icon>;\nexport const Copy = (p: IconProps) => <Icon {...p}><rect x=\"9\" y=\"9\" width=\"11\" height=\"11\" rx=\"2\" /><path d=\"M15 9V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h3\" /></Icon>;\nexport const Lightbulb = (p: IconProps) => <Icon {...p}><path d=\"M9 18h6M10 22h4M8 14a6 6 0 1 1 8 0c-1 1-1 2-1 3H9c0-1 0-2-1-3z\" /></Icon>;\nexport const ShieldOff = (p: IconProps) => <Icon {...p}><path d=\"m3 3 18 18M12 3l7 3v5c0 4-3 7-7 9-4-2-7-5-7-9V6l4-2\" /></Icon>;\nexport const ListFilter = SlidersHorizontal;\nexport const ListX = X;\n\nexport const ChevronsLeft = (p: IconProps) => <Icon {...p}><path d=\"m11 18-6-6 6-6m8 12-6-6 6-6\" /></Icon>;\nexport const ChevronsRight = (p: IconProps) => <Icon {...p}><path d=\"m5 18 6-6-6-6m8 12 6-6-6-6\" /></Icon>;\n","\"use client\";\nimport { useState } from \"react\";\nimport { useMatrxDataTableHost } from \"./host\";\n\n/** Every portable async action has visible feedback even without a host toast system. */\nexport function useTableNotice() {\n const host = useMatrxDataTableHost();\n const [message, setMessage] = useState<{ text: string; error: boolean } | null>(null);\n const notify = {\n success(text: string) { if (host.notify) host.notify.success(text); else setMessage({ text, error: false }); },\n error(text: string) { if (host.notify) host.notify.error(text); else setMessage({ text, error: true }); },\n };\n const notice = message ? <span role={message.error ? \"alert\" : \"status\"} className={message.error ? \"text-xs text-destructive\" : \"text-xs text-muted-foreground\"}>{message.text}<button type=\"button\" aria-label=\"Dismiss notification\" className=\"ml-2 underline\" onClick={() => setMessage(null)}>Dismiss</button></span> : null;\n return { notify, notice };\n}\n","\"use client\";\nimport { createContext, useContext, type Context, type ComponentType, type ReactNode, type MouseEventHandler } from \"react\";\nimport type { CopyControlProps } from \"./copy-types\";\nimport type { MatrxDataTableDensity, MatrxDataTableRecordControls, TableSavedViewsProps } from \"./types\";\n\nexport type {\n AgentPayloadInput,\n AiCustomSource,\n AiVariant,\n CopyControlProps,\n CopyExportConfig,\n} from \"./copy-types\";\n\nexport interface TableLinkProps { href: string; children: ReactNode; className?: string; onClick?: MouseEventHandler<HTMLAnchorElement>; }\n/**\n * Host-owned toolbar affordance. The table package keeps operation state and\n * labels; an application can supply its canonical icon-button primitive\n * without making the shared package depend on an application UI package.\n */\nexport interface TableToolbarActionProps { ariaLabel: string; tooltip?: string | undefined; disabled?: boolean | undefined; busy?: boolean | undefined; /** Indicates a selected mutually-exclusive action such as the current page. */ active?: boolean | undefined; onClick: () => void; children: ReactNode; }\nexport interface TableSidePanelProps { title: string; titleNode?: ReactNode; description?: ReactNode; onClose: () => void; defaultWidth?: number; headerActions?: ReactNode; children: ReactNode; }\nexport interface TableWindowPanelProps { id: string; title: string; onClose: () => void; width?: number; height?: number; minWidth?: number; minHeight?: number; actionsRight?: ReactNode; bodyClassName?: string; sidebarDefaultSize?: number; sidebarMinSize?: number; sidebar?: ReactNode; children: ReactNode; }\nexport interface TableEntityRefProps { token: string; id: string; href?: string; children: ReactNode; className?: string; }\nexport interface TablePeekProps { kind: string; id: string; href?: string; onClose: () => void; }\nexport interface TableDoors { href?: string; peekKind?: string; canPeek?: boolean; }\nexport interface TableRowContextRegistry { register(tableId: string, resolve: (rowId: string) => unknown): () => void; }\nexport interface TableContextMenuBoundaryProps { label: string; children: ReactNode; }\nexport interface MatrxDataTableHost { JsonViewer?: ComponentType<{ data: object | string }>; Link?: ComponentType<TableLinkProps>; CopyControls?: ComponentType<CopyControlProps>; ToolbarAction?: ComponentType<TableToolbarActionProps>; SidePanelSurface?: ComponentType<TableSidePanelProps>; WindowPanel?: ComponentType<TableWindowPanelProps>; EntityRef?: ComponentType<TableEntityRefProps>; resolveEntityDoors?: (token: string, id: string, href?: string | null) => TableDoors | null; ResourcePeek?: ComponentType<TablePeekProps>; SavedViews?: ComponentType<TableSavedViewsProps>; rowContextRegistry?: TableRowContextRegistry; createDefaultRowContext?: (row: unknown, controls: import(\"./types\").MatrxDataTableRecordControls) => unknown; ContextMenuBoundary?: ComponentType<TableContextMenuBoundaryProps>; /** Host default; a table's explicit density takes precedence. */ defaultDensity?: MatrxDataTableDensity; notify?: { success(message: string): void; error(message: string): void }; }\n// Public entrypoints are independently bundled in ESM and CJS. The context\n// identity must survive those bundle boundaries; values stay provider-scoped.\nconst HOST_SLOT = Symbol.for(\"ai-matrx.design-system.table-host-context\");\nconst hostRegistry = globalThis as typeof globalThis & { [HOST_SLOT]?: Context<MatrxDataTableHost> };\nconst HostContext = hostRegistry[HOST_SLOT] ??= createContext<MatrxDataTableHost>({});\nexport function MatrxDataTableProvider({ value, children }: { value: MatrxDataTableHost; children: ReactNode }) { return <HostContext.Provider value={value}>{children}</HostContext.Provider>; }\nexport function useMatrxDataTableHost(): MatrxDataTableHost { return useContext(HostContext); }\n\nexport interface MatrxTableRowAlchemy {\n copy: CopyControlProps;\n controls?: MatrxDataTableRecordControls;\n placement: \"inline\" | \"menu\";\n ready: boolean;\n activate(): void;\n prepare(restoreFocus?: () => void): Promise<void>;\n}\n\nconst ROW_ALCHEMY_SLOT = Symbol.for(\"ai-matrx.design-system.table-row-alchemy-context\");\nconst rowAlchemyRegistry = globalThis as typeof globalThis & { [ROW_ALCHEMY_SLOT]?: Context<MatrxTableRowAlchemy | null> };\nconst RowAlchemyContext = rowAlchemyRegistry[ROW_ALCHEMY_SLOT] ??= createContext<MatrxTableRowAlchemy | null>(null);\n\nexport function MatrxTableRowAlchemyScope({ value, children }: { value: MatrxTableRowAlchemy; children: ReactNode }) { return <RowAlchemyContext.Provider value={value}>{children}</RowAlchemyContext.Provider>; }\n\nexport function useMatrxTableRowAlchemy(): MatrxTableRowAlchemy | null { return useContext(RowAlchemyContext); }\n\nconst ROW_CONTROLS_SLOT = Symbol.for(\"ai-matrx.design-system.table-row-controls-context\");\nconst rowControlsRegistry = globalThis as typeof globalThis & { [ROW_CONTROLS_SLOT]?: Context<MatrxDataTableRecordControls | null> };\nconst RowControlsContext = rowControlsRegistry[ROW_CONTROLS_SLOT] ??= createContext<MatrxDataTableRecordControls | null>(null);\nexport function MatrxTableRowControlsScope({ value, children }: { value: MatrxDataTableRecordControls; children: ReactNode }) { return <RowControlsContext.Provider value={value}>{children}</RowControlsContext.Provider>; }\nexport function useMatrxTableRowControls(): MatrxDataTableRecordControls | null { return useContext(RowControlsContext); }\n","\"use client\";\n\n/**\n * Tooltip — the ONE tooltip in the fleet.\n *\n * THE COLLAPSE (0.6.0). Two implementations existed: matrx-frontend's\n * `components/ui/tooltip.tsx` (182 import sites) and `@ai-matrx/tap-target`'s\n * `src/tooltip.tsx` — the latter an explicit inlined PORT of the former,\n * carrying a header that said so. tap-target shipped it only because its ~60\n * tap buttons need a tooltip and no shared package owned one; four repos then\n * adopted `TooltipProvider` from tap-target. That made tap-target — a\n * button-geometry package — the accidental owner of a design-system primitive,\n * with a second copy living in the biggest host.\n *\n * A tooltip is a design-system surface, so it lives here. tap-target now takes\n * `@ai-matrx/design-system` as an ordinary sibling dependency and imports this\n * file; its own copy is deleted, and its re-export removed. The DAG already\n * ordered design-system before tap-target, so no cycle is introduced.\n *\n * BEHAVIOUR is matrx-frontend's, verbatim, including the ruling both copies\n * carried in prose:\n *\n * 1. THE ROOT RENDERS UNCONDITIONALLY — no hydration mount gate. The gate the\n * host wrapper once carried (\"Radix generates dynamic aria-controls ids that\n * differ between SSR and client\") was false: Radix ids come from React's\n * SSR-stable `useId`. It was actively harmful — a Trigger wraps\n * ALWAYS-VISIBLE content, so `return null` deleted that subtree from SSR and\n * the first client paint.\n *\n * 2. THE SURFACE IS NEUTRAL, NOT BRANDED. Popover tokens, not `bg-primary`:\n * rich tooltip content using `text-muted-foreground` was illegible on a\n * brand-coloured background in one theme or the other.\n *\n * SEAM INVERSION. The host resolved nested portal targets through\n * `useNestedPortalContainer` (an app hook wired to its dialog + window-panel\n * systems); tap-target's port dropped that seam entirely and always portalled\n * to `document.body` — which is why a tooltip inside a popped-out panel landed\n * in the wrong window. Here it is the package's `PortalContainerProvider`\n * seam: an explicit `container` prop wins, then the injected container, then\n * `document.body`. Both prior behaviours are reachable; neither is forked.\n */\n\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { MOTION_POPPER } from \"./motion\";\nimport { usePortalContainer } from \"./portal-container\";\n\n/**\n * Mount once near the app root. Every tooltip in the tree shares its\n * `delayDuration` / `skipDelayDuration` timing.\n */\nconst TooltipProvider = TooltipPrimitive.Provider;\n\nconst Tooltip = TooltipPrimitive.Root;\n\nconst TooltipTrigger = TooltipPrimitive.Trigger;\n\nexport interface TooltipContentProps\n extends React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> {\n /**\n * Explicit portal target; wins over the injected `PortalContainerProvider`\n * value. Pass `null` to force `document.body`.\n */\n container?: HTMLElement | null;\n /**\n * Package-owned open/close motion. Default `true`. Pass `false` for a\n * surface that must appear instantly. It is NOT the reduced-motion switch;\n * `styles.css` already honours `prefers-reduced-motion`.\n */\n animated?: boolean;\n}\n\nconst TooltipContent = React.forwardRef<\n React.ComponentRef<typeof TooltipPrimitive.Content>,\n TooltipContentProps\n>(({ className, sideOffset = 4, container, animated = true, ...props }, ref) => {\n const resolved = usePortalContainer(container);\n return (\n <TooltipPrimitive.Portal container={resolved ?? null}>\n <TooltipPrimitive.Content\n ref={ref}\n data-slot=\"tooltip-content\"\n sideOffset={sideOffset}\n className={cn(\n \"z-[10001] overflow-hidden rounded-md border border-border bg-popover px-3 py-1.5 text-xs text-popover-foreground shadow-md\",\n animated && MOTION_POPPER,\n className,\n )}\n {...props}\n />\n </TooltipPrimitive.Portal>\n );\n});\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","/**\n * THE MOTION CONTRACT (0.10.0) — the class names every animated surface in\n * this package puts on the DOM, in ONE place.\n *\n * Why a module and not ten inline strings: the sweep that produced this file\n * found the same defect ten times over, and it was invisible each time\n * because each primitive spelled its animation out by hand. Ten hand-written\n * copies of `data-[state=open]:animate-in data-[state=closed]:animate-out\n * data-[state=closed]:fade-out-0 …` meant ten chances to reach for a utility\n * nothing in the package defines — which is exactly what happened. A single\n * exported constant per motion SHAPE means the next primitive cannot invent\n * an eleventh spelling, and `styles.test.ts` can prove every one of them\n * resolves to a rule in the shipped stylesheet.\n *\n * Every rule these name lives in `styles.css` under the package's own\n * keyframes. NONE of them is a Tailwind utility, and none requires a host\n * plugin — see that file's header for the measurement that made this\n * necessary.\n */\n\n/** Modal scrims: Dialog, AlertDialog, Sheet, CommandDialog. Fade only. */\nexport const MOTION_OVERLAY = \"matrx-motion-overlay\";\n\n/** The centred dialog card. Fades and scales; centring is not its business. */\nexport const MOTION_DIALOG = \"matrx-motion-dialog\";\n\n/**\n * THE CENTRING OF A CENTRED DIALOG CARD — package-owned, in the `translate`\n * property, and NEVER a Tailwind `translate-x-[-50%] translate-y-[-50%]` pair.\n *\n * Those utilities do not compile to the same thing in every host: Tailwind v3\n * writes them into `transform`, Tailwind v4 writes them into the independent\n * `translate` property, which COMPOSES with `transform` instead of being\n * replaced by it. 0.10.0's keyframes restated the centring inside `transform`,\n * which was harmless on v3 and doubled the centring on v4 — the card flew in\n * from off the top-left of the viewport for the animation's whole duration and\n * snapped into place at the end (fixed in 0.10.1).\n *\n * Owning it here means one spelling that reads the same on both, and it frees\n * `transform` so the keyframes carry ONLY the delta. Put this on every centred\n * surface UNCONDITIONALLY — it is geometry, so unlike {@link MOTION_DIALOG} it\n * must survive `animated={false}`. Its rule ships in `styles.css`.\n */\nexport const CENTERED_DIALOG = \"matrx-dialog-centered\";\n\n/**\n * The resting gap between a `popper`-positioned surface and its trigger, for\n * the primitives that want one (today: `Select`). Same law and same reason as\n * {@link CENTERED_DIALOG} — a position an animated surface holds AT REST is\n * the `translate` property's job, never a Tailwind translate utility, because\n * those land in `transform` on a v3 host and in `translate` on a v4 one while\n * the keyframes animate `transform` either way. Sizes from\n * `--matrx-popper-offset`; keys off Radix's `data-side`.\n */\nexport const POPPER_OFFSET = \"matrx-popper-offset\";\n\n/** The mobile Dialog / CommandDialog bottom sheet. Slides up and fades. */\nexport const MOTION_BOTTOM_SHEET = \"matrx-motion-bottom-sheet\";\n\n/**\n * Radix-popper surfaces: Popover, DropdownMenu, ContextMenu, HoverCard,\n * Select, Tooltip. Reads `--radix-popper-transform-origin` so the surface\n * grows out of its trigger, and `data-side` so it travels from it.\n */\nexport const MOTION_POPPER = \"matrx-motion-popper\";\n\n/** Edge sheets, one class per `sheetVariants` side. */\nexport const MOTION_SHEET = {\n top: \"matrx-motion-sheet-top\",\n bottom: \"matrx-motion-sheet-bottom\",\n left: \"matrx-motion-sheet-left\",\n right: \"matrx-motion-sheet-right\",\n center: \"matrx-motion-sheet-center\",\n} as const;\n\n/** Skeleton's breathing loop. */\nexport const MOTION_PULSE = \"matrx-pulse\";\n\n/** The spinner loop, for every inline busy indicator in the package. */\nexport const MOTION_SPIN = \"matrx-spin\";\n\n/**\n * Every motion class the package ships, for the guards. If a rule for one of\n * these is missing from `styles.css`, a component animates in no consumer and\n * says nothing about it — the C26 failure this list exists to make loud.\n */\nexport const ALL_MOTION_CLASSES = [\n MOTION_OVERLAY,\n MOTION_DIALOG,\n MOTION_BOTTOM_SHEET,\n MOTION_POPPER,\n ...Object.values(MOTION_SHEET),\n MOTION_PULSE,\n MOTION_SPIN,\n] as const;\n\n/**\n * The host-plugin utilities this package is forbidden to emit. They are\n * supplied by `tailwindcss-animate` / `tw-animate-css`, which is a HOST CSS\n * entry concern a package cannot declare a dependency on: three of the four\n * AI Matrx consumers never loaded it, so every surface wearing these appeared\n * with no animation and no error. `styles.test.ts` fails the build if one\n * comes back.\n */\nexport const FORBIDDEN_HOST_MOTION_UTILITIES = [\n \"animate-in\",\n \"animate-out\",\n \"fade-in\",\n \"fade-out\",\n \"zoom-in\",\n \"zoom-out\",\n \"slide-in-from\",\n \"slide-out-to\",\n \"animate-accordion\",\n \"animate-slide-down\",\n \"animate-slide-up\",\n \"animate-pulse\",\n \"animate-spin\",\n] as const;\n","\"use client\";\n\n/**\n * Injected portal-container seam.\n *\n * The matrx-frontend original resolved nested portal targets through\n * `useNestedPortalContainer` (explicit prop > dialog content > popout body >\n * document.body) — a host-shaped hook wired to that app's dialog and\n * window-panel systems. The package inverts the seam: hosts provide the\n * resolved container through `PortalContainerProvider`; an explicit\n * `container` prop on a component still wins, and with neither the portal\n * falls through to `document.body` (Radix default). Priority semantics are\n * unchanged from the original.\n */\n\nimport * as React from \"react\";\n\n// Shared identity across independently bundled public entrypoints/loaders.\nconst CONTEXT_SLOT = Symbol.for(\"ai-matrx.design-system.portal-container-context\");\nconst contextRegistry = globalThis as typeof globalThis & { [CONTEXT_SLOT]?: React.Context<HTMLElement | null | undefined> };\nconst PortalContainerContext = contextRegistry[CONTEXT_SLOT] ??= React.createContext<HTMLElement | null | undefined>(undefined);\n\nexport interface PortalContainerProviderProps {\n /** Where nested Radix portals (Popover, etc.) should mount. `null`/`undefined` → document.body. */\n container: HTMLElement | null | undefined;\n children: React.ReactNode;\n}\n\nexport function PortalContainerProvider({\n container,\n children,\n}: PortalContainerProviderProps) {\n return (\n <PortalContainerContext.Provider value={container ?? undefined}>\n {children}\n </PortalContainerContext.Provider>\n );\n}\n\n/**\n * Resolve a portal target: explicit prop (including an explicit `null`,\n * meaning \"the default body\") beats the injected container.\n */\nexport function usePortalContainer(\n explicit?: HTMLElement | null,\n): HTMLElement | undefined {\n const injected = React.useContext(PortalContainerContext);\n\n if (explicit !== undefined) {\n return explicit ?? undefined;\n }\n\n return injected ?? undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBA,IAAAA,gBAMO;;;ACnBE;AADT,SAAS,KAAK,EAAE,UAAU,GAAG,MAAM,GAAc;AAC/C,SAAO,4CAAC,SAAI,SAAQ,aAAY,MAAK,QAAO,QAAO,gBAAe,aAAY,KAAI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,uDAAC,aAAU,WAAU,WAAU;AAAA;AAAA,UACjC,GACF;AAAA,UACA,8CAAC,kBAAe,MAAK,OAAM;AAAA;AAAA,YAAe,SAAS;AAAA,aAAS;AAAA,WAC9D,IACE;AAAA,QACH,UAAU,gBAAgB,CAAC,YAC1B,8CAAC,WACC;AAAA,uDAAC,kBAAe,SAAO,MACrB;AAAA,YAAC;AAAA;AAAA,cACC,MAAM;AAAA,cACN,QAAO;AAAA,cACP,KAAI;AAAA,cACJ,SAAS;AAAA,cACT,cAAY,QAAQ,SAAS,QAAQ;AAAA,cACrC,WAAU;AAAA,cAEV,uDAAC,gBAAa,WAAU,WAAU;AAAA;AAAA,UACpC,GACF;AAAA,UACA,8CAAC,kBAAe,MAAK,OAAM;AAAA;AAAA,YAAM,SAAS;AAAA,YAAS;AAAA,aAAa;AAAA,WAClE,IACE;AAAA,QACH;AAAA,QACA;AAAA,QACA,WAAW,YAAY,eACtB;AAAA,UAAC;AAAA;AAAA,YACC,MAAM,OAAO,YAAY,SAAS;AAAA,YAClC,IAAI;AAAA,YACJ,SAAS,MAAM,YAAY,KAAK;AAAA,YAO/B,GAAI,QAAQ,OAAO,CAAC,IAAI,EAAE,KAAK;AAAA;AAAA,QAClC,IACE;AAAA;AAAA;AAAA,EACN,GACF;AAEJ;","names":["import_react","import_react","import_jsx_runtime","import_jsx_runtime","React","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime"]}
1
+ {"version":3,"sources":["../../src/data-table/MatrxUuidCell.tsx","../../src/data-table/icons.tsx","../../src/data-table/useTableNotice.tsx","../../src/data-table/host.tsx","../../src/tooltip.tsx","../../src/cn.ts","../../src/motion.ts","../../src/portal-container.tsx"],"sourcesContent":["\"use client\";\n\n/**\n * MatrxUuidCell — canonical UUID / FK display for dense tables.\n *\n * Port of aidream `UuidDisplay` + AI Models `UuidCell` + tool-call `ShortId`:\n * short prefix (8 chars), full value on hover, always-visible copy of the full\n * id. Optional FK open: in-app WindowPanel (`onOpen`) and/or route (`href`).\n * Forbidden targets stay copyable but are not navigable.\n *\n * THE DOOR LAW: \"never render an id you can't open\". Pass `token` (the canonical\n * entity token this id points at) and the cell resolves its own doors from the\n * registries — route, new tab, and peek — with no per-callsite wiring. Prefer\n * `EntityRef` whenever the record's NAME is available; this is the fallback for\n * a raw FK column where it genuinely isn't.\n */\n\nimport {\n useEffect,\n useRef,\n useState,\n type MouseEvent,\n type ReactNode,\n} from \"react\";\nimport {\n Check,\n Copy,\n ExternalLink,\n Lightbulb,\n PanelRight,\n ShieldOff,\n} from \"./icons\";\nimport { useTableNotice } from \"./useTableNotice\";\nimport { useMatrxDataTableHost } from \"./host\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipProvider,\n TooltipTrigger,\n} from \"../tooltip\";\nimport { cn } from \"../cn\";\n\nconst SHORT_LEN = 8;\n\nexport function shortUuid(id: string, len = SHORT_LEN): string {\n return id.slice(0, len);\n}\n\nasync function copyText(text: string): Promise<boolean> {\n try {\n if (navigator.clipboard?.writeText) {\n await navigator.clipboard.writeText(text);\n return true;\n }\n } catch {\n // fall through\n }\n try {\n const ta = document.createElement(\"textarea\");\n ta.value = text;\n ta.style.position = \"fixed\";\n ta.style.opacity = \"0\";\n document.body.appendChild(ta);\n ta.select();\n const ok = document.execCommand(\"copy\");\n document.body.removeChild(ta);\n return ok;\n } catch {\n return false;\n }\n}\n\nexport type MatrxUuidOpenResult = void | \"forbidden\";\n\nexport interface MatrxUuidCellProps {\n value: string | null | undefined;\n /** Tooltip / copy label prefix (e.g. column name). */\n label?: string | undefined;\n /**\n * Open the referenced record in-app (prefer WindowPanel).\n * Return `\"forbidden\"` to block navigation and show a muted state.\n */\n onOpen?: (id: string) => MatrxUuidOpenResult | Promise<MatrxUuidOpenResult>;\n /** Optional real href (new tab / cmd-click). Used when navigation is allowed. */\n href?: string | null | undefined;\n /**\n * Canonical entity token this id points at (`agent`, `note`, `task`, …).\n * Supplies the route and the peek automatically — THE DOOR LAW, resolved\n * from the registries instead of wired per callsite. An explicit `href` /\n * `onOpen` still wins.\n */\n token?: string | null | undefined;\n /** Force non-navigable (still copyable). */\n forbidden?: boolean;\n className?: string;\n trailing?: ReactNode;\n}\n\nexport function MatrxUuidCell({\n value,\n label,\n onOpen,\n href,\n token,\n forbidden = false,\n className,\n trailing,\n}: MatrxUuidCellProps) {\n const { resolveEntityDoors, ResourcePeek } = useMatrxDataTableHost();\n const { notify, notice } = useTableNotice();\n const [copied, setCopied] = useState(false);\n const [opening, setOpening] = useState(false);\n const [peekOpen, setPeekOpen] = useState(false);\n const timer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(\n () => () => {\n if (timer.current) clearTimeout(timer.current);\n },\n [],\n );\n\n if (!value) {\n return <span className=\"text-muted-foreground/40\">—</span>;\n }\n\n const doors = token ? resolveEntityDoors?.(token, value, href) ?? null : null;\n const resolvedHref = doors?.href ?? href ?? null;\n const canPeek = Boolean(doors?.canPeek) && !forbidden;\n const display = shortUuid(value);\n const tip = label ? `${label}: ${value}` : value;\n\n const stop = (e: MouseEvent) => {\n e.stopPropagation();\n };\n\n const onCopy = (e: MouseEvent) => {\n stop(e);\n e.preventDefault();\n void copyText(value).then((ok) => {\n if (!ok) {\n notify?.error(\"Couldn't copy ID\");\n return;\n }\n setCopied(true);\n if (timer.current) clearTimeout(timer.current);\n timer.current = setTimeout(() => setCopied(false), 1500);\n });\n };\n\n const handleOpen = async (e: MouseEvent) => {\n stop(e);\n e.preventDefault();\n if (!onOpen || forbidden || opening) return;\n setOpening(true);\n try {\n const result = await onOpen(value);\n if (result === \"forbidden\") {\n // access-errors: ok — relays the onOpen contract's explicit verdict: the caller's opener returns \"forbidden\" only after ITS OWN access check; the cell performs no read and never guesses\n notify?.error(\"You don't have access to open this record\");\n }\n } catch (err) {\n notify?.error(\n `Couldn't open: ${err instanceof Error ? err.message : String(err)}`,\n );\n } finally {\n setOpening(false);\n }\n };\n\n const idNode = (() => {\n if (forbidden) {\n return (\n <span className=\"inline-flex min-w-0 items-center gap-1 font-mono text-xs text-muted-foreground/70 tabular-nums\">\n <span className=\"min-w-0 truncate\">{display}</span>\n <ShieldOff className=\"h-3 w-3 shrink-0 opacity-60\" aria-hidden />\n </span>\n );\n }\n\n if (onOpen) {\n return (\n <button\n type=\"button\"\n aria-label={`Open ${label ?? \"record\"} ${display}`}\n onClick={(e) => void handleOpen(e)}\n disabled={opening}\n className=\"inline-flex min-w-0 items-center gap-1 font-mono text-xs text-sky-600 hover:underline dark:text-sky-400 disabled:opacity-60\"\n >\n <span className=\"min-w-0 truncate tabular-nums\">{display}</span>\n <PanelRight className=\"h-3 w-3 shrink-0 opacity-50\" />\n </button>\n );\n }\n\n if (resolvedHref) {\n return (\n <a\n href={resolvedHref}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n aria-label={`Open ${label ?? \"record\"} ${display} in a new tab`}\n onClick={stop}\n className=\"inline-flex min-w-0 items-center gap-1 font-mono text-xs text-sky-600 hover:underline dark:text-sky-400\"\n >\n <span className=\"min-w-0 truncate tabular-nums\">{display}</span>\n <ExternalLink className=\"h-3 w-3 shrink-0 opacity-50\" />\n </a>\n );\n }\n\n return (\n <span className=\"min-w-0 truncate font-mono text-xs text-muted-foreground tabular-nums select-all\">\n {display}\n </span>\n );\n })();\n\n return (\n <TooltipProvider delayDuration={200}>\n <span\n data-matrx-cell-control\n className={cn(\n \"inline-flex min-w-0 max-w-full items-center gap-0.5 whitespace-nowrap\",\n className,\n )}\n onClick={stop}\n >\n <Tooltip>\n <TooltipTrigger asChild>\n <span className=\"inline-flex min-w-0 max-w-full items-center\">\n {idNode}\n </span>\n </TooltipTrigger>\n <TooltipContent side=\"top\" className=\"max-w-sm break-all font-mono\">\n {forbidden ? `No access · ${tip}` : tip}\n </TooltipContent>\n </Tooltip>\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n onClick={onCopy}\n aria-label={copied ? \"Copied\" : `Copy ${label ?? \"id\"}`}\n className={cn(\n \"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none\",\n copied && \"text-primary\",\n )}\n >\n {copied ? <Check className=\"h-3 w-3\" /> : <Copy className=\"h-3 w-3\" />}\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"top\">{copied ? \"Copied\" : `Copy ${label ?? \"id\"}: ${value}`}</TooltipContent>\n </Tooltip>\n {canPeek ? (\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n onClick={(e) => {\n stop(e);\n setPeekOpen(true);\n }}\n aria-label={`Quick look at ${label ?? \"record\"}`}\n className=\"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none\"\n >\n <Lightbulb className=\"h-3 w-3\" />\n </button>\n </TooltipTrigger>\n <TooltipContent side=\"top\">Quick look at {label ?? \"record\"}</TooltipContent>\n </Tooltip>\n ) : null}\n {onOpen && resolvedHref && !forbidden ? (\n <Tooltip>\n <TooltipTrigger asChild>\n <a\n href={resolvedHref}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n onClick={stop}\n aria-label={`Open ${label ?? \"record\"} in a new tab`}\n className=\"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:text-foreground focus:outline-none\"\n >\n <ExternalLink className=\"h-3 w-3\" />\n </a>\n </TooltipTrigger>\n <TooltipContent side=\"top\">Open {label ?? \"record\"} in a new tab</TooltipContent>\n </Tooltip>\n ) : null}\n {trailing}\n {notice}\n {canPeek && peekOpen && ResourcePeek ? (\n <ResourcePeek\n kind={doors?.peekKind ?? token ?? \"record\"}\n id={value}\n onClose={() => setPeekOpen(false)}\n // Same contract as `EntityDoorControls`: forward the CALLER's raw\n // `href` so the peek's \"Open\" cannot send the user somewhere this\n // cell's own link does not go. `doors.ts` names EntityRef and this\n // cell as the two presentations that must not drift — the peek\n // override shipped on one of them first, which is exactly the drift\n // that file warns about.\n {...(href == null ? {} : { href })}\n />\n ) : null}\n </span>\n </TooltipProvider>\n );\n}\n","import type { SVGProps } from \"react\";\n\ntype IconProps = SVGProps<SVGSVGElement>;\nfunction Icon({ children, ...props }: IconProps) {\n return <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\" {...props}>{children}</svg>;\n}\nconst path = <path d=\"M4 12h16M12 4v16\" />;\nexport const ChevronLeft = (p: IconProps) => <Icon {...p}><path d=\"m15 18-6-6 6-6\" /></Icon>;\nexport const ChevronRight = (p: IconProps) => <Icon {...p}><path d=\"m9 18 6-6-6-6\" /></Icon>;\nexport const ChevronDown = (p: IconProps) => <Icon {...p}><path d=\"m6 9 6 6 6-6\" /></Icon>;\nexport const ArrowDown = (p: IconProps) => <Icon {...p}><path d=\"M12 4v16m-6-6 6 6 6-6\" /></Icon>;\nexport const ArrowUp = (p: IconProps) => <Icon {...p}><path d=\"M12 20V4m-6 6 6-6 6 6\" /></Icon>;\nexport const ArrowUpDown = (p: IconProps) => <Icon {...p}><path d=\"M12 4v16m-4-12 4-4 4 4m-8 8 4 4 4-4\" /></Icon>;\nexport const Check = (p: IconProps) => <Icon {...p}><path d=\"m5 12 4 4L19 6\" /></Icon>;\nexport const X = (p: IconProps) => <Icon {...p}><path d=\"M6 6l12 12M18 6 6 18\" /></Icon>;\nexport const Search = (p: IconProps) => <Icon {...p}><circle cx=\"11\" cy=\"11\" r=\"6\" /><path d=\"m16 16 4 4\" /></Icon>;\nexport const Plus = (p: IconProps) => <Icon {...p}>{path}</Icon>;\nexport const Minus = (p: IconProps) => <Icon {...p}><path d=\"M4 12h16\" /></Icon>;\n/** lucide `star` — compact saved-item marker. */\nexport const Star = (p: IconProps) => <Icon {...p}><path d=\"m12 2 3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z\" /></Icon>;\n/** lucide `pin` — compact saved-item marker. */\nexport const Pin = (p: IconProps) => <Icon {...p}><path d=\"M12 17v5M9 3h6l1 7 3 3v2H5v-2l3-3 1-7z\" /></Icon>;\nexport const Eraser = (p: IconProps) => <Icon {...p}><path d=\"m16 3 5 5-11 11H5l-3-3L13 5l3-2Z M8 10l6 6 M10 19h12\" /></Icon>;\nexport const GripVertical = (p: IconProps) => <Icon {...p}><circle cx=\"9\" cy=\"6\" r=\"1\" /><circle cx=\"15\" cy=\"6\" r=\"1\" /><circle cx=\"9\" cy=\"12\" r=\"1\" /><circle cx=\"15\" cy=\"12\" r=\"1\" /><circle cx=\"9\" cy=\"18\" r=\"1\" /><circle cx=\"15\" cy=\"18\" r=\"1\" /></Icon>;\n/** lucide `sliders-horizontal` — used for the table column manager. */\nexport const SlidersHorizontal = (p: IconProps) => <Icon {...p}>\n <path d=\"M21 4h-7M10 4H3M21 12h-9M8 12H3M21 20h-5M12 20H3M14 2v4M8 10v4M16 18v4\" />\n</Icon>;\nexport const Trash2 = (p: IconProps) => <Icon {...p}><path d=\"M4 7h16M10 11v6M14 11v6M9 7l1-2h4l1 2M6 7l1 13h10l1-13\" /></Icon>;\n/**\n * Spinner-only incomplete arc. Never a resting glyph — at rest this reads as a\n * broken half-circle. Pair it with `animate-spin` / `matrx-spin` only while\n * work is actually running. Refresh controls use `RefreshControlIcon`.\n */\nexport const Loader2 = (p: IconProps) => <Icon {...p}><path d=\"M20 12a8 8 0 1 1-2.3-5.7\" /></Icon>;\n/** lucide `refresh-cw` — the resting refresh arrows. */\nexport const RefreshCw = (p: IconProps) => (\n <Icon {...p}>\n <path d=\"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8\" />\n <path d=\"M21 3v5h-5\" />\n <path d=\"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16\" />\n <path d=\"M8 16H3v5\" />\n </Icon>\n);\n/** Refresh affordance: arrows at rest, spinner only while busy. */\nexport function RefreshControlIcon({\n spinning = false,\n className,\n ...props\n}: IconProps & { spinning?: boolean }) {\n if (spinning) {\n return (\n <Loader2\n className={[className, \"animate-spin\"].filter(Boolean).join(\" \")}\n {...props}\n />\n );\n }\n return <RefreshCw className={className} {...props} />;\n}\nexport const Save = (p: IconProps) => <Icon {...p}><path d=\"M5 3h12l2 2v16H5zM8 3v6h8V3M8 21v-7h8v7\" /></Icon>;\nexport const Pencil = (p: IconProps) => <Icon {...p}><path d=\"m4 20 4-1 11-11-3-3L5 16l-1 4z\" /></Icon>;\nexport const Eye = (p: IconProps) => <Icon {...p}><path d=\"M2 12s3-6 10-6 10 6 10 6-3 6-10 6S2 12 2 12z\" /><circle cx=\"12\" cy=\"12\" r=\"2\" /></Icon>;\nexport const PanelRight = (p: IconProps) => <Icon {...p}><rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\" /><path d=\"M15 4v16\" /></Icon>;\nexport const PanelRightOpen = PanelRight;\nexport const WholeWord = (p: IconProps) => <Icon {...p}><path d=\"M4 6l3 12 3-8 3 8 3-12M17 15h4\" /></Icon>;\nexport const ExternalLink = (p: IconProps) => <Icon {...p}><path d=\"M14 4h6v6M20 4l-9 9M19 13v6H5V5h6\" /></Icon>;\nexport const Copy = (p: IconProps) => <Icon {...p}><rect x=\"9\" y=\"9\" width=\"11\" height=\"11\" rx=\"2\" /><path d=\"M15 9V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h3\" /></Icon>;\nexport const Lightbulb = (p: IconProps) => <Icon {...p}><path d=\"M9 18h6M10 22h4M8 14a6 6 0 1 1 8 0c-1 1-1 2-1 3H9c0-1 0-2-1-3z\" /></Icon>;\nexport const ShieldOff = (p: IconProps) => <Icon {...p}><path d=\"m3 3 18 18M12 3l7 3v5c0 4-3 7-7 9-4-2-7-5-7-9V6l4-2\" /></Icon>;\nexport const ListFilter = SlidersHorizontal;\nexport const ListX = X;\n\nexport const ChevronsLeft = (p: IconProps) => <Icon {...p}><path d=\"m11 18-6-6 6-6m8 12-6-6 6-6\" /></Icon>;\nexport const ChevronsRight = (p: IconProps) => <Icon {...p}><path d=\"m5 18 6-6-6-6m8 12 6-6-6-6\" /></Icon>;\n","\"use client\";\nimport { useState } from \"react\";\nimport { useMatrxDataTableHost } from \"./host\";\n\n/** Every portable async action has visible feedback even without a host toast system. */\nexport function useTableNotice() {\n const host = useMatrxDataTableHost();\n const [message, setMessage] = useState<{ text: string; error: boolean } | null>(null);\n const notify = {\n success(text: string) { if (host.notify) host.notify.success(text); else setMessage({ text, error: false }); },\n error(text: string) { if (host.notify) host.notify.error(text); else setMessage({ text, error: true }); },\n };\n const notice = message ? <span role={message.error ? \"alert\" : \"status\"} className={message.error ? \"text-xs text-destructive\" : \"text-xs text-muted-foreground\"}>{message.text}<button type=\"button\" aria-label=\"Dismiss notification\" className=\"ml-2 underline\" onClick={() => setMessage(null)}>Dismiss</button></span> : null;\n return { notify, notice };\n}\n","\"use client\";\nimport { createContext, useContext, type Context, type ComponentType, type ReactNode, type MouseEventHandler } from \"react\";\nimport type { CopyControlProps } from \"./copy-types\";\nimport type { MatrxDataTableDensity, MatrxDataTableRecordControls, TableSavedViewsProps } from \"./types\";\n\nexport type {\n AgentPayloadInput,\n AiCustomSource,\n AiVariant,\n CopyControlProps,\n CopyExportConfig,\n} from \"./copy-types\";\n\nexport interface TableLinkProps { href: string; children: ReactNode; className?: string; onClick?: MouseEventHandler<HTMLAnchorElement>; }\n/**\n * Host-owned toolbar affordance. The table package keeps operation state and\n * labels; an application can supply its canonical icon-button primitive\n * without making the shared package depend on an application UI package.\n */\nexport interface TableToolbarActionProps { ariaLabel: string; tooltip?: string | undefined; disabled?: boolean | undefined; busy?: boolean | undefined; /** Indicates a selected mutually-exclusive action such as the current page. */ active?: boolean | undefined; onClick: () => void; children: ReactNode; }\nexport interface TableSidePanelProps { title: string; titleNode?: ReactNode; description?: ReactNode; onClose: () => void; defaultWidth?: number; headerActions?: ReactNode; children: ReactNode; }\nexport interface TableWindowPanelProps { id: string; title: string; onClose: () => void; width?: number; height?: number; minWidth?: number; minHeight?: number; actionsRight?: ReactNode; bodyClassName?: string; sidebarDefaultSize?: number; sidebarMinSize?: number; sidebar?: ReactNode; children: ReactNode; }\nexport interface TableEntityRefProps { token: string; id: string; href?: string; children: ReactNode; className?: string; }\nexport interface TablePeekProps { kind: string; id: string; href?: string; onClose: () => void; }\nexport interface TableDoors { href?: string; peekKind?: string; canPeek?: boolean; }\nexport interface TableRowContextRegistry { register(tableId: string, resolve: (rowId: string) => unknown): () => void; }\nexport interface TableContextMenuBoundaryProps { label: string; children: ReactNode; }\nexport interface MatrxDataTableHost { JsonViewer?: ComponentType<{ data: object | string }>; Link?: ComponentType<TableLinkProps>; CopyControls?: ComponentType<CopyControlProps>; ToolbarAction?: ComponentType<TableToolbarActionProps>; SidePanelSurface?: ComponentType<TableSidePanelProps>; WindowPanel?: ComponentType<TableWindowPanelProps>; EntityRef?: ComponentType<TableEntityRefProps>; resolveEntityDoors?: (token: string, id: string, href?: string | null) => TableDoors | null; ResourcePeek?: ComponentType<TablePeekProps>; SavedViews?: ComponentType<TableSavedViewsProps>; rowContextRegistry?: TableRowContextRegistry; createDefaultRowContext?: (row: unknown, controls: import(\"./types\").MatrxDataTableRecordControls) => unknown; ContextMenuBoundary?: ComponentType<TableContextMenuBoundaryProps>; /** Host default; a table's explicit density takes precedence. */ defaultDensity?: MatrxDataTableDensity; notify?: { success(message: string): void; error(message: string): void }; }\n// Public entrypoints are independently bundled in ESM and CJS. The context\n// identity must survive those bundle boundaries; values stay provider-scoped.\nconst HOST_SLOT = Symbol.for(\"ai-matrx.design-system.table-host-context\");\nconst hostRegistry = globalThis as typeof globalThis & { [HOST_SLOT]?: Context<MatrxDataTableHost> };\nconst HostContext = hostRegistry[HOST_SLOT] ??= createContext<MatrxDataTableHost>({});\nexport function MatrxDataTableProvider({ value, children }: { value: MatrxDataTableHost; children: ReactNode }) { return <HostContext.Provider value={value}>{children}</HostContext.Provider>; }\nexport function useMatrxDataTableHost(): MatrxDataTableHost { return useContext(HostContext); }\n\nexport interface MatrxTableRowAlchemy {\n copy: CopyControlProps;\n controls?: MatrxDataTableRecordControls;\n placement: \"inline\" | \"menu\";\n ready: boolean;\n activate(): void;\n prepare(restoreFocus?: () => void): Promise<void>;\n}\n\nconst ROW_ALCHEMY_SLOT = Symbol.for(\"ai-matrx.design-system.table-row-alchemy-context\");\nconst rowAlchemyRegistry = globalThis as typeof globalThis & { [ROW_ALCHEMY_SLOT]?: Context<MatrxTableRowAlchemy | null> };\nconst RowAlchemyContext = rowAlchemyRegistry[ROW_ALCHEMY_SLOT] ??= createContext<MatrxTableRowAlchemy | null>(null);\n\nexport function MatrxTableRowAlchemyScope({ value, children }: { value: MatrxTableRowAlchemy; children: ReactNode }) { return <RowAlchemyContext.Provider value={value}>{children}</RowAlchemyContext.Provider>; }\n\nexport function useMatrxTableRowAlchemy(): MatrxTableRowAlchemy | null { return useContext(RowAlchemyContext); }\n\nconst ROW_CONTROLS_SLOT = Symbol.for(\"ai-matrx.design-system.table-row-controls-context\");\nconst rowControlsRegistry = globalThis as typeof globalThis & { [ROW_CONTROLS_SLOT]?: Context<MatrxDataTableRecordControls | null> };\nconst RowControlsContext = rowControlsRegistry[ROW_CONTROLS_SLOT] ??= createContext<MatrxDataTableRecordControls | null>(null);\nexport function MatrxTableRowControlsScope({ value, children }: { value: MatrxDataTableRecordControls; children: ReactNode }) { return <RowControlsContext.Provider value={value}>{children}</RowControlsContext.Provider>; }\nexport function useMatrxTableRowControls(): MatrxDataTableRecordControls | null { return useContext(RowControlsContext); }\n","\"use client\";\n\n/**\n * Tooltip — the ONE tooltip in the fleet.\n *\n * THE COLLAPSE (0.6.0). Two implementations existed: matrx-frontend's\n * `components/ui/tooltip.tsx` (182 import sites) and `@ai-matrx/tap-target`'s\n * `src/tooltip.tsx` — the latter an explicit inlined PORT of the former,\n * carrying a header that said so. tap-target shipped it only because its ~60\n * tap buttons need a tooltip and no shared package owned one; four repos then\n * adopted `TooltipProvider` from tap-target. That made tap-target — a\n * button-geometry package — the accidental owner of a design-system primitive,\n * with a second copy living in the biggest host.\n *\n * A tooltip is a design-system surface, so it lives here. tap-target now takes\n * `@ai-matrx/design-system` as an ordinary sibling dependency and imports this\n * file; its own copy is deleted, and its re-export removed. The DAG already\n * ordered design-system before tap-target, so no cycle is introduced.\n *\n * BEHAVIOUR is matrx-frontend's, verbatim, including the ruling both copies\n * carried in prose:\n *\n * 1. THE ROOT RENDERS UNCONDITIONALLY — no hydration mount gate. The gate the\n * host wrapper once carried (\"Radix generates dynamic aria-controls ids that\n * differ between SSR and client\") was false: Radix ids come from React's\n * SSR-stable `useId`. It was actively harmful — a Trigger wraps\n * ALWAYS-VISIBLE content, so `return null` deleted that subtree from SSR and\n * the first client paint.\n *\n * 2. THE SURFACE IS NEUTRAL, NOT BRANDED. Popover tokens, not `bg-primary`:\n * rich tooltip content using `text-muted-foreground` was illegible on a\n * brand-coloured background in one theme or the other.\n *\n * SEAM INVERSION. The host resolved nested portal targets through\n * `useNestedPortalContainer` (an app hook wired to its dialog + window-panel\n * systems); tap-target's port dropped that seam entirely and always portalled\n * to `document.body` — which is why a tooltip inside a popped-out panel landed\n * in the wrong window. Here it is the package's `PortalContainerProvider`\n * seam: an explicit `container` prop wins, then the injected container, then\n * `document.body`. Both prior behaviours are reachable; neither is forked.\n */\n\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport * as React from \"react\";\n\nimport { cn } from \"./cn\";\nimport { MOTION_POPPER } from \"./motion\";\nimport { usePortalContainer } from \"./portal-container\";\n\n/**\n * Mount once near the app root. Every tooltip in the tree shares its\n * `delayDuration` / `skipDelayDuration` timing.\n */\nconst TooltipProvider = TooltipPrimitive.Provider;\n\nconst Tooltip = TooltipPrimitive.Root;\n\nconst TooltipTrigger = TooltipPrimitive.Trigger;\n\nexport interface TooltipContentProps\n extends React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> {\n /**\n * Explicit portal target; wins over the injected `PortalContainerProvider`\n * value. Pass `null` to force `document.body`.\n */\n container?: HTMLElement | null;\n /**\n * Package-owned open/close motion. Default `true`. Pass `false` for a\n * surface that must appear instantly. It is NOT the reduced-motion switch;\n * `styles.css` already honours `prefers-reduced-motion`.\n */\n animated?: boolean;\n}\n\nconst TooltipContent = React.forwardRef<\n React.ComponentRef<typeof TooltipPrimitive.Content>,\n TooltipContentProps\n>(({ className, sideOffset = 4, container, animated = true, ...props }, ref) => {\n const resolved = usePortalContainer(container);\n return (\n <TooltipPrimitive.Portal container={resolved ?? null}>\n <TooltipPrimitive.Content\n ref={ref}\n data-slot=\"tooltip-content\"\n sideOffset={sideOffset}\n className={cn(\n \"z-[10001] overflow-hidden rounded-md border border-border bg-popover px-3 py-1.5 text-xs text-popover-foreground shadow-md\",\n animated && MOTION_POPPER,\n className,\n )}\n {...props}\n />\n </TooltipPrimitive.Portal>\n );\n});\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]): string {\n return twMerge(clsx(inputs));\n}\n","/**\n * THE MOTION CONTRACT (0.10.0) — the class names every animated surface in\n * this package puts on the DOM, in ONE place.\n *\n * Why a module and not ten inline strings: the sweep that produced this file\n * found the same defect ten times over, and it was invisible each time\n * because each primitive spelled its animation out by hand. Ten hand-written\n * copies of `data-[state=open]:animate-in data-[state=closed]:animate-out\n * data-[state=closed]:fade-out-0 …` meant ten chances to reach for a utility\n * nothing in the package defines — which is exactly what happened. A single\n * exported constant per motion SHAPE means the next primitive cannot invent\n * an eleventh spelling, and `styles.test.ts` can prove every one of them\n * resolves to a rule in the shipped stylesheet.\n *\n * Every rule these name lives in `styles.css` under the package's own\n * keyframes. NONE of them is a Tailwind utility, and none requires a host\n * plugin — see that file's header for the measurement that made this\n * necessary.\n */\n\n/** Modal scrims: Dialog, AlertDialog, Sheet, CommandDialog. Fade only. */\nexport const MOTION_OVERLAY = \"matrx-motion-overlay\";\n\n/** The centred dialog card. Fades and scales; centring is not its business. */\nexport const MOTION_DIALOG = \"matrx-motion-dialog\";\n\n/**\n * THE CENTRING OF A CENTRED DIALOG CARD — package-owned, in the `translate`\n * property, and NEVER a Tailwind `translate-x-[-50%] translate-y-[-50%]` pair.\n *\n * Those utilities do not compile to the same thing in every host: Tailwind v3\n * writes them into `transform`, Tailwind v4 writes them into the independent\n * `translate` property, which COMPOSES with `transform` instead of being\n * replaced by it. 0.10.0's keyframes restated the centring inside `transform`,\n * which was harmless on v3 and doubled the centring on v4 — the card flew in\n * from off the top-left of the viewport for the animation's whole duration and\n * snapped into place at the end (fixed in 0.10.1).\n *\n * Owning it here means one spelling that reads the same on both, and it frees\n * `transform` so the keyframes carry ONLY the delta. Put this on every centred\n * surface UNCONDITIONALLY — it is geometry, so unlike {@link MOTION_DIALOG} it\n * must survive `animated={false}`. Its rule ships in `styles.css`.\n */\nexport const CENTERED_DIALOG = \"matrx-dialog-centered\";\n\n/**\n * The resting gap between a `popper`-positioned surface and its trigger, for\n * the primitives that want one (today: `Select`). Same law and same reason as\n * {@link CENTERED_DIALOG} — a position an animated surface holds AT REST is\n * the `translate` property's job, never a Tailwind translate utility, because\n * those land in `transform` on a v3 host and in `translate` on a v4 one while\n * the keyframes animate `transform` either way. Sizes from\n * `--matrx-popper-offset`; keys off Radix's `data-side`.\n */\nexport const POPPER_OFFSET = \"matrx-popper-offset\";\n\n/** The mobile Dialog / CommandDialog bottom sheet. Slides up and fades. */\nexport const MOTION_BOTTOM_SHEET = \"matrx-motion-bottom-sheet\";\n\n/**\n * Radix-popper surfaces: Popover, DropdownMenu, ContextMenu, HoverCard,\n * Select, Tooltip. Reads `--radix-popper-transform-origin` so the surface\n * grows out of its trigger, and `data-side` so it travels from it.\n */\nexport const MOTION_POPPER = \"matrx-motion-popper\";\n\n/** Edge sheets, one class per `sheetVariants` side. */\nexport const MOTION_SHEET = {\n top: \"matrx-motion-sheet-top\",\n bottom: \"matrx-motion-sheet-bottom\",\n left: \"matrx-motion-sheet-left\",\n right: \"matrx-motion-sheet-right\",\n center: \"matrx-motion-sheet-center\",\n} as const;\n\n/** Skeleton's breathing loop. */\nexport const MOTION_PULSE = \"matrx-pulse\";\n\n/** The spinner loop, for every inline busy indicator in the package. */\nexport const MOTION_SPIN = \"matrx-spin\";\n\n/**\n * Every motion class the package ships, for the guards. If a rule for one of\n * these is missing from `styles.css`, a component animates in no consumer and\n * says nothing about it — the C26 failure this list exists to make loud.\n */\nexport const ALL_MOTION_CLASSES = [\n MOTION_OVERLAY,\n MOTION_DIALOG,\n MOTION_BOTTOM_SHEET,\n MOTION_POPPER,\n ...Object.values(MOTION_SHEET),\n MOTION_PULSE,\n MOTION_SPIN,\n] as const;\n\n/**\n * The host-plugin utilities this package is forbidden to emit. They are\n * supplied by `tailwindcss-animate` / `tw-animate-css`, which is a HOST CSS\n * entry concern a package cannot declare a dependency on: three of the four\n * AI Matrx consumers never loaded it, so every surface wearing these appeared\n * with no animation and no error. `styles.test.ts` fails the build if one\n * comes back.\n */\nexport const FORBIDDEN_HOST_MOTION_UTILITIES = [\n \"animate-in\",\n \"animate-out\",\n \"fade-in\",\n \"fade-out\",\n \"zoom-in\",\n \"zoom-out\",\n \"slide-in-from\",\n \"slide-out-to\",\n \"animate-accordion\",\n \"animate-slide-down\",\n \"animate-slide-up\",\n \"animate-pulse\",\n \"animate-spin\",\n] as const;\n","\"use client\";\n\n/**\n * Injected portal-container seam.\n *\n * The matrx-frontend original resolved nested portal targets through\n * `useNestedPortalContainer` (explicit prop > dialog content > popout body >\n * document.body) — a host-shaped hook wired to that app's dialog and\n * window-panel systems. The package inverts the seam: hosts provide the\n * resolved container through `PortalContainerProvider`; an explicit\n * `container` prop on a component still wins, and with neither the portal\n * falls through to `document.body` (Radix default). Priority semantics are\n * unchanged from the original.\n */\n\nimport * as React from \"react\";\n\n// Shared identity across independently bundled public entrypoints/loaders.\nconst CONTEXT_SLOT = Symbol.for(\"ai-matrx.design-system.portal-container-context\");\nconst contextRegistry = globalThis as typeof globalThis & { [CONTEXT_SLOT]?: React.Context<HTMLElement | null | undefined> };\nconst PortalContainerContext = contextRegistry[CONTEXT_SLOT] ??= React.createContext<HTMLElement | null | undefined>(undefined);\n\nexport interface PortalContainerProviderProps {\n /** Where nested Radix portals (Popover, etc.) should mount. `null`/`undefined` → document.body. */\n container: HTMLElement | null | undefined;\n children: React.ReactNode;\n}\n\nexport function PortalContainerProvider({\n container,\n children,\n}: PortalContainerProviderProps) {\n return (\n <PortalContainerContext.Provider value={container ?? undefined}>\n {children}\n </PortalContainerContext.Provider>\n );\n}\n\n/**\n * Resolve a portal target: explicit prop (including an explicit `null`,\n * meaning \"the default body\") beats the injected container.\n */\nexport function usePortalContainer(\n explicit?: HTMLElement | null,\n): HTMLElement | undefined {\n const injected = React.useContext(PortalContainerContext);\n\n if (explicit !== undefined) {\n return explicit ?? undefined;\n }\n\n return injected ?? undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBA,IAAAA,gBAMO;;;ACnBE;AADT,SAAS,KAAK,EAAE,UAAU,GAAG,MAAM,GAAc;AAC/C,SAAO,4CAAC,SAAI,SAAQ,aAAY,MAAK,QAAO,QAAO,gBAAe,aAAY,KAAI,eAAc,SAAQ,gBAAe,SAAQ,eAAY,QAAQ,GAAG,OAAQ,UAAS;AACzK;AAQO,IAAM,QAAQ,CAAC,MAAiB,4CAAC,QAAM,GAAG,GAAG,sDAAC,UAAK,GAAE,kBAAiB,GAAE;AAkDxE,IAAM,aAAa,CAAC,MAAiB,6CAAC,QAAM,GAAG,GAAG;AAAA,8CAAC,UAAK,GAAE,KAAI,GAAE,KAAI,OAAM,MAAK,QAAO,MAAK,IAAG,KAAI;AAAA,EAAE,4CAAC,UAAK,GAAE,YAAW;AAAA,GAAE;AAGzH,IAAM,eAAe,CAAC,MA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AEV,uDAAC,gBAAa,WAAU,WAAU;AAAA;AAAA,UACpC,GACF;AAAA,UACA,8CAAC,kBAAe,MAAK,OAAM;AAAA;AAAA,YAAM,SAAS;AAAA,YAAS;AAAA,aAAa;AAAA,WAClE,IACE;AAAA,QACH;AAAA,QACA;AAAA,QACA,WAAW,YAAY,eACtB;AAAA,UAAC;AAAA;AAAA,YACC,MAAM,OAAO,YAAY,SAAS;AAAA,YAClC,IAAI;AAAA,YACJ,SAAS,MAAM,YAAY,KAAK;AAAA,YAO/B,GAAI,QAAQ,OAAO,CAAC,IAAI,EAAE,KAAK;AAAA;AAAA,QAClC,IACE;AAAA;AAAA;AAAA,EACN,GACF;AAEJ;","names":["import_react","import_react","import_jsx_runtime","import_jsx_runtime","React","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime"]}