@oxy.so/bloom 19.9.0 → 19.10.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.
- package/docs/adoption-matrix.mdx +5 -5
- package/docs/conversation-sidebar.mdx +1 -1
- package/docs/menubar.mdx +3 -3
- package/docs/sidebar.mdx +2 -2
- package/docs/task-catalog.json +1 -1
- package/docs/task-catalog.mdx +1 -1
- package/lib/commonjs/conversation-sidebar/create-conversation-sidebar.js +6 -3
- package/lib/commonjs/conversation-sidebar/create-conversation-sidebar.js.map +1 -1
- package/lib/commonjs/conversation-sidebar/index.js +1 -1
- package/lib/commonjs/conversation-sidebar/index.web.js +1 -1
- package/lib/commonjs/menubar/declared.js +171 -66
- package/lib/commonjs/menubar/declared.js.map +1 -1
- package/lib/commonjs/menubar/description.js +293 -0
- package/lib/commonjs/menubar/description.js.map +1 -0
- package/lib/commonjs/menubar/use-edit-action.js +1 -0
- package/lib/commonjs/menubar/use-edit-action.js.map +1 -1
- package/lib/commonjs/sidebar/SidebarToolbar.js +24 -9
- package/lib/commonjs/sidebar/SidebarToolbar.js.map +1 -1
- package/lib/commonjs/sidebar/SidebarTreeSection.js +17 -6
- package/lib/commonjs/sidebar/SidebarTreeSection.js.map +1 -1
- package/lib/module/conversation-sidebar/create-conversation-sidebar.js +6 -3
- package/lib/module/conversation-sidebar/create-conversation-sidebar.js.map +1 -1
- package/lib/module/conversation-sidebar/index.js +1 -1
- package/lib/module/conversation-sidebar/index.web.js +1 -1
- package/lib/module/menubar/declared.js +145 -43
- package/lib/module/menubar/declared.js.map +1 -1
- package/lib/module/menubar/description.js +286 -0
- package/lib/module/menubar/description.js.map +1 -0
- package/lib/module/menubar/use-edit-action.js +1 -1
- package/lib/module/menubar/use-edit-action.js.map +1 -1
- package/lib/module/sidebar/SidebarToolbar.js +24 -9
- package/lib/module/sidebar/SidebarToolbar.js.map +1 -1
- package/lib/module/sidebar/SidebarTreeSection.js +16 -5
- package/lib/module/sidebar/SidebarTreeSection.js.map +1 -1
- package/lib/typescript/commonjs/conversation-sidebar/create-conversation-sidebar.d.ts.map +1 -1
- package/lib/typescript/commonjs/conversation-sidebar/index.d.ts +1 -1
- package/lib/typescript/commonjs/conversation-sidebar/index.web.d.ts +1 -1
- package/lib/typescript/commonjs/menubar/declared.d.ts +29 -20
- package/lib/typescript/commonjs/menubar/declared.d.ts.map +1 -1
- package/lib/typescript/commonjs/menubar/description.d.ts +90 -0
- package/lib/typescript/commonjs/menubar/description.d.ts.map +1 -0
- package/lib/typescript/commonjs/menubar/types.d.ts +7 -6
- package/lib/typescript/commonjs/menubar/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/menubar/use-edit-action.d.ts +4 -1
- package/lib/typescript/commonjs/menubar/use-edit-action.d.ts.map +1 -1
- package/lib/typescript/commonjs/sidebar/SidebarToolbar.d.ts +5 -1
- package/lib/typescript/commonjs/sidebar/SidebarToolbar.d.ts.map +1 -1
- package/lib/typescript/commonjs/sidebar/SidebarTreeSection.d.ts +7 -1
- package/lib/typescript/commonjs/sidebar/SidebarTreeSection.d.ts.map +1 -1
- package/lib/typescript/module/conversation-sidebar/create-conversation-sidebar.d.ts.map +1 -1
- package/lib/typescript/module/conversation-sidebar/index.d.ts +1 -1
- package/lib/typescript/module/conversation-sidebar/index.web.d.ts +1 -1
- package/lib/typescript/module/menubar/declared.d.ts +29 -20
- package/lib/typescript/module/menubar/declared.d.ts.map +1 -1
- package/lib/typescript/module/menubar/description.d.ts +90 -0
- package/lib/typescript/module/menubar/description.d.ts.map +1 -0
- package/lib/typescript/module/menubar/types.d.ts +7 -6
- package/lib/typescript/module/menubar/types.d.ts.map +1 -1
- package/lib/typescript/module/menubar/use-edit-action.d.ts +4 -1
- package/lib/typescript/module/menubar/use-edit-action.d.ts.map +1 -1
- package/lib/typescript/module/sidebar/SidebarToolbar.d.ts +5 -1
- package/lib/typescript/module/sidebar/SidebarToolbar.d.ts.map +1 -1
- package/lib/typescript/module/sidebar/SidebarTreeSection.d.ts +7 -1
- package/lib/typescript/module/sidebar/SidebarTreeSection.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/conversation-sidebar/create-conversation-sidebar.tsx +3 -2
- package/src/conversation-sidebar/index.ts +1 -1
- package/src/conversation-sidebar/index.web.ts +1 -1
- package/src/menubar/declared.tsx +166 -39
- package/src/menubar/description.ts +337 -0
- package/src/menubar/types.ts +7 -6
- package/src/menubar/use-edit-action.ts +2 -2
- package/src/sidebar/SidebarToolbar.tsx +22 -10
- package/src/sidebar/SidebarTreeSection.tsx +15 -4
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A closed menu's DESCRIPTION, read from its declaration's elements without
|
|
3
|
+
* mounting them (OxyOS ADR 0021).
|
|
4
|
+
*
|
|
5
|
+
* A closed menu's rows are known to its bar so that their shortcuts work while
|
|
6
|
+
* it is closed. Mounting them headless did that by rendering every row, which
|
|
7
|
+
* cost every bar render a render of every closed menu's rows (OxyOS's shell has
|
|
8
|
+
* a Window menu of some 27). A menu's content is a declaration: Bloom's own
|
|
9
|
+
* parts (an item, a check item, a radio group and its items, a label, a
|
|
10
|
+
* separator, a group, a submenu), with their props. So a closed menu's entries
|
|
11
|
+
* are read from those elements here, as a Mac's bar keeps a menu's items as
|
|
12
|
+
* data and builds its rows as it opens: the label, the shortcut, the state, and
|
|
13
|
+
* what choosing it runs, the element's own handler.
|
|
14
|
+
*
|
|
15
|
+
* POSITIONS are the ones `DeclaredChildren` gives the mounted rows (arrays and
|
|
16
|
+
* fragments flattened, every child, `null` included, taking a place), so the
|
|
17
|
+
* order a description sorts by is the same open or closed.
|
|
18
|
+
*
|
|
19
|
+
* What is not one of Bloom's parts (an application's own component that
|
|
20
|
+
* renders rows) cannot be read without rendering it: it is returned as
|
|
21
|
+
* `unread`, with its place, for the caller to mount headless as before.
|
|
22
|
+
*/
|
|
23
|
+
import { type ReactNode } from 'react';
|
|
24
|
+
import { type Chord } from '../kbd/chord.js';
|
|
25
|
+
import type { PlatformEditAction, PlatformMenuAction } from '../platform-surface/types.js';
|
|
26
|
+
import type { MenuEntryKind } from './registry.js';
|
|
27
|
+
/** Which of Bloom's menubar parts a component is (`createMenubarRows` marks each). */
|
|
28
|
+
export type MenubarPart = 'item' | 'checkbox' | 'radioGroup' | 'radio' | 'label' | 'separator' | 'group' | 'sub' | 'subTrigger' | 'subContent';
|
|
29
|
+
/** Marks `component` as one of Bloom's menubar parts, so a description can read its elements. */
|
|
30
|
+
export declare function markMenubarPart<T extends object>(component: T, part: MenubarPart): T;
|
|
31
|
+
/** Marks a row's shortcut hint, which a label's text leaves out. */
|
|
32
|
+
export declare function markMenubarHint(component: unknown): void;
|
|
33
|
+
/**
|
|
34
|
+
* The text of a part's children, as the platform's bar shows it: every string
|
|
35
|
+
* and number under it, element children included, except a shortcut hint
|
|
36
|
+
* (`isHint`), which is not part of the name.
|
|
37
|
+
*/
|
|
38
|
+
export declare function textOf(children: ReactNode, isHint: (type: unknown) => boolean): string;
|
|
39
|
+
/** A radio group's selection, as its items read it. */
|
|
40
|
+
export interface RadioSelection {
|
|
41
|
+
readonly value: string | undefined;
|
|
42
|
+
readonly onValueChange: (value: string) => void;
|
|
43
|
+
}
|
|
44
|
+
/** One entry of a closed menu, read from its element. */
|
|
45
|
+
export interface DescribedEntry {
|
|
46
|
+
/** Stable while the element keeps its place: its kind and its path. */
|
|
47
|
+
readonly key: string;
|
|
48
|
+
readonly kind: MenuEntryKind;
|
|
49
|
+
/** The key of the submenu it is in; null for the menu's own content. */
|
|
50
|
+
readonly parentKey: string | null;
|
|
51
|
+
/** Its position under the content's own path. */
|
|
52
|
+
readonly path: readonly number[];
|
|
53
|
+
readonly label: string;
|
|
54
|
+
readonly enabled: boolean;
|
|
55
|
+
readonly shortcut: Chord | null;
|
|
56
|
+
readonly checked?: boolean;
|
|
57
|
+
readonly keepOpen?: boolean;
|
|
58
|
+
readonly action?: PlatformMenuAction;
|
|
59
|
+
/** An editing action: its state and what choosing it does are the focused field's while one is. */
|
|
60
|
+
readonly editAction?: PlatformEditAction;
|
|
61
|
+
/** The element's own handler, as a press on its row would run it; undefined for none. */
|
|
62
|
+
readonly run?: () => void;
|
|
63
|
+
/** Whether choosing it runs something: every item does, a label and a submenu's trigger do not. */
|
|
64
|
+
readonly runs: boolean;
|
|
65
|
+
}
|
|
66
|
+
/** What a description could not read: an element to mount headless at its place. */
|
|
67
|
+
export interface UnreadElement {
|
|
68
|
+
readonly node: ReactNode;
|
|
69
|
+
readonly parentKey: string | null;
|
|
70
|
+
readonly path: readonly number[];
|
|
71
|
+
readonly radio: RadioSelection | null;
|
|
72
|
+
/**
|
|
73
|
+
* Set for an element placed directly in a submenu (beside its trigger and
|
|
74
|
+
* content): the submenu (`parentKey`) is its owner, and this is the key of
|
|
75
|
+
* the menu or submenu the submenu is in.
|
|
76
|
+
*/
|
|
77
|
+
readonly owner: {
|
|
78
|
+
readonly parentKey: string | null;
|
|
79
|
+
} | null;
|
|
80
|
+
}
|
|
81
|
+
export interface MenuDescription {
|
|
82
|
+
readonly entries: DescribedEntry[];
|
|
83
|
+
readonly unread: UnreadElement[];
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* `children`'s description: its entries, each at `[...path, place]` under
|
|
87
|
+
* `parentKey`, and what it could not read.
|
|
88
|
+
*/
|
|
89
|
+
export declare function describeMenu(children: ReactNode): MenuDescription;
|
|
90
|
+
//# sourceMappingURL=description.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"description.d.ts","sourceRoot":"","sources":["../../../../src/menubar/description.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAA4B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGjE,OAAO,EAAE,KAAK,KAAK,EAAc,MAAM,iBAAc,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,8BAA2B,CAAC;AACxF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAY,CAAC;AAGhD,sFAAsF;AACtF,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,UAAU,GACV,YAAY,GACZ,OAAO,GACP,OAAO,GACP,WAAW,GACX,OAAO,GACP,KAAK,GACL,YAAY,GACZ,YAAY,CAAC;AAKjB,iGAAiG;AACjG,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,GAAG,CAAC,CAGpF;AAED,oEAAoE;AACpE,wBAAgB,eAAe,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAIxD;AAUD;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,GAAG,MAAM,CAWtF;AAID,uDAAuD;AACvD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACjD;AAED,yDAAyD;AACzD,MAAM,WAAW,cAAc;IAC7B,uEAAuE;IACvE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,wEAAwE;IACxE,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,iDAAiD;IACjD,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,KAAK,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,kBAAkB,CAAC;IACrC,mGAAmG;IACnG,QAAQ,CAAC,UAAU,CAAC,EAAE,kBAAkB,CAAC;IACzC,yFAAyF;IACzF,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,mGAAmG;IACnG,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB;AAED,oFAAoF;AACpF,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;CAC9D;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,CAAC;CAClC;AA0CD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,SAAS,GAAG,eAAe,CA6JjE"}
|
|
@@ -29,12 +29,13 @@ export interface MenubarProps {
|
|
|
29
29
|
/** The keyboard moved across the bar, or left it (`undefined`). */
|
|
30
30
|
onFocusValueChange?: (value: string | undefined) => void;
|
|
31
31
|
/**
|
|
32
|
-
* Whether a closed menu's
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
32
|
+
* Whether a closed menu's rows are known to the bar, so their `shortcut`s work while the menu is
|
|
33
|
+
* closed (the default, `true`). Known, not mounted: Bloom reads them from the content's elements
|
|
34
|
+
* (a closed menu's rows never render) and mounts headless only an application's own component
|
|
35
|
+
* placed in it, which it cannot read without rendering. A bar whose rows run no chords of their
|
|
36
|
+
* own (an OS shell's, whose rows only show the chord another part runs) passes `false`: a closed
|
|
37
|
+
* menu then declares nothing, and its shortcuts are the open menu's only. Ignored where the
|
|
38
|
+
* platform draws the bar (`menu-bar`), which needs every menu declared.
|
|
38
39
|
*/
|
|
39
40
|
declareClosedMenus?: boolean;
|
|
40
41
|
/** Accessible name for the bar. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/menubar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,8BAA2B,CAAC;AAExF,OAAO,KAAK,EACV,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,sBAAmB,CAAC;AAE3B,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IACpD;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mEAAmE;IACnE,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IACzD
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/menubar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,8BAA2B,CAAC;AAExF,OAAO,KAAK,EACV,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,sBAAmB,CAAC;AAE3B,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IACpD;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mEAAmE;IACnE,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IACzD;;;;;;;;OAQG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,mCAAmC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAC9B;AAED,MAAM,MAAM,mBAAmB,GAAG,mBAAmB,CAAC;AACtD,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;AAEnD;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAiB,SAAQ,YAAY,EAAE,mBAAmB;IACzE;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,MAAM,CAAC,EAAE,kBAAkB,GAAG,kBAAkB,CAAC;CAClD;AACD,MAAM,WAAW,wBAAyB,SAAQ,oBAAoB,EAAE,mBAAmB;CAAG;AAC9F,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AACzD,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB,EAAE,mBAAmB;CAAG;AACxF,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC;AAC/C,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;AACrD,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC;AAC/C,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC;AAC3C,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AACzD,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PlatformEditAction, PlatformMenuAction } from '../platform-surface/types.js';
|
|
1
|
+
import type { PlatformEditAction, PlatformEditing, PlatformMenuAction } from '../platform-surface/types.js';
|
|
2
2
|
/** Each action's standard chord, as a Mac's Edit menu has it; Delete has none. */
|
|
3
3
|
export declare const EDIT_ACTION_SHORTCUTS: Readonly<Record<PlatformEditAction, string | undefined>>;
|
|
4
4
|
/**
|
|
@@ -10,6 +10,9 @@ export declare const MENU_ACTION_SHORTCUTS: Readonly<Record<PlatformMenuAction,
|
|
|
10
10
|
export declare function isMenuAction(action: string | undefined): action is PlatformMenuAction;
|
|
11
11
|
/** The standard chord of an item's `action`, editing or the application's. */
|
|
12
12
|
export declare function actionShortcut(action: PlatformEditAction | PlatformMenuAction | undefined): string | undefined;
|
|
13
|
+
/** What a field can do with `action` now: 'none' with no field focused. */
|
|
14
|
+
export type Responder = 'none' | 'enabled' | 'disabled';
|
|
15
|
+
export declare function responderOf(editing: PlatformEditing | null, action: PlatformEditAction | undefined): Responder;
|
|
13
16
|
export interface EditActionItem {
|
|
14
17
|
/** Whether the item can be chosen now. */
|
|
15
18
|
readonly enabled: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-edit-action.d.ts","sourceRoot":"","sources":["../../../../src/menubar/use-edit-action.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EACV,kBAAkB,
|
|
1
|
+
{"version":3,"file":"use-edit-action.d.ts","sourceRoot":"","sources":["../../../../src/menubar/use-edit-action.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EACnB,MAAM,8BAA2B,CAAC;AAEnC,kFAAkF;AAClF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC,CAS1F,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC,CAG1F,CAAC;AAEF,4FAA4F;AAC5F,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,IAAI,kBAAkB,CAErF;AAED,8EAA8E;AAC9E,wBAAgB,cAAc,CAC5B,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,GAAG,SAAS,GAC1D,MAAM,GAAG,SAAS,CAGpB;AAID,2EAA2E;AAC3E,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC;AAExD,wBAAgB,WAAW,CACzB,OAAO,EAAE,eAAe,GAAG,IAAI,EAC/B,MAAM,EAAE,kBAAkB,GAAG,SAAS,GACrC,SAAS,CAKX;AAED,MAAM,WAAW,cAAc;IAC7B,0CAA0C;IAC1C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,2FAA2F;IAC3F,QAAQ,CAAC,GAAG,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,kBAAkB,GAAG,SAAS,EACtC,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,GAChC,cAAc,CAqBhB"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SidebarToolbarProps } from './types.js';
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* The search's slot and one per action share the row in equal parts, however many actions there
|
|
5
|
+
* are; the closed search covers the first slot and opens across all of them. The sidebar owns its
|
|
6
|
+
* viewport.
|
|
7
|
+
*/
|
|
4
8
|
export declare function SidebarToolbar({ actions, search, style, testID }: SidebarToolbarProps): React.JSX.Element;
|
|
5
9
|
//# sourceMappingURL=SidebarToolbar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidebarToolbar.d.ts","sourceRoot":"","sources":["../../../../src/sidebar/SidebarToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAgB9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"SidebarToolbar.d.ts","sourceRoot":"","sources":["../../../../src/sidebar/SidebarToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAgB9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAS,CAAC;AAWnD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,OAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,mBAAmB,qBA+K1F"}
|
|
@@ -3,11 +3,17 @@ import type { SidebarPalette } from './palette.js';
|
|
|
3
3
|
import type { SidebarTree, SidebarTreeFolder, SidebarTreeItem } from './types.js';
|
|
4
4
|
/** One level of nesting: a row's content starts this much further in than its parent's. */
|
|
5
5
|
export declare const TREE_INDENT = 16;
|
|
6
|
+
/**
|
|
7
|
+
* Where a top-level row's content starts (its disclosure, glyph, avatar or label), and so where
|
|
8
|
+
* the section's label and status start: one edge from the title down.
|
|
9
|
+
*/
|
|
10
|
+
export declare const TREE_INSET = 8;
|
|
6
11
|
type TreePress = (item: SidebarTreeItem, folder?: SidebarTreeFolder) => void;
|
|
7
12
|
/**
|
|
8
13
|
* One labelled section of the sidebar's tree.
|
|
9
14
|
*
|
|
10
|
-
* label `tree.label` text-secondary,
|
|
15
|
+
* label `tree.label` text-secondary, inset 8 like the rows' content (its
|
|
16
|
+
* `actions` at the end, inset 4 like theirs). A
|
|
11
17
|
* `collapsible` section's label is a disclosure (16px chevron,
|
|
12
18
|
* turning 90° open) that shows and hides the rows (300ms).
|
|
13
19
|
* status `loading` / `error` (an alert, in the danger role) / `emptyLabel`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidebarTreeSection.d.ts","sourceRoot":"","sources":["../../../../src/sidebar/SidebarTreeSection.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkE,MAAM,OAAO,CAAC;AAgCvF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAW,CAAC;AAWhD,OAAO,KAAK,EAAE,WAAW,EAAmB,iBAAiB,EAAE,eAAe,EAAE,MAAM,YAAS,CAAC;AAKhG,2FAA2F;AAC3F,eAAO,MAAM,WAAW,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"SidebarTreeSection.d.ts","sourceRoot":"","sources":["../../../../src/sidebar/SidebarTreeSection.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkE,MAAM,OAAO,CAAC;AAgCvF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAW,CAAC;AAWhD,OAAO,KAAK,EAAE,WAAW,EAAmB,iBAAiB,EAAE,eAAe,EAAE,MAAM,YAAS,CAAC;AAKhG,2FAA2F;AAC3F,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B;;;GAGG;AACH,eAAO,MAAM,UAAU,IAAI,CAAC;AAO5B,KAAK,SAAS,GAAG,CAAC,IAAI,EAAE,eAAe,EAAE,MAAM,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,kBAAkB,yHAS5B;IACD,OAAO,EAAE,WAAW,CAAC;IACrB,mCAAmC;IACnC,KAAK,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IACtC,OAAO,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;IAC1C,2DAA2D;IAC3D,SAAS,EAAE,OAAO,CAAC;IACnB,4EAA4E;IAC5E,KAAK,EAAE,OAAO,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,OAAO,EAAE,cAAc,CAAC;CACzB,uBAgFC,CAAC"}
|
package/package.json
CHANGED
|
@@ -148,7 +148,7 @@ export function createConversationSidebar({
|
|
|
148
148
|
showThemeToggle={false}
|
|
149
149
|
{...sidebar}
|
|
150
150
|
// Under the panel's own header (logo, account, collapse control), which stays; a rail has
|
|
151
|
-
// no room for the
|
|
151
|
+
// no room for the tools (search, then the store and "+" buttons the app passes).
|
|
152
152
|
toolbar={({ collapsed }) =>
|
|
153
153
|
collapsed ? null : (
|
|
154
154
|
<SidebarToolbar
|
|
@@ -168,9 +168,10 @@ export function createConversationSidebar({
|
|
|
168
168
|
content={
|
|
169
169
|
<StyledView className="flex flex-col gap-2" accessibilityLabel={l.list}>
|
|
170
170
|
{heading && conversations.length ? (
|
|
171
|
+
// Inset 6, as the rows' padding: the heading starts where their avatars do.
|
|
171
172
|
<Text
|
|
172
173
|
role="heading"
|
|
173
|
-
className="px-
|
|
174
|
+
className="px-1.5 pt-1 text-body-2-medium text-text-secondary"
|
|
174
175
|
numberOfLines={1}
|
|
175
176
|
>
|
|
176
177
|
{heading}
|
|
@@ -3,7 +3,7 @@ import * as Dropdown from '../dropdown-menu/index';
|
|
|
3
3
|
import { createConversationSidebar } from './create-conversation-sidebar';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* A sidebar of conversations:
|
|
6
|
+
* A sidebar of conversations: its tools on top (search, and the store and "+" buttons when given), a list
|
|
7
7
|
* of conversations with their agents' avatars and a context menu each, and the panel's own footer.
|
|
8
8
|
*/
|
|
9
9
|
export const ConversationSidebar = createConversationSidebar({ Dropdown, ContextMenu });
|
|
@@ -8,7 +8,7 @@ import * as Dropdown from '../dropdown-menu/index.web';
|
|
|
8
8
|
import { createConversationSidebar } from './create-conversation-sidebar';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* A sidebar of conversations:
|
|
11
|
+
* A sidebar of conversations: its tools on top (search, and the store and "+" buttons when given), a list
|
|
12
12
|
* of conversations with their agents' avatars and a context menu each, and the panel's own footer.
|
|
13
13
|
*/
|
|
14
14
|
export const ConversationSidebar = createConversationSidebar({ Dropdown, ContextMenu });
|
package/src/menubar/declared.tsx
CHANGED
|
@@ -9,17 +9,21 @@
|
|
|
9
9
|
* handlers stay the application's closures, and choosing an item anywhere runs
|
|
10
10
|
* exactly what a press on its row runs.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
12
|
+
* With the `menu-bar` capability (the platform draws the bar) the whole bar
|
|
13
|
+
* is mounted HEADLESS: known but not drawn. A headless part registers and
|
|
14
|
+
* renders nothing; its containers (a menu's content, a group, a radio group, a
|
|
15
|
+
* submenu) render only their children, each in a slot that records its
|
|
16
|
+
* position for the description's order.
|
|
17
|
+
*
|
|
18
|
+
* Without it, a CLOSED menu's or submenu's content is not mounted at all: its
|
|
19
|
+
* entries are read from its elements (`description.ts`, `StaticDeclaration`)
|
|
20
|
+
* so that its shortcuts work while it is closed, and its rows mount as it
|
|
21
|
+
* opens, register, and draw. Only an element that is not one of Bloom's parts
|
|
22
|
+
* (an application's own component rendering rows) is mounted headless there,
|
|
23
|
+
* since it cannot be read without rendering it.
|
|
19
24
|
*
|
|
20
25
|
* A menu's content is its rows. Anything else placed inside one (a bare
|
|
21
|
-
* `View` or `Text`) is
|
|
22
|
-
* the declaration is mounted headless; it is not part of the description.
|
|
26
|
+
* `View` or `Text`) is not part of the description.
|
|
23
27
|
*/
|
|
24
28
|
import {
|
|
25
29
|
type ComponentType,
|
|
@@ -28,9 +32,11 @@ import {
|
|
|
28
32
|
type ReactNode,
|
|
29
33
|
createContext,
|
|
30
34
|
useContext,
|
|
35
|
+
useCallback,
|
|
31
36
|
useMemo,
|
|
32
37
|
useRef,
|
|
33
38
|
useState,
|
|
39
|
+
useSyncExternalStore,
|
|
34
40
|
} from 'react';
|
|
35
41
|
import { openHref } from '../hooks/link-activation';
|
|
36
42
|
|
|
@@ -38,6 +44,7 @@ import { MenuRadioGroupProvider, useMenuRadioGroup } from '../floating/context';
|
|
|
38
44
|
import { useControllableState } from '../hooks/use-controllable-state';
|
|
39
45
|
import type { MenuRowParts } from '../floating/types';
|
|
40
46
|
import { type Chord, formatChord, parseChord } from '../kbd/chord';
|
|
47
|
+
import { usePlatformEditing } from '../platform-surface/context';
|
|
41
48
|
import { useIsomorphicLayoutEffect } from '../theme/use-isomorphic-layout-effect';
|
|
42
49
|
import {
|
|
43
50
|
type MenubarScope,
|
|
@@ -45,8 +52,15 @@ import {
|
|
|
45
52
|
useMenubarMenu,
|
|
46
53
|
useMenubarScope,
|
|
47
54
|
} from './context';
|
|
55
|
+
import {
|
|
56
|
+
type DescribedEntry,
|
|
57
|
+
describeMenu,
|
|
58
|
+
markMenubarHint,
|
|
59
|
+
markMenubarPart,
|
|
60
|
+
textOf,
|
|
61
|
+
} from './description';
|
|
48
62
|
import { type MenuEntry, nextMenuEntryId } from './registry';
|
|
49
|
-
import { actionShortcut, isMenuAction, useEditAction } from './use-edit-action';
|
|
63
|
+
import { actionShortcut, isMenuAction, responderOf, useEditAction } from './use-edit-action';
|
|
50
64
|
import { useMenubarLeaving } from './viewport';
|
|
51
65
|
import type {
|
|
52
66
|
MenubarCheckboxItemProps,
|
|
@@ -99,23 +113,7 @@ export function useMenuEntry(
|
|
|
99
113
|
return id;
|
|
100
114
|
}
|
|
101
115
|
|
|
102
|
-
|
|
103
|
-
* The text of a part's children, as the platform's bar shows it: every string
|
|
104
|
-
* and number under it, element children included, except a shortcut hint
|
|
105
|
-
* (`isHint`), which is not part of the name.
|
|
106
|
-
*/
|
|
107
|
-
export function textOf(children: ReactNode, isHint: (type: unknown) => boolean): string {
|
|
108
|
-
const parts: string[] = [];
|
|
109
|
-
const visit = (node: ReactNode) => {
|
|
110
|
-
if (typeof node === 'string' || typeof node === 'number') parts.push(String(node));
|
|
111
|
-
else if (Array.isArray(node)) node.forEach(visit);
|
|
112
|
-
else if (isValidElement<{ children?: ReactNode }>(node) && !isHint(node.type)) {
|
|
113
|
-
visit(node.props.children);
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
visit(children);
|
|
117
|
-
return parts.join('').replace(/\s+/g, ' ').trim();
|
|
118
|
-
}
|
|
116
|
+
export { textOf };
|
|
119
117
|
|
|
120
118
|
/** Whether the drawn submenu around a `MenubarSubContent` is open. */
|
|
121
119
|
const SubOpenContext = createContext(false);
|
|
@@ -189,22 +187,139 @@ export function DeclaredChildren({ children }: { children?: ReactNode }) {
|
|
|
189
187
|
return <>{slots}</>;
|
|
190
188
|
}
|
|
191
189
|
|
|
192
|
-
|
|
193
|
-
|
|
190
|
+
const subscribeNowhere = () => () => undefined;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* A closed menu's or submenu's content, KNOWN to its bar without being
|
|
194
|
+
* mounted: its entries read from its elements (`describeMenu`) and registered
|
|
195
|
+
* here, each at the place its row would take; what is not one of Bloom's parts
|
|
196
|
+
* is mounted headless at its place, as before.
|
|
197
|
+
*
|
|
198
|
+
* An entry's `run` is stable while it keeps its place and calls the current
|
|
199
|
+
* element's handler, so a re-render of the application's bar is no change to
|
|
200
|
+
* the registry unless what the menu says changed. An item with an editing
|
|
201
|
+
* action follows the focused field, as its row would (`use-edit-action.ts`).
|
|
202
|
+
*/
|
|
203
|
+
export function StaticDeclaration({ children }: { children?: ReactNode }) {
|
|
194
204
|
const scope = useMenubarScope();
|
|
195
|
-
const
|
|
196
|
-
|
|
205
|
+
const description = useMemo(() => describeMenu(children), [children]);
|
|
206
|
+
const editing = usePlatformEditing();
|
|
207
|
+
const edits = description.entries.some((entry) => entry.editAction !== undefined);
|
|
208
|
+
// What a focused field can do with each editing action, as one value: a change re-renders.
|
|
209
|
+
const listen = useCallback(
|
|
210
|
+
(listener: () => void) => (edits && editing ? editing.subscribe(listener) : subscribeNowhere()),
|
|
211
|
+
[edits, editing],
|
|
212
|
+
);
|
|
213
|
+
useSyncExternalStore(
|
|
214
|
+
listen,
|
|
215
|
+
() =>
|
|
216
|
+
edits
|
|
217
|
+
? description.entries.map((entry) => responderOf(editing, entry.editAction)).join()
|
|
218
|
+
: '',
|
|
219
|
+
() => '',
|
|
220
|
+
);
|
|
221
|
+
|
|
222
|
+
const registry = scope?.registry;
|
|
223
|
+
const parent = scope?.parent ?? null;
|
|
224
|
+
const idOf = useCallback((key: string) => `${parent ?? 'bar'}/${key}`, [parent]);
|
|
225
|
+
const latest = useRef(new Map<string, DescribedEntry>());
|
|
226
|
+
const latestEditing = useRef(editing);
|
|
227
|
+
const runs = useRef(new Map<string, () => void>());
|
|
228
|
+
const registered = useRef(new Set<string>());
|
|
229
|
+
const runFor = (key: string) => {
|
|
230
|
+
let run = runs.current.get(key);
|
|
231
|
+
if (!run) {
|
|
232
|
+
run = () => {
|
|
233
|
+
const entry = latest.current.get(key);
|
|
234
|
+
if (!entry) return;
|
|
235
|
+
const field = latestEditing.current;
|
|
236
|
+
if (entry.editAction && field && responderOf(field, entry.editAction) !== 'none') {
|
|
237
|
+
field.perform(entry.editAction);
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
entry.run?.();
|
|
241
|
+
};
|
|
242
|
+
runs.current.set(key, run);
|
|
243
|
+
}
|
|
244
|
+
return run;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
useIsomorphicLayoutEffect(() => {
|
|
248
|
+
if (!registry || !scope) return;
|
|
249
|
+
latest.current = new Map(description.entries.map((entry) => [entry.key, entry]));
|
|
250
|
+
latestEditing.current = editing;
|
|
251
|
+
const now = new Set<string>();
|
|
252
|
+
for (const entry of description.entries) {
|
|
253
|
+
const id = idOf(entry.key);
|
|
254
|
+
now.add(id);
|
|
255
|
+
const responder = responderOf(editing, entry.editAction);
|
|
256
|
+
registry.set({
|
|
257
|
+
id,
|
|
258
|
+
kind: entry.kind,
|
|
259
|
+
parent: entry.parentKey === null ? parent : idOf(entry.parentKey),
|
|
260
|
+
path: [...scope.path, ...entry.path],
|
|
261
|
+
label: entry.label,
|
|
262
|
+
enabled: responder === 'none' ? entry.enabled : responder === 'enabled',
|
|
263
|
+
shortcut: entry.shortcut,
|
|
264
|
+
...(entry.checked === undefined ? null : { checked: entry.checked }),
|
|
265
|
+
...(entry.keepOpen === undefined ? null : { keepOpen: entry.keepOpen }),
|
|
266
|
+
...(entry.action ? { action: entry.action } : null),
|
|
267
|
+
run: entry.runs ? runFor(entry.key) : undefined,
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
for (const id of registered.current) if (!now.has(id)) registry.delete(id);
|
|
271
|
+
registered.current = now;
|
|
272
|
+
for (const key of runs.current.keys()) if (!latest.current.has(key)) runs.current.delete(key);
|
|
273
|
+
});
|
|
274
|
+
useIsomorphicLayoutEffect(() => {
|
|
275
|
+
if (!registry) return undefined;
|
|
276
|
+
return () => {
|
|
277
|
+
for (const id of registered.current) registry.delete(id);
|
|
278
|
+
registered.current = new Set();
|
|
279
|
+
};
|
|
280
|
+
}, [registry, idOf]);
|
|
281
|
+
|
|
282
|
+
if (!scope) return null;
|
|
197
283
|
return (
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
284
|
+
<>
|
|
285
|
+
{description.unread.map((element) => {
|
|
286
|
+
const subKey = element.parentKey;
|
|
287
|
+
const path = [...scope.path, ...element.path];
|
|
288
|
+
const { owner } = element;
|
|
289
|
+
const value: MenubarScope = {
|
|
290
|
+
...scope,
|
|
291
|
+
headless: true,
|
|
292
|
+
parent: subKey === null ? parent : idOf(subKey),
|
|
293
|
+
path,
|
|
294
|
+
owner:
|
|
295
|
+
owner && subKey !== null
|
|
296
|
+
? {
|
|
297
|
+
kind: 'submenu',
|
|
298
|
+
id: idOf(subKey),
|
|
299
|
+
parent: owner.parentKey === null ? parent : idOf(owner.parentKey),
|
|
300
|
+
path,
|
|
301
|
+
}
|
|
302
|
+
: undefined,
|
|
303
|
+
};
|
|
304
|
+
const node = element.radio ? (
|
|
305
|
+
<MenuRadioGroupProvider value={element.radio}>{element.node}</MenuRadioGroupProvider>
|
|
306
|
+
) : (
|
|
307
|
+
element.node
|
|
308
|
+
);
|
|
309
|
+
return (
|
|
310
|
+
<MenubarScopeProvider key={`${subKey ?? ''}@${element.path.join('.')}`} value={value}>
|
|
311
|
+
{node}
|
|
312
|
+
</MenubarScopeProvider>
|
|
313
|
+
);
|
|
314
|
+
})}
|
|
315
|
+
</>
|
|
201
316
|
);
|
|
202
317
|
}
|
|
203
318
|
|
|
204
319
|
/**
|
|
205
320
|
* A fork's `MenubarContent`: its panel (`Panel`, the sheet or the anchored
|
|
206
|
-
* panel) as before, with the content
|
|
207
|
-
* closed; only the headless content with the capability.
|
|
321
|
+
* panel) as before, with the content known to the bar while the menu is
|
|
322
|
+
* closed (`StaticDeclaration`); only the headless content with the capability.
|
|
208
323
|
*/
|
|
209
324
|
export function createMenubarContent(
|
|
210
325
|
Panel: ComponentType<MenubarContentProps>,
|
|
@@ -216,7 +331,7 @@ export function createMenubarContent(
|
|
|
216
331
|
return (
|
|
217
332
|
<>
|
|
218
333
|
{menu.open || scope?.declareClosed === false ? null : (
|
|
219
|
-
<
|
|
334
|
+
<StaticDeclaration>{props.children}</StaticDeclaration>
|
|
220
335
|
)}
|
|
221
336
|
<Panel {...props} />
|
|
222
337
|
</>
|
|
@@ -431,17 +546,29 @@ export function createMenubarRows(rows: MenuRowParts): MenubarRowParts {
|
|
|
431
546
|
}
|
|
432
547
|
MenubarSubContent.displayName = 'MenubarSubContent';
|
|
433
548
|
|
|
434
|
-
/** Drawn: the fork's sub content, with its content
|
|
549
|
+
/** Drawn: the fork's sub content, with its content known to the bar while it is closed. */
|
|
435
550
|
function DrawnSubContent(props: MenubarSubContentProps) {
|
|
436
551
|
const open = useContext(SubOpenContext);
|
|
437
552
|
return (
|
|
438
553
|
<>
|
|
439
|
-
{open ? null : <
|
|
554
|
+
{open ? null : <StaticDeclaration>{props.children}</StaticDeclaration>}
|
|
440
555
|
<rows.SubContent {...props} />
|
|
441
556
|
</>
|
|
442
557
|
);
|
|
443
558
|
}
|
|
444
559
|
|
|
560
|
+
markMenubarHint(Shortcut);
|
|
561
|
+
markMenubarPart(MenubarItem, 'item');
|
|
562
|
+
markMenubarPart(MenubarCheckboxItem, 'checkbox');
|
|
563
|
+
markMenubarPart(MenubarRadioGroup, 'radioGroup');
|
|
564
|
+
markMenubarPart(MenubarRadioItem, 'radio');
|
|
565
|
+
markMenubarPart(MenubarLabel, 'label');
|
|
566
|
+
markMenubarPart(MenubarSeparator, 'separator');
|
|
567
|
+
markMenubarPart(MenubarGroup, 'group');
|
|
568
|
+
markMenubarPart(MenubarSub, 'sub');
|
|
569
|
+
markMenubarPart(MenubarSubTrigger, 'subTrigger');
|
|
570
|
+
markMenubarPart(MenubarSubContent, 'subContent');
|
|
571
|
+
|
|
445
572
|
return {
|
|
446
573
|
Item: MenubarItem,
|
|
447
574
|
CheckboxItem: MenubarCheckboxItem,
|