@detergent-software/atk 3.0.0 → 5.0.0-dev.1
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 +361 -0
- package/build/commands/_app.d.ts.map +1 -1
- package/build/commands/_app.js +23 -3
- package/build/commands/_app.js.map +1 -1
- package/build/commands/audit.d.ts.map +1 -1
- package/build/commands/audit.js +76 -37
- package/build/commands/audit.js.map +1 -1
- package/build/commands/browse.d.ts.map +1 -1
- package/build/commands/browse.js +126 -154
- package/build/commands/browse.js.map +1 -1
- package/build/commands/cache.d.ts.map +1 -1
- package/build/commands/cache.js +13 -15
- package/build/commands/cache.js.map +1 -1
- package/build/commands/config.d.ts +1 -1
- package/build/commands/config.d.ts.map +1 -1
- package/build/commands/config.js +7 -3
- package/build/commands/config.js.map +1 -1
- package/build/commands/diff.d.ts.map +1 -1
- package/build/commands/diff.js +4 -117
- package/build/commands/diff.js.map +1 -1
- package/build/commands/freeze.d.ts +1 -2
- package/build/commands/freeze.d.ts.map +1 -1
- package/build/commands/freeze.js +17 -37
- package/build/commands/freeze.js.map +1 -1
- package/build/commands/info.d.ts +1 -2
- package/build/commands/info.d.ts.map +1 -1
- package/build/commands/info.js +43 -38
- package/build/commands/info.js.map +1 -1
- package/build/commands/init.d.ts.map +1 -1
- package/build/commands/init.js +41 -414
- package/build/commands/init.js.map +1 -1
- package/build/commands/install.d.ts.map +1 -1
- package/build/commands/install.js +79 -72
- package/build/commands/install.js.map +1 -1
- package/build/commands/list.d.ts +2 -2
- package/build/commands/list.d.ts.map +1 -1
- package/build/commands/list.js +138 -27
- package/build/commands/list.js.map +1 -1
- package/build/commands/outdated.d.ts.map +1 -1
- package/build/commands/outdated.js +20 -10
- package/build/commands/outdated.js.map +1 -1
- package/build/commands/pin.d.ts +1 -2
- package/build/commands/pin.d.ts.map +1 -1
- package/build/commands/pin.js +44 -47
- package/build/commands/pin.js.map +1 -1
- package/build/commands/prune.d.ts.map +1 -1
- package/build/commands/prune.js +76 -151
- package/build/commands/prune.js.map +1 -1
- package/build/commands/publish.d.ts +4 -1
- package/build/commands/publish.d.ts.map +1 -1
- package/build/commands/publish.js +139 -388
- package/build/commands/publish.js.map +1 -1
- package/build/commands/search.d.ts.map +1 -1
- package/build/commands/search.js +14 -19
- package/build/commands/search.js.map +1 -1
- package/build/commands/setup.d.ts +1 -1
- package/build/commands/setup.d.ts.map +1 -1
- package/build/commands/setup.js +48 -253
- package/build/commands/setup.js.map +1 -1
- package/build/commands/sync.d.ts.map +1 -1
- package/build/commands/sync.js +43 -169
- package/build/commands/sync.js.map +1 -1
- package/build/commands/thaw.d.ts +1 -2
- package/build/commands/thaw.d.ts.map +1 -1
- package/build/commands/thaw.js +19 -37
- package/build/commands/thaw.js.map +1 -1
- package/build/commands/uninstall.d.ts.map +1 -1
- package/build/commands/uninstall.js +106 -221
- package/build/commands/uninstall.js.map +1 -1
- package/build/commands/unpin.d.ts +1 -2
- package/build/commands/unpin.d.ts.map +1 -1
- package/build/commands/unpin.js +23 -38
- package/build/commands/unpin.js.map +1 -1
- package/build/commands/update.d.ts.map +1 -1
- package/build/commands/update.js +57 -54
- package/build/commands/update.js.map +1 -1
- package/build/commands/why.d.ts +1 -1
- package/build/commands/why.d.ts.map +1 -1
- package/build/commands/why.js +14 -6
- package/build/commands/why.js.map +1 -1
- package/build/components/AssetDetail.d.ts +1 -3
- package/build/components/AssetDetail.d.ts.map +1 -1
- package/build/components/AssetDetail.js +22 -21
- package/build/components/AssetDetail.js.map +1 -1
- package/build/components/AssetTable.d.ts +5 -2
- package/build/components/AssetTable.d.ts.map +1 -1
- package/build/components/AssetTable.js +37 -40
- package/build/components/AssetTable.js.map +1 -1
- package/build/components/AssetVersionLine.d.ts +27 -0
- package/build/components/AssetVersionLine.d.ts.map +1 -0
- package/build/components/AssetVersionLine.js +10 -0
- package/build/components/AssetVersionLine.js.map +1 -0
- package/build/components/BrowseExpandedBundle.d.ts +10 -1
- package/build/components/BrowseExpandedBundle.d.ts.map +1 -1
- package/build/components/BrowseExpandedBundle.js +28 -3
- package/build/components/BrowseExpandedBundle.js.map +1 -1
- package/build/components/BrowseExpandedRow.d.ts +9 -1
- package/build/components/BrowseExpandedRow.d.ts.map +1 -1
- package/build/components/BrowseExpandedRow.js +35 -3
- package/build/components/BrowseExpandedRow.js.map +1 -1
- package/build/components/BrowseList.d.ts +5 -1
- package/build/components/BrowseList.d.ts.map +1 -1
- package/build/components/BrowseList.js +57 -47
- package/build/components/BrowseList.js.map +1 -1
- package/build/components/BundleDetail.d.ts +2 -1
- package/build/components/BundleDetail.d.ts.map +1 -1
- package/build/components/BundleDetail.js +3 -2
- package/build/components/BundleDetail.js.map +1 -1
- package/build/components/DiffView.d.ts +0 -2
- package/build/components/DiffView.d.ts.map +1 -1
- package/build/components/DiffView.js +11 -5
- package/build/components/DiffView.js.map +1 -1
- package/build/components/DryRunBanner.d.ts +3 -3
- package/build/components/DryRunBanner.d.ts.map +1 -1
- package/build/components/DryRunBanner.js +2 -2
- package/build/components/DryRunBanner.js.map +1 -1
- package/build/components/FilterBar.d.ts +10 -3
- package/build/components/FilterBar.d.ts.map +1 -1
- package/build/components/FilterBar.js +4 -4
- package/build/components/FilterBar.js.map +1 -1
- package/build/components/FrozenSkippedHint.d.ts +11 -0
- package/build/components/FrozenSkippedHint.d.ts.map +1 -0
- package/build/components/FrozenSkippedHint.js +12 -0
- package/build/components/FrozenSkippedHint.js.map +1 -0
- package/build/components/HelpBar.d.ts.map +1 -1
- package/build/components/HelpBar.js +3 -3
- package/build/components/HelpBar.js.map +1 -1
- package/build/components/InitSuccess.d.ts +5 -0
- package/build/components/InitSuccess.d.ts.map +1 -0
- package/build/components/InitSuccess.js +20 -0
- package/build/components/InitSuccess.js.map +1 -0
- package/build/components/InstallSummary.d.ts +3 -3
- package/build/components/InstallSummary.d.ts.map +1 -1
- package/build/components/InstallSummary.js +2 -2
- package/build/components/InstallSummary.js.map +1 -1
- package/build/components/Link.d.ts +7 -0
- package/build/components/Link.d.ts.map +1 -0
- package/build/components/Link.js +6 -0
- package/build/components/Link.js.map +1 -0
- package/build/components/ListActionBar.d.ts +11 -0
- package/build/components/ListActionBar.d.ts.map +1 -0
- package/build/components/ListActionBar.js +30 -0
- package/build/components/ListActionBar.js.map +1 -0
- package/build/components/ListBrowseList.d.ts +27 -0
- package/build/components/ListBrowseList.d.ts.map +1 -0
- package/build/components/ListBrowseList.js +57 -0
- package/build/components/ListBrowseList.js.map +1 -0
- package/build/components/ListExpandedRow.d.ts +38 -0
- package/build/components/ListExpandedRow.d.ts.map +1 -0
- package/build/components/ListExpandedRow.js +49 -0
- package/build/components/ListExpandedRow.js.map +1 -0
- package/build/components/ListHelpBar.d.ts +19 -0
- package/build/components/ListHelpBar.d.ts.map +1 -0
- package/build/components/ListHelpBar.js +11 -0
- package/build/components/ListHelpBar.js.map +1 -0
- package/build/components/OrphanListItem.d.ts +15 -0
- package/build/components/OrphanListItem.d.ts.map +1 -0
- package/build/components/OrphanListItem.js +6 -0
- package/build/components/OrphanListItem.js.map +1 -0
- package/build/components/PromptField.d.ts +19 -0
- package/build/components/PromptField.d.ts.map +1 -0
- package/build/components/PromptField.js +7 -0
- package/build/components/PromptField.js.map +1 -0
- package/build/components/SkippedAssetSection.d.ts +35 -0
- package/build/components/SkippedAssetSection.d.ts.map +1 -0
- package/build/components/SkippedAssetSection.js +15 -0
- package/build/components/SkippedAssetSection.js.map +1 -0
- package/build/components/StatusBadge.d.ts +1 -1
- package/build/components/StatusBadge.d.ts.map +1 -1
- package/build/components/StatusBadge.js +4 -0
- package/build/components/StatusBadge.js.map +1 -1
- package/build/components/SyncAllInSync.d.ts +14 -0
- package/build/components/SyncAllInSync.d.ts.map +1 -0
- package/build/components/SyncAllInSync.js +10 -0
- package/build/components/SyncAllInSync.js.map +1 -0
- package/build/components/SyncDriftedList.d.ts +24 -0
- package/build/components/SyncDriftedList.d.ts.map +1 -0
- package/build/components/SyncDriftedList.js +17 -0
- package/build/components/SyncDriftedList.js.map +1 -0
- package/build/components/SyncNoAssets.d.ts +12 -0
- package/build/components/SyncNoAssets.d.ts.map +1 -0
- package/build/components/SyncNoAssets.js +9 -0
- package/build/components/SyncNoAssets.js.map +1 -0
- package/build/components/index.d.ts +16 -2
- package/build/components/index.d.ts.map +1 -1
- package/build/components/index.js +16 -2
- package/build/components/index.js.map +1 -1
- package/build/hooks/useBrowseState.d.ts +44 -1
- package/build/hooks/useBrowseState.d.ts.map +1 -1
- package/build/hooks/useBrowseState.js +148 -13
- package/build/hooks/useBrowseState.js.map +1 -1
- package/build/hooks/useConfirmation.d.ts +18 -0
- package/build/hooks/useConfirmation.d.ts.map +1 -0
- package/build/hooks/useConfirmation.js +56 -0
- package/build/hooks/useConfirmation.js.map +1 -0
- package/build/hooks/useInitState.d.ts +109 -0
- package/build/hooks/useInitState.d.ts.map +1 -0
- package/build/hooks/useInitState.js +474 -0
- package/build/hooks/useInitState.js.map +1 -0
- package/build/hooks/useListActions.d.ts +15 -0
- package/build/hooks/useListActions.d.ts.map +1 -0
- package/build/hooks/useListActions.js +155 -0
- package/build/hooks/useListActions.js.map +1 -0
- package/build/hooks/useListState.d.ts +151 -0
- package/build/hooks/useListState.d.ts.map +1 -0
- package/build/hooks/useListState.js +448 -0
- package/build/hooks/useListState.js.map +1 -0
- package/build/hooks/usePruneState.d.ts +76 -0
- package/build/hooks/usePruneState.d.ts.map +1 -0
- package/build/hooks/usePruneState.js +252 -0
- package/build/hooks/usePruneState.js.map +1 -0
- package/build/hooks/usePublishState.d.ts +147 -0
- package/build/hooks/usePublishState.d.ts.map +1 -0
- package/build/hooks/usePublishState.js +916 -0
- package/build/hooks/usePublishState.js.map +1 -0
- package/build/hooks/useSetupState.d.ts +57 -0
- package/build/hooks/useSetupState.d.ts.map +1 -0
- package/build/hooks/useSetupState.js +236 -0
- package/build/hooks/useSetupState.js.map +1 -0
- package/build/hooks/useUninstallState.d.ts +102 -0
- package/build/hooks/useUninstallState.d.ts.map +1 -0
- package/build/hooks/useUninstallState.js +342 -0
- package/build/hooks/useUninstallState.js.map +1 -0
- package/build/lib/adapter.d.ts +21 -0
- package/build/lib/adapter.d.ts.map +1 -1
- package/build/lib/adapter.js +59 -1
- package/build/lib/adapter.js.map +1 -1
- package/build/lib/checksum.d.ts +39 -0
- package/build/lib/checksum.d.ts.map +1 -1
- package/build/lib/checksum.js +98 -13
- package/build/lib/checksum.js.map +1 -1
- package/build/lib/config.d.ts +38 -18
- package/build/lib/config.d.ts.map +1 -1
- package/build/lib/config.js +103 -55
- package/build/lib/config.js.map +1 -1
- package/build/lib/detector.d.ts +2 -11
- package/build/lib/detector.d.ts.map +1 -1
- package/build/lib/detector.js +2 -64
- package/build/lib/detector.js.map +1 -1
- package/build/lib/diagnostics.d.ts +7 -0
- package/build/lib/diagnostics.d.ts.map +1 -1
- package/build/lib/diagnostics.js +54 -34
- package/build/lib/diagnostics.js.map +1 -1
- package/build/lib/diff-command.d.ts +40 -0
- package/build/lib/diff-command.d.ts.map +1 -0
- package/build/lib/diff-command.js +145 -0
- package/build/lib/diff-command.js.map +1 -0
- package/build/lib/diff.d.ts +7 -0
- package/build/lib/diff.d.ts.map +1 -1
- package/build/lib/diff.js +15 -10
- package/build/lib/diff.js.map +1 -1
- package/build/lib/format.d.ts +6 -0
- package/build/lib/format.d.ts.map +1 -0
- package/build/lib/format.js +18 -0
- package/build/lib/format.js.map +1 -0
- package/build/lib/github.d.ts +35 -0
- package/build/lib/github.d.ts.map +1 -1
- package/build/lib/github.js +44 -0
- package/build/lib/github.js.map +1 -1
- package/build/lib/gitignore.d.ts +17 -0
- package/build/lib/gitignore.d.ts.map +1 -1
- package/build/lib/gitignore.js +17 -1
- package/build/lib/gitignore.js.map +1 -1
- package/build/lib/init.d.ts +22 -0
- package/build/lib/init.d.ts.map +1 -1
- package/build/lib/init.js +163 -18
- package/build/lib/init.js.map +1 -1
- package/build/lib/installer.d.ts +1 -0
- package/build/lib/installer.d.ts.map +1 -1
- package/build/lib/installer.js +7 -7
- package/build/lib/installer.js.map +1 -1
- package/build/lib/lockfile.d.ts +19 -17
- package/build/lib/lockfile.d.ts.map +1 -1
- package/build/lib/lockfile.js +45 -68
- package/build/lib/lockfile.js.map +1 -1
- package/build/lib/publisher.d.ts +41 -12
- package/build/lib/publisher.d.ts.map +1 -1
- package/build/lib/publisher.js +226 -64
- package/build/lib/publisher.js.map +1 -1
- package/build/lib/registry.d.ts +20 -5
- package/build/lib/registry.d.ts.map +1 -1
- package/build/lib/registry.js +45 -33
- package/build/lib/registry.js.map +1 -1
- package/build/lib/sanitize.d.ts +25 -0
- package/build/lib/sanitize.d.ts.map +1 -0
- package/build/lib/sanitize.js +61 -0
- package/build/lib/sanitize.js.map +1 -0
- package/build/lib/schemas/config.d.ts +31 -3
- package/build/lib/schemas/config.d.ts.map +1 -1
- package/build/lib/schemas/config.js +21 -2
- package/build/lib/schemas/config.js.map +1 -1
- package/build/lib/schemas/index.d.ts +1 -1
- package/build/lib/schemas/index.d.ts.map +1 -1
- package/build/lib/schemas/index.js +1 -1
- package/build/lib/schemas/index.js.map +1 -1
- package/build/lib/schemas/lockfile.d.ts +20 -4
- package/build/lib/schemas/lockfile.d.ts.map +1 -1
- package/build/lib/schemas/lockfile.js +7 -1
- package/build/lib/schemas/lockfile.js.map +1 -1
- package/build/lib/schemas/manifest.d.ts +1 -1
- package/build/lib/schemas/manifest.d.ts.map +1 -1
- package/build/lib/schemas/manifest.js +7 -2
- package/build/lib/schemas/manifest.js.map +1 -1
- package/build/lib/schemas/registry.d.ts +2 -4
- package/build/lib/schemas/registry.d.ts.map +1 -1
- package/build/lib/schemas/registry.js +1 -1
- package/build/lib/schemas/registry.js.map +1 -1
- package/build/lib/search.d.ts +15 -1
- package/build/lib/search.d.ts.map +1 -1
- package/build/lib/search.js +65 -65
- package/build/lib/search.js.map +1 -1
- package/build/lib/setup.d.ts +28 -0
- package/build/lib/setup.d.ts.map +1 -0
- package/build/lib/setup.js +98 -0
- package/build/lib/setup.js.map +1 -0
- package/build/lib/sync.d.ts +109 -0
- package/build/lib/sync.d.ts.map +1 -0
- package/build/lib/sync.js +217 -0
- package/build/lib/sync.js.map +1 -0
- package/build/lib/tool-resolver.d.ts +29 -6
- package/build/lib/tool-resolver.d.ts.map +1 -1
- package/build/lib/tool-resolver.js +54 -15
- package/build/lib/tool-resolver.js.map +1 -1
- package/build/lib/updater.d.ts +7 -4
- package/build/lib/updater.d.ts.map +1 -1
- package/build/lib/updater.js +10 -6
- package/build/lib/updater.js.map +1 -1
- package/build/lib/version.js +1 -1
- package/build/lib/version.js.map +1 -1
- package/package.json +79 -65
- package/tool-adapters/claude-code.json +1 -1
- package/tool-adapters/copilot-cli.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssetTable.d.ts","sourceRoot":"","sources":["../../src/components/AssetTable.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AssetTable.d.ts","sourceRoot":"","sources":["../../src/components/AssetTable.tsx"],"names":[],"mappings":"AAMA,UAAU,QAAQ;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,eAAe;IACvB,qCAAqC;IACrC,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB,iEAAiE;IACjE,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,KAAK,UAAU,GAAG,aAAa,GAAG,OAAO,GAAG,WAAW,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AA4BzG;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,UAAiB,EAAE,EAAE,eAAe,2CA8EtG"}
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text, useStdout } from 'ink';
|
|
3
3
|
import { getBreakpoint } from '../lib/breakpoints.js';
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { formatDate } from '../lib/format.js';
|
|
5
|
+
import Link from './Link.js';
|
|
6
|
+
const DEFAULT_COLUMNS = ['name', 'org', 'type', 'version', 'description'];
|
|
6
7
|
/** Per-breakpoint fixed widths for columns. Columns absent from a breakpoint's map are hidden. */
|
|
7
8
|
const RESPONSIVE_WIDTHS = {
|
|
8
|
-
medium: { files: 8, name:
|
|
9
|
-
narrow: { files: 8, name:
|
|
10
|
-
wide: { files: 8, name:
|
|
9
|
+
medium: { files: 8, installed: 14, name: 30, org: 16, readme: 18, type: 14, version: 10 },
|
|
10
|
+
narrow: { files: 8, installed: 14, name: 30, readme: 18, version: 10 },
|
|
11
|
+
wide: { files: 8, installed: 14, name: 40, org: 20, readme: 18, type: 18, version: 10 },
|
|
11
12
|
};
|
|
12
13
|
/** Columns that flex to fill remaining space — never hidden by breakpoint. */
|
|
13
|
-
const FLEX_COLUMNS = new Set(['description'
|
|
14
|
+
const FLEX_COLUMNS = new Set(['description']);
|
|
15
|
+
/** Maximum widths for flex columns. When set, the column is capped at this width instead of growing unbounded. */
|
|
16
|
+
const MAX_FLEX_WIDTHS = {};
|
|
14
17
|
const COLUMN_LABELS = {
|
|
15
18
|
description: 'Description',
|
|
16
19
|
files: 'Files',
|
|
17
20
|
installed: 'Installed',
|
|
18
21
|
name: 'Name',
|
|
22
|
+
org: 'Org',
|
|
23
|
+
readme: 'README',
|
|
19
24
|
type: 'Type',
|
|
20
25
|
version: 'Version',
|
|
21
26
|
};
|
|
@@ -23,7 +28,7 @@ const COLUMN_LABELS = {
|
|
|
23
28
|
* Table display for asset lists — used by search, list, and outdated commands.
|
|
24
29
|
* Supports configurable column sets and responsive breakpoints.
|
|
25
30
|
*/
|
|
26
|
-
export default function AssetTable({ assets, columns: columnsProp }) {
|
|
31
|
+
export default function AssetTable({ assets, columns: columnsProp, showHeader = true }) {
|
|
27
32
|
const { stdout } = useStdout();
|
|
28
33
|
const terminalWidth = stdout?.columns ?? 120;
|
|
29
34
|
const bp = getBreakpoint(terminalWidth);
|
|
@@ -31,7 +36,7 @@ export default function AssetTable({ assets, columns: columnsProp }) {
|
|
|
31
36
|
const requestedColumns = columnsProp ?? DEFAULT_COLUMNS;
|
|
32
37
|
// Filter to only columns visible at this breakpoint (has a fixed width OR is a flex column)
|
|
33
38
|
const columns = requestedColumns.filter((col) => FLEX_COLUMNS.has(col) || col in widthMap);
|
|
34
|
-
// Find the last flex column — it gets flexGrow={1}
|
|
39
|
+
// Find the last flex column — it gets flexGrow={1} (unless all flex columns have max widths)
|
|
35
40
|
let lastFlexIndex = -1;
|
|
36
41
|
for (let i = columns.length - 1; i >= 0; i--) {
|
|
37
42
|
if (FLEX_COLUMNS.has(columns[i])) {
|
|
@@ -39,38 +44,26 @@ export default function AssetTable({ assets, columns: columnsProp }) {
|
|
|
39
44
|
break;
|
|
40
45
|
}
|
|
41
46
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}) }, `${asset.type}/${asset.name}`)))] }));
|
|
61
|
-
}
|
|
62
|
-
function formatDate(isoString) {
|
|
63
|
-
try {
|
|
64
|
-
const date = new Date(isoString);
|
|
65
|
-
return date.toLocaleDateString('en-US', {
|
|
66
|
-
day: 'numeric',
|
|
67
|
-
month: 'short',
|
|
68
|
-
year: 'numeric',
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
catch {
|
|
72
|
-
return isoString;
|
|
47
|
+
// Compute fixed column width sum for capping flex columns with MAX_FLEX_WIDTHS
|
|
48
|
+
const fixedWidthSum = columns.reduce((sum, col) => sum + (widthMap[col] ?? 0), 0);
|
|
49
|
+
const remainingSpace = terminalWidth - fixedWidthSum;
|
|
50
|
+
function renderColumnBox(col, i, children, key) {
|
|
51
|
+
const width = widthMap[col];
|
|
52
|
+
if (width !== undefined) {
|
|
53
|
+
return (_jsx(Box, { flexShrink: 0, width: width, children: children }, key));
|
|
54
|
+
}
|
|
55
|
+
if (i === lastFlexIndex) {
|
|
56
|
+
// Last flex column: cap at MAX_FLEX_WIDTHS if defined, otherwise flexGrow
|
|
57
|
+
const maxWidth = MAX_FLEX_WIDTHS[col];
|
|
58
|
+
if (maxWidth !== undefined) {
|
|
59
|
+
return (_jsx(Box, { flexShrink: 0, overflow: 'hidden', width: Math.min(remainingSpace, maxWidth), children: children }, key));
|
|
60
|
+
}
|
|
61
|
+
return (_jsx(Box, { flexGrow: 1, overflow: 'hidden', children: children }, key));
|
|
62
|
+
}
|
|
63
|
+
// Non-last flex column: auto-sized to content
|
|
64
|
+
return _jsx(Box, { children: children }, key);
|
|
73
65
|
}
|
|
66
|
+
return (_jsxs(Box, { flexDirection: 'column', children: [showHeader && (_jsx(Box, { children: columns.map((col, i) => renderColumnBox(col, i, _jsx(Text, { bold: true, underline: true, wrap: 'truncate', children: COLUMN_LABELS[col] }), col)) })), assets.map((asset) => (_jsx(Box, { children: columns.map((col, i) => renderColumnBox(col, i, renderCell(col, asset), col)) }, `${asset.type}/${asset.name}`)))] }));
|
|
74
67
|
}
|
|
75
68
|
function renderCell(column, asset) {
|
|
76
69
|
switch (column) {
|
|
@@ -81,7 +74,11 @@ function renderCell(column, asset) {
|
|
|
81
74
|
case 'installed':
|
|
82
75
|
return (_jsx(Text, { dimColor: true, wrap: 'truncate', children: formatDate(asset.installedAt ?? '') }));
|
|
83
76
|
case 'name':
|
|
84
|
-
return (_jsx(Text, { color: 'cyan', wrap: 'truncate', children:
|
|
77
|
+
return (_jsx(Text, { color: 'cyan', wrap: 'truncate', children: asset.name }));
|
|
78
|
+
case 'org':
|
|
79
|
+
return (_jsx(Text, { dimColor: true, wrap: 'truncate', children: asset.org ? `@${asset.org}` : '' }));
|
|
80
|
+
case 'readme':
|
|
81
|
+
return asset.readmeUrl ? _jsx(Link, { url: asset.readmeUrl, children: "view on GitHub" }) : _jsx(Text, {});
|
|
85
82
|
case 'type':
|
|
86
83
|
return _jsx(Text, { wrap: 'truncate', children: asset.type });
|
|
87
84
|
case 'version':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssetTable.js","sourceRoot":"","sources":["../../src/components/AssetTable.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAE3C,OAAO,EAAmB,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"AssetTable.js","sourceRoot":"","sources":["../../src/components/AssetTable.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAE3C,OAAO,EAAmB,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,IAAI,MAAM,WAAW,CAAC;AA0B7B,MAAM,eAAe,GAAiB,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;AAExF,kGAAkG;AAClG,MAAM,iBAAiB,GAA4D;IACjF,MA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,CAAC,CAAC,CAAC,EAAE,IACjD,CACR,CAAC;QACJ;YACE,OAAO,KAAC,IAAI,oBAAS,CAAC;IAC1B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
interface AssetVersionLineBadge {
|
|
2
|
+
/** Ink color for the badge */
|
|
3
|
+
color: string;
|
|
4
|
+
/** Badge label text (e.g., "frozen", "pinned") */
|
|
5
|
+
text: string;
|
|
6
|
+
}
|
|
7
|
+
interface AssetVersionLineProps {
|
|
8
|
+
/** Optional badge rendered after the version transition */
|
|
9
|
+
badge?: AssetVersionLineBadge;
|
|
10
|
+
/** When true, both version numbers render with dimColor instead of red/green */
|
|
11
|
+
dimVersions?: boolean;
|
|
12
|
+
/** Currently installed version */
|
|
13
|
+
installedVersion: string;
|
|
14
|
+
/** Target/latest version */
|
|
15
|
+
latestVersion: string;
|
|
16
|
+
/** Asset name */
|
|
17
|
+
name: string;
|
|
18
|
+
/** Asset type (e.g., "skill", "rule") */
|
|
19
|
+
type: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Renders a single asset version transition line:
|
|
23
|
+
* name (type) vOld → vNew [badge]
|
|
24
|
+
*/
|
|
25
|
+
export default function AssetVersionLine({ badge, dimVersions, installedVersion, latestVersion, name, type, }: AssetVersionLineProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=AssetVersionLine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssetVersionLine.d.ts","sourceRoot":"","sources":["../../src/components/AssetVersionLine.tsx"],"names":[],"mappings":"AAEA,UAAU,qBAAqB;IAC7B,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,qBAAqB;IAC7B,2DAA2D;IAC3D,KAAK,CAAC,EAAE,qBAAqB,CAAC;IAC9B,gFAAgF;IAChF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kCAAkC;IAClC,gBAAgB,EAAE,MAAM,CAAC;IACzB,4BAA4B;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,KAAK,EACL,WAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,IAAI,EACJ,IAAI,GACL,EAAE,qBAAqB,2CAkBvB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from 'ink';
|
|
3
|
+
/**
|
|
4
|
+
* Renders a single asset version transition line:
|
|
5
|
+
* name (type) vOld → vNew [badge]
|
|
6
|
+
*/
|
|
7
|
+
export default function AssetVersionLine({ badge, dimVersions = false, installedVersion, latestVersion, name, type, }) {
|
|
8
|
+
return (_jsxs(Text, { children: [' ', _jsx(Text, { bold: true, children: name }), _jsxs(Text, { dimColor: true, children: [" (", type, ")"] }), ' ', dimVersions ? _jsxs(Text, { dimColor: true, children: ["v", installedVersion] }) : _jsxs(Text, { color: 'red', children: ["v", installedVersion] }), dimVersions ? (_jsxs(Text, { dimColor: true, children: [" \u2192 v", latestVersion] })) : (_jsxs(_Fragment, { children: [' → ', _jsxs(Text, { color: 'green', children: ["v", latestVersion] })] })), badge && _jsxs(Text, { color: badge.color, children: [" [", badge.text, "]"] })] }));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=AssetVersionLine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AssetVersionLine.js","sourceRoot":"","sources":["../../src/components/AssetVersionLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAwB3B;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,KAAK,EACL,WAAW,GAAG,KAAK,EACnB,gBAAgB,EAChB,aAAa,EACb,IAAI,EACJ,IAAI,GACkB;IACtB,OAAO,CACL,MAAC,IAAI,eACF,IAAI,EACL,KAAC,IAAI,IAAC,IAAI,kBAAE,IAAI,GAAQ,EACxB,MAAC,IAAI,IAAC,QAAQ,yBAAI,IAAI,SAAS,EAAC,GAAG,EAClC,WAAW,CAAC,CAAC,CAAC,MAAC,IAAI,IAAC,QAAQ,wBAAG,gBAAgB,IAAQ,CAAC,CAAC,CAAC,MAAC,IAAI,IAAC,KAAK,EAAC,KAAK,kBAAG,gBAAgB,IAAQ,EACtG,WAAW,CAAC,CAAC,CAAC,CACb,MAAC,IAAI,IAAC,QAAQ,gCAAM,aAAa,IAAQ,CAC1C,CAAC,CAAC,CAAC,CACF,8BACG,KAAK,EACN,MAAC,IAAI,IAAC,KAAK,EAAC,OAAO,kBAAG,aAAa,IAAQ,IAC1C,CACJ,EACA,KAAK,IAAI,MAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,mBAAK,KAAK,CAAC,IAAI,SAAS,IACrD,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -9,10 +9,19 @@ interface BrowseExpandedBundleProps {
|
|
|
9
9
|
bundle: RegistryBundle;
|
|
10
10
|
/** Pre-computed dependency resolution result */
|
|
11
11
|
bundleDeps: BundleDeps;
|
|
12
|
+
/** URL to the bundle's README on GitHub, or null */
|
|
13
|
+
readmeUrl: null | string;
|
|
12
14
|
/** Terminal width for responsive layout */
|
|
13
15
|
terminalWidth: number;
|
|
14
16
|
}
|
|
15
|
-
export default function BrowseExpandedBundle({ bundle, bundleDeps, terminalWidth }: BrowseExpandedBundleProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default function BrowseExpandedBundle({ bundle, bundleDeps, readmeUrl, terminalWidth }: BrowseExpandedBundleProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
* WARNING: This line-count calculation MUST stay in sync with the JSX rendered
|
|
20
|
+
* by BrowseExpandedBundle above. If any lines are added to or removed from the
|
|
21
|
+
* component's output, this function must be updated to match — otherwise the
|
|
22
|
+
* viewport height math in BrowseList will be wrong, causing scroll glitches.
|
|
23
|
+
*/
|
|
24
|
+
export declare function bundleExpandedLines(bundleDeps: BundleDeps, assetCount: number, readmeUrl: null | string | undefined, description: string, terminalWidth: number): number;
|
|
16
25
|
/**
|
|
17
26
|
* Resolve transitive dependencies for each bundle asset.
|
|
18
27
|
* Returns a map of "type/name" → array of dependency RegistryAssets,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowseExpandedBundle.d.ts","sourceRoot":"","sources":["../../src/components/BrowseExpandedBundle.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"BrowseExpandedBundle.d.ts","sourceRoot":"","sources":["../../src/components/BrowseExpandedBundle.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAKhF,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;IACrC,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,yBAAyB;IACjC,qCAAqC;IACrC,MAAM,EAAE,cAAc,CAAC;IACvB,gDAAgD;IAChD,UAAU,EAAE,UAAU,CAAC;IACvB,oDAAoD;IACpD,SAAS,EAAE,IAAI,GAAG,MAAM,CAAC;IACzB,2CAA2C;IAC3C,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,EAAE,yBAAyB,2CA4DvH;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,EACpC,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,GACpB,MAAM,CAcR;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,cAAc,EAAE,aAAa,EAAE,EAC/B,eAAe,EAAE,cAAc,EAAE,GAChC;IAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CA0CjE"}
|
|
@@ -1,17 +1,42 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from 'ink';
|
|
3
|
-
|
|
3
|
+
import { computeWrappedLines } from './BrowseExpandedRow.js';
|
|
4
|
+
import Link from './Link.js';
|
|
5
|
+
export default function BrowseExpandedBundle({ bundle, bundleDeps, readmeUrl, terminalWidth }) {
|
|
4
6
|
const assets = bundle.assets ?? [];
|
|
5
7
|
const { depMap, totalDepCount } = bundleDeps;
|
|
6
8
|
const separatorWidth = Math.max(20, terminalWidth - 10);
|
|
7
9
|
const headerLabel = totalDepCount > 0
|
|
8
10
|
? `Assets (${assets.length} direct + ${totalDepCount} dependencies):`
|
|
9
11
|
: `Assets (${assets.length}):`;
|
|
10
|
-
return (_jsxs(Box, { flexDirection: 'column', paddingLeft: 4, children: [_jsx(Text, { dimColor: true, children: '─'.repeat(separatorWidth) }), _jsx(Text, { wrap: '
|
|
12
|
+
return (_jsxs(Box, { flexDirection: 'column', paddingLeft: 4, children: [_jsx(Text, { dimColor: true, children: '─'.repeat(separatorWidth) }), _jsx(Text, { wrap: 'wrap', children: bundle.description }), _jsxs(Box, { gap: 2, children: [bundle.tags.length > 0 && (_jsxs(Text, { children: [_jsx(Text, { dimColor: true, children: "Tags: " }), _jsx(Text, { color: 'blue', children: bundle.tags.join(', ') })] })), _jsxs(Text, { children: [_jsx(Text, { dimColor: true, children: "Author: " }), _jsx(Text, { children: bundle.author })] })] }), assets.length > 0 && (_jsxs(Box, { flexDirection: 'column', children: [_jsx(Text, { dimColor: true, children: headerLabel }), assets.map((a) => {
|
|
11
13
|
const key = `${a.type}/${a.name}`;
|
|
12
14
|
const deps = depMap.get(key);
|
|
13
15
|
return (_jsxs(Box, { flexDirection: 'column', children: [_jsxs(Text, { children: [' ', _jsxs(Text, { dimColor: true, children: [a.type, "/"] }), _jsx(Text, { children: a.name })] }), deps?.map((d) => (_jsxs(Text, { children: [' ', _jsxs(Text, { dimColor: true, children: ["\u2514 ", d.type, "/"] }), _jsx(Text, { dimColor: true, children: d.name })] }, `${d.type}/${d.name}`)))] }, key));
|
|
14
|
-
})] })), _jsx(Text, { dimColor: true, children: '─'.repeat(separatorWidth) })] }));
|
|
16
|
+
})] })), readmeUrl && (_jsxs(Box, { marginTop: 1, children: [_jsx(Text, { dimColor: true, children: "README: " }), _jsx(Link, { url: readmeUrl, children: "view on GitHub" })] })), _jsx(Text, { dimColor: true, children: '─'.repeat(separatorWidth) })] }));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* WARNING: This line-count calculation MUST stay in sync with the JSX rendered
|
|
20
|
+
* by BrowseExpandedBundle above. If any lines are added to or removed from the
|
|
21
|
+
* component's output, this function must be updated to match — otherwise the
|
|
22
|
+
* viewport height math in BrowseList will be wrong, causing scroll glitches.
|
|
23
|
+
*/
|
|
24
|
+
export function bundleExpandedLines(bundleDeps, assetCount, readmeUrl, description, terminalWidth) {
|
|
25
|
+
const descriptionLines = computeWrappedLines(description, terminalWidth - 4);
|
|
26
|
+
// separator + description (N lines) + tags/author + separator = 3 + N
|
|
27
|
+
// If assets: header(1) + assets(N) + rendered dep lines(M)
|
|
28
|
+
if (assetCount === 0)
|
|
29
|
+
return 3 + descriptionLines;
|
|
30
|
+
// Sum per-asset dep counts from the depMap, since deps shared across assets
|
|
31
|
+
// are rendered under each asset individually (not deduplicated in the UI)
|
|
32
|
+
let renderedDepLines = 0;
|
|
33
|
+
for (const deps of bundleDeps.depMap.values()) {
|
|
34
|
+
renderedDepLines += deps.length;
|
|
35
|
+
}
|
|
36
|
+
let lines = 3 + descriptionLines + 1 + assetCount + renderedDepLines;
|
|
37
|
+
if (readmeUrl)
|
|
38
|
+
lines += 2; // marginTop + link line
|
|
39
|
+
return lines;
|
|
15
40
|
}
|
|
16
41
|
/**
|
|
17
42
|
* Resolve transitive dependencies for each bundle asset.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowseExpandedBundle.js","sourceRoot":"","sources":["../../src/components/BrowseExpandedBundle.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"BrowseExpandedBundle.js","sourceRoot":"","sources":["../../src/components/BrowseExpandedBundle.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAKhC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,IAAI,MAAM,WAAW,CAAC;AAkB7B,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAA6B;IACtH,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;IACnC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,UAAU,CAAC;IAC7C,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,aAAa,GAAG,EAAE,CAAC,CAAC;IAExD,MAAM,WAAW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
|
8
8
|
isInstalled: boolean;
|
|
9
|
+
/** URL to the asset's README on GitHub, or null */
|
|
10
|
+
readmeUrl: null | string;
|
|
9
11
|
/** Terminal width for responsive layout */
|
|
10
12
|
terminalWidth: number;
|
|
11
13
|
}
|
|
12
|
-
export default function BrowseExpandedRow({ asset, installedVersion, isInstalled, terminalWidth, }: BrowseExpandedRowProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export default function BrowseExpandedRow({ asset, installedVersion, isInstalled, readmeUrl, terminalWidth, }: BrowseExpandedRowProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function computeBrowseExpandedLines(asset: RegistryAsset, readmeUrl: null | string, terminalWidth: number): number;
|
|
16
|
+
/**
|
|
17
|
+
* Estimate how many terminal lines a string will occupy when wrapped.
|
|
18
|
+
* Uses the available width (accounting for padding) to calculate line count.
|
|
19
|
+
*/
|
|
20
|
+
export declare function computeWrappedLines(text: string, availableWidth: number): number;
|
|
13
21
|
export {};
|
|
14
22
|
//# sourceMappingURL=BrowseExpandedRow.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowseExpandedRow.d.ts","sourceRoot":"","sources":["../../src/components/BrowseExpandedRow.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"BrowseExpandedRow.d.ts","sourceRoot":"","sources":["../../src/components/BrowseExpandedRow.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAIhE,UAAU,sBAAsB;IAC9B,oCAAoC;IACpC,KAAK,EAAE,aAAa,CAAC;IACrB,0CAA0C;IAC1C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,8CAA8C;IAC9C,WAAW,EAAE,OAAO,CAAC;IACrB,mDAAmD;IACnD,SAAS,EAAE,IAAI,GAAG,MAAM,CAAC;IACzB,2CAA2C;IAC3C,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,KAAK,EACL,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,aAAa,GACd,EAAE,sBAAsB,2CAyDxB;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,aAAa,EACpB,SAAS,EAAE,IAAI,GAAG,MAAM,EACxB,aAAa,EAAE,MAAM,GACpB,MAAM,CAcR;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAGhF"}
|
|
@@ -1,8 +1,40 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from 'ink';
|
|
3
|
-
|
|
3
|
+
import Link from './Link.js';
|
|
4
|
+
export default function BrowseExpandedRow({ asset, installedVersion, isInstalled, readmeUrl, terminalWidth, }) {
|
|
4
5
|
const latestVersion = asset.versions[asset.latest];
|
|
5
6
|
const separatorWidth = Math.max(20, terminalWidth - 10);
|
|
6
|
-
|
|
7
|
+
const hasOrg = !!asset.org;
|
|
8
|
+
const hasTags = asset.tags.length > 0;
|
|
9
|
+
const hasTools = (latestVersion?.tools ?? []).length > 0;
|
|
10
|
+
const hasDeps = (latestVersion?.dependencies ?? []).length > 0;
|
|
11
|
+
return (_jsxs(Box, { flexDirection: 'column', paddingLeft: 4, children: [_jsx(Text, { dimColor: true, children: '─'.repeat(separatorWidth) }), _jsx(Text, { wrap: 'wrap', children: latestVersion?.description ?? '' }), _jsxs(Text, { children: [_jsx(Text, { dimColor: true, children: "Version: " }), _jsxs(Text, { children: ["v", asset.latest] }), ' ', isInstalled && (_jsxs(_Fragment, { children: [_jsx(Text, { color: 'green', children: "\u2713 installed" }), installedVersion && _jsxs(Text, { dimColor: true, children: [" v", installedVersion] })] }))] }), hasOrg && (_jsxs(Text, { children: [_jsx(Text, { dimColor: true, children: "Org: " }), _jsx(Text, { color: 'magenta', children: asset.org })] })), hasTags && (_jsxs(Text, { children: [_jsx(Text, { dimColor: true, children: "Tags: " }), _jsx(Text, { color: 'blue', children: asset.tags.join(', ') })] })), hasTools && (_jsxs(Text, { children: [_jsx(Text, { dimColor: true, children: "Tools: " }), _jsx(Text, { children: (latestVersion?.tools ?? []).join(', ') })] })), hasDeps && (_jsxs(Text, { children: [_jsx(Text, { dimColor: true, children: "Deps: " }), _jsx(Text, { children: (latestVersion?.dependencies ?? []).map((d) => d.name).join(', ') })] })), readmeUrl && (_jsxs(Box, { marginTop: 1, children: [_jsx(Text, { dimColor: true, children: "README: " }), _jsx(Link, { url: readmeUrl, children: "view on GitHub" })] })), _jsx(Text, { dimColor: true, children: '─'.repeat(separatorWidth) })] }));
|
|
12
|
+
}
|
|
13
|
+
export function computeBrowseExpandedLines(asset, readmeUrl, terminalWidth) {
|
|
14
|
+
const latestVersion = asset.versions[asset.latest];
|
|
15
|
+
const description = latestVersion?.description ?? '';
|
|
16
|
+
const descriptionLines = computeWrappedLines(description, terminalWidth - 4);
|
|
17
|
+
// Base: top separator + description (N lines) + version + bottom separator = 3 + N
|
|
18
|
+
let lines = 3 + descriptionLines;
|
|
19
|
+
if (asset.org)
|
|
20
|
+
lines += 1;
|
|
21
|
+
if (asset.tags.length > 0)
|
|
22
|
+
lines += 1;
|
|
23
|
+
if ((latestVersion?.tools ?? []).length > 0)
|
|
24
|
+
lines += 1;
|
|
25
|
+
if ((latestVersion?.dependencies ?? []).length > 0)
|
|
26
|
+
lines += 1;
|
|
27
|
+
if (readmeUrl)
|
|
28
|
+
lines += 2; // marginTop + link line
|
|
29
|
+
return lines;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Estimate how many terminal lines a string will occupy when wrapped.
|
|
33
|
+
* Uses the available width (accounting for padding) to calculate line count.
|
|
34
|
+
*/
|
|
35
|
+
export function computeWrappedLines(text, availableWidth) {
|
|
36
|
+
if (!text || availableWidth <= 0)
|
|
37
|
+
return 1;
|
|
38
|
+
return Math.max(1, Math.ceil(text.length / availableWidth));
|
|
7
39
|
}
|
|
8
40
|
//# sourceMappingURL=BrowseExpandedRow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowseExpandedRow.js","sourceRoot":"","sources":["../../src/components/BrowseExpandedRow.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"BrowseExpandedRow.js","sourceRoot":"","sources":["../../src/components/BrowseExpandedRow.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAIhC,OAAO,IAAI,MAAM,WAAW,CAAC;AAe7B,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,KAAK,EACL,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,aAAa,GACU;IACvB,MAAM,aAAa,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACnD,MAAM,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,aAAa,GAAG,EAAE,CAAC,CAAC;IAExD,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC;IAC3B,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;IACtC,MAAM,QAAQ,GAAG,CAAC,aAAa,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IACzD,MAAM,OAAO,GAAG,CAAC,aAAa,EAAE,YAAY,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IAE/D,OAAO,CACL,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,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OAAO,CAAC,CAAC;IAC3C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -6,10 +6,14 @@ interface BrowseListProps {
|
|
|
6
6
|
cursorIndex: number;
|
|
7
7
|
/** Index of expanded item, or null */
|
|
8
8
|
expandedIndex: null | number;
|
|
9
|
+
/** Whether an org is active (passed via --org flag or lockfile) */
|
|
10
|
+
hasOrg: boolean;
|
|
9
11
|
/** Filtered items to display */
|
|
10
12
|
items: BrowseItem[];
|
|
11
13
|
/** Current lockfile for installed badges */
|
|
12
14
|
lockfile: Lockfile;
|
|
15
|
+
/** URL to the expanded asset's README, or null */
|
|
16
|
+
readmeUrl: null | string;
|
|
13
17
|
/** All registry assets for resolving transitive dependencies */
|
|
14
18
|
registryAssets: RegistryAsset[];
|
|
15
19
|
/** First visible item index */
|
|
@@ -21,6 +25,6 @@ interface BrowseListProps {
|
|
|
21
25
|
/** Available height in rows for the list area */
|
|
22
26
|
viewportHeight: number;
|
|
23
27
|
}
|
|
24
|
-
export default function BrowseList({ cursorIndex, expandedIndex, items, lockfile, registryAssets, scrollOffset, terminalWidth, typeFilter, viewportHeight, }: BrowseListProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export default function BrowseList({ cursorIndex, expandedIndex, hasOrg, items, lockfile, readmeUrl, registryAssets, scrollOffset, terminalWidth, typeFilter, viewportHeight, }: BrowseListProps): import("react/jsx-runtime").JSX.Element;
|
|
25
29
|
export {};
|
|
26
30
|
//# sourceMappingURL=BrowseList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowseList.d.ts","sourceRoot":"","sources":["../../src/components/BrowseList.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"BrowseList.d.ts","sourceRoot":"","sources":["../../src/components/BrowseList.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE9E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAkB,MAAM,4BAA4B,CAAC;AA0DhF,UAAU,eAAe;IACvB,6CAA6C;IAC7C,WAAW,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,aAAa,EAAE,IAAI,GAAG,MAAM,CAAC;IAC7B,mEAAmE;IACnE,MAAM,EAAE,OAAO,CAAC;IAChB,gCAAgC;IAChC,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,4CAA4C;IAC5C,QAAQ,EAAE,QAAQ,CAAC;IACnB,kDAAkD;IAClD,SAAS,EAAE,IAAI,GAAG,MAAM,CAAC;IACzB,gEAAgE;IAChE,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,+BAA+B;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,2CAA2C;IAC3C,aAAa,EAAE,MAAM,CAAC;IACtB,6BAA6B;IAC7B,UAAU,EAAE,eAAe,CAAC;IAC5B,iDAAiD;IACjD,cAAc,EAAE,MAAM,CAAC;CACxB;AAaD,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,WAAW,EACX,aAAa,EACb,MAAM,EACN,KAAK,EACL,QAAQ,EACR,SAAS,EACT,cAAc,EACd,YAAY,EACZ,aAAa,EACb,UAAU,EACV,cAAc,GACf,EAAE,eAAe,2CA4GjB"}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from 'ink';
|
|
3
3
|
import { getBreakpoint } from '../lib/breakpoints.js';
|
|
4
4
|
import { findInstalledAsset, isInstalled as isAssetInstalled } from '../lib/lockfile.js';
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import BrowseExpandedRow from './BrowseExpandedRow.js';
|
|
5
|
+
import BrowseExpandedBundle, { bundleExpandedLines, resolveBundleDependencies, } from './BrowseExpandedBundle.js';
|
|
6
|
+
import BrowseExpandedRow, { computeBrowseExpandedLines } from './BrowseExpandedRow.js';
|
|
8
7
|
const COLUMN_WIDTHS = {
|
|
9
|
-
medium: { cursor: 3, name:
|
|
10
|
-
narrow: { cursor: 3, name:
|
|
11
|
-
wide: { cursor: 3, name:
|
|
8
|
+
medium: { cursor: 3, name: 30, org: 16, status: 12, type: 14, version: 10 },
|
|
9
|
+
narrow: { cursor: 3, name: 30, status: 12, version: 10 },
|
|
10
|
+
wide: { cursor: 3, name: 40, org: 20, status: 12, type: 18, version: 10 },
|
|
12
11
|
};
|
|
13
12
|
const BUNDLE_COLUMN_WIDTHS = {
|
|
14
|
-
medium: { assets: 18, cursor: 3, name:
|
|
15
|
-
narrow: { assets: 14, cursor: 3, name:
|
|
16
|
-
wide: { assets: 18, cursor: 3, name:
|
|
13
|
+
medium: { assets: 18, cursor: 3, name: 30, status: 12, version: 10 },
|
|
14
|
+
narrow: { assets: 14, cursor: 3, name: 30, status: 12, version: 10 },
|
|
15
|
+
wide: { assets: 18, cursor: 3, name: 40, status: 12, version: 10 },
|
|
17
16
|
};
|
|
18
|
-
export default function BrowseList({ cursorIndex, expandedIndex, items, lockfile, registryAssets, scrollOffset, terminalWidth, typeFilter, viewportHeight, }) {
|
|
17
|
+
export default function BrowseList({ cursorIndex, expandedIndex, hasOrg, items, lockfile, readmeUrl, registryAssets, scrollOffset, terminalWidth, typeFilter, viewportHeight, }) {
|
|
19
18
|
if (items.length === 0) {
|
|
20
19
|
const label = typeFilter === 'bundle' ? 'bundles' : 'assets';
|
|
21
20
|
return (_jsx(Box, { borderColor: 'gray', borderStyle: 'round', flexDirection: 'column', children: _jsx(Box, { paddingY: 1, children: _jsxs(Text, { dimColor: true, children: ["No ", label, " match your filters."] }) }) }));
|
|
@@ -23,7 +22,9 @@ export default function BrowseList({ cursorIndex, expandedIndex, items, lockfile
|
|
|
23
22
|
const isBundleTab = typeFilter === 'bundle';
|
|
24
23
|
const bp = getBreakpoint(terminalWidth);
|
|
25
24
|
const showType = bp !== 'narrow';
|
|
25
|
+
const showOrg = bp !== 'narrow' && hasOrg;
|
|
26
26
|
const cols = COLUMN_WIDTHS[bp];
|
|
27
|
+
const orgWidth = 'org' in cols ? cols.org : 0;
|
|
27
28
|
const bundleCols = BUNDLE_COLUMN_WIDTHS[bp];
|
|
28
29
|
const aboveCount = scrollOffset;
|
|
29
30
|
// Resolve deps for the expanded bundle (if any) once, used for both line-height calculation and rendering
|
|
@@ -42,10 +43,10 @@ export default function BrowseList({ cursorIndex, expandedIndex, items, lockfile
|
|
|
42
43
|
let expandedLines = 0;
|
|
43
44
|
if (i === expandedIndex) {
|
|
44
45
|
if (expandedBundleDeps && expandedBundle) {
|
|
45
|
-
expandedLines = bundleExpandedLines(expandedBundleDeps, (expandedBundle.assets ?? []).length);
|
|
46
|
+
expandedLines = bundleExpandedLines(expandedBundleDeps, (expandedBundle.assets ?? []).length, readmeUrl, expandedBundle.description, terminalWidth);
|
|
46
47
|
}
|
|
47
|
-
else {
|
|
48
|
-
expandedLines =
|
|
48
|
+
else if (expandedItem?.kind === 'asset') {
|
|
49
|
+
expandedLines = computeBrowseExpandedLines(expandedItem.data, readmeUrl, terminalWidth);
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
const linesNeeded = 1 + expandedLines;
|
|
@@ -58,43 +59,52 @@ export default function BrowseList({ cursorIndex, expandedIndex, items, lockfile
|
|
|
58
59
|
}
|
|
59
60
|
const lastVisibleIndex = belowItems.length > 0 ? belowItems[belowItems.length - 1].index : scrollOffset;
|
|
60
61
|
const belowCount = items.length - lastVisibleIndex - 1;
|
|
61
|
-
return (_jsxs(Box, { borderColor: 'gray', borderStyle: 'round', flexDirection: 'column', children: [
|
|
62
|
+
return (_jsxs(Box, { borderColor: 'gray', borderStyle: 'round', flexDirection: 'column', children: [_jsx(ColumnHeader, { bundleCols: bundleCols, cols: cols, isBundleTab: isBundleTab, orgWidth: orgWidth, showOrg: showOrg, showType: showType }), aboveCount > 0 && _jsxs(Text, { dimColor: true, children: [" \u25B2 ", aboveCount, " more above"] }), belowItems.map(({ index, item }) => {
|
|
62
63
|
const isCursor = index === cursorIndex;
|
|
63
64
|
const isExpanded = index === expandedIndex;
|
|
64
|
-
|
|
65
|
-
const bundle = item.data;
|
|
66
|
-
const bundleDeps = index === expandedIndex && expandedBundleDeps
|
|
67
|
-
? expandedBundleDeps
|
|
68
|
-
: resolveBundleDependencies(registryAssets, bundle.assets ?? []);
|
|
69
|
-
const assetLabel = bundleDeps.totalDepCount > 0
|
|
70
|
-
? `${bundle.assetCount} (+${bundleDeps.totalDepCount} deps)`
|
|
71
|
-
: `${bundle.assetCount} assets`;
|
|
72
|
-
const bundleAssets = bundle.assets ?? [];
|
|
73
|
-
const installedCount = bundleAssets.filter((ref) => isAssetInstalled(lockfile, ref.name, ref.type)).length;
|
|
74
|
-
const totalCount = bundleAssets.length;
|
|
75
|
-
const allInstalled = totalCount > 0 && installedCount === totalCount;
|
|
76
|
-
const partiallyInstalled = installedCount > 0 && installedCount < totalCount;
|
|
77
|
-
return (_jsxs(Box, { flexDirection: 'column', children: [_jsxs(Box, { children: [_jsx(Box, { flexShrink: 0, width: isBundleTab ? bundleCols.cursor : cols.cursor, children: _jsx(Text, { color: 'magenta', children: isCursor ? ' ▸' : ' ' }) }), _jsx(Box, { flexShrink: 0, width: isBundleTab ? bundleCols.name : cols.name, children: _jsx(Text, { color: 'magenta', wrap: 'truncate', children: bundle.name }) }), isBundleTab ? (_jsx(Box, { flexShrink: 0, width: bundleCols.assets, children: _jsx(Text, { wrap: 'truncate', children: assetLabel }) })) : (showType && (_jsx(Box, { flexShrink: 0, width: 'type' in cols ? cols.type : 0, children: _jsx(Text, { wrap: 'truncate', children: "bundle" }) }))), _jsx(Box, { flexShrink: 0, width: isBundleTab ? bundleCols.version : cols.version, children: _jsxs(Text, { wrap: 'truncate', children: ["v", bundle.version] }) }), _jsxs(Box, { flexShrink: 0, width: isBundleTab ? bundleCols.status : cols.status, children: [allInstalled && _jsx(Text, { color: 'green', children: "[installed]" }), partiallyInstalled && _jsx(Text, { color: 'yellow', children: "[partial]" })] }), _jsx(Box, { flexGrow: 1, overflow: 'hidden', children: _jsx(Text, { dimColor: true, wrap: 'truncate', children: bundle.description }) })] }), isExpanded && (_jsx(BrowseExpandedBundle, { bundle: bundle, bundleDeps: bundleDeps, terminalWidth: terminalWidth }))] }, `bundle/${bundle.name}`));
|
|
78
|
-
}
|
|
79
|
-
const asset = item.data;
|
|
80
|
-
const latestVersion = asset.versions[asset.latest];
|
|
81
|
-
const installed = findInstalledAsset(lockfile, asset.name, asset.type);
|
|
82
|
-
return (_jsxs(Box, { flexDirection: 'column', children: [_jsxs(Box, { children: [_jsx(Box, { flexShrink: 0, width: cols.cursor, children: _jsx(Text, { color: 'cyan', children: isCursor ? ' ▸' : ' ' }) }), _jsx(Box, { flexShrink: 0, width: cols.name, children: _jsx(Text, { color: 'cyan', wrap: 'truncate', children: formatOrgName(asset.org, asset.name) }) }), showType && (_jsx(Box, { flexShrink: 0, width: 'type' in cols ? cols.type : 0, children: _jsx(Text, { wrap: 'truncate', children: asset.type }) })), _jsx(Box, { flexShrink: 0, width: cols.version, children: _jsxs(Text, { wrap: 'truncate', children: ["v", asset.latest] }) }), _jsx(Box, { flexShrink: 0, width: cols.status, children: installed && _jsx(Text, { color: 'green', children: "[installed]" }) }), _jsx(Box, { flexGrow: 1, overflow: 'hidden', children: _jsx(Text, { dimColor: true, wrap: 'truncate', children: latestVersion?.description ?? '' }) })] }), isExpanded && (_jsx(BrowseExpandedRow, { asset: asset, installedVersion: installed?.version, isInstalled: !!installed, terminalWidth: terminalWidth }))] }, `${asset.type}/${asset.name}`));
|
|
65
|
+
return item.kind === 'bundle' ? (_jsx(BrowseBundleRow, { bundle: item.data, bundleCols: bundleCols, cols: cols, expandedBundleDeps: expandedBundleDeps, isBundleTab: isBundleTab, isCursor: isCursor, isExpanded: isExpanded, lockfile: lockfile, orgWidth: orgWidth, readmeUrl: readmeUrl, registryAssets: registryAssets, showOrg: showOrg, showType: showType, terminalWidth: terminalWidth }, `bundle/${item.data.name}`)) : (_jsx(BrowseAssetRow, { asset: item.data, cols: cols, isCursor: isCursor, isExpanded: isExpanded, lockfile: lockfile, orgWidth: orgWidth, readmeUrl: readmeUrl, showOrg: showOrg, showType: showType, terminalWidth: terminalWidth }, `${item.data.type}/${item.data.name}`));
|
|
83
66
|
}), belowCount > 0 && _jsxs(Text, { dimColor: true, children: [" \u25BC ", belowCount, " more below"] })] }));
|
|
84
67
|
}
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
//
|
|
93
|
-
|
|
94
|
-
let
|
|
95
|
-
|
|
96
|
-
|
|
68
|
+
function BrowseAssetRow({ asset, cols, isCursor, isExpanded, lockfile, orgWidth, readmeUrl, showOrg, showType, terminalWidth, }) {
|
|
69
|
+
const latestVersion = asset.versions[asset.latest];
|
|
70
|
+
const installed = findInstalledAsset(lockfile, asset.name, asset.type, asset.org);
|
|
71
|
+
return (_jsxs(Box, { flexDirection: 'column', children: [_jsxs(Box, { children: [_jsx(Box, { flexShrink: 0, width: cols.cursor, children: _jsx(Text, { color: 'cyan', children: isCursor ? ' ▸' : ' ' }) }), _jsx(Box, { flexShrink: 0, width: cols.name, children: _jsx(Text, { color: 'cyan', wrap: 'truncate', children: asset.name }) }), showOrg && (_jsx(Box, { flexShrink: 0, width: orgWidth, children: _jsx(Text, { dimColor: true, wrap: 'truncate', children: asset.org ? `@${asset.org}` : '' }) })), showType && (_jsx(Box, { flexShrink: 0, width: 'type' in cols ? cols.type : 0, children: _jsx(Text, { wrap: 'truncate', children: asset.type }) })), _jsx(Box, { flexShrink: 0, width: cols.version, children: _jsxs(Text, { wrap: 'truncate', children: ["v", asset.latest] }) }), _jsx(Box, { flexShrink: 0, width: cols.status, children: installed && _jsx(Text, { color: 'green', children: "[installed]" }) }), _jsx(Box, { flexGrow: 1, overflow: 'hidden', children: _jsx(Text, { dimColor: true, wrap: 'truncate', children: latestVersion?.description ?? '' }) })] }), isExpanded && (_jsx(BrowseExpandedRow, { asset: asset, installedVersion: installed?.version, isInstalled: !!installed, readmeUrl: readmeUrl, terminalWidth: terminalWidth }))] }, `${asset.type}/${asset.name}`));
|
|
72
|
+
}
|
|
73
|
+
function BrowseBundleRow({ bundle, bundleCols, cols, expandedBundleDeps, isBundleTab, isCursor, isExpanded, lockfile, orgWidth, readmeUrl, registryAssets, showOrg, showType, terminalWidth, }) {
|
|
74
|
+
const bundleAssets = bundle.assets ?? [];
|
|
75
|
+
// Only resolve dependencies when expanded; for collapsed rows use asset count directly
|
|
76
|
+
let assetLabel;
|
|
77
|
+
let bundleDeps;
|
|
78
|
+
if (isExpanded) {
|
|
79
|
+
bundleDeps = expandedBundleDeps ?? resolveBundleDependencies(registryAssets, bundleAssets);
|
|
80
|
+
assetLabel =
|
|
81
|
+
bundleDeps.totalDepCount > 0
|
|
82
|
+
? `${bundle.assetCount} (+${bundleDeps.totalDepCount} deps)`
|
|
83
|
+
: `${bundle.assetCount} assets`;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
assetLabel = `${bundle.assetCount} assets`;
|
|
87
|
+
// bundleDeps only needed for the expanded view, provide a stub for type safety
|
|
88
|
+
bundleDeps = { depMap: new Map(), totalDepCount: 0 };
|
|
97
89
|
}
|
|
98
|
-
|
|
90
|
+
const { allInstalled, partiallyInstalled } = getBundleInstallStatus(lockfile, bundleAssets);
|
|
91
|
+
return (_jsxs(Box, { flexDirection: 'column', children: [_jsxs(Box, { children: [_jsx(Box, { flexShrink: 0, width: isBundleTab ? bundleCols.cursor : cols.cursor, children: _jsx(Text, { color: 'magenta', children: isCursor ? ' ▸' : ' ' }) }), _jsx(Box, { flexShrink: 0, width: isBundleTab ? bundleCols.name : cols.name, children: _jsx(Text, { color: 'magenta', wrap: 'truncate', children: bundle.name }) }), isBundleTab ? (_jsx(Box, { flexShrink: 0, width: bundleCols.assets, children: _jsx(Text, { wrap: 'truncate', children: assetLabel }) })) : (_jsxs(_Fragment, { children: [showOrg && (_jsx(Box, { flexShrink: 0, width: orgWidth, children: _jsx(Text, { dimColor: true, wrap: 'truncate' }) })), showType && (_jsx(Box, { flexShrink: 0, width: 'type' in cols ? cols.type : 0, children: _jsx(Text, { wrap: 'truncate', children: "bundle" }) }))] })), _jsx(Box, { flexShrink: 0, width: isBundleTab ? bundleCols.version : cols.version, children: _jsxs(Text, { wrap: 'truncate', children: ["v", bundle.version] }) }), _jsxs(Box, { flexShrink: 0, width: isBundleTab ? bundleCols.status : cols.status, children: [allInstalled && _jsx(Text, { color: 'green', children: "[installed]" }), partiallyInstalled && _jsx(Text, { color: 'yellow', children: "[partial]" })] }), _jsx(Box, { flexGrow: 1, overflow: 'hidden', children: _jsx(Text, { dimColor: true, wrap: 'truncate', children: bundle.description }) })] }), isExpanded && (_jsx(BrowseExpandedBundle, { bundle: bundle, bundleDeps: bundleDeps, readmeUrl: readmeUrl, terminalWidth: terminalWidth }))] }, `bundle/${bundle.name}`));
|
|
92
|
+
}
|
|
93
|
+
// --- Main component ---
|
|
94
|
+
function ColumnHeader({ bundleCols, cols, isBundleTab, orgWidth, showOrg, showType }) {
|
|
95
|
+
if (isBundleTab) {
|
|
96
|
+
return (_jsxs(Box, { children: [_jsx(Box, { flexShrink: 0, width: bundleCols.cursor, children: _jsx(Text, { children: " " }) }), _jsx(Box, { flexShrink: 0, width: bundleCols.name, children: _jsx(Text, { bold: true, dimColor: true, children: "Name" }) }), _jsx(Box, { flexShrink: 0, width: bundleCols.assets, children: _jsx(Text, { bold: true, dimColor: true, children: "Assets" }) }), _jsx(Box, { flexShrink: 0, width: bundleCols.version, children: _jsx(Text, { bold: true, dimColor: true, children: "Version" }) }), _jsx(Box, { flexShrink: 0, width: bundleCols.status, children: _jsx(Text, { bold: true, dimColor: true, children: "Status" }) }), _jsx(Box, { flexGrow: 1, overflow: 'hidden', children: _jsx(Text, { bold: true, dimColor: true, children: "Description" }) })] }));
|
|
97
|
+
}
|
|
98
|
+
return (_jsxs(Box, { children: [_jsx(Box, { flexShrink: 0, width: cols.cursor, children: _jsx(Text, { children: " " }) }), _jsx(Box, { flexShrink: 0, width: cols.name, children: _jsx(Text, { bold: true, dimColor: true, children: "Name" }) }), showOrg && (_jsx(Box, { flexShrink: 0, width: orgWidth, children: _jsx(Text, { bold: true, dimColor: true, children: "Org" }) })), showType && (_jsx(Box, { flexShrink: 0, width: 'type' in cols ? cols.type : 0, children: _jsx(Text, { bold: true, dimColor: true, children: "Type" }) })), _jsx(Box, { flexShrink: 0, width: cols.version, children: _jsx(Text, { bold: true, dimColor: true, children: "Version" }) }), _jsx(Box, { flexShrink: 0, width: cols.status, children: _jsx(Text, { bold: true, dimColor: true, children: "Status" }) }), _jsx(Box, { flexGrow: 1, overflow: 'hidden', children: _jsx(Text, { bold: true, dimColor: true, children: "Description" }) })] }));
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Compute bundle install status from the lockfile and bundle asset refs.
|
|
102
|
+
*/
|
|
103
|
+
function getBundleInstallStatus(lockfile, bundleAssets) {
|
|
104
|
+
const totalCount = bundleAssets.length;
|
|
105
|
+
const installedCount = bundleAssets.filter((ref) => isAssetInstalled(lockfile, ref.name, ref.type)).length;
|
|
106
|
+
const allInstalled = totalCount > 0 && installedCount === totalCount;
|
|
107
|
+
const partiallyInstalled = installedCount > 0 && installedCount < totalCount;
|
|
108
|
+
return { allInstalled, installedCount, partiallyInstalled, totalCount };
|
|
99
109
|
}
|
|
100
110
|
//# sourceMappingURL=BrowseList.js.map
|