Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .changeset/36246-record-header-star.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'@object-ui/app-shell': patch
'@object-ui/components': patch
'@objectstack/spec': patch
---

feat(app-shell): the record's favorite star sits beside its name, and the header's `⋯` no longer holds "Add to favorites"

Clause-②: no
Metadata-protocol: none

The record page draws its favorite star right of the record's name, always visible: hollow until the record is a favorite, filled once it is, one press to toggle with no confirm. The full page, a drawer or split-pane preview, and a phone's record page all draw it, from the same favorite the sidebar's Favorites section reads, so nothing about the stored favorites or that section changes. The header's `⋯` menu drops its "Add to favorites" / "Remove from favorites" entry, so the page keeps one favorites control. On a phone the star keeps a 44px tap target, as the copy-id button beside it does. A print page, which draws no record header and so no star, keeps the entry in its chrome row's `⋯`. The `showStar` refusal in `@objectstack/spec` (the retired `page:header` key) now says what stays true: the console draws the record's star from the host's favorites toggle, never from metadata, so the key switched nothing; it no longer names the `⋯` menu as the favorites entry.
2 changes: 1 addition & 1 deletion content/docs/references/ui/component.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1577,7 +1577,7 @@ An any-of group: `{ or: [rule, ...] }` matches a record when ANY of its rules ma
| **actions** | `string[]` | optional | Action IDs the header draws, resolved against the actions declared on the page's object. An authored list is the whole set: an action that declares `record_header` (or `record_more`) in its `locations` but is not named here is not drawn, and a header with neither this key nor `placedActions: true` draws none of the object's actions. `placedActions: true` is the other way to say which actions the header draws (every one placed at `record_header` / `record_more`, read live), and the two are refused together. A named action that declares neither location renders nowhere. The host's own Edit / Share / Delete chrome is separate from this list. |
| **placedActions** | `boolean` | optional | Draw every action of the page's object whose `locations` include `record_header` or `record_more`, read live from the object's metadata, in place of an authored `actions` list: an action added to the object later, by any package, is drawn without editing the page. Omit it, or set false, to keep the `actions` list as the whole set. Refused as `true` beside an authored `actions` list: keep one. |
| **recordChrome** | `boolean` | optional (default: `true`) | Render the record chrome — the title as a record chip with its copy-id button. Set false on a non-record page (dashboard, landing) to fall back to the bare heading layout. |
| **showStar** | `never` | optional | [REMOVED] `page:header` property `showStar` was removed in @objectstack/spec 18 (ADR-0087 D2) — the reference console draws no star beside the record title, so the key switched nothing: the record's favorites entry is the header's ⋯ menu, and metadata does not control it. Delete the key, whether it was `true` or `false`; the ⋯ menu's favorites entry is unchanged. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. |
| **showStar** | `never` | optional | [REMOVED] `page:header` property `showStar` was removed in @objectstack/spec 18 (ADR-0087 D2) — the console draws the record's star from the host's favorites toggle, never from metadata, so the key switched nothing. Delete the key, whether it was `true` or `false`; the page draws the same star without it. Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand. |
| **showCopyId** | `boolean` | optional (default: `true`) | Show the copy-record-id button beside the record title. Part of the record chrome — no effect when `recordChrome` is false. |
| **maxVisible** | `integer` | optional | How many header actions render as inline buttons before the rest fold into the overflow menu. Renderer default when unset: 3 on every header. In a record page's header bar the number, authored or not, is an upper bound: actions that do not fit the bar's width fold as well, so a narrow drawer shows fewer. |
| **mobileMaxVisible** | `integer` | optional | The `maxVisible` budget on mobile viewports. Renderer default when unset: 2 in a record page's bottom action bar on a phone, where the host's Edit counts as one, 1 on any other header. |
Expand Down
6 changes: 3 additions & 3 deletions packages/lint/src/validate-component-props.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ describe('validateComponentProps — undeclared keys', () => {
});

// #23650 — `PageHeaderProps.showStar` is a retiredKey tombstone, the
// `breadcrumb` route one key over: the reference console draws no star, and
// the record's favorites entry is the header's ⋯ menu. It replaces the
// `breadcrumb` route one key over: the star follows the host's favorites
// toggle, never metadata. It replaces the
// acceptance this file used to pin for `showStar: false` (#6776, below).
it('refuses a retired page-header `showStar` as an error carrying the prescription, for `true` and `false`', () => {
for (const showStar of [true, false]) {
Expand All @@ -119,7 +119,7 @@ describe('validateComponentProps — undeclared keys', () => {
expect(f.severity).toBe('error');
expect(f.path).toBe('pages[0].regions[0].components[0].properties.showStar');
expect(f.message).toContain('`page:header` property `showStar` was removed in @objectstack/spec 18');
expect(f.message).toContain('the record\'s favorites entry is the header\'s ⋯ menu, and metadata does not control it');
expect(f.message).toContain('the console draws the record\'s star from the host\'s favorites toggle, never from metadata');
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,20 @@ import { isDict, stripKeys } from '../shared.js';
* enforce-or-remove; ruling record 6203775759, letter A: 「A 退役 showStar
* (Recommended)」).
*
* The key switched a star the reference console no longer draws. Since
* objectui#12427 the `page:header` record chip draws the follow star only
* where the host wires a favorites toggle into the record context
* (`onToggleFavorite`), and no reference host does: the record's favorites
* entry is the header's ⋯ overflow menu. `true` drew nothing and `false` hid
* nothing. The tombstone on `PageHeaderProps` refuses it for a live author:
* The key switched nothing. Since objectui#12427 the `page:header` record
* chip draws the follow star wherever the host wires a favorites toggle into
* the record context (`onToggleFavorite`), whatever the key says: the console
* draws the record's star from the host's favorites toggle, never from
* metadata. `true` and `false` draw the same star. The tombstone on `PageHeaderProps` refuses it for a live author:
* `os validate`, `os build` and `os lint` refuse it as an `error` with the
* prescription (the component-props gate, `@objectstack/lint`; the load path
* keeps the open `properties` bag as written).
*
* **A delete of both values.** Neither changes what the reference console
* draws, so there is no value to preserve and no rewrite target. The host
* hook is not the key: a third-party host of the published component library
* that wires `onToggleFavorite` keeps its star, and after the strip a header
* that said `false` shows it there as an absent key would. The D3 entry
* hook is not the key: any host of the published component library that wires
* `onToggleFavorite`, the console included, draws its star, and a header that
* said `false` shows it there as an absent key would. The D3 entry
* `page-header-show-star-retired` records that.
*
* Who writes the key: nobody measured. No example app, skill or doc in this
Expand All @@ -51,9 +50,8 @@ const pageHeaderShowStarRemoved: MetadataConversion = {
retiredAfter: '17.7.0',
surface: 'page.component.page:header.showStar',
summary:
"page:header prop 'showStar' removed, whether 'true' or 'false' (the reference console draws no star "
+ 'beside the record title: the record\'s favorites entry is the header\'s ⋯ menu, and metadata does '
+ 'not control it)',
"page:header prop 'showStar' removed, whether 'true' or 'false' (the console draws the record's star "
+ 'from the host\'s favorites toggle, never from metadata, so the key switched nothing)',
apply(stack, emit) {
return mapPageComponents(stack, (component, path) => {
if (component.type !== 'page:header') return component;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,25 @@ import type { SemanticMigration } from '../../types.js';
// #23650 (ADR-0049 enforce-or-remove) — the D3 entry of the
// `page-header-show-star-removed` family (one D3 entry per retirement family,
// even when D2 is lossless). Registered key: `ui/PageHeaderProps:showStar`.
// The strip changes nothing the reference console draws; what it can change
// is a third-party host that wires its own favorites toggle.
// The strip changes nothing the reference console draws: the console draws
// the record's star from the host's favorites toggle, never from metadata.
export const entry: SemanticMigration = {
id: 'page-header-show-star-retired',
surface: 'page.component.page:header.showStar — the follow star beside the record title',
replacement:
'Nothing: delete the key, whether it was `true` or `false`. The record\'s favorites entry is the '
+ 'header\'s ⋯ menu, and metadata does not control it.',
'Nothing: delete the key, whether it was `true` or `false`. The console draws the record\'s star '
+ 'from the host\'s favorites toggle, never from metadata, so the page draws the same star without it.',
reason:
'The D2 conversion `page-header-show-star-removed` deletes `showStar` from every page header, and '
+ 'nothing the reference console draws changes: its record chip draws the follow star only where '
+ 'the host wires a favorites toggle into the record context, and the console wires none, so '
+ '`true` drew nothing and `false` hid nothing. What the conversion cannot decide is a host of '
+ 'your own: if it wires that favorites toggle, the star now draws on every record header, a '
+ 'header that said `false` included, and hiding it there is the host\'s call, not the page\'s.',
+ 'nothing the reference console draws changes: the console draws the record\'s star from the '
+ 'host\'s favorites toggle, never from metadata. Its record chip draws the star beside the record '
+ 'name wherever the host wires that toggle into the record context, and the console wires it on '
+ 'its record pages, so `true` and `false` draw the same star. A host of your own works the same '
+ 'way: the star draws where it wires the favorites toggle, a header that said `false` included, '
+ 'and hiding it there is the host\'s call, not the page\'s.',
acceptanceCriteria:
'No page header carries `showStar`, and the props lint reports one with the prescription. Every '
+ 'record page shows the same header in the console as before the upgrade — title, copy-id '
+ 'button and actions — and the record\'s favorites entry is still in the header\'s ⋯ menu.',
+ 'record page shows the same header in the console as before the strip — title, copy-id button, '
+ 'actions and the record\'s star beside the record name — and the header\'s ⋯ menu holds no '
+ 'favorites entry (only a print page, which draws no header, keeps one in its ⋯).',
};
8 changes: 4 additions & 4 deletions packages/spec/src/migrations/registry.ts.template
Original file line number Diff line number Diff line change
Expand Up @@ -2665,10 +2665,10 @@ const STEP18_RATIONALE: readonly RationaleFragment[] = [
order: 98,
text:
'It also retires the page header\'s `showStar` switch (ADR-0049 enforce-or-remove): the '
+ 'reference console draws no star beside the record title — its record chip draws one only '
+ 'where the host wires a favorites toggle, and the console\'s favorites entry is the '
+ 'header\'s ⋯ menu — so the key switched nothing. The key is a retiredKey tombstone on '
+ '`PageHeaderProps`, beside `icon` and `breadcrumb`, and the D2 conversion '
+ 'console draws the record\'s star from the host\'s favorites toggle, never from metadata — '
+ 'its record chip draws the star beside the record name wherever the host wires that toggle, '
+ 'and the console wires it on its record pages — so the key switched nothing. The key is a '
+ 'retiredKey tombstone on `PageHeaderProps`, beside `icon` and `breadcrumb`, and the D2 conversion '
+ '`page-header-show-star-removed` strips it from every `page:header`, `true` and `false` '
+ 'alike, retired from the load path. Its D3 record is the semantic entry '
+ '`page-header-show-star-retired`. The host hook is not part of it: a host that wires the '
Expand Down
20 changes: 10 additions & 10 deletions packages/spec/src/ui/component.zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -779,8 +779,8 @@ export const PageHeaderProps = strictObject({
*
* ON (the default) the header carries the **record chrome**: the title
* renders as a record chip with the copy-record-id button beside it (the
* follow star draws there only where a host wires a favorites toggle; the
* reference console's favorites entry is the header's ⋯ menu). OFF it falls back to a bare heading — one title line and
* follow star draws there only where a host wires a favorites toggle, as the
* reference console does on its record pages). OFF it falls back to a bare heading — one title line and
* nothing record-shaped — which is what a dashboard or a landing page wants,
* since there is no record for the chip to describe.
*
Expand All @@ -801,11 +801,12 @@ export const PageHeaderProps = strictObject({
* the way `breadcrumb` above left this row; ruling record 6203775759,
* letter A).
*
* A switch for a star the reference console no longer draws. Since
* objectui#12427 the record chip draws the follow star only where the HOST
* wires a favorites toggle into the record context (`onToggleFavorite`),
* and no reference host does: the record's favorites entry is the header's
* ⋯ overflow menu. So `showStar: true` (the default) drew nothing and
* A switch metadata never had a say in. Since objectui#12427 the record chip
* draws the follow star only where the HOST wires a favorites toggle into
* the record context (`onToggleFavorite`); when the key was retired no
* reference host did, and since #36246 the reference console wires it on
* its record pages, beside the record's name. Either way the star follows
* the host's toggle, so `showStar: true` (the default) drew nothing and
* `showStar: false` hid nothing. No example app, skill or doc authored it.
*
* The host hook stays: objectui's `RecordContextValue.onToggleFavorite` is a
Expand All @@ -817,9 +818,8 @@ export const PageHeaderProps = strictObject({
*/
showStar: retiredKey(
'`page:header` property `showStar` was removed in @objectstack/spec 18 (ADR-0087 D2) — '
+ 'the reference console draws no star beside the record title, so the key switched nothing: '
+ 'the record\'s favorites entry is the header\'s ⋯ menu, and metadata does not control it. '
+ 'Delete the key, whether it was `true` or `false`; the ⋯ menu\'s favorites entry is unchanged. '
+ 'the console draws the record\'s star from the host\'s favorites toggle, never from metadata, so the key switched nothing. '
+ 'Delete the key, whether it was `true` or `false`; the page draws the same star without it. '
+ 'Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand.',
),
/**
Expand Down
6 changes: 4 additions & 2 deletions packages/spec/src/ui/page-header-show-star-retirement.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
* record context (`onToggleFavorite`), and no reference host does — the
* console's favorites entry is the header's ⋯ overflow menu. So `true` (the
* default) drew nothing and `false` hid nothing. No producer writes the key in
* this repo or in objectui's apps and examples.
* this repo or in objectui's apps and examples. Since objectstack#36246 the
* console wires that toggle on its record pages, and the star still answers
* the host's toggle, never the key.
*
* Bookkeeping shapes, pinned below:
* 1. A `retiredKey()` tombstone on `PageHeaderProps`, a `strictObject` — the
Expand Down Expand Up @@ -58,7 +60,7 @@ const REGISTERED_KEY = 'ui/PageHeaderProps:showStar';
// Unanchored, because a thrown `ZodError`'s message is the JSON of its issues;
// the key-first house convention is asserted on the issue message itself.
const PRESCRIPTION =
/`page:header` property `showStar` was removed in @objectstack\/spec 18 \(ADR-0087 D2\) — the reference console draws no star beside the record title.*the record's favorites entry is the header's ⋯ menu, and metadata does not control it\..*Delete the key, whether it was `true` or `false`.*Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand\./s;
/`page:header` property `showStar` was removed in @objectstack\/spec 18 \(ADR-0087 D2\) — the console draws the record's star from the host's favorites toggle, never from metadata, so the key switched nothing\..*Delete the key, whether it was `true` or `false`.*Run `os migrate meta --from 17` to list the mechanical edits for existing sources; `--write` applies the ones it can prove, and you apply the rest by hand\./s;

/** A page header's live keys — what an author commonly writes, not the retired one. */
const HEADER = { title: 'Account', subtitle: '{industry}', showCopyId: false, actions: ['log_call'] } as const;
Expand Down
Loading
Loading