@ai-matrx/records-ui 0.116.87 → 0.116.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -1
- package/dist/{SaveToTable-X2T2GDX7.js → SaveToTable-RV553LQL.js} +3 -3
- package/dist/{chunk-Y5UJD4FV.js → chunk-A5XXEX6A.js} +2 -2
- package/dist/{chunk-QNI75ZHU.js → chunk-D7LNXDKV.js} +2 -1
- package/dist/{chunk-QNI75ZHU.js.map → chunk-D7LNXDKV.js.map} +1 -1
- package/dist/{chunk-HYC2SPZZ.js → chunk-HEPOU6ZX.js} +1 -1
- package/dist/chunk-HEPOU6ZX.js.map +1 -0
- package/dist/{chunk-6BTGCYPK.js → chunk-NS2VEKMS.js} +4 -2
- package/dist/chunk-NS2VEKMS.js.map +1 -0
- package/dist/{chunk-ATBJZKUT.js → chunk-YQW2T27M.js} +4 -4
- package/dist/first-page.cjs.map +1 -1
- package/dist/first-page.js.map +1 -1
- package/dist/helpers.cjs +1 -0
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.d.cts +18 -2
- package/dist/helpers.d.ts +18 -2
- package/dist/helpers.js +1 -0
- package/dist/helpers.js.map +1 -1
- package/dist/index.cjs +4117 -3888
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -4
- package/dist/index.d.ts +20 -4
- package/dist/index.js +3699 -3470
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +3 -3
- package/dist/skeleton.cjs +2 -0
- package/dist/skeleton.cjs.map +1 -1
- package/dist/skeleton.d.cts +1 -1
- package/dist/skeleton.d.ts +1 -1
- package/dist/skeleton.js +2 -2
- package/package.json +4 -4
- package/dist/chunk-6BTGCYPK.js.map +0 -1
- package/dist/chunk-HYC2SPZZ.js.map +0 -1
- /package/dist/{SaveToTable-X2T2GDX7.js.map → SaveToTable-RV553LQL.js.map} +0 -0
- /package/dist/{chunk-Y5UJD4FV.js.map → chunk-A5XXEX6A.js.map} +0 -0
- /package/dist/{chunk-ATBJZKUT.js.map → chunk-YQW2T27M.js.map} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
EMBEDDED_PLAIN_FOOTER_CLASS,
|
|
4
4
|
EMBEDDED_TABLE_CLASS
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-D7LNXDKV.js";
|
|
6
6
|
|
|
7
7
|
// src/skeletonLayout.ts
|
|
8
8
|
var RECORDS_SKELETON_LAYOUTS = [
|
|
@@ -15,6 +15,7 @@ var RECORDS_SKELETON_LAYOUTS = [
|
|
|
15
15
|
"map",
|
|
16
16
|
"orgchart",
|
|
17
17
|
"pivot",
|
|
18
|
+
"swipe",
|
|
18
19
|
"form",
|
|
19
20
|
"record",
|
|
20
21
|
"chart",
|
|
@@ -203,6 +204,7 @@ function BodySkeleton({ layout, embedded, rows, columns, known }) {
|
|
|
203
204
|
return /* @__PURE__ */ jsx(Skeleton, { className: "min-h-[16rem] w-full rounded-md", "data-records-skeleton-part": "body" });
|
|
204
205
|
case "map":
|
|
205
206
|
case "orgchart":
|
|
207
|
+
case "swipe":
|
|
206
208
|
return /* @__PURE__ */ jsx(Skeleton, { className: `w-full rounded-md ${SPATIAL_LAYOUT_BOX}`, "data-records-skeleton-part": "body" });
|
|
207
209
|
case "record":
|
|
208
210
|
return /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-2 overflow-hidden", "data-records-skeleton-part": "body", children: [
|
|
@@ -302,4 +304,4 @@ export {
|
|
|
302
304
|
RecordsSkeleton,
|
|
303
305
|
TablePageSkeleton
|
|
304
306
|
};
|
|
305
|
-
//# sourceMappingURL=chunk-
|
|
307
|
+
//# sourceMappingURL=chunk-NS2VEKMS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/skeletonLayout.ts","../src/RecordsSkeleton.tsx","../src/rememberedRows.ts"],"sourcesContent":["// src/skeletonLayout.ts — @ai-matrx/records-ui · the skeleton's layout words, with no React\n//\n// Pure, so `/helpers` carries `skeletonLayoutFor` and a host can choose a loading frame before it\n// loads any screen (records-ui front door, 2026-10-16). `RecordsSkeleton.tsx` re-exports all of it.\n\n/** Every place a records surface shows while its first read is out. */\nexport type RecordsSkeletonLayout =\n | \"grid\"\n | \"kanban\"\n | \"gallery\"\n | \"list\"\n | \"calendar\"\n | \"timeline\"\n | \"map\"\n | \"orgchart\"\n | \"pivot\"\n | \"swipe\"\n | \"form\"\n | \"record\"\n | \"chart\"\n | \"home\";\n\nexport const RECORDS_SKELETON_LAYOUTS: readonly RecordsSkeletonLayout[] = [\n \"grid\",\n \"kanban\",\n \"gallery\",\n \"list\",\n \"calendar\",\n \"timeline\",\n \"map\",\n \"orgchart\",\n \"pivot\",\n \"swipe\",\n \"form\",\n \"record\",\n \"chart\",\n \"home\",\n];\n\n/** A layout word the address or a view carries, as the skeleton that stands for it. */\nexport function skeletonLayoutFor(layout: string | null | undefined): RecordsSkeletonLayout {\n if (layout === \"board\" || layout === \"pipeline\") return \"kanban\";\n return (RECORDS_SKELETON_LAYOUTS as readonly string[]).includes(layout ?? \"\")\n ? (layout as RecordsSkeletonLayout)\n : \"grid\";\n}\n\n/**\n * THE GEOMETRY OF AN EMBEDDED GRID, MEASURED ON A LIVE SPACES PAGE (lane SKELETON-HEIGHT, 2026-10-17).\n * A loading frame that is not the loaded frame moves everything under it when the rows land. The\n * embedded grid is: a 12px wrap (the body's 4px padding twice plus its 4px gap), the data table's 36px\n * header, one 37px row per record, and the footer line (44.5px: the add-row line) when there is a row.\n * Pure numbers, so a host can size a frame before it loads any screen.\n */\nexport const EMBEDDED_ROW_PX = 37;\nexport const EMBEDDED_HEADER_PX = 36;\nexport const EMBEDDED_FOOTER_PX = 44.5;\nexport const EMBEDDED_WRAP_PX = 12;\n/** An embedded table reads this many rows at a time (the same number as `EMBEDDED_PAGE_SIZE`, firstPage.ts; a test holds them equal). */\nexport const SKELETON_EMBEDDED_PAGE_ROWS = 50;\n/** A full page's grid reads this many rows at a time (the page's own `pageSize`). */\nexport const SKELETON_PAGE_ROWS = 100;\n\n/**\n * THE ROWS A LOADING FRAME DRAWS WHEN THE SERVER KNOWS HOW MANY THE PERSON SEES: min(rows, page size).\n * `rowsVisible` is the count the store gave (`custom.where_id_opens` / the table bundle: the caller's own\n * visible rows, capped), `pageSize` the rows the surface reads first. Null/undefined/invalid = not known.\n */\nexport function skeletonRowsFor(rowsVisible: number | null | undefined, pageSize: number): number | null {\n if (typeof rowsVisible !== \"number\" || !Number.isFinite(rowsVisible) || rowsVisible < 0) return null;\n return Math.min(Math.floor(rowsVisible), pageSize);\n}\n\n/** The height (px) of an embedded grid's body with `rows` rows drawn: the loaded body's own height. */\nexport function embeddedGridBodyPx(rows: number): number {\n return EMBEDDED_WRAP_PX + EMBEDDED_HEADER_PX + EMBEDDED_ROW_PX * rows + (rows > 0 ? EMBEDDED_FOOTER_PX : 0);\n}\n\n/**\n * THE CARDS EACH BOARD COLUMN DRAWS WHEN THE SERVER KNOWS THEM (lane SKELETON-HEIGHT-2): the store's\n * per-group counts (`opening_view.groups`), each min(cards, page size). Null = not known (empty or invalid),\n * so the board skeleton keeps its stand-in columns. A column with no card still draws (its header).\n */\nexport function skeletonColumnsFor(groups: readonly number[] | null | undefined, pageSize: number): number[] | null {\n if (!Array.isArray(groups) || groups.length === 0) return null;\n const out: number[] = [];\n for (const g of groups) {\n if (typeof g !== \"number\" || !Number.isFinite(g) || g < 0) return null;\n out.push(Math.min(Math.floor(g), pageSize));\n }\n return out;\n}\n","/**\n * THE LOADING FRAME OF EVERY RECORDS SURFACE (lane STABLE-TABLES).\n *\n * Arman, 2026-10-06: \"The tables do not properly show a loading state so they are jumpy … They\n * must properly show skeletons and they should not cause shifts … all must have proper loading,\n * empty state, etc.\" Measured before this file: a table page went route placeholder → a line of\n * text → a 160px gray box → a grid frame with 23px rows and its footer under them → the real grid\n * with 35px rows and its footer 580px lower. Four frames, four geometries.\n *\n * ONE skeleton per surface, chosen by a named option, drawn in the frame the loaded surface uses:\n * · the toolbar row is the page's own toolbar row (`TABLE_TOOLBAR_ROW_CLASS`), at its height;\n * · `grid` is the data table itself in its loading state — the same header, the same row\n * height, the same pinned footer — so its geometry is the loaded grid's by construction;\n * · `kanban`, `gallery`, `list`, `calendar`, `timeline` paint their columns, cards, rows or\n * cells where the loaded layout puts them;\n * · `form` and `record` paint the field stack and the body; `chart` reserves the chart's box.\n *\n * THE COUNT WHEN NOBODY KNOWS IT. A page frame fills to its edge (Airtable's rule: the grid never\n * starts short and grows); an embedded frame paints the rows the table had last time, else five\n * (Notion's inline database paints a short run) — see `rememberedRows.ts`.\n *\n * Hosts never style a placeholder of their own: they render this, with a layout.\n */\n\nimport { createContext, useContext, useMemo, useSyncExternalStore, type ReactNode } from \"react\";\nimport { cn } from \"@ai-matrx/design-system/cn\";\nimport { Skeleton } from \"@ai-matrx/design-system/skeleton\";\nimport { MatrxDataTable, type MatrxColumnDef } from \"@ai-matrx/design-system/data-table\";\n\nimport { EMBEDDED_PLAIN_FOOTER_CLASS, EMBEDDED_TABLE_CLASS } from \"./embeddedLook\";\nimport { rememberedLayout, rememberedRowCount } from \"./rememberedRows\";\nimport {\n EMBEDDED_FOOTER_PX,\n EMBEDDED_ROW_PX,\n EMBEDDED_WRAP_PX,\n SKELETON_EMBEDDED_PAGE_ROWS,\n SKELETON_PAGE_ROWS,\n skeletonLayoutFor,\n skeletonColumnsFor,\n skeletonRowsFor,\n type RecordsSkeletonLayout,\n} from \"./skeletonLayout\";\n\n// The layout words and their chooser are pure, so `/helpers` carries them too (records-ui front door, 2026-10-16).\nexport {\n EMBEDDED_FOOTER_PX,\n EMBEDDED_HEADER_PX,\n EMBEDDED_ROW_PX,\n EMBEDDED_WRAP_PX,\n RECORDS_SKELETON_LAYOUTS,\n SKELETON_EMBEDDED_PAGE_ROWS,\n SKELETON_PAGE_ROWS,\n embeddedGridBodyPx,\n skeletonColumnsFor,\n skeletonLayoutFor,\n skeletonRowsFor,\n type RecordsSkeletonLayout,\n} from \"./skeletonLayout\";\n\ninterface Expected {\n rows: number | null;\n /** A board's cards per column (the store's opening view): a board skeleton draws these columns. */\n groups: number[] | null;\n}\nconst ExpectedRowsContext = createContext<Expected>({ rows: null, groups: null });\n\n/**\n * HOW MANY ROWS THE SERVER SAYS THIS PERSON SEES (lane SKELETON-HEIGHT). A host that knows the count\n * before the table loads (`rows_visible` from the store's `where_id_opens` / table bundle) wraps the table in\n * this; every loading frame below — the skeleton, the page skeleton, the grid's own first frame — then paints\n * min(rows, its page size) rows, the height the loaded table will have, and nothing under it moves.\n * `groups` (lane SKELETON-HEIGHT-2) is the cards each board column holds (`opening_view.groups`): a board's\n * skeleton then draws that many columns, each min(cards, page size) tall; a gallery's draws `rows` cards.\n */\nexport function ExpectedRows({ rows, groups, children }: { rows: number | null | undefined; groups?: readonly number[] | null | undefined; children: ReactNode }) {\n const value = useMemo<Expected>(\n () => ({ rows: typeof rows === \"number\" && rows >= 0 ? rows : null, groups: skeletonColumnsFor(groups, Number.MAX_SAFE_INTEGER) }),\n [rows, groups],\n );\n return <ExpectedRowsContext.Provider value={value}>{children}</ExpectedRowsContext.Provider>;\n}\n\n/** The rows a loading frame draws from what the host said it knows (null = nobody told it). */\nexport function useExpectedRows(embedded: boolean): number | null {\n return skeletonRowsFor(useContext(ExpectedRowsContext).rows, embedded ? SKELETON_EMBEDDED_PAGE_ROWS : SKELETON_PAGE_ROWS);\n}\n\n/** The cards each board column draws (page size capped), or null when the host did not say. */\nexport function useExpectedColumns(embedded: boolean): number[] | null {\n return skeletonColumnsFor(useContext(ExpectedRowsContext).groups, embedded ? SKELETON_EMBEDDED_PAGE_ROWS : SKELETON_PAGE_ROWS);\n}\n\nconst NEVER = () => () => {};\n\n/**\n * THE ROWS A TABLE PAGE PAINTED LAST VISIT, for a frame drawn before the table is known (the\n * route's own loading frame, the page's first-read frame). The server render and the first client\n * paint agree (\"fill\"); a browser that remembers the table then settles on its count with no\n * hydration mismatch. The key is the one the grid writes (`<tableId>:page:last`).\n */\nexport function useRememberedPageRows(tableId: string | undefined): number | \"fill\" {\n return useSyncExternalStore(\n NEVER,\n () => (tableId ? rememberedRowCount(`${tableId}:page:last`, 100, \"fill\" as const) : \"fill\"),\n () => \"fill\" as const,\n );\n}\n\n/**\n * THE LAYOUT A TABLE PAGE SETTLED ON LAST VISIT (null before a browser remembers one, and on the\n * server). Server render and first client paint agree (null); a browser that remembers the table\n * then settles on its layout with no hydration mismatch.\n */\nexport function useRememberedLayout(tableId: string | undefined): string | null {\n return useSyncExternalStore(\n NEVER,\n () => (tableId ? rememberedLayout(tableId) : null),\n () => null,\n );\n}\n\n/** The box a map or an org chart reserves from the first frame: the skeleton and the loaded layout share it. */\nexport const SPATIAL_LAYOUT_BOX = \"h-[60vh] min-h-[22rem]\";\n\n/**\n * THE TABLE PAGE'S TOOLBAR ROW — one class for the loaded row and its skeleton, so the two are\n * the same height from the first frame. The row holds tap buttons and tap groups, whose footprint is\n * the design system's tap box (38px: the 32px pill plus its gap), so the row is that tall before the\n * toolbar mounts — at 32px the first paint was 6px short and the whole grid moved down when the\n * toolbar's controls arrived (CLS on /data/<table>, admin and member alike). A chip that arrives\n * later can never make it taller or shorter.\n */\nexport const TABLE_TOOLBAR_ROW_CLASS =\n \"flex min-h-[var(--matrx-tap-box,2.375rem)] min-w-0 shrink-0 flex-nowrap items-center gap-1.5 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden\";\n\n/** The table page's frame: the same two boxes `TablePage` draws round its toolbar and records. */\nexport const TABLE_PAGE_FRAME_CLASS = \"flex h-full min-h-0 gap-4\";\nexport const TABLE_PAGE_COLUMN_CLASS = \"flex min-h-0 min-w-0 flex-1 flex-col gap-2\";\n\ntype Row = { id: string };\nconst PLACEHOLDER_COLUMNS: MatrxColumnDef<Row>[] = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\"].map((id) => ({\n id,\n header: \"\",\n accessorFn: () => \"\",\n}));\nconst NO_ROWS: Row[] = [];\n\n/**\n * THE GRID'S SKELETON IS THE GRID. The data table in its loading state, with the records grid's\n * own row height (35px: the condensed row round its 32px action strip), header and footer.\n */\nfunction GridSkeleton({ embedded, rows }: { embedded: boolean; rows: number | \"fill\" }) {\n const table = (\n <MatrxDataTable<Row>\n {...(embedded ? {} : { className: \"min-h-0 flex-1\" })}\n data={NO_ROWS}\n columns={PLACEHOLDER_COLUMNS}\n getRowId={(r) => r.id}\n isLoading\n density=\"condensed\"\n loadingRowHeight={embedded ? EMBEDDED_ROW_PX : RECORDS_GRID_ROW_PX}\n hideToolbar\n viewTabs={false}\n stickyHeader\n frameHeight={embedded ? \"content\" : \"fill\"}\n loadingRows={rows}\n copy={false}\n {...(embedded\n ? {\n appearance: \"embedded\" as const,\n hidePagination: true,\n tableClassName: cn(EMBEDDED_TABLE_CLASS, EMBEDDED_PLAIN_FOOTER_CLASS),\n }\n : {})}\n />\n );\n if (!embedded) return table;\n // The loaded embedded grid: the body's wrap (6px above and below) and, once there is a row, the add-row footer.\n return (\n <div style={{ paddingBlock: EMBEDDED_WRAP_PX / 2 }} data-records-skeleton-part=\"embedded-grid\">\n {table}\n {rows === \"fill\" || rows > 0 ? <div style={{ height: EMBEDDED_FOOTER_PX }} data-records-skeleton-part=\"footer\" /> : null}\n </div>\n );\n}\n\n/** A chart block's plot height (`ChartBlock`'s HEIGHT): the box a chart skeleton reserves. */\nexport const CHART_PLOT_PX = 140;\n\n/** The records grid's row: condensed, round the 32px row action strip, plus its rule. */\nexport const RECORDS_GRID_ROW_PX = 35;\n\nfunction Cards({ count, className }: { count: number; className: string }) {\n return (\n <>\n {Array.from({ length: count }, (_, i) => (\n <Skeleton key={i} shape=\"block\" className={className} />\n ))}\n </>\n );\n}\n\nfunction BodySkeleton({ layout, embedded, rows, columns, known }: { layout: RecordsSkeletonLayout; embedded: boolean; rows: number | \"fill\"; columns?: number[] | null; known?: number | \"fill\" | undefined }) {\n const lineCount = rows === \"fill\" ? 12 : rows;\n switch (layout) {\n case \"grid\":\n case \"home\":\n return <GridSkeleton embedded={embedded} rows={rows} />;\n case \"kanban\":\n return (\n <div className=\"flex min-h-0 flex-1 gap-2 overflow-hidden pb-2\" data-records-skeleton-part=\"body\">\n {(columns ?? [3, 2, 3, 2]).map((cards, c) => (\n <div key={c} className=\"flex w-64 shrink-0 flex-col gap-2 rounded-lg bg-muted/40 p-2\" data-records-skeleton-part=\"column\">\n <Skeleton shape=\"line\" width=\"1/2\" className=\"my-1.5\" />\n <Cards count={cards} className=\"h-24\" />\n </div>\n ))}\n </div>\n );\n case \"gallery\":\n return (\n <div\n className=\"grid min-h-0 flex-1 auto-rows-min grid-cols-[repeat(auto-fill,minmax(14rem,1fr))] gap-3 overflow-hidden\"\n data-records-skeleton-part=\"body\"\n >\n <Cards count={typeof known === \"number\" ? known : 8} className=\"h-48\" />\n </div>\n );\n case \"list\":\n return (\n <div className=\"flex min-h-0 flex-1 flex-col overflow-hidden\" data-records-skeleton-part=\"body\">\n {Array.from({ length: lineCount }, (_, i) => (\n <div key={i} className=\"flex h-9 items-center gap-3 border-b border-border/60 px-2\">\n <Skeleton className=\"size-4\" />\n <Skeleton shape=\"line\" width={i % 3 === 0 ? \"1/2\" : i % 3 === 1 ? \"2/3\" : \"1/3\"} />\n </div>\n ))}\n </div>\n );\n case \"calendar\":\n return (\n <div className=\"flex min-h-0 flex-1 flex-col gap-2 overflow-hidden\" data-records-skeleton-part=\"body\">\n <div className=\"grid grid-cols-7 gap-px\">\n {Array.from({ length: 7 }, (_, i) => (\n <Skeleton key={i} shape=\"line\" width=\"1/3\" className=\"mx-auto my-1\" />\n ))}\n </div>\n <div className=\"grid flex-1 grid-cols-7 grid-rows-5 gap-px overflow-hidden rounded-md border border-border bg-border\">\n {Array.from({ length: 35 }, (_, i) => (\n <div key={i} className=\"bg-card p-1.5\">\n <Skeleton shape=\"line\" width=\"1/3\" />\n </div>\n ))}\n </div>\n </div>\n );\n case \"timeline\":\n return (\n <div className=\"flex min-h-0 flex-1 flex-col overflow-hidden rounded-md border border-border\" data-records-skeleton-part=\"body\">\n <div className=\"flex h-9 items-center gap-6 border-b border-border px-3\">\n {Array.from({ length: 6 }, (_, i) => (\n <Skeleton key={i} shape=\"line\" width=\"sm\" className=\"w-16\" />\n ))}\n </div>\n {Array.from({ length: Math.min(lineCount, 8) }, (_, i) => (\n <div key={i} className=\"flex h-10 items-center border-b border-border/60 px-3\">\n <Skeleton className=\"h-6 rounded-md\" style={{ marginLeft: `${(i * 13) % 45}%`, width: `${20 + ((i * 7) % 25)}%` }} />\n </div>\n ))}\n </div>\n );\n case \"pivot\":\n // The box the pivot layout reserves (`PIVOT_BOX`, PivotLayout.tsx): the skeleton and the loaded table share it.\n return <Skeleton className=\"min-h-[16rem] w-full rounded-md\" data-records-skeleton-part=\"body\" />;\n case \"map\":\n case \"orgchart\":\n case \"swipe\":\n // The same box the loaded layout reserves (`SPATIAL_LAYOUT_BOX`), so nothing moves when it lands.\n return <Skeleton className={`w-full rounded-md ${SPATIAL_LAYOUT_BOX}`} data-records-skeleton-part=\"body\" />;\n case \"record\":\n // THE RECORD PAGE'S OWN GEOMETRY (STABLE-2, field list moved down on landing): RecordPanel's header\n // is a 32px title, an actions row (38px), a rule, then the field list — each `gap-2` apart; the\n // field rows are 28px with 2px between. Same boxes here, so the first field is at the same y\n // whether the record has landed or not.\n return (\n <div className=\"flex min-h-0 flex-1 flex-col gap-2 overflow-hidden\" data-records-skeleton-part=\"body\">\n <Skeleton shape=\"title\" width=\"1/2\" className=\"h-8\" data-records-skeleton-part=\"title\" />\n <div className=\"flex h-[38px] items-center gap-2\" data-records-skeleton-part=\"actions\">\n <Skeleton shape=\"control\" width=\"sm\" className=\"h-8\" />\n <Skeleton shape=\"control\" width=\"sm\" className=\"h-8\" />\n </div>\n <div className=\"h-px w-full shrink-0 bg-border\" />\n <div className=\"grid grid-cols-[minmax(6rem,12rem)_1fr] gap-x-3 gap-y-0.5\" data-records-skeleton-part=\"fields\">\n {Array.from({ length: 6 }, (_, i) => (\n <div key={i} className=\"contents\">\n <Skeleton shape=\"line\" width=\"2/3\" className=\"my-[7px]\" />\n <Skeleton shape=\"row\" className=\"h-7\" />\n </div>\n ))}\n </div>\n <Skeleton shape=\"block\" height=\"lg\" />\n </div>\n );\n case \"form\":\n return (\n <div className=\"flex min-h-0 flex-1 flex-col gap-4 overflow-hidden\" data-records-skeleton-part=\"body\">\n <Skeleton shape=\"title\" width=\"1/2\" />\n <div className=\"grid grid-cols-[minmax(6rem,12rem)_1fr] gap-x-3 gap-y-1.5\">\n {Array.from({ length: 6 }, (_, i) => (\n <div key={i} className=\"contents\">\n <Skeleton shape=\"line\" width=\"2/3\" className=\"my-1.5\" />\n <Skeleton shape=\"row\" className=\"h-7\" />\n </div>\n ))}\n </div>\n <Skeleton shape=\"control\" width=\"sm\" />\n </div>\n );\n case \"chart\":\n // The chart's box: its title line, then the plot at the plot's own height (`CHART_PLOT_PX`).\n return (\n <div className=\"flex flex-col gap-2\" data-records-skeleton-part=\"body\">\n {embedded ? null : <Skeleton shape=\"line\" width=\"1/3\" />}\n <Skeleton shape=\"block\" style={{ height: CHART_PLOT_PX }} />\n </div>\n );\n }\n}\n\nexport interface RecordsSkeletonProps {\n /** Which surface is coming. Default `grid`. */\n layout?: RecordsSkeletonLayout;\n /** Inside a page (a Spaces block): no frame, the data table's embedded look, content height. */\n embedded?: boolean;\n /** Rows to paint; default — page: to the frame's edge, embedded: five. */\n rows?: number | \"fill\";\n /** The table this page is for: a page frame then paints the rows that table showed last visit. */\n tableId?: string;\n className?: string;\n}\n\n/** The body of a layout while its first read is out — where the loaded layout's body will be. */\nexport function RecordsSkeleton({ layout = \"grid\", embedded = false, rows, className }: RecordsSkeletonProps) {\n const expected = useExpectedRows(embedded);\n const columns = useExpectedColumns(embedded);\n return (\n <div\n role=\"status\"\n aria-label=\"Loading\"\n aria-busy=\"true\"\n data-records-skeleton={layout}\n className={cn(\"flex min-h-0 flex-col\", !embedded && \"flex-1\", className)}\n >\n <BodySkeleton layout={layout} embedded={embedded} rows={rows ?? expected ?? (embedded ? 5 : \"fill\")} columns={columns} known={rows ?? expected ?? undefined} />\n </div>\n );\n}\n\n/**\n * A WHOLE TABLE PAGE while the table itself is being read: the page's own frame, its toolbar row\n * at its height (the view, the layout, filter, then the search and the add buttons at the end),\n * and the layout's body skeleton below — the boxes the loaded page fills, nothing else.\n */\nexport function TablePageSkeleton({\n layout: layoutAsked,\n embedded = false,\n rows,\n tableId,\n className,\n}: RecordsSkeletonProps) {\n const remembered = useRememberedPageRows(embedded ? undefined : tableId);\n // No layout named (the route's loading frame): the layout this table settled on last visit, else the grid.\n const rememberedFace = useRememberedLayout(embedded || layoutAsked ? undefined : tableId);\n const layout: RecordsSkeletonLayout = layoutAsked ?? skeletonLayoutFor(rememberedFace);\n const expected = useExpectedRows(embedded);\n // What the server said this person sees outranks what this browser remembers from last visit.\n const painted = rows ?? expected ?? (remembered === \"fill\" ? undefined : remembered);\n return (\n <div className={cn(TABLE_PAGE_FRAME_CLASS, className)} data-records-skeleton-page={layout}>\n <div className={TABLE_PAGE_COLUMN_CLASS}>\n <div className={TABLE_TOOLBAR_ROW_CLASS} data-table-toolbar=\"\" data-records-skeleton-part=\"toolbar\" aria-hidden=\"true\">\n <Skeleton shape=\"control\" width=\"sm\" className=\"w-28\" />\n <Skeleton shape=\"control\" className=\"w-16\" />\n <Skeleton shape=\"control\" className=\"w-16\" />\n <div className=\"ml-auto flex items-center gap-1.5\">\n <Skeleton shape=\"control\" width=\"md\" />\n <Skeleton shape=\"control\" className=\"w-24\" />\n </div>\n </div>\n <div className=\"flex min-h-0 flex-1 flex-col gap-2\" data-table-records=\"\">\n <RecordsSkeleton layout={layout} embedded={embedded} {...(painted !== undefined ? { rows: painted } : {})} />\n </div>\n </div>\n </div>\n );\n}\n","/**\n * HOW MANY ROWS A TABLE HAD LAST TIME (lane STABLE-TABLES, Arman 2026-10-06: \"if a table renders\n * with an unknown number of rows, we'll have to figure out the best way to handle that by\n * following the best apps in the world\").\n *\n * The champions' rule for a count nobody knows yet: Airtable paints placeholder rows to the\n * frame's edge; Notion's inline database paints a short fixed run. Both still jump once the real\n * count lands. Linear does not, because it paints from its local cache. This is the cache-sized\n * part of Linear's answer: the count a table showed the last time this browser opened it (per\n * table and per place), so a return visit paints exactly the rows it will get and nothing moves.\n * A first visit falls back to the champions' rule (`fallback`). Pure storage; never throws.\n */\n\nconst PREFIX = \"records-ui:rows:\";\nconst MAX = 100;\n\nfunction storage(): Storage | null {\n try {\n return typeof window !== \"undefined\" && window.localStorage ? window.localStorage : null;\n } catch {\n return null;\n }\n}\n\n/** The rows to paint while a first read is out: last time's count (capped at `cap`), else `fallback`. */\nexport function rememberedRowCount<F extends number | \"fill\">(key: string, cap: number, fallback: F): number | F {\n const held = storage()?.getItem(PREFIX + key);\n const n = held == null ? NaN : Number(held);\n if (!Number.isFinite(n) || n < 0) return fallback;\n return Math.max(1, Math.min(cap, MAX, Math.round(n)));\n}\n\n/** Keep the count the table just showed. Zero is kept as one row: the empty state's own frame. */\nexport function rememberRowCount(key: string, count: number): void {\n try {\n storage()?.setItem(PREFIX + key, String(Math.max(0, Math.min(MAX, Math.round(count)))));\n } catch {\n // A full or refused storage only costs the next visit its exact count.\n }\n}\n\nconst LAYOUT_PREFIX = \"records-ui:layout:\";\n\n/**\n * THE LAYOUT A TABLE SHOWED LAST TIME (lane TAIL-FIX). A frame drawn before the table's saved view,\n * look and host layouts are read (the route's loading frame, the page's first-read frame) cannot know\n * whether this person opens it as a grid or a board, so it painted the grid and then switched, 300 to\n * 450ms later (Cleanings, 3 of 3 loads). The layout the page settled on is kept per table in this\n * browser, so a return visit's first frame already is the final layout. A first visit has nothing to\n * remember and keeps the grid skeleton. Pure storage; never throws.\n */\nexport function rememberedLayout(tableId: string): string | null {\n const held = storage()?.getItem(LAYOUT_PREFIX + tableId);\n return held && /^[a-z_-]{2,24}$/.test(held) ? held : null;\n}\n\n/** Keep the layout the table just settled on. */\nexport function rememberLayout(tableId: string, layout: string): void {\n try {\n storage()?.setItem(LAYOUT_PREFIX + tableId, layout);\n } catch {\n // A full or refused storage only costs the next visit its first-frame layout.\n }\n}\n"],"mappings":";;;;;;;AAsBO,IAAM,2BAA6D;AAAA,EACxE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,SAAS,kBAAkB,QAA0D;AAC1F,MAAI,WAAW,WAAW,WAAW,WAAY,QAAO;AACxD,SAAQ,yBAA+C,SAAS,UAAU,EAAE,IACvE,SACD;AACN;AASO,IAAM,kBAAkB;AACxB,IAAM,qBAAqB;AAC3B,IAAM,qBAAqB;AAC3B,IAAM,mBAAmB;AAEzB,IAAM,8BAA8B;AAEpC,IAAM,qBAAqB;AAO3B,SAAS,gBAAgB,aAAwC,UAAiC;AACvG,MAAI,OAAO,gBAAgB,YAAY,CAAC,OAAO,SAAS,WAAW,KAAK,cAAc,EAAG,QAAO;AAChG,SAAO,KAAK,IAAI,KAAK,MAAM,WAAW,GAAG,QAAQ;AACnD;AAGO,SAAS,mBAAmB,MAAsB;AACvD,SAAO,mBAAmB,qBAAqB,kBAAkB,QAAQ,OAAO,IAAI,qBAAqB;AAC3G;AAOO,SAAS,mBAAmB,QAA8C,UAAmC;AAClH,MAAI,CAAC,MAAM,QAAQ,MAAM,KAAK,OAAO,WAAW,EAAG,QAAO;AAC1D,QAAM,MAAgB,CAAC;AACvB,aAAW,KAAK,QAAQ;AACtB,QAAI,OAAO,MAAM,YAAY,CAAC,OAAO,SAAS,CAAC,KAAK,IAAI,EAAG,QAAO;AAClE,QAAI,KAAK,KAAK,IAAI,KAAK,MAAM,CAAC,GAAG,QAAQ,CAAC;AAAA,EAC5C;AACA,SAAO;AACT;;;ACnEA,SAAS,eAAe,YAAY,SAAS,4BA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UAAU,QAAQ,aAAa,eAAe,SAAS,SAAY;AACzE,SACE,oBAAC,SAAI,WAAW,GAAG,wBAAwB,SAAS,GAAG,8BAA4B,QACjF,+BAAC,SAAI,WAAW,yBACd;AAAA,yBAAC,SAAI,WAAW,yBAAyB,sBAAmB,IAAG,8BAA2B,WAAU,eAAY,QAC9G;AAAA,0BAAC,YAAS,OAAM,WAAU,OAAM,MAAK,WAAU,QAAO;AAAA,MACtD,oBAAC,YAAS,OAAM,WAAU,WAAU,QAAO;AAAA,MAC3C,oBAAC,YAAS,OAAM,WAAU,WAAU,QAAO;AAAA,MAC3C,qBAAC,SAAI,WAAU,qCACb;AAAA,4BAAC,YAAS,OAAM,WAAU,OAAM,MAAK;AAAA,QACrC,oBAAC,YAAS,OAAM,WAAU,WAAU,QAAO;AAAA,SAC7C;AAAA,OACF;AAAA,IACA,oBAAC,SAAI,WAAU,sCAAqC,sBAAmB,IACrE,8BAAC,mBAAgB,QAAgB,UAAqB,GAAI,YAAY,SAAY,EAAE,MAAM,QAAQ,IAAI,CAAC,GAAI,GAC7G;AAAA,KACF,GACF;AAEJ;","names":[]}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
isYearValue,
|
|
6
6
|
shownAsOf,
|
|
7
7
|
useEmbeddedLook
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-D7LNXDKV.js";
|
|
9
9
|
import {
|
|
10
10
|
HtmlSampleFrame,
|
|
11
11
|
HtmlSampleTokensProvider
|
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
useTableRights,
|
|
65
65
|
withoutInternalCodes,
|
|
66
66
|
writeOnTheWinningVersion_exports
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-HEPOU6ZX.js";
|
|
68
68
|
import {
|
|
69
69
|
kindItemWords,
|
|
70
70
|
kindLabel,
|
|
@@ -4637,7 +4637,7 @@ import { OutboundLink as OutboundLink5 } from "@ai-matrx/kit/outbound-react";
|
|
|
4637
4637
|
import { humanizeIdentifier } from "@ai-matrx/kit/text-case";
|
|
4638
4638
|
import { momentZoneOptions } from "@ai-matrx/design-system/field-formats";
|
|
4639
4639
|
import { jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4640
|
-
var SaveToTable = lazy(() => import("./SaveToTable-
|
|
4640
|
+
var SaveToTable = lazy(() => import("./SaveToTable-RV553LQL.js").then((m) => ({ default: m.SaveToTable })));
|
|
4641
4641
|
var LONGEST_READ = 5e5;
|
|
4642
4642
|
var FENCE = /^```(?:json)?[ \t]*\r?\n([\s\S]*?)\r?\n?```$/;
|
|
4643
4643
|
function isPlainObject(v) {
|
|
@@ -14307,4 +14307,4 @@ export {
|
|
|
14307
14307
|
RecordNameText,
|
|
14308
14308
|
HeldChangeDecision
|
|
14309
14309
|
};
|
|
14310
|
-
//# sourceMappingURL=chunk-
|
|
14310
|
+
//# sourceMappingURL=chunk-YQW2T27M.js.map
|
package/dist/first-page.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/presentation.ts","../src/viewKeys.ts","../src/firstPage.ts"],"names":["parseTableStyle","tableStyleIsEmpty","raw","base","bindFirstPageCodec"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBO,SAAS,eAAe,GAAA,EAAqC;AAClE,EAAA,IAAI,CAAC,OAAO,OAAO,GAAA,KAAQ,YAAY,KAAA,CAAM,OAAA,CAAQ,GAAG,CAAA,EAAG,OAAO,MAAA;AAClE,EAAA,MAAM,CAAA,GAAI,GAAA;AACV,EAAA,MAAM,MAAiB,EAAC;AACxB,EAAA,IAAI,CAAA,CAAE,MAAM,CAAA,KAAM,IAAA,MAAU,IAAA,GAAO,IAAA;AACnC,EAAA,IAAI,CAAA,CAAE,UAAU,CAAA,KAAM,IAAA,MAAU,QAAA,GAAW,IAAA;AAC3C,EAAA,KAAA,MAAW,KAAK,CAAC,UAAA,EAAY,aAAa,eAAA,EAAiB,aAAA,EAAe,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A;;;AChBnD,IAAM,cAAA,GAAiBC,6BAAmB,qBAAqB,CAAA;AACxD,IAAM,uBAA+D,cAAA,CAAe;AACpF,IAAM,mBAAuD,cAAA,CAAe","file":"first-page.cjs","sourcesContent":["/**\n * The Gantt mode of a timeline view, by Field key. `mode` turns the left task list on; `critical` paints the longest\n * chain; `progress` is a percent/number column; `milestone` a yes/no column; `baselineStart` / `baselineEnd` the two\n * date columns \"Save baseline\" writes; `dependency` the link column that dependencies are written to.\n */\nexport interface GanttLook {\n mode?: boolean;\n critical?: boolean;\n progress?: string;\n milestone?: string;\n baselineStart?: string;\n baselineEnd?: string;\n dependency?: string;\n}\n\n/** Read a stored Gantt look; unknown keys and wrong shapes are dropped. */\nexport function parseGanttLook(raw: unknown): GanttLook | undefined {\n if (!raw || typeof raw !== \"object\" || Array.isArray(raw)) return undefined;\n const v = raw as Record<string, unknown>;\n const out: GanttLook = {};\n if (v[\"mode\"] === true) out.mode = true;\n if (v[\"critical\"] === true) out.critical = true;\n for (const k of [\"progress\", \"milestone\", \"baselineStart\", \"baselineEnd\", \"dependency\"] as const) {\n const x = v[k];\n if (typeof x === \"string\" && x !== \"\") out[k] = x;\n }\n return Object.keys(out).length > 0 ? out : undefined;\n}\n\n/**\n * HOW A TABLE LOOKS — colors, formats and the frozen column.\n *\n * THE SPLIT, AND WHY IT IS THIS ONE. A Field declares WHAT it holds: a\n * currency, a percent, a date, a person. A VIEW declares HOW that reads and\n * what it is worth looking at: two decimal places or none, tint the row when\n * Status is Blocked, keep Name in place while the rest scrolls. Airtable draws\n * the line in exactly this place, and it has to be here: two people read one\n * table two different ways, and neither reading is a fact about the records.\n *\n * So nothing in this module is a new column on a Field and nothing here needed\n * a migration. A presentation lives on the saved-view record (`views.ts`), which\n * is an ordinary record of an ordinary Table — which means an agent sets it\n * through the same `records` tool it uses for everything else, and it travels\n * with the table the way every other record does.\n *\n * A FIELD STILL GETS ITS MONEY RIGHT WITH NO CONFIGURATION. `formatForField`\n * reads the Field's OWN declaration — a `currency` parity type with unit `$`, a\n * `percent`, a `datetime` with `config.kind` — and returns the format that\n * follows from it. The view's `formats` map only OVERRIDES that. A table nobody\n * has ever styled still shows `$1,250.50` and `45%`.\n */\n\n// The style parser from its own client-free subpath (lane SSR-ROWS): `@ai-matrx/records-ui/first-page`\n// runs in a host's SERVER component, and every export of the \"use client\" `data-table` entry is a\n// client reference there — calling `parseTableStyle` through it threw on the server.\nimport { COLOR_ROTATION, parseTableStyle, tableStyleIsEmpty } from \"@ai-matrx/design-system/data-table/table-style\";\nimport type {\n ChoiceColorLookup,\n GroupAggregateKind,\n GroupAggregateSpec,\n GroupOrder,\n StyleColor,\n TableStyle,\n} from \"@ai-matrx/design-system/data-table\";\nimport { getFieldFormat, type FieldFormatConfig } from \"@ai-matrx/design-system/field-formats\";\nimport type { ColorRule } from \"@ai-matrx/design-system/data-table\";\nimport { newerKindOf, ratingMaxOf } from \"@ai-matrx/records/field-kinds\";\nimport type { Field, TableDecorations } from \"@ai-matrx/records\";\n\nimport { editorKindFor } from \"./parity\";\nimport { dateFormatFor } from \"./dates\";\n\n/**\n * SECTIONS BY A FIELD — the view's own grouping.\n *\n * `field` is a Field KEY, exactly like `frozen` and the keys of `formats`,\n * because a view is written against the Table's declaration and never against\n * whatever id a screen happened to build its columns with.\n *\n * `aggregates` is keyed by Field key too, and `collapsed` holds the data\n * table's own group keys (`s:Blocked`, `n:3`, `empty`), which is what the\n * primitive emits and the only thing that survives a value rendering the same\n * text as another.\n *\n * NOTHING HERE IS EVER CALLED `valueOf`, `toString` or `hasOwnProperty`: every\n * object in JavaScript already has all three, so an optional field by one of\n * those names is NEVER absent and a `config.valueOf ? … : …` check silently\n * reads `Object.prototype`. It cost the primitive a whole grouping once.\n */\nexport type GridGrouping = {\n /** The Field key whose value makes the sections. */\n field: string;\n /** Per-Field-key subtotal on every section header. */\n aggregates?: Record<string, GroupAggregateSpec>;\n /** Section order. The primitive's default is `value-asc`; blanks sort last. */\n order?: GroupOrder;\n /** The sections this view keeps shut, by the primitive's own group key. */\n collapsed?: string[];\n /** The grouped column stays drawn as a column (Airtable). Absent = shown; `false` = the person stepped it aside. */\n showColumn?: boolean;\n /**\n * SUB-GROUPS (lane S1-PRIME VIEW-KEYS; ui-bench LISTS \"sub-grouping\"): up to two more levels\n * inside each section, by Field key. At most three levels in all — the store refuses a fourth\n * (`custom.view_declare`). A layout that draws one level ignores the rest; it never drops them,\n * because this list is parsed and written back whole with the rest of the look.\n */\n then?: GridSubGroup[];\n /**\n * DRILL (lane DRILL-TABLE-PRIMITIVE): the Dimension pivoted across the top — a Field key, or\n * `<key>:<grain>` for a date cut into periods.\n */\n across?: string;\n /** DRILL: the period `field` is cut into when it is a date (`month`); the store keeps `field` a Field key. */\n grain?: string;\n /** The Measures shown (\"what to display\"), by the store's own keys (`count`, `sum_quantity`). */\n show?: string[];\n /** The drill trail, in order: each crumb a Dimension reference and the value it narrowed to. */\n trail?: GridDrillStep[];\n};\n\n/** One crumb of a saved drill trail. `value: null` is \"no value\". */\nexport type GridDrillStep = { dim: string; value: string | null };\n\n/** One sub-group level: a Field key and its section order. */\nexport type GridSubGroup = { field: string; order?: GroupOrder; grain?: string };\n\n/** Everything a view says about how its table LOOKS. */\nexport type GridPresentation = {\n /** Color-by-a-column, rules and manual highlights. */\n style?: TableStyle;\n /** Per-column format overrides, by the Field's key. */\n formats?: Record<string, FieldFormatConfig>;\n /**\n * The columns that stay in place while the table scrolls sideways, by Field\n * key. Only the LEADING run of the view's column order can actually freeze —\n * the data table decides that, and declines rather than pinning a column at a\n * guessed offset.\n */\n frozen?: string[];\n /** Collapsible sections by one Field, with subtotals on each header. */\n grouping?: GridGrouping;\n /**\n * The width a person dragged a column to, by Field key. SPARSE on purpose —\n * a view saved before widths existed carries none and still parses, and a\n * column nobody resized is left to the table's own measurement.\n */\n widths?: Record<string, number>;\n /** The body row height this view remembers, in px. */\n rowHeight?: number;\n /**\n * Field keys hidden from this view — the SAME hidden-column list the grid's\n * own column picker holds, now given a place on the view so it survives a\n * reload and a layout switch reads the identical set gallery and grid agree\n * on, rather than a second \"fields shown\" list nobody kept in sync.\n */\n hiddenFields?: string[];\n /**\n * THE FIELDS A CARD LEAVES OFF (board, list, gallery, calendar, timeline), by Field key — the\n * card's own choice, kept apart from `hiddenFields` so a board's \"Card fields\" never hides the\n * grid's columns when the view switches layout (v7 TABLE-EXPERIENCE, walk 2026-10-05). An empty\n * list is a choice (every field shown); absent means the card never chose.\n */\n cardHidden?: string[];\n /**\n * THE ORDER A PERSON DRAGGED THE COLUMNS INTO, by Field key (merge tranche 6a). Sparse like\n * `widths`: a key it does not name keeps its Field's own place after the named ones, and a key\n * whose Field is gone is skipped — a column order can never hide or invent a column.\n */\n columnOrder?: string[];\n /**\n * The gallery's card size, remembered the same way the grid remembers its\n * row height — a per-view look, not a global default.\n */\n gallerySize?: \"small\" | \"medium\" | \"large\";\n /**\n * THE BOARD'S OWN LOOK (lane BOARD-SWIMLANES, Notion's board options). All kept on the view, all\n * read only by the kanban layout. Absent means the board's default: columns wear their choice's\n * color, each heading shows its count, empty columns and lanes are drawn, cards are medium with\n * no preview.\n * boardSize card size: sets the column width, the preview's height and, small, drops the card's extras\n * boardPreview the FILE field drawn as a cover at the top of each card (absent = no preview)\n * boardHideEmpty leave out a column or a lane that holds no card\n * boardColorColumns false = neutral headings, no accent bar on the cards\n * boardCounts false = no count beside the heading\n * boardLanesShut the swimlanes kept shut to a strip, by the lane's name\n */\n boardSize?: \"small\" | \"medium\" | \"large\";\n boardPreview?: string;\n boardHideEmpty?: boolean;\n boardColorColumns?: boolean;\n boardCounts?: boolean;\n boardLanesShut?: string[];\n /**\n * A CHART VIEW'S MENU (PIVOT-VIEW): `chartLabels` draws each mark's value on it (the chart menu's \"Data labels\"\n * switch); `chartLegend: false` leaves the legend off. Read only by the chart layout.\n */\n chartLabels?: boolean;\n chartLegend?: boolean;\n /**\n * A LOCKED VIEW (lane NOTION-SMALL-2): its layout, filters, sorts and settings are not saved over until\n * somebody unlocks it. An editing convenience against an accidental change, never a permission.\n */\n locked?: boolean;\n /**\n * THIS VIEW'S OWN LAYOUT CHOICES, over the organization's `custom/grid_layout` knob (lane\n * DEFAULT-GRID-PARITY, TABLE-PARITY D1 D5 D6). Absent means \"whatever the organization\n * says\"; present is the view's word. `freezeFirst: false` is an explicit NO over an\n * organization that freezes the first column — an empty `frozen` cannot say that.\n */\n wrap?: boolean;\n /** AIRTABLE'S \"WRAP FIELD HEADERS\": column titles take a second line instead of being cut. Absent = one line. */\n headerWrap?: boolean;\n /** NOTION'S \"WRAP COLUMN\" (N5): the columns that wrap their text when the view as a whole does not. */\n wrapColumns?: string[];\n fit?: \"auto\" | \"fit\" | \"scroll\";\n freezeFirst?: boolean;\n /**\n * THE SUMMARY BAR (TABLE-PARITY F1): Field key → the store measure shown under that column\n * (`count`, `sum`, `avg`, `min`, `max`, `median`, `filled`, `empty`, `unique`), worked out\n * by `custom.record_aggregate` over the whole table.\n */\n summaries?: Record<string, string>;\n /** THE TIMELINE'S GANTT MODE (kept as `presentation.gantt`): see `GanttLook`. */\n gantt?: GanttLook;\n /**\n * WHERE THE FOOTER SITS (lane TABLE-PAGE-CHROME, owner 2026-09-25) — the row count and the\n * pages: `sticky`, pinned to the bottom of the screen while the rows scroll (the older grid's\n * way, and the default when a view says nothing), or `inline`, right after the last row with\n * the page scrolling. Read by the Grid and a host's Sheet.\n */\n footer?: FooterPlacement;\n};\n\n/** Where a grid's footer sits. */\nexport type FooterPlacement = \"sticky\" | \"inline\";\n\n/** What a view that says nothing gets — the older grid's pinned footer. */\nexport const DEFAULT_FOOTER: FooterPlacement = \"sticky\";\n\n/** Where THIS view's footer sits, said or defaulted. */\nexport function footerOf(p: GridPresentation | null | undefined): FooterPlacement {\n return p?.footer ?? DEFAULT_FOOTER;\n}\n\nexport const EMPTY_PRESENTATION: GridPresentation = {};\n\n/** A frozen column needs a known width, or the table declines to freeze at all. */\nexport const FROZEN_COLUMN_WIDTH = 200;\n\n/**\n * WHAT A ROW HEIGHT IS ALLOWED TO BE. Below the floor the text is clipped and\n * no editor fits; above the ceiling one record fills the screen. A view asking\n * for anything outside it is DROPPED rather than obeyed, because a saved look\n * must not be able to make a table unreadable — and the Fields' own heights\n * still draw, which is the tolerant half.\n */\nexport const MIN_ROW_HEIGHT = 24;\nexport const MAX_ROW_HEIGHT = 240;\n\n/**\n * The aggregate kinds and orders the primitive actually implements. Listed here\n * because they are the tolerant parser's allow-list and a view is hostile input:\n * `satisfies` ties them to the primitive's own union, so a kind it renames stops\n * this file compiling instead of quietly parsing into a subtotal nobody draws.\n */\nconst AGGREGATE_KINDS = [\n \"count\",\n \"sum\",\n \"average\",\n \"min\",\n \"max\",\n \"empty\",\n \"filled\",\n \"unique\",\n \"checked\",\n \"unchecked\",\n \"percentFilled\",\n] as const satisfies readonly GroupAggregateKind[];\n\nconst GROUP_ORDERS = [\n \"value-asc\",\n \"value-desc\",\n \"count-desc\",\n \"first-seen\",\n] as const satisfies readonly GroupOrder[];\n\nfunction isRecord(v: unknown): v is Record<string, unknown> {\n return typeof v === \"object\" && v !== null && !Array.isArray(v);\n}\n\n/**\n * Read a presentation out of whatever the view record holds — an object, or the\n * JSON string a text field stores.\n *\n * Tolerant in exactly the way `parseTableStyle` is: an unreadable half is\n * dropped and the rest still applies, because a table must keep drawing when\n * one piece of its styling goes out of date.\n */\nexport function parseGridPresentation(raw: unknown): GridPresentation {\n let value = raw;\n if (typeof value === \"string\") {\n const trimmed = value.trim();\n if (trimmed === \"\") return {};\n try {\n value = JSON.parse(trimmed);\n } catch {\n return {};\n }\n }\n if (!isRecord(value)) return {};\n\n const out: GridPresentation = {};\n\n const style = parseTableStyle(value[\"style\"]);\n if (!tableStyleIsEmpty(style)) out.style = style;\n\n if (isRecord(value[\"formats\"])) {\n const formats: Record<string, FieldFormatConfig> = {};\n for (const [key, cfg] of Object.entries(value[\"formats\"])) {\n if (!isRecord(cfg)) continue;\n const id = cfg[\"id\"];\n if (typeof id !== \"string\") continue;\n const options = cfg[\"options\"];\n formats[key] = isRecord(options)\n ? {\n id: id as FieldFormatConfig[\"id\"],\n options: options as NonNullable<FieldFormatConfig[\"options\"]>,\n }\n : { id: id as FieldFormatConfig[\"id\"] };\n }\n if (Object.keys(formats).length > 0) out.formats = formats;\n }\n\n if (Array.isArray(value[\"frozen\"])) {\n const frozen = value[\"frozen\"].filter((k): k is string => typeof k === \"string\");\n if (frozen.length > 0) out.frozen = frozen;\n }\n\n const grouping = parseGrouping(value[\"grouping\"]);\n if (grouping) out.grouping = grouping;\n\n if (isRecord(value[\"widths\"])) {\n const widths: Record<string, number> = {};\n for (const [key, raw] of Object.entries(value[\"widths\"])) {\n // A width that is not a usable number is one column's loss, never the\n // view's: the rest of the widths still apply and that column is measured.\n if (typeof raw !== \"number\" || !Number.isFinite(raw) || raw <= 0) continue;\n widths[key] = Math.round(raw);\n }\n if (Object.keys(widths).length > 0) out.widths = widths;\n }\n\n const rowHeight = value[\"rowHeight\"];\n if (\n typeof rowHeight === \"number\" &&\n Number.isFinite(rowHeight) &&\n rowHeight >= MIN_ROW_HEIGHT &&\n rowHeight <= MAX_ROW_HEIGHT\n ) {\n out.rowHeight = Math.round(rowHeight);\n }\n\n if (Array.isArray(value[\"hiddenFields\"])) {\n const hiddenFields = value[\"hiddenFields\"].filter((k): k is string => typeof k === \"string\");\n if (hiddenFields.length > 0) out.hiddenFields = hiddenFields;\n }\n if (Array.isArray(value[\"cardHidden\"])) {\n out.cardHidden = value[\"cardHidden\"].filter((k): k is string => typeof k === \"string\");\n }\n\n if (Array.isArray(value[\"columnOrder\"])) {\n const columnOrder = value[\"columnOrder\"].filter((k): k is string => typeof k === \"string\");\n if (columnOrder.length > 0) out.columnOrder = columnOrder;\n }\n\n const gallerySize = value[\"gallerySize\"];\n if (gallerySize === \"small\" || gallerySize === \"medium\" || gallerySize === \"large\") {\n out.gallerySize = gallerySize;\n }\n\n const boardSize = value[\"boardSize\"];\n if (boardSize === \"small\" || boardSize === \"medium\" || boardSize === \"large\") out.boardSize = boardSize;\n if (typeof value[\"boardPreview\"] === \"string\" && value[\"boardPreview\"] !== \"\") out.boardPreview = value[\"boardPreview\"];\n if (typeof value[\"boardHideEmpty\"] === \"boolean\") out.boardHideEmpty = value[\"boardHideEmpty\"];\n if (typeof value[\"boardColorColumns\"] === \"boolean\") out.boardColorColumns = value[\"boardColorColumns\"];\n if (typeof value[\"boardCounts\"] === \"boolean\") out.boardCounts = value[\"boardCounts\"];\n if (typeof value[\"chartLabels\"] === \"boolean\") out.chartLabels = value[\"chartLabels\"];\n if (typeof value[\"chartLegend\"] === \"boolean\") out.chartLegend = value[\"chartLegend\"];\n if (value[\"locked\"] === true) out.locked = true;\n if (Array.isArray(value[\"boardLanesShut\"])) {\n const shut = value[\"boardLanesShut\"].filter((k): k is string => typeof k === \"string\");\n if (shut.length > 0) out.boardLanesShut = shut;\n }\n\n if (typeof value[\"wrap\"] === \"boolean\") out.wrap = value[\"wrap\"];\n if (typeof value[\"headerWrap\"] === \"boolean\") out.headerWrap = value[\"headerWrap\"];\n if (Array.isArray(value[\"wrapColumns\"])) {\n const wrapColumns = value[\"wrapColumns\"].filter((k): k is string => typeof k === \"string\");\n if (wrapColumns.length > 0) out.wrapColumns = wrapColumns;\n }\n const fit = value[\"fit\"];\n if (fit === \"auto\" || fit === \"fit\" || fit === \"scroll\") out.fit = fit;\n if (typeof value[\"freezeFirst\"] === \"boolean\") out.freezeFirst = value[\"freezeFirst\"];\n const footer = value[\"footer\"];\n if (footer === \"sticky\" || footer === \"inline\") out.footer = footer;\n {\n const gantt = parseGanttLook(value[\"gantt\"]);\n if (gantt) out.gantt = gantt;\n }\n if (isRecord(value[\"summaries\"])) {\n const summaries: Record<string, string> = {};\n for (const [key, op] of Object.entries(value[\"summaries\"])) {\n // A measure name is judged by the store when it is asked; a non-string is nobody's.\n if (typeof op === \"string\" && op.trim() !== \"\") summaries[key] = op;\n }\n if (Object.keys(summaries).length > 0) out.summaries = summaries;\n }\n\n return out;\n}\n\n/**\n * A grouping, or nothing. A grouping with no Field to group BY is not a partial\n * grouping — it is no grouping at all, so it is dropped whole; an unreadable\n * subtotal or a section order this primitive does not have costs only itself.\n */\nfunction parseGrouping(raw: unknown): GridGrouping | undefined {\n if (!isRecord(raw)) return undefined;\n const field = raw[\"field\"];\n if (typeof field !== \"string\" || field.trim() === \"\") return undefined;\n\n const out: GridGrouping = { field };\n\n if (isRecord(raw[\"aggregates\"])) {\n const aggregates: Record<string, GroupAggregateSpec> = {};\n for (const [key, spec] of Object.entries(raw[\"aggregates\"])) {\n if (!isRecord(spec)) continue;\n const kind = spec[\"kind\"];\n if (typeof kind !== \"string\") continue;\n if (!(AGGREGATE_KINDS as readonly string[]).includes(kind)) continue;\n const label = spec[\"label\"];\n aggregates[key] =\n typeof label === \"string\"\n ? { kind: kind as GroupAggregateKind, label }\n : { kind: kind as GroupAggregateKind };\n }\n if (Object.keys(aggregates).length > 0) out.aggregates = aggregates;\n }\n\n const order = raw[\"order\"];\n if (typeof order === \"string\" && (GROUP_ORDERS as readonly string[]).includes(order)) {\n out.order = order as GroupOrder;\n }\n\n if (Array.isArray(raw[\"collapsed\"])) {\n const collapsed = raw[\"collapsed\"].filter((k): k is string => typeof k === \"string\");\n if (collapsed.length > 0) out.collapsed = collapsed;\n }\n\n if (typeof raw[\"showColumn\"] === \"boolean\") out.showColumn = raw[\"showColumn\"];\n\n if (Array.isArray(raw[\"then\"])) {\n const then: GridSubGroup[] = [];\n for (const level of raw[\"then\"]) {\n if (!isRecord(level)) continue;\n const sub = level[\"field\"];\n if (typeof sub !== \"string\" || sub.trim() === \"\") continue;\n const subOrder = level[\"order\"];\n const subGrain = level[\"grain\"];\n then.push({\n field: sub,\n ...(typeof subOrder === \"string\" && (GROUP_ORDERS as readonly string[]).includes(subOrder)\n ? { order: subOrder as GroupOrder }\n : {}),\n ...(typeof subGrain === \"string\" && subGrain !== \"\" ? { grain: subGrain } : {}),\n });\n }\n if (then.length > 0) out.then = then.slice(0, 2);\n }\n\n const grain = raw[\"grain\"];\n if (typeof grain === \"string\" && grain !== \"\") out.grain = grain;\n const across = raw[\"across\"];\n if (typeof across === \"string\" && across.trim() !== \"\") out.across = across;\n if (Array.isArray(raw[\"show\"])) {\n const show = raw[\"show\"].filter((k): k is string => typeof k === \"string\" && k !== \"\");\n if (show.length > 0) out.show = show;\n }\n if (Array.isArray(raw[\"trail\"])) {\n const trail: GridDrillStep[] = [];\n for (const step of raw[\"trail\"]) {\n if (!isRecord(step) || typeof step[\"dim\"] !== \"string\" || step[\"dim\"] === \"\") continue;\n const value = step[\"value\"];\n if (value !== null && typeof value !== \"string\") continue;\n trail.push({ dim: step[\"dim\"], value });\n }\n if (trail.length > 0) out.trail = trail;\n }\n\n return out;\n}\n\n/** True when nothing here would change how anything looks. */\nexport function presentationIsEmpty(p: GridPresentation): boolean {\n return (\n (p.style === undefined || tableStyleIsEmpty(p.style)) &&\n Object.keys(p.formats ?? {}).length === 0 &&\n (p.frozen?.length ?? 0) === 0 &&\n p.grouping === undefined &&\n Object.keys(p.widths ?? {}).length === 0 &&\n p.rowHeight === undefined &&\n (p.hiddenFields?.length ?? 0) === 0 &&\n p.cardHidden === undefined &&\n (p.columnOrder?.length ?? 0) === 0 &&\n p.gallerySize === undefined &&\n p.boardSize === undefined &&\n p.boardPreview === undefined &&\n p.boardHideEmpty === undefined &&\n p.boardColorColumns === undefined &&\n p.boardCounts === undefined &&\n (p.boardLanesShut?.length ?? 0) === 0 &&\n p.chartLabels === undefined &&\n p.chartLegend === undefined &&\n p.locked === undefined &&\n p.wrap === undefined &&\n p.headerWrap === undefined &&\n p.fit === undefined &&\n p.freezeFirst === undefined &&\n p.footer === undefined &&\n Object.keys(p.summaries ?? {}).length === 0 &&\n p.gantt === undefined\n );\n}\n\n/** The string a view record stores. Empty string for \"this view styles nothing\". */\nexport function presentationDocument(p: GridPresentation): string {\n return presentationIsEmpty(p) ? \"\" : JSON.stringify(p);\n}\n\n/** Kinds whose value is a control the record renderer draws, never a formatter's string. */\nconst DRAWN_KINDS = new Set([\"select\", \"multi_select\", \"relation\", \"member\", \"person\", \"attachment\", \"file\", \"entity_reference\", \"checkbox\", \"boolean\", \"signature\", \"json\"]);\n\n/**\n * The display format a column's settings chose for it, when it is one the platform registry\n * knows and the column is not one the record renderer draws itself. `undefined` otherwise.\n */\nexport function shownAsOf(field: Field): FieldFormatConfig | undefined {\n if (DRAWN_KINDS.has(String(editorKindFor(field)))) return undefined;\n const raw = (field as unknown as { display_format?: unknown }).display_format;\n if (!raw || typeof raw !== \"object\") return undefined;\n const id = (raw as { id?: unknown }).id;\n // `formula` is the column's KIND, never a look: a worked-out column shows as its result format.\n if (typeof id !== \"string\" || id === \"formula\" || !getFieldFormat(id)) return undefined;\n const options = (raw as { options?: unknown }).options;\n return options && typeof options === \"object\" && Object.keys(options).length > 0\n ? ({ id, options } as FieldFormatConfig)\n : ({ id } as FieldFormatConfig);\n}\n\n/**\n * The format a Field's OWN declaration implies, before any view says anything.\n *\n * Returns `undefined` for a Field whose value the record renderer already draws\n * better than a formatter could — a relation chip, a person, an attachment, a\n * choice — because handing those to a text formatter would REPLACE a working\n * control with a string.\n */\n/**\n * A COLUMN THAT HOLDS YEARS (\"Founded\", \"Year\", \"Year built\", \"Established\", \"Model year\"…).\n * A year is a number that is never grouped: \"Founded 2,008\" read as a quantity (lane RECORD-PAGE-UI,\n * 2026-10-15). Known by its name; a value is printed as a year only when it is also a whole number\n * from 1000 to 2999 (`isYearValue`).\n */\nconst YEAR_NAMES = /(^|[\\s_-])(year|founded|established|incorporated|vintage)([\\s_-]|$)/i;\nexport function isYearField(field: Pick<Field, \"key\" | \"label\">): boolean {\n return YEAR_NAMES.test(String(field.label ?? \"\")) || YEAR_NAMES.test(field.key);\n}\nexport function isYearValue(value: unknown): boolean {\n return typeof value === \"number\" && Number.isInteger(value) && value >= 1000 && value <= 2999;\n}\n/** A number format with its grouping off for a year column, unless the column chose grouping itself. */\nfunction ungroupedForYears(field: Field, format: FieldFormatConfig): FieldFormatConfig {\n if (format.id !== \"number\" || !isYearField(field)) return format;\n const options = (format.options ?? {}) as Record<string, unknown>;\n if (options[\"useGrouping\"] !== undefined) return format;\n return { ...format, options: { ...options, useGrouping: false } };\n}\n\nexport function formatForField(field: Field): FieldFormatConfig | undefined {\n // \"SHOWS AS\" — THE FORMAT THE COLUMN'S OWN SETTINGS CHOSE (merge tranche 6a/6e). The column\n // keeps it on the Field (`display_format`, written by `custom.field_update`), so the grid, the\n // record panel and the export read one answer. A column the record renderer draws better than\n // a formatter (a choice, a link, a person, a file) keeps its own drawing.\n const shownAs = shownAsOf(field);\n // A RATING'S TOP STAR IS ITS MAX RULE (lane 10 P4), so changing the rule changes the stars.\n if (newerKindOf(field) === \"rating\" && (!shownAs || shownAs.id === \"rating\")) {\n return { id: \"rating\", options: { ...(shownAs?.options ?? {}), ratingMax: ratingMaxOf(field) } };\n }\n if (shownAs) return ungroupedForYears(field, shownAs);\n // THE STORE'S OWN STAMPS (Created time, Last changed time) are instants and print like\n // every other date-and-time cell — `dates.ts` answers, the same helper every card reads.\n const stamp = dateFormatFor(field);\n if (stamp && editorKindFor(field) !== \"datetime\") return stamp;\n switch (editorKindFor(field)) {\n case \"currency\":\n return {\n id: \"currency\",\n options: { currency: currencyCodeFor(field.unit) },\n };\n case \"percent\":\n return { id: \"percent\" };\n case \"datetime\":\n // The COLUMN's declaration: a `kind: \"date\"` column is a date column, anything else can\n // hold a moment. Each VALUE is still printed in its own shape (`RecordValue` →\n // `dates.dateFormatFor(field, value)`), so a bare date in a datetime column reads as a date.\n return String(field.config?.[\"kind\"] ?? \"\") === \"date\" ? { id: \"date\" } : { id: \"datetime\" };\n case \"email\":\n return { id: \"email\" };\n case \"url\":\n return { id: \"url\" };\n case \"phone\":\n return { id: \"phone\" };\n case \"number\":\n return ungroupedForYears(field, { id: \"number\" });\n default:\n return undefined;\n }\n}\n\n/**\n * THE FORMAT ONE CELL OF A COLUMN IS DRAWN IN — the grid's cell and the gallery's card alike\n * (guard G4 \"one format\", lane VIEWS-AND-FIELDS W1-B): the view's own format for the column when\n * it set one, else the Field's own (`formatForField`). One function, so no layout formats money\n * (or a date, or a percent) its own way.\n */\nexport function cellFormatFor(field: Field, viewFormat?: FieldFormatConfig | undefined): FieldFormatConfig | undefined {\n return viewFormat ?? formatForField(field);\n}\n\n/**\n * The store lets a person type the SYMBOL they think in (`$`, `€`), and\n * `Intl.NumberFormat` wants the ISO code. The symbols people actually enter are\n * mapped; anything else is passed straight through, because a real ISO code is\n * the other thing that lands in this field, and an unknown code still renders\n * (`1,234.00 XYZ`) rather than blanking — THE FALLBACK LAW.\n */\nconst SYMBOL_TO_CODE: Record<string, string> = {\n $: \"USD\",\n \"£\": \"GBP\",\n \"€\": \"EUR\",\n \"¥\": \"JPY\",\n \"₹\": \"INR\",\n \"₽\": \"RUB\",\n \"₩\": \"KRW\",\n \"R$\": \"BRL\",\n \"C$\": \"CAD\",\n \"A$\": \"AUD\",\n};\n\nexport function currencyCodeFor(unit: string | null | undefined): string {\n const raw = (unit ?? \"\").trim();\n if (raw === \"\") return \"USD\";\n return SYMBOL_TO_CODE[raw] ?? raw.toUpperCase();\n}\n\n/**\n * The color a value paints with when a view colors BY a column.\n *\n * NOTHING FAILS SILENTLY, so this never returns \"no color\" for a value that\n * exists. The store keeps a list column's choices as records of another Table,\n * and this grid has not read that Table's option colors, so the color is\n * derived from the value's own text: the same word always gets the same color,\n * different words get different ones, and `true` is green the way every\n * checklist reads. When those option colors do land, this is the ONE function\n * that changes and every screen follows.\n */\nexport const colorFromTheValue: ChoiceColorLookup = (_fieldKey, value) => {\n if (value === true) return \"green\";\n if (value === false || value === null || value === undefined) return undefined;\n const text = String(value).trim().toLowerCase();\n if (text === \"\") return undefined;\n let hash = 0;\n for (let i = 0; i < text.length; i += 1) {\n hash = (hash * 31 + text.charCodeAt(i)) >>> 0;\n }\n return COLOR_ROTATION[hash % COLOR_ROTATION.length] as StyleColor;\n};\n\n/**\n * G1's TABLE-LEVEL COLORS (`custom.table_decorations` / `client.tableDecorations`),\n * TRANSLATED INTO A `TableStyle` — the same document a saved view's own `presentation.style`\n * is, so one resolver (`resolveTableStyle`, below) can treat \"the table's colors\" and \"this\n * view's colors\" as two layers of the SAME thing instead of two unrelated systems.\n *\n * THE TRANSLATION IS NECESSARY AND IT IS THE ONLY ONE. G1 addresses a Field by its ID\n * (REC-17 — a column renamed keeps its color), because it is the STORE's own door; a\n * `TableStyle` addresses a Field by its KEY, because it reads straight off `row.document`,\n * which is keyed by Field key. A rule or a color-by whose Field has been deleted (its id no\n * longer resolves to a key) is dropped rather than crashing the whole style — a defect in\n * one rule costs that rule, never the read.\n */\nexport function styleFromDecorations(\n decorations: TableDecorations | null | undefined,\n fields: readonly Field[],\n): TableStyle {\n if (!decorations) return { version: 1 };\n const keyOf = (id: string) => fields.find((f) => f.id === id)?.key;\n const style: TableStyle = { version: 1 };\n\n if (decorations.color_by?.field) {\n const field = keyOf(decorations.color_by.field);\n if (field) style.colorBy = { field, target: decorations.color_by.target };\n }\n\n if (Array.isArray(decorations.rules) && decorations.rules.length > 0) {\n const rules: ColorRule[] = [];\n decorations.rules.forEach((rule, index) => {\n const field = keyOf(rule.field);\n if (!field) return;\n rules.push({\n id: rule.id ?? `decoration:${index}`,\n field,\n op: rule.op,\n color: rule.color,\n target: rule.target,\n ...(rule.value === undefined || rule.value === null ? {} : { value: String(rule.value) }),\n });\n });\n if (rules.length > 0) style.rules = rules;\n }\n\n if (decorations.rows && Object.keys(decorations.rows).length > 0) {\n style.rows = { ...decorations.rows };\n }\n\n const columns: Record<string, StyleColor> = {};\n for (const [id, color] of Object.entries(decorations.columns ?? {})) {\n const key = keyOf(id);\n if (key) columns[key] = color;\n }\n if (Object.keys(columns).length > 0) style.columns = columns;\n\n const cells: Record<string, Record<string, StyleColor>> = {};\n for (const [rowId, byField] of Object.entries(decorations.cells ?? {})) {\n for (const [id, color] of Object.entries(byField ?? {})) {\n const key = keyOf(id);\n if (!key) continue;\n (cells[rowId] ??= {})[key] = color;\n }\n }\n if (Object.keys(cells).length > 0) style.cells = cells;\n\n return style;\n}\n\n/**\n * THE ONE PRESENTATION RESOLVER every colored surface in this package reads —\n * `Grid`, and (via `Card`) the kanban board, the calendar and the gallery.\n *\n * THE CLASS THIS CLOSES (lane UI-QUICK-1, TABLE-PARITY review, 2026-09-24). Threading\n * `view.presentation.style` into `Card` closed the instance the CALENDAR-GALLERY bench\n * found — a VIEW that had its own color-by looked right everywhere — but it left the\n * class open: a table whose colors are the ORGANIZATION's decorations (G1's\n * `custom.table_decorations` — \"color rows by Account Type\", \"MAXED and NEAR rules\" on\n * Arman's own Coding Accounts table) and whose views never set a `presentation.style` of\n * their own drew NOTHING, on the grid exactly as much as on every other layout, because\n * nothing in this package had ever read G1's door at all.\n *\n * TWO LAYERS, ONE DOCUMENT. The table's decorations are the base coat — what every view\n * of this table shows until a view says otherwise. A view's OWN `presentation.style` is\n * an override, piece by piece: a view that only ever set manual row highlights still\n * inherits the table's color-by and rules for everything it never touched, and a view\n * that fully redecorated (its own `colorBy` AND its own `rules`) is not haunted by a\n * table rule it meant to replace. Per-piece, never all-or-nothing, because a view is a\n * LOOK on top of the table, not a wholesale substitute for it.\n */\nexport function resolveTableStyle(\n decorations: TableDecorations | null | undefined,\n fields: readonly Field[],\n viewStyle: TableStyle | undefined,\n): TableStyle {\n const base = styleFromDecorations(decorations, fields);\n if (!viewStyle) return base;\n const colorBy = viewStyle.colorBy ?? base.colorBy;\n const rules = viewStyle.rules ?? base.rules;\n const rows = viewStyle.rows ?? base.rows;\n const columns = viewStyle.columns ?? base.columns;\n const cells = viewStyle.cells ?? base.cells;\n return {\n version: 1,\n ...(colorBy !== undefined ? { colorBy } : {}),\n ...(rules !== undefined ? { rules } : {}),\n ...(rows !== undefined ? { rows } : {}),\n ...(columns !== undefined ? { columns } : {}),\n ...(cells !== undefined ? { cells } : {}),\n };\n}\n","// src/viewKeys.ts — @ai-matrx/records-ui · lane S1-PRIME VIEW-KEYS\n//\n// THE VIEW-KEY REGISTRY MOVED TO `@ai-matrx/records/views` (step 10, 2026-10-08): the declared keys, the one\n// reader and the one writer are headless there. What stays here is this package's LOOK: the grid\n// presentation (colors, formats, frozen columns — `presentation.ts`, built on design-system) bound as the\n// view's presentation codec. Every name this file exported is unchanged.\n\nimport * as base from \"@ai-matrx/records/views\";\nimport { parseGridPresentation, presentationDocument, presentationIsEmpty, type GridPresentation } from \"./presentation\";\n\nexport {\n STORE_KEEPS_TIMELINE,\n STORE_KEPT_LAYOUTS,\n VIEW_KEYS,\n storeKeepsLayout,\n viewKeysFor,\n viewSettingsFor,\n type ViewKeyDeclaration,\n type ViewKeyLayout,\n type ViewKeyWriter,\n type ViewSortKey,\n} from \"@ai-matrx/records/views\";\n\n/** This package's look, as the view's presentation codec. */\nexport const gridPresentationCodec: base.ViewPresentationCodec<GridPresentation> = {\n parse: parseGridPresentation,\n isEmpty: presentationIsEmpty,\n toDocument: (presentation) => JSON.parse(presentationDocument(presentation)) as Record<string, unknown>,\n};\n\n/** EVERY DECLARED KEY OF A VIEW, TYPED, with this package's grid look. */\nexport type ViewSettings = base.ViewSettings<GridPresentation>;\nexport type ViewSettingsPatch = base.ViewSettingsPatch<GridPresentation>;\n\n/** Every view and look door with this package's grid look bound — bindings of records' one definition. */\nexport const boundViews = base.bindViewCodec<GridPresentation>(gridPresentationCodec);\n\n/** THE READER (a stored `definition` and the row's flat `filters` in, every declared key out) and THE WRITER'S SHAPE. */\nexport const { viewSettings, viewSettingsPatch } = boundViews;\n","// src/firstPage.ts — @ai-matrx/records-ui/first-page · lane PAGE-BUNDLE-2\n//\n// THE GRID'S FIRST PAGE, ASKED BEFORE THE GRID EXISTS. The logic lives in `@ai-matrx/records/first-page` (headless,\n// step 10, 2026-10-08); this entry binds this package's grid look (`gridPresentationCodec`) so a view is read exactly\n// as the screen reads it. No React here (server-safe entry).\n\nimport { bindFirstPageCodec } from \"@ai-matrx/records/first-page\";\nimport type { GridPresentation } from \"./presentation\";\nimport { gridPresentationCodec } from \"./viewKeys\";\n\nexport type { GridPresentation } from \"./presentation\";\n\nexport {\n EMBEDDED_PAGE_SIZE,\n TABLE_PAGE_SIZE,\n firstGridPageArgs,\n serverRowsOf,\n viewFilterOf,\n type FirstGridPageArgs,\n} from \"@ai-matrx/records/first-page\";\n\ntype BoundFirstPage = ReturnType<typeof bindFirstPageCodec<GridPresentation>>;\nconst boundFirstPage = bindFirstPageCodec(gridPresentationCodec);\nexport const firstGridPageRequest: BoundFirstPage[\"firstGridPageRequest\"] = boundFirstPage.firstGridPageRequest;\nexport const askTablePageSeed: BoundFirstPage[\"askTablePageSeed\"] = boundFirstPage.askTablePageSeed;\n\n// Entity blocks and chart tiles (lane SEED-ENTITY).\nexport * from \"./firstPageEntity\";\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/presentation.ts","../src/viewKeys.ts","../src/firstPage.ts"],"names":["parseTableStyle","tableStyleIsEmpty","raw","base","bindFirstPageCodec"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBO,SAAS,eAAe,GAAA,EAAqC;AAClE,EAAA,IAAI,CAAC,OAAO,OAAO,GAAA,KAAQ,YAAY,KAAA,CAAM,OAAA,CAAQ,GAAG,CAAA,EAAG,OAAO,MAAA;AAClE,EAAA,MAAM,CAAA,GAAI,GAAA;AACV,EAAA,MAAM,MAAiB,EAAC;AACxB,EAAA,IAAI,CAAA,CAAE,MAAM,CAAA,KAAM,IAAA,MAAU,IAAA,GAAO,IAAA;AACnC,EAAA,IAAI,CAAA,CAAE,UAAU,CAAA,KAAM,IAAA,MAAU,QAAA,GAAW,IAAA;AAC3C,EAAA,KAAA,MAAW,KAAK,CAAC,UAAA,EAAY,aAAa,eAAA,EAAiB,aAAA,EAAe,YAAY,CAAA,EAAY;AAChG,IAAA,MAAM,CAAA,GAAI,EAAE,CAAC,CAAA;AACb,IAAA,IAAI,OAAO,CAAA,KAAM,QAAA,IAAY,MAAM,EAAA,EAAI,GAAA,CAAI,CAAC,CAAA,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mode of a timeline view, by Field key. `mode` turns the left task list on; `critical` paints the longest\n * chain; `progress` is a percent/number column; `milestone` a yes/no column; `baselineStart` / `baselineEnd` the two\n * date columns \"Save baseline\" writes; `dependency` the link column that dependencies are written to.\n */\nexport interface GanttLook {\n mode?: boolean;\n critical?: boolean;\n progress?: string;\n milestone?: string;\n baselineStart?: string;\n baselineEnd?: string;\n dependency?: string;\n}\n\n/** Read a stored Gantt look; unknown keys and wrong shapes are dropped. */\nexport function parseGanttLook(raw: unknown): GanttLook | undefined {\n if (!raw || typeof raw !== \"object\" || Array.isArray(raw)) return undefined;\n const v = raw as Record<string, unknown>;\n const out: GanttLook = {};\n if (v[\"mode\"] === true) out.mode = true;\n if (v[\"critical\"] === true) out.critical = true;\n for (const k of [\"progress\", \"milestone\", \"baselineStart\", \"baselineEnd\", \"dependency\"] as const) {\n const x = v[k];\n if (typeof x === \"string\" && x !== \"\") out[k] = x;\n }\n return Object.keys(out).length > 0 ? out : undefined;\n}\n\n/**\n * HOW A TABLE LOOKS — colors, formats and the frozen column.\n *\n * THE SPLIT, AND WHY IT IS THIS ONE. A Field declares WHAT it holds: a\n * currency, a percent, a date, a person. A VIEW declares HOW that reads and\n * what it is worth looking at: two decimal places or none, tint the row when\n * Status is Blocked, keep Name in place while the rest scrolls. Airtable draws\n * the line in exactly this place, and it has to be here: two people read one\n * table two different ways, and neither reading is a fact about the records.\n *\n * So nothing in this module is a new column on a Field and nothing here needed\n * a migration. A presentation lives on the saved-view record (`views.ts`), which\n * is an ordinary record of an ordinary Table — which means an agent sets it\n * through the same `records` tool it uses for everything else, and it travels\n * with the table the way every other record does.\n *\n * A FIELD STILL GETS ITS MONEY RIGHT WITH NO CONFIGURATION. `formatForField`\n * reads the Field's OWN declaration — a `currency` parity type with unit `$`, a\n * `percent`, a `datetime` with `config.kind` — and returns the format that\n * follows from it. The view's `formats` map only OVERRIDES that. A table nobody\n * has ever styled still shows `$1,250.50` and `45%`.\n */\n\n// The style parser from its own client-free subpath (lane SSR-ROWS): `@ai-matrx/records-ui/first-page`\n// runs in a host's SERVER component, and every export of the \"use client\" `data-table` entry is a\n// client reference there — calling `parseTableStyle` through it threw on the server.\nimport { COLOR_ROTATION, parseTableStyle, tableStyleIsEmpty } from \"@ai-matrx/design-system/data-table/table-style\";\nimport type {\n ChoiceColorLookup,\n GroupAggregateKind,\n GroupAggregateSpec,\n GroupOrder,\n StyleColor,\n TableStyle,\n} from \"@ai-matrx/design-system/data-table\";\nimport { getFieldFormat, type FieldFormatConfig } from \"@ai-matrx/design-system/field-formats\";\nimport type { ColorRule } from \"@ai-matrx/design-system/data-table\";\nimport { newerKindOf, ratingMaxOf } from \"@ai-matrx/records/field-kinds\";\nimport type { Field, TableDecorations } from \"@ai-matrx/records\";\n\nimport { editorKindFor } from \"./parity\";\nimport { dateFormatFor } from \"./dates\";\n\n/**\n * SECTIONS BY A FIELD — the view's own grouping.\n *\n * `field` is a Field KEY, exactly like `frozen` and the keys of `formats`,\n * because a view is written against the Table's declaration and never against\n * whatever id a screen happened to build its columns with.\n *\n * `aggregates` is keyed by Field key too, and `collapsed` holds the data\n * table's own group keys (`s:Blocked`, `n:3`, `empty`), which is what the\n * primitive emits and the only thing that survives a value rendering the same\n * text as another.\n *\n * NOTHING HERE IS EVER CALLED `valueOf`, `toString` or `hasOwnProperty`: every\n * object in JavaScript already has all three, so an optional field by one of\n * those names is NEVER absent and a `config.valueOf ? … : …` check silently\n * reads `Object.prototype`. It cost the primitive a whole grouping once.\n */\nexport type GridGrouping = {\n /** The Field key whose value makes the sections. */\n field: string;\n /** Per-Field-key subtotal on every section header. */\n aggregates?: Record<string, GroupAggregateSpec>;\n /** Section order. The primitive's default is `value-asc`; blanks sort last. */\n order?: GroupOrder;\n /** The sections this view keeps shut, by the primitive's own group key. */\n collapsed?: string[];\n /** The grouped column stays drawn as a column (Airtable). Absent = shown; `false` = the person stepped it aside. */\n showColumn?: boolean;\n /**\n * SUB-GROUPS (lane S1-PRIME VIEW-KEYS; ui-bench LISTS \"sub-grouping\"): up to two more levels\n * inside each section, by Field key. At most three levels in all — the store refuses a fourth\n * (`custom.view_declare`). A layout that draws one level ignores the rest; it never drops them,\n * because this list is parsed and written back whole with the rest of the look.\n */\n then?: GridSubGroup[];\n /**\n * DRILL (lane DRILL-TABLE-PRIMITIVE): the Dimension pivoted across the top — a Field key, or\n * `<key>:<grain>` for a date cut into periods.\n */\n across?: string;\n /** DRILL: the period `field` is cut into when it is a date (`month`); the store keeps `field` a Field key. */\n grain?: string;\n /** The Measures shown (\"what to display\"), by the store's own keys (`count`, `sum_quantity`). */\n show?: string[];\n /** The drill trail, in order: each crumb a Dimension reference and the value it narrowed to. */\n trail?: GridDrillStep[];\n};\n\n/** One crumb of a saved drill trail. `value: null` is \"no value\". */\nexport type GridDrillStep = { dim: string; value: string | null };\n\n/** One sub-group level: a Field key and its section order. */\nexport type GridSubGroup = { field: string; order?: GroupOrder; grain?: string };\n\n/** Everything a view says about how its table LOOKS. */\nexport type GridPresentation = {\n /** Color-by-a-column, rules and manual highlights. */\n style?: TableStyle;\n /** Per-column format overrides, by the Field's key. */\n formats?: Record<string, FieldFormatConfig>;\n /**\n * The columns that stay in place while the table scrolls sideways, by Field\n * key. Only the LEADING run of the view's column order can actually freeze —\n * the data table decides that, and declines rather than pinning a column at a\n * guessed offset.\n */\n frozen?: string[];\n /** Collapsible sections by one Field, with subtotals on each header. */\n grouping?: GridGrouping;\n /**\n * The width a person dragged a column to, by Field key. SPARSE on purpose —\n * a view saved before widths existed carries none and still parses, and a\n * column nobody resized is left to the table's own measurement.\n */\n widths?: Record<string, number>;\n /** The body row height this view remembers, in px. */\n rowHeight?: number;\n /**\n * Field keys hidden from this view — the SAME hidden-column list the grid's\n * own column picker holds, now given a place on the view so it survives a\n * reload and a layout switch reads the identical set gallery and grid agree\n * on, rather than a second \"fields shown\" list nobody kept in sync.\n */\n hiddenFields?: string[];\n /**\n * THE FIELDS A CARD LEAVES OFF (board, list, gallery, calendar, timeline), by Field key — the\n * card's own choice, kept apart from `hiddenFields` so a board's \"Card fields\" never hides the\n * grid's columns when the view switches layout (v7 TABLE-EXPERIENCE, walk 2026-10-05). An empty\n * list is a choice (every field shown); absent means the card never chose.\n */\n cardHidden?: string[];\n /**\n * THE ORDER A PERSON DRAGGED THE COLUMNS INTO, by Field key (merge tranche 6a). Sparse like\n * `widths`: a key it does not name keeps its Field's own place after the named ones, and a key\n * whose Field is gone is skipped — a column order can never hide or invent a column.\n */\n columnOrder?: string[];\n /**\n * The gallery's card size, remembered the same way the grid remembers its\n * row height — a per-view look, not a global default.\n */\n gallerySize?: \"small\" | \"medium\" | \"large\";\n /**\n * THE BOARD'S OWN LOOK (lane BOARD-SWIMLANES, Notion's board options). All kept on the view, all\n * read only by the kanban layout. Absent means the board's default: columns wear their choice's\n * color, each heading shows its count, empty columns and lanes are drawn, cards are medium with\n * no preview.\n * boardSize card size: sets the column width, the preview's height and, small, drops the card's extras\n * boardPreview the FILE field drawn as a cover at the top of each card (absent = no preview)\n * boardHideEmpty leave out a column or a lane that holds no card\n * boardColorColumns false = neutral headings, no accent bar on the cards\n * boardCounts false = no count beside the heading\n * boardLanesShut the swimlanes kept shut to a strip, by the lane's name\n */\n boardSize?: \"small\" | \"medium\" | \"large\";\n boardPreview?: string;\n boardHideEmpty?: boolean;\n boardColorColumns?: boolean;\n boardCounts?: boolean;\n boardLanesShut?: string[];\n /**\n * A CHART VIEW'S MENU (PIVOT-VIEW): `chartLabels` draws each mark's value on it (the chart menu's \"Data labels\"\n * switch); `chartLegend: false` leaves the legend off. Read only by the chart layout.\n */\n chartLabels?: boolean;\n chartLegend?: boolean;\n /**\n * A LOCKED VIEW (lane NOTION-SMALL-2): its layout, filters, sorts and settings are not saved over until\n * somebody unlocks it. An editing convenience against an accidental change, never a permission.\n */\n locked?: boolean;\n /**\n * THIS VIEW'S OWN LAYOUT CHOICES, over the organization's `custom/grid_layout` knob (lane\n * DEFAULT-GRID-PARITY, TABLE-PARITY D1 D5 D6). Absent means \"whatever the organization\n * says\"; present is the view's word. `freezeFirst: false` is an explicit NO over an\n * organization that freezes the first column — an empty `frozen` cannot say that.\n */\n wrap?: boolean;\n /** AIRTABLE'S \"WRAP FIELD HEADERS\": column titles take a second line instead of being cut. Absent = one line. */\n headerWrap?: boolean;\n /** NOTION'S \"WRAP COLUMN\" (N5): the columns that wrap their text when the view as a whole does not. */\n wrapColumns?: string[];\n fit?: \"auto\" | \"fit\" | \"scroll\";\n freezeFirst?: boolean;\n /**\n * THE SUMMARY BAR (TABLE-PARITY F1): Field key → the store measure shown under that column\n * (`count`, `sum`, `avg`, `min`, `max`, `median`, `filled`, `empty`, `unique`), worked out\n * by `custom.record_aggregate` over the whole table.\n */\n summaries?: Record<string, string>;\n /** THE TIMELINE'S GANTT MODE (kept as `presentation.gantt`): see `GanttLook`. */\n gantt?: GanttLook;\n /**\n * WHERE THE FOOTER SITS (lane TABLE-PAGE-CHROME, owner 2026-09-25) — the row count and the\n * pages: `sticky`, pinned to the bottom of the screen while the rows scroll (the older grid's\n * way, and the default when a view says nothing), or `inline`, right after the last row with\n * the page scrolling. Read by the Grid and a host's Sheet.\n */\n footer?: FooterPlacement;\n};\n\n/** Where a grid's footer sits. */\nexport type FooterPlacement = \"sticky\" | \"inline\";\n\n/** What a view that says nothing gets — the older grid's pinned footer. */\nexport const DEFAULT_FOOTER: FooterPlacement = \"sticky\";\n\n/** Where THIS view's footer sits, said or defaulted. */\nexport function footerOf(p: GridPresentation | null | undefined): FooterPlacement {\n return p?.footer ?? DEFAULT_FOOTER;\n}\n\nexport const EMPTY_PRESENTATION: GridPresentation = {};\n\n/** A frozen column needs a known width, or the table declines to freeze at all. */\nexport const FROZEN_COLUMN_WIDTH = 200;\n\n/**\n * WHAT A ROW HEIGHT IS ALLOWED TO BE. Below the floor the text is clipped and\n * no editor fits; above the ceiling one record fills the screen. A view asking\n * for anything outside it is DROPPED rather than obeyed, because a saved look\n * must not be able to make a table unreadable — and the Fields' own heights\n * still draw, which is the tolerant half.\n */\nexport const MIN_ROW_HEIGHT = 24;\nexport const MAX_ROW_HEIGHT = 240;\n\n/**\n * The aggregate kinds and orders the primitive actually implements. Listed here\n * because they are the tolerant parser's allow-list and a view is hostile input:\n * `satisfies` ties them to the primitive's own union, so a kind it renames stops\n * this file compiling instead of quietly parsing into a subtotal nobody draws.\n */\nconst AGGREGATE_KINDS = [\n \"count\",\n \"sum\",\n \"average\",\n \"min\",\n \"max\",\n \"empty\",\n \"filled\",\n \"unique\",\n \"checked\",\n \"unchecked\",\n \"percentFilled\",\n] as const satisfies readonly GroupAggregateKind[];\n\nconst GROUP_ORDERS = [\n \"value-asc\",\n \"value-desc\",\n \"count-desc\",\n \"first-seen\",\n] as const satisfies readonly GroupOrder[];\n\nfunction isRecord(v: unknown): v is Record<string, unknown> {\n return typeof v === \"object\" && v !== null && !Array.isArray(v);\n}\n\n/**\n * Read a presentation out of whatever the view record holds — an object, or the\n * JSON string a text field stores.\n *\n * Tolerant in exactly the way `parseTableStyle` is: an unreadable half is\n * dropped and the rest still applies, because a table must keep drawing when\n * one piece of its styling goes out of date.\n */\nexport function parseGridPresentation(raw: unknown): GridPresentation {\n let value = raw;\n if (typeof value === \"string\") {\n const trimmed = value.trim();\n if (trimmed === \"\") return {};\n try {\n value = JSON.parse(trimmed);\n } catch {\n return {};\n }\n }\n if (!isRecord(value)) return {};\n\n const out: GridPresentation = {};\n\n const style = parseTableStyle(value[\"style\"]);\n if (!tableStyleIsEmpty(style)) out.style = style;\n\n if (isRecord(value[\"formats\"])) {\n const formats: Record<string, FieldFormatConfig> = {};\n for (const [key, cfg] of Object.entries(value[\"formats\"])) {\n if (!isRecord(cfg)) continue;\n const id = cfg[\"id\"];\n if (typeof id !== \"string\") continue;\n const options = cfg[\"options\"];\n formats[key] = isRecord(options)\n ? {\n id: id as FieldFormatConfig[\"id\"],\n options: options as NonNullable<FieldFormatConfig[\"options\"]>,\n }\n : { id: id as FieldFormatConfig[\"id\"] };\n }\n if (Object.keys(formats).length > 0) out.formats = formats;\n }\n\n if (Array.isArray(value[\"frozen\"])) {\n const frozen = value[\"frozen\"].filter((k): k is string => typeof k === \"string\");\n if (frozen.length > 0) out.frozen = frozen;\n }\n\n const grouping = parseGrouping(value[\"grouping\"]);\n if (grouping) out.grouping = grouping;\n\n if (isRecord(value[\"widths\"])) {\n const widths: Record<string, number> = {};\n for (const [key, raw] of Object.entries(value[\"widths\"])) {\n // A width that is not a usable number is one column's loss, never the\n // view's: the rest of the widths still apply and that column is measured.\n if (typeof raw !== \"number\" || !Number.isFinite(raw) || raw <= 0) continue;\n widths[key] = Math.round(raw);\n }\n if (Object.keys(widths).length > 0) out.widths = widths;\n }\n\n const rowHeight = value[\"rowHeight\"];\n if (\n typeof rowHeight === \"number\" &&\n Number.isFinite(rowHeight) &&\n rowHeight >= MIN_ROW_HEIGHT &&\n rowHeight <= MAX_ROW_HEIGHT\n ) {\n out.rowHeight = Math.round(rowHeight);\n }\n\n if (Array.isArray(value[\"hiddenFields\"])) {\n const hiddenFields = value[\"hiddenFields\"].filter((k): k is string => typeof k === \"string\");\n if (hiddenFields.length > 0) out.hiddenFields = hiddenFields;\n }\n if (Array.isArray(value[\"cardHidden\"])) {\n out.cardHidden = value[\"cardHidden\"].filter((k): k is string => typeof k === \"string\");\n }\n\n if (Array.isArray(value[\"columnOrder\"])) {\n const columnOrder = value[\"columnOrder\"].filter((k): k is string => typeof k === \"string\");\n if (columnOrder.length > 0) out.columnOrder = columnOrder;\n }\n\n const gallerySize = value[\"gallerySize\"];\n if (gallerySize === \"small\" || gallerySize === \"medium\" || gallerySize === \"large\") {\n out.gallerySize = gallerySize;\n }\n\n const boardSize = value[\"boardSize\"];\n if (boardSize === \"small\" || boardSize === \"medium\" || boardSize === \"large\") out.boardSize = boardSize;\n if (typeof value[\"boardPreview\"] === \"string\" && value[\"boardPreview\"] !== \"\") out.boardPreview = value[\"boardPreview\"];\n if (typeof value[\"boardHideEmpty\"] === \"boolean\") out.boardHideEmpty = value[\"boardHideEmpty\"];\n if (typeof value[\"boardColorColumns\"] === \"boolean\") out.boardColorColumns = value[\"boardColorColumns\"];\n if (typeof value[\"boardCounts\"] === \"boolean\") out.boardCounts = value[\"boardCounts\"];\n if (typeof value[\"chartLabels\"] === \"boolean\") out.chartLabels = value[\"chartLabels\"];\n if (typeof value[\"chartLegend\"] === \"boolean\") out.chartLegend = value[\"chartLegend\"];\n if (value[\"locked\"] === true) out.locked = true;\n if (Array.isArray(value[\"boardLanesShut\"])) {\n const shut = value[\"boardLanesShut\"].filter((k): k is string => typeof k === \"string\");\n if (shut.length > 0) out.boardLanesShut = shut;\n }\n\n if (typeof value[\"wrap\"] === \"boolean\") out.wrap = value[\"wrap\"];\n if (typeof value[\"headerWrap\"] === \"boolean\") out.headerWrap = value[\"headerWrap\"];\n if (Array.isArray(value[\"wrapColumns\"])) {\n const wrapColumns = value[\"wrapColumns\"].filter((k): k is string => typeof k === \"string\");\n if (wrapColumns.length > 0) out.wrapColumns = wrapColumns;\n }\n const fit = value[\"fit\"];\n if (fit === \"auto\" || fit === \"fit\" || fit === \"scroll\") out.fit = fit;\n if (typeof value[\"freezeFirst\"] === \"boolean\") out.freezeFirst = value[\"freezeFirst\"];\n const footer = value[\"footer\"];\n if (footer === \"sticky\" || footer === \"inline\") out.footer = footer;\n {\n const gantt = parseGanttLook(value[\"gantt\"]);\n if (gantt) out.gantt = gantt;\n }\n if (isRecord(value[\"summaries\"])) {\n const summaries: Record<string, string> = {};\n for (const [key, op] of Object.entries(value[\"summaries\"])) {\n // A measure name is judged by the store when it is asked; a non-string is nobody's.\n if (typeof op === \"string\" && op.trim() !== \"\") summaries[key] = op;\n }\n if (Object.keys(summaries).length > 0) out.summaries = summaries;\n }\n\n return out;\n}\n\n/**\n * A grouping, or nothing. A grouping with no Field to group BY is not a partial\n * grouping — it is no grouping at all, so it is dropped whole; an unreadable\n * subtotal or a section order this primitive does not have costs only itself.\n */\nfunction parseGrouping(raw: unknown): GridGrouping | undefined {\n if (!isRecord(raw)) return undefined;\n const field = raw[\"field\"];\n if (typeof field !== \"string\" || field.trim() === \"\") return undefined;\n\n const out: GridGrouping = { field };\n\n if (isRecord(raw[\"aggregates\"])) {\n const aggregates: Record<string, GroupAggregateSpec> = {};\n for (const [key, spec] of Object.entries(raw[\"aggregates\"])) {\n if (!isRecord(spec)) continue;\n const kind = spec[\"kind\"];\n if (typeof kind !== \"string\") continue;\n if (!(AGGREGATE_KINDS as readonly string[]).includes(kind)) continue;\n const label = spec[\"label\"];\n aggregates[key] =\n typeof label === \"string\"\n ? { kind: kind as GroupAggregateKind, label }\n : { kind: kind as GroupAggregateKind };\n }\n if (Object.keys(aggregates).length > 0) out.aggregates = aggregates;\n }\n\n const order = raw[\"order\"];\n if (typeof order === \"string\" && (GROUP_ORDERS as readonly string[]).includes(order)) {\n out.order = order as GroupOrder;\n }\n\n if (Array.isArray(raw[\"collapsed\"])) {\n const collapsed = raw[\"collapsed\"].filter((k): k is string => typeof k === \"string\");\n if (collapsed.length > 0) out.collapsed = collapsed;\n }\n\n if (typeof raw[\"showColumn\"] === \"boolean\") out.showColumn = raw[\"showColumn\"];\n\n if (Array.isArray(raw[\"then\"])) {\n const then: GridSubGroup[] = [];\n for (const level of raw[\"then\"]) {\n if (!isRecord(level)) continue;\n const sub = level[\"field\"];\n if (typeof sub !== \"string\" || sub.trim() === \"\") continue;\n const subOrder = level[\"order\"];\n const subGrain = level[\"grain\"];\n then.push({\n field: sub,\n ...(typeof subOrder === \"string\" && (GROUP_ORDERS as readonly string[]).includes(subOrder)\n ? { order: subOrder as GroupOrder }\n : {}),\n ...(typeof subGrain === \"string\" && subGrain !== \"\" ? { grain: subGrain } : {}),\n });\n }\n if (then.length > 0) out.then = then.slice(0, 2);\n }\n\n const grain = raw[\"grain\"];\n if (typeof grain === \"string\" && grain !== \"\") out.grain = grain;\n const across = raw[\"across\"];\n if (typeof across === \"string\" && across.trim() !== \"\") out.across = across;\n if (Array.isArray(raw[\"show\"])) {\n const show = raw[\"show\"].filter((k): k is string => typeof k === \"string\" && k !== \"\");\n if (show.length > 0) out.show = show;\n }\n if (Array.isArray(raw[\"trail\"])) {\n const trail: GridDrillStep[] = [];\n for (const step of raw[\"trail\"]) {\n if (!isRecord(step) || typeof step[\"dim\"] !== \"string\" || step[\"dim\"] === \"\") continue;\n const value = step[\"value\"];\n if (value !== null && typeof value !== \"string\") continue;\n trail.push({ dim: step[\"dim\"], value });\n }\n if (trail.length > 0) out.trail = trail;\n }\n\n return out;\n}\n\n/** True when nothing here would change how anything looks. */\nexport function presentationIsEmpty(p: GridPresentation): boolean {\n return (\n (p.style === undefined || tableStyleIsEmpty(p.style)) &&\n Object.keys(p.formats ?? {}).length === 0 &&\n (p.frozen?.length ?? 0) === 0 &&\n p.grouping === undefined &&\n Object.keys(p.widths ?? {}).length === 0 &&\n p.rowHeight === undefined &&\n (p.hiddenFields?.length ?? 0) === 0 &&\n p.cardHidden === undefined &&\n (p.columnOrder?.length ?? 0) === 0 &&\n p.gallerySize === undefined &&\n p.boardSize === undefined &&\n p.boardPreview === undefined &&\n p.boardHideEmpty === undefined &&\n p.boardColorColumns === undefined &&\n p.boardCounts === undefined &&\n (p.boardLanesShut?.length ?? 0) === 0 &&\n p.chartLabels === undefined &&\n p.chartLegend === undefined &&\n p.locked === undefined &&\n p.wrap === undefined &&\n p.headerWrap === undefined &&\n p.fit === undefined &&\n p.freezeFirst === undefined &&\n p.footer === undefined &&\n Object.keys(p.summaries ?? {}).length === 0 &&\n p.gantt === undefined\n );\n}\n\n/** The string a view record stores. Empty string for \"this view styles nothing\". */\nexport function presentationDocument(p: GridPresentation): string {\n return presentationIsEmpty(p) ? \"\" : JSON.stringify(p);\n}\n\n/** Kinds whose value is a control the record renderer draws, never a formatter's string. */\nconst DRAWN_KINDS = new Set([\"select\", \"multi_select\", \"relation\", \"member\", \"person\", \"attachment\", \"file\", \"entity_reference\", \"checkbox\", \"boolean\", \"signature\", \"json\"]);\n\n/**\n * The display format a column's settings chose for it, when it is one the platform registry\n * knows and the column is not one the record renderer draws itself. `undefined` otherwise.\n */\nexport function shownAsOf(field: Field): FieldFormatConfig | undefined {\n if (DRAWN_KINDS.has(String(editorKindFor(field)))) return undefined;\n const raw = (field as unknown as { display_format?: unknown }).display_format;\n if (!raw || typeof raw !== \"object\") return undefined;\n const id = (raw as { id?: unknown }).id;\n // `formula` is the column's KIND, never a look: a worked-out column shows as its result format.\n if (typeof id !== \"string\" || id === \"formula\" || !getFieldFormat(id)) return undefined;\n const options = (raw as { options?: unknown }).options;\n return options && typeof options === \"object\" && Object.keys(options).length > 0\n ? ({ id, options } as FieldFormatConfig)\n : ({ id } as FieldFormatConfig);\n}\n\n/**\n * The format a Field's OWN declaration implies, before any view says anything.\n *\n * Returns `undefined` for a Field whose value the record renderer already draws\n * better than a formatter could — a relation chip, a person, an attachment, a\n * choice — because handing those to a text formatter would REPLACE a working\n * control with a string.\n */\n/**\n * A COLUMN THAT HOLDS YEARS (\"Founded\", \"Year\", \"Year built\", \"Established\", \"Model year\"…).\n * A year is a number that is never grouped: \"Founded 2,008\" read as a quantity (lane RECORD-PAGE-UI,\n * 2026-10-15). Known by its name; a value is printed as a year only when it is also a whole number\n * from 1000 to 2999 (`isYearValue`).\n */\nconst YEAR_NAMES = /(^|[\\s_-])(year|founded|established|incorporated|vintage)([\\s_-]|$)/i;\nexport function isYearField(field: Pick<Field, \"key\" | \"label\">): boolean {\n return YEAR_NAMES.test(String(field.label ?? \"\")) || YEAR_NAMES.test(field.key);\n}\nexport function isYearValue(value: unknown): boolean {\n return typeof value === \"number\" && Number.isInteger(value) && value >= 1000 && value <= 2999;\n}\n/** A number format with its grouping off for a year column, unless the column chose grouping itself. */\nfunction ungroupedForYears(field: Field, format: FieldFormatConfig): FieldFormatConfig {\n if (format.id !== \"number\" || !isYearField(field)) return format;\n const options = (format.options ?? {}) as Record<string, unknown>;\n if (options[\"useGrouping\"] !== undefined) return format;\n return { ...format, options: { ...options, useGrouping: false } };\n}\n\nexport function formatForField(field: Field): FieldFormatConfig | undefined {\n // \"SHOWS AS\" — THE FORMAT THE COLUMN'S OWN SETTINGS CHOSE (merge tranche 6a/6e). The column\n // keeps it on the Field (`display_format`, written by `custom.field_update`), so the grid, the\n // record panel and the export read one answer. A column the record renderer draws better than\n // a formatter (a choice, a link, a person, a file) keeps its own drawing.\n const shownAs = shownAsOf(field);\n // A RATING'S TOP STAR IS ITS MAX RULE (lane 10 P4), so changing the rule changes the stars.\n if (newerKindOf(field) === \"rating\" && (!shownAs || shownAs.id === \"rating\")) {\n return { id: \"rating\", options: { ...(shownAs?.options ?? {}), ratingMax: ratingMaxOf(field) } };\n }\n if (shownAs) return ungroupedForYears(field, shownAs);\n // THE STORE'S OWN STAMPS (Created time, Last changed time) are instants and print like\n // every other date-and-time cell — `dates.ts` answers, the same helper every card reads.\n const stamp = dateFormatFor(field);\n if (stamp && editorKindFor(field) !== \"datetime\") return stamp;\n switch (editorKindFor(field)) {\n case \"currency\":\n return {\n id: \"currency\",\n options: { currency: currencyCodeFor(field.unit) },\n };\n case \"percent\":\n return { id: \"percent\" };\n case \"datetime\":\n // The COLUMN's declaration: a `kind: \"date\"` column is a date column, anything else can\n // hold a moment. Each VALUE is still printed in its own shape (`RecordValue` →\n // `dates.dateFormatFor(field, value)`), so a bare date in a datetime column reads as a date.\n return String(field.config?.[\"kind\"] ?? \"\") === \"date\" ? { id: \"date\" } : { id: \"datetime\" };\n case \"email\":\n return { id: \"email\" };\n case \"url\":\n return { id: \"url\" };\n case \"phone\":\n return { id: \"phone\" };\n case \"number\":\n return ungroupedForYears(field, { id: \"number\" });\n default:\n return undefined;\n }\n}\n\n/**\n * THE FORMAT ONE CELL OF A COLUMN IS DRAWN IN — the grid's cell and the gallery's card alike\n * (guard G4 \"one format\", lane VIEWS-AND-FIELDS W1-B): the view's own format for the column when\n * it set one, else the Field's own (`formatForField`). One function, so no layout formats money\n * (or a date, or a percent) its own way.\n */\nexport function cellFormatFor(field: Field, viewFormat?: FieldFormatConfig | undefined): FieldFormatConfig | undefined {\n return viewFormat ?? formatForField(field);\n}\n\n/**\n * The store lets a person type the SYMBOL they think in (`$`, `€`), and\n * `Intl.NumberFormat` wants the ISO code. The symbols people actually enter are\n * mapped; anything else is passed straight through, because a real ISO code is\n * the other thing that lands in this field, and an unknown code still renders\n * (`1,234.00 XYZ`) rather than blanking — THE FALLBACK LAW.\n */\nconst SYMBOL_TO_CODE: Record<string, string> = {\n $: \"USD\",\n \"£\": \"GBP\",\n \"€\": \"EUR\",\n \"¥\": \"JPY\",\n \"₹\": \"INR\",\n \"₽\": \"RUB\",\n \"₩\": \"KRW\",\n \"R$\": \"BRL\",\n \"C$\": \"CAD\",\n \"A$\": \"AUD\",\n};\n\nexport function currencyCodeFor(unit: string | null | undefined): string {\n const raw = (unit ?? \"\").trim();\n if (raw === \"\") return \"USD\";\n return SYMBOL_TO_CODE[raw] ?? raw.toUpperCase();\n}\n\n/**\n * The color a value paints with when a view colors BY a column.\n *\n * NOTHING FAILS SILENTLY, so this never returns \"no color\" for a value that\n * exists. The store keeps a list column's choices as records of another Table,\n * and this grid has not read that Table's option colors, so the color is\n * derived from the value's own text: the same word always gets the same color,\n * different words get different ones, and `true` is green the way every\n * checklist reads. When those option colors do land, this is the ONE function\n * that changes and every screen follows.\n */\nexport const colorFromTheValue: ChoiceColorLookup = (_fieldKey, value) => {\n if (value === true) return \"green\";\n if (value === false || value === null || value === undefined) return undefined;\n const text = String(value).trim().toLowerCase();\n if (text === \"\") return undefined;\n let hash = 0;\n for (let i = 0; i < text.length; i += 1) {\n hash = (hash * 31 + text.charCodeAt(i)) >>> 0;\n }\n return COLOR_ROTATION[hash % COLOR_ROTATION.length] as StyleColor;\n};\n\n/**\n * G1's TABLE-LEVEL COLORS (`custom.table_decorations` / `client.tableDecorations`),\n * TRANSLATED INTO A `TableStyle` — the same document a saved view's own `presentation.style`\n * is, so one resolver (`resolveTableStyle`, below) can treat \"the table's colors\" and \"this\n * view's colors\" as two layers of the SAME thing instead of two unrelated systems.\n *\n * THE TRANSLATION IS NECESSARY AND IT IS THE ONLY ONE. G1 addresses a Field by its ID\n * (REC-17 — a column renamed keeps its color), because it is the STORE's own door; a\n * `TableStyle` addresses a Field by its KEY, because it reads straight off `row.document`,\n * which is keyed by Field key. A rule or a color-by whose Field has been deleted (its id no\n * longer resolves to a key) is dropped rather than crashing the whole style — a defect in\n * one rule costs that rule, never the read.\n */\nexport function styleFromDecorations(\n decorations: TableDecorations | null | undefined,\n fields: readonly Field[],\n): TableStyle {\n if (!decorations) return { version: 1 };\n const keyOf = (id: string) => fields.find((f) => f.id === id)?.key;\n const style: TableStyle = { version: 1 };\n\n if (decorations.color_by?.field) {\n const field = keyOf(decorations.color_by.field);\n if (field) style.colorBy = { field, target: decorations.color_by.target };\n }\n\n if (Array.isArray(decorations.rules) && decorations.rules.length > 0) {\n const rules: ColorRule[] = [];\n decorations.rules.forEach((rule, index) => {\n const field = keyOf(rule.field);\n if (!field) return;\n rules.push({\n id: rule.id ?? `decoration:${index}`,\n field,\n op: rule.op,\n color: rule.color,\n target: rule.target,\n ...(rule.value === undefined || rule.value === null ? {} : { value: String(rule.value) }),\n });\n });\n if (rules.length > 0) style.rules = rules;\n }\n\n if (decorations.rows && Object.keys(decorations.rows).length > 0) {\n style.rows = { ...decorations.rows };\n }\n\n const columns: Record<string, StyleColor> = {};\n for (const [id, color] of Object.entries(decorations.columns ?? {})) {\n const key = keyOf(id);\n if (key) columns[key] = color;\n }\n if (Object.keys(columns).length > 0) style.columns = columns;\n\n const cells: Record<string, Record<string, StyleColor>> = {};\n for (const [rowId, byField] of Object.entries(decorations.cells ?? {})) {\n for (const [id, color] of Object.entries(byField ?? {})) {\n const key = keyOf(id);\n if (!key) continue;\n (cells[rowId] ??= {})[key] = color;\n }\n }\n if (Object.keys(cells).length > 0) style.cells = cells;\n\n return style;\n}\n\n/**\n * THE ONE PRESENTATION RESOLVER every colored surface in this package reads —\n * `Grid`, and (via `Card`) the kanban board, the calendar and the gallery.\n *\n * THE CLASS THIS CLOSES (lane UI-QUICK-1, TABLE-PARITY review, 2026-09-24). Threading\n * `view.presentation.style` into `Card` closed the instance the CALENDAR-GALLERY bench\n * found — a VIEW that had its own color-by looked right everywhere — but it left the\n * class open: a table whose colors are the ORGANIZATION's decorations (G1's\n * `custom.table_decorations` — \"color rows by Account Type\", \"MAXED and NEAR rules\" on\n * Arman's own Coding Accounts table) and whose views never set a `presentation.style` of\n * their own drew NOTHING, on the grid exactly as much as on every other layout, because\n * nothing in this package had ever read G1's door at all.\n *\n * TWO LAYERS, ONE DOCUMENT. The table's decorations are the base coat — what every view\n * of this table shows until a view says otherwise. A view's OWN `presentation.style` is\n * an override, piece by piece: a view that only ever set manual row highlights still\n * inherits the table's color-by and rules for everything it never touched, and a view\n * that fully redecorated (its own `colorBy` AND its own `rules`) is not haunted by a\n * table rule it meant to replace. Per-piece, never all-or-nothing, because a view is a\n * LOOK on top of the table, not a wholesale substitute for it.\n */\nexport function resolveTableStyle(\n decorations: TableDecorations | null | undefined,\n fields: readonly Field[],\n viewStyle: TableStyle | undefined,\n): TableStyle {\n const base = styleFromDecorations(decorations, fields);\n if (!viewStyle) return base;\n const colorBy = viewStyle.colorBy ?? base.colorBy;\n const rules = viewStyle.rules ?? base.rules;\n const rows = viewStyle.rows ?? base.rows;\n const columns = viewStyle.columns ?? base.columns;\n const cells = viewStyle.cells ?? base.cells;\n return {\n version: 1,\n ...(colorBy !== undefined ? { colorBy } : {}),\n ...(rules !== undefined ? { rules } : {}),\n ...(rows !== undefined ? { rows } : {}),\n ...(columns !== undefined ? { columns } : {}),\n ...(cells !== undefined ? { cells } : {}),\n };\n}\n","// src/viewKeys.ts — @ai-matrx/records-ui · lane S1-PRIME VIEW-KEYS\n//\n// THE VIEW-KEY REGISTRY MOVED TO `@ai-matrx/records/views` (step 10, 2026-10-08): the declared keys, the one\n// reader and the one writer are headless there. What stays here is this package's LOOK: the grid\n// presentation (colors, formats, frozen columns — `presentation.ts`, built on design-system) bound as the\n// view's presentation codec. Every name this file exported is unchanged.\n\nimport * as base from \"@ai-matrx/records/views\";\nimport { parseGridPresentation, presentationDocument, presentationIsEmpty, type GridPresentation } from \"./presentation\";\n\nexport {\n STORE_KEEPS_SWIPE,\n STORE_KEEPS_TIMELINE,\n STORE_KEPT_LAYOUTS,\n VIEW_KEYS,\n storeKeepsLayout,\n viewKeysFor,\n viewSettingsFor,\n type ViewKeyDeclaration,\n type ViewKeyLayout,\n type ViewKeyWriter,\n type ViewSortKey,\n} from \"@ai-matrx/records/views\";\n\n/** This package's look, as the view's presentation codec. */\nexport const gridPresentationCodec: base.ViewPresentationCodec<GridPresentation> = {\n parse: parseGridPresentation,\n isEmpty: presentationIsEmpty,\n toDocument: (presentation) => JSON.parse(presentationDocument(presentation)) as Record<string, unknown>,\n};\n\n/** EVERY DECLARED KEY OF A VIEW, TYPED, with this package's grid look. */\nexport type ViewSettings = base.ViewSettings<GridPresentation>;\nexport type ViewSettingsPatch = base.ViewSettingsPatch<GridPresentation>;\n\n/** Every view and look door with this package's grid look bound — bindings of records' one definition. */\nexport const boundViews = base.bindViewCodec<GridPresentation>(gridPresentationCodec);\n\n/** THE READER (a stored `definition` and the row's flat `filters` in, every declared key out) and THE WRITER'S SHAPE. */\nexport const { viewSettings, viewSettingsPatch } = boundViews;\n","// src/firstPage.ts — @ai-matrx/records-ui/first-page · lane PAGE-BUNDLE-2\n//\n// THE GRID'S FIRST PAGE, ASKED BEFORE THE GRID EXISTS. The logic lives in `@ai-matrx/records/first-page` (headless,\n// step 10, 2026-10-08); this entry binds this package's grid look (`gridPresentationCodec`) so a view is read exactly\n// as the screen reads it. No React here (server-safe entry).\n\nimport { bindFirstPageCodec } from \"@ai-matrx/records/first-page\";\nimport type { GridPresentation } from \"./presentation\";\nimport { gridPresentationCodec } from \"./viewKeys\";\n\nexport type { GridPresentation } from \"./presentation\";\n\nexport {\n EMBEDDED_PAGE_SIZE,\n TABLE_PAGE_SIZE,\n firstGridPageArgs,\n serverRowsOf,\n viewFilterOf,\n type FirstGridPageArgs,\n} from \"@ai-matrx/records/first-page\";\n\ntype BoundFirstPage = ReturnType<typeof bindFirstPageCodec<GridPresentation>>;\nconst boundFirstPage = bindFirstPageCodec(gridPresentationCodec);\nexport const firstGridPageRequest: BoundFirstPage[\"firstGridPageRequest\"] = boundFirstPage.firstGridPageRequest;\nexport const askTablePageSeed: BoundFirstPage[\"askTablePageSeed\"] = boundFirstPage.askTablePageSeed;\n\n// Entity blocks and chart tiles (lane SEED-ENTITY).\nexport * from \"./firstPageEntity\";\n"]}
|