@tooee/layout 0.7.3 → 0.9.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 (40) hide show
  1. package/README.md +3 -0
  2. package/dist/app-layout.d.ts +9 -7
  3. package/dist/app-layout.d.ts.map +1 -1
  4. package/dist/app-layout.js +2 -2
  5. package/dist/app-layout.js.map +1 -1
  6. package/dist/app-layout.public-contract.typecheck.d.ts +17 -0
  7. package/dist/app-layout.public-contract.typecheck.d.ts.map +1 -0
  8. package/dist/app-layout.public-contract.typecheck.js +2 -0
  9. package/dist/app-layout.public-contract.typecheck.js.map +1 -0
  10. package/dist/close-button.d.ts +18 -0
  11. package/dist/close-button.d.ts.map +1 -0
  12. package/dist/close-button.js +23 -0
  13. package/dist/close-button.js.map +1 -0
  14. package/dist/index.d.ts +6 -1
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +3 -0
  17. package/dist/index.js.map +1 -1
  18. package/dist/overlay-panel.d.ts +31 -0
  19. package/dist/overlay-panel.d.ts.map +1 -0
  20. package/dist/overlay-panel.js +30 -0
  21. package/dist/overlay-panel.js.map +1 -0
  22. package/dist/react-content.d.ts +17 -0
  23. package/dist/react-content.d.ts.map +1 -0
  24. package/dist/react-content.js +12 -0
  25. package/dist/react-content.js.map +1 -0
  26. package/dist/status-bar.d.ts +2 -1
  27. package/dist/status-bar.d.ts.map +1 -1
  28. package/dist/status-bar.js.map +1 -1
  29. package/dist/title-bar.d.ts +2 -1
  30. package/dist/title-bar.d.ts.map +1 -1
  31. package/dist/title-bar.js.map +1 -1
  32. package/package.json +7 -6
  33. package/src/app-layout.public-contract.typecheck.ts +20 -0
  34. package/src/app-layout.tsx +15 -13
  35. package/src/close-button.tsx +46 -0
  36. package/src/index.ts +6 -1
  37. package/src/overlay-panel.tsx +141 -0
  38. package/src/react-content.ts +31 -0
  39. package/src/status-bar.tsx +3 -2
  40. package/src/title-bar.tsx +2 -1
package/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  Standard app chrome (title bar, status bar) for Tooee.
4
4
 
5
+ Layout is a composition package by design. It combines theme, command,
6
+ overlay, search, and toast primitives into standard application chrome.
7
+
5
8
  Part of the [Tooee](https://github.com/gingerhendrix/tooee) monorepo. See the main repo for documentation.
6
9
 
7
10
  ## Overlays
@@ -2,6 +2,12 @@ import type { ReactNode, RefObject } from "react";
2
2
  import type { ScrollBoxRenderable } from "@opentui/core";
3
3
  import type { StatusBarItem } from "./status-bar.js";
4
4
  import type { SearchState } from "@tooee/search";
5
+ export interface AppLayoutScroll {
6
+ ref: RefObject<ScrollBoxRenderable | null>;
7
+ stickyScroll?: boolean;
8
+ stickyStart?: "bottom" | "top";
9
+ focused?: boolean;
10
+ }
5
11
  export interface AppLayoutProps {
6
12
  titleBar?: {
7
13
  title: string;
@@ -10,14 +16,10 @@ export interface AppLayoutProps {
10
16
  statusBar: {
11
17
  items: StatusBarItem[];
12
18
  };
13
- scrollRef?: RefObject<ScrollBoxRenderable | null>;
14
- scrollProps?: {
15
- stickyScroll?: boolean;
16
- stickyStart?: "bottom" | "top";
17
- focused?: boolean;
18
- };
19
+ /** Configure the optional scrollbox used for the main content. */
20
+ scroll?: AppLayoutScroll;
19
21
  searchBar?: SearchState;
20
22
  children: ReactNode;
21
23
  }
22
- export declare const AppLayout: ({ titleBar, statusBar, scrollRef, scrollProps, searchBar, children, }: AppLayoutProps) => ReactNode;
24
+ export declare const AppLayout: ({ titleBar, statusBar, scroll, searchBar, children, }: AppLayoutProps) => ReactNode;
23
25
  //# sourceMappingURL=app-layout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"app-layout.d.ts","sourceRoot":"","sources":["../src/app-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGzD,OAAO,KAAK,EAAE,aAAa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E,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChD,SAAS,EAAE;QAAE,KAAK,EAAE,aAAa,EAAE,CAAA;KAAE,CAAC;IACtC,kEAAkE;IAClE,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAaD,eAAO,MAAM,SAAS,0DAMnB,cAAc,KAAG,SAiDnB,CAAC"}
@@ -13,7 +13,7 @@ const hasRenderableOverlay = function hasRenderableOverlay(overlay) {
13
13
  overlay !== 0 &&
14
14
  overlay !== 0n);
15
15
  };
16
- export const AppLayout = function AppLayout({ titleBar, statusBar, scrollRef, scrollProps, searchBar, children, }) {
16
+ export const AppLayout = function AppLayout({ titleBar, statusBar, scroll, searchBar, children, }) {
17
17
  const { theme } = useTheme();
18
18
  const contextOverlay = useCurrentOverlay();
19
19
  const handleSearchQueryChange = (query) => {
@@ -22,7 +22,7 @@ export const AppLayout = function AppLayout({ titleBar, statusBar, scrollRef, sc
22
22
  const handleSearchSubmit = () => {
23
23
  searchBar?.submitSearch();
24
24
  };
25
- return (_jsxs("box", { flexDirection: "column", width: "100%", height: "100%", backgroundColor: theme.background, children: [titleBar && _jsx(TitleBar, { title: titleBar.title, subtitle: titleBar.subtitle }), _jsxs("box", { style: { flexGrow: 1, position: "relative" }, children: [scrollRef ? (_jsx("scrollbox", { ref: scrollRef, style: { flexGrow: 1 }, stickyScroll: scrollProps?.stickyScroll, stickyStart: scrollProps?.stickyStart, focused: scrollProps?.focused ?? true, children: children })) : (_jsx("box", { style: { flexGrow: 1, overflow: "hidden" }, children: children })), hasRenderableOverlay(contextOverlay) && (_jsx("box", { position: "absolute", left: 0, top: 0, width: "100%", height: "100%", children: contextOverlay })), _jsx(ToastContainer, {})] }), searchBar?.searchActive === true ? (_jsx(SearchBar, { query: searchBar.searchQuery, onQueryChange: handleSearchQueryChange, onSubmit: handleSearchSubmit, onCancel: () => {
25
+ return (_jsxs("box", { flexDirection: "column", width: "100%", height: "100%", backgroundColor: theme.background, children: [titleBar && _jsx(TitleBar, { title: titleBar.title, subtitle: titleBar.subtitle }), _jsxs("box", { style: { flexGrow: 1, position: "relative" }, children: [scroll ? (_jsx("scrollbox", { ref: scroll.ref, style: { flexGrow: 1 }, stickyScroll: scroll.stickyScroll, stickyStart: scroll.stickyStart, focused: scroll.focused ?? true, children: children })) : (_jsx("box", { style: { flexGrow: 1, overflow: "hidden" }, children: children })), hasRenderableOverlay(contextOverlay) && (_jsx("box", { position: "absolute", left: 0, top: 0, width: "100%", height: "100%", children: contextOverlay })), _jsx(ToastContainer, {})] }), searchBar?.searchActive === true ? (_jsx(SearchBar, { query: searchBar.searchQuery, onQueryChange: handleSearchQueryChange, onSubmit: handleSearchSubmit, onCancel: () => {
26
26
  searchBar.setSearchQuery("");
27
27
  }, matchCount: searchBar.matchingLines.length, currentMatch: searchBar.currentMatchIndex })) : (_jsx(StatusBar, { items: statusBar.items }))] }));
28
28
  };
@@ -1 +1 @@
1
- {"version":3,"file":"app-layout.js","sourceRoot":"","sources":["../src/app-layout.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAe/C,MAAM,oBAAoB,GAAG,SAAS,oBAAoB,CAAC,OAAkB;IAC3E,OAAO,CACL,OAAO,KAAK,IAAI;QAChB,OAAO,KAAK,SAAS;QACrB,OAAO,KAAK,KAAK;QACjB,OAAO,KAAK,EAAE;QACd,OAAO,KAAK,CAAC;QACb,OAAO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C,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,YACjE,cAAc,GACX,CACP,EACD,KAAC,cAAc,KAAG,IACd,EACL,SAAS,EAAE,YAAY,KAAK,IAAI,CAAC,CAAC,CAAC,CAClC,KAAC,SAAS,IACR,KAAK,EAAE,SAAS,CAAC,WAAW,EAC5B,aAAa,EAAE,uBAAuB,EACtC,QAAQ,EAAE,kBAAkB,EAC5B,QAAQ,EAAE,GAAG,EAAE;oBACb,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;gBAC/B,CAAC,EACD,UAAU,EAAE,SAAS,CAAC,aAAa,CAAC,MAAM,EAC1C,YAAY,EAAE,SAAS,CAAC,iBAAiB,GACzC,CACH,CAAC,CAAC,CAAC,CACF,KAAC,SAAS,IAAC,KAAK,EAAE,SAAS,CAAC,KAAK,GAAI,CACtC,IACG,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ /** Compile-time checks for AppLayout's 0.9 scroll configuration. */
2
+ import type { AppLayoutProps, AppLayoutScroll } from "./app-layout.js";
3
+ type Assert<T extends true> = T;
4
+ type IsNever<T> = [T] extends [never] ? true : false;
5
+ type Has<TKeys, TName> = [Extract<TKeys, TName>] extends [never] ? false : true;
6
+ type LayoutKeys = keyof AppLayoutProps;
7
+ type ScrollKeys = keyof AppLayoutScroll;
8
+ type RetainedScrollProp = Assert<Has<LayoutKeys, "scroll">>;
9
+ type RemovedScrollAliases = Assert<IsNever<Extract<LayoutKeys, "scrollProps" | "scrollRef">>>;
10
+ type NestedScrollOptions = Assert<Has<ScrollKeys, "focused" | "ref" | "stickyScroll" | "stickyStart">>;
11
+ export type AppLayoutPublicContractChecks = [
12
+ RetainedScrollProp,
13
+ RemovedScrollAliases,
14
+ NestedScrollOptions
15
+ ];
16
+ export {};
17
+ //# sourceMappingURL=app-layout.public-contract.typecheck.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-layout.public-contract.typecheck.d.ts","sourceRoot":"","sources":["../src/app-layout.public-contract.typecheck.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvE,KAAK,MAAM,CAAC,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC;AAChC,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC;AACrD,KAAK,GAAG,CAAC,KAAK,EAAE,KAAK,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC;AAEhF,KAAK,UAAU,GAAG,MAAM,cAAc,CAAC;AACvC,KAAK,UAAU,GAAG,MAAM,eAAe,CAAC;AACxC,KAAK,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;AAC5D,KAAK,oBAAoB,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,aAAa,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AAC9F,KAAK,mBAAmB,GAAG,MAAM,CAC/B,GAAG,CAAC,UAAU,EAAE,SAAS,GAAG,KAAK,GAAG,cAAc,GAAG,aAAa,CAAC,CACpE,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,kBAAkB;IAClB,oBAAoB;IACpB,mBAAmB;CACpB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=app-layout.public-contract.typecheck.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-layout.public-contract.typecheck.js","sourceRoot":"","sources":["../src/app-layout.public-contract.typecheck.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import type { ReactNode } from "react";
2
+ interface CloseButtonProps {
3
+ /** Called when the button is clicked (left mouse button). */
4
+ onClose: () => void;
5
+ /** Glyph to render (default "✕"). */
6
+ glyph?: string;
7
+ /** Foreground colour (defaults to theme.textMuted). */
8
+ color?: string;
9
+ }
10
+ /**
11
+ * Reusable clickable close control for overlays.
12
+ *
13
+ * Renders a small themed glyph that calls `onClose` on left-click. Purely
14
+ * additive — overlays keep their existing Escape / cancel keyboard paths.
15
+ */
16
+ export declare const CloseButton: ({ onClose, glyph, color, }: CloseButtonProps) => ReactNode;
17
+ export {};
18
+ //# sourceMappingURL=close-button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"close-button.d.ts","sourceRoot":"","sources":["../src/close-button.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,UAAU,gBAAgB;IACxB,6DAA6D;IAC7D,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,+BAIrB,gBAAgB,KAAG,SAqBrB,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "@opentui/react/jsx-runtime";
2
+ import { useCallback } from "react";
3
+ import { useTheme } from "@tooee/themes";
4
+ /**
5
+ * Reusable clickable close control for overlays.
6
+ *
7
+ * Renders a small themed glyph that calls `onClose` on left-click. Purely
8
+ * additive — overlays keep their existing Escape / cancel keyboard paths.
9
+ */
10
+ export const CloseButton = function CloseButton({ onClose, glyph = "✕", color, }) {
11
+ const { theme } = useTheme();
12
+ const handleMouseDown = useCallback((event) => {
13
+ // Left button only; let other buttons bubble.
14
+ if (event.button !== 0) {
15
+ return;
16
+ }
17
+ event.preventDefault();
18
+ event.stopPropagation();
19
+ onClose();
20
+ }, [onClose]);
21
+ return (_jsx("box", { flexShrink: 0, paddingLeft: 1, onMouseDown: handleMouseDown, children: _jsx("text", { content: glyph, fg: color ?? theme.textMuted }) }));
22
+ };
23
+ //# sourceMappingURL=close-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"close-button.js","sourceRoot":"","sources":["../src/close-button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAYzC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,WAAW,CAAC,EAC9C,OAAO,EACP,KAAK,GAAG,GAAG,EACX,KAAK,GACY;IACjB,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAE7B,MAAM,eAAe,GAAG,WAAW,CACjC,CAAC,KAAiB,EAAE,EAAE;QACpB,8CAA8C;QAC9C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,OAAO;QACT,CAAC;QACD,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,KAAK,CAAC,eAAe,EAAE,CAAC;QACxB,OAAO,EAAE,CAAC;IACZ,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,OAAO,CACL,cAAK,UAAU,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,WAAW,EAAE,eAAe,YAC9D,eAAM,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,IAAI,KAAK,CAAC,SAAS,GAAI,GAClD,CACP,CAAC;AACJ,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  export { AppLayout } from "./app-layout.js";
2
- export type { AppLayoutProps } from "./app-layout.js";
2
+ export type { AppLayoutProps, AppLayoutScroll } from "./app-layout.js";
3
+ export { CloseButton } from "./close-button.js";
4
+ export { OverlayPanel } from "./overlay-panel.js";
5
+ export type { OverlayPanelProps, PanelInset, PanelInsetValue } from "./overlay-panel.js";
6
+ export { decodeReactContent } from "./react-content.js";
7
+ export type { DecodedReactContent } from "./react-content.js";
3
8
  export { StatusBar } from "./status-bar.js";
4
9
  export type { StatusBarItem } from "./status-bar.js";
5
10
  export { TitleBar } from "./title-bar.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,7 @@
1
1
  export { AppLayout } from "./app-layout.js";
2
+ export { CloseButton } from "./close-button.js";
3
+ export { OverlayPanel } from "./overlay-panel.js";
4
+ export { decodeReactContent } from "./react-content.js";
2
5
  export { StatusBar } from "./status-bar.js";
3
6
  export { TitleBar } from "./title-bar.js";
4
7
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,31 @@
1
+ import type { ReactNode } from "react";
2
+ import type { MouseEvent } from "@opentui/core";
3
+ export type PanelInsetValue = number | "auto" | `${number}%`;
4
+ export interface PanelInset {
5
+ left?: PanelInsetValue;
6
+ right?: PanelInsetValue;
7
+ top?: PanelInsetValue;
8
+ bottom?: PanelInsetValue;
9
+ }
10
+ export interface OverlayPanelProps {
11
+ /** Title bar content. Primitive text uses the active accent color. */
12
+ title?: ReactNode;
13
+ /** Content between the title bar and main panel body. */
14
+ prompt?: ReactNode;
15
+ children: ReactNode;
16
+ /** Extra row below the body and above the hint bar. */
17
+ footer?: ReactNode;
18
+ /** Left-aligned hint bar content. */
19
+ hints?: ReactNode;
20
+ /** Right-aligned status area in the hint bar. */
21
+ statusRight?: ReactNode;
22
+ /** Overlay geometry when absolutely positioned. Defaults to 20% on all sides. */
23
+ inset?: PanelInset;
24
+ /** Show a title-bar close button. */
25
+ onClose?: () => void;
26
+ /** Mouse handler for the whole panel. */
27
+ onMouseDown?: (event: MouseEvent) => void;
28
+ }
29
+ /** Shared bordered chrome for modal overlay panels. */
30
+ export declare const OverlayPanel: ({ title, prompt, children, footer, hints, statusRight, inset, onClose, onMouseDown, }: OverlayPanelProps) => ReactNode;
31
+ //# sourceMappingURL=overlay-panel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlay-panel.d.ts","sourceRoot":"","sources":["../src/overlay-panel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAMhD,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC;AAE7D,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,GAAG,CAAC,EAAE,eAAe,CAAC;IACtB,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,sEAAsE;IACtE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,yDAAyD;IACzD,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,uDAAuD;IACvD,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,qCAAqC;IACrC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,iDAAiD;IACjD,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,iFAAiF;IACjF,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,yCAAyC;IACzC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;CAC3C;AA+BD,uDAAuD;AACvD,eAAO,MAAM,YAAY,0FAUtB,iBAAiB,KAAG,SAgEtB,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
2
+ import { useTheme } from "@tooee/themes";
3
+ import { CloseButton } from "./close-button.js";
4
+ import { decodeReactContent } from "./react-content.js";
5
+ const renderThemedContent = function renderThemedContent(content, color) {
6
+ if (content.kind === "empty") {
7
+ return null;
8
+ }
9
+ return content.kind === "string" ? _jsx("text", { content: content.value, fg: color }) : content.value;
10
+ };
11
+ const renderPrompt = function renderPrompt(prompt, textColor) {
12
+ if (prompt.kind === "empty") {
13
+ return null;
14
+ }
15
+ if (prompt.kind === "node") {
16
+ return prompt.value;
17
+ }
18
+ return (_jsx("box", { paddingLeft: 1, paddingRight: 1, children: _jsx("text", { fg: textColor, children: _jsx("strong", { children: prompt.value }) }) }));
19
+ };
20
+ /** Shared bordered chrome for modal overlay panels. */
21
+ export const OverlayPanel = function OverlayPanel({ title, prompt, children, footer, hints, statusRight, inset, onClose, onMouseDown, }) {
22
+ const { theme } = useTheme();
23
+ const decodedTitle = decodeReactContent(title);
24
+ const decodedPrompt = decodeReactContent(prompt);
25
+ const decodedFooter = decodeReactContent(footer);
26
+ const decodedHints = decodeReactContent(hints);
27
+ const decodedStatus = decodeReactContent(statusRight);
28
+ return (_jsxs("box", { position: "absolute", left: inset?.left ?? "20%", right: inset?.right ?? "20%", top: inset?.top ?? "20%", bottom: inset?.bottom ?? "20%", flexDirection: "column", backgroundColor: theme.backgroundPanel, border: true, borderColor: theme.borderActive, onMouseDown: onMouseDown, children: [decodedTitle.kind !== "empty" && (_jsxs("box", { flexDirection: "row", height: 1, paddingLeft: 1, paddingRight: 1, backgroundColor: theme.backgroundElement, children: [decodedTitle.kind === "string" ? (_jsx("text", { content: decodedTitle.value, fg: theme.accent, style: { flexGrow: 1 } })) : (_jsx("box", { flexDirection: "row", style: { flexGrow: 1 }, children: decodedTitle.value })), onClose && _jsx(CloseButton, { onClose: onClose })] })), renderPrompt(decodedPrompt, theme.text), children, decodedFooter.kind !== "empty" && (_jsx("box", { height: 1, paddingLeft: 1, paddingRight: 1, children: decodedFooter.value })), _jsxs("box", { flexDirection: "row", height: 1, paddingLeft: 1, paddingRight: 1, backgroundColor: theme.backgroundElement, children: [_jsx("box", { flexDirection: "row", style: { flexGrow: 1 }, children: renderThemedContent(decodedHints, theme.textMuted) }), renderThemedContent(decodedStatus, theme.textMuted)] })] }));
29
+ };
30
+ //# sourceMappingURL=overlay-panel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlay-panel.js","sourceRoot":"","sources":["../src/overlay-panel.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAgCxD,MAAM,mBAAmB,GAAG,SAAS,mBAAmB,CACtD,OAA4B,EAC5B,KAAa;IAEb,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,eAAM,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,EAAE,KAAK,GAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;AACjG,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,SAAS,YAAY,CACxC,MAA2B,EAC3B,SAAiB;IAEjB,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAC3B,OAAO,MAAM,CAAC,KAAK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AAE,KAAK,CAAC,iBAAiB,aAEvC,YAAY,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAChC,eAAM,OAAO,EAAE,YAAY,CAAC,KAAK,EAAE,EAAE,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAI,CAChF,CAAC,CAAC,CAAC,CACF,cAAK,aAAa,EAAC,KAAK,EAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,YAC5C,YAAY,CAAC,KAAK,GACf,CACP,EACA,OAAO,IAAI,KAAC,WAAW,IAAC,OAAO,EAAE,OAAO,GAAI,IACzC,CACP,EAEA,YAAY,CAAC,aAAa,EAAE,KAAK,CAAC,IAAI,CAAC,EAEvC,QAAQ,EAER,aAAa,CAAC,IAAI,KAAK,OAAO,IAAI,CACjC,cAAK,MAAM,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,YAC5C,aAAa,CAAC,KAAK,GAChB,CACP,EAED,eACE,aAAa,EAAC,KAAK,EACnB,MAAM,EAAE,CAAC,EACT,WAAW,EAAE,CAAC,EACd,YAAY,EAAE,CAAC,EACf,eAAe,EAAE,KAAK,CAAC,iBAAiB,aAExC,cAAK,aAAa,EAAC,KAAK,EAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,YAC5C,mBAAmB,CAAC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,GAC/C,EACL,mBAAmB,CAAC,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,IAChD,IACF,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { ReactNode } from "react";
2
+ interface EmptyReactContent {
3
+ kind: "empty";
4
+ }
5
+ interface StringReactContent {
6
+ kind: "string";
7
+ value: string;
8
+ }
9
+ interface NodeReactContent {
10
+ kind: "node";
11
+ value: ReactNode;
12
+ }
13
+ export type DecodedReactContent = EmptyReactContent | StringReactContent | NodeReactContent;
14
+ /** Decode a public React slot once into its three rendering cases. */
15
+ export declare const decodeReactContent: (content: ReactNode) => DecodedReactContent;
16
+ export {};
17
+ //# sourceMappingURL=react-content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-content.d.ts","sourceRoot":"","sources":["../src/react-content.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,UAAU,iBAAiB;IACzB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,UAAU,kBAAkB;IAC1B,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,gBAAgB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;CAClB;AAED,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,GAAG,kBAAkB,GAAG,gBAAgB,CAAC;AAE5F,sEAAsE;AACtE,eAAO,MAAM,kBAAkB,YACpB,SAAS,KACjB,mBASF,CAAC"}
@@ -0,0 +1,12 @@
1
+ /** Decode a public React slot once into its three rendering cases. */
2
+ export const decodeReactContent = function decodeReactContent(content) {
3
+ if (content === null || content === undefined) {
4
+ return { kind: "empty" };
5
+ }
6
+ // oxlint-disable-next-line anti-slop/no-runtime-typeof -- ReactNode boundary distinguishes themed primitive text from nodes rendered by React
7
+ if (typeof content === "string") {
8
+ return { kind: "string", value: content };
9
+ }
10
+ return { kind: "node", value: content };
11
+ };
12
+ //# sourceMappingURL=react-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-content.js","sourceRoot":"","sources":["../src/react-content.ts"],"names":[],"mappings":"AAkBA,sEAAsE;AACtE,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,kBAAkB,CAC3D,OAAkB;IAElB,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC9C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAC3B,CAAC;IACD,8IAA8I;IAC9I,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IAC5C,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC1C,CAAC,CAAC"}
@@ -1,3 +1,4 @@
1
+ import type { ReactNode } from "react";
1
2
  interface StatusBarProps {
2
3
  items: StatusBarItem[];
3
4
  }
@@ -5,6 +6,6 @@ export interface StatusBarItem {
5
6
  label: string;
6
7
  value?: string;
7
8
  }
8
- export declare const StatusBar: ({ items }: StatusBarProps) => React.ReactNode;
9
+ export declare const StatusBar: ({ items }: StatusBarProps) => ReactNode;
9
10
  export {};
10
11
  //# sourceMappingURL=status-bar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"status-bar.d.ts","sourceRoot":"","sources":["../src/status-bar.tsx"],"names":[],"mappings":"AAEA,UAAU,cAAc;IACtB,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,SAAS,cAAiC,cAAc,KAAG,KAAK,CAAC,SAyB7E,CAAC"}
1
+ {"version":3,"file":"status-bar.d.ts","sourceRoot":"","sources":["../src/status-bar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,UAAU,cAAc;IACtB,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,SAAS,cAAiC,cAAc,KAAG,SAyBvE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"status-bar.js","sourceRoot":"","sources":["../src/status-bar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAWzC,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,SAAS,CAAC,EAAE,KAAK,EAAkB;IACnE,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,OAAO,CACL,cACE,KAAK,EAAE;YACL,eAAe,EAAE,KAAK,CAAC,eAAe;YACtC,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,CAAC;YACb,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,CAAC;YACd,YAAY,EAAE,CAAC;SAChB,YAEA,KAAK,CAAC,GAAG,CACR,CAAC,IAAI,EAAE,KAAK,EAAmB,EAAE,CAAC,CAChC,eAAiB,KAAK,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,aAC9D,eAAM,OAAO,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,SAAS,EAAE,GAAI,EAC5D,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAChC,eAAM,OAAO,EAAE,IAAI,IAAI,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,IAAI,EAAE,GAAI,CAC/D,KAJO,KAAK,CAKT,CACP,CACF,GACG,CACP,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"status-bar.js","sourceRoot":"","sources":["../src/status-bar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAYzC,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,SAAS,CAAC,EAAE,KAAK,EAAkB;IACnE,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,OAAO,CACL,cACE,KAAK,EAAE;YACL,eAAe,EAAE,KAAK,CAAC,eAAe;YACtC,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,CAAC;YACb,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,CAAC;YACd,YAAY,EAAE,CAAC;SAChB,YAEA,KAAK,CAAC,GAAG,CACR,CAAC,IAAI,EAAE,KAAK,EAAa,EAAE,CAAC,CAC1B,eAAiB,KAAK,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,aAC9D,eAAM,OAAO,EAAE,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,SAAS,EAAE,GAAI,EAC5D,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAChC,eAAM,OAAO,EAAE,IAAI,IAAI,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,IAAI,EAAE,GAAI,CAC/D,KAJO,KAAK,CAKT,CACP,CACF,GACG,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -1,7 +1,8 @@
1
+ import type { ReactNode } from "react";
1
2
  interface TitleBarProps {
2
3
  title: string;
3
4
  subtitle?: string;
4
5
  }
5
- export declare const TitleBar: ({ title, subtitle }: TitleBarProps) => React.ReactNode;
6
+ export declare const TitleBar: ({ title, subtitle }: TitleBarProps) => ReactNode;
6
7
  export {};
7
8
  //# sourceMappingURL=title-bar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"title-bar.d.ts","sourceRoot":"","sources":["../src/title-bar.tsx"],"names":[],"mappings":"AAEA,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,QAAQ,wBAA0C,aAAa,KAAG,KAAK,CAAC,SAmBpF,CAAC"}
1
+ {"version":3,"file":"title-bar.d.ts","sourceRoot":"","sources":["../src/title-bar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,QAAQ,wBAA0C,aAAa,KAAG,SAmB9E,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"title-bar.js","sourceRoot":"","sources":["../src/title-bar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAOzC,MAAM,CAAC,MAAM,QAAQ,GAAG,SAAS,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAiB;IAC1E,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,OAAO,CACL,eACE,KAAK,EAAE;YACL,eAAe,EAAE,KAAK,CAAC,eAAe;YACtC,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,CAAC;YACb,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,CAAC;YACd,YAAY,EAAE,CAAC;SAChB,aAED,eAAM,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,GAAI,EACrD,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAC9B,eAAM,OAAO,EAAE,MAAM,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,SAAS,EAAE,GAAI,CACpE,IACG,CACP,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"title-bar.js","sourceRoot":"","sources":["../src/title-bar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAQzC,MAAM,CAAC,MAAM,QAAQ,GAAG,SAAS,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAiB;IAC1E,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,OAAO,CACL,eACE,KAAK,EAAE;YACL,eAAe,EAAE,KAAK,CAAC,eAAe;YACtC,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,CAAC;YACb,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,CAAC;YACd,YAAY,EAAE,CAAC;SAChB,aAED,eAAM,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,OAAO,EAAE,GAAI,EACrD,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAC9B,eAAM,OAAO,EAAE,MAAM,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,SAAS,EAAE,GAAI,CACpE,IACG,CACP,CAAC;AACJ,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tooee/layout",
3
- "version": "0.7.3",
3
+ "version": "0.9.0",
4
4
  "description": "Standard app chrome (title bar, status bar) for Tooee",
5
5
  "keywords": [
6
6
  "cli",
@@ -38,15 +38,16 @@
38
38
  "typecheck": "tsc --noEmit"
39
39
  },
40
40
  "dependencies": {
41
- "@tooee/commands": "0.7.3",
42
- "@tooee/overlays": "0.7.3",
43
- "@tooee/search": "0.7.3",
44
- "@tooee/themes": "0.7.3",
45
- "@tooee/toasts": "0.7.3"
41
+ "@tooee/commands": "0.9.0",
42
+ "@tooee/overlays": "0.9.0",
43
+ "@tooee/search": "0.9.0",
44
+ "@tooee/themes": "0.9.0",
45
+ "@tooee/toasts": "0.9.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@opentui/core": "^0.5.1",
49
49
  "@opentui/react": "^0.5.1",
50
+ "@tooee/test-support": "0.7.3",
50
51
  "@types/bun": "^1.3.10",
51
52
  "@types/react": "^19.2.14",
52
53
  "typescript": "^5.9.3"
@@ -0,0 +1,20 @@
1
+ /** Compile-time checks for AppLayout's 0.9 scroll configuration. */
2
+ import type { AppLayoutProps, AppLayoutScroll } from "./app-layout.js";
3
+
4
+ type Assert<T extends true> = T;
5
+ type IsNever<T> = [T] extends [never] ? true : false;
6
+ type Has<TKeys, TName> = [Extract<TKeys, TName>] extends [never] ? false : true;
7
+
8
+ type LayoutKeys = keyof AppLayoutProps;
9
+ type ScrollKeys = keyof AppLayoutScroll;
10
+ type RetainedScrollProp = Assert<Has<LayoutKeys, "scroll">>;
11
+ type RemovedScrollAliases = Assert<IsNever<Extract<LayoutKeys, "scrollProps" | "scrollRef">>>;
12
+ type NestedScrollOptions = Assert<
13
+ Has<ScrollKeys, "focused" | "ref" | "stickyScroll" | "stickyStart">
14
+ >;
15
+
16
+ export type AppLayoutPublicContractChecks = [
17
+ RetainedScrollProp,
18
+ RemovedScrollAliases,
19
+ NestedScrollOptions,
20
+ ];
@@ -9,15 +9,18 @@ import { useTheme } from "@tooee/themes";
9
9
  import { useCurrentOverlay } from "@tooee/overlays";
10
10
  import { ToastContainer } from "@tooee/toasts";
11
11
 
12
+ export interface AppLayoutScroll {
13
+ ref: RefObject<ScrollBoxRenderable | null>;
14
+ stickyScroll?: boolean;
15
+ stickyStart?: "bottom" | "top";
16
+ focused?: boolean;
17
+ }
18
+
12
19
  export interface AppLayoutProps {
13
20
  titleBar?: { title: string; subtitle?: string };
14
21
  statusBar: { items: StatusBarItem[] };
15
- scrollRef?: RefObject<ScrollBoxRenderable | null>;
16
- scrollProps?: {
17
- stickyScroll?: boolean;
18
- stickyStart?: "bottom" | "top";
19
- focused?: boolean;
20
- };
22
+ /** Configure the optional scrollbox used for the main content. */
23
+ scroll?: AppLayoutScroll;
21
24
  searchBar?: SearchState;
22
25
  children: ReactNode;
23
26
  }
@@ -36,8 +39,7 @@ const hasRenderableOverlay = function hasRenderableOverlay(overlay: ReactNode):
36
39
  export const AppLayout = function AppLayout({
37
40
  titleBar,
38
41
  statusBar,
39
- scrollRef,
40
- scrollProps,
42
+ scroll,
41
43
  searchBar,
42
44
  children,
43
45
  }: AppLayoutProps): ReactNode {
@@ -53,13 +55,13 @@ export const AppLayout = function AppLayout({
53
55
  <box flexDirection="column" width="100%" height="100%" backgroundColor={theme.background}>
54
56
  {titleBar && <TitleBar title={titleBar.title} subtitle={titleBar.subtitle} />}
55
57
  <box style={{ flexGrow: 1, position: "relative" }}>
56
- {scrollRef ? (
58
+ {scroll ? (
57
59
  <scrollbox
58
- ref={scrollRef}
60
+ ref={scroll.ref}
59
61
  style={{ flexGrow: 1 }}
60
- stickyScroll={scrollProps?.stickyScroll}
61
- stickyStart={scrollProps?.stickyStart}
62
- focused={scrollProps?.focused ?? true}
62
+ stickyScroll={scroll.stickyScroll}
63
+ stickyStart={scroll.stickyStart}
64
+ focused={scroll.focused ?? true}
63
65
  >
64
66
  {children}
65
67
  </scrollbox>
@@ -0,0 +1,46 @@
1
+ import { useCallback } from "react";
2
+ import type { MouseEvent } from "@opentui/core";
3
+ import { useTheme } from "@tooee/themes";
4
+ import type { ReactNode } from "react";
5
+
6
+ interface CloseButtonProps {
7
+ /** Called when the button is clicked (left mouse button). */
8
+ onClose: () => void;
9
+ /** Glyph to render (default "✕"). */
10
+ glyph?: string;
11
+ /** Foreground colour (defaults to theme.textMuted). */
12
+ color?: string;
13
+ }
14
+
15
+ /**
16
+ * Reusable clickable close control for overlays.
17
+ *
18
+ * Renders a small themed glyph that calls `onClose` on left-click. Purely
19
+ * additive — overlays keep their existing Escape / cancel keyboard paths.
20
+ */
21
+ export const CloseButton = function CloseButton({
22
+ onClose,
23
+ glyph = "✕",
24
+ color,
25
+ }: CloseButtonProps): ReactNode {
26
+ const { theme } = useTheme();
27
+
28
+ const handleMouseDown = useCallback(
29
+ (event: MouseEvent) => {
30
+ // Left button only; let other buttons bubble.
31
+ if (event.button !== 0) {
32
+ return;
33
+ }
34
+ event.preventDefault();
35
+ event.stopPropagation();
36
+ onClose();
37
+ },
38
+ [onClose],
39
+ );
40
+
41
+ return (
42
+ <box flexShrink={0} paddingLeft={1} onMouseDown={handleMouseDown}>
43
+ <text content={glyph} fg={color ?? theme.textMuted} />
44
+ </box>
45
+ );
46
+ };
package/src/index.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  export { AppLayout } from "./app-layout.js";
2
- export type { AppLayoutProps } from "./app-layout.js";
2
+ export type { AppLayoutProps, AppLayoutScroll } from "./app-layout.js";
3
+ export { CloseButton } from "./close-button.js";
4
+ export { OverlayPanel } from "./overlay-panel.js";
5
+ export type { OverlayPanelProps, PanelInset, PanelInsetValue } from "./overlay-panel.js";
6
+ export { decodeReactContent } from "./react-content.js";
7
+ export type { DecodedReactContent } from "./react-content.js";
3
8
  export { StatusBar } from "./status-bar.js";
4
9
  export type { StatusBarItem } from "./status-bar.js";
5
10
  export { TitleBar } from "./title-bar.js";
@@ -0,0 +1,141 @@
1
+ import type { ReactNode } from "react";
2
+ import type { MouseEvent } from "@opentui/core";
3
+ import { useTheme } from "@tooee/themes";
4
+ import { CloseButton } from "./close-button.js";
5
+ import { decodeReactContent } from "./react-content.js";
6
+ import type { DecodedReactContent } from "./react-content.js";
7
+
8
+ export type PanelInsetValue = number | "auto" | `${number}%`;
9
+
10
+ export interface PanelInset {
11
+ left?: PanelInsetValue;
12
+ right?: PanelInsetValue;
13
+ top?: PanelInsetValue;
14
+ bottom?: PanelInsetValue;
15
+ }
16
+
17
+ export interface OverlayPanelProps {
18
+ /** Title bar content. Primitive text uses the active accent color. */
19
+ title?: ReactNode;
20
+ /** Content between the title bar and main panel body. */
21
+ prompt?: ReactNode;
22
+ children: ReactNode;
23
+ /** Extra row below the body and above the hint bar. */
24
+ footer?: ReactNode;
25
+ /** Left-aligned hint bar content. */
26
+ hints?: ReactNode;
27
+ /** Right-aligned status area in the hint bar. */
28
+ statusRight?: ReactNode;
29
+ /** Overlay geometry when absolutely positioned. Defaults to 20% on all sides. */
30
+ inset?: PanelInset;
31
+ /** Show a title-bar close button. */
32
+ onClose?: () => void;
33
+ /** Mouse handler for the whole panel. */
34
+ onMouseDown?: (event: MouseEvent) => void;
35
+ }
36
+
37
+ const renderThemedContent = function renderThemedContent(
38
+ content: DecodedReactContent,
39
+ color: string,
40
+ ): ReactNode {
41
+ if (content.kind === "empty") {
42
+ return null;
43
+ }
44
+ return content.kind === "string" ? <text content={content.value} fg={color} /> : content.value;
45
+ };
46
+
47
+ const renderPrompt = function renderPrompt(
48
+ prompt: DecodedReactContent,
49
+ textColor: string,
50
+ ): ReactNode {
51
+ if (prompt.kind === "empty") {
52
+ return null;
53
+ }
54
+ if (prompt.kind === "node") {
55
+ return prompt.value;
56
+ }
57
+ return (
58
+ <box paddingLeft={1} paddingRight={1}>
59
+ <text fg={textColor}>
60
+ <strong>{prompt.value}</strong>
61
+ </text>
62
+ </box>
63
+ );
64
+ };
65
+
66
+ /** Shared bordered chrome for modal overlay panels. */
67
+ export const OverlayPanel = function OverlayPanel({
68
+ title,
69
+ prompt,
70
+ children,
71
+ footer,
72
+ hints,
73
+ statusRight,
74
+ inset,
75
+ onClose,
76
+ onMouseDown,
77
+ }: OverlayPanelProps): ReactNode {
78
+ const { theme } = useTheme();
79
+ const decodedTitle = decodeReactContent(title);
80
+ const decodedPrompt = decodeReactContent(prompt);
81
+ const decodedFooter = decodeReactContent(footer);
82
+ const decodedHints = decodeReactContent(hints);
83
+ const decodedStatus = decodeReactContent(statusRight);
84
+
85
+ return (
86
+ <box
87
+ position="absolute"
88
+ left={inset?.left ?? "20%"}
89
+ right={inset?.right ?? "20%"}
90
+ top={inset?.top ?? "20%"}
91
+ bottom={inset?.bottom ?? "20%"}
92
+ flexDirection="column"
93
+ backgroundColor={theme.backgroundPanel}
94
+ border
95
+ borderColor={theme.borderActive}
96
+ onMouseDown={onMouseDown}
97
+ >
98
+ {decodedTitle.kind !== "empty" && (
99
+ <box
100
+ flexDirection="row"
101
+ height={1}
102
+ paddingLeft={1}
103
+ paddingRight={1}
104
+ backgroundColor={theme.backgroundElement}
105
+ >
106
+ {decodedTitle.kind === "string" ? (
107
+ <text content={decodedTitle.value} fg={theme.accent} style={{ flexGrow: 1 }} />
108
+ ) : (
109
+ <box flexDirection="row" style={{ flexGrow: 1 }}>
110
+ {decodedTitle.value}
111
+ </box>
112
+ )}
113
+ {onClose && <CloseButton onClose={onClose} />}
114
+ </box>
115
+ )}
116
+
117
+ {renderPrompt(decodedPrompt, theme.text)}
118
+
119
+ {children}
120
+
121
+ {decodedFooter.kind !== "empty" && (
122
+ <box height={1} paddingLeft={1} paddingRight={1}>
123
+ {decodedFooter.value}
124
+ </box>
125
+ )}
126
+
127
+ <box
128
+ flexDirection="row"
129
+ height={1}
130
+ paddingLeft={1}
131
+ paddingRight={1}
132
+ backgroundColor={theme.backgroundElement}
133
+ >
134
+ <box flexDirection="row" style={{ flexGrow: 1 }}>
135
+ {renderThemedContent(decodedHints, theme.textMuted)}
136
+ </box>
137
+ {renderThemedContent(decodedStatus, theme.textMuted)}
138
+ </box>
139
+ </box>
140
+ );
141
+ };
@@ -0,0 +1,31 @@
1
+ import type { ReactNode } from "react";
2
+
3
+ interface EmptyReactContent {
4
+ kind: "empty";
5
+ }
6
+
7
+ interface StringReactContent {
8
+ kind: "string";
9
+ value: string;
10
+ }
11
+
12
+ interface NodeReactContent {
13
+ kind: "node";
14
+ value: ReactNode;
15
+ }
16
+
17
+ export type DecodedReactContent = EmptyReactContent | StringReactContent | NodeReactContent;
18
+
19
+ /** Decode a public React slot once into its three rendering cases. */
20
+ export const decodeReactContent = function decodeReactContent(
21
+ content: ReactNode,
22
+ ): DecodedReactContent {
23
+ if (content === null || content === undefined) {
24
+ return { kind: "empty" };
25
+ }
26
+ // oxlint-disable-next-line anti-slop/no-runtime-typeof -- ReactNode boundary distinguishes themed primitive text from nodes rendered by React
27
+ if (typeof content === "string") {
28
+ return { kind: "string", value: content };
29
+ }
30
+ return { kind: "node", value: content };
31
+ };
@@ -1,4 +1,5 @@
1
1
  import { useTheme } from "@tooee/themes";
2
+ import type { ReactNode } from "react";
2
3
 
3
4
  interface StatusBarProps {
4
5
  items: StatusBarItem[];
@@ -9,7 +10,7 @@ export interface StatusBarItem {
9
10
  value?: string;
10
11
  }
11
12
 
12
- export const StatusBar = function StatusBar({ items }: StatusBarProps): React.ReactNode {
13
+ export const StatusBar = function StatusBar({ items }: StatusBarProps): ReactNode {
13
14
  const { theme } = useTheme();
14
15
  return (
15
16
  <box
@@ -23,7 +24,7 @@ export const StatusBar = function StatusBar({ items }: StatusBarProps): React.Re
23
24
  }}
24
25
  >
25
26
  {items.map(
26
- (item, index): React.ReactNode => (
27
+ (item, index): ReactNode => (
27
28
  <box key={index} style={{ flexDirection: "row", marginRight: 2 }}>
28
29
  <text content={item.label} style={{ fg: theme.textMuted }} />
29
30
  {(item.value?.length ?? 0) > 0 && (
package/src/title-bar.tsx CHANGED
@@ -1,11 +1,12 @@
1
1
  import { useTheme } from "@tooee/themes";
2
+ import type { ReactNode } from "react";
2
3
 
3
4
  interface TitleBarProps {
4
5
  title: string;
5
6
  subtitle?: string;
6
7
  }
7
8
 
8
- export const TitleBar = function TitleBar({ title, subtitle }: TitleBarProps): React.ReactNode {
9
+ export const TitleBar = function TitleBar({ title, subtitle }: TitleBarProps): ReactNode {
9
10
  const { theme } = useTheme();
10
11
  return (
11
12
  <box