@multiplatform.one/backoffice 7.63.4 → 7.65.0

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 (88) hide show
  1. package/dist/cjs/chrome/BackofficeAwesomebar.cjs +3 -19
  2. package/dist/cjs/chrome/BackofficeAwesomebar.native.js +3 -20
  3. package/dist/cjs/chrome/BackofficeAwesomebar.native.js.map +1 -1
  4. package/dist/cjs/chrome/CommandPalette.cjs +6 -23
  5. package/dist/cjs/chrome/CommandPalette.native.js +6 -24
  6. package/dist/cjs/chrome/CommandPalette.native.js.map +1 -1
  7. package/dist/cjs/chrome/help-shortcuts-dialog.cjs +7 -43
  8. package/dist/cjs/chrome/help-shortcuts-dialog.native.js +6 -46
  9. package/dist/cjs/chrome/help-shortcuts-dialog.native.js.map +1 -1
  10. package/dist/cjs/list/DoctypeListScreen.cjs +10 -4
  11. package/dist/cjs/list/DoctypeListScreen.native.js +12 -4
  12. package/dist/cjs/list/DoctypeListScreen.native.js.map +1 -1
  13. package/dist/cjs/shell/BackofficeShell.cjs +37 -2
  14. package/dist/cjs/shell/BackofficeShell.native.js +43 -2
  15. package/dist/cjs/shell/BackofficeShell.native.js.map +1 -1
  16. package/dist/cjs/shell/shellTopBarSlot.cjs +65 -9
  17. package/dist/cjs/shell/shellTopBarSlot.native.js +78 -9
  18. package/dist/cjs/shell/shellTopBarSlot.native.js.map +1 -1
  19. package/dist/esm/chrome/BackofficeAwesomebar.mjs +4 -20
  20. package/dist/esm/chrome/BackofficeAwesomebar.mjs.map +1 -1
  21. package/dist/esm/chrome/BackofficeAwesomebar.native.js +4 -21
  22. package/dist/esm/chrome/BackofficeAwesomebar.native.js.map +1 -1
  23. package/dist/esm/chrome/CommandPalette.mjs +7 -24
  24. package/dist/esm/chrome/CommandPalette.mjs.map +1 -1
  25. package/dist/esm/chrome/CommandPalette.native.js +7 -25
  26. package/dist/esm/chrome/CommandPalette.native.js.map +1 -1
  27. package/dist/esm/chrome/help-shortcuts-dialog.mjs +9 -45
  28. package/dist/esm/chrome/help-shortcuts-dialog.mjs.map +1 -1
  29. package/dist/esm/chrome/help-shortcuts-dialog.native.js +8 -48
  30. package/dist/esm/chrome/help-shortcuts-dialog.native.js.map +1 -1
  31. package/dist/esm/list/DoctypeListScreen.mjs +11 -5
  32. package/dist/esm/list/DoctypeListScreen.mjs.map +1 -1
  33. package/dist/esm/list/DoctypeListScreen.native.js +13 -5
  34. package/dist/esm/list/DoctypeListScreen.native.js.map +1 -1
  35. package/dist/esm/shell/BackofficeShell.mjs +37 -2
  36. package/dist/esm/shell/BackofficeShell.mjs.map +1 -1
  37. package/dist/esm/shell/BackofficeShell.native.js +43 -2
  38. package/dist/esm/shell/BackofficeShell.native.js.map +1 -1
  39. package/dist/esm/shell/shellTopBarSlot.mjs +66 -11
  40. package/dist/esm/shell/shellTopBarSlot.mjs.map +1 -1
  41. package/dist/esm/shell/shellTopBarSlot.native.js +79 -11
  42. package/dist/esm/shell/shellTopBarSlot.native.js.map +1 -1
  43. package/dist/jsx/chrome/BackofficeAwesomebar.mjs +4 -20
  44. package/dist/jsx/chrome/BackofficeAwesomebar.mjs.map +1 -1
  45. package/dist/jsx/chrome/BackofficeAwesomebar.native.js +3 -20
  46. package/dist/jsx/chrome/BackofficeAwesomebar.native.js.map +1 -1
  47. package/dist/jsx/chrome/CommandPalette.mjs +7 -24
  48. package/dist/jsx/chrome/CommandPalette.mjs.map +1 -1
  49. package/dist/jsx/chrome/CommandPalette.native.js +6 -24
  50. package/dist/jsx/chrome/CommandPalette.native.js.map +1 -1
  51. package/dist/jsx/chrome/help-shortcuts-dialog.mjs +9 -45
  52. package/dist/jsx/chrome/help-shortcuts-dialog.mjs.map +1 -1
  53. package/dist/jsx/chrome/help-shortcuts-dialog.native.js +6 -46
  54. package/dist/jsx/chrome/help-shortcuts-dialog.native.js.map +1 -1
  55. package/dist/jsx/list/DoctypeListScreen.mjs +11 -5
  56. package/dist/jsx/list/DoctypeListScreen.mjs.map +1 -1
  57. package/dist/jsx/list/DoctypeListScreen.native.js +12 -4
  58. package/dist/jsx/list/DoctypeListScreen.native.js.map +1 -1
  59. package/dist/jsx/shell/BackofficeShell.mjs +37 -2
  60. package/dist/jsx/shell/BackofficeShell.mjs.map +1 -1
  61. package/dist/jsx/shell/BackofficeShell.native.js +43 -2
  62. package/dist/jsx/shell/BackofficeShell.native.js.map +1 -1
  63. package/dist/jsx/shell/shellTopBarSlot.mjs +66 -11
  64. package/dist/jsx/shell/shellTopBarSlot.mjs.map +1 -1
  65. package/dist/jsx/shell/shellTopBarSlot.native.js +78 -9
  66. package/dist/jsx/shell/shellTopBarSlot.native.js.map +1 -1
  67. package/package.json +12 -12
  68. package/src/chrome/BackofficeAwesomebar.tsx +2 -26
  69. package/src/chrome/CommandPalette.stories.tsx +1 -7
  70. package/src/chrome/CommandPalette.tsx +4 -20
  71. package/src/chrome/help-shortcuts-dialog.tsx +9 -51
  72. package/src/desk/Desk.stories.tsx +1 -7
  73. package/src/desk/DeskSurface.stories.tsx +1 -7
  74. package/src/formBuilder/FormBuilderScreen.stories.tsx +2 -6
  75. package/src/list/DoctypeListScreen.compactHead.screen.spec.tsx +13 -0
  76. package/src/list/DoctypeListScreen.tsx +18 -8
  77. package/src/shell/BackofficeShell.tsx +49 -5
  78. package/src/shell/NotFoundScreen.stories.tsx +1 -7
  79. package/src/shell/shellTopBarSlot.spec.tsx +131 -0
  80. package/src/shell/shellTopBarSlot.tsx +109 -10
  81. package/src/views/DoctypeViewScreen.stories.tsx +1 -7
  82. package/types/chrome/BackofficeAwesomebar.d.ts.map +1 -1
  83. package/types/chrome/CommandPalette.d.ts.map +1 -1
  84. package/types/chrome/help-shortcuts-dialog.d.ts.map +1 -1
  85. package/types/list/DoctypeListScreen.d.ts.map +1 -1
  86. package/types/shell/BackofficeShell.d.ts.map +1 -1
  87. package/types/shell/shellTopBarSlot.d.ts +36 -2
  88. package/types/shell/shellTopBarSlot.d.ts.map +1 -1
@@ -7,16 +7,10 @@
7
7
  import { YStack } from "@multiplatform.one/components";
8
8
  import { InMemoryFixtureProvider } from "@multiplatform.one/frappe";
9
9
  import type { ReactNode } from "react";
10
- import { sizeRecipeEscape } from "@multiplatform.one/theme";
11
10
  import { BackofficeProvider } from "../config/BackofficeProvider";
12
11
  import { createMemoryNavigator } from "../navigation/navigator";
13
12
  import { NotFoundScreen } from "./NotFoundScreen";
14
13
 
15
- const frameHeight = sizeRecipeEscape(
16
- 420,
17
- "story canvas: a fixed-height frame for a full-height screen to fill",
18
- );
19
-
20
14
  const meta = {
21
15
  title: "Screens/Backoffice/NotFoundScreen",
22
16
  component: NotFoundScreen,
@@ -52,7 +46,7 @@ function Host({
52
46
  frappe={{ baseURL: MOCK_HOST, fixtures: new InMemoryFixtureProvider({}) }}
53
47
  navigation={navigation}
54
48
  >
55
- <YStack flex={1} height={frameHeight} justifyContent="center">
49
+ <YStack flex={1} height="100vh" justifyContent="center">
56
50
  {children}
57
51
  </YStack>
58
52
  </BackofficeProvider>
@@ -0,0 +1,131 @@
1
+ // LC-128 (FZ-7974): the banner's title outranks the page action. The shell
2
+ // holds the action only while the title fits whole beside it; otherwise it
3
+ // hands the action back to the page's control row. The widths below are the
4
+ // banner's, measured at 390pt in `Screens/Backoffice/Desk → Pinned With Full
5
+ // Chrome` (title "QaDeskWorkItem", 121pt on one line, trailing group of
6
+ // New, search, notifications and Log in).
7
+ import { act, renderHook } from "@testing-library/react";
8
+ import { describe, expect, it } from "vitest";
9
+ import { bannerHoldsAction, useShellTopBarSlotState } from "./shellTopBarSlot";
10
+
11
+ const titleNatural = 121;
12
+ const roomWithAction = 85;
13
+ const trailingWith = 203;
14
+ const trailingWithout = 157;
15
+ const actionCost = trailingWith - trailingWithout;
16
+ const roomWithoutAction = roomWithAction + actionCost;
17
+
18
+ describe("bannerHoldsAction", () => {
19
+ it("withdraws the action when the title would truncate beside it", () => {
20
+ expect(
21
+ bannerHoldsAction({
22
+ shown: true,
23
+ titleNatural,
24
+ titleAvailable: roomWithAction,
25
+ actionCost,
26
+ }),
27
+ ).toBe(false);
28
+ });
29
+
30
+ it("keeps the action out while bringing it back would truncate the title", () => {
31
+ expect(
32
+ bannerHoldsAction({
33
+ shown: false,
34
+ titleNatural,
35
+ titleAvailable: roomWithoutAction,
36
+ actionCost,
37
+ }),
38
+ ).toBe(false);
39
+ });
40
+
41
+ it("holds the action when a short title fits whole beside it", () => {
42
+ expect(
43
+ bannerHoldsAction({ shown: true, titleNatural: 62, titleAvailable: 85, actionCost }),
44
+ ).toBe(true);
45
+ expect(
46
+ bannerHoldsAction({ shown: false, titleNatural: 62, titleAvailable: 131, actionCost }),
47
+ ).toBe(true);
48
+ });
49
+
50
+ it("decides the same way in both states, so it never flips back and forth", () => {
51
+ for (let natural = 40; natural <= 160; natural += 1) {
52
+ const shown = bannerHoldsAction({
53
+ shown: true,
54
+ titleNatural: natural,
55
+ titleAvailable: roomWithAction,
56
+ actionCost,
57
+ });
58
+ const hidden = bannerHoldsAction({
59
+ shown: false,
60
+ titleNatural: natural,
61
+ titleAvailable: roomWithoutAction,
62
+ actionCost,
63
+ });
64
+ expect(hidden).toBe(shown);
65
+ }
66
+ });
67
+ });
68
+
69
+ describe("useShellTopBarSlotState", () => {
70
+ it("at 390pt hands New back to the page and leaves the title its whole width", () => {
71
+ const { result } = renderHook(() => useShellTopBarSlotState());
72
+ act(() => result.current.measure.trailing(trailingWithout));
73
+ act(() => result.current.value.setAction("New"));
74
+ expect(result.current.held).toBe(true);
75
+ act(() => {
76
+ result.current.measure.trailing(trailingWith);
77
+ result.current.measure.titleNatural(titleNatural);
78
+ result.current.measure.titleAvailable(roomWithAction);
79
+ });
80
+ expect(result.current.held).toBe(false);
81
+ expect(result.current.value.held).toBe(false);
82
+ // With New back in the page's row, the banner gives the title more room
83
+ // than it needs on one line: it is not truncated.
84
+ act(() => {
85
+ result.current.measure.trailing(trailingWithout);
86
+ result.current.measure.titleAvailable(roomWithoutAction);
87
+ });
88
+ expect(result.current.held).toBe(false);
89
+ expect(roomWithoutAction).toBeGreaterThanOrEqual(titleNatural);
90
+ });
91
+
92
+ it("brings the action back when the title gets short enough", () => {
93
+ const { result } = renderHook(() => useShellTopBarSlotState());
94
+ act(() => result.current.measure.trailing(trailingWithout));
95
+ act(() => result.current.value.setAction("New"));
96
+ act(() => {
97
+ result.current.measure.trailing(trailingWith);
98
+ result.current.measure.titleNatural(titleNatural);
99
+ result.current.measure.titleAvailable(roomWithAction);
100
+ });
101
+ act(() => {
102
+ result.current.measure.trailing(trailingWithout);
103
+ result.current.measure.titleAvailable(roomWithoutAction);
104
+ });
105
+ expect(result.current.held).toBe(false);
106
+ act(() => result.current.measure.titleNatural(62));
107
+ expect(result.current.held).toBe(true);
108
+ });
109
+
110
+ it("holds the action until the banner is measured (no layout, SSR, tests)", () => {
111
+ const { result } = renderHook(() => useShellTopBarSlotState());
112
+ act(() => result.current.value.setAction("New"));
113
+ expect(result.current.held).toBe(true);
114
+ expect(result.current.action).toBe("New");
115
+ });
116
+
117
+ it("starts a withdrawn action fresh in the banner after the page drops it", () => {
118
+ const { result } = renderHook(() => useShellTopBarSlotState());
119
+ act(() => result.current.measure.trailing(trailingWithout));
120
+ act(() => result.current.value.setAction("New"));
121
+ act(() => {
122
+ result.current.measure.trailing(trailingWith);
123
+ result.current.measure.titleNatural(titleNatural);
124
+ result.current.measure.titleAvailable(roomWithAction);
125
+ });
126
+ expect(result.current.held).toBe(false);
127
+ act(() => result.current.value.setAction(null));
128
+ expect(result.current.held).toBe(false);
129
+ expect(result.current.value.held).toBe(true);
130
+ });
131
+ });
@@ -5,9 +5,14 @@
5
5
  * banner. Without a shell above (bare stories, embedded screens) there is no
6
6
  * slot, `useShellTopBarAction` returns false and the page keeps the action
7
7
  * in its own control row.
8
+ *
9
+ * The title outranks the action: the banner holds the action only while the
10
+ * title fits whole beside it. When it would truncate the title, the shell
11
+ * hands the action back and the page ends its control row with it.
8
12
  */
9
13
  import {
10
14
  createContext,
15
+ useCallback,
11
16
  useContext,
12
17
  useLayoutEffect,
13
18
  useMemo,
@@ -17,18 +22,108 @@ import {
17
22
 
18
23
  interface ShellTopBarSlotValue {
19
24
  setAction: (action: ReactNode | null) => void;
25
+ /** Whether the banner is drawing the registered action. */
26
+ held: boolean;
20
27
  }
21
28
 
22
29
  const ShellTopBarSlotContext = createContext<ShellTopBarSlotValue | null>(null);
23
30
 
24
- /** Shell side: owns the registered action and exposes the setter. */
31
+ /** Sub-pixel rounding between a text's natural and laid-out width. */
32
+ const fitTolerancePx = 0.5;
33
+
34
+ export interface BannerFitInput {
35
+ /** Whether the banner is drawing the action while these were measured. */
36
+ shown: boolean;
37
+ /** The title's width on one line, unconstrained. */
38
+ titleNatural: number;
39
+ /** The width the banner gives the title in its current layout. */
40
+ titleAvailable: number;
41
+ /** What drawing the action costs the title: the trailing group's width with it minus without it. */
42
+ actionCost: number | undefined;
43
+ }
44
+
45
+ /**
46
+ * Whether the banner can hold the action without truncating the title. With
47
+ * the action shown the title's room is measured as is; with it withdrawn the
48
+ * room it would leave is the current room minus the action's cost. An
49
+ * unknown cost keeps the current state, so the first measurement decides.
50
+ */
51
+ export function bannerHoldsAction({
52
+ shown,
53
+ titleNatural,
54
+ titleAvailable,
55
+ actionCost,
56
+ }: BannerFitInput): boolean {
57
+ if (shown) return titleNatural <= titleAvailable + fitTolerancePx;
58
+ if (actionCost === undefined) return false;
59
+ return titleNatural <= titleAvailable - actionCost + fitTolerancePx;
60
+ }
61
+
62
+ interface BannerWidths {
63
+ titleNatural?: number;
64
+ titleAvailable?: number;
65
+ trailingWith?: number;
66
+ trailingWithout?: number;
67
+ }
68
+
69
+ /**
70
+ * Shell side: owns the registered action, decides whether the banner holds
71
+ * it, and exposes the setter. Feed it the banner's widths through the
72
+ * returned `measure` callbacks (onLayout).
73
+ */
25
74
  export function useShellTopBarSlotState(): {
26
75
  action: ReactNode | null;
76
+ held: boolean;
27
77
  value: ShellTopBarSlotValue;
78
+ measure: {
79
+ titleNatural: (width: number) => void;
80
+ titleAvailable: (width: number) => void;
81
+ trailing: (width: number) => void;
82
+ };
28
83
  } {
29
- const [action, setAction] = useState<ReactNode | null>(null);
30
- const value = useMemo(() => ({ setAction }), []);
31
- return { action, value };
84
+ const [action, setActionState] = useState<ReactNode | null>(null);
85
+ const [held, setHeld] = useState(true);
86
+ const [widths, setWidths] = useState<BannerWidths>({});
87
+ const hasAction = action != null;
88
+
89
+ const setAction = useCallback((next: ReactNode | null) => {
90
+ setActionState(next);
91
+ if (next == null) {
92
+ // A new action starts in the banner and is measured there.
93
+ setHeld(true);
94
+ setWidths((current) => ({ ...current, trailingWith: undefined }));
95
+ }
96
+ }, []);
97
+
98
+ const record = useCallback(
99
+ (key: keyof BannerWidths) => (width: number) =>
100
+ setWidths((current) => (current[key] === width ? current : { ...current, [key]: width })),
101
+ [],
102
+ );
103
+ const measure = useMemo(
104
+ () => ({
105
+ titleNatural: record("titleNatural"),
106
+ titleAvailable: record("titleAvailable"),
107
+ trailing: (width: number) =>
108
+ record(hasAction && held ? "trailingWith" : "trailingWithout")(width),
109
+ }),
110
+ [record, hasAction, held],
111
+ );
112
+
113
+ useLayoutEffect(() => {
114
+ if (!hasAction) return;
115
+ const { titleNatural, titleAvailable, trailingWith, trailingWithout } = widths;
116
+ if (titleNatural === undefined || titleAvailable === undefined) return;
117
+ const actionCost =
118
+ trailingWith !== undefined && trailingWithout !== undefined
119
+ ? trailingWith - trailingWithout
120
+ : undefined;
121
+ const next = bannerHoldsAction({ shown: held, titleNatural, titleAvailable, actionCost });
122
+ if (next !== held) setHeld(next);
123
+ }, [hasAction, held, widths]);
124
+
125
+ const value = useMemo(() => ({ setAction, held }), [setAction, held]);
126
+ return { action, held: hasAction && held, value, measure };
32
127
  }
33
128
 
34
129
  export function ShellTopBarSlotProvider({
@@ -46,16 +141,20 @@ export function ShellTopBarSlotProvider({
46
141
  /**
47
142
  * Page side: register `action` (or `null` to withdraw it) with the shell's
48
143
  * top bar. Re-registers after every render of the caller so the action
49
- * tracks the page's state. Returns whether a shell took it.
144
+ * tracks the page's state. Returns whether the banner is drawing it; when
145
+ * false the page draws it itself.
50
146
  */
51
147
  export function useShellTopBarAction(action: ReactNode | null): boolean {
52
148
  const slot = useContext(ShellTopBarSlotContext);
149
+ // Keyed on the stable setter, not the context value: `held` flipping must
150
+ // not withdraw and re-register the action.
151
+ const setAction = slot?.setAction;
53
152
  useLayoutEffect(() => {
54
- slot?.setAction(action);
153
+ setAction?.(action);
55
154
  });
56
155
  useLayoutEffect(() => {
57
- if (!slot) return;
58
- return () => slot.setAction(null);
59
- }, [slot]);
60
- return slot !== null;
156
+ if (!setAction) return;
157
+ return () => setAction(null);
158
+ }, [setAction]);
159
+ return slot !== null && slot.held;
61
160
  }
@@ -12,17 +12,11 @@
12
12
  // so an arm sets them by seeding the MemoryNavigator path.
13
13
  import { YStack } from "@multiplatform.one/components";
14
14
  import { InMemoryFixtureProvider } from "@multiplatform.one/frappe";
15
- import { sizeRecipeEscape } from "@multiplatform.one/theme";
16
15
  import { BackofficeProvider } from "../config/BackofficeProvider";
17
16
  import { createMemoryNavigator } from "../navigation/navigator";
18
17
  import type { BackofficeView } from "../navigation/paths";
19
18
  import { DoctypeViewScreen } from "./DoctypeViewScreen";
20
19
 
21
- const frameHeight = sizeRecipeEscape(
22
- 600,
23
- "story canvas: a fixed-height frame for a full-height screen to fill",
24
- );
25
-
26
20
  const meta = {
27
21
  title: "Screens/Backoffice/DoctypeViewScreen",
28
22
  component: DoctypeViewScreen,
@@ -218,7 +212,7 @@ function View({ doctype, view, path }: { doctype: string; view: BackofficeView;
218
212
  frappe={{ baseURL: MOCK_HOST, fixtures: makeFixtures() }}
219
213
  navigation={createMemoryNavigator(path ?? "/backoffice")}
220
214
  >
221
- <YStack flex={1} height={frameHeight} minHeight={0}>
215
+ <YStack flex={1} height="100vh" minHeight={0}>
222
216
  <DoctypeViewScreen doctype={doctype} view={view} />
223
217
  </YStack>
224
218
  </BackofficeProvider>
@@ -1 +1 @@
1
- {"version":3,"file":"BackofficeAwesomebar.d.ts","sourceRoot":"","sources":["../../src/chrome/BackofficeAwesomebar.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAQjC,2EAA2E;AAC3E,MAAM,WAAW,0BAA0B;IACzC,yEAAyE;IACzE,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,MAAM,WAAW,yBAAyB;IACxC,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,GAAG,CAAC,0BAA0B,CAAC,CAAC;CAC5C;AAaD,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,GAAE,yBAA8B,2CAoDhF"}
1
+ {"version":3,"file":"BackofficeAwesomebar.d.ts","sourceRoot":"","sources":["../../src/chrome/BackofficeAwesomebar.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAQjC,2EAA2E;AAC3E,MAAM,WAAW,0BAA0B;IACzC,yEAAyE;IACzE,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,MAAM,WAAW,yBAAyB;IACxC,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,GAAG,CAAC,0BAA0B,CAAC,CAAC;CAC5C;AAED,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,GAAE,yBAA8B,2CAuChF"}
@@ -1 +1 @@
1
- {"version":3,"file":"CommandPalette.d.ts","sourceRoot":"","sources":["../../src/chrome/CommandPalette.tsx"],"names":[],"mappings":"AAgEA,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACvC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CAMxD"}
1
+ {"version":3,"file":"CommandPalette.d.ts","sourceRoot":"","sources":["../../src/chrome/CommandPalette.tsx"],"names":[],"mappings":"AAiEA,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACvC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CAMxD"}
@@ -1 +1 @@
1
- {"version":3,"file":"help-shortcuts-dialog.d.ts","sourceRoot":"","sources":["../../src/chrome/help-shortcuts-dialog.tsx"],"names":[],"mappings":"AAoBA,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACvC;AA8ED,wBAAgB,mBAAmB,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,wBAAwB,2CAuDnF"}
1
+ {"version":3,"file":"help-shortcuts-dialog.d.ts","sourceRoot":"","sources":["../../src/chrome/help-shortcuts-dialog.tsx"],"names":[],"mappings":"AAqBA,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACvC;AAuCD,wBAAgB,mBAAmB,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,wBAAwB,2CAmDnF"}
@@ -1 +1 @@
1
- {"version":3,"file":"DoctypeListScreen.d.ts","sourceRoot":"","sources":["../../src/list/DoctypeListScreen.tsx"],"names":[],"mappings":"AAyCA,OAAO,EAUL,KAAK,OAAO,EACb,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAEV,eAAe,EAIhB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAOL,KAAK,gBAAgB,EACtB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAS1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,KAAK,W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sBAAsB,2CAgpCxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"BackofficeShell.d.ts","sourceRoot":"","sources":["../../src/shell/BackofficeShell.tsx"],"names":[],"mappings":"AA8CA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAmC/B,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA6DD,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,oBAAoB,2CAqOhG"}
1
+ {"version":3,"file":"BackofficeShell.d.ts","sourceRoot":"","sources":["../../src/shell/BackofficeShell.tsx"],"names":[],"mappings":"AA8CA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAmC/B,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA6DD,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,oBAAoB,2CAiRhG"}
@@ -5,15 +5,48 @@
5
5
  * banner. Without a shell above (bare stories, embedded screens) there is no
6
6
  * slot, `useShellTopBarAction` returns false and the page keeps the action
7
7
  * in its own control row.
8
+ *
9
+ * The title outranks the action: the banner holds the action only while the
10
+ * title fits whole beside it. When it would truncate the title, the shell
11
+ * hands the action back and the page ends its control row with it.
8
12
  */
9
13
  import { type ReactNode } from "react";
10
14
  interface ShellTopBarSlotValue {
11
15
  setAction: (action: ReactNode | null) => void;
16
+ /** Whether the banner is drawing the registered action. */
17
+ held: boolean;
12
18
  }
13
- /** Shell side: owns the registered action and exposes the setter. */
19
+ export interface BannerFitInput {
20
+ /** Whether the banner is drawing the action while these were measured. */
21
+ shown: boolean;
22
+ /** The title's width on one line, unconstrained. */
23
+ titleNatural: number;
24
+ /** The width the banner gives the title in its current layout. */
25
+ titleAvailable: number;
26
+ /** What drawing the action costs the title: the trailing group's width with it minus without it. */
27
+ actionCost: number | undefined;
28
+ }
29
+ /**
30
+ * Whether the banner can hold the action without truncating the title. With
31
+ * the action shown the title's room is measured as is; with it withdrawn the
32
+ * room it would leave is the current room minus the action's cost. An
33
+ * unknown cost keeps the current state, so the first measurement decides.
34
+ */
35
+ export declare function bannerHoldsAction({ shown, titleNatural, titleAvailable, actionCost, }: BannerFitInput): boolean;
36
+ /**
37
+ * Shell side: owns the registered action, decides whether the banner holds
38
+ * it, and exposes the setter. Feed it the banner's widths through the
39
+ * returned `measure` callbacks (onLayout).
40
+ */
14
41
  export declare function useShellTopBarSlotState(): {
15
42
  action: ReactNode | null;
43
+ held: boolean;
16
44
  value: ShellTopBarSlotValue;
45
+ measure: {
46
+ titleNatural: (width: number) => void;
47
+ titleAvailable: (width: number) => void;
48
+ trailing: (width: number) => void;
49
+ };
17
50
  };
18
51
  export declare function ShellTopBarSlotProvider({ value, children, }: {
19
52
  value: ShellTopBarSlotValue | null;
@@ -22,7 +55,8 @@ export declare function ShellTopBarSlotProvider({ value, children, }: {
22
55
  /**
23
56
  * Page side: register `action` (or `null` to withdraw it) with the shell's
24
57
  * top bar. Re-registers after every render of the caller so the action
25
- * tracks the page's state. Returns whether a shell took it.
58
+ * tracks the page's state. Returns whether the banner is drawing it; when
59
+ * false the page draws it itself.
26
60
  */
27
61
  export declare function useShellTopBarAction(action: ReactNode | null): boolean;
28
62
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"shellTopBarSlot.d.ts","sourceRoot":"","sources":["../../src/shell/shellTopBarSlot.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,UAAU,oBAAoB;IAC5B,SAAS,EAAE,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,KAAK,IAAI,CAAC;CAC/C;AAID,qEAAqE;AACrE,wBAAgB,uBAAuB,IAAI;IACzC,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,oBAAoB,CAAC;CAC7B,CAIA;AAED,wBAAgB,uBAAuB,CAAC,EACtC,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACnC,QAAQ,EAAE,SAAS,CAAC;CACrB,2CAIA;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,GAAG,OAAO,CAUtE"}
1
+ {"version":3,"file":"shellTopBarSlot.d.ts","sourceRoot":"","sources":["../../src/shell/shellTopBarSlot.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,UAAU,oBAAoB;IAC5B,SAAS,EAAE,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,KAAK,IAAI,CAAC;IAC9C,2DAA2D;IAC3D,IAAI,EAAE,OAAO,CAAC;CACf;AAOD,MAAM,WAAW,cAAc;IAC7B,0EAA0E;IAC1E,KAAK,EAAE,OAAO,CAAC;IACf,oDAAoD;IACpD,YAAY,EAAE,MAAM,CAAC;IACrB,kEAAkE;IAClE,cAAc,EAAE,MAAM,CAAC;IACvB,oGAAoG;IACpG,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,E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