@tristan2828/ui-foundation 4.105.0 → 4.107.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,29 +3,30 @@
3
3
  <!-- index: written by `npm run docs:index` in the package from the headings below; never edit it by hand -->
4
4
  ## Index
5
5
 
6
- - [The reference files](#the-reference-files) · lines 44–66
7
- - [Before anything: the entity plan](#before-anything-the-entity-plan) · lines 68–847
8
- - Step 1: Add `<Entity>` to `openapi.yaml` · lines 110–117
9
- - Step 2: `npm run gen:api` · lines 118–119
10
- - Step 3: Add gateway tests in `tests/gateway/<entity>.test.ts`, derived from the spec · lines 120–131
11
- - Step 4: Add MSW handlers in `src/mocks/<entity>.ts` · lines 132–141
12
- - Step 5: Add a gateway module in `src/api/gateway/<entity>.ts` · lines 142–146
13
- - Step 6: Copy the reference files, one for one, not just the two screens · lines 147–735
14
- - Step 7: Register routes · lines 736–751
15
- - Step 8: Add Playwright specs for all three screens · lines 752–829
16
- - Step 9: Register the nav entry and route names · lines 830–844
17
- - Step 10: `npm run verify`. · lines 845–847
18
- - [How a list opens a record](#how-a-list-opens-a-record) · lines 849–1216
19
- - [The record view](#the-record-view) · lines 1002–1066
20
- - [Forms](#forms) · lines 1068–1133
21
- - [Dialogs](#dialogs) · lines 1135–1166
22
- - [Toasts and feedback](#toasts-and-feedback) · lines 1168–1216
23
- - [What not to copy](#what-not-to-copy) · lines 1218–1250
24
- - [After a commit, in the backend](#after-a-commit-in-the-backend) · lines 1252–1269
25
- - [Deleting](#deleting) · lines 1271–1302
26
- - [Fields only a script writes](#fields-only-a-script-writes) · lines 1304–1325
27
- - [Searching one part of the app](#searching-one-part-of-the-app) · lines 1327–1336
28
- - [What a chat is told about an entity](#what-a-chat-is-told-about-an-entity) · lines 1339–1381
6
+ - [The reference files](#the-reference-files) · lines 45–67
7
+ - [Before anything: the entity plan](#before-anything-the-entity-plan) · lines 69–850
8
+ - Step 1: Add `<Entity>` to `openapi.yaml` · lines 111–118
9
+ - Step 2: `npm run gen:api` · lines 119–120
10
+ - Step 3: Add gateway tests in `tests/gateway/<entity>.test.ts`, derived from the spec · lines 121–132
11
+ - Step 4: Add MSW handlers in `src/mocks/<entity>.ts` · lines 133–142
12
+ - Step 5: Add a gateway module in `src/api/gateway/<entity>.ts` · lines 143–149
13
+ - Step 6: Copy the reference files, one for one, not just the two screens · lines 150–738
14
+ - Step 7: Register routes · lines 739–754
15
+ - Step 8: Add Playwright specs for all three screens · lines 755–832
16
+ - Step 9: Register the nav entry and route names · lines 833–847
17
+ - Step 10: `npm run verify`. · lines 848–850
18
+ - [How a list opens a record](#how-a-list-opens-a-record) · lines 852–1249
19
+ - [The record view](#the-record-view) · lines 1005–1099
20
+ - [Forms](#forms) · lines 1101–1166
21
+ - [Dialogs](#dialogs) · lines 1168–1199
22
+ - [Toasts and feedback](#toasts-and-feedback) · lines 1201–1249
23
+ - [What not to copy](#what-not-to-copy) · lines 1251–1283
24
+ - [After a commit, in the backend](#after-a-commit-in-the-backend) · lines 1285–1302
25
+ - [Deleting](#deleting) · lines 1304–1335
26
+ - [Fields only a script writes](#fields-only-a-script-writes) · lines 1337–1358
27
+ - [Searching one part of the app](#searching-one-part-of-the-app) · lines 1360–1369
28
+ - [What a chat is told about an entity](#what-a-chat-is-told-about-an-entity) · lines 1372–1414
29
+ - [Behind a sign-in proxy](#behind-a-sign-in-proxy) · lines 1416–1452
29
30
 
30
31
  <!-- /index -->
31
32
 
@@ -143,7 +144,9 @@ is a filled-in example while the Widgets demo is still here).
143
144
  tests pass, built on `safeFetch`/`toAppError` from
144
145
  `@tristan2828/ui-foundation/gateway` (see `src/api/gateway/widgets.ts`).
145
146
  Wire → `Page<T>` / `AppError` translation only; no hand-written types
146
- (everything comes from `schema.d.ts`).
147
+ (everything comes from `schema.d.ts`). A proxy's sign-in page or redirect never
148
+ reaches it: `safeFetch` throws kind `proxy_auth` first
149
+ ([Behind a sign-in proxy](#behind-a-sign-in-proxy)).
147
150
  6. **Copy the reference files, one for one, not just the two screens**
148
151
  (the Widgets demo's, or the ones the app's `### Reference files` names) — shaped by the plan: table columns and sortable columns from
149
152
  its "List" column, toolbar filters from its "Filter" column, form fields
@@ -1042,6 +1045,36 @@ A record uses the parts it has, in this order:
1042
1045
  - **Facts beside their labels** (`railFields`, `beside` by default since
1043
1046
  4.81), so the short facts read as a list of pairs rather than a column
1044
1047
  of labels; keep labels to a word or two.
1048
+ - **The facts rail** (4.106, record standard A1): `factsRail` on the
1049
+ view puts the record's short facts in a 300px column beside the strip
1050
+ and the tabs where the view has room (60rem: a laptop's page, a record
1051
+ dialog), so the page doesn't end 900px in. Only short values go in it,
1052
+ and the API holds to that: a rail section is `facts`, not `fields`,
1053
+ each fact one of a few kinds, never free markup:
1054
+
1055
+ ```tsx
1056
+ { title: 'Facts', placement: 'rail', facts: [
1057
+ { label: 'Status', kind: 'status', status: STATUS_KINDS[record.status], word: STATUS_LABELS[record.status] },
1058
+ { label: 'By', kind: 'text', text: formatDay(record.due) },
1059
+ { label: 'Areas', kind: 'badges', items: record.areas.map(areaLabel) },
1060
+ { label: 'From', kind: 'record', name: provider.name, to: `/providers/${provider.id}`, short: true },
1061
+ { label: 'Open Tasks', kind: 'count', count: record.openTasks, to: `/tasks?project=${record.id}` },
1062
+ { label: 'Task', kind: 'link', href: task.url, name: task.name },
1063
+ ] }
1064
+ ```
1065
+
1066
+ - `text` is a date, a number or a person's name: one line, cut with
1067
+ its whole text on hover. `badges` are a few short labels.
1068
+ - A link to another record is `record`, and must say `short: true`:
1069
+ the app vouches its names are short (a person, a place). Records
1070
+ with long titles (a list of discussions, a log's entries) never go in
1071
+ the rail: they're a tab of their own, with its count.
1072
+ - Anything else (a sentence, a closing condition, notes) is a
1073
+ `fields` or `content` section: in Details, never the rail.
1074
+ - What's in the rail isn't repeated in Details. A Details tab left with
1075
+ nothing isn't drawn. On a phone (or a view under 60rem) the rail's
1076
+ sections are back in Details, as rows.
1077
+ - `edit` works on a fact as on a field; at rest it's drawn by its kind.
1045
1078
  - **A tiny record** (4.98: a few fields and no notes, like a lookup's
1046
1079
  row) opens as a small card: `RecordDialogRoute look="card"`, usually
1047
1080
  with `fullPage={false}`. A 420px dialog (a sheet on a phone), its
@@ -1379,3 +1412,41 @@ def note(caller, tool, arguments, entities):
1379
1412
  register_entities(ENTITIES, instructions="Amounts are in the account's currency.")
1380
1413
  register_answer_note(note)
1381
1414
  ```
1415
+
1416
+ ## Behind a sign-in proxy
1417
+
1418
+ An app put behind an identity-aware proxy that has its own sign-in
1419
+ (Cloudflare Access is the usual one; an OAuth proxy or a VPN gateway's
1420
+ portal works the same way) can outlive that sign-in: the page stays open,
1421
+ the proxy's session lapses, and the next request gets the proxy's answer
1422
+ instead of the app's. The foundation handles it (4.107), with nothing for
1423
+ the app to write:
1424
+
1425
+ - **The request asks for JSON as a script.** `safeFetch` sends
1426
+ `Accept: application/json` and `X-Requested-With: XMLHttpRequest`
1427
+ (unless the gateway module set its own) and doesn't follow redirects
1428
+ (`redirect: "manual"`, unless the module passes `"follow"`), so a proxy
1429
+ that can answers a script with a 401, and one that can't answers with a
1430
+ redirect the browser doesn't chase to another origin.
1431
+ - **The proxy's answer becomes one `AppError`, kind `proxy_auth`.**
1432
+ `safeFetch` throws it, before your gateway module sees the response,
1433
+ for: a page (`text/html`) on a 2xx, 401 or 403; a 401 or 403 whose body
1434
+ isn't JSON; a redirect not followed (an opaque redirect); and a redirect
1435
+ followed to another origin. A step 5 gateway module needs no change.
1436
+ The app's own answers are untouched: a JSON 401 is still `auth` (the
1437
+ app's session, which sends the person to `/login`), and a 404, 422, 429
1438
+ or 5xx, JSON or not, is what `toAppError` always made it.
1439
+ - **The screens say "Sign In Again".** `ErrorState` (every `DataTable`,
1440
+ `EntityView`, `WidgetCard`, `Board`, the shell's own session check) and
1441
+ `ModuleCard` show "Sign-in expired" with a **Sign In Again** button in
1442
+ place of any retry. It reloads the whole page, so the proxy's sign-in
1443
+ runs and brings the person back. A screen with its own error UI checks
1444
+ `error.kind === 'proxy_auth'` and offers the same reload.
1445
+ - **Your contract tests don't change.** `openapi.yaml` and the step 3
1446
+ gateway tests describe the app's own responses, never the proxy's; the
1447
+ proxy isn't part of the contract. `proxyAuthError()` (from
1448
+ `@tristan2828/ui-foundation/gateway`) is the error itself, for a mock or
1449
+ a test of a screen's state.
1450
+ - **On the proxy's side**, nothing is required. Where it offers a 401 for
1451
+ scripts instead of a redirect (Cloudflare Access does for requests with
1452
+ `X-Requested-With`), either answer works.
@@ -40,10 +40,10 @@
40
40
  - [24. A list's rows: hover, lines, rows per page](#24-a-lists-rows-hover-lines-rows-per-page) · lines 1811–1849
41
41
  - [23. A Group menu, and a record read beside the list](#23-a-group-menu-and-a-record-read-beside-the-list) · lines 1851–1927
42
42
  - [24. A stored colour beside its name](#24-a-stored-colour-beside-its-name) · lines 1929–1952
43
- - [25. A list's tools: views, filters, columns, row actions, a phone's rows](#25-a-lists-tools-views-filters-columns-row-actions-a-phones-rows) · lines 1954–2112
44
- - [The framed look, and sibling lists beside the title](#the-framed-look-and-sibling-lists-beside-the-title) · lines 2074–2112
45
- - [26. A record's related list, capped](#26-a-records-related-list-capped) · lines 2114–2150
46
- - [27. A repeat and its next time](#27-a-repeat-and-its-next-time) · lines 2152–2197
43
+ - [25. A list's tools: views, filters, columns, row actions, a phone's rows](#25-a-lists-tools-views-filters-columns-row-actions-a-phones-rows) · lines 1954–2129
44
+ - [The framed look, and sibling lists beside the title](#the-framed-look-and-sibling-lists-beside-the-title) · lines 2074–2129
45
+ - [26. A record's related list, capped](#26-a-records-related-list-capped) · lines 2131–2167
46
+ - [27. A repeat and its next time](#27-a-repeat-and-its-next-time) · lines 2169–2214
47
47
 
48
48
  <!-- /index -->
49
49
 
@@ -2090,6 +2090,13 @@ The toolbar a list-page review picked (4.100): `look="framed"` on
2090
2090
  <DataTable look="framed" views={VIEWS} columnsMenu={…} groupings={…} toolbar={<FilterBar … />} … />
2091
2091
  ```
2092
2092
 
2093
+ Since 4.106 (C3) the header goes in the table, as `pageHeader`, so the
2094
+ header row ends where the card does:
2095
+
2096
+ ```tsx
2097
+ <DataTable look="framed" pageHeader={<ListHeader title="Exercises" … />} views={VIEWS} toolbar={…} … />
2098
+ ```
2099
+
2093
2100
  - **The card**: the toolbar in its top bar (search and Filters keep their
2094
2101
  words), the rows, then the count and pager in its bottom bar. Saved
2095
2102
  views sit above it, outside the bar. Loading, empty and error show
@@ -2097,6 +2104,14 @@ The toolbar a list-page review picked (4.100): `look="framed"` on
2097
2104
  - **The tools end at the table's edge**: the card is as wide as `width`
2098
2105
  makes the table, tools and pager with it, so nothing sits off at the
2099
2106
  far right of a wide page. `width="full"` fills the area as before.
2107
+ - **So does the header** (4.106, C3), passed as `pageHeader`: the
2108
+ header (title, siblings, ⋯ and New), the views and the card are one
2109
+ box as wide as the table (CSS `fit-content` with the table's minimum
2110
+ and the page as its maximum; nothing is measured), so above a short
2111
+ table ⋯ and New sit over the card's right edge, and above a wide one
2112
+ where the page ends. A header wider than the table widens the card to
2113
+ match. `width="full"` and the phone's row list span the page as before.
2114
+ A ListHeader left outside the table spans the page, as before 4.106.
2100
2115
  - **One settings button** in place of Columns and Group: the Columns
2101
2116
  ticks, then Group By, in one menu. Its name says the grouping that's on
2102
2117
  ("Table Settings, Grouped by Status") and a dot marks it. Fold All
@@ -2109,7 +2124,9 @@ The toolbar a list-page review picked (4.100): `look="framed"` on
2109
2124
  - The fixtures' `app/DataTable tools` Framed and `app/ListHeader`
2110
2125
  Siblings stories hold it, under axe and the token check in both
2111
2126
  themes; `e2e/data-table-framed.spec.ts` checks the edges, the menu
2112
- from the mouse and the keyboard, the switch and the phone.
2127
+ from the mouse and the keyboard, the switch and the phone, and
2128
+ `e2e/list-header-width.spec.ts` the header's edge at 1440 and 1920
2129
+ (`Header at the table edge` stories).
2113
2130
 
2114
2131
  ## 26. A record's related list, capped
2115
2132
 
@@ -29,15 +29,15 @@
29
29
  - [A list as a board](#a-list-as-a-board) · lines 1236–1287
30
30
  - [A list as cards](#a-list-as-cards) · lines 1289–1335
31
31
  - [Key numbers on a record](#key-numbers-on-a-record) · lines 1337–1366
32
- - [Parts of the page standards](#parts-of-the-page-standards) · lines 1368–1413
33
- - [A few equal things](#a-few-equal-things) · lines 1415–1499
34
- - [An overview page](#an-overview-page) · lines 1501–1564
35
- - [A record's header and empty values](#a-records-header-and-empty-values) · lines 1565–1616
36
- - [A record's tabs, mark and facts](#a-records-tabs-mark-and-facts) · lines 1618–1686
37
- - [Picking at random](#picking-at-random) · lines 1688–1719
38
- - [Filling in what's missing](#filling-in-whats-missing) · lines 1721–1788
39
- - [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines 1790–1815
40
- - [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines 1817–1906
32
+ - [Parts of the page standards](#parts-of-the-page-standards) · lines 1368–1415
33
+ - [A few equal things](#a-few-equal-things) · lines 1417–1501
34
+ - [An overview page](#an-overview-page) · lines 1503–1566
35
+ - [A record's header and empty values](#a-records-header-and-empty-values) · lines 1567–1618
36
+ - [A record's tabs, mark and facts](#a-records-tabs-mark-and-facts) · lines 1620–1688
37
+ - [Picking at random](#picking-at-random) · lines 1690–1721
38
+ - [Filling in what's missing](#filling-in-whats-missing) · lines 1723–1790
39
+ - [Values edited in place: the presets' looks](#values-edited-in-place-the-presets-looks) · lines 1792–1817
40
+ - [The sidebar and the phone's bar](#the-sidebar-and-the-phones-bar) · lines 1819–1908
41
41
 
42
42
  <!-- /index -->
43
43
 
@@ -1383,7 +1383,9 @@ into a table, a record or an overview.
1383
1383
  `more` (the page's own actions). `deleted={{ shown, onShownChange }}` adds
1384
1384
  "Show Deleted" as the menu's last item and, while it's on, an info
1385
1385
  `Notice` with "Back to the List" in a `role="status"` region that is
1386
- always there. It holds no state: the app keeps `shown`. The menu is as
1386
+ always there. It holds no state: the app keeps `shown`. Passed as a
1387
+ framed DataTable's `pageHeader` (4.106, C3) it's as wide as the
1388
+ table, so ⋯ and New end on the card's right edge. The menu is as
1387
1389
  wide as its longest item and never wraps one (4.105), as is a row's ⋯
1388
1390
  menu.
1389
1391
  - **`Timeline`: a record's dated history.** `items` newest first
@@ -5,7 +5,14 @@ export type Page<T> = {
5
5
  pageSize: number;
6
6
  };
7
7
  export type AppError = {
8
- kind: "validation" | "notfound" | "auth" | "rate_limited" | "server" | "network";
8
+ /**
9
+ * `proxy_auth`: the answer came from something in front of the app (an
10
+ * identity-aware proxy such as Cloudflare Access) whose own sign-in has
11
+ * lapsed, not from the app: a page or a redirect where JSON was
12
+ * expected. Only a full page load signs in again. Not the app's own
13
+ * session, which is `auth`.
14
+ */
15
+ kind: "validation" | "notfound" | "auth" | "rate_limited" | "server" | "network" | "proxy_auth";
9
16
  message: string;
10
17
  fieldErrors?: Record<string, string[]>;
11
18
  /**
@@ -1,6 +1,14 @@
1
1
  import { safeFetch, toAppError } from "./errors.js";
2
2
  export async function getDataLabel() {
3
- const res = await safeFetch("/environment");
3
+ let res;
4
+ try {
5
+ res = await safeFetch("/environment");
6
+ }
7
+ catch (error) {
8
+ if (error.kind === "proxy_auth")
9
+ return null;
10
+ throw error;
11
+ }
4
12
  if (res.status === 404)
5
13
  return null;
6
14
  if (res.status !== 200)
@@ -1,6 +1,13 @@
1
1
  import { type ApiResponse } from "../transport/index.js";
2
2
  import type { AppError } from "../contracts.js";
3
3
  export declare function safeFetch(path: string, init?: RequestInit): Promise<ApiResponse>;
4
+ /**
5
+ * The AppError for a lapsed sign-in at a proxy in front of the app (kind
6
+ * `proxy_auth`): only a full page load can sign in again, which
7
+ * `ErrorState` offers ("Sign In Again"). `safeFetch` throws it itself, so
8
+ * an app's gateway modules need no change to get it.
9
+ */
10
+ export declare function proxyAuthError(status?: number): AppError;
4
11
  export declare function httpStatusOf(error: AppError): number | undefined;
5
12
  export declare function toAppError(status: number, body: unknown, headers?: Headers): AppError;
6
13
  export declare function networkError(): AppError;
@@ -18,8 +18,40 @@ export async function safeFetch(path, init) {
18
18
  throw networkError();
19
19
  }
20
20
  reportAnswered();
21
+ if (isProxySignIn(response))
22
+ throw proxyAuthError(response.status);
21
23
  return response;
22
24
  }
25
+ // What a proxy in front of the app (an identity-aware proxy such as
26
+ // Cloudflare Access) sends once its own sign-in has lapsed, in place of
27
+ // the app's JSON: any redirect (never in an app's contract), or a page or
28
+ // unparseable body on a success, a 401 or a 403. The app's own 401 and
29
+ // 403 are always JSON (the foundation's error envelopes), so they still
30
+ // reach toAppError as before. Anything else not JSON (a load balancer's
31
+ // 502 page, say) is left to the caller's toAppError, as before.
32
+ function isProxySignIn(response) {
33
+ const { foreign, status } = response;
34
+ if (foreign === "opaque-redirect" || foreign === "cross-origin-redirect")
35
+ return true;
36
+ if (foreign === "html" && status >= 200 && status < 300)
37
+ return true;
38
+ return (foreign === "html" || foreign === "not-json") && (status === 401 || status === 403);
39
+ }
40
+ /**
41
+ * The AppError for a lapsed sign-in at a proxy in front of the app (kind
42
+ * `proxy_auth`): only a full page load can sign in again, which
43
+ * `ErrorState` offers ("Sign In Again"). `safeFetch` throws it itself, so
44
+ * an app's gateway modules need no change to get it.
45
+ */
46
+ export function proxyAuthError(status) {
47
+ const error = {
48
+ kind: "proxy_auth",
49
+ message: "Your sign-in has expired. Reload the page to sign in again.",
50
+ };
51
+ if (status)
52
+ STATUS.set(error, status);
53
+ return error;
54
+ }
23
55
  /**
24
56
  * Pass the response's `headers` so a 429 carries its Retry-After
25
57
  * (`retryAfterSeconds`); without them it's still `rate_limited`.
@@ -3,5 +3,15 @@ export type ApiResponse = {
3
3
  body: unknown;
4
4
  /** The response's headers (a 429's Retry-After, for one). */
5
5
  headers: Headers;
6
+ /**
7
+ * Set when the answer can't be the app's own API speaking JSON, the way
8
+ * an identity-aware proxy in front of the app answers once its sign-in
9
+ * has lapsed: `html` (a page where JSON was expected), `not-json` (a
10
+ * body that doesn't parse as JSON), `cross-origin-redirect` (followed to
11
+ * another origin) or `opaque-redirect` (a redirect not followed). The
12
+ * gateway decides what it means (`safeFetch`). Absent on every ordinary
13
+ * response.
14
+ */
15
+ foreign?: "html" | "not-json" | "cross-origin-redirect" | "opaque-redirect";
6
16
  };
7
17
  export declare function apiFetch(path: string, init?: RequestInit): Promise<ApiResponse>;
@@ -4,11 +4,53 @@
4
4
  // Owns the base URL and the raw HTTP call; knows nothing about widgets,
5
5
  // pagination, or error shapes — that translation is the gateway's job.
6
6
  const BASE_URL = "/api";
7
+ // Sent unless the caller set them: they tell a proxy in front of the app
8
+ // that this is a script asking for JSON, not a page, so a proxy that can
9
+ // answers a lapsed sign-in with a 401 rather than a redirect to its login
10
+ // page (Cloudflare Access reads X-Requested-With; others read Accept).
11
+ const DEFAULT_HEADERS = [
12
+ ["accept", "application/json"],
13
+ ["x-requested-with", "XMLHttpRequest"],
14
+ ];
7
15
  export async function apiFetch(path, init) {
8
- const response = await fetch(`${BASE_URL}${path}`, init);
16
+ const headers = new Headers(init?.headers);
17
+ for (const [name, value] of DEFAULT_HEADERS)
18
+ if (!headers.has(name))
19
+ headers.set(name, value);
20
+ // A redirect is never part of the app's contract. A proxy's redirect to
21
+ // its login page on another origin, if followed, fails as a network
22
+ // error that can't be told from being offline; not followed, it comes
23
+ // back as an opaque redirect the gateway can name. A caller can still
24
+ // pass `redirect: "follow"`.
25
+ const response = await fetch(`${BASE_URL}${path}`, { ...init, headers, redirect: init?.redirect ?? "manual" });
26
+ if (response.type === "opaqueredirect") {
27
+ return { status: response.status, body: undefined, headers: response.headers, foreign: "opaque-redirect" };
28
+ }
29
+ if (response.redirected && isOtherOrigin(response.url)) {
30
+ return { status: response.status, body: undefined, headers: response.headers, foreign: "cross-origin-redirect" };
31
+ }
9
32
  if (response.status === 204) {
10
33
  return { status: response.status, body: undefined, headers: response.headers };
11
34
  }
12
- const body = await response.json().catch(() => undefined);
13
- return { status: response.status, body, headers: response.headers };
35
+ const html = (response.headers.get("content-type") ?? "").toLowerCase().includes("text/html");
36
+ let parsed = true;
37
+ const body = await response.json().catch(() => {
38
+ parsed = false;
39
+ return undefined;
40
+ });
41
+ const foreign = html ? "html" : parsed ? undefined : "not-json";
42
+ return foreign
43
+ ? { status: response.status, body, headers: response.headers, foreign }
44
+ : { status: response.status, body, headers: response.headers };
45
+ }
46
+ function isOtherOrigin(url) {
47
+ const here = globalThis.location?.origin;
48
+ if (!here || !url)
49
+ return false;
50
+ try {
51
+ return new URL(url).origin !== here;
52
+ }
53
+ catch {
54
+ return false;
55
+ }
14
56
  }
@@ -278,6 +278,16 @@ export type DataTableProps<TData extends Record<string, unknown>, TView extends
278
278
  onViewChange?: (view: TView, id: string) => void;
279
279
  /** The pills' group name: "Views" unless set. */
280
280
  viewsLabel?: string;
281
+ /**
282
+ * The list page's header (4.106, the list standard's C3): its
283
+ * `<ListHeader>`, drawn above the views. In the framed look with
284
+ * `width="content"` the header, the views and the card share one width,
285
+ * the table's, so the header's ⋯ and New end on the card's right edge
286
+ * above a short table instead of at the page's far edge. With
287
+ * `width="full"`, a table wider than the page, or the row list on a
288
+ * phone, it spans the page as before.
289
+ */
290
+ pageHeader?: ReactNode;
281
291
  /**
282
292
  * A Columns menu at the end of the toolbar (L5): a tick for every column
283
293
  * but the first (the name) and the row actions, remembered on this device
@@ -405,4 +415,4 @@ export type DataTableTotals = {
405
415
  */
406
416
  cells?: Partial<Record<string, ReactNode>>;
407
417
  };
408
- export declare function DataTable<TData extends Record<string, unknown>, TView extends DataTableView = DataTableView>({ columns, data, total, page, pageSize, onPageChange, pageSizes, onPageSizeChange, sorting, onSortingChange, isLoading, error, onRetry, emptyTitle, emptyDescription, emptyAction, toolbar, getRowId, pinFirstColumn, pinLastColumn, enableSortingRemoval, visibleColumns, width, striped, groupBy, groupSummary, stickyGroupHeadings, stickyTop, header: showHeader, highlightRow, totals, layouts, layout: layoutProp, onLayoutChange, tableLayout, groupings, grouping: groupingProp, onGroupingChange, opens, detailPanel, onRowClick: onRowClickProp, detailRow, onDetailRowChange, detailLabel, views, activeView, onViewChange, viewsLabel, columnsMenu, rowActions, phoneRow, limit, viewAll, look, }: DataTableProps<TData, TView>): import("react").JSX.Element;
418
+ export declare function DataTable<TData extends Record<string, unknown>, TView extends DataTableView = DataTableView>({ columns, data, total, page, pageSize, onPageChange, pageSizes, onPageSizeChange, sorting, onSortingChange, isLoading, error, onRetry, emptyTitle, emptyDescription, emptyAction, toolbar, getRowId, pinFirstColumn, pinLastColumn, enableSortingRemoval, visibleColumns, width, striped, groupBy, groupSummary, stickyGroupHeadings, stickyTop, header: showHeader, highlightRow, totals, layouts, layout: layoutProp, onLayoutChange, tableLayout, groupings, grouping: groupingProp, onGroupingChange, opens, detailPanel, onRowClick: onRowClickProp, detailRow, onDetailRowChange, detailLabel, views, activeView, onViewChange, viewsLabel, pageHeader, columnsMenu, rowActions, phoneRow, limit, viewAll, look, }: DataTableProps<TData, TView>): import("react").JSX.Element;
@@ -428,7 +428,7 @@ const ROW_ACTIONS_COLUMN = {
428
428
  };
429
429
  // The cell under the actions' column: as narrow as its button.
430
430
  const ROW_ACTIONS_CELL_CLASS = 'w-px py-0';
431
- export function DataTable({ columns, data, total, page, pageSize, onPageChange, pageSizes, onPageSizeChange, sorting, onSortingChange, isLoading, error, onRetry, emptyTitle, emptyDescription, emptyAction, toolbar, getRowId, pinFirstColumn, pinLastColumn, enableSortingRemoval, visibleColumns, width = 'content', striped = false, groupBy, groupSummary, stickyGroupHeadings = false, stickyTop = '0px', header: showHeader = true, highlightRow, totals, layouts, layout: layoutProp, onLayoutChange, tableLayout, groupings, grouping: groupingProp, onGroupingChange, opens, detailPanel, onRowClick: onRowClickProp, detailRow, onDetailRowChange, detailLabel = 'Details', views, activeView = null, onViewChange, viewsLabel = 'Views', columnsMenu, rowActions, phoneRow, limit, viewAll, look = 'plain', }) {
431
+ export function DataTable({ columns, data, total, page, pageSize, onPageChange, pageSizes, onPageSizeChange, sorting, onSortingChange, isLoading, error, onRetry, emptyTitle, emptyDescription, emptyAction, toolbar, getRowId, pinFirstColumn, pinLastColumn, enableSortingRemoval, visibleColumns, width = 'content', striped = false, groupBy, groupSummary, stickyGroupHeadings = false, stickyTop = '0px', header: showHeader = true, highlightRow, totals, layouts, layout: layoutProp, onLayoutChange, tableLayout, groupings, grouping: groupingProp, onGroupingChange, opens, detailPanel, onRowClick: onRowClickProp, detailRow, onDetailRowChange, detailLabel = 'Details', views, activeView = null, onViewChange, viewsLabel = 'Views', pageHeader, columnsMenu, rowActions, phoneRow, limit, viewAll, look = 'plain', }) {
432
432
  // The switch's own state, for a table that doesn't pass `layout`.
433
433
  const [ownLayout, setOwnLayout] = useState('table');
434
434
  const requestedLayout = layoutProp ?? ownLayout;
@@ -851,7 +851,11 @@ export function DataTable({ columns, data, total, page, pageSize, onPageChange,
851
851
  const lastWidthStyle = fitsColumns && !isSuccessView && lastWidth !== null
852
852
  ? { '--data-table-last-width': `${lastWidth}px` }
853
853
  : undefined;
854
- const content = framed ? (_jsxs("div", { ref: root, className: "flex flex-col gap-4", "data-width": width, "data-look": "framed", "data-layout": layouts?.length ? currentLayout : undefined, children: [viewPills, _jsx(DetailFrame, { enabled: Boolean(detailPanel) && !cardLayout, aside: detailAside, children: _jsxs("div", { ref: body, "data-slot": "data-table-frame", className: cn(FRAME_CLASS, fitsColumns && CONTENT_WIDTH_CLASS), style: lastWidthStyle, children: [framedToolbar, _jsx("div", { "data-slot": "data-table-body", className: cn('flex flex-col gap-4', (stateView || cardLayout) && 'p-3', showPhoneRows && !stateView && FRAMED_PHONE_ROWS_CLASS), children: stateView ?? rowsView }), stateView ? null : pagination] }) })] })) : (_jsxs("div", { ref: root, className: "flex flex-col gap-4", "data-width": width, "data-layout": layouts?.length ? currentLayout : undefined, children: [viewPills, plainToolbar, _jsx("div", { ref: body, "data-slot": "data-table-body", className: cn('flex flex-col gap-4', fitsColumns && CONTENT_WIDTH_CLASS), style: lastWidthStyle, children: stateView ?? (_jsxs(DetailFrame, { enabled: Boolean(detailPanel) && !cardLayout, aside: detailAside, children: [rowsView, pagination] })) })] }));
854
+ // C3: with a header, the header, views and card are one box as wide as
855
+ // the table (the box fits its content, the card fills the box), so the
856
+ // header ends where the card does. CSS only: nothing is measured.
857
+ const sharedWidth = Boolean(pageHeader) && fitsColumns;
858
+ const content = framed ? (_jsxs("div", { ref: root, className: cn('flex flex-col gap-4', sharedWidth && CONTENT_WIDTH_CLASS), "data-width": width, "data-look": "framed", "data-shared-width": sharedWidth ? '' : undefined, "data-layout": layouts?.length ? currentLayout : undefined, children: [pageHeader, viewPills, _jsx(DetailFrame, { enabled: Boolean(detailPanel) && !cardLayout, aside: detailAside, children: _jsxs("div", { ref: body, "data-slot": "data-table-frame", className: cn(FRAME_CLASS, fitsColumns && !sharedWidth && CONTENT_WIDTH_CLASS), style: lastWidthStyle, children: [framedToolbar, _jsx("div", { "data-slot": "data-table-body", className: cn('flex flex-col gap-4', (stateView || cardLayout) && 'p-3', showPhoneRows && !stateView && FRAMED_PHONE_ROWS_CLASS), children: stateView ?? rowsView }), stateView ? null : pagination] }) })] })) : (_jsxs("div", { ref: root, className: "flex flex-col gap-4", "data-width": width, "data-layout": layouts?.length ? currentLayout : undefined, children: [pageHeader, viewPills, plainToolbar, _jsx("div", { ref: body, "data-slot": "data-table-body", className: cn('flex flex-col gap-4', fitsColumns && CONTENT_WIDTH_CLASS), style: lastWidthStyle, children: stateView ?? (_jsxs(DetailFrame, { enabled: Boolean(detailPanel) && !cardLayout, aside: detailAside, children: [rowsView, pagination] })) })] }));
855
859
  return (_jsx(EditInPlaceContext.Provider, { value: store, children: _jsxs(RowActionsContext.Provider, { value: rowActions, children: [editing && _jsx(LeaveGuard, { store: store }), width === 'content' ? _jsx("div", { className: "@container/data-table", children: content }) : content, detailPanel && (_jsx(Sheet, { open: Boolean(selectedRow) && !isWide && isSuccessView && !cardLayout, onOpenChange: (open) => {
856
860
  if (!open)
857
861
  setSelection(null);
@@ -0,0 +1,69 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { StatusKind } from '../../lib/status-kinds.js';
3
+ import type { EditInPlace } from './edit-in-place.js';
4
+ /** What a fact holds: one of the short kinds a rail can draw. */
5
+ export type EntityViewFactValue =
6
+ /** A status, drawn as its StatusMark; `word` is the status's own ("As needed"). */
7
+ {
8
+ kind: 'status';
9
+ status: StatusKind;
10
+ word?: string;
11
+ }
12
+ /** Short text: a date, a number, a person's name. One line, cut with its whole text on hover. `null` is empty. */
13
+ | {
14
+ kind: 'text';
15
+ text: string | number | null | undefined;
16
+ }
17
+ /** A few short labels (areas, tags) as badges. None is empty. */
18
+ | {
19
+ kind: 'badges';
20
+ items: readonly string[];
21
+ }
22
+ /** A count, and where it links to, if anywhere (`/discussions?provider=3`). */
23
+ | {
24
+ kind: 'count';
25
+ count: number;
26
+ to?: string;
27
+ }
28
+ /** A link out of the app, its words `name`, opening in a new tab. */
29
+ | {
30
+ kind: 'link';
31
+ href: string;
32
+ name: string;
33
+ }
34
+ /**
35
+ * Another record, by a short `name` (a person's, a place's). `short: true`
36
+ * says the app knows its titles are short: a record whose titles run
37
+ * long (a discussion, a log entry) is a section in a tab instead.
38
+ */
39
+ | {
40
+ kind: 'record';
41
+ name: string;
42
+ to: string;
43
+ short: true;
44
+ };
45
+ export type EntityViewFact = EntityViewFactValue & {
46
+ label: string;
47
+ /** What an empty value reads as, for this fact. Defaults to the view's `emptyText`. */
48
+ emptyLabel?: string;
49
+ /** Editable in place, as a field is (`inPlace.select`, `inPlace.date`); it's drawn by its kind at rest. */
50
+ edit?: EditInPlace;
51
+ };
52
+ /** A fact as the view draws it: `null` when empty. */
53
+ export declare function factValue(fact: EntityViewFactValue): ReactNode;
54
+ /** A facts section's facts as fields rows, for Details, the column and printing. */
55
+ export declare function factsAsFields(facts: readonly EntityViewFact[]): {
56
+ label: string;
57
+ value: ReactNode;
58
+ emptyLabel: string | undefined;
59
+ edit: EditInPlace | undefined;
60
+ }[];
61
+ /** The width the view needs for the facts rail beside its column: 60rem (the column ~40rem, a 300px rail, the gap). */
62
+ export declare const FACTS_RAIL_MIN_WIDTH = 960;
63
+ /**
64
+ * Whether the element's parent (the room the view has: the page's content
65
+ * area, or a dialog's body) is at least `min` px wide. A ResizeObserver
66
+ * measures it: its first report comes after layout and before paint, and
67
+ * then on every resize, so the rail and the Details tab never flash.
68
+ */
69
+ export declare function useWideParent<T extends HTMLElement>(enabled: boolean, min?: number): readonly [import("react").Dispatch<import("react").SetStateAction<T | null>>, boolean];
@@ -0,0 +1,56 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useLayoutEffect, useState } from 'react';
3
+ import { Link } from 'react-router';
4
+ import { ExternalLinkIcon } from 'lucide-react';
5
+ import { cn } from 'cn';
6
+ import { Badge } from '../ui/badge.js';
7
+ import { StatusMark } from './status-mark.js';
8
+ const LINK_CLASS = 'rounded-sm font-medium text-link underline-offset-4 outline-none hover:underline focus-visible:ring-3 focus-visible:ring-ring/50';
9
+ /** A fact as the view draws it: `null` when empty. */
10
+ export function factValue(fact) {
11
+ switch (fact.kind) {
12
+ case 'status':
13
+ return _jsx(StatusMark, { kind: fact.status, children: fact.word });
14
+ case 'text': {
15
+ if (fact.text === null || fact.text === undefined || fact.text === '')
16
+ return null;
17
+ const text = String(fact.text);
18
+ return (_jsx("span", { "data-slot": "entity-view-fact-text", title: text, className: "inline-block max-w-full truncate align-bottom tabular-nums", children: text }));
19
+ }
20
+ case 'badges':
21
+ if (fact.items.length === 0)
22
+ return null;
23
+ return (_jsx("span", { className: "inline-flex max-w-full flex-wrap gap-1", children: fact.items.map((item) => (_jsx(Badge, { variant: "outline", className: "max-w-full truncate", children: item }, item))) }));
24
+ case 'count':
25
+ return fact.to ? (_jsx(Link, { to: fact.to, className: cn(LINK_CLASS, 'tabular-nums'), children: fact.count })) : (_jsx("span", { className: "tabular-nums", children: fact.count }));
26
+ case 'link':
27
+ return (_jsxs("a", { href: fact.href, target: "_blank", rel: "noreferrer", className: cn(LINK_CLASS, 'inline-flex max-w-full items-center gap-1'), children: [_jsx("span", { className: "truncate", children: fact.name }), _jsx(ExternalLinkIcon, { "aria-hidden": "true", className: "size-3.5 shrink-0" }), _jsx("span", { className: "sr-only", children: "(opens in a new tab)" })] }));
28
+ case 'record':
29
+ return (_jsx(Link, { to: fact.to, title: fact.name, className: cn(LINK_CLASS, 'inline-block max-w-full truncate align-bottom'), children: fact.name }));
30
+ }
31
+ }
32
+ /** A facts section's facts as fields rows, for Details, the column and printing. */
33
+ export function factsAsFields(facts) {
34
+ return facts.map((fact) => ({ label: fact.label, value: factValue(fact), emptyLabel: fact.emptyLabel, edit: fact.edit }));
35
+ }
36
+ /** The width the view needs for the facts rail beside its column: 60rem (the column ~40rem, a 300px rail, the gap). */
37
+ export const FACTS_RAIL_MIN_WIDTH = 960;
38
+ /**
39
+ * Whether the element's parent (the room the view has: the page's content
40
+ * area, or a dialog's body) is at least `min` px wide. A ResizeObserver
41
+ * measures it: its first report comes after layout and before paint, and
42
+ * then on every resize, so the rail and the Details tab never flash.
43
+ */
44
+ export function useWideParent(enabled, min = FACTS_RAIL_MIN_WIDTH) {
45
+ const [node, setNode] = useState(null);
46
+ const [wide, setWide] = useState(false);
47
+ useLayoutEffect(() => {
48
+ const parent = node?.parentElement;
49
+ if (!enabled || !parent || typeof ResizeObserver === 'undefined')
50
+ return;
51
+ const observer = new ResizeObserver(() => setWide(parent.getBoundingClientRect().width >= min));
52
+ observer.observe(parent);
53
+ return () => observer.disconnect();
54
+ }, [node, enabled, min]);
55
+ return [setNode, enabled && wide];
56
+ }
@@ -2,6 +2,7 @@ import { type ReactNode } from 'react';
2
2
  import type { AppError } from '../../api/contracts.js';
3
3
  import { type EditInPlace, type EditInPlaceList } from './edit-in-place.js';
4
4
  import { type PageCrumb } from './page-trail.js';
5
+ import { type EntityViewFact } from './entity-view-facts.js';
5
6
  export type EntityViewField = {
6
7
  label: string;
7
8
  /**
@@ -30,6 +31,17 @@ export type EntityViewSection = ({
30
31
  /** The section's heading (an <h2>). Unique on the page. */
31
32
  title: string;
32
33
  fields: EntityViewField[];
34
+ } | {
35
+ /** The section's heading. */
36
+ title: string;
37
+ /**
38
+ * Short facts only (4.106, A1): each a typed kind (a status, short
39
+ * text, badges, a count, a link, a short-named record), never free
40
+ * markup. Placed `rail` with no `tab`, the section goes in the facts
41
+ * rail beside the tabs where the view has room (`factsRail`), else
42
+ * in Details, as rows like `fields`.
43
+ */
44
+ facts: EntityViewFact[];
33
45
  } | {
34
46
  title: string;
35
47
  content: ReactNode;
@@ -208,6 +220,18 @@ export type EntityViewProps = {
208
220
  printLook?: 'icon' | 'words';
209
221
  /** The rail's landmark name (its `<aside>`). Defaults to the title + " details". */
210
222
  railLabel?: string;
223
+ /**
224
+ * The facts rail (4.106, record standard A1), in the `tabs` layout:
225
+ * where the view has room (60rem beside it: a laptop's page, a record
226
+ * dialog), the sections of short facts (`facts`, placed `rail`, no
227
+ * `tab`) go in a 300px column beside the strip and the tabs, and leave
228
+ * Details; a Details tab left with nothing isn't drawn. Narrower (a
229
+ * phone), they're in Details as before. Sections with `fields` or
230
+ * `content` never go in it: a rail holds short values only.
231
+ */
232
+ factsRail?: boolean;
233
+ /** The facts rail's landmark name (its `<aside>`). Defaults to the title + " facts". */
234
+ factsRailLabel?: string;
211
235
  /**
212
236
  * In the `rail` layout, a rail section's fields: each label to the left
213
237
  * of its value (`beside`, the default since 4.81), falling back to
@@ -249,4 +273,4 @@ export type EntityViewProps = {
249
273
  trail?: readonly PageCrumb[];
250
274
  };
251
275
  };
252
- export declare function EntityView({ title, documentTitle, titleEdit, leading, subtitle, badges, actions, notice, strip, cardStrip, sections, footer, layout, detailsTab, tabCounts, tabsStickyTop, mobileOrder, railLabel, railFields, emptyFields, emptyText, printLabel, printLook, isLoading, error, onRetry, back, }: EntityViewProps): import("react").JSX.Element;
276
+ export declare function EntityView({ title, documentTitle, titleEdit, leading, subtitle, badges, actions, notice, strip, cardStrip, sections, footer, layout, detailsTab, tabCounts, tabsStickyTop, mobileOrder, railLabel, factsRail, factsRailLabel, railFields, emptyFields, emptyText, printLabel, printLook, isLoading, error, onRetry, back, }: EntityViewProps): import("react").JSX.Element;
@@ -118,6 +118,7 @@ import { FIELD_LABEL, FIELD_ROW, FIELD_ROW_BASE, FIELD_VALUE } from './field-row
118
118
  import { PageTrail } from './page-trail.js';
119
119
  import { usePageTrail } from './page-trail-context.js';
120
120
  import { entityViewTabSlug } from '../../lib/entity-view-tab.js';
121
+ import { factsAsFields, useWideParent } from './entity-view-facts.js';
121
122
  // The view's empty text and whether fields cards fold their empty ones,
122
123
  // for every section without threading them through each layout.
123
124
  const EmptyContext = createContext({ text: EMPTY_DASH, fold: false });
@@ -157,10 +158,10 @@ function FieldList({ fields, place }) {
157
158
  const shown = emptyCount === 0 || open ? fields : fields.filter((field) => !isEmptyValue(fieldValue(field)));
158
159
  return (_jsxs("div", { className: "flex flex-col gap-3", children: [shown.length > 0 && (_jsx("dl", { id: listId, className: "@container/fields flex flex-col divide-y divide-border", children: shown.map((field) => (_jsx(FieldRow, { field: field, place: place }, field.label))) })), emptyCount > 0 && (_jsxs("button", { type: "button", "data-slot": "entity-view-empty-toggle", "aria-expanded": open, "aria-controls": shown.length > 0 ? listId : undefined, onClick: () => setOpen((was) => !was), className: "inline-flex w-fit items-center gap-1 rounded-sm type-label text-muted-foreground underline underline-offset-3 outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 pointer-coarse:min-h-11", children: [open ? 'Hide Empty' : `${emptyCount} Empty`, _jsx(ChevronDownIcon, { "aria-hidden": "true", className: cn('size-3.5 transition-transform', open && 'rotate-180') })] }))] }));
159
160
  }
160
- function ViewSection({ section, inRail = false, railFields = 'beside', bare, }) {
161
+ function ViewSection({ section, inRail = false, railFields = 'beside', bare, factsRail = false, }) {
161
162
  const headingId = useId();
162
163
  const empty = useContext(EmptyContext);
163
- const body = 'fields' in section ? (_jsx(FieldList, { fields: section.fields, place: !inRail ? 'page' : railFields === 'beside' ? 'railBeside' : 'rail' })) : section.edit?.kind === 'list' ? (_jsxs("div", { className: "flex min-w-0 flex-col gap-2 type-body break-words text-foreground", children: [!isEmptyValue(section.content) && section.content, _jsx(EditableList, { label: section.title, edit: section.edit, emptyLabel: section.emptyLabel ?? empty.text })] })) : (_jsx("div", { className: "min-w-0 type-body break-words text-foreground", children: section.edit ? (_jsx(EditableValue, { label: section.title, edit: section.edit, children: _jsx(OrEmpty, { value: section.content, emptyLabel: section.emptyLabel }) })) : (_jsx(OrEmpty, { value: section.content, emptyLabel: section.emptyLabel })) }));
164
+ const body = 'fields' in section || 'facts' in section ? (_jsx(FieldList, { fields: 'fields' in section ? section.fields : factsAsFields(section.facts), place: factsRail ? 'facts' : !inRail ? 'page' : railFields === 'beside' ? 'railBeside' : 'rail' })) : section.edit?.kind === 'list' ? (_jsxs("div", { className: "flex min-w-0 flex-col gap-2 type-body break-words text-foreground", children: [!isEmptyValue(section.content) && section.content, _jsx(EditableList, { label: section.title, edit: section.edit, emptyLabel: section.emptyLabel ?? empty.text })] })) : (_jsx("div", { className: "min-w-0 type-body break-words text-foreground", children: section.edit ? (_jsx(EditableValue, { label: section.title, edit: section.edit, children: _jsx(OrEmpty, { value: section.content, emptyLabel: section.emptyLabel }) })) : (_jsx(OrEmpty, { value: section.content, emptyLabel: section.emptyLabel })) }));
164
165
  if (bare) {
165
166
  return (_jsxs("section", { "aria-labelledby": headingId, "data-slot": "entity-view-bare-section", className: "flex flex-col gap-2", children: [_jsx("h2", { id: headingId, className: bare === 'hidden' ? 'sr-only' : 'type-label text-muted-foreground', children: section.title }), body] }));
166
167
  }
@@ -184,6 +185,18 @@ const RAIL_LAYOUT = {
184
185
  // is never stuck below the fold.
185
186
  sticky: '@4xl/view:data-[fits]:sticky @4xl/view:data-[fits]:top-6',
186
187
  };
188
+ // The facts rail (A1): the record's column at its usual reading width
189
+ // (max-w-4xl) and a 300px rail beside it, top-aligned with the strip.
190
+ const FACTS_RAIL = {
191
+ page: 'max-w-[calc(var(--container-4xl)+var(--spacing)*6+300px)]',
192
+ columns: 'grid grid-cols-[minmax(0,1fr)_300px] items-start gap-6',
193
+ main: 'flex min-w-0 flex-col gap-6',
194
+ rail: 'flex min-w-0 flex-col gap-6',
195
+ };
196
+ /** A section of short facts placed `rail` with no tab: the facts rail's, where it's drawn. */
197
+ function isRailFacts(section) {
198
+ return 'facts' in section && section.placement === 'rail' && section.tab === undefined;
199
+ }
187
200
  function SkeletonCard({ rows, stacked }) {
188
201
  return (_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(Skeleton, { className: "h-5 w-32" }) }), _jsx(CardContent, { className: "flex flex-col gap-4", children: Array.from({ length: rows }, (_, row) => (_jsxs("div", { className: cn('flex flex-col gap-1', !stacked && 'sm:flex-row sm:gap-6'), children: [_jsx(Skeleton, { className: "h-5 w-32" }), _jsx(Skeleton, { className: cn('h-5', stacked ? 'w-full' : 'flex-1') })] }, row))) })] }));
189
202
  }
@@ -342,7 +355,7 @@ function tabsLayout(sections, detailsTab) {
342
355
  tabs.push({ slug, name: detailsTab, sections: facts, side: [], details: true });
343
356
  return { above: main.filter((section) => section.tab === undefined), tabs, factsInColumn: false };
344
357
  }
345
- export function EntityView({ title, documentTitle, titleEdit, leading, subtitle, badges, actions, notice, strip, cardStrip = false, sections, footer, layout = 'tabs', detailsTab = 'Details', tabCounts, tabsStickyTop, mobileOrder = 'rail-first', railLabel, railFields = 'beside', emptyFields = 'show', emptyText = EMPTY_DASH, printLabel = 'Print Notes', printLook = 'icon', isLoading, error, onRetry, back, }) {
358
+ export function EntityView({ title, documentTitle, titleEdit, leading, subtitle, badges, actions, notice, strip, cardStrip = false, sections, footer, layout = 'tabs', detailsTab = 'Details', tabCounts, tabsStickyTop, mobileOrder = 'rail-first', railLabel, factsRail = false, factsRailLabel, railFields = 'beside', emptyFields = 'show', emptyText = EMPTY_DASH, printLabel = 'Print Notes', printLook = 'icon', isLoading, error, onRetry, back, }) {
346
359
  // Editing in place: one store per view, and the leave-page prompt only
347
360
  // while a field is open (or one is always editable).
348
361
  const [store] = useState(() => new EditInPlaceStore());
@@ -355,6 +368,8 @@ export function EntityView({ title, documentTitle, titleEdit, leading, subtitle,
355
368
  // In the shell, the trail goes up in its bar; a dialog leaves the bar
356
369
  // to the list under it.
357
370
  const inShell = usePageTrail(dialog ? null : trail);
371
+ // The facts rail (A1): only in the tabs layout, never in a card dialog.
372
+ const [setRoot, wide] = useWideParent(factsRail && layout === 'tabs' && dialog?.look !== 'card');
358
373
  if (error?.kind === 'notfound') {
359
374
  // A record that doesn't exist and one that belongs to another user are
360
375
  // the same plain 404, so this never says which. Retrying can't help.
@@ -368,9 +383,9 @@ export function EntityView({ title, documentTitle, titleEdit, leading, subtitle,
368
383
  .filter((section) => section.print)
369
384
  .map((section) => ({
370
385
  title: section.title,
371
- ...('fields' in section
386
+ ...('fields' in section || 'facts' in section
372
387
  ? {
373
- fields: section.fields.map((field) => ({
388
+ fields: ('fields' in section ? section.fields : factsAsFields(section.facts)).map((field) => ({
374
389
  label: field.label,
375
390
  value: field.value !== undefined ? field.value : field.edit?.shown,
376
391
  })),
@@ -387,7 +402,8 @@ export function EntityView({ title, documentTitle, titleEdit, leading, subtitle,
387
402
  const card = dialog?.look === 'card';
388
403
  // Tabs: in the `tabs` layout the facts are a tab of their own (1A); in
389
404
  // the others a main section's `tab` (a rail one's is ignored).
390
- const shaped = layout === 'tabs' ? tabsLayout(sections, detailsTab) : null;
405
+ const railFacts = wide && !card ? sections.filter(isRailFacts) : [];
406
+ const shaped = layout === 'tabs' ? tabsLayout(railFacts.length > 0 ? sections.filter((section) => !isRailFacts(section)) : sections, detailsTab) : null;
391
407
  const tabs = shaped ? shaped.tabs : tabsOf(mainSections);
392
408
  const tabbed = (section) => section.placement !== 'rail' && section.tab !== undefined;
393
409
  const tabList = tabs.length > 0 && (_jsx(MainTabs, { tabs: tabs, label: tabsLabel, railFields: railFields, title: title, counts: tabCounts, stickyTop: tabsStickyTop }));
@@ -402,12 +418,16 @@ export function EntityView({ title, documentTitle, titleEdit, leading, subtitle,
402
418
  body = (_jsxs("div", { className: RAIL_LAYOUT.columns, children: [mobileOrder === 'main-first' && main, railSections.length > 0 && (_jsx(Rail, { label: railLabel ?? `${title ?? 'Record'} details`, sections: railSections, fields: railFields })), mobileOrder === 'rail-first' && main] }));
403
419
  }
404
420
  else if (shaped) {
405
- body = (_jsxs(_Fragment, { children: [shaped.above.map((section) => section.placement === 'rail' ? (_jsx(ViewSection, { section: section, inRail: true, railFields: railFields }, section.title)) : (_jsx(ViewSection, { section: section }, section.title))), tabList] }));
421
+ const column = (_jsxs(_Fragment, { children: [shaped.above.map((section) => section.placement === 'rail' ? (_jsx(ViewSection, { section: section, inRail: true, railFields: railFields }, section.title)) : (_jsx(ViewSection, { section: section }, section.title))), tabList] }));
422
+ body =
423
+ railFacts.length > 0 ? (_jsxs("div", { "data-slot": "entity-view-with-facts", className: FACTS_RAIL.columns, children: [_jsxs("div", { className: FACTS_RAIL.main, children: [strip && _jsx("div", { "data-slot": "entity-view-strip", children: strip }), column] }), _jsx("aside", { "aria-label": factsRailLabel ?? `${title ?? 'Record'} facts`, "data-slot": "entity-view-facts-rail", className: FACTS_RAIL.rail, children: railFacts.map((section) => (_jsx(ViewSection, { section: section, inRail: true, factsRail: true }, section.title))) })] })) : (column);
406
424
  }
407
425
  else {
408
426
  body = (_jsxs(_Fragment, { children: [sections
409
427
  .filter((section) => !tabbed(section))
410
428
  .map((section) => (_jsx(ViewSection, { section: section }, section.title))), tabList] }));
411
429
  }
412
- return (_jsx(EditInPlaceContext.Provider, { value: store, children: _jsx(EmptyContext.Provider, { value: { text: emptyText, fold: emptyFields === 'fold' }, children: _jsxs("div", { className: layout === 'rail' && !card ? RAIL_LAYOUT.page : cn('flex max-w-4xl flex-col', card ? 'gap-4' : 'gap-6'), "data-state": "success", "data-layout": layout, "data-look": card ? 'card' : undefined, children: [editing && _jsx(LeaveGuard, { store: store }), !dialog && !trail && _jsx(BackLink, { back: back }), !dialog && trail && !inShell && _jsx(PageTrail, { crumbs: trail }), _jsxs("header", { className: card ? 'flex items-start justify-between gap-3' : 'flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between', children: [_jsxs("div", { className: cn('flex min-w-0 flex-1 items-start gap-3', !card && 'sm:min-w-64 sm:gap-4'), children: [leading && (_jsx("div", { "data-slot": "entity-view-leading", className: "flex shrink-0 items-center", children: leading })), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [_jsxs("div", { "data-slot": "entity-view-title-line", className: "flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2", children: [_jsx("h1", { id: dialog?.titleId, className: cn('min-w-0 max-w-full break-words text-foreground', card ? 'type-section-title' : 'type-page-title'), children: titleEdit ? (_jsx(EditableField, { label: titleEdit.label, edit: titleEdit, layout: "inline", keepPencilRoom: true, children: title })) : (title) }), badges && (_jsx("div", { "data-slot": "entity-view-badges", className: "flex flex-wrap items-center gap-1.5", children: badges }))] }), subtitle && (_jsx("div", { "data-slot": "entity-view-subtitle", className: "type-body break-words text-muted-foreground", children: subtitle }))] })] }), card ? (_jsxs("div", { "data-slot": "entity-view-card-controls", className: "flex shrink-0 items-center gap-1", children: [printButton, actions, dialog?.controls] })) : ((actions || printButton) && (_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2 sm:justify-end", children: [printButton, actions] })))] }), _jsx("div", { role: "status", "data-slot": "entity-view-notice", className: "empty:hidden", children: notice }), strip && (!card || cardStrip) && _jsx("div", { "data-slot": "entity-view-strip", children: strip }), body, footer && (_jsx("footer", { "data-slot": "entity-view-footer", className: "type-caption text-muted-foreground", children: footer }))] }) }) }));
430
+ return (_jsx(EditInPlaceContext.Provider, { value: store, children: _jsx(EmptyContext.Provider, { value: { text: emptyText, fold: emptyFields === 'fold' }, children: _jsxs("div", { ref: setRoot, className: layout === 'rail' && !card
431
+ ? RAIL_LAYOUT.page
432
+ : cn('flex flex-col', railFacts.length > 0 ? FACTS_RAIL.page : 'max-w-4xl', card ? 'gap-4' : 'gap-6'), "data-facts-rail": railFacts.length > 0 ? '' : undefined, "data-state": "success", "data-layout": layout, "data-look": card ? 'card' : undefined, children: [editing && _jsx(LeaveGuard, { store: store }), !dialog && !trail && _jsx(BackLink, { back: back }), !dialog && trail && !inShell && _jsx(PageTrail, { crumbs: trail }), _jsxs("header", { className: card ? 'flex items-start justify-between gap-3' : 'flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between', children: [_jsxs("div", { className: cn('flex min-w-0 flex-1 items-start gap-3', !card && 'sm:min-w-64 sm:gap-4'), children: [leading && (_jsx("div", { "data-slot": "entity-view-leading", className: "flex shrink-0 items-center", children: leading })), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: [_jsxs("div", { "data-slot": "entity-view-title-line", className: "flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2", children: [_jsx("h1", { id: dialog?.titleId, className: cn('min-w-0 max-w-full break-words text-foreground', card ? 'type-section-title' : 'type-page-title'), children: titleEdit ? (_jsx(EditableField, { label: titleEdit.label, edit: titleEdit, layout: "inline", keepPencilRoom: true, children: title })) : (title) }), badges && (_jsx("div", { "data-slot": "entity-view-badges", className: "flex flex-wrap items-center gap-1.5", children: badges }))] }), subtitle && (_jsx("div", { "data-slot": "entity-view-subtitle", className: "type-body break-words text-muted-foreground", children: subtitle }))] })] }), card ? (_jsxs("div", { "data-slot": "entity-view-card-controls", className: "flex shrink-0 items-center gap-1", children: [printButton, actions, dialog?.controls] })) : ((actions || printButton) && (_jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2 sm:justify-end", children: [printButton, actions] })))] }), _jsx("div", { role: "status", "data-slot": "entity-view-notice", className: "empty:hidden", children: notice }), strip && (!card || cardStrip) && railFacts.length === 0 && _jsx("div", { "data-slot": "entity-view-strip", children: strip }), body, footer && (_jsx("footer", { "data-slot": "entity-view-footer", className: "type-caption text-muted-foreground", children: footer }))] }) }) }));
413
433
  }
@@ -9,7 +9,12 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
9
9
  // `compact` is the same state for a small container (a WidgetCard): less
10
10
  // padding and the icon beside the title instead of in a box above it, so
11
11
  // one failing widget reads as that widget's problem, not the page's.
12
- import { AlertCircleIcon } from 'lucide-react';
12
+ //
13
+ // Kind `proxy_auth` (a lapsed sign-in at a proxy in front of the app, such
14
+ // as Cloudflare Access) offers "Sign In Again" in place of any retry: a
15
+ // full page load, so the proxy's own sign-in runs. Retrying the request
16
+ // would only get the proxy's page again.
17
+ import { AlertCircleIcon, LogInIcon } from 'lucide-react';
13
18
  import { cn } from 'cn';
14
19
  import { Button } from '../ui/button.js';
15
20
  import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, } from '../ui/empty.js';
@@ -20,8 +25,13 @@ const TITLE_BY_KIND = {
20
25
  auth: 'Not authorized',
21
26
  rate_limited: 'Too many attempts',
22
27
  validation: 'Check the form',
28
+ proxy_auth: 'Sign-in expired',
23
29
  };
30
+ function reloadPage() {
31
+ window.location.reload();
32
+ }
24
33
  export function ErrorState({ error, onRetry, size = 'default', className, }) {
25
34
  const compact = size === 'compact';
26
- return (_jsxs(Empty, { className: cn(compact && 'gap-3 p-4', className), "data-state": "error", "data-size": size, children: [_jsxs(EmptyHeader, { className: cn(compact && 'gap-1'), children: [compact ? (_jsxs(EmptyTitle, { className: "flex items-center gap-1.5", children: [_jsx(AlertCircleIcon, { "aria-hidden": "true", className: "size-4 shrink-0 text-destructive-text" }), TITLE_BY_KIND[error.kind]] })) : (_jsxs(_Fragment, { children: [_jsx(EmptyMedia, { variant: "icon", children: _jsx(AlertCircleIcon, { className: "text-destructive" }) }), _jsx(EmptyTitle, { children: TITLE_BY_KIND[error.kind] })] })), _jsx(EmptyDescription, { children: error.message })] }), onRetry && (_jsx(EmptyContent, { children: _jsx(Button, { size: "sm", variant: "outline", onClick: onRetry, children: "Try Again" }) }))] }));
35
+ const signInAgain = error.kind === 'proxy_auth';
36
+ return (_jsxs(Empty, { className: cn(compact && 'gap-3 p-4', className), "data-state": "error", "data-size": size, children: [_jsxs(EmptyHeader, { className: cn(compact && 'gap-1'), children: [compact ? (_jsxs(EmptyTitle, { className: "flex items-center gap-1.5", children: [_jsx(AlertCircleIcon, { "aria-hidden": "true", className: "size-4 shrink-0 text-destructive-text" }), TITLE_BY_KIND[error.kind]] })) : (_jsxs(_Fragment, { children: [_jsx(EmptyMedia, { variant: "icon", children: _jsx(AlertCircleIcon, { className: "text-destructive-text" }) }), _jsx(EmptyTitle, { children: TITLE_BY_KIND[error.kind] })] })), _jsx(EmptyDescription, { children: error.message })] }), signInAgain ? (_jsx(EmptyContent, { children: _jsxs(Button, { size: "sm", onClick: reloadPage, children: [_jsx(LogInIcon, { "aria-hidden": "true" }), "Sign In Again"] }) })) : (onRetry && (_jsx(EmptyContent, { children: _jsx(Button, { size: "sm", variant: "outline", onClick: onRetry, children: "Try Again" }) })))] }));
27
37
  }
@@ -2,6 +2,7 @@ export declare const FIELD_ROW: {
2
2
  page: string;
3
3
  rail: string;
4
4
  railBeside: string;
5
+ facts: string;
5
6
  };
6
7
  /** A row's own spacing, before its place's grid. */
7
8
  export declare const FIELD_ROW_BASE = "flex flex-col gap-1 py-3 first:pt-0 last:pb-0";
@@ -18,6 +18,9 @@ export const FIELD_ROW = {
18
18
  page: 'sm:@sm/fields:grid sm:@sm/fields:grid-cols-[minmax(--spacing(32),--spacing(48))_minmax(0,1fr)] sm:@sm/fields:gap-6',
19
19
  rail: '@lg/fields:grid @lg/fields:grid-cols-[minmax(--spacing(32),--spacing(48))_1fr] @lg/fields:gap-6',
20
20
  railBeside: '@2xs/fields:grid @2xs/fields:grid-cols-[minmax(--spacing(24),--spacing(28))_minmax(0,1fr)] @2xs/fields:items-baseline @2xs/fields:gap-4 @2xs/fields:py-2.5 @lg/fields:grid-cols-[minmax(--spacing(32),--spacing(48))_1fr] @lg/fields:gap-6',
21
+ // The facts rail (4.106, A1): a 300px card, so side by side from a
22
+ // 16rem list, the label column a little narrower again.
23
+ facts: '@3xs/fields:grid @3xs/fields:grid-cols-[--spacing(24)_minmax(0,1fr)] @3xs/fields:items-baseline @3xs/fields:gap-3 @3xs/fields:py-2.5',
21
24
  };
22
25
  /** A row's own spacing, before its place's grid. */
23
26
  export const FIELD_ROW_BASE = 'flex flex-col gap-1 py-3 first:pt-0 last:pb-0';
@@ -116,7 +116,7 @@ export function ModuleCard({ title, icon: Icon, category, to, href, value, note,
116
116
  'data-slot': 'module-card-band',
117
117
  className: cn(BAND_LINK_CLASS, category && BAND_CLASS[category]),
118
118
  };
119
- const card = (_jsxs(Card, { "data-slot": "module-card", "data-state": state, className: cn('glow-edge relative h-full min-w-0 gap-0 py-0', mobile === 'row' && 'max-md:hidden', className), children: [href !== undefined ? (_jsxs("a", { href: href, target: "_blank", rel: "noreferrer", ...bandProps, children: [band, _jsx(NewTabMark, {})] })) : (_jsx(Link, { to: to, ...bandProps, children: band })), _jsxs("div", { id: bodyId, "data-slot": "module-card-body", "aria-busy": state === 'loading' || undefined, className: "flex flex-1 flex-col gap-0.5 px-3 py-2 density-compact:py-1.5 max-sm:px-2", children: [state === 'error' ? (_jsxs(_Fragment, { children: [_jsxs("p", { className: "flex items-center gap-1.5 type-body text-foreground", children: [_jsx(AlertCircleIcon, { "aria-hidden": "true", className: "size-4 shrink-0 text-destructive-text" }), _jsxs("span", { className: "min-w-0", children: ["Couldn't load", error?.message && _jsxs("span", { className: "sr-only", children: [": ", error.message] })] })] }), onRetry && (_jsx(Button, { size: "sm", variant: "outline", onClick: onRetry, "aria-describedby": titleId, className: "relative z-10 mt-1 self-start", children: "Retry" }))] })) : state === 'loading' ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "sr-only", children: "Loading" }), _jsx(Skeleton, { "data-state": "loading", className: "my-0.5 h-6 w-12" })] })) : (value !== undefined && (_jsx("span", { "data-slot": "module-card-value", className: "type-numeric text-foreground", children: value }))), note && state !== 'error' && (_jsx("span", { className: "truncate type-body text-muted-foreground", title: note, children: note }))] }), action &&
119
+ const card = (_jsxs(Card, { "data-slot": "module-card", "data-state": state, className: cn('glow-edge relative h-full min-w-0 gap-0 py-0', mobile === 'row' && 'max-md:hidden', className), children: [href !== undefined ? (_jsxs("a", { href: href, target: "_blank", rel: "noreferrer", ...bandProps, children: [band, _jsx(NewTabMark, {})] })) : (_jsx(Link, { to: to, ...bandProps, children: band })), _jsxs("div", { id: bodyId, "data-slot": "module-card-body", "aria-busy": state === 'loading' || undefined, className: "flex flex-1 flex-col gap-0.5 px-3 py-2 density-compact:py-1.5 max-sm:px-2", children: [state === 'error' ? (_jsxs(_Fragment, { children: [_jsxs("p", { className: "flex items-center gap-1.5 type-body text-foreground", children: [_jsx(AlertCircleIcon, { "aria-hidden": "true", className: "size-4 shrink-0 text-destructive-text" }), _jsxs("span", { className: "min-w-0", children: ["Couldn't load", error?.message && _jsxs("span", { className: "sr-only", children: [": ", error.message] })] })] }), error?.kind === 'proxy_auth' ? (_jsx(Button, { size: "sm", variant: "outline", onClick: () => window.location.reload(), "aria-describedby": titleId, className: "relative z-10 mt-1 self-start", children: "Sign In Again" })) : (onRetry && (_jsx(Button, { size: "sm", variant: "outline", onClick: onRetry, "aria-describedby": titleId, className: "relative z-10 mt-1 self-start", children: "Retry" })))] })) : state === 'loading' ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "sr-only", children: "Loading" }), _jsx(Skeleton, { "data-state": "loading", className: "my-0.5 h-6 w-12" })] })) : (value !== undefined && (_jsx("span", { "data-slot": "module-card-value", className: "type-numeric text-foreground", children: value }))), note && state !== 'error' && (_jsx("span", { className: "truncate type-body text-muted-foreground", title: note, children: note }))] }), action &&
120
120
  (action.href !== undefined ? (_jsxs("a", { href: action.href, target: "_blank", rel: "noreferrer", "aria-describedby": titleId, className: ACTION_CLASS, children: [_jsx("span", { className: "truncate", children: action.label }), _jsx(NewTabMark, {})] })) : (_jsx(Link, { to: action.to, "aria-describedby": titleId, className: ACTION_CLASS, children: _jsx("span", { className: "truncate", children: action.label }) })))] }));
121
121
  if (mobile === 'tiles')
122
122
  return card;
@@ -1,7 +1,7 @@
1
1
  import { useRender } from "@base-ui/react/use-render";
2
2
  import { type VariantProps } from "class-variance-authority";
3
3
  declare const badgeVariants: (props?: ({
4
- variant?: "link" | "success" | "default" | "outline" | "secondary" | "ghost" | "destructive" | "solid" | "info" | "warning" | "outline-success" | "outline-warning" | "outline-info" | "outline-destructive" | "tinted-success" | "tinted-warning" | "tinted-info" | "tinted-destructive" | null | undefined;
4
+ variant?: "default" | "link" | "success" | "outline" | "secondary" | "ghost" | "destructive" | "solid" | "info" | "warning" | "outline-success" | "outline-warning" | "outline-info" | "outline-destructive" | "tinted-success" | "tinted-warning" | "tinted-info" | "tinted-destructive" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
6
  declare function Badge({ className, variant, render, ...props }: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
7
7
  export { Badge, badgeVariants };
@@ -1,7 +1,7 @@
1
1
  import { Button as ButtonPrimitive } from "@base-ui/react/button";
2
2
  import { type VariantProps } from "class-variance-authority";
3
3
  declare const buttonVariants: (props?: ({
4
- variant?: "link" | "default" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
4
+ variant?: "default" | "link" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
5
5
  size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
7
  declare function Button({ className, variant, size, ...props }: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>): import("react").JSX.Element;
package/dist/gateway.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { networkError, safeFetch, toAppError } from './api/gateway/errors.js';
1
+ export { networkError, proxyAuthError, safeFetch, toAppError } from './api/gateway/errors.js';
2
2
  export type { ApiResponse } from './api/transport/index.js';
package/dist/gateway.js CHANGED
@@ -2,4 +2,4 @@
2
2
  // (src/api/gateway/<entity>.ts) build on: the single fetch path and the
3
3
  // wire-error -> AppError translation. Lint allows importing this only from
4
4
  // src/api/gateway/, which is what keeps every other layer off the network.
5
- export { networkError, safeFetch, toAppError } from './api/gateway/errors.js';
5
+ export { networkError, proxyAuthError, safeFetch, toAppError } from './api/gateway/errors.js';
package/dist/index.d.ts CHANGED
@@ -28,6 +28,7 @@ export { EmptyText, type EmptyTextProps } from './components/app/empty-value.js'
28
28
  export { isEmptyValue } from './lib/empty-value.js';
29
29
  export { IconAction, type IconActionProps } from './components/app/icon-action.js';
30
30
  export { EntityView, type EntityViewEmptyFields, type EntityViewField, type EntityViewLayout, type EntityViewMobileOrder, type EntityViewPlacement, type EntityViewProps, type EntityViewRailFields, type EntityViewSection, } from './components/app/entity-view.js';
31
+ export { type EntityViewFact, type EntityViewFactValue } from './components/app/entity-view-facts.js';
31
32
  export { entityViewTabSlug } from './lib/entity-view-tab.js';
32
33
  export { usePrinting } from './components/app/print-context.js';
33
34
  export { RecordDialogRoute, RecordLink, type RecordDialogRouteProps, type RecordLinkProps, } from './components/app/record-dialog.js';
package/dist/index.js CHANGED
@@ -34,6 +34,7 @@ export { EmptyText } from './components/app/empty-value.js';
34
34
  export { isEmptyValue } from './lib/empty-value.js';
35
35
  export { IconAction } from './components/app/icon-action.js';
36
36
  export { EntityView, } from './components/app/entity-view.js';
37
+ export {} from './components/app/entity-view-facts.js';
37
38
  export { entityViewTabSlug } from './lib/entity-view-tab.js';
38
39
  export { usePrinting } from './components/app/print-context.js';
39
40
  export { RecordDialogRoute, RecordLink, } from './components/app/record-dialog.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tristan2828/ui-foundation",
3
- "version": "4.105.0",
3
+ "version": "4.107.0",
4
4
  "description": "Shared UI foundation for contract-first, database-backed React apps: shadcn primitives, DataTable/EntityForm composites, auth, the gateway error seam, design tokens, lint rules and the AI playbook.",
5
5
  "license": "MIT",
6
6
  "repository": {