@knpkv/codecommit 0.1.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/README.md +216 -0
- package/dist/package.json +50 -0
- package/dist/src/bin.d.ts +3 -0
- package/dist/src/bin.d.ts.map +1 -0
- package/dist/src/bin.js +204 -0
- package/dist/src/bin.js.map +1 -0
- package/dist/src/main.d.ts +2 -0
- package/dist/src/main.d.ts.map +1 -0
- package/dist/src/main.js +25 -0
- package/dist/src/main.js.map +1 -0
- package/dist/src/tui/App.d.ts +6 -0
- package/dist/src/tui/App.d.ts.map +1 -0
- package/dist/src/tui/App.js +40 -0
- package/dist/src/tui/App.js.map +1 -0
- package/dist/src/tui/Constants.d.ts +11 -0
- package/dist/src/tui/Constants.d.ts.map +1 -0
- package/dist/src/tui/Constants.js +40 -0
- package/dist/src/tui/Constants.js.map +1 -0
- package/dist/src/tui/ListBuilder.d.ts +32 -0
- package/dist/src/tui/ListBuilder.d.ts.map +1 -0
- package/dist/src/tui/ListBuilder.js +145 -0
- package/dist/src/tui/ListBuilder.js.map +1 -0
- package/dist/src/tui/atoms/actions.d.ts +39 -0
- package/dist/src/tui/atoms/actions.d.ts.map +1 -0
- package/dist/src/tui/atoms/actions.js +149 -0
- package/dist/src/tui/atoms/actions.js.map +1 -0
- package/dist/src/tui/atoms/app.d.ts +42 -0
- package/dist/src/tui/atoms/app.d.ts.map +1 -0
- package/dist/src/tui/atoms/app.js +69 -0
- package/dist/src/tui/atoms/app.js.map +1 -0
- package/dist/src/tui/atoms/index.d.ts +6 -0
- package/dist/src/tui/atoms/index.d.ts.map +1 -0
- package/dist/src/tui/atoms/index.js +7 -0
- package/dist/src/tui/atoms/index.js.map +1 -0
- package/dist/src/tui/atoms/runtime.d.ts +9 -0
- package/dist/src/tui/atoms/runtime.d.ts.map +1 -0
- package/dist/src/tui/atoms/runtime.js +22 -0
- package/dist/src/tui/atoms/runtime.js.map +1 -0
- package/dist/src/tui/atoms/ui.d.ts +103 -0
- package/dist/src/tui/atoms/ui.d.ts.map +1 -0
- package/dist/src/tui/atoms/ui.js +97 -0
- package/dist/src/tui/atoms/ui.js.map +1 -0
- package/dist/src/tui/components/Badge.d.ts +13 -0
- package/dist/src/tui/components/Badge.d.ts.map +1 -0
- package/dist/src/tui/components/Badge.js +48 -0
- package/dist/src/tui/components/Badge.js.map +1 -0
- package/dist/src/tui/components/DetailsView.d.ts +6 -0
- package/dist/src/tui/components/DetailsView.d.ts.map +1 -0
- package/dist/src/tui/components/DetailsView.js +81 -0
- package/dist/src/tui/components/DetailsView.js.map +1 -0
- package/dist/src/tui/components/ErrorBoundary.d.ts +20 -0
- package/dist/src/tui/components/ErrorBoundary.d.ts.map +1 -0
- package/dist/src/tui/components/ErrorBoundary.js +33 -0
- package/dist/src/tui/components/ErrorBoundary.js.map +1 -0
- package/dist/src/tui/components/Footer.d.ts +6 -0
- package/dist/src/tui/components/Footer.d.ts.map +1 -0
- package/dist/src/tui/components/Footer.js +29 -0
- package/dist/src/tui/components/Footer.js.map +1 -0
- package/dist/src/tui/components/Header.d.ts +6 -0
- package/dist/src/tui/components/Header.d.ts.map +1 -0
- package/dist/src/tui/components/Header.js +58 -0
- package/dist/src/tui/components/Header.js.map +1 -0
- package/dist/src/tui/components/ListItemRow.d.ts +13 -0
- package/dist/src/tui/components/ListItemRow.d.ts.map +1 -0
- package/dist/src/tui/components/ListItemRow.js +52 -0
- package/dist/src/tui/components/ListItemRow.js.map +1 -0
- package/dist/src/tui/components/MainList.d.ts +11 -0
- package/dist/src/tui/components/MainList.d.ts.map +1 -0
- package/dist/src/tui/components/MainList.js +124 -0
- package/dist/src/tui/components/MainList.js.map +1 -0
- package/dist/src/tui/components/NotificationsTable.d.ts +12 -0
- package/dist/src/tui/components/NotificationsTable.d.ts.map +1 -0
- package/dist/src/tui/components/NotificationsTable.js +72 -0
- package/dist/src/tui/components/NotificationsTable.js.map +1 -0
- package/dist/src/tui/components/QuickFilters.d.ts +6 -0
- package/dist/src/tui/components/QuickFilters.d.ts.map +1 -0
- package/dist/src/tui/components/QuickFilters.js +74 -0
- package/dist/src/tui/components/QuickFilters.js.map +1 -0
- package/dist/src/tui/components/SettingsTable.d.ts +12 -0
- package/dist/src/tui/components/SettingsTable.d.ts.map +1 -0
- package/dist/src/tui/components/SettingsTable.js +62 -0
- package/dist/src/tui/components/SettingsTable.js.map +1 -0
- package/dist/src/tui/components/Spinner.d.ts +11 -0
- package/dist/src/tui/components/Spinner.d.ts.map +1 -0
- package/dist/src/tui/components/Spinner.js +24 -0
- package/dist/src/tui/components/Spinner.js.map +1 -0
- package/dist/src/tui/components/StatusRow.d.ts +11 -0
- package/dist/src/tui/components/StatusRow.d.ts.map +1 -0
- package/dist/src/tui/components/StatusRow.js +11 -0
- package/dist/src/tui/components/StatusRow.js.map +1 -0
- package/dist/src/tui/components/Table.d.ts +20 -0
- package/dist/src/tui/components/Table.d.ts.map +1 -0
- package/dist/src/tui/components/Table.js +38 -0
- package/dist/src/tui/components/Table.js.map +1 -0
- package/dist/src/tui/components/index.d.ts +14 -0
- package/dist/src/tui/components/index.d.ts.map +1 -0
- package/dist/src/tui/components/index.js +14 -0
- package/dist/src/tui/components/index.js.map +1 -0
- package/dist/src/tui/components/mainlist-utils.d.ts +22 -0
- package/dist/src/tui/components/mainlist-utils.d.ts.map +1 -0
- package/dist/src/tui/components/mainlist-utils.js +71 -0
- package/dist/src/tui/components/mainlist-utils.js.map +1 -0
- package/dist/src/tui/components/table-utils.d.ts +25 -0
- package/dist/src/tui/components/table-utils.d.ts.map +1 -0
- package/dist/src/tui/components/table-utils.js +25 -0
- package/dist/src/tui/components/table-utils.js.map +1 -0
- package/dist/src/tui/context/dialog.d.ts +32 -0
- package/dist/src/tui/context/dialog.d.ts.map +1 -0
- package/dist/src/tui/context/dialog.js +41 -0
- package/dist/src/tui/context/dialog.js.map +1 -0
- package/dist/src/tui/context/theme.d.ts +25 -0
- package/dist/src/tui/context/theme.d.ts.map +1 -0
- package/dist/src/tui/context/theme.js +31 -0
- package/dist/src/tui/context/theme.js.map +1 -0
- package/dist/src/tui/hooks/index.d.ts +2 -0
- package/dist/src/tui/hooks/index.d.ts.map +1 -0
- package/dist/src/tui/hooks/index.js +2 -0
- package/dist/src/tui/hooks/index.js.map +1 -0
- package/dist/src/tui/hooks/useKeyboardNav.d.ts +16 -0
- package/dist/src/tui/hooks/useKeyboardNav.d.ts.map +1 -0
- package/dist/src/tui/hooks/useKeyboardNav.js +429 -0
- package/dist/src/tui/hooks/useKeyboardNav.js.map +1 -0
- package/dist/src/tui/hooks/useListNavigation.d.ts +3 -0
- package/dist/src/tui/hooks/useListNavigation.d.ts.map +1 -0
- package/dist/src/tui/hooks/useListNavigation.js +123 -0
- package/dist/src/tui/hooks/useListNavigation.js.map +1 -0
- package/dist/src/tui/mocks.d.ts +6 -0
- package/dist/src/tui/mocks.d.ts.map +1 -0
- package/dist/src/tui/mocks.js +36 -0
- package/dist/src/tui/mocks.js.map +1 -0
- package/dist/src/tui/theme/Resolver.d.ts +6 -0
- package/dist/src/tui/theme/Resolver.d.ts.map +1 -0
- package/dist/src/tui/theme/Resolver.js +73 -0
- package/dist/src/tui/theme/Resolver.js.map +1 -0
- package/dist/src/tui/theme/ThemeRegistry.d.ts +3 -0
- package/dist/src/tui/theme/ThemeRegistry.d.ts.map +1 -0
- package/dist/src/tui/theme/ThemeRegistry.js +70 -0
- package/dist/src/tui/theme/ThemeRegistry.js.map +1 -0
- package/dist/src/tui/theme/data/aura.json +69 -0
- package/dist/src/tui/theme/data/ayu.json +80 -0
- package/dist/src/tui/theme/data/carbonfox.json +248 -0
- package/dist/src/tui/theme/data/catppuccin-frappe.json +233 -0
- package/dist/src/tui/theme/data/catppuccin-macchiato.json +233 -0
- package/dist/src/tui/theme/data/catppuccin.json +112 -0
- package/dist/src/tui/theme/data/cobalt2.json +228 -0
- package/dist/src/tui/theme/data/cursor.json +249 -0
- package/dist/src/tui/theme/data/dracula.json +219 -0
- package/dist/src/tui/theme/data/everforest.json +241 -0
- package/dist/src/tui/theme/data/flexoki.json +237 -0
- package/dist/src/tui/theme/data/github.json +233 -0
- package/dist/src/tui/theme/data/gruvbox.json +242 -0
- package/dist/src/tui/theme/data/kanagawa.json +77 -0
- package/dist/src/tui/theme/data/lucent-orng.json +237 -0
- package/dist/src/tui/theme/data/material.json +235 -0
- package/dist/src/tui/theme/data/matrix.json +77 -0
- package/dist/src/tui/theme/data/mercury.json +245 -0
- package/dist/src/tui/theme/data/monokai.json +221 -0
- package/dist/src/tui/theme/data/nightowl.json +221 -0
- package/dist/src/tui/theme/data/nord.json +223 -0
- package/dist/src/tui/theme/data/one-dark.json +84 -0
- package/dist/src/tui/theme/data/opencode.json +245 -0
- package/dist/src/tui/theme/data/orng.json +249 -0
- package/dist/src/tui/theme/data/osaka-jade.json +93 -0
- package/dist/src/tui/theme/data/palenight.json +222 -0
- package/dist/src/tui/theme/data/rosepine.json +234 -0
- package/dist/src/tui/theme/data/solarized.json +223 -0
- package/dist/src/tui/theme/data/synthwave84.json +226 -0
- package/dist/src/tui/theme/data/tokyonight.json +243 -0
- package/dist/src/tui/theme/data/vercel.json +245 -0
- package/dist/src/tui/theme/data/vesper.json +218 -0
- package/dist/src/tui/theme/data/zenburn.json +223 -0
- package/dist/src/tui/theme/default.d.ts +40 -0
- package/dist/src/tui/theme/default.d.ts.map +1 -0
- package/dist/src/tui/theme/default.js +35 -0
- package/dist/src/tui/theme/default.js.map +1 -0
- package/dist/src/tui/theme/resolver-utils.d.ts +28 -0
- package/dist/src/tui/theme/resolver-utils.d.ts.map +1 -0
- package/dist/src/tui/theme/resolver-utils.js +19 -0
- package/dist/src/tui/theme/resolver-utils.js.map +1 -0
- package/dist/src/tui/theme/themes.d.ts +3 -0
- package/dist/src/tui/theme/themes.d.ts.map +1 -0
- package/dist/src/tui/theme/themes.js +13 -0
- package/dist/src/tui/theme/themes.js.map +1 -0
- package/dist/src/tui/ui/Dialog.d.ts +19 -0
- package/dist/src/tui/ui/Dialog.d.ts.map +1 -0
- package/dist/src/tui/ui/Dialog.js +39 -0
- package/dist/src/tui/ui/Dialog.js.map +1 -0
- package/dist/src/tui/ui/DialogCommand.d.ts +2 -0
- package/dist/src/tui/ui/DialogCommand.d.ts.map +1 -0
- package/dist/src/tui/ui/DialogCommand.js +182 -0
- package/dist/src/tui/ui/DialogCommand.js.map +1 -0
- package/dist/src/tui/ui/DialogCreatePR.d.ts +2 -0
- package/dist/src/tui/ui/DialogCreatePR.d.ts.map +1 -0
- package/dist/src/tui/ui/DialogCreatePR.js +397 -0
- package/dist/src/tui/ui/DialogCreatePR.js.map +1 -0
- package/dist/src/tui/ui/DialogHelp.d.ts +6 -0
- package/dist/src/tui/ui/DialogHelp.d.ts.map +1 -0
- package/dist/src/tui/ui/DialogHelp.js +93 -0
- package/dist/src/tui/ui/DialogHelp.js.map +1 -0
- package/dist/src/tui/ui/DialogTheme.d.ts +2 -0
- package/dist/src/tui/ui/DialogTheme.d.ts.map +1 -0
- package/dist/src/tui/ui/DialogTheme.js +124 -0
- package/dist/src/tui/ui/DialogTheme.js.map +1 -0
- package/dist/src/tui/ui/index.d.ts +6 -0
- package/dist/src/tui/ui/index.d.ts.map +1 -0
- package/dist/src/tui/ui/index.js +6 -0
- package/dist/src/tui/ui/index.js.map +1 -0
- package/dist/src/tui/utils/prTemplates.d.ts +19 -0
- package/dist/src/tui/utils/prTemplates.d.ts.map +1 -0
- package/dist/src/tui/utils/prTemplates.js +46 -0
- package/dist/src/tui/utils/prTemplates.js.map +1 -0
- package/dist/test/ConfigService.test.d.ts +2 -0
- package/dist/test/ConfigService.test.d.ts.map +1 -0
- package/dist/test/ConfigService.test.js +40 -0
- package/dist/test/ConfigService.test.js.map +1 -0
- package/dist/test/ListBuilder.test.d.ts +2 -0
- package/dist/test/ListBuilder.test.d.ts.map +1 -0
- package/dist/test/ListBuilder.test.js +246 -0
- package/dist/test/ListBuilder.test.js.map +1 -0
- package/dist/test/MainList.test.d.ts +2 -0
- package/dist/test/MainList.test.d.ts.map +1 -0
- package/dist/test/MainList.test.js +228 -0
- package/dist/test/MainList.test.js.map +1 -0
- package/dist/test/Resolver.test.d.ts +2 -0
- package/dist/test/Resolver.test.d.ts.map +1 -0
- package/dist/test/Resolver.test.js +81 -0
- package/dist/test/Resolver.test.js.map +1 -0
- package/dist/test/Table.test.d.ts +2 -0
- package/dist/test/Table.test.d.ts.map +1 -0
- package/dist/test/Table.test.js +100 -0
- package/dist/test/Table.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { useTheme } from "../context/theme.js";
|
|
4
|
+
import { computeScrollTarget, resolveColumnLayout } from "./table-utils.js";
|
|
5
|
+
/**
|
|
6
|
+
* Reusable Table component for TUI
|
|
7
|
+
* @category components
|
|
8
|
+
*/
|
|
9
|
+
export function Table({ columns, data, hideHeader, keyExtractor, renderRow: _renderRow, selectedIndex }) {
|
|
10
|
+
const { theme } = useTheme();
|
|
11
|
+
const scrollRef = useRef(null);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (selectedIndex !== undefined && scrollRef.current) {
|
|
14
|
+
scrollRef.current.scrollTo({ x: 0, y: computeScrollTarget(selectedIndex) });
|
|
15
|
+
}
|
|
16
|
+
}, [selectedIndex]);
|
|
17
|
+
return (_jsxs("box", { flexDirection: "column", style: { flexGrow: 1 }, border: ["left"], borderColor: theme.primary, children: [!hideHeader && (_jsx("box", { flexDirection: "row", border: ["bottom"], borderColor: theme.textMuted, style: { width: "100%", paddingBottom: 0 }, children: columns.map((col, i) => (_jsx("box", { style: {
|
|
18
|
+
...resolveColumnLayout(col.width),
|
|
19
|
+
paddingRight: 1
|
|
20
|
+
}, children: _jsx("text", { fg: theme.textMuted, children: col.header }) }, i))) })), _jsx("scrollbox", { ref: scrollRef, style: {
|
|
21
|
+
flexGrow: 1,
|
|
22
|
+
width: "100%",
|
|
23
|
+
backgroundColor: theme.backgroundPanel
|
|
24
|
+
}, children: _jsx("box", { flexDirection: "column", style: { width: "100%" }, children: data.map((item, i) => {
|
|
25
|
+
const selected = i === selectedIndex;
|
|
26
|
+
return (_jsx("box", { flexDirection: "row", style: {
|
|
27
|
+
width: "100%",
|
|
28
|
+
paddingTop: 0,
|
|
29
|
+
paddingBottom: 1,
|
|
30
|
+
...(selected ? { backgroundColor: theme.selectedBackground } : {})
|
|
31
|
+
}, children: columns.map((col, j) => (_jsx("box", { style: {
|
|
32
|
+
width: (col.width === "auto" ? 0 : col.width),
|
|
33
|
+
flexGrow: col.width === "auto" || !col.width ? 1 : 0,
|
|
34
|
+
paddingRight: 1
|
|
35
|
+
}, children: col.render(item, selected) }, j))) }, keyExtractor(item)));
|
|
36
|
+
}) }) })] }));
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=Table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Table.js","sourceRoot":"","sources":["../../../../src/tui/components/Table.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAiB3E;;;GAGG;AACH,MAAM,UAAU,KAAK,CAAI,EACvB,OAAO,EACP,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,SAAS,EAAE,UAAU,EACrB,aAAa,EACC;IACd,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAA;IAC5B,MAAM,SAAS,GAAG,MAAM,CAAsB,IAAI,CAAC,CAAA;IAEnD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,aAAa,KAAK,SAAS,IAAI,SAAS,CAAC,OAAO,EAAE,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B,KAAK,EAAE;gCACL,KAAK,EAAE,MAAM;gCACb,UAAU,EAAE,CAAC;gCACb,aAAa,EAAE,CAAC;gCAChB,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,KAAK,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;6BACnE,YAEA,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CACvB,cAEE,KAAK,EAAE;oCACL,KAAK,EAAE,CAAC,GAAG,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAQ;oCACpD,QAAQ,EAAE,GAAG,CAAC,KAAK,KAAK,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oCACpD,YAAY,EAAE,CAAC;iCAChB,YAEA,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,IAPtB,CAAC,CAQF,CACP,CAAC,IApBG,YAAY,CAAC,IAAI,CAAC,CAqBnB,CACP,CAAA;oBACH,CAAC,CAAC,GACE,GACI,IACR,CACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { Badge } from "./Badge.js";
|
|
2
|
+
export { DetailsView } from "./DetailsView.js";
|
|
3
|
+
export { ErrorBoundary } from "./ErrorBoundary.js";
|
|
4
|
+
export { Footer } from "./Footer.js";
|
|
5
|
+
export { Header } from "./Header.js";
|
|
6
|
+
export { ListItemRow } from "./ListItemRow.js";
|
|
7
|
+
export { MainList } from "./MainList.js";
|
|
8
|
+
export { NotificationsTable } from "./NotificationsTable.js";
|
|
9
|
+
export { QuickFilters } from "./QuickFilters.js";
|
|
10
|
+
export { SettingsTable } from "./SettingsTable.js";
|
|
11
|
+
export { Spinner } from "./Spinner.js";
|
|
12
|
+
export { StatusRow } from "./StatusRow.js";
|
|
13
|
+
export { Table } from "./Table.js";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tui/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { Badge } from "./Badge.js";
|
|
2
|
+
export { DetailsView } from "./DetailsView.js";
|
|
3
|
+
export { ErrorBoundary } from "./ErrorBoundary.js";
|
|
4
|
+
export { Footer } from "./Footer.js";
|
|
5
|
+
export { Header } from "./Header.js";
|
|
6
|
+
export { ListItemRow } from "./ListItemRow.js";
|
|
7
|
+
export { MainList } from "./MainList.js";
|
|
8
|
+
export { NotificationsTable } from "./NotificationsTable.js";
|
|
9
|
+
export { QuickFilters } from "./QuickFilters.js";
|
|
10
|
+
export { SettingsTable } from "./SettingsTable.js";
|
|
11
|
+
export { Spinner } from "./Spinner.js";
|
|
12
|
+
export { StatusRow } from "./StatusRow.js";
|
|
13
|
+
export { Table } from "./Table.js";
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/tui/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helpers for MainList layout, filtering, and scroll position.
|
|
3
|
+
*
|
|
4
|
+
* Separated from MainList.tsx to avoid transitive React/OpenTUI deps in tests.
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
import type { ListItem } from "../ListBuilder.js";
|
|
9
|
+
export interface ParsedSettingsFilter {
|
|
10
|
+
readonly status: "all" | "on" | "off";
|
|
11
|
+
readonly name: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const parseSettingsFilter: (raw: string) => ParsedSettingsFilter;
|
|
14
|
+
export declare const applySettingsFilter: (items: ReadonlyArray<ListItem>, filter: string) => ReadonlyArray<ListItem>;
|
|
15
|
+
export declare const findStableIndex: (items: ReadonlyArray<ListItem>, view: string, selectedPrId: string | null, selectedIndex: number) => number;
|
|
16
|
+
export declare const findGroupHeader: (items: ReadonlyArray<ListItem>, index: number) => ListItem | null;
|
|
17
|
+
export interface ItemPosition {
|
|
18
|
+
readonly start: number;
|
|
19
|
+
readonly end: number;
|
|
20
|
+
}
|
|
21
|
+
export declare const computeItemPositions: (items: ReadonlyArray<ListItem>) => ReadonlyArray<ItemPosition>;
|
|
22
|
+
//# sourceMappingURL=mainlist-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mainlist-utils.d.ts","sourceRoot":"","sources":["../../../../src/tui/components/mainlist-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAEjD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAE,KAAK,GAAG,IAAI,GAAG,KAAK,CAAA;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED,eAAO,MAAM,mBAAmB,GAAI,KAAK,MAAM,KAAG,oBAKjD,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,OAAO,aAAa,CAAC,QAAQ,CAAC,EAAE,QAAQ,MAAM,KAAG,aAAa,CAAC,QAAQ,CAU1G,CAAA;AAED,eAAO,MAAM,eAAe,GAC1B,OAAO,aAAa,CAAC,QAAQ,CAAC,EAC9B,MAAM,MAAM,EACZ,cAAc,MAAM,GAAG,IAAI,EAC3B,eAAe,MAAM,KACpB,MAQF,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,OAAO,aAAa,CAAC,QAAQ,CAAC,EAAE,OAAO,MAAM,KAAG,QAAQ,GAAG,IAS1F,CAAA;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CACrB;AAED,eAAO,MAAM,oBAAoB,GAAI,OAAO,aAAa,CAAC,QAAQ,CAAC,KAAG,aAAa,CAAC,YAAY,CAkB/F,CAAA"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export const parseSettingsFilter = (raw) => {
|
|
2
|
+
const lower = raw.toLowerCase();
|
|
3
|
+
if (lower.startsWith("on:"))
|
|
4
|
+
return { status: "on", name: lower.slice(3) };
|
|
5
|
+
if (lower.startsWith("off:"))
|
|
6
|
+
return { status: "off", name: lower.slice(4) };
|
|
7
|
+
return { status: "all", name: lower };
|
|
8
|
+
};
|
|
9
|
+
export const applySettingsFilter = (items, filter) => {
|
|
10
|
+
if (!filter)
|
|
11
|
+
return items;
|
|
12
|
+
const { name, status } = parseSettingsFilter(filter);
|
|
13
|
+
return items.filter((item) => {
|
|
14
|
+
if (item.type !== "account")
|
|
15
|
+
return false;
|
|
16
|
+
if (status === "on" && !item.account.enabled)
|
|
17
|
+
return false;
|
|
18
|
+
if (status === "off" && item.account.enabled)
|
|
19
|
+
return false;
|
|
20
|
+
if (name && !item.account.profile.toLowerCase().includes(name))
|
|
21
|
+
return false;
|
|
22
|
+
return true;
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
export const findStableIndex = (items, view, selectedPrId, selectedIndex) => {
|
|
26
|
+
if ((view === "prs" || view === "details") && selectedPrId) {
|
|
27
|
+
const idx = items.findIndex((item) => item.type === "pr" && item.pr.id === selectedPrId);
|
|
28
|
+
if (idx !== -1)
|
|
29
|
+
return idx;
|
|
30
|
+
}
|
|
31
|
+
if (selectedIndex >= items.length)
|
|
32
|
+
return Math.max(0, items.length - 1);
|
|
33
|
+
if (selectedIndex < 0)
|
|
34
|
+
return 0;
|
|
35
|
+
return selectedIndex;
|
|
36
|
+
};
|
|
37
|
+
export const findGroupHeader = (items, index) => {
|
|
38
|
+
if (items.length === 0)
|
|
39
|
+
return null;
|
|
40
|
+
const clamped = Math.min(index, items.length - 1);
|
|
41
|
+
if (clamped < 0)
|
|
42
|
+
return null;
|
|
43
|
+
for (let i = clamped; i >= 0; i--) {
|
|
44
|
+
const item = items[i];
|
|
45
|
+
if (item && item.type === "header")
|
|
46
|
+
return item;
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
};
|
|
50
|
+
export const computeItemPositions = (items) => {
|
|
51
|
+
const positions = [];
|
|
52
|
+
let y = 0;
|
|
53
|
+
for (let i = 0; i < items.length; i++) {
|
|
54
|
+
const item = items[i];
|
|
55
|
+
if (!item)
|
|
56
|
+
continue;
|
|
57
|
+
const start = y;
|
|
58
|
+
let height = 2;
|
|
59
|
+
if (item.type === "header") {
|
|
60
|
+
height = i === 0 ? 2 : 3;
|
|
61
|
+
}
|
|
62
|
+
else if (item.type === "pr") {
|
|
63
|
+
const descLines = item.pr.description ? Math.min(item.pr.description.split("\n").length, 5) : 0;
|
|
64
|
+
height = 1 + 1 + descLines + 1 + 1;
|
|
65
|
+
}
|
|
66
|
+
y += height;
|
|
67
|
+
positions.push({ start, end: y });
|
|
68
|
+
}
|
|
69
|
+
return positions;
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=mainlist-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mainlist-utils.js","sourceRoot":"","sources":["../../../../src/tui/components/mainlist-utils.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,GAAW,EAAwB,EAAE;IACvE,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,EAAE,CAAA;IAC/B,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;IAC1E,IAAI,KAAK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AAC,CAAA;QACrB,IAAI,CAAC,IAAI;YAAE,SAAQ;QACnB,MAAM,KAAK,GAAG,CAAC,CAAA;QACf,IAAI,MAAM,GAAG,CAAC,CAAA;QACd,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC3B,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAC1B,CAAC;aAAM,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;YAC/F,MAAM,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,CAAC,GAAG,CAAC,CAAA;QACpC,CAAC;QACD,CAAC,IAAI,MAAM,CAAA;QACX,SAAS,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAA;IACnC,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helpers for Table layout and scroll calculations.
|
|
3
|
+
*
|
|
4
|
+
* Separated from Table.tsx to avoid transitive React/OpenTUI deps in tests.
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
/** Row height in lines: 1 content + 1 paddingBottom */
|
|
9
|
+
export declare const ROW_HEIGHT = 2;
|
|
10
|
+
/** Rows of context to keep visible above the selected row */
|
|
11
|
+
export declare const SCROLL_LEAD = 2;
|
|
12
|
+
/**
|
|
13
|
+
* Compute the scroll-Y target so `selectedIndex` is visible with SCROLL_LEAD
|
|
14
|
+
* rows of context above it.
|
|
15
|
+
*/
|
|
16
|
+
export declare const computeScrollTarget: (selectedIndex: number, rowHeight?: number, scrollLead?: number) => number;
|
|
17
|
+
/**
|
|
18
|
+
* Resolve a Column width spec to a concrete `width` and `flexGrow` pair
|
|
19
|
+
* suitable for the box layout engine.
|
|
20
|
+
*/
|
|
21
|
+
export declare const resolveColumnLayout: (width: number | `${number}%` | "auto" | undefined) => {
|
|
22
|
+
readonly width: number | `${number}%` | 0;
|
|
23
|
+
readonly flexGrow: 0 | 1;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=table-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-utils.d.ts","sourceRoot":"","sources":["../../../../src/tui/components/table-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,uDAAuD;AACvD,eAAO,MAAM,UAAU,IAAI,CAAA;AAE3B,6DAA6D;AAC7D,eAAO,MAAM,WAAW,IAAI,CAAA;AAE5B;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC9B,eAAe,MAAM,EACrB,YAAW,MAAmB,EAC9B,aAAY,MAAoB,KAC/B,MAA+D,CAAA;AAElE;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC9B,OAAO,MAAM,GAAG,GAAG,MAAM,GAAG,GAAG,MAAM,GAAG,SAAS,KAChD;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,MAAM,GAAG,GAAG,CAAC,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAA;CAGtE,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helpers for Table layout and scroll calculations.
|
|
3
|
+
*
|
|
4
|
+
* Separated from Table.tsx to avoid transitive React/OpenTUI deps in tests.
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
/** Row height in lines: 1 content + 1 paddingBottom */
|
|
9
|
+
export const ROW_HEIGHT = 2;
|
|
10
|
+
/** Rows of context to keep visible above the selected row */
|
|
11
|
+
export const SCROLL_LEAD = 2;
|
|
12
|
+
/**
|
|
13
|
+
* Compute the scroll-Y target so `selectedIndex` is visible with SCROLL_LEAD
|
|
14
|
+
* rows of context above it.
|
|
15
|
+
*/
|
|
16
|
+
export const computeScrollTarget = (selectedIndex, rowHeight = ROW_HEIGHT, scrollLead = SCROLL_LEAD) => Math.max(0, (selectedIndex - scrollLead) * rowHeight);
|
|
17
|
+
/**
|
|
18
|
+
* Resolve a Column width spec to a concrete `width` and `flexGrow` pair
|
|
19
|
+
* suitable for the box layout engine.
|
|
20
|
+
*/
|
|
21
|
+
export const resolveColumnLayout = (width) => ({
|
|
22
|
+
width: width === "auto" || !width ? 0 : width,
|
|
23
|
+
flexGrow: width === "auto" || !width ? 1 : 0
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=table-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-utils.js","sourceRoot":"","sources":["../../../../src/tui/components/table-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,uDAAuD;AACvD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAA;AAE3B,6DAA6D;AAC7D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAA;AAE5B;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,aAAqB,EACrB,YAAoB,UAAU,EAC9B,aAAqB,WAAW,EACxB,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,aAAa,GAAG,UAAU,CAAC,GAAG,SAAS,CAAC,CAAA;AAElE;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,KAAiD,EACwB,EAAE,CAAC,CAAC;IAC7E,KAAK,EAAE,KAAK,KAAK,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK;IAC7C,QAAQ,EAAE,KAAK,KAAK,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC7C,CAAC,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
type DialogElement = () => ReactNode;
|
|
3
|
+
interface DialogContextValue {
|
|
4
|
+
readonly current: DialogElement | null;
|
|
5
|
+
readonly show: (element: DialogElement) => void;
|
|
6
|
+
readonly hide: () => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Provides dialog stack management to child components
|
|
10
|
+
* @category context
|
|
11
|
+
*/
|
|
12
|
+
export declare function DialogProvider({ children }: {
|
|
13
|
+
readonly children: React.ReactNode;
|
|
14
|
+
}): ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Hook to access dialog management functions
|
|
17
|
+
* @category hooks
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* function MyComponent() {
|
|
21
|
+
* const dialog = useDialog()
|
|
22
|
+
* return (
|
|
23
|
+
* <box onMouseUp={() => dialog.show(() => <HelpModal />)}>
|
|
24
|
+
* <text>Show Help</text>
|
|
25
|
+
* </box>
|
|
26
|
+
* )
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function useDialog(): DialogContextValue;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../../src/tui/context/dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,KAAK,aAAa,GAAG,MAAM,SAAS,CAAA;AAEpC,UAAU,kBAAkB;IAC1B,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAAA;IACtC,QAAQ,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAA;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,CAAA;CAC1B;AAQD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,aAclF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,IAAI,kBAAkB,CAE9C"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@opentui/react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useState } from "react";
|
|
3
|
+
const DialogContext = createContext({
|
|
4
|
+
current: null,
|
|
5
|
+
show: () => { },
|
|
6
|
+
hide: () => { }
|
|
7
|
+
});
|
|
8
|
+
/**
|
|
9
|
+
* Provides dialog stack management to child components
|
|
10
|
+
* @category context
|
|
11
|
+
*/
|
|
12
|
+
export function DialogProvider({ children }) {
|
|
13
|
+
const [stack, setStack] = useState([]);
|
|
14
|
+
const show = useCallback((element) => {
|
|
15
|
+
setStack((s) => [...s, element]);
|
|
16
|
+
}, []);
|
|
17
|
+
const hide = useCallback(() => {
|
|
18
|
+
setStack((s) => s.slice(0, -1));
|
|
19
|
+
}, []);
|
|
20
|
+
const current = stack.length > 0 ? stack[stack.length - 1] : null;
|
|
21
|
+
return _jsx(DialogContext.Provider, { value: { current, show, hide }, children: children });
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Hook to access dialog management functions
|
|
25
|
+
* @category hooks
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* function MyComponent() {
|
|
29
|
+
* const dialog = useDialog()
|
|
30
|
+
* return (
|
|
31
|
+
* <box onMouseUp={() => dialog.show(() => <HelpModal />)}>
|
|
32
|
+
* <text>Show Help</text>
|
|
33
|
+
* </box>
|
|
34
|
+
* )
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export function useDialog() {
|
|
39
|
+
return useContext(DialogContext);
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../../../src/tui/context/dialog.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAUxE,MAAM,aAAa,GAAG,aAAa,CAAqB;IACtD,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;CACf,CAAC,CAAA;AAEF;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,QAAQ,EAA0C;IACjF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAuB,EAAE,CAAC,CAAA;IAE5D,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,OAAsB,EAAE,EAAE;QAClD,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAA;IAClC,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,EAAE;QAC5B,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;IACjC,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC,CAAC,CAAC,IAAI,CAAA;IAElE,OAAO,KAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,YAAG,QAAQ,GAA0B,CAAA;AACpG,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,SAAS;IACvB,OAAO,UAAU,CAAC,aAAa,CAAC,CAAA;AAClC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type Theme } from "../theme/default.js";
|
|
2
|
+
interface ThemeContextValue {
|
|
3
|
+
readonly theme: Theme;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Provides theme context to child components
|
|
7
|
+
* @category context
|
|
8
|
+
*/
|
|
9
|
+
export declare function ThemeProvider({ children }: {
|
|
10
|
+
readonly children: React.ReactNode;
|
|
11
|
+
}): import("react").ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Hook to access current theme
|
|
14
|
+
* @category hooks
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* function MyComponent() {
|
|
18
|
+
* const { theme } = useTheme()
|
|
19
|
+
* return <text fg={theme.text}>Hello</text>
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function useTheme(): ThemeContextValue;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../src/tui/context/theme.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAgB,KAAK,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAG9D,UAAU,iBAAiB;IACzB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;CACtB;AAID;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,6BAKjF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,IAAI,iBAAiB,CAE5C"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@opentui/react/jsx-runtime";
|
|
2
|
+
import { useAtomValue } from "@effect-atom/atom-react";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
import { themeAtom } from "../atoms/ui.js";
|
|
5
|
+
import { defaultTheme } from "../theme/default.js";
|
|
6
|
+
import { themes } from "../theme/themes.js";
|
|
7
|
+
const ThemeContext = createContext({ theme: defaultTheme });
|
|
8
|
+
/**
|
|
9
|
+
* Provides theme context to child components
|
|
10
|
+
* @category context
|
|
11
|
+
*/
|
|
12
|
+
export function ThemeProvider({ children }) {
|
|
13
|
+
const themeId = useAtomValue(themeAtom);
|
|
14
|
+
const theme = themes[themeId] ?? defaultTheme;
|
|
15
|
+
return _jsx(ThemeContext.Provider, { value: { theme }, children: children });
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Hook to access current theme
|
|
19
|
+
* @category hooks
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* function MyComponent() {
|
|
23
|
+
* const { theme } = useTheme()
|
|
24
|
+
* return <text fg={theme.text}>Hello</text>
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export function useTheme() {
|
|
29
|
+
return useContext(ThemeContext);
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../../../src/tui/context/theme.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAc,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAM3C,MAAM,YAAY,GAAG,aAAa,CAAoB,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAA;AAE9E;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,EAAE,QAAQ,EAA0C;IAChF,MAAM,OAAO,GAAG,YAAY,CAAC,SAAS,CAAC,CAAA;IACvC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,YAAY,CAAA;IAE7C,OAAO,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,YAAG,QAAQ,GAAyB,CAAA;AACpF,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,QAAQ;IACtB,OAAO,UAAU,CAAC,YAAY,CAAC,CAAA;AACjC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tui/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/tui/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Domain } from "@knpkv/codecommit-core";
|
|
2
|
+
interface UseKeyboardNavOptions {
|
|
3
|
+
readonly onQuit: () => void;
|
|
4
|
+
readonly onOpenInBrowser?: (pr: Domain.PullRequest) => void;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Keyboard navigation hook for the TUI
|
|
8
|
+
* Handles global keybindings for view switching, filtering, help, etc.
|
|
9
|
+
* @category hooks
|
|
10
|
+
*/
|
|
11
|
+
export declare function useKeyboardNav({ onOpenInBrowser, onQuit }: UseKeyboardNavOptions): {
|
|
12
|
+
view: import("../atoms/ui.js").TuiView;
|
|
13
|
+
isFiltering: boolean;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=useKeyboardNav.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useKeyboardNav.d.ts","sourceRoot":"","sources":["../../../../src/tui/hooks/useKeyboardNav.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAqCpD,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAA;IAC3B,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,WAAW,KAAK,IAAI,CAAA;CAC5D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,qBAAqB;;;EAmahF"}
|