@mistriwork/kit 1.0.0-rc.15 → 1.0.0-rc.17

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 (40) hide show
  1. package/dist/client/components/CardsList.js +7 -1
  2. package/dist/client/components/ChartFigure.d.ts +3 -2
  3. package/dist/client/components/ChartFigure.js +7 -5
  4. package/dist/client/components/Export.js +8 -4
  5. package/dist/client/components/Grid.js +21 -2
  6. package/dist/client/components/JsonView.d.ts +2 -1
  7. package/dist/client/components/JsonView.js +2 -2
  8. package/dist/client/components/PageCurrent.d.ts +10 -1
  9. package/dist/client/components/PageCurrent.js +10 -6
  10. package/dist/client/components/PageFields.js +15 -4
  11. package/dist/client/components/PageHead.js +11 -9
  12. package/dist/client/components/PageHeadline.d.ts +3 -1
  13. package/dist/client/components/PageHeadline.js +3 -2
  14. package/dist/client/components/PageMetrics.js +13 -4
  15. package/dist/client/components/PageRelated.js +17 -2
  16. package/dist/client/components/PageSectionBox.js +6 -3
  17. package/dist/client/components/PageSections.js +1 -1
  18. package/dist/client/components/PageTimeline.js +29 -16
  19. package/dist/client/components/SecondLine.d.ts +15 -0
  20. package/dist/client/components/SecondLine.js +18 -0
  21. package/dist/client/components/Value.d.ts +3 -0
  22. package/dist/client/components/Value.js +32 -5
  23. package/dist/client/components/dashboardModel.d.ts +2 -2
  24. package/dist/client/components/jsonModel.d.ts +3 -0
  25. package/dist/client/components/jsonModel.js +8 -0
  26. package/dist/client/components/pageContext.js +2 -1
  27. package/dist/client/components/pageModel.d.ts +10 -5
  28. package/dist/client/components/textMeasure.d.ts +2 -0
  29. package/dist/client/components/textMeasure.js +16 -2
  30. package/dist/client/copy/record/components/PageTimeline.d.ts +1 -0
  31. package/dist/client/copy/record/components/PageTimeline.js +1 -0
  32. package/dist/client/copy/workbench/components/Export.d.ts +3 -2
  33. package/dist/client/copy/workbench/components/Export.js +3 -2
  34. package/dist/client/export.d.ts +5 -4
  35. package/dist/client/export.js +40 -19
  36. package/dist/client/features.css +2 -0
  37. package/dist/client/page.css +37 -2
  38. package/dist/client/shellMode.d.ts +6 -0
  39. package/dist/client/structure.css +7 -0
  40. package/package.json +4 -4
@@ -12,6 +12,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
12
  import { useContext, useEffect, useRef } from 'react';
13
13
  import { disclosure, findTable } from '../core.js';
14
14
  import { GridSkeleton } from './Skeleton.js';
15
+ import { Icon } from './Icon.js';
15
16
  import { sectionClass } from './pageModel.js';
16
17
  import { PageRenderContext, spoken } from './pageContext.js';
17
18
  import { useMessageLanguage } from './useMessageLanguage.js';
@@ -21,6 +22,8 @@ import { say } from '../copy/record/components/PageSectionBox.js';
21
22
  /* A suggested page titles a related list by its table's name (`visit_attachment`), which an App says as words, as
22
23
  every untitled list's head already is. An authored title has words or capitals of its own and is left as written. */
23
24
  const titled = (title) => (/^[a-z][a-z0-9_.]*$/.test(title) ? spoken(title) : title);
25
+ /** A section's mark leading its heading. A note draws its own over its words, so it has none here. */
26
+ const mark = (section) => section.icon && section.kind !== 'note' ? _jsx(Icon, { name: section.icon, size: 16, className: "dash-section-icon" }) : null;
24
27
  /** A section's box: its heading, or a fold when it is a later group of fields. */
