@ai-matrx/records-ui 0.116.0 → 0.116.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CHANGELOG.md +48 -1
  2. package/dist/SaveToTable-3VDK4U5M.js +20 -0
  3. package/dist/chunk-32TUVT57.js +246 -0
  4. package/dist/chunk-32TUVT57.js.map +1 -0
  5. package/dist/chunk-B5S5F5NH.js +445 -0
  6. package/dist/chunk-B5S5F5NH.js.map +1 -0
  7. package/dist/chunk-IUUZVQZD.js +95 -0
  8. package/dist/chunk-IUUZVQZD.js.map +1 -0
  9. package/dist/{chunk-6NSGVKYL.js → chunk-NJYJEAQC.js} +1 -91
  10. package/dist/chunk-NJYJEAQC.js.map +1 -0
  11. package/dist/{chunk-4ZYGWYQP.js → chunk-QRZ4RW2T.js} +56 -31
  12. package/dist/chunk-QRZ4RW2T.js.map +1 -0
  13. package/dist/chunk-SPPATZSR.js +288 -0
  14. package/dist/chunk-SPPATZSR.js.map +1 -0
  15. package/dist/{chunk-7IZJT3DV.js → chunk-TCRNJVGZ.js} +93 -512
  16. package/dist/chunk-TCRNJVGZ.js.map +1 -0
  17. package/dist/{chunk-W5SOKJ5P.js → chunk-TNIC2SGW.js} +5 -3
  18. package/dist/{chunk-W5SOKJ5P.js.map → chunk-TNIC2SGW.js.map} +1 -1
  19. package/dist/{chunk-3OKHOGSO.js → chunk-VCAOXQ5K.js} +2 -283
  20. package/dist/chunk-VCAOXQ5K.js.map +1 -0
  21. package/dist/first-page.cjs.map +1 -1
  22. package/dist/first-page.js.map +1 -1
  23. package/dist/helpers.cjs +812 -8
  24. package/dist/helpers.cjs.map +1 -1
  25. package/dist/helpers.d.cts +441 -3
  26. package/dist/helpers.d.ts +441 -3
  27. package/dist/helpers.js +754 -10
  28. package/dist/helpers.js.map +1 -1
  29. package/dist/index.cjs +1634 -1581
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +156 -168
  32. package/dist/index.d.ts +156 -168
  33. package/dist/index.js +4286 -4477
  34. package/dist/index.js.map +1 -1
  35. package/dist/object-actions.js +3 -2
  36. package/dist/pickers.cjs +52 -13
  37. package/dist/pickers.cjs.map +1 -1
  38. package/dist/pickers.js +6 -3
  39. package/dist/skeleton.cjs +262 -0
  40. package/dist/skeleton.cjs.map +1 -0
  41. package/dist/skeleton.d.cts +50 -0
  42. package/dist/skeleton.d.ts +50 -0
  43. package/dist/skeleton.js +26 -0
  44. package/dist/skeleton.js.map +1 -0
  45. package/package.json +18 -7
  46. package/dist/SaveToTable-AG7ZY4IG.js +0 -18
  47. package/dist/chunk-3OKHOGSO.js.map +0 -1
  48. package/dist/chunk-4ZYGWYQP.js.map +0 -1
  49. package/dist/chunk-6NSGVKYL.js.map +0 -1
  50. package/dist/chunk-7IZJT3DV.js.map +0 -1
  51. /package/dist/{SaveToTable-AG7ZY4IG.js.map → SaveToTable-3VDK4U5M.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -2,17 +2,64 @@
2
2
 
3
3
  ### Unreleased
4
4
 
5
+ - **The light entries ship no package root** (records-ui front door, 2026-10-17). 0.116.1's `/helpers` imported `DECLARABLE_FIELD_KINDS` / `newerKindOf` from the `@ai-matrx/records` root (~360 KB, and `undefined` under any host test that mocks the root), and `/skeleton` took `cn` / `Skeleton` from the design-system root. They now read `@ai-matrx/records/field-kinds`, `@ai-matrx/records/views` (`isRuleFilter`), `@ai-matrx/design-system/cn` and `/skeleton`. Guard: `scripts/check-light-entries.mjs`, run by `build` — fails when `/helpers`, `/data-source`, `/skeleton`, `/table-shape` or `/first-page` (or a chunk they reach) imports either root; red on 0.116.1's dist. Needs `@ai-matrx/records` with `isRuleFilter` on `/views` and `@ai-matrx/design-system` with `/skeleton`. Consumer action: none.
6
+ - **`/helpers` carries every name a host calls outside a screen (records-ui front door, 2026-10-16).** New on `@ai-matrx/records-ui/helpers`: `whatYouMayDo`, `isPage`, `isInterface`, `laneFor`, `platformOwned`, `TableLane`, `bodyFieldOf`, `readLooks`, `viewFromRow`, `VIEW_ADDRESS_KEYS`, `isViewAddressEmpty`, `sameViewAddress`, `viewAddressFromParams`, `viewAddressToParams`, `ViewAddressState`, `ViewAddressSort`, `googleCalendarUrl`, `webcalUrl`, `FIELD_SENSITIVITY_LABEL`, `CUSTOM_FIELD_ADDABLE_TYPES`, `refusalForAPerson`, `codeDependsRefusal`, `announceTableArchived`, `skeletonLayoutFor`, `RECORDS_SKELETON_LAYOUTS`, `RecordsSkeletonLayout`, `endingsFromDocument`, `hiddenFromLink`, `themeFromDocument`, `welcomeFromDocument` (the store's `/forms` readers), `gridContextSnapshot`, `recordActions` and its types. To keep the entry light, the pure parts moved into their own modules (`skeletonLayout.ts`, `viewAddressParams.ts`, `tableLanes.ts`, `bodyField.ts`, `codeDependsRefusal.ts`, `standardFieldChoices.ts`) and `views.ts`, `viewLook.ts`, `viewKeys.ts` lost a `"use client"` they never needed (no React in them). Not moved, because they reach screens or React: `cardWords`, `scalarText` (`values.tsx`), `saveTableDescription` (`@ai-matrx/records/react`), and every hook and provider (`useRecordRights`, `useRecordsUi`, `useRecordLabels`, `useRecordActionHost`, `RecordsUiProvider`, `RecordLabelProvider`) — they read contexts only the screens provide. The root still exports every name it exported. Guard: `helpers-entry-is-light.test.tsx` (green). Consumer action: new names on /helpers — a host file that imports one of them from the root can take it from `/helpers` instead.
7
+ - **New subpath `@ai-matrx/records-ui/skeleton`:** `RecordsSkeleton`, `TablePageSkeleton`, `useRememberedPageRows`, `useRememberedLayout`, `skeletonLayoutFor` and the skeleton constants, without the root. It is in the split client group, so it shares its one copy of `RecordsSkeleton.tsx` with the root (593 B entry over ~46 KB of shared chunks; React and the design system's data table only). Guard: `skeleton-entry-is-light.test.ts`. Consumer action: a host that loads the root lazily paints `/skeleton` while the root is out.
5
8
  - **Map and Org chart layouts (lane AT-VIEWS).** Two new `ViewSwitcher` layouts, so a saved Map or Org chart keeps its view, filter, share link and interface-page place like every layout. `MapLayout` pins an address or latitude/longitude column (addresses are looked up once through the new optional host port `geocodeAddress` and saved on the record into Latitude/Longitude columns); the picture is the host's `mapCanvas` port (`MapCanvasProps`, with the exported `clusterPins` for dense pins) — this package adds no map library, and without a canvas the located records are listed. `OrgChartLayout` draws a self-link column as a tree (collapse/expand, pan, pinch and button zoom, Fit; loops, missing and multiple bosses and several roots are said above the chart). New exports: `MapLayout`, `OrgChartLayout`, `buildOrgForest`, `layoutOrg`, `clusterPins`, `placeRows`, `MapCanvasProps` and friends. Consumer action: bind `mapCanvas` and `geocodeAddress` on `RecordsUiHost` to get the map picture and address lookup.
6
9
  - **The client entries ship each module once (0.116.0, build only).** `index`, `table-shape`, `object-actions` and `pickers` are now built as one split ESM group: a module two of them reach lives in one shared `chunk-*.js` instead of a copy per entry, and `SaveToTable` (the root's `import()`) is its own lazy chunk. Before: client ESM 3,374,887 B in 4 files, `dist/index.js` 2,710,479 B as one module, `dist/pickers.js` 623,095 B re-inlining 89 of the same source files. After: 2,698,094 B in 12 files, largest `index.js` 1,849,502 B, `pickers.js` 912 B. Every client file carries `"use client"`; `first-page`, `helpers` and `data-source` are unchanged (no banner, shaken). CJS stays unsplit. Every export path and every exported name is identical (scripted, ESM and CJS). Guard: `scripts/check-client-modules-ship-once.mjs`, run by `build`, fails when one source file sits in more than one client file (red on the old build: 90 modules). Consumer action: none — same exports.
7
10
  - **`/helpers` no longer reaches `@ai-matrx/records/core`.** The field-type words, colour resolver, rights and table builders now read `@ai-matrx/records/field-kinds` (needs `@ai-matrx/records` with that subpath), so importing a helper no longer puts the ~600 KB store client on the host's first paint. Guard: `helpers-entry-is-light.test.tsx` fails if `/helpers` reaches `/core` or the records root. Consumer action: none.
8
11
  - Tests: `vitest.setup.ts` gives jsdom a no-op `performance.mark` / `measure`.
9
12
  - **New subpath `@ai-matrx/records-ui/data-source`:** `recordsDataSource`, `personActor` and the who-changed words (`whenWords`, `actorWords`, `actorBadge`, `lastChangeSentence`, `SOMEBODY`, `THE_SYSTEM`) alone. `/helpers` also carries the field-type words, the colour resolver and the table builders, which read `@ai-matrx/records/core`; this entry reaches `@ai-matrx/kit` only, and shares the one data-source cache with `/helpers` and the root. Additive. Consumer action: a shell-reachable service that only binds its supabase client or says when imports from `/data-source`.
10
13
 
11
- ## 0.116.0
14
+ ## 0.116.2
12
15
 
13
16
  UNVERIFIED: this release has no Unreleased entry and the source comparison could not be made (the caller supplied no source comparison). Whether source changed is unknown; consumer action is unknown.
14
17
  Check the package's gitHead on npm against this version's gitHead: `git diff <previous gitHead> <this gitHead> -- apps/shared/records-ui/src`.
15
18
 
19
+ ## 0.116.1
20
+
21
+ SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
22
+ so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
23
+ Diff: `git diff c3b04e4b53 e101f72586 -- apps/shared/records-ui/src`
24
+
25
+ Changed shipped source files (21):
26
+ - `apps/shared/records-ui/src/ArchiveDeliberately.tsx`
27
+ - `apps/shared/records-ui/src/CustomFieldsSection.tsx`
28
+ - `apps/shared/records-ui/src/FieldEditor.tsx`
29
+ - `apps/shared/records-ui/src/FormulaTextEditor.tsx`
30
+ - `apps/shared/records-ui/src/RecordBody.tsx`
31
+ - `apps/shared/records-ui/src/RecordsSkeleton.tsx`
32
+ - `apps/shared/records-ui/src/SaveToTable.tsx`
33
+ - `apps/shared/records-ui/src/TablesHome.tsx`
34
+ - `apps/shared/records-ui/src/bodyField.ts`
35
+ - `apps/shared/records-ui/src/codeDependsRefusal.ts`
36
+ - `apps/shared/records-ui/src/helpers.ts`
37
+ - `apps/shared/records-ui/src/skeletonEntry.ts`
38
+ - ...and 9 more
39
+
40
+ ## 0.116.0
41
+
42
+ SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
43
+ so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
44
+ Diff: `git diff a58de4849b c3b04e4b53 -- apps/shared/records-ui/src`
45
+
46
+ Changed shipped source files (10):
47
+ - `apps/shared/records-ui/src/MapLayout.tsx`
48
+ - `apps/shared/records-ui/src/OrgChartLayout.tsx`
49
+ - `apps/shared/records-ui/src/PageCanvas.tsx`
50
+ - `apps/shared/records-ui/src/RecordsSkeleton.tsx`
51
+ - `apps/shared/records-ui/src/ViewSwitcher.tsx`
52
+ - `apps/shared/records-ui/src/host.tsx`
53
+ - `apps/shared/records-ui/src/index.ts`
54
+ - `apps/shared/records-ui/src/mapPins.ts`
55
+ - `apps/shared/records-ui/src/orgTree.ts`
56
+ - `apps/shared/records-ui/src/pages.ts`
57
+
58
+ ## 0.115.108
59
+
60
+ Automatic changed-only republish (docs/metadata drift since the last published version; verified: `git diff a54ebfacf8 a58de4849b -- apps/shared/records-ui/src`
61
+ has no shipped-source changes outside tests, fixtures and docs). No consumer action required.
62
+
16
63
  ## 0.115.107
17
64
 
18
65
  SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ "use client";
3
+ import {
4
+ SAVE_TO_TABLE_TYPES,
5
+ SaveToTable,
6
+ shapesOfSource
7
+ } from "./chunk-QRZ4RW2T.js";
8
+ import "./chunk-TNIC2SGW.js";
9
+ import "./chunk-VCAOXQ5K.js";
10
+ import "./chunk-TIZHA6VK.js";
11
+ import "./chunk-IUUZVQZD.js";
12
+ import "./chunk-SPPATZSR.js";
13
+ import "./chunk-NJYJEAQC.js";
14
+ import "./chunk-HKYEHBQT.js";
15
+ export {
16
+ SAVE_TO_TABLE_TYPES,
17
+ SaveToTable,
18
+ shapesOfSource
19
+ };
20
+ //# sourceMappingURL=SaveToTable-3VDK4U5M.js.map
@@ -0,0 +1,246 @@
1
+ "use client";
2
+ import {
3
+ EMBEDDED_PLAIN_FOOTER_CLASS,
4
+ EMBEDDED_TABLE_CLASS
5
+ } from "./chunk-B5S5F5NH.js";
6
+
7
+ // src/skeletonLayout.ts
8
+ var RECORDS_SKELETON_LAYOUTS = [
9
+ "grid",
10
+ "kanban",
11
+ "gallery",
12
+ "list",
13
+ "calendar",
14
+ "timeline",
15
+ "map",
16
+ "orgchart",
17
+ "form",
18
+ "record",
19
+ "chart",
20
+ "home"
21
+ ];
22
+ function skeletonLayoutFor(layout) {
23
+ if (layout === "board" || layout === "pipeline") return "kanban";
24
+ return RECORDS_SKELETON_LAYOUTS.includes(layout ?? "") ? layout : "grid";
25
+ }
26
+
27
+ // src/RecordsSkeleton.tsx
28
+ import { useSyncExternalStore } from "react";
29
+ import { cn } from "@ai-matrx/design-system/cn";
30
+ import { Skeleton } from "@ai-matrx/design-system/skeleton";
31
+ import { MatrxDataTable } from "@ai-matrx/design-system/data-table";
32
+
33
+ // src/rememberedRows.ts
34
+ var PREFIX = "records-ui:rows:";
35
+ var MAX = 100;
36
+ function storage() {
37
+ try {
38
+ return typeof window !== "undefined" && window.localStorage ? window.localStorage : null;
39
+ } catch {
40
+ return null;
41
+ }
42
+ }
43
+ function rememberedRowCount(key, cap, fallback) {
44
+ const held = storage()?.getItem(PREFIX + key);
45
+ const n = held == null ? NaN : Number(held);
46
+ if (!Number.isFinite(n) || n < 0) return fallback;
47
+ return Math.max(1, Math.min(cap, MAX, Math.round(n)));
48
+ }
49
+ function rememberRowCount(key, count) {
50
+ try {
51
+ storage()?.setItem(PREFIX + key, String(Math.max(0, Math.min(MAX, Math.round(count)))));
52
+ } catch {
53
+ }
54
+ }
55
+ var LAYOUT_PREFIX = "records-ui:layout:";
56
+ function rememberedLayout(tableId) {
57
+ const held = storage()?.getItem(LAYOUT_PREFIX + tableId);
58
+ return held && /^[a-z_-]{2,24}$/.test(held) ? held : null;
59
+ }
60
+ function rememberLayout(tableId, layout) {
61
+ try {
62
+ storage()?.setItem(LAYOUT_PREFIX + tableId, layout);
63
+ } catch {
64
+ }
65
+ }
66
+
67
+ // src/RecordsSkeleton.tsx
68
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
69
+ var NEVER = () => () => {
70
+ };
71
+ function useRememberedPageRows(tableId) {
72
+ return useSyncExternalStore(
73
+ NEVER,
74
+ () => tableId ? rememberedRowCount(`${tableId}:page:last`, 100, "fill") : "fill",
75
+ () => "fill"
76
+ );
77
+ }
78
+ function useRememberedLayout(tableId) {
79
+ return useSyncExternalStore(
80
+ NEVER,
81
+ () => tableId ? rememberedLayout(tableId) : null,
82
+ () => null
83
+ );
84
+ }
85
+ var SPATIAL_LAYOUT_BOX = "h-[60vh] min-h-[22rem]";
86
+ var TABLE_TOOLBAR_ROW_CLASS = "flex min-h-8 min-w-0 shrink-0 flex-nowrap items-center gap-1.5 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden";
87
+ var TABLE_PAGE_FRAME_CLASS = "flex h-full min-h-0 gap-4";
88
+ var TABLE_PAGE_COLUMN_CLASS = "flex min-h-0 min-w-0 flex-1 flex-col gap-2";
89
+ var PLACEHOLDER_COLUMNS = ["a", "b", "c", "d", "e", "f"].map((id) => ({
90
+ id,
91
+ header: "",
92
+ accessorFn: () => ""
93
+ }));
94
+ var NO_ROWS = [];
95
+ function GridSkeleton({ embedded, rows }) {
96
+ return /* @__PURE__ */ jsx(
97
+ MatrxDataTable,
98
+ {
99
+ ...embedded ? {} : { className: "min-h-0 flex-1" },
100
+ data: NO_ROWS,
101
+ columns: PLACEHOLDER_COLUMNS,
102
+ getRowId: (r) => r.id,
103
+ isLoading: true,
104
+ density: "condensed",
105
+ loadingRowHeight: RECORDS_GRID_ROW_PX,
106
+ hideToolbar: true,
107
+ viewTabs: false,
108
+ stickyHeader: true,
109
+ frameHeight: embedded ? "content" : "fill",
110
+ loadingRows: rows,
111
+ copy: false,
112
+ ...embedded ? {
113
+ appearance: "embedded",
114
+ hidePagination: true,
115
+ tableClassName: cn(EMBEDDED_TABLE_CLASS, EMBEDDED_PLAIN_FOOTER_CLASS)
116
+ } : {}
117
+ }
118
+ );
119
+ }
120
+ var CHART_PLOT_PX = 140;
121
+ var RECORDS_GRID_ROW_PX = 35;
122
+ function Cards({ count, className }) {
123
+ return /* @__PURE__ */ jsx(Fragment, { children: Array.from({ length: count }, (_, i) => /* @__PURE__ */ jsx(Skeleton, { shape: "block", className }, i)) });
124
+ }
125
+ function BodySkeleton({ layout, embedded, rows }) {
126
+ const lineCount = rows === "fill" ? 12 : rows;
127
+ switch (layout) {
128
+ case "grid":
129
+ case "home":
130
+ return /* @__PURE__ */ jsx(GridSkeleton, { embedded, rows });
131
+ case "kanban":
132
+ return /* @__PURE__ */ jsx("div", { className: "flex min-h-0 flex-1 gap-2 overflow-hidden pb-2", "data-records-skeleton-part": "body", children: Array.from({ length: 4 }, (_, c) => /* @__PURE__ */ jsxs("div", { className: "flex w-64 shrink-0 flex-col gap-2 rounded-lg bg-muted/40 p-2", children: [
133
+ /* @__PURE__ */ jsx(Skeleton, { shape: "line", width: "1/2", className: "my-1.5" }),
134
+ /* @__PURE__ */ jsx(Cards, { count: 3 - c % 2, className: "h-24" })
135
+ ] }, c)) });
136
+ case "gallery":
137
+ return /* @__PURE__ */ jsx(
138
+ "div",
139
+ {
140
+ className: "grid min-h-0 flex-1 auto-rows-min grid-cols-[repeat(auto-fill,minmax(14rem,1fr))] gap-3 overflow-hidden",
141
+ "data-records-skeleton-part": "body",
142
+ children: /* @__PURE__ */ jsx(Cards, { count: 8, className: "h-48" })
143
+ }
144
+ );
145
+ case "list":
146
+ return /* @__PURE__ */ jsx("div", { className: "flex min-h-0 flex-1 flex-col overflow-hidden", "data-records-skeleton-part": "body", children: Array.from({ length: lineCount }, (_, i) => /* @__PURE__ */ jsxs("div", { className: "flex h-9 items-center gap-3 border-b border-border/60 px-2", children: [
147
+ /* @__PURE__ */ jsx(Skeleton, { className: "size-4" }),
148
+ /* @__PURE__ */ jsx(Skeleton, { shape: "line", width: i % 3 === 0 ? "1/2" : i % 3 === 1 ? "2/3" : "1/3" })
149
+ ] }, i)) });
150
+ case "calendar":
151
+ return /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-2 overflow-hidden", "data-records-skeleton-part": "body", children: [
152
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-px", children: Array.from({ length: 7 }, (_, i) => /* @__PURE__ */ jsx(Skeleton, { shape: "line", width: "1/3", className: "mx-auto my-1" }, i)) }),
153
+ /* @__PURE__ */ jsx("div", { className: "grid flex-1 grid-cols-7 grid-rows-5 gap-px overflow-hidden rounded-md border border-border bg-border", children: Array.from({ length: 35 }, (_, i) => /* @__PURE__ */ jsx("div", { className: "bg-card p-1.5", children: /* @__PURE__ */ jsx(Skeleton, { shape: "line", width: "1/3" }) }, i)) })
154
+ ] });
155
+ case "timeline":
156
+ return /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col overflow-hidden rounded-md border border-border", "data-records-skeleton-part": "body", children: [
157
+ /* @__PURE__ */ jsx("div", { className: "flex h-9 items-center gap-6 border-b border-border px-3", children: Array.from({ length: 6 }, (_, i) => /* @__PURE__ */ jsx(Skeleton, { shape: "line", width: "sm", className: "w-16" }, i)) }),
158
+ Array.from({ length: Math.min(lineCount, 8) }, (_, i) => /* @__PURE__ */ jsx("div", { className: "flex h-10 items-center border-b border-border/60 px-3", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-6 rounded-md", style: { marginLeft: `${i * 13 % 45}%`, width: `${20 + i * 7 % 25}%` } }) }, i))
159
+ ] });
160
+ case "map":
161
+ case "orgchart":
162
+ return /* @__PURE__ */ jsx(Skeleton, { className: `w-full rounded-md ${SPATIAL_LAYOUT_BOX}`, "data-records-skeleton-part": "body" });
163
+ case "record":
164
+ return /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-2 overflow-hidden", "data-records-skeleton-part": "body", children: [
165
+ /* @__PURE__ */ jsx(Skeleton, { shape: "title", width: "1/2", className: "h-8", "data-records-skeleton-part": "title" }),
166
+ /* @__PURE__ */ jsxs("div", { className: "flex h-[38px] items-center gap-2", "data-records-skeleton-part": "actions", children: [
167
+ /* @__PURE__ */ jsx(Skeleton, { shape: "control", width: "sm", className: "h-8" }),
168
+ /* @__PURE__ */ jsx(Skeleton, { shape: "control", width: "sm", className: "h-8" })
169
+ ] }),
170
+ /* @__PURE__ */ jsx("div", { className: "h-px w-full shrink-0 bg-border" }),
171
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-[minmax(6rem,12rem)_1fr] gap-x-3 gap-y-0.5", "data-records-skeleton-part": "fields", children: Array.from({ length: 6 }, (_, i) => /* @__PURE__ */ jsxs("div", { className: "contents", children: [
172
+ /* @__PURE__ */ jsx(Skeleton, { shape: "line", width: "2/3", className: "my-[7px]" }),
173
+ /* @__PURE__ */ jsx(Skeleton, { shape: "row", className: "h-7" })
174
+ ] }, i)) }),
175
+ /* @__PURE__ */ jsx(Skeleton, { shape: "block", height: "lg" })
176
+ ] });
177
+ case "form":
178
+ return /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-4 overflow-hidden", "data-records-skeleton-part": "body", children: [
179
+ /* @__PURE__ */ jsx(Skeleton, { shape: "title", width: "1/2" }),
180
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-[minmax(6rem,12rem)_1fr] gap-x-3 gap-y-1.5", children: Array.from({ length: 6 }, (_, i) => /* @__PURE__ */ jsxs("div", { className: "contents", children: [
181
+ /* @__PURE__ */ jsx(Skeleton, { shape: "line", width: "2/3", className: "my-1.5" }),
182
+ /* @__PURE__ */ jsx(Skeleton, { shape: "row", className: "h-7" })
183
+ ] }, i)) }),
184
+ /* @__PURE__ */ jsx(Skeleton, { shape: "control", width: "sm" })
185
+ ] });
186
+ case "chart":
187
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", "data-records-skeleton-part": "body", children: [
188
+ embedded ? null : /* @__PURE__ */ jsx(Skeleton, { shape: "line", width: "1/3" }),
189
+ /* @__PURE__ */ jsx(Skeleton, { shape: "block", style: { height: CHART_PLOT_PX } })
190
+ ] });
191
+ }
192
+ }
193
+ function RecordsSkeleton({ layout = "grid", embedded = false, rows, className }) {
194
+ return /* @__PURE__ */ jsx(
195
+ "div",
196
+ {
197
+ role: "status",
198
+ "aria-label": "Loading",
199
+ "aria-busy": "true",
200
+ "data-records-skeleton": layout,
201
+ className: cn("flex min-h-0 flex-col", !embedded && "flex-1", className),
202
+ children: /* @__PURE__ */ jsx(BodySkeleton, { layout, embedded, rows: rows ?? (embedded ? 5 : "fill") })
203
+ }
204
+ );
205
+ }
206
+ function TablePageSkeleton({
207
+ layout: layoutAsked,
208
+ embedded = false,
209
+ rows,
210
+ tableId,
211
+ className
212
+ }) {
213
+ const remembered = useRememberedPageRows(embedded ? void 0 : tableId);
214
+ const rememberedFace = useRememberedLayout(embedded || layoutAsked ? void 0 : tableId);
215
+ const layout = layoutAsked ?? skeletonLayoutFor(rememberedFace);
216
+ const painted = rows ?? (remembered === "fill" ? void 0 : remembered);
217
+ return /* @__PURE__ */ jsx("div", { className: cn(TABLE_PAGE_FRAME_CLASS, className), "data-records-skeleton-page": layout, children: /* @__PURE__ */ jsxs("div", { className: TABLE_PAGE_COLUMN_CLASS, children: [
218
+ /* @__PURE__ */ jsxs("div", { className: TABLE_TOOLBAR_ROW_CLASS, "data-table-toolbar": "", "data-records-skeleton-part": "toolbar", "aria-hidden": "true", children: [
219
+ /* @__PURE__ */ jsx(Skeleton, { shape: "control", width: "sm", className: "w-28" }),
220
+ /* @__PURE__ */ jsx(Skeleton, { shape: "control", className: "w-16" }),
221
+ /* @__PURE__ */ jsx(Skeleton, { shape: "control", className: "w-16" }),
222
+ /* @__PURE__ */ jsxs("div", { className: "ml-auto flex items-center gap-1.5", children: [
223
+ /* @__PURE__ */ jsx(Skeleton, { shape: "control", width: "md" }),
224
+ /* @__PURE__ */ jsx(Skeleton, { shape: "control", className: "w-24" })
225
+ ] })
226
+ ] }),
227
+ /* @__PURE__ */ jsx("div", { className: "flex min-h-0 flex-1 flex-col gap-2", "data-table-records": "", children: /* @__PURE__ */ jsx(RecordsSkeleton, { layout, embedded, ...painted !== void 0 ? { rows: painted } : {} }) })
228
+ ] }) });
229
+ }
230
+
231
+ export {
232
+ rememberedRowCount,
233
+ rememberRowCount,
234
+ rememberLayout,
235
+ RECORDS_SKELETON_LAYOUTS,
236
+ skeletonLayoutFor,
237
+ useRememberedPageRows,
238
+ useRememberedLayout,
239
+ SPATIAL_LAYOUT_BOX,
240
+ TABLE_TOOLBAR_ROW_CLASS,
241
+ CHART_PLOT_PX,
242
+ RECORDS_GRID_ROW_PX,
243
+ RecordsSkeleton,
244
+ TablePageSkeleton
245
+ };
246
+ //# sourceMappingURL=chunk-32TUVT57.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 | \"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 \"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 * 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 grey 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 { useSyncExternalStore } 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 { skeletonLayoutFor, type RecordsSkeletonLayout } 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 { RECORDS_SKELETON_LAYOUTS, skeletonLayoutFor, type RecordsSkeletonLayout } from \"./skeletonLayout\";\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 (`min-h-8`: the row's 32px buttons; a chip that arrives\n * later can never make it taller or shorter).\n */\nexport const TABLE_TOOLBAR_ROW_CLASS =\n \"flex min-h-8 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 return (\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={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}\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 }: { layout: RecordsSkeletonLayout; embedded: boolean; rows: number | \"fill\" }) {\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 {Array.from({ length: 4 }, (_, c) => (\n <div key={c} className=\"flex w-64 shrink-0 flex-col gap-2 rounded-lg bg-muted/40 p-2\">\n <Skeleton shape=\"line\" width=\"1/2\" className=\"my-1.5\" />\n <Cards count={3 - (c % 2)} 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={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 \"map\":\n case \"orgchart\":\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 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 ?? (embedded ? 5 : \"fill\")} />\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 painted = rows ?? (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":";;;;;;;AAoBO,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;AACF;AAGO,SAAS,kBAAkB,QAA0D;AAC1F,MAAI,WAAW,WAAW,WAAW,WAAY,QAAO;AACxD,SAAQ,yBAA+C,SAAS,UAAU,EAAE,IACvE,SACD;AACN;;;ACjBA,SAAS,4BAA4B;AACrC,SAAS,UAAU;AACnB,SAAS,gBAAgB;AACzB,SAAS,sBAA2C;;;ACdpD,IAAM,SAAS;AACf,IAAM,MAAM;AAEZ,SAAS,UAA0B;AACjC,MAAI;AACF,WAAO,OAAO,WAAW,eAAe,OAAO,eAAe,OAAO,eAAe;AAAA,EACtF,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGO,SAAS,mBAA8C,KA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