@bridgebrew/shell 0.0.6 → 0.0.8

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.
@@ -1326,7 +1326,7 @@ function Frame({
1326
1326
  app: boolean;
1327
1327
  errors: ErrorsSignal;
1328
1328
  renderSlot: (
1329
- key: 'rail' | 'sidebar' | 'main' | 'overlay' | 'controls' | 'more',
1329
+ key: 'rail' | 'sidebar' | 'main' | 'overlay' | 'controls' | 'more-header',
1330
1330
  props: object,
1331
1331
  options?: { only?: string },
1332
1332
  ) => React.ReactNode;
@@ -2076,7 +2076,7 @@ export function apply(ctx: Context) {
2076
2076
  sidebar: { ...slot, ...open },
2077
2077
  main: slot,
2078
2078
  overlay: { kind: 'list', scope: 'root' },
2079
- more: { kind: 'list', scope: 'root' },
2079
+ 'more-header': { kind: 'list', scope: 'root' },
2080
2080
  controls: { kind: 'list', scope: 'root', ...open },
2081
2081
  },
2082
2082
  },
@@ -1038,8 +1038,8 @@ export function MobileFrame({
1038
1038
  renderSlot,
1039
1039
  }: {
1040
1040
  shell: Shell;
1041
- /** The frame's slots: `main`, the drawer's `more` rows, and `overlay` (its entries opted in on a phone only). */
1042
- renderSlot: (key: 'main' | 'more' | 'overlay', props: object, options?: { only?: string }) => React.ReactNode;
1041
+ /** The frame's slots: `main`, the drawer's `more-header` buttons, and `overlay` (its entries opted in on a phone only). */
1042
+ renderSlot: (key: 'main' | 'more-header' | 'overlay', props: object, options?: { only?: string }) => React.ReactNode;
1043
1043
  }) {
1044
1044
  const open = React.useSyncExternalStore(drawer.subscribe, drawer.get);
1045
1045
  const overlays = React.useSyncExternalStore(phoneOverlays.subscribe, phoneOverlays.get);
@@ -1157,6 +1157,10 @@ function PageRow({ icon, title, onSelect }: { icon: string; title: string; onSel
1157
1157
  /** A page of the `pages` menu: a node's (its views, then its child nodes), or a row's (it, then the rows under it). */
1158
1158
  type Page = { node: string } | { entry: Entry };
1159
1159
 
1160
+ /** A button of More's header (`more-header`): its look without its ink, the icon's size, and the drawer's close. */
1161
+ type MoreHeader = { className: string; iconSize: number; close: (then?: () => void) => void };
1162
+ const headerButton = 'mobile-press relative flex size-11 shrink-0 items-center justify-center rounded-full active:bg-hover';
1163
+
1160
1164
  /** The drawer's content: with `pages`, a page (a node's views, then its child nodes; a view's rows under it), each
1161
1165
  * row with rows under it opening its own page in the drawer, Back going up one; with `tree`, the node's views as a
1162
1166
  * tree and a row opening the tree's page. The workspaces. It opens on the node shown. */
@@ -1167,7 +1171,7 @@ function Menu({
1167
1171
  }: {
1168
1172
  shell: Shell;
1169
1173
  style: MenuStyle;
1170
- renderSlot: (key: 'more', props: { style: MenuStyle; close: (then?: () => void) => void }) => React.ReactNode;
1174
+ renderSlot: (key: 'more-header', props: MoreHeader) => React.ReactNode;
1171
1175
  }) {
1172
1176
  const state = React.useSyncExternalStore(shell.subscribe, shell.get);
1173
1177
  useSidebarItems();
@@ -1208,8 +1212,7 @@ function Menu({
1208
1212
  };
1209
1213
  const back = style === 'pages' && above !== undefined;
1210
1214
  const kids = 'node' in page ? childrenOf(nodes, page.node, shown) : [];
1211
- const iconButton =
1212
- 'mobile-press flex size-11 shrink-0 items-center justify-center rounded-full text-secondary active:bg-hover';
1215
+ const iconButton = `${headerButton} text-secondary`;
1213
1216
  return (
1214
1217
  <div
1215
1218
  data-mobile=""
@@ -1240,6 +1243,13 @@ function Menu({
1240
1243
  ) : (
1241
1244
  <DialogTitle className="min-w-0 flex-1 truncate text-[22px]">{titleOf(page)}</DialogTitle>
1242
1245
  )}
1246
+ {/* Buttons plugins add (`more-header`, research-128 §7), before More's own: drawn as them (`className`, the
1247
+ icon's size, ink left to the plugin), and `close`, which closes the drawer and runs `then` after. */}
1248
+ {renderSlot('more-header', {
1249
+ className: headerButton,
1250
+ iconSize: 22,
1251
+ close: (then?: () => void) => drawer.close(then),
1252
+ })}
1243
1253
  <button
1244
1254
  type="button"
1245
1255
  aria-label="Phone settings"
@@ -1306,9 +1316,6 @@ function Menu({
1306
1316
  push={(next) => push({ entry: next })}
1307
1317
  />
1308
1318
  )}
1309
- {/* Rows plugins add (`more`, research-128 §7), after More's own: the menu's style, so a row is drawn as its
1310
- neighbours, and `close`, which closes the drawer and runs `then` after (as a row of the menu does). */}
1311
- {!back && renderSlot('more', { style, close: (then?: () => void) => drawer.close(then) })}
1312
1319
  {style === 'pages' && kids.length > 0 && (
1313
1320
  <nav aria-label="Nodes" className="flex flex-col px-2 pb-2">
1314
1321
  <h2 className="m-0 px-2 pt-3 pb-1 text-xs font-medium tracking-wide text-secondary uppercase">
@@ -896,13 +896,14 @@ declare module '@bridge/ui-slots' {
896
896
  /** Over the whole frame, after it: `_host` plugins add floating layers (each its own `id`), fixed-positioned. On a
897
897
  * phone, only the entries that opted in (`shell.overlayOnPhone(id)`) are drawn, outside the frame. */
898
898
  overlay: { kind: 'list'; scope: 'root' };
899
- /** Declared by `shell` (research-128 §7): rows a plugin adds to the phone's More, after its own, each its own `id`.
900
- * `style`: the menu's (`tree`: a SidebarTreeItem row, as its views; `pages`: a 48px row with a 20px icon), so a row
901
- * is drawn as its neighbours; `close(then)`: closes the drawer, then runs `then` (open a page from it). */
902
- more: {
899
+ /** Declared by `shell` (research-128 §7): buttons a plugin adds to the header of the phone's More, before its own,
900
+ * each its own `id`. `className`: the look of More's header buttons without their ink (44px round, pressed state),
901
+ * `iconSize` its icons' (22px), so a button is drawn as its neighbours; `close(then)`: closes the drawer, then runs
902
+ * `then` (open a window from it). */
903
+ 'more-header': {
903
904
  kind: 'list';
904
905
  scope: 'root';
905
- owner: { style: 'tree' | 'pages'; close: (then?: () => void) => void };
906
+ owner: { className: string; iconSize: number; close: (then?: () => void) => void };
906
907
  };
907
908
  /** Declared by `shell`: with its theme controls, wherever they stand (under the sidebar, under the rail while it is
908
909
  * hidden, in the narrow column of the desktop app's pages), first; each entry its own `id`, a 28px button (the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bridgebrew/shell",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "license": "MIT",
5
5
  "description": "The page around everything: the rail, the sidebar column, the stage beside it and the theme controls.",
6
6
  "keywords": [
@@ -103,6 +103,6 @@
103
103
  "typecheck": "bridge plugin check ."
104
104
  },
105
105
  "engines": {
106
- "bridge": ">=0.0.1-nightly.20261124.1"
106
+ "bridge": ">=0.0.1-nightly.20261125.1"
107
107
  }
108
108
  }