25
28
  export function SectionBox({ section, body, foldable, broken, crashed, hidden, tools, }) {
26
29
  useMessageLanguage();
@@ -49,7 +52,7 @@ export function SectionBox({ section, body, foldable, broken, crashed, hidden, t
49
52
  return (_jsxs("section", { className: `${sectionClass(section)} page-broken`, children: [_jsx("h2", { className: "page-section-head", children: heading || say('thisSection') }), crashed ?? _jsx(Problem, { text: broken ?? '' })] }));
50
53
  }
51
54
  if (foldable && heading) {
52
- return (_jsx("section", { className: sectionClass(section), children: _jsxs("details", { className: "page-fold", ref: details, open: true, children: [_jsx("summary", { className: "page-section-head page-fold-head", children: _jsx("span", { children: heading }) }), content] }) }));
55
+ return (_jsx("section", { className: sectionClass(section), children: _jsxs("details", { className: "page-fold", ref: details, open: true, children: [_jsx("summary", { className: "page-section-head page-fold-head", children: _jsxs("span", { children: [mark(section), heading] }) }), content] }) }));
53
56
  }
54
57
  /* A gallery is a picture: its title names it for assistive technology,
55
58
  and a "Photos" heading over the photos says nothing a sighted reader
@@ -57,9 +60,9 @@ export function SectionBox({ section, body, foldable, broken, crashed, hidden, t
57
60
  const gallery = section.kind === 'list' && section.presentation === 'gallery';
58
61
  /* An embedded list view's heading is the way to the whole of it: the view's own room, where the reader has it. */
59
62
  const room = section.view && !preview ? navigate?.(section.view) : undefined;
60
- const headed = heading && (_jsx("h2", { className: gallery ? 'page-section-head visually-hidden' : 'page-section-head', children: room ? (_jsx("a", { className: "page-section-link", ...room, children: heading })) : (heading) }));
63
+ const headed = heading && (_jsxs("h2", { className: gallery ? 'page-section-head visually-hidden' : 'page-section-head', children: [mark(section), room ? (_jsx("a", { className: "page-section-link", ...room, children: heading })) : (heading)] }));
61
64
  return (_jsxs("section", { className: `${sectionClass(section)}${gallery ? ' page-gallery' : ''}`, hidden: hidden || undefined, children: [tools ? (_jsxs("div", { className: "page-section-bar", children: [headed, tools] })) : (headed), content] }));
62
65
  }
63
66
  export function Loading({ section }) {
64
- return (_jsxs("section", { className: `${sectionClass(section)} loading`, children: [section.title && _jsx("h2", { className: "page-section-head", children: titled(section.title) }), section.kind === 'list' ? _jsx(GridSkeleton, { columns: 4, rows: 3 }) : _jsx("div", { className: "sk-bar" })] }));
67
+ return (_jsxs("section", { className: `${sectionClass(section)} loading`, children: [section.title && (_jsxs("h2", { className: "page-section-head", children: [mark(section), titled(section.title)] })), section.kind === 'list' ? _jsx(GridSkeleton, { columns: 4, rows: 3 }) : _jsx("div", { className: "sk-bar" })] }));
65
68
  }
@@ -273,7 +273,7 @@ export function Sections({ page, base, recordKey: key, plans, entry, onLabel, on
273
273
  an empty list is neither hidden nor collapsed, its tab shows it and the strip already folds it. */
274
274
  const tabbed = (section) => section.kind === 'list' && section.presentation !== 'gallery' && (section.width === undefined || !inAppPage());
275
275
  /* Outside a strip, such a list is left out or said in one line with its neighbours (PageEmptyRun.tsx). */
276
- const emptyable = (section) => section.kind === 'list' && Boolean(section.emptyMode) && section.presentation !== 'card';
276
+ const emptyable = (section) => section.kind === 'list' && Boolean(section.emptyMode) && (section.presentation !== 'card' || section.emptyMode === 'hide');
277
277
  /* Where a tab holds nothing but such lists, it never ends up with nothing. */
278
278
  const onlyEmptyable = items.length > 0 && items.every(({ section }) => emptyable(section));
279
279
  for (let i = 0; i < items.length; i += 1) {
@@ -6,7 +6,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
6
6
  * the same related-create plan and form a related list uses.
7
7
  */
8
8
  import { useContext, useId, useLayoutEffect, useRef, useState } from 'react';
9
- import { useQuery, useQueryClient } from '@tanstack/react-query';
9
+ import { keepPreviousData, useQuery, useQueryClient } from '@tanstack/react-query';
10
10
  import { findTable, labelPath, state } from '../core.js';
11
11
  import { shell } from '../shellMode.js';
12
12
  import { resourceOf } from './appRooms.js';
@@ -67,9 +67,10 @@ const runsOn = (r, prev) => Boolean(prev && !Array.isArray(prev) && !isEvent(pre
67
67
  function Row({ r, multi, conversation, continued = false, reacted, }) {
68
68
  const words = r.text == null || r.text === '' ? ('') : (_jsx(Value, { tableId: r.table, col: r.textColumn, value: r.text, compact: true, links: true, wholeText: conversation }));
69
69
  const tone = r.tone ? { 'data-tone': r.tone } : {};
70
+ const body = _jsx("div", { className: "timeline-text prose", children: words });
70
71
  if (isEvent(r))
71
72
  return (_jsxs("li", { className: "timeline-row is-compact", "data-timeline-row": true, ...tone, children: [_jsx("span", { className: "timeline-text", children: words }), _jsx(When, { at: r.when })] }));
72
- return (_jsxs("li", { className: `timeline-row${r.tone ? ' is-tinted' : ''}${r.other ? ' is-other' : ''}${continued ? ' is-continued' : ''}`, "data-timeline-row": true, ...tone, children: [r.by && !continued ? (_jsx("span", { className: `timeline-avatar avatar avatar-c${hueOf(r.by)}`, "aria-hidden": "true", children: initialsOf(r.by) })) : (_jsx("span", { className: "timeline-avatar", "aria-hidden": "true" })), _jsxs("span", { className: "timeline-head", children: [r.by && (continued ? _jsx("span", { className: "visually-hidden", children: r.by }) : _jsx("span", { className: "timeline-by", children: r.by })), r.detail != null && (_jsx("span", { className: "timeline-kind", children: _jsx(Value, { tableId: r.table, col: r.detailColumn, value: r.detail, compact: true }) })), multi && _jsx("span", { className: "timeline-source", children: r.source }), _jsx(When, { at: r.when })] }), _jsx("div", { className: "timeline-text prose", children: words }), reacted && r.entry && _jsx(Reactions, { reactions: reacted.reactions, entry: r.entry, tally: reacted.tally })] }));
73
+ return (_jsxs("li", { className: `timeline-row${r.tone ? ' is-tinted' : ''}${r.other ? ' is-other' : ''}${continued ? ' is-continued' : ''}`, "data-timeline-row": true, ...tone, children: [r.by && !continued ? (_jsx("span", { className: `timeline-avatar avatar avatar-c${hueOf(r.by)}`, "aria-hidden": "true", children: initialsOf(r.by) })) : (_jsx("span", { className: "timeline-avatar", "aria-hidden": "true" })), !r.by && body, _jsxs("span", { className: "timeline-head", children: [r.by && (continued ? _jsx("span", { className: "visually-hidden", children: r.by }) : _jsx("span", { className: "timeline-by", children: r.by })), r.detail != null && (_jsx("span", { className: "timeline-kind", children: _jsx(Value, { tableId: r.table, col: r.detailColumn, value: r.detail, compact: true }) })), multi && _jsx("span", { className: "timeline-source", children: r.source }), _jsx(When, { at: r.when })] }), r.by && body, reacted && r.entry && _jsx(Reactions, { reactions: reacted.reactions, entry: r.entry, tally: reacted.tally })] }));
73
74
  }
74
75
  /** Two or more events in a row, said as their count and opened in place. */
75
76
  function Fold({ rows, multi, conversation }) {
@@ -101,9 +102,16 @@ export function TimelineSection({ section, plan, base, recordKey }) {
101
102
  const atFoot = useRef(true);
102
103
  /* A row's line and detail are values of their stream's table, dressed by its display rules and drawn by its
103
104
  value components as a grid cell is; `table` is whose rules they are. */
105
+ /* "Show more" asks for another `limit` rows of every stream, on demand: the first page is the rows the page's
106
+ plan already asked, so a section nobody opens further costs no more than before. */
107
+ const step = section.limit ?? 20;
108
+ const [pages, setPages] = useState(1);
104
109
  const data = useQuery({
105
- queryKey: ['page-timeline', plan.streams, section.limit, section.tone, section.compact, section.streams],
110
+ queryKey: ['page-timeline', plan.streams, section.limit, section.tone, section.compact, section.streams, pages],
111
+ /* The rows already drawn stay while the next page comes, so the list does not blank or jump. */
112
+ placeholderData: keepPreviousData,
106
113
  queryFn: async () => {
114
+ let streamMore = false;
107
115
  const answers = await Promise.all(streams.map(async (stream, s) => {
108
116
  /* The stream as authored: its own tone and compact stand over the section's rules. */
109
117
  const own = section.streams?.[s];
@@ -122,13 +130,15 @@ export function TimelineSection({ section, plan, base, recordKey }) {
122
130
  if (stream.side?.error)
123
131
  throw new Error(stream.side.error);
124
132
  const asked = timelineReads({ table: (id) => findTable(id), namePath: (target) => labelPath(target) }, stream);
125
- const view = asked.view;
133
+ const view = pages > 1 ? { ...asked.view, limit: step * pages } : asked.view;
126
134
  const named = asked.view !== stream.view ? asked.view.columns?.at(-1)?.path : undefined;
127
135
  const byPath = named ?? stream.by;
128
136
  const others = asked.side ? api('/api/view/run', { view: asked.side, offset: 0 }) : undefined;
129
137
  const [got, otherRows] = await Promise.all([api('/api/view/run', { view, offset: 0 }), others]);
130
138
  if (!('view' in got))
131
139
  throw new Error(got.errors[0]?.message ?? say('thisActivityStreamCould'));
140
+ if (got.more)
141
+ streamMore = true;
132
142
  if (otherRows && !('view' in otherRows))
133
143
  throw new Error(otherRows.errors[0]?.message ?? say('thisActivityStreamCould'));
134
144
  const keyOf = (row, names, cols) => JSON.stringify(stream.key.map((column) => row[cols[names.indexOf(column)] ?? column] ?? null));
@@ -137,19 +147,19 @@ export function TimelineSection({ section, plan, base, recordKey }) {
137
147
  const names = (view.columns ?? []).map((c) => c.path);
138
148
  const cols = got.columns ?? names;
139
149
  const atCol = cols[names.indexOf(stream.at)] ?? stream.at;
140
- const showCol = cols[names.indexOf(stream.show)] ?? stream.show;
141
- const detailCol = stream.detail ? (cols[names.indexOf(stream.detail)] ?? stream.detail) : null;
150
+ const showCol = cols[names.indexOf(stream.text)] ?? stream.text;
151
+ const detailCol = stream.badge ? (cols[names.indexOf(stream.badge)] ?? stream.badge) : null;
142
152
  const byCol = byPath ? (cols[names.indexOf(byPath)] ?? byPath) : null;
143
153
  const markCol = (name) => cols[names.indexOf(name)] ?? name;
144
154
  const entryCol = stream.reacts ? markCol(stream.reacts) : undefined;
145
- const shown = table && listColumn(table, stream.show);
146
- const detailed = table && stream.detail ? listColumn(table, stream.detail) : undefined;
155
+ const shown = table && listColumn(table, stream.text);
156
+ const detailed = table && stream.badge ? listColumn(table, stream.badge) : undefined;
147
157
  return got.rows.map((row) => ({
148
158
  when: row[atCol] == null ? '' : String(row[atCol]),
149
159
  text: row[showCol] ?? null,
150
- ...(shown ? { textColumn: { ...shown, name: stream.show } } : {}),
160
+ ...(shown ? { textColumn: { ...shown, name: stream.text } } : {}),
151
161
  detail: detailCol && row[detailCol] != null && row[detailCol] !== '' ? row[detailCol] : null,
152
- ...(detailed ? { detailColumn: { ...detailed, name: stream.detail } } : {}),
162
+ ...(detailed ? { detailColumn: { ...detailed, name: stream.badge } } : {}),
153
163
  table: table?.id ?? stream.from,
154
164
  by: byCol && row[byCol] != null ? String(row[byCol]) : null,
155
165
  source: streamSource(stream.from, table),
@@ -172,11 +182,11 @@ export function TimelineSection({ section, plan, base, recordKey }) {
172
182
  })(),
173
183
  }));
174
184
  }));
175
- return answers
185
+ const merged = answers
176
186
  .flat()
177
187
  .filter((r) => r.when)
178
- .sort((a, b) => (a.when < b.when ? 1 : a.when > b.when ? -1 : 0))
179
- .slice(0, section.limit ?? 20);
188
+ .sort((a, b) => (a.when < b.when ? 1 : a.when > b.when ? -1 : 0));
189
+ return { rows: merged.slice(0, step * pages), more: streamMore || merged.length > step * pages };
180
190
  },
181
191
  staleTime: 0,
182
192
  });
@@ -237,7 +247,7 @@ export function TimelineSection({ section, plan, base, recordKey }) {
237
247
  scroller.scrollTop = scroller.scrollHeight;
238
248
  }, [conversation, scroller, data.data]);
239
249
  /* Reactions are counted for the entries on the page, once they are known: one read for all of them. */
240
- const entries = [...new Set((data.data ?? []).flatMap((r) => (r.entry && !isEvent(r) ? [r.entry.value] : [])))];
250
+ const entries = [...new Set((data.data?.rows ?? []).flatMap((r) => (r.entry && !isEvent(r) ? [r.entry.value] : [])))];
241
251
  const { tally, waiting } = useReactionTally(section.reactions, entries);
242
252
  const reacted = section.reactions && tally ? { reactions: section.reactions, tally } : undefined;
243
253
  /* Rows with reactions wait for them too, under the same skeleton: a row of kinds arriving later pushed every message
@@ -246,7 +256,7 @@ export function TimelineSection({ section, plan, base, recordKey }) {
246
256
  return _jsx(Loading, { section: section });
247
257
  if (data.isError)
248
258
  return _jsx(SectionBox, { section: section, body: null, foldable: false, broken: data.error.message });
249
- const rows = conversation ? [...(data.data ?? [])].reverse() : (data.data ?? []);
259
+ const rows = conversation ? [...(data.data?.rows ?? [])].reverse() : (data.data?.rows ?? []);
250
260
  /* A message names its stream only where the messages come from more than one: a conversation whose second stream
251
261
  is all quiet lines (time logged) said "Activity" over every message, a word that told the reader nothing. */
252
262
  const multi = new Set(rows.filter((r) => !isEvent(r)).map((r) => r.source)).size > 1;
@@ -281,7 +291,10 @@ export function TimelineSection({ section, plan, base, recordKey }) {
281
291
  }, children: ["+ ", section.create.label] })] }));
282
292
  /* The composer sends through the App's commands (TimelineComposer.tsx), drawn through the shell's slot. */
283
293
  const { TimelineComposer } = shell().slots;
284
- return (_jsx(SectionBox, { section: section, foldable: false, body: _jsxs(_Fragment, { children: [composeButton, rows.length ? (_jsx("div", { className: conversation ? 'timeline-scroll' : undefined, ...(conversation ? { 'data-scrolls': '' } : {}), ref: setScroller, children: _jsx("ol", { className: "timeline", children: byDay(rows).map(({ day, items }, d) => (_jsxs("li", { className: "timeline-day", children: [day && (_jsx("time", { className: "timeline-day-label", dateTime: day, children: formatDayHeading(day) })), _jsx("ol", { className: "timeline-rows", children: items.map((item, i) => Array.isArray(item) ? (_jsx(Fold, { rows: item, multi: multi, conversation: conversation }, `${item[0].when} ${item[0].table}`)) : (_jsx(Row, { r: item, multi: multi, conversation: conversation, continued: sided && runsOn(item, items[i - 1]), reacted: reacted }, `${item.when} ${item.table}`))) })] }, day || d))) }) })) : (_jsx(Empty, { text: say('nothingDatedYetForThisRecord') })), section.composer && !preview && shell().inApp() && TimelineComposer && (_jsx(TimelineComposer, { composer: section.composer, recordKey: recordKey, table: base?.id, onSent: () => void queries.invalidateQueries({
294
+ /* Older rows come in place: above a conversation (its oldest is at the top), below a feed. The button holds its row
295
+ whether or not it is working, so nothing moves under the pointer. */
296
+ const showMore = data.data?.more && (_jsx("div", { className: "timeline-more", children: _jsx("button", { type: "button", className: "ghost", disabled: data.isPlaceholderData, onClick: () => setPages(pages + 1), children: say('showMore') }) }));
297
+ return (_jsx(SectionBox, { section: section, foldable: false, body: _jsxs(_Fragment, { children: [composeButton, conversation && showMore, rows.length ? (_jsx("div", { className: conversation ? 'timeline-scroll' : undefined, ...(conversation ? { 'data-scrolls': '' } : {}), ref: setScroller, children: _jsx("ol", { className: "timeline", children: byDay(rows).map(({ day, items }, d) => (_jsxs("li", { className: "timeline-day", children: [day && (_jsx("time", { className: "timeline-day-label", dateTime: day, children: formatDayHeading(day) })), _jsx("ol", { className: "timeline-rows", children: items.map((item, i) => Array.isArray(item) ? (_jsx(Fold, { rows: item, multi: multi, conversation: conversation }, `${item[0].when} ${item[0].table}`)) : (_jsx(Row, { r: item, multi: multi, conversation: conversation, continued: sided && runsOn(item, items[i - 1]), reacted: reacted }, `${item.when} ${item.table}`))) })] }, day || d))) }) })) : (_jsx(Empty, { text: say('nothingDatedYetForThisRecord') })), !conversation && showMore, section.composer && !preview && shell().inApp() && TimelineComposer && (_jsx(TimelineComposer, { composer: section.composer, recordKey: recordKey, table: base?.id, onSent: () => void queries.invalidateQueries({
285
298
  predicate: (query) => ['page-list', 'page-timeline', 'page-metric', 'page-breakdown'].includes(String(query.queryKey[0])),
286
299
  }) }))] }) }));
287
300
  }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * A column's second line: the column its display rule names (`subtitle`, another column of the same record), drawn
3
+ * quietly under the value wherever there is room for one (docs/design.md). Its own module so a test that stands a
4
+ * value in for Value.tsx still draws the second line it is about.
5
+ */
6
+ import type { ReactNode } from 'react';
7
+ /** The second line of `column` on `row`, as the record or the list read it with the row; none where it has no value. */
8
+ export declare function secondLine(tableId: string | undefined, column: string | undefined, row: Readonly<Record<string, unknown>> | undefined): string | undefined;
9
+ /** Something drawn with its column's second line quietly under it, as a list's cell does. */
10
+ export declare function Subtitled({ tableId, column, row, children, }: {
11
+ tableId: string | undefined;
12
+ column: string | undefined;
13
+ row: Readonly<Record<string, unknown>> | undefined;
14
+ children: ReactNode;
15
+ }): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal>;
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { columnDisplay } from '../core.js';
3
+ import { subtitlePath } from './valueModel.js';
4
+ /** The second line of `column` on `row`, as the record or the list read it with the row; none where it has no value. */
5
+ export function secondLine(tableId, column, row) {
6
+ if (tableId === undefined || !column || !row)
7
+ return undefined;
8
+ const path = subtitlePath(columnDisplay(tableId, column), column);
9
+ const second = path !== undefined && Object.hasOwn(row, path) ? row[path] : undefined;
10
+ return second === null || second === undefined || second === '' ? undefined : String(second);
11
+ }
12
+ /** Something drawn with its column's second line quietly under it, as a list's cell does. */
13
+ export function Subtitled({ tableId, column, row, children, }) {
14
+ const second = secondLine(tableId, column, row);
15
+ if (second === undefined)
16
+ return children;
17
+ return (_jsxs("span", { className: "value-subtitled", children: [children, _jsx("span", { className: "value-sub", children: second })] }));
18
+ }
@@ -1,5 +1,6 @@
1
1
  import type { ColumnMeta, TableMeta } from '@mistriwork/engine/shared/schema.js';
2
2
  import { AvatarText, Dressed } from './Dressed.js';
3
+ export { secondLine } from './SecondLine.js';
3
4
  export { AvatarText, Dressed };
4
5
  interface ValueProps {
5
6
  col: ColumnMeta | undefined;
@@ -17,6 +18,8 @@ interface ValueProps {
17
18
  wholeText?: boolean;
18
19
  /** The record the value is of, where a money rule reads its currency from another of its columns (money.ts). */
19
20
  row?: Readonly<Record<string, unknown>>;
21
+ /** Draw the rule's `subtitle` (a column of the same record) as a second line under the value, as a list's cell does. */
22
+ subtitled?: boolean;
20
23
  }
21
24
  /** A value as the record and the page show it: dressed when the app says, plain otherwise. */
22
25
  export declare function Value(props: ValueProps): import("react").JSX.Element;
@@ -11,17 +11,20 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
11
  import { Fragment } from 'react';
12
12
  import { api, columnDisplay, columnLabel, emptyWord, findTable, humanName, openRecord, refsFrom, state, toast } from '../core.js';
13
13
  import { opensRecord } from '../recordIntent.js';
14
- import { dressFor, linkFor, maskedText, ruleSays } from './valueModel.js';
14
+ import { dressFor, linkFor, maskedText, ruleSays, wordFor } from './valueModel.js';
15
15
  import { rowCurrency } from '@mistriwork/engine/shared/money.js';
16
16
  import { dueOpen } from './dueOpen.js';
17
17
  import { JsonValue } from './JsonValue.js';
18
- import { jsonValueOf, previewOf } from './jsonModel.js';
18
+ import { itemsText, jsonValueOf, previewOf } from './jsonModel.js';
19
19
  import { TAGS_TYPE, tagChips } from '@mistriwork/engine/shared/tagLists.js';
20
20
  import { AvatarText, Dressed, Said } from './Dressed.js';
21
21
  import { ValueSlot } from './valueRenderers.js';
22
22
  import { Icon } from './Icon.js';
23
23
  import { say } from '../copy/record/components/Value.js';
24
24
  import { shellBody } from '../shellHost.js';
25
+ import { Subtitled } from './SecondLine.js';
26
+ /* The second line is a value's too: the board reads it from here, as it reads every value's words. */
27
+ export { secondLine } from './SecondLine.js';
25
28
  /* Drawn here and in the grid; the rules that draw them read no global (Dressed.tsx). */
26
29
  export { AvatarText, Dressed };
27
30
  /** A value that is a link: mail, a call, or a web page, which opens beside the App rather than in place of it. */
@@ -46,6 +49,11 @@ function breakable(text) {
46
49
  }
47
50
  /** A value as the record and the page show it: dressed when the app says, plain otherwise. */
48
51
  export function Value(props) {
52
+ const { subtitled, row, col, tableId } = props;
53
+ const body = _jsx(BareValue, { ...props });
54
+ return subtitled ? (_jsx(Subtitled, { tableId: tableId, column: col?.name, row: row, children: body })) : (body);
55
+ }
56
+ function BareValue(props) {
49
57
  const { col, value, tableId, compact = false, links = !compact } = props;
50
58
  const rule = tableId === undefined ? null : columnDisplay(tableId, col?.name ?? '');
51
59
  const drawn = _jsx(DrawnValue, { ...props, rule: rule });
@@ -102,10 +110,29 @@ function PlatformValue({ col, value, tableId, compact = false, links = !compact,
102
110
  return (_jsx("span", { className: "null", title: "null", children: emptyWord() }));
103
111
  return (_jsx("span", { className: "value-tags", children: chips.map((chip) => (_jsx("span", { className: `record-tag tone tone-${chip.tone ?? 'neutral'}`, children: chip.label }, chip.label))) }));
104
112
  }
105
- const json = jsonValueOf(col, value);
106
- if (json)
107
- return compact ? _jsx("span", { className: "json-preview-text", children: previewOf(json.value) }) : _jsx(JsonValue, { value: json.value });
108
113
  const declared = tableId === undefined ? null : columnDisplay(tableId, col?.name ?? '');
114
+ const json = jsonValueOf(col, value);
115
+ if (json) {
116
+ /* A list of plain values (roles, tags, sizes) is its values, each said in the rule's words as a single value is
117
+ (`values`, `humanize`), plainly: Raw and Copy belong to a document whose braces a reader may want, and are
118
+ not drawn over a row of chips. */
119
+ const items = Array.isArray(json.value) && json.value.length && json.value.every((item) => item === null || typeof item !== 'object');
120
+ const shown = items
121
+ ? json.value.map((item) => (typeof item === 'string' ? (wordFor(declared, item) ?? item) : item))
122
+ : json.value;
123
+ /* Where there is one line (a cell, a header's fact, a figure) a list of plain values is its words, comma between,
124
+ with no brackets: "Ram, Truck". Chips are for a field block, where there is room for them; `format: 'items'`
125
+ asks for one item per line there instead, as a text of lines is said. */
126
+ if (items && compact) {
127
+ const text = itemsText(shown);
128
+ return (_jsx("span", { className: "json-preview-text", title: text, children: text }));
129
+ }
130
+ if (items && declared?.format === 'items')
131
+ return (_jsx("ul", { className: "value-items", children: shown.map((item, index) => (_jsx("li", { children: String(item) }, index))) }));
132
+ if (compact)
133
+ return _jsx("span", { className: "json-preview-text", children: previewOf(shown) });
134
+ return _jsx(JsonValue, { value: shown, bar: !items });
135
+ }
109
136
  /* A money column whose currency is the record's own: the code its row holds. */
110
137
  const owned = declared?.currencyColumn && row
111
138
  ? { ...declared, currency: rowCurrency(declared, row, declared.currency ?? '') || undefined }
@@ -83,8 +83,8 @@ export interface Section {
83
83
  label: string;
84
84
  view: string;
85
85
  };
86
- /** note: the dashboard's banner, its tag and its picture. */
87
- variant?: 'banner';
86
+ /** note: quiet or callout, or the banner a `banner()` is served as, with its tag and its picture. */
87
+ variant?: 'quiet' | 'callout' | 'banner';
88
88
  eyebrow?: string;
89
89
  image?: import('@mistriwork/engine/shared/servedApp.js').LandingImage;
90
90
  error?: string;
@@ -68,6 +68,9 @@ export declare function countLabel(value: object, locale?: string): string;
68
68
  * the document is and a value out of context says nothing.
69
69
  */
70
70
  export declare function previewOf(value: object): string;
71
+ /** A list of plain values said as words, comma between: where one line is all there is room for (a cell, a header's
72
+ fact, a figure). A null among them is a gap nobody reads. */
73
+ export declare function itemsText(items: readonly unknown[]): string;
71
74
  /** What a scalar is best shown as. */
72
75
  export type Scalar = {
73
76
  kind: 'null';
@@ -189,6 +189,14 @@ export function previewOf(value) {
189
189
  const more = keys.length - shown.length;
190
190
  return `{ ${shown.join(', ')}${more ? `, +${more}` : ''} }`;
191
191
  }
192
+ /** A list of plain values said as words, comma between: where one line is all there is room for (a cell, a header's
193
+ fact, a figure). A null among them is a gap nobody reads. */
194
+ export function itemsText(items) {
195
+ return items
196
+ .filter((item) => item !== null && item !== undefined)
197
+ .map((item) => String(item))
198
+ .join(', ');
199
+ }
192
200
  export function scalarOf(value, locale) {
193
201
  if (value === null || value === undefined)
194
202
  return { kind: 'null' };
@@ -9,7 +9,7 @@
9
9
  */
10
10
  import { createContext, useContext } from 'react';
11
11
  import { ownedBy } from '../requestIdentity.js';
12
- import { api as request, findTable, labelPath, recordLabel, state } from '../core.js';
12
+ import { api as request, columnDisplay, findTable, labelPath, recordLabel, state } from '../core.js';
13
13
  import { humanName } from '@mistriwork/engine/shared/model.js';
14
14
  import { shell } from '../shellMode.js';
15
15
  import { resourceOf } from './appRooms.js';
@@ -43,5 +43,6 @@ export function recordReadNames() {
43
43
  namePath: (table) => labelPath(table),
44
44
  table: (id) => findTable(id),
45
45
  defined: (id) => resourceOf(shell().app(), id)?.defined,
46
+ display: (id, column) => columnDisplay(id, column),
46
47
  };
47
48
  }
@@ -12,6 +12,9 @@ export interface PageSection {
12
12
  sort?: string;
13
13
  height?: number;
14
14
  target?: number;
15
+ /** A line chart's curve and a donut's middle words, as a dashboard chart's. */
16
+ curve?: 'smooth' | 'straight';
17
+ total?: string;
15
18
  /** A note's words, mark and one way on. */
16
19
  text?: string;
17
20
  icon?: import('@mistriwork/engine/shared/appIcons.js').AppIconName;
@@ -42,8 +45,8 @@ export interface PageSection {
42
45
  from: string;
43
46
  path: string;
44
47
  at: string;
45
- show: string;
46
- detail?: string;
48
+ text: string;
49
+ badge?: string;
47
50
  by?: string;
48
51
  filter?: string;
49
52
  side?: string;
@@ -84,15 +87,17 @@ export interface PageSection {
84
87
  headerActions?: string[];
85
88
  /** A headline's second figure, its figure's earlier value, and small print. */
86
89
  subfigure?: string;
90
+ subtitle?: string;
87
91
  was?: string;
88
92
  note?: string;
89
93
  /** A similar list: rows of the page's own table sharing the record's `same` values, `near` its numbers. */
90
94
  similar?: import('@mistriwork/engine/shared/pageModel.js').PageSimilar;
95
+ opens?: string;
91
96
  workflow?: ResolvedWorkflowStatus;
92
97
  create?: RelatedCreate<string>;
93
98
  empty?: import('@mistriwork/engine/shared/listPresentations.js').AppListEmpty;
94
99
  /** Authored `empty: 'hide' | 'collapse'`: the list is left out, or said in one line, while it has no rows. */
95
- emptyMode?: 'hide' | 'collapse';
100
+ emptyMode?: 'hide' | 'collapse' | 'show';
96
101
  /** The rows under a header for each record they share (shared/pageModel.ts, PageGroup); `limit` is then the rows to a group. */
97
102
  group?: import('@mistriwork/engine/shared/pageModel.js').PageGroup;
98
103
  /** Columns summed in the list's footer, over every row it matches. */
@@ -142,8 +147,8 @@ export interface SectionPlan {
142
147
  view?: ViewDef;
143
148
  from: string;
144
149
  at: string;
145
- show: string;
146
- detail?: string;
150
+ text: string;
151
+ badge?: string;
147
152
  by?: string;
148
153
  /** A timeline's `side`: the stream's key columns, and its read narrowed to the other party's rows. */
149
154
  key?: string[];
@@ -1,2 +1,4 @@
1
1
  import type { TextMeasure } from './gridSizing.js';
2
+ /** Whether `font` is set in faces that are loaded (or that no `@font-face` declares: a system face). */
3
+ export declare function fontLoaded(font: string): boolean;
2
4
  export declare function textMeasure(font: string): TextMeasure | undefined;
@@ -1,7 +1,19 @@
1
1
  /** Text widths in one font, from a shared canvas; `undefined` where there is
2
2
  no 2D context (the component tests), which falls back to counting. */
3
3
  let measuringContext;
4
+ /* Only measures of a face that is here: a canvas measures a face still on its way in the fallback's metrics, and that
5
+ number kept for the page's life sized every column from the wrong font, so a table's columns came out differently
6
+ from one load to the next, by whether the webfont beat the first measure. */
4
7
  const measures = new Map();
8
+ /** Whether `font` is set in faces that are loaded (or that no `@font-face` declares: a system face). */
9
+ export function fontLoaded(font) {
10
+ try {
11
+ return globalThis.document?.fonts?.check(font) ?? true;
12
+ }
13
+ catch {
14
+ return true;
15
+ }
16
+ }
5
17
  export function textMeasure(font) {
6
18
  if (measuringContext === undefined) {
7
19
  try {
@@ -14,7 +26,8 @@ export function textMeasure(font) {
14
26
  const context = measuringContext;
15
27
  if (!context)
16
28
  return undefined;
17
- const known = measures.get(font);
29
+ const loaded = fontLoaded(font);
30
+ const known = loaded ? measures.get(font) : undefined;
18
31
  if (known)
19
32
  return known;
20
33
  const cache = new Map();
@@ -30,6 +43,7 @@ export function textMeasure(font) {
30
43
  cache.set(text, width);
31
44
  return width;
32
45
  };
33
- measures.set(font, measure);
46
+ if (loaded)
47
+ measures.set(font, measure);
34
48
  return measure;
35
49
  }
@@ -2,6 +2,7 @@ export declare const say: import("../../../messages.js").RoomMessage<{
2
2
  readonly thisActivityStreamHasNoView: "This activity stream has no view definition.";
3
3
  readonly thisActivityStreamCould: "This activity stream could not be read.";
4
4
  readonly nothingDatedYetForThisRecord: "Nothing dated yet for this record.";
5
+ readonly showMore: "Show more";
5
6
  readonly updates: {
6
7
  readonly one: "{count} update";
7
8
  readonly other: "{count} updates";
@@ -4,5 +4,6 @@ export const say = defineMessages({
4
4
  thisActivityStreamHasNoView: 'This activity stream has no view definition.',
5
5
  thisActivityStreamCould: 'This activity stream could not be read.',
6
6
  nothingDatedYetForThisRecord: 'Nothing dated yet for this record.',
7
+ showMore: 'Show more',
7
8
  updates: { one: '{count} update', other: '{count} updates' },
8
9
  });
@@ -5,7 +5,7 @@ export declare const say: import("../../../messages.js").RoomMessage<{
5
5
  readonly one: "this page ({count} row)";
6
6
  readonly other: "this page ({count} rows)";
7
7
  };
8
- readonly allMatchingRows: "all matching rows ({capped})";
8
+ readonly allMatchingRows: "all matching rows ({count})";
9
9
  readonly downloadThisResult: "Download this result";
10
10
  readonly export: "Export";
11
11
  readonly chooseColumns: "Choose columns…";
@@ -13,7 +13,8 @@ export declare const say: import("../../../messages.js").RoomMessage<{
13
13
  readonly agent: "Agent";
14
14
  readonly theQueryTheShape: "The query, the shape and how to run it over MCP — not the rows";
15
15
  readonly copyThisPosition: "Copy this position";
16
- readonly cappedAtRowsTheSame: "Capped at {max} rows — the same ceiling every read in this tool has. Narrow the query to export the rest.";
16
+ readonly streamedPastTheCap: "Every matching row is written, read in batches as it downloads.";
17
+ readonly stoppedAtTheCap: "This file stops at {max} rows: a support visit records each read whole, so its export is one read, not a stream.";
17
18
  readonly pickAtLeastOne: "Pick at least one column to export.";
18
19
  readonly columnsToExport: "Columns to export";
19
20
  readonly tickedColumnsAreWritten: "Ticked columns are written in the order the table declares them. Choosing a column that is not on screen re-runs the query to fetch it.";
@@ -4,7 +4,7 @@ export const say = defineMessages({
4
4
  none: 'None',
5
5
  thatQueryNoLonger: 'That query no longer returns rows.',
6
6
  thisPageRows: { one: 'this page ({count} row)', other: 'this page ({count} rows)' },
7
- allMatchingRows: 'all matching rows ({capped})',
7
+ allMatchingRows: 'all matching rows ({count})',
8
8
  downloadThisResult: 'Download this result',
9
9
  export: 'Export',
10
10
  chooseColumns: 'Choose columns…',
@@ -12,7 +12,8 @@ export const say = defineMessages({
12
12
  agent: 'Agent',
13
13
  theQueryTheShape: 'The query, the shape and how to run it over MCP — not the rows',
14
14
  copyThisPosition: 'Copy this position',
15
- cappedAtRowsTheSame: 'Capped at {max} rows — the same ceiling every read in this tool has. Narrow the query to export the rest.',
15
+ streamedPastTheCap: 'Every matching row is written, read in batches as it downloads.',
16
+ stoppedAtTheCap: 'This file stops at {max} rows: a support visit records each read whole, so its export is one read, not a stream.',
16
17
  pickAtLeastOne: 'Pick at least one column to export.',
17
18
  columnsToExport: 'Columns to export',
18
19
  tickedColumnsAreWritten: 'Ticked columns are written in the order the table declares them. Choosing a column that is not on screen re-runs the query to fetch it.',
@@ -45,10 +45,11 @@ export declare function saveExport(kind: any, table: any, columns: any, rows: an
45
45
  /**
46
46
  * All matching rows, as a file the server streams (`POST /api/export`):
47
47
  * read in batches and written as each arrives, so neither side holds the
48
- * whole result as objects and nothing is counted. False where the server
49
- * does not offer it — a tenant host, a row-policy App (its replies wait for
50
- * the policy to settle, which a stream cannot) — and the caller exports
51
- * through `/api/run` as before.
48
+ * whole result as objects and nothing is counted. A tenant's file is asked
49
+ * on its lease (the shell's `tenant.exportFile`); a row-policy App's is read
50
+ * through the policy like its list. False where the server does not offer
51
+ * it — a support visit, whose every read is ledgered whole — and the caller
52
+ * exports through `/api/run` as before.
52
53
  *
53
54
  * @param {'csv' | 'json'} kind
54
55
  * @param {string} table