@mistriwork/kit 1.0.0-rc.70 → 1.0.0-rc.71

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.
@@ -29,6 +29,7 @@ import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } fr
29
29
  import { useMutation, useQueries, useQuery, useQueryClient } from '@tanstack/react-query';
30
30
  import { api, columnLabel, labelPath, pageSize, recordLabel, state as walk, toast } from '../core.js';
31
31
  import { say } from '../copy/lists/components/AppList.js';
32
+ import { LABEL_SEGMENT } from '@mistriwork/engine/shared/recordLabel.js';
32
33
  /* The walk's state, with the field core.js's JSDoc does not declare. */
33
34
  const state = walk;
34
35
  import { mayRunAny } from '../actionGrants.js';
@@ -214,8 +215,9 @@ export function AppList({ entry, spec, navigate, embedded = false, newButton, in
214
215
  const [definedBoxes, setDefinedBoxes] = useState({});
215
216
  const onDefinedBoxes = useCallback((column, next) => setDefinedBoxes((previous) => ({ ...previous, [column]: next })), []);
216
217
  const names = declared.flatMap((name) => (boundNames.includes(name) ? (definedBoxes[name] ?? []).map((box) => box.column) : [name]));
217
- /* The resource's caption, through the label source every surface reads (appLabels.ts). */
218
- const captionOf = (name) => columnLabel(spec.table, name) ?? humanName(name);
218
+ /* The resource's caption, through the label source every surface reads (appLabels.ts). A name the catalog
219
+ computes from a template (`$label`, the search box's column for such a table) is the record's name. */
220
+ const captionOf = (name) => columnLabel(spec.table, name) ?? (name === LABEL_SEGMENT ? say('common.name') : humanName(name));
219
221
  const near = [...declared, ...(table?.columns.map((column) => column.name) ?? [])];
220
222
  const labelOf = (name) => filterLabel(name, captionOf, near);
221
223
  const form = useRef(null);
@@ -174,7 +174,8 @@ export function MultiStepForm({ steps, children, step, initialStep = 0, onStepCh
174
174
  step's own `next`, else Continue, in either style. A host may still name its own. */
175
175
  const primaryWords = last
176
176
  ? completeLabel
177
- : (nextLabel ?? (intake && active.skip && isStepEmpty?.(active) ? active.skip : (active.next ?? say('continue'))));
177
+ : (nextLabel ??
178
+ (intake && active.skip && isStepEmpty?.(active) ? active.skip : (active.next ?? appWord('mistri.form.continue', say('continue')))));
178
179
  const heading = active.title ?? active.label;
179
180
  /* Enter in a typed answer presses the primary, as it would submit a one-page form: the step is no <form>, so nothing
180
181
  else does. A list that is open (a combobox), a box of lines, a composition in progress and a modified key keep it. */
@@ -159,8 +159,18 @@ export declare const roomVersion: () => number;
159
159
  * Paint a refinement of the table room on screen: a page, a page size, a
160
160
  * header's sort or filter. The address bar and the trail are written as for
161
161
  * any paint; the room is kept when it is still the same table room.
162
+ *
163
+ * `yields` lets the paint wait for the frame the press is in, as a room
164
+ * started over by a press does (`render`): a header's sort on an App's list
165
+ * redraws more than its rows inside the click — the tab it un-lights, the
166
+ * column that tab had pinned, the chip that says the order, every column's
167
+ * width — and drawn inside the click that held the press's own frame past
168
+ * the interaction budget (`compass sort`, test/built-client-vitals.mjs). The
169
+ * walk and the address are the sort's at once; only the drawing waits.
162
170
  */
163
- export declare function refine(fn: any): any;
171
+ export declare function refine(fn: any, { yields }?: {
172
+ yields?: boolean;
173
+ }): any;
164
174
  /** @param {{ before(roomChanged: boolean): void; after(): void; yields?(): boolean } | null} hold */
165
175
  export declare function setPaintHold(hold: {
166
176
  before(roomChanged: boolean): void;
@@ -544,6 +544,7 @@ export const paintVersion = () => paintTick;
544
544
  let roomTick = 0;
545
545
  let roomOnScreen = null;
546
546
  let refining = false;
547
+ let refiningYields = false;
547
548
  export const roomVersion = () => roomTick;
548
549
  /** A table view's identity as a room, or null for anything else. */
549
550
  function tableRoomShape() {
@@ -556,15 +557,24 @@ function tableRoomShape() {
556
557
  * Paint a refinement of the table room on screen: a page, a page size, a
557
558
  * header's sort or filter. The address bar and the trail are written as for
558
559
  * any paint; the room is kept when it is still the same table room.
560
+ *
561
+ * `yields` lets the paint wait for the frame the press is in, as a room
562
+ * started over by a press does (`render`): a header's sort on an App's list
563
+ * redraws more than its rows inside the click — the tab it un-lights, the
564
+ * column that tab had pinned, the chip that says the order, every column's
565
+ * width — and drawn inside the click that held the press's own frame past
566
+ * the interaction budget (`compass sort`, test/built-client-vitals.mjs). The
567
+ * walk and the address are the sort's at once; only the drawing waits.
559
568
  */
560
- export function refine(fn) {
561
- const was = refining;
569
+ export function refine(fn, { yields = false } = {}) {
570
+ const was = [refining, refiningYields];
562
571
  refining = true;
572
+ refiningYields = yields;
563
573
  try {
564
574
  return fn();
565
575
  }
566
576
  finally {
567
- refining = was;
577
+ [refining, refiningYields] = was;
568
578
  }
569
579
  }
570
580
  /* What happens around a paint that may start the room over: the shell
@@ -583,8 +593,10 @@ export function setPaintHold(hold) {
583
593
  interaction budget (a cards list's open, test/built-client-vitals.mjs).
584
594
  What is on show is the same either way. A paint asked for while one waits
585
595
  is the same navigation going on (a redirect, a label): it is drawn at
586
- once, as a room started over. */
596
+ once, as a room started over when the one waiting was. A refinement that
597
+ yields (`refine`) waits the same way, keeping its room. */
587
598
  let waiting = null;
599
+ let waitingRoom = false;
588
600
  export function render() {
589
601
  if (sessionIdentity().mode === 'locked')
590
602
  return;
@@ -597,13 +609,15 @@ export function render() {
597
609
  if (waiting) {
598
610
  waiting();
599
611
  waiting = null;
600
- roomChanged = true;
612
+ roomChanged ||= waitingRoom;
601
613
  }
602
- else if (roomChanged && paintHold?.yields?.()) {
614
+ else if (roomChanged ? paintHold?.yields?.() : refiningYields && paintHold) {
615
+ const room = roomChanged;
616
+ waitingRoom = room;
603
617
  waiting = afterThisFrame(() => {
604
618
  waiting = null;
605
619
  if (sessionIdentity().mode !== 'locked')
606
- paint(true);
620
+ paint(room);
607
621
  });
608
622
  return;
609
623
  }
@@ -3333,12 +3333,17 @@ tr.expanded > td { border-bottom-color: transparent; background: var(--accent-so
3333
3333
  .tenant-chooser-choice[aria-current="true"] { border-color: var(--accent); }
3334
3334
  .tenant-chooser-retry { margin-top: 20px; }
3335
3335
  .tenant-chooser button:disabled, .tenant-chooser-actions button:disabled, .tenant-control-trigger:disabled { cursor: default; opacity: 0.6; }
3336
- .tenant-control { display: inline-flex; min-width: 0; }
3336
+ /* A length, not a percentage, caps the control: the trigger's min(24rem, 100%) is circular while the host sizes to
3337
+ its content, so a long name's whole width was held empty beside the cut label (147px at 1280). */
3338
+ .tenant-control { display: inline-flex; min-width: 0; max-width: 24rem; }
3337
3339
  /* A long name is cut to the bar's room, not to a fixed 16rem that cut
3338
3340
  ordinary ones; its whole is the button's title. */
3339
3341
  .tenant-control-trigger { display: inline-flex; align-items: center; gap: var(--space-2h); max-width: min(24rem, 100%); min-width: 0; }
3340
3342
  .tenant-control-trigger > :first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
3341
3343
  .tenant-control-trigger > :last-child { flex: none; }
3344
+ /* Beside a top bar's tabs the name gives way before they fold into the menu: at 1280 a long name's 24rem folded a
3345
+ dealer's five tabs. It still grows with the window, and an ordinary name is whole at a desk. */
3346
+ body.app-topnav .topbar .tenant-control { max-width: clamp(16rem, 22vw, 24rem); }
3342
3347
  /* The names scroll and the foot stays: a list of many tenants carried the
3343
3348
  foot off the bottom of the dialog. */
3344
3349
  .tenant-chooser-dialog {
@@ -89,6 +89,8 @@ export function sortBy(column, direction, append = false) {
89
89
  cost the header its second click. `addSort` has no cycle to skip, so it
90
90
  takes a direction. */
91
91
  /* A refinement: the same table room re-asks in place (core.js `refine`),
92
- so the header that was clicked, the rows' decorations and the focus stay. */
93
- refine(() => go(tableView(entry.table, append ? addSort(entry.query, column, direction ?? 'asc') : nextSort(entry.query, column, direction)), 'replace'));
92
+ so the header that was clicked, the rows' decorations and the focus stay.
93
+ It is drawn after the press's frame: the walk and the address are the
94
+ sort's at once. */
95
+ refine(() => go(tableView(entry.table, append ? addSort(entry.query, column, direction ?? 'asc') : nextSort(entry.query, column, direction)), 'replace'), { yields: true });
94
96
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mistriwork/kit",
3
- "version": "1.0.0-rc.70",
3
+ "version": "1.0.0-rc.71",
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": {
@@ -85,8 +85,8 @@
85
85
  "./package.json": "./package.json"
86
86
  },
87
87
  "dependencies": {
88
- "@mistriwork/engine": "1.0.0-rc.70",
89
- "@mistriwork/ui": "1.0.0-rc.70",
88
+ "@mistriwork/engine": "1.0.0-rc.71",
89
+ "@mistriwork/ui": "1.0.0-rc.71",
90
90
  "intl-messageformat": "12.1.2",
91
91
  "qrcode-generator": "^2.0.4"
92
92
  },