@mistriwork/kit 1.0.0-rc.46 → 1.0.0-rc.48

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.
@@ -80,7 +80,9 @@ export function planColumn(meta, name, rows) {
80
80
  them turns invoice 1001 into "1,001", which reads as a quantity and is
81
81
  not what the value means. */
82
82
  const identifier = Boolean(meta?.primaryKey || meta?.references || meta?.identifier);
83
- const decimals = identifier ? 0 : Math.max(0, ...values.map(countDecimals));
83
+ /* A worked-out figure (an average, a computed number) says its places, never the six an average of whole
84
+ numbers carries: `places` (shared/rollups.ts DERIVED_PLACES). */
85
+ const decimals = identifier ? 0 : Math.min(meta?.places ?? 6, Math.max(0, ...values.map(countDecimals)));
84
86
  const group = !identifier && values.some((v) => Math.abs(Number(v)) >= 10000);
85
87
  return { ...plan, kind: 'number', align: 'right', decimals, group, identifier };
86
88
  }
@@ -1,6 +1,6 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import { type DisplayRule } from './valueModel.js';
3
- import type { ColumnMeta, TableMeta } from '@mistriwork/engine/shared/schema.js';
3
+ import type { ColumnMeta, DatabaseSchema, TableMeta } from '@mistriwork/engine/shared/schema.js';
4
4
  import type { TrailList } from '../recordTrail.js';
5
5
  import type { TableSizing } from '@mistriwork/engine/shared/tableSizing.js';
6
6
  import type { CellDraw } from './gridCellModel.js';
@@ -92,6 +92,16 @@ interface Plan {
92
92
  group?: boolean;
93
93
  showTime?: boolean;
94
94
  }
95
+ /**
96
+ * The column a list names its rows by, among those it draws: the App's record name where it says one, else the
97
+ * table's label, else the first column of words. The App's name comes first: a field report's tickets, named by their
98
+ * title, were cut to fifteen characters beside a wide `number` column, which the schema alone calls the name.
99
+ */
100
+ export declare function rowNameColumn(named: {
101
+ schema: DatabaseSchema;
102
+ table: TableMeta;
103
+ authored: string | false | undefined;
104
+ } | undefined, asked: readonly string[], words: (name: string) => boolean): string | undefined;
95
105
  /** A row's folded columns, each drawn as its own cell would draw it, for the detail line under the row's name. */
96
106
  export declare function foldedOf(more: NonNullable<CellColumn['more']>, record: Row): {
97
107
  name: string;
@@ -31,7 +31,7 @@ import { createColumnHelper, tableFeatures, useTable } from '@tanstack/react-tab
31
31
  import { useVirtualizer } from '@tanstack/react-virtual';
32
32
  import { columnDisplay, columnLabel, currentEntry, emptyWord, keyOf, openRecord, peekRecord, prefersPages, primaryKey, rowLabel, state, viewportBox, viewportScale, } from '../core.js';
33
33
  import { opensRecord } from '../recordIntent.js';
34
- import { labelColumn as namingColumn } from '@mistriwork/engine/shared/schema.js';
34
+ import { labelColumn as namingColumn, labelPath as namingPath } from '@mistriwork/engine/shared/schema.js';
35
35
  import { ListSubtitles } from './listSubtitles.js';
36
36
  import { datesAmong, dressFor, leadTonePath, maskedText, ruleSays, subtitlePath } from './valueModel.js';
37
37
  import { currencyPath } from '@mistriwork/engine/shared/money.js';
@@ -63,7 +63,7 @@ import { AvatarPhotoContext, AvatarPhotos, avatarOwner } from './avatarPhotos.js
63
63
  import { jsonValueOf, previewOf } from './jsonModel.js';
64
64
  import { vocabularyWord } from '@mistriwork/engine/shared/model.js';
65
65
  import { shell } from '../shellMode.js';
66
- import { parseLabelTemplate } from '@mistriwork/engine/shared/recordLabel.js';
66
+ import { LABEL_SEGMENT, parseLabelTemplate } from '@mistriwork/engine/shared/recordLabel.js';
67
67
  import { say } from '../copy/lists/components/Grid.js';
68
68
  import { TAGS_TYPE, tagChips } from '@mistriwork/engine/shared/tagLists.js';
69
69
  import { addHostListener, removeHostListener, shellBody } from '../shellHost.js';
@@ -155,6 +155,26 @@ function drawnWords(display, plan, value, label) {
155
155
  }
156
156
  return (dress?.kind === 'tone' || dress?.kind === 'word' || dress?.kind === 'mark' ? dress.label : dress?.text) ?? value;
157
157
  }
158
+ /**
159
+ * The column a list names its rows by, among those it draws: the App's record name where it says one, else the
160
+ * table's label, else the first column of words. The App's name comes first: a field report's tickets, named by their
161
+ * title, were cut to fifteen characters beside a wide `number` column, which the schema alone calls the name.
162
+ */
163
+ export function rowNameColumn(named, asked, words) {
164
+ const naming = !named
165
+ ? undefined
166
+ : named.authored === undefined && !named.table.labelTemplate
167
+ ? namingColumn(named.table)
168
+ : namingPath(named.schema, named.table, named.authored);
169
+ if (naming === LABEL_SEGMENT) {
170
+ /* A name the catalog computes is the `$label` the grid is handed, where it asks for it; where it does not, the
171
+ template's own first column, which is what the name leads with. Neither: the first column of words, as before. */
172
+ const parsed = named?.table.labelTemplate ? parseLabelTemplate(named.table.labelTemplate) : undefined;
173
+ const first = parsed && 'paths' in parsed ? parsed.paths.find((path) => asked.includes(path)) : undefined;
174
+ return asked.includes(LABEL_SEGMENT) ? LABEL_SEGMENT : (first ?? asked.find(words));
175
+ }
176
+ return naming && asked.includes(naming) ? naming : asked.find(words);
177
+ }
158
178
  /** A row's folded columns, each drawn as its own cell would draw it, for the detail line under the row's name. */
159
179
  export function foldedOf(more, record) {
160
180
  /* Empty says nothing, and a yes-or-no says its head where it is yes ("Listed online") and nothing where it is no. */
@@ -617,14 +637,9 @@ export function Grid({ table, data, hide, labels, totals, totalsLabel = say('tot
617
637
  removeHostListener(window, VISUAL_THEME_EVENT, themeChanged);
618
638
  };
619
639
  }, [sizing]);
620
- /* The column that names the row — the table's label where it is drawn,
621
- else the first text — is read whole before the others (gridSizing.ts). */
622
- const titleName = useMemo(() => {
623
- const naming = table ? namingColumn(table) : undefined;
624
- return naming && asked.includes(naming)
625
- ? naming
626
- : asked.find((name) => plans.get(name)?.kind === 'text' || Boolean(referenceLabels?.[name]));
627
- }, [table, asked, plans, referenceLabels]);
640
+ /* The column that names the row is read whole before the others (gridSizing.ts). */
641
+ const recordLabel = table ? shell().recordLabel(table.id) : undefined;
642
+ const titleName = useMemo(() => rowNameColumn(table && { schema: state.schema, table, authored: recordLabel }, asked, (name) => plans.get(name)?.kind === 'text' || Boolean(referenceLabels?.[name])), [table, state.schema, recordLabel, asked, plans, referenceLabels]);
628
643
  const sizeHints = useMemo(() => asked.map((name) => {
629
644
  const plan = plans.get(name);
630
645
  const labelColumn = referenceLabels?.[name];
@@ -191,8 +191,9 @@ export function MultiStepForm({ steps, children, step, initialStep = 0, onStepCh
191
191
  void (last ? complete() : move('next'));
192
192
  };
193
193
  /* The bar and its count beside it. The count is the bar's own name said again for the eye, so it is hidden from
194
- assistive technology, which hears the bar's. */
195
- const progressRow = (_jsxs("div", { className: "multi-step-progress", children: [_jsx(ProgressBar, { min: 1, value: current + 1, max: boundedSteps.length, label: say('progress', { step: current + 1, count: boundedSteps.length, label: active.label }) }), _jsx("span", { className: "multi-step-count", "aria-hidden": "true", children: say('stepOf', { step: current + 1, count: boundedSteps.length }) })] }));
194
+ assistive technology, which hears the bar's. A form of one step has no way through to show: "Step 1 of 1" over a
195
+ full bar said nothing, so neither is drawn. */
196
+ const progressRow = boundedSteps.length > 1 && (_jsxs("div", { className: "multi-step-progress", children: [_jsx(ProgressBar, { min: 1, value: current + 1, max: boundedSteps.length, label: say('progress', { step: current + 1, count: boundedSteps.length, label: active.label }) }), _jsx("span", { className: "multi-step-count", "aria-hidden": "true", children: say('stepOf', { step: current + 1, count: boundedSteps.length }) })] }));
196
197
  const panelNode = (_jsx("div", { id: panelId, ref: panel, className: "multi-step-panel", role: "group", "aria-labelledby": titleId, onKeyDown: enter, children: children(active, current) }));
197
198
  const problemNode = (_jsx("p", { ref: said, tabIndex: -1, className: "multi-step-problem", role: "alert", "aria-live": "polite", hidden: !problem, children: problem }));
198
199
  /* A page's steps beside the form (drawn, and shown only where the page is wide enough, by structure.css, so the
@@ -12,7 +12,7 @@ import { ownedBy } from '../requestIdentity.js';
12
12
  import { columnDisplay, columnLabel, recordLabel, api as coreApi, findTable, openRecord, rowLabel, state, writeAllowed } from '../core.js';
13
13
  import { relatedRows } from '../prefs.js';
14
14
  import { formatBytes, formatNumber, formatRelativeDay } from '../locale.js';
15
- import { columnKind, linkTarget } from '@mistriwork/engine/shared/schema.js';
15
+ import { columnKind, isAppendOnly, linkTarget } from '@mistriwork/engine/shared/schema.js';
16
16
  import { recordViewKey, recordViewLabel, withoutParent, withoutParentName } from '@mistriwork/engine/shared/referenceModel.js';
17
17
  import { groupsBody, listView, relatedCountsBody } from '@mistriwork/engine/shared/recordReads.js';
18
18
  import { GROUP_ROWS_DEFAULT, GROUPS_DEFAULT } from '@mistriwork/engine/shared/pageModel.js';
@@ -438,7 +438,8 @@ function RelatedList({ section, plan, base, recordKey, onEdit, collapsed, counte
438
438
  const owner = connection ?? state.activeConnection;
439
439
  /* Rename and Remove are offered where the server would accept them — the
440
440
  catalog's own answer for this reader, as the record's Delete asks it —
441
- and never in a preview, which writes nothing. */
441
+ and never in a preview, which writes nothing. A file the reader only
442
+ appends is never changed after its upload, so it is never renamed. */
442
443
  const nameColumn = file && table ? table.columns.find((column) => column.name === file.name) : undefined;
443
444
  const connectionWritable = Boolean(state.connections?.some((c) => c.id === owner && c.writable));
444
445
  const renamable = Boolean(!preview &&
@@ -448,6 +449,7 @@ function RelatedList({ section, plan, base, recordKey, onEdit, collapsed, counte
448
449
  !nameColumn.primaryKey &&
449
450
  nameColumn.writable !== false &&
450
451
  !table.isView &&
452
+ !isAppendOnly(table) &&
451
453
  writeAllowed(table.id) &&
452
454
  connectionWritable);
453
455
  /* A grouped list's rows move between groups, and to their place in a ranked one (groupMoves.tsx), on the board's
@@ -275,7 +275,7 @@ export function Palette({ prefill = '', onClose }) {
275
275
  }, children: _jsxs("div", { className: `palette${inApp ? ' palette-grouped' : ''}`, role: "dialog", "aria-modal": "true", "aria-label": say('navigation.search'), children: [_jsx("input", { ref: input, type: "text", className: "palette-input", placeholder: shell().inApp() ? say('searchRecordsPagesAndCommands') : say('goToATable'), "aria-label": say('navigation.search'), autoComplete: "off", spellCheck: false, role: "combobox", "aria-autocomplete": "list", "aria-expanded": "true", "aria-controls": "palette-list", "aria-activedescendant": shown.length ? `palette-o${current}` : undefined, value: query, onChange: (e) => {
276
276
  setQuery(e.currentTarget.value);
277
277
  setActive(0);
278
- } }), _jsx("div", { ref: list, className: "palette-list", id: "palette-list", role: "listbox", children: !shown.length
278
+ } }), _jsx("div", { ref: list, className: "palette-list", id: "palette-list", role: "listbox", "aria-label": say('navigation.search'), children: !shown.length
279
279
  ? settled && _jsx("p", { className: "palette-empty", children: term ? say('nothingMatches', { term }) : say('nothingToGo') })
280
280
  : inApp
281
281
  ? grouped.map(({ group, items, from: first }) => {
@@ -556,7 +556,10 @@ export function sayValue(col, value) {
556
556
  ? formatNumber(text)
557
557
  : plan.identifier
558
558
  ? text
559
- : formatNumber(n, { maximumFractionDigits: 6, useGrouping: !YEAR_NAME.test((col?.name ?? '').split('.').pop() ?? '') });
559
+ : formatNumber(n, {
560
+ maximumFractionDigits: col?.places ?? 6,
561
+ useGrouping: !YEAR_NAME.test((col?.name ?? '').split('.').pop() ?? ''),
562
+ });
560
563
  return { kind: 'number', text: shown, title: shown === text ? undefined : text };
561
564
  }
562
565
  if (plan.kind === 'date' || /date|time/.test(type))
@@ -147,6 +147,7 @@
147
147
  :root[data-visual-theme] .app-mode .topbar button.account:hover { background: color-mix(in srgb, var(--nav-ink) 5%, transparent); }
148
148
  :root[data-visual-theme] .app-mode .topbar .tn-group.active > .tn-group-button { color: var(--nav-accent); }
149
149
  :root[data-visual-theme] .app-mode .topbar .tn-group.active > .tn-group-button::after { background: var(--nav-accent); }
150
+ :root[data-visual-theme] .app-mode .topbar .workspace-tab[aria-current="page"]::after { background: var(--nav-accent); }
150
151
  :root[data-visual-theme] .app-mode .topbar .tn-group-button[aria-expanded="true"] { color: var(--nav-ink); background: color-mix(in srgb, var(--nav-ink) 7%, transparent); }
151
152
  :root[data-visual-theme] .app-mode .topbar .mode { background: transparent; border-color: var(--nav-line); }
152
153
  /* Danger is checked against the palette's surface, not an unrelated nav
@@ -329,8 +330,10 @@
329
330
  color: var(--nav-ink);
330
331
  }
331
332
  /* A top bar's menu: its entries and the folded Menu stand on the bar, which wears nav.ground (above), so the same
332
- inks; only the menu, since the search beside it is a field on the page's surface. */
333
- :root[data-visual-theme] .app-mode .topbar .tn-links {
333
+ inks; only the menu, since the search beside it is a field on the page's surface. The workspaces' tabs stand on
334
+ the same bar (appChrome.js renderWorkspaces): left the page's ink, the current one was dark on a dark bar, and no
335
+ pair check read was the one drawn (a field report). */
336
+ :root[data-visual-theme] .app-mode .topbar :is(.tn-links, .workspace-host) {
334
337
  --ink: var(--nav-ink);
335
338
  --ink-muted: var(--nav-muted);
336
339
  --ink-subtle: var(--nav-muted);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mistriwork/kit",
3
- "version": "1.0.0-rc.46",
3
+ "version": "1.0.0-rc.48",
4
4
  "description": "The shared React client both shells are drawn with: the walk and the address, Grid, Value, the record page, lists, filters and charts.",
5
5
  "homepage": "https://mistriwork.dev",
6
6
  "bugs": {
@@ -83,8 +83,8 @@
83
83
  "./package.json": "./package.json"
84
84
  },
85
85
  "dependencies": {
86
- "@mistriwork/engine": "1.0.0-rc.46",
87
- "@mistriwork/ui": "1.0.0-rc.46",
86
+ "@mistriwork/engine": "1.0.0-rc.48",
87
+ "@mistriwork/ui": "1.0.0-rc.48",
88
88
  "intl-messageformat": "12.1.2",
89
89
  "qrcode-generator": "^2.0.4"
90
90
  },