Repository navigation
Commit 355c73c
feat(studio): ⌘K on every Studio design page lists the package's menu and items (#37108)
Fixes #36900
Part of #36890
Clause-②: no
Metadata-protocol: none
repo:objectstack#4 · os-justin · session_01QSeKYkkwuF6UuFtu85Yd5H
## 维护者速读
- 在 Studio 的任何设计页面(包括「全部元数据」跨包页)按 ⌘K /
Ctrl+K,都能打开搜索面板:按左侧菜单的六组列出当前包的全部类型和每一项,选中即打开它的详情或设计器;页面上有没保存的修改时,会先问一句再走。
- 属于「Studio 重构」专题:去掉设计器左侧那一列后,作者靠 ×、‹ › 和 ⌘K
换到别的项;同时补回上一步左侧菜单改造时临时丢掉的跨包页 ⌘K。
- 出错时作者只是搜不到或打不开某一项,左侧菜单和列表照常可用;不动任何数据,直接撤回这次改动即可。
- 无。
## What changes
Head `7bbe1c54b`: 15 files, +1,679 / −92 against `main`, one PR for the
card. REWORK round 1 (L1 7144125191) and its delta L1 ACCEPT
(7147006586) are folded in below. `main` was merged in that round.
**The command palette is mounted on every Studio design page.**
`StudioDesignSurface` mounts it in its shell under its own
`CommandPaletteProvider`, on a package's pillars and "All metadata"
area, `~org` and `~all`. After #36985 only the `/studio` landing had
one, so `~all` had lost ⌘K (the hand-off's stated temporary regression);
this restores it. A host that already mounts a palette above the surface
keeps its own (`useCommandPaletteProviderMounted()`): the surface then
mounts neither provider nor palette.
- **What it lists on a package.** The left menu, group by group
(`buildStudioMenu`, decision 11: Data, UI, Automation, Platform, Access,
AI, under the menu's names). Each group holds the menu's own entries:
each type's list, plus Organization flows, Default sharing, Diagnostics
and Positions and permissions. Then come the items of every type the
group lists, from the package and its `.custom` pair (ADR-0146 D3).
- **Types.** The menu's own data, read once per page:
`StudioMenuDataProvider` in the surface feeds both the menu and the
palette (new `studioMenuData.ts`: the data hook, the context, the group
icons and the entry names). The palette and the menu cannot disagree,
and opening the palette re-reads neither types nor the diagnostics
sweep.
- **Items.** Each listed type's served list, read only while the palette
is open, as its list page reads it (`include: listInclude`). The rows
are kept by the list page's own rule (`scopeListRows`: the package, its
pair, the type's list predicate) and named by the type's primary key.
- **Customizations.** A customization item reads "Customization of
PACKAGE NAME", never the pair's raw id.
- **Other scopes.** On a package the palette no longer lists every
package's objects and flows, because the package's own items replace
them. The packages stay listed. `~org` and `~all` keep those lists and
add their own menu entries.
- **Where a pick opens.** Every address comes from `studioAddress.ts`
(#36895). An object, flow or permission set goes through
`studioItemPath`, so it opens its designer today and follows each
designer card's `STUDIO_ITEM_PILLAR` switch with no edit here. Any other
item opens `studioMetadataItemAddress(…, ?package=OWNER)`, the address
its list row links to (ADR-0048). A menu entry goes to the menu entry's
own `to`.
- **How it leaves (decision 12): through the shell's unsaved-edits seam
(M1).** `openStudioPaletteAddress` handles another page through
`confirmUnsavedLeave`. That seam holds the surface's own work and every
editor that registered its own, the "All metadata" item page
(`ResourceEditPage`) among them; the surface's own bit never saw that
page's edits. The page already open on another query (Default sharing
from the Access pillar) goes through `reenterPillar`. It asks, then
remounts the pillar once the router shows the requested query (S5): the
palette's own `?palette=` change comes first and no longer triggers it.
The page already shown, palette keys aside, just closes the palette.
- The surface's `confirmLeavePillar` now goes through the same seam, so
its own header departures ask about the item page's edits too: Back to
app, the retired-Interfaces notice, the other-pillar `requestSurface`
and the Access opener. They had the same blind spot; it is closed here,
and no defect card is owed.
- **The palette stays free of Studio reads.** `CommandPalette`'s
`studio` scope takes an optional `surface` (`packageScope`,
`renderGroups`, `open`), documented in the app-shell README. The page
draws its own groups (`StudioPaletteGroups`), so the Studio modules load
with the Studio chunk, never with the console's eager closure.
`@object-ui/app-shell` is private, so the new optional prop and exported
types widen no published surface: `Clause-②: no`.
- **N4.** `ResourceEditPage`'s fullscreen Escape now ignores an Escape a
dialog above it already took (`defaultPrevented`, which Radix sets), so
closing the palette over a fullscreen editor no longer also leaves
fullscreen.
- **Card item 1 (`advertisedShortcuts.ts`)** needs no edit.
`CommandPaletteProvider` already advertises ⌘K
(`useAdvertiseShortcut(OPEN_COMMAND_PALETTE_SHORTCUT)`), and it now runs
on every design page.
- **Card item 4 (#35308)**: the studio scope searches no record, so it
has no record title. Items are titled by their served metadata label, as
their lists show them, and no second title rule exists.
Files:
- New: `studio-design/studioPaletteModel.ts` (pure: pair, items,
addresses, groups, departure, `openStudioPaletteAddress`),
`studio-design/StudioPaletteGroups.tsx` (reads and draws) and
`studio-design/studioMenuData.ts` (the menu's shared data and
vocabulary).
- `StudioMenu.tsx`: it gains `StudioMenuDataProvider`, draws the shared
data when a provider above holds it, and otherwise reads its own.
- `StudioDesignSurface.tsx`: changes are in its shell region only: the
providers, the palette mount, `confirmLeavePillar`, `reenterPillar` and
`openFromPalette`.
- `StudioRoute.tsx` is unchanged. No i18n key is added.
- `e2e/studio-left-menu-36899.spec.ts` stubs the menu's reads where they
now live.
Read first, by risk:
1.
`ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx`:
`confirmLeavePillar` (now the seam), the `reenterPillar` latch,
`openFromPalette` / `paletteSurface`, and the provider wrap. It is the
only edit to a shared file beyond `StudioMenu.tsx`.
2.
`ui/packages/app-shell/src/views/studio-design/studioPaletteModel.ts`:
`openStudioPaletteAddress` and `studioPaletteItemsOf` over
`scopeListRows`.
3. `ui/packages/app-shell/src/views/studio-design/studioMenuData.ts`
with `StudioMenu.tsx`: the shared data and the menu's own-read fallback.
## Tests
- `studioPaletteModel-36900.test.ts` (15 cases). It pins:
- the pair;
- items through `scopeListRows`: unwrapped, scoped, deduped and named by
the primary key, with the list predicate applied;
- pillar types following `studioItemPath` for every `STUDIO_ITEM_PILLAR`
row, and other types on their area page with `?package=OWNER`;
- the menu's six groups;
- the leave / re-enter / stay decision;
- M1 at the unit: with an editor registered, a leave asks its question
(Cancel stays, OK goes), with a CONTROL that nothing registered asks
nothing; re-entry hands the host the query to wait for.
- `StudioPaletteGroups.surfaceScope-36900.test.tsx` (11 cases): the real
`CommandPalette` + `CommandPaletteProvider` + `StudioMenuDataProvider` +
`StudioPaletteGroups`, with the metadata reads doubled at the menu's own
seam. It pins:
- group headings and order, menu entries, and the package's and pair's
items;
- the list read's `include` and list predicate;
- "Customization of" the package's name, with no `.custom` text shown;
- no cross-package object or flow on a package;
- addresses handed to `surface.open`, and matching;
- "Searching…" then "No results", and a query typed before the lists
answer: the arriving row is selected and Enter opens it;
- no item list read until open, with its CONTROL;
- `~all`.
- `StudioDesignSurface.metadataArea-28561.test.tsx`: 7 new cases on the
real surface.
- Ctrl+K on a pillar, on `~all` and on a missing package.
- **M1**: with the "All metadata" item page holding registered edits, a
palette pick asks the page's question (Cancel keeps the page, OK
leaves), and Back to app asks too. CONTROL: a clean page leaves at once.
- **S5**: Default sharing picked on the real Access pillar shows the
overview at `?surface=owd%3Aoverview`.
- `ResourceEditPage.leaveGuard-13231.test.tsx` (2 new cases): **M1 on
the real `ResourceEditPage`** with a dirty draft and the real palette
leaving through `openStudioPaletteAddress`. Cancel keeps the page and
the draft, OK leaves, and a CONTROL clean page leaves without asking.
- `ResourceEditPage.detailTabs-36901.test.tsx` (1 new case): **N4**, an
Escape a dialog took leaves the fullscreen and the page alone, with its
CONTROL.
<details><summary>Local readings, head 5e181ef / 7bbe1c5</summary>
- Touched and related files at 5e181ef (new pins, StudioMenu,
studioMenuModel, the address guard, all 16 `CommandPalette.*`, every
console `StudioRoute*`): `Test Files 31 passed (31)`, `Tests 249 passed
(249)`, lock `VERDICT command-exit 0`. 7bbe1c5 changes the e2e spec
only.
- All 83 `StudioDesignSurface.*.test.tsx` (at cf95fe5; later commits
change no surface file): `Test Files 43 passed (43)`, `Tests 236 passed
(236)` and `Test Files 40 passed (40)`, `Tests 217 passed (217)`.
- `@object-ui/app-shell` `type-check` (both programs) and
`type-check:e2e`: exit 0. `e2e/studio-left-menu-36899.spec.ts`, local:
`3 passed`.
- `pnpm --dir ui exec vitest run scripts/`: `Test Files 172 passed | 2
skipped (174)`.
- Derived gate families (`dispatch-gates.mjs --commands`, 39): all exit
0 on the final tree; `--ran`: `39 derived, 39 run, 0 NOT-MEASURED, 0
UNRUN`. `check:new-line-citations` (ui): `0 new citation(s)`. eslint on
the changed ui files: 0 errors, none in the new modules.
- `overlap-check.mjs` before every push of the round: `VERDICT clean
exit 0`.
- CI at 7bbe1c5: 38 success, 13 expected skips, 0 failed.
</details>
<details><summary>Ablations (scripts/ablation-replace.mjs, each restored
to HEAD: blob == HEAD, git diff HEAD empty)</summary>
- A1, the seam dropped from the palette's leave (`confirmUnsavedLeave(()
=> act.navigate(to))` → `act.navigate(to)`): `Tests 3 failed | 33
passed`. The three M1 pins (real `ResourceEditPage`, surface, unit) go
red.
- A2, the seam dropped from `confirmLeavePillar`: `Tests 1 failed | 13
passed` (Back to app).
- A3, the re-entry latch back to "the next query change": stays green
(`14 passed`). Under test the palette's close and the navigation land in
one render, so no pin tells the latch from the old trigger. The latch
guards the ordering the code's own comment warns about: the router
applying a navigation in a later render.
- A4, a first-row selection added during the round: green in happy-dom
and no effect live (a live probe with it removed). It was taken out
again, so it is not on this head.
- Round 0: the package-scope cross-package guard (`Tests 1 failed | 9
passed`) and the surface's palette mount (`Tests 3 failed | 7 passed`).
</details>
## Acceptance notes
- **Live walk-through, showcase leg: passed** (PR comment 7145761753). A
real build, backend `--fresh`, and the Console dev server serving
app-shell from `src` at this head, driven by headless Chromium as a
person would.
- One non-first item each of object, flow, permission set, hook and
dashboard, found by label and opened at its list-row address with its
label on the page. The object pick re-enters the Data page.
- Ctrl+K on the cross-package catalog.
- **M1** on a real item page with an unsaved edit: the pick asks once,
Cancel keeps the page and the edit, Back to app asks, OK leaves.
- **S5**: Default sharing from the Access page shows the overview.
- **HotCRM leg: carried by #36910** (the joint walk-through card); this
container has no HotCRM stack.
- N1: `MetadataQuickFind` on ⌘⇧M (`DirectoryPage`) is a second item
finder beside ⌘K; a follow-up retires or routes it.
- N2: each open of the palette on a package reads one item list per
listed type (the menu's types and counts are shared and not re-read).
The client shares only in-flight reads. Draft-only items are not listed.
- N5: nothing inside Studio advertises ⌘K. Studio's own header draws no
search trigger, and the help dialog that lists advertised shortcuts is
mounted only inside apps.
- N6: `useStudioMenuTypes` no longer memoizes `types`, and the provider
value is a new object each render. The palette's reads key on the type
names, so this costs re-renders only.
- N7: while the package entry loads, the customization label briefly
names the base package by its id.
- N8: the changeset's English body carries the six group names in
Chinese too, beside the English.
- Walk observation: with zero delay between Escape and the next Ctrl+K
(automated), a query typed before the lists answered left no row
highlighted. With no earlier close, or with a 1 s gap, it worked every
time measured. This is synthetic timing, not filed.
- #36784 (paused, pre-split) conflicts in `StudioDesignSurface.tsx`
against `main` itself; this branch merges cleanly with `main` and
#37089.
## Verification
Two minutes: open any package in Studio (`/studio/PKG/data`), press ⌘K
(Ctrl+K), type part of a dashboard's or hook's name, and press Enter.
The palette lists the six menu groups and the item; Enter opens
`/studio/PKG/metadata/TYPE/NAME?package=OWNER`. Edit a field on that
item page without saving, then pick another entry: the leave prompt
appears first, and Cancel keeps the edit.
<details><summary>Where to look in code</summary>
- Leave path: `openStudioPaletteAddress` (model) and
`confirmLeavePillar` / `reenterPillar` / `openFromPalette` (surface).
- Groups: `StudioPaletteGroups` (reads) over `useStudioMenuData` and
`buildStudioPaletteGroups` / `studioPaletteItemAddress` (pure).
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QSeKYkkwuF6UuFtu85Yd5H)_
<!-- signed: repo:objectstack#4 · os-justin ·
session_01QSeKYkkwuF6UuFtu85Yd5H -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 6f3a8da commit 355c73c
15 files changed
Lines changed: 1679 additions & 92 deletions
File tree
- .changeset
- ui
- e2e
- packages/app-shell
- src
- chrome
- views
- metadata-admin
- studio-design
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
44 | 47 | | |
45 | 48 | | |
46 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1424 | 1424 | | |
1425 | 1425 | | |
1426 | 1426 | | |
1427 | | - | |
1428 | | - | |
1429 | | - | |
1430 | | - | |
1431 | | - | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
1432 | 1453 | | |
1433 | 1454 | | |
1434 | 1455 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
| |||
123 | 126 | | |
124 | 127 | | |
125 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
126 | 168 | | |
127 | 169 | | |
128 | 170 | | |
| |||
372 | 414 | | |
373 | 415 | | |
374 | 416 | | |
375 | | - | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
376 | 423 | | |
| 424 | + | |
| 425 | + | |
377 | 426 | | |
378 | 427 | | |
379 | 428 | | |
| |||
585 | 634 | | |
586 | 635 | | |
587 | 636 | | |
588 | | - | |
| 637 | + | |
589 | 638 | | |
590 | 639 | | |
591 | 640 | | |
| |||
766 | 815 | | |
767 | 816 | | |
768 | 817 | | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
769 | 821 | | |
770 | 822 | | |
771 | 823 | | |
| |||
775 | 827 | | |
776 | 828 | | |
777 | 829 | | |
778 | | - | |
| 830 | + | |
779 | 831 | | |
780 | 832 | | |
781 | 833 | | |
| |||
788 | 840 | | |
789 | 841 | | |
790 | 842 | | |
791 | | - | |
| 843 | + | |
792 | 844 | | |
793 | 845 | | |
794 | 846 | | |
| |||
801 | 853 | | |
802 | 854 | | |
803 | 855 | | |
804 | | - | |
| 856 | + | |
805 | 857 | | |
806 | 858 | | |
807 | 859 | | |
| |||
1056 | 1108 | | |
1057 | 1109 | | |
1058 | 1110 | | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
1059 | 1115 | | |
1060 | | - | |
| 1116 | + | |
1061 | 1117 | | |
1062 | 1118 | | |
1063 | 1119 | | |
| |||
1082 | 1138 | | |
1083 | 1139 | | |
1084 | 1140 | | |
1085 | | - | |
1086 | | - | |
| 1141 | + | |
| 1142 | + | |
1087 | 1143 | | |
| 1144 | + | |
1088 | 1145 | | |
1089 | 1146 | | |
1090 | 1147 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
204 | 228 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
26 | | - | |
| 28 | + | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
| |||
89 | 92 | | |
90 | 93 | | |
91 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
92 | 98 | | |
93 | 99 | | |
94 | 100 | | |
| |||
220 | 226 | | |
221 | 227 | | |
222 | 228 | | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1717 | 1717 | | |
1718 | 1718 | | |
1719 | 1719 | | |
1720 | | - | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
1721 | 1723 | | |
1722 | 1724 | | |
1723 | 1725 | | |
1724 | | - | |
| 1726 | + | |
1725 | 1727 | | |
1726 | 1728 | | |
1727 | 1729 | | |
| |||
0 commit comments