@contentful/experience-design-system-cli 2.14.2 → 2.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/README.md +64 -2
  2. package/dist/package.json +3 -2
  3. package/dist/src/analyze/command.d.ts +11 -0
  4. package/dist/src/analyze/command.js +298 -3
  5. package/dist/src/analyze/composite-closure.d.ts +25 -0
  6. package/dist/src/analyze/composite-closure.js +0 -0
  7. package/dist/src/analyze/composition/agent-parser/author-prompt.d.ts +4 -0
  8. package/dist/src/analyze/composition/agent-parser/author-prompt.js +22 -0
  9. package/dist/src/analyze/composition/agent-parser/extract-parser.d.ts +8 -0
  10. package/dist/src/analyze/composition/agent-parser/extract-parser.js +44 -0
  11. package/dist/src/analyze/composition/agent-parser/load-prompt.d.ts +7 -0
  12. package/dist/src/analyze/composition/agent-parser/load-prompt.js +31 -0
  13. package/dist/src/analyze/composition/agent-parser/resolve-via-parser.d.ts +46 -0
  14. package/dist/src/analyze/composition/agent-parser/resolve-via-parser.js +88 -0
  15. package/dist/src/analyze/composition/agent-parser/sandbox.d.ts +45 -0
  16. package/dist/src/analyze/composition/agent-parser/sandbox.js +187 -0
  17. package/dist/src/analyze/composition/apply-mapping.d.ts +22 -0
  18. package/dist/src/analyze/composition/apply-mapping.js +67 -0
  19. package/dist/src/analyze/composition/candidate-critic-agent.d.ts +7 -0
  20. package/dist/src/analyze/composition/candidate-critic-agent.js +39 -0
  21. package/dist/src/analyze/composition/candidate-critic.d.ts +32 -0
  22. package/dist/src/analyze/composition/candidate-critic.js +63 -0
  23. package/dist/src/analyze/composition/candidate-files.d.ts +34 -0
  24. package/dist/src/analyze/composition/candidate-files.js +131 -0
  25. package/dist/src/analyze/composition/composition-cache-key.d.ts +19 -0
  26. package/dist/src/analyze/composition/composition-cache-key.js +19 -0
  27. package/dist/src/analyze/composition/interchange-schema.d.ts +37 -0
  28. package/dist/src/analyze/composition/interchange-schema.js +61 -0
  29. package/dist/src/analyze/composition/merge-edges.d.ts +19 -0
  30. package/dist/src/analyze/composition/merge-edges.js +50 -0
  31. package/dist/src/analyze/composition/parse-map-edges.d.ts +16 -0
  32. package/dist/src/analyze/composition/parse-map-edges.js +55 -0
  33. package/dist/src/analyze/composition/resolve-mapping-cli.d.ts +23 -0
  34. package/dist/src/analyze/composition/resolve-mapping-cli.js +29 -0
  35. package/dist/src/analyze/composition/resolve-mapping.d.ts +59 -0
  36. package/dist/src/analyze/composition/resolve-mapping.js +94 -0
  37. package/dist/src/analyze/cycle-detection.d.ts +27 -0
  38. package/dist/src/analyze/cycle-detection.js +234 -0
  39. package/dist/src/analyze/cycle-view.d.ts +7 -0
  40. package/dist/src/analyze/cycle-view.js +28 -0
  41. package/dist/src/analyze/fuzzy-search.d.ts +3 -0
  42. package/dist/src/analyze/fuzzy-search.js +55 -0
  43. package/dist/src/analyze/issue-inheritance.d.ts +12 -0
  44. package/dist/src/analyze/issue-inheritance.js +108 -0
  45. package/dist/src/analyze/lineage.d.ts +29 -0
  46. package/dist/src/analyze/lineage.js +0 -0
  47. package/dist/src/analyze/scope-gate-cascade.d.ts +11 -0
  48. package/dist/src/analyze/scope-gate-cascade.js +170 -0
  49. package/dist/src/analyze/search-neighborhood.d.ts +3 -0
  50. package/dist/src/analyze/search-neighborhood.js +56 -0
  51. package/dist/src/analyze/select/tui/App.js +5 -16
  52. package/dist/src/analyze/select/tui/components/ComponentRationalePanel.d.ts +0 -4
  53. package/dist/src/analyze/select/tui/components/ComponentRationalePanel.js +3 -15
  54. package/dist/src/analyze/select/tui/components/FieldEditor.d.ts +29 -38
  55. package/dist/src/analyze/select/tui/components/FieldEditor.js +309 -185
  56. package/dist/src/analyze/select/tui/components/FinalizeDialog.d.ts +13 -1
  57. package/dist/src/analyze/select/tui/components/FinalizeDialog.js +23 -2
  58. package/dist/src/analyze/select/tui/components/GotoBanner.d.ts +31 -0
  59. package/dist/src/analyze/select/tui/components/GotoBanner.js +30 -0
  60. package/dist/src/analyze/select/tui/components/GroupedSidebar.d.ts +91 -0
  61. package/dist/src/analyze/select/tui/components/GroupedSidebar.js +497 -0
  62. package/dist/src/analyze/select/tui/components/HelpOverlay.d.ts +13 -1
  63. package/dist/src/analyze/select/tui/components/HelpOverlay.js +9 -3
  64. package/dist/src/analyze/select/tui/components/JsonEditor.js +3 -3
  65. package/dist/src/analyze/select/tui/components/LineagePanel.d.ts +14 -0
  66. package/dist/src/analyze/select/tui/components/LineagePanel.js +22 -0
  67. package/dist/src/analyze/select/tui/components/RationalePanel.d.ts +0 -7
  68. package/dist/src/analyze/select/tui/components/RationalePanel.js +3 -15
  69. package/dist/src/analyze/select/tui/components/Sidebar.d.ts +0 -6
  70. package/dist/src/analyze/select/tui/components/Sidebar.js +11 -27
  71. package/dist/src/analyze/select/tui/components/StatusBar.js +2 -1
  72. package/dist/src/analyze/select/tui/components/removed-components-text.d.ts +7 -0
  73. package/dist/src/analyze/select/tui/components/removed-components-text.js +11 -0
  74. package/dist/src/analyze/select/tui/hooks/useImmediateInput.d.ts +1 -5
  75. package/dist/src/analyze/select/tui/hooks/useImmediateInput.js +8 -10
  76. package/dist/src/analyze/select/tui/theme.d.ts +15 -0
  77. package/dist/src/analyze/select/tui/theme.js +28 -0
  78. package/dist/src/analyze/selection-cascade.d.ts +3 -0
  79. package/dist/src/analyze/selection-cascade.js +19 -0
  80. package/dist/src/analyze/slot-graph.d.ts +11 -0
  81. package/dist/src/analyze/slot-graph.js +17 -0
  82. package/dist/src/apply/api-client.d.ts +2 -1
  83. package/dist/src/apply/api-client.js +40 -6
  84. package/dist/src/apply/command.d.ts +17 -1
  85. package/dist/src/apply/command.js +69 -11
  86. package/dist/src/apply/error-parser.d.ts +16 -0
  87. package/dist/src/apply/error-parser.js +117 -0
  88. package/dist/src/apply/tui/ServerPreviewView.js +3 -1
  89. package/dist/src/credentials-store.d.ts +6 -0
  90. package/dist/src/credentials-store.js +5 -1
  91. package/dist/src/generate/agent-runner.d.ts +6 -0
  92. package/dist/src/generate/agent-runner.js +24 -8
  93. package/dist/src/import/command.js +69 -31
  94. package/dist/src/import/cycle-auto-reject.d.ts +4 -0
  95. package/dist/src/import/cycle-auto-reject.js +14 -0
  96. package/dist/src/import/orchestrator.d.ts +20 -7
  97. package/dist/src/import/orchestrator.js +139 -35
  98. package/dist/src/import/strip-allowed-components.d.ts +18 -0
  99. package/dist/src/import/strip-allowed-components.js +22 -0
  100. package/dist/src/import/tui/CustomPromptBanner.d.ts +0 -5
  101. package/dist/src/import/tui/CustomPromptBanner.js +2 -1
  102. package/dist/src/import/tui/WizardApp.d.ts +10 -74
  103. package/dist/src/import/tui/WizardApp.js +234 -246
  104. package/dist/src/import/tui/ai-flag.d.ts +5 -0
  105. package/dist/src/import/tui/ai-flag.js +6 -0
  106. package/dist/src/import/tui/autocomplete.d.ts +5 -0
  107. package/dist/src/import/tui/autocomplete.js +32 -0
  108. package/dist/src/import/tui/components/AutoFilterBanner.d.ts +10 -0
  109. package/dist/src/import/tui/components/AutoFilterBanner.js +19 -0
  110. package/dist/src/import/tui/components/CounterStrip.d.ts +12 -0
  111. package/dist/src/import/tui/components/CounterStrip.js +12 -0
  112. package/dist/src/import/tui/components/LegendEntry.d.ts +2 -0
  113. package/dist/src/import/tui/components/LegendEntry.js +6 -0
  114. package/dist/src/import/tui/cycle-panel-scroll.d.ts +8 -0
  115. package/dist/src/import/tui/cycle-panel-scroll.js +33 -0
  116. package/dist/src/import/tui/final-review-host.d.ts +3 -7
  117. package/dist/src/import/tui/final-review-host.js +9 -4
  118. package/dist/src/import/tui/group-collapse.d.ts +2 -0
  119. package/dist/src/import/tui/group-collapse.js +11 -0
  120. package/dist/src/import/tui/history.d.ts +22 -0
  121. package/dist/src/import/tui/history.js +53 -0
  122. package/dist/src/import/tui/hooks/useLineage.d.ts +32 -0
  123. package/dist/src/import/tui/hooks/useLineage.js +50 -0
  124. package/dist/src/import/tui/hooks/useOverlayPanel.d.ts +13 -0
  125. package/dist/src/import/tui/hooks/useOverlayPanel.js +27 -0
  126. package/dist/src/import/tui/lineage-layout.d.ts +75 -0
  127. package/dist/src/import/tui/lineage-layout.js +82 -0
  128. package/dist/src/import/tui/runLivePreview.d.ts +11 -0
  129. package/dist/src/import/tui/runLivePreview.js +7 -1
  130. package/dist/src/import/tui/scope-gate-columns.d.ts +31 -0
  131. package/dist/src/import/tui/scope-gate-columns.js +94 -0
  132. package/dist/src/import/tui/scope-gate-host.d.ts +3 -1
  133. package/dist/src/import/tui/scope-gate-host.js +11 -3
  134. package/dist/src/import/tui/sidebar-width.d.ts +1 -0
  135. package/dist/src/import/tui/sidebar-width.js +3 -0
  136. package/dist/src/import/tui/step-filters.d.ts +19 -0
  137. package/dist/src/import/tui/step-filters.js +42 -0
  138. package/dist/src/import/tui/steps/AtomicGenerateReviewStep.d.ts +42 -0
  139. package/dist/src/import/tui/steps/AtomicGenerateReviewStep.js +726 -0
  140. package/dist/src/import/tui/steps/AtomicScopeGateStep.d.ts +3 -0
  141. package/dist/src/import/tui/steps/AtomicScopeGateStep.js +211 -0
  142. package/dist/src/import/tui/steps/CredentialsStep.js +5 -18
  143. package/dist/src/import/tui/steps/DoneStep.d.ts +0 -2
  144. package/dist/src/import/tui/steps/DoneStep.js +3 -2
  145. package/dist/src/import/tui/steps/ErrorStep.js +2 -1
  146. package/dist/src/import/tui/steps/GenerateReviewStep.d.ts +19 -25
  147. package/dist/src/import/tui/steps/GenerateReviewStep.js +1258 -229
  148. package/dist/src/import/tui/steps/PathValidationStep.js +3 -2
  149. package/dist/src/import/tui/steps/PreviewStep.js +2 -1
  150. package/dist/src/import/tui/steps/PushDecisionGateStep.d.ts +0 -7
  151. package/dist/src/import/tui/steps/PushDecisionGateStep.js +3 -6
  152. package/dist/src/import/tui/steps/PushingStep.js +2 -1
  153. package/dist/src/import/tui/steps/RunningStep.d.ts +4 -1
  154. package/dist/src/import/tui/steps/RunningStep.js +3 -2
  155. package/dist/src/import/tui/steps/ScopeGateStep.d.ts +24 -0
  156. package/dist/src/import/tui/steps/ScopeGateStep.js +850 -193
  157. package/dist/src/import/tui/steps/TokenInputStep.js +2 -1
  158. package/dist/src/import/tui/steps/WelcomeStep.js +2 -1
  159. package/dist/src/import/tui/steps/WizardPreviewStep.d.ts +6 -0
  160. package/dist/src/import/tui/steps/WizardPreviewStep.js +95 -56
  161. package/dist/src/import/tui/steps/auto-reject-decision.d.ts +7 -0
  162. package/dist/src/import/tui/steps/auto-reject-decision.js +9 -0
  163. package/dist/src/import/tui/steps/breaking-change-format.d.ts +2 -0
  164. package/dist/src/import/tui/steps/breaking-change-format.js +24 -0
  165. package/dist/src/import/tui/steps/enumerate-cycle-breaks.d.ts +14 -0
  166. package/dist/src/import/tui/steps/enumerate-cycle-breaks.js +0 -0
  167. package/dist/src/import/tui/steps/preview-diff.js +48 -5
  168. package/dist/src/import/tui/useFinalizePreview.d.ts +34 -0
  169. package/dist/src/import/tui/useFinalizePreview.js +0 -0
  170. package/dist/src/import/tui/useLivePreview.d.ts +3 -0
  171. package/dist/src/import/tui/useLivePreview.js +1 -0
  172. package/dist/src/import/tui/wizard-state-transitions.d.ts +5 -59
  173. package/dist/src/import/tui/wizard-state-transitions.js +5 -60
  174. package/dist/src/lib/composition-mode.d.ts +28 -0
  175. package/dist/src/lib/composition-mode.js +37 -0
  176. package/dist/src/lib/prompt-overrides.d.ts +38 -0
  177. package/dist/src/lib/prompt-overrides.js +69 -0
  178. package/dist/src/print/command.js +19 -1
  179. package/dist/src/runs/modify-launcher.d.ts +3 -0
  180. package/dist/src/runs/modify-launcher.js +2 -0
  181. package/dist/src/runs/replay-helpers.js +1 -0
  182. package/dist/src/runs/run-picker.js +2 -18
  183. package/dist/src/runs/store.d.ts +4 -0
  184. package/dist/src/session/db.d.ts +23 -40
  185. package/dist/src/session/db.js +110 -138
  186. package/dist/src/setup/composition-mode-prompt.d.ts +14 -0
  187. package/dist/src/setup/composition-mode-prompt.js +37 -0
  188. package/package.json +5 -4
  189. package/prompts/composition-dir-critic.md +7 -0
  190. package/prompts/composition-edges.md +8 -0
  191. package/prompts/composition-parser-repair-empty.md +1 -0
  192. package/prompts/composition-parser-repair-error.md +2 -0
  193. package/prompts/composition-parser.md +42 -0
@@ -1,10 +1,22 @@
1
1
  import React from 'react';
2
+ import type { ComponentTypeSummary } from '@contentful/experience-design-system-types';
3
+ /** Max removed-component lines shown at once; the rest scroll with j/k.
4
+ * Exported so the parent's scroll-offset clamping stays in sync. */
5
+ export declare const FINALIZE_REMOVED_WINDOW = 6;
2
6
  type FinalizeDialogProps = {
3
7
  accepted: number;
4
8
  rejected: number;
5
9
  needsReview: number;
6
10
  onConfirm: () => void;
7
11
  onCancel: () => void;
12
+ /** Components that will be DELETED from the target space on push, from a
13
+ * preview scoped to the accepted set. */
14
+ removed?: ComponentTypeSummary[];
15
+ /** Status of the accepted-set preview fired when the dialog opened. While
16
+ * 'running', the deletion section shows a spinner instead of a (stale) list. */
17
+ previewStatus?: 'idle' | 'running' | 'done' | 'error';
18
+ /** Scroll offset into the removed list (owned by the parent; j/k adjust it). */
19
+ removedScrollOffset?: number;
8
20
  };
9
- export declare function FinalizeDialog({ accepted, rejected, needsReview, onConfirm, onCancel, }: FinalizeDialogProps): React.ReactElement;
21
+ export declare function FinalizeDialog({ accepted, rejected, needsReview, onConfirm, onCancel, removed, previewStatus, removedScrollOffset, }: FinalizeDialogProps): React.ReactElement;
10
22
  export {};
@@ -1,8 +1,19 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { PALETTE } from '../theme.js';
2
3
  import { Box, Text } from 'ink';
3
4
  import { useImmediateInput } from '../hooks/useImmediateInput.js';
4
- export function FinalizeDialog({ accepted, rejected, needsReview, onConfirm, onCancel, }) {
5
+ import { removedComponentsHeader, removedComponentLine } from './removed-components-text.js';
6
+ /** Max removed-component lines shown at once; the rest scroll with j/k.
7
+ * Exported so the parent's scroll-offset clamping stays in sync. */
8
+ export const FINALIZE_REMOVED_WINDOW = 6;
9
+ export function FinalizeDialog({ accepted, rejected, needsReview, onConfirm, onCancel, removed = [],
10
+ // Default 'done' so callers that pass a ready `removed` list (e.g. the atomic
11
+ // review step) render it immediately without threading a status.
12
+ previewStatus = 'done', removedScrollOffset = 0, }) {
5
13
  useImmediateInput((input, key) => {
14
+ // j/k scroll the removed list; the parent owns the offset (handled there).
15
+ if (input === 'j' || input === 'k' || key.upArrow || key.downArrow)
16
+ return;
6
17
  if (input === 'y' || key.return) {
7
18
  onConfirm();
8
19
  }
@@ -11,5 +22,15 @@ export function FinalizeDialog({ accepted, rejected, needsReview, onConfirm, onC
11
22
  }
12
23
  });
13
24
  const allResolved = needsReview === 0;
14
- return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", padding: 1, width: 58, children: [_jsx(Text, { bold: true, children: '─'.repeat(17) + ' Finalize ' + '─'.repeat(17) }), _jsx(Text, { children: " " }), _jsxs(Text, { children: [_jsxs(Text, { color: "green", children: [accepted, " accepted"] }), _jsx(Text, { children: " \u00B7 " }), _jsxs(Text, { color: "red", children: [rejected, " rejected"] }), _jsx(Text, { children: " \u00B7 " }), _jsxs(Text, { dimColor: true, children: [needsReview, " unresolved"] })] }), _jsx(Text, { children: " " }), !allResolved && (_jsxs(_Fragment, { children: [_jsx(Text, { color: "yellow", children: '⚠ ' + needsReview + ' unresolved component' + (needsReview === 1 ? '' : 's') + ' will not be pushed.' }), _jsx(Text, { color: "yellow", children: ' Only explicitly accepted components ship.' }), _jsx(Text, { children: " " })] })), _jsx(Text, { children: allResolved ? 'Save decisions and exit? All components resolved.' : 'Save decisions and exit?' }), _jsx(Text, { children: " " }), _jsx(Text, { children: ' [y / Enter] Confirm [n / Esc] Cancel' })] }));
25
+ const noneAccepted = accepted === 0;
26
+ const maxOffset = Math.max(0, removed.length - FINALIZE_REMOVED_WINDOW);
27
+ const offset = Math.min(Math.max(0, removedScrollOffset), maxOffset);
28
+ const windowed = removed.slice(offset, offset + FINALIZE_REMOVED_WINDOW);
29
+ const hasMoreBelow = offset + FINALIZE_REMOVED_WINDOW < removed.length;
30
+ const hasMoreAbove = offset > 0;
31
+ return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", padding: 1, width: 58, children: [_jsx(Text, { bold: true, children: '─'.repeat(17) + ' Finalize ' + '─'.repeat(17) }), _jsx(Text, { children: " " }), _jsxs(Text, { children: [_jsxs(Text, { color: PALETTE.success, children: [accepted, " accepted"] }), _jsx(Text, { children: " \u00B7 " }), _jsxs(Text, { color: PALETTE.error, children: [rejected, " rejected"] }), _jsx(Text, { children: " \u00B7 " }), _jsxs(Text, { dimColor: true, children: [needsReview, " unresolved"] })] }), _jsx(Text, { children: " " }), noneAccepted && (_jsxs(_Fragment, { children: [_jsx(Text, { bold: true, color: PALETTE.warning, children: '⚠ No components are accepted — nothing will be pushed.' }), _jsx(Text, { color: PALETTE.warning, children: ' Accept at least one component ([a] a row, [A] accept all) to push.' }), _jsx(Text, { children: " " })] })), !allResolved && (_jsxs(_Fragment, { children: [_jsx(Text, { color: PALETTE.warning, children: '⚠ ' + needsReview + ' unresolved component' + (needsReview === 1 ? '' : 's') + ' will not be pushed.' }), _jsx(Text, { color: PALETTE.warning, children: ' Only explicitly accepted components ship.' }), _jsx(Text, { children: " " })] })), previewStatus === 'running' && (_jsxs(_Fragment, { children: [_jsx(Text, { dimColor: true, children: "Previewing deletions against the target space\u2026" }), _jsx(Text, { children: " " })] })), previewStatus === 'error' && (_jsxs(_Fragment, { children: [_jsx(Text, { color: PALETTE.warning, children: '⚠ Could not preview deletions (the push will still proceed).' }), _jsx(Text, { children: " " })] })), previewStatus === 'done' && removed.length > 0 && (_jsxs(_Fragment, { children: [_jsx(Text, { bold: true, color: PALETTE.error, children: removedComponentsHeader(removed.length, false) }), hasMoreAbove && _jsx(Text, { dimColor: true, children: ' ↑ more above' }), windowed.map((rc) => (_jsx(Text, { color: PALETTE.error, children: removedComponentLine(rc) }, rc.id))), hasMoreBelow && _jsx(Text, { dimColor: true, children: ' ↓ more below' }), removed.length > FINALIZE_REMOVED_WINDOW && _jsx(Text, { dimColor: true, children: ' [j/k] scroll deletions' }), _jsx(Text, { children: " " })] })), _jsx(Text, { children: noneAccepted
32
+ ? 'Confirm exit with nothing accepted?'
33
+ : allResolved
34
+ ? 'Save decisions and exit? All components resolved.'
35
+ : 'Save decisions and exit?' }), _jsx(Text, { children: " " }), _jsx(Text, { children: ' [y / Enter] Confirm [n / Esc] Cancel' })] }));
15
36
  }
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ export interface GotoRow {
3
+ label: string;
4
+ jumpTarget: string;
5
+ kind?: string;
6
+ }
7
+ export interface GotoBannerProps {
8
+ title: string;
9
+ rows: GotoRow[];
10
+ /** Index used to highlight + window. Indexes `rows` directly by default. */
11
+ cursor: number;
12
+ /**
13
+ * Override the row index the cursor sits on, when `cursor` indexes a subset
14
+ * (e.g. a jumpable projection) rather than `rows`. Windowing and the default
15
+ * highlight center on this instead of `cursor` when provided.
16
+ */
17
+ cursorRowIndex?: number;
18
+ /** Max rows rendered at once. Larger lists window around the cursor. */
19
+ maxRows?: number;
20
+ /** Constrain the box to a fixed column width (e.g. the sidebar slot). */
21
+ width?: number;
22
+ /** Footer keybinding hint. Rendered dim below the list when given. */
23
+ footerHint?: string;
24
+ /**
25
+ * Escape hatch for feature-specific row rendering. Receives the row, its
26
+ * index into `rows`, and whether the cursor is on it. Falls back to a
27
+ * generic ▶-pointer row.
28
+ */
29
+ renderRow?: (row: GotoRow, index: number, isCursor: boolean) => React.ReactElement;
30
+ }
31
+ export declare function GotoBanner({ title, rows, cursor, cursorRowIndex, maxRows, width, footerHint, renderRow, }: GotoBannerProps): React.ReactElement;
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { PALETTE } from '../theme.js';
3
+ import { Box, Text } from 'ink';
4
+ const DEFAULT_MAX_ROWS = 15;
5
+ function windowStart(rowCount, highlightIndex, maxRows) {
6
+ if (rowCount <= maxRows)
7
+ return 0;
8
+ const maxStart = rowCount - maxRows;
9
+ let start = highlightIndex - Math.floor(maxRows / 2);
10
+ if (start < 0)
11
+ start = 0;
12
+ if (start > maxStart)
13
+ start = maxStart;
14
+ return start;
15
+ }
16
+ function defaultRenderRow(row, index, isCursor) {
17
+ return (_jsxs(Text, { children: [isCursor ? (_jsx(Text, { color: PALETTE.info, bold: true, children: '▶' })) : (_jsx(Text, { children: " " })), _jsx(Text, { inverse: isCursor, children: ' ' + row.label })] }, index));
18
+ }
19
+ export function GotoBanner({ title, rows, cursor, cursorRowIndex, maxRows = DEFAULT_MAX_ROWS, width, footerHint, renderRow = defaultRenderRow, }) {
20
+ const highlightIndex = cursorRowIndex ?? cursor;
21
+ const start = windowStart(rows.length, highlightIndex, maxRows);
22
+ const end = Math.min(rows.length, start + maxRows);
23
+ const visible = rows.slice(start, end);
24
+ const moreAbove = start;
25
+ const moreBelow = rows.length - end;
26
+ return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: PALETTE.info, paddingX: 1, marginTop: width === undefined ? 1 : 0, width: width, flexShrink: 0, children: [_jsx(Text, { bold: true, children: title }), moreAbove > 0 && _jsx(Text, { dimColor: true, children: ` ▲ ${moreAbove} more` }), visible.map((row, vi) => {
27
+ const i = start + vi;
28
+ return renderRow(row, i, i === highlightIndex);
29
+ }), moreBelow > 0 && _jsx(Text, { dimColor: true, children: ` ▼ ${moreBelow} more` }), footerHint !== undefined && _jsx(Text, { dimColor: true, children: footerHint })] }));
30
+ }
@@ -0,0 +1,91 @@
1
+ import React from 'react';
2
+ import type { CDFComponentEntry } from '@contentful/experience-design-system-types';
3
+ import { type ComponentGraphNode, type NodeStatus } from '../../../composite-closure.js';
4
+ import type { RenderStatus } from '../../../issue-inheritance.js';
5
+ import type { PreviewAnnotation } from '../../types.js';
6
+ export interface GroupedSidebarItem {
7
+ key: string;
8
+ entry: CDFComponentEntry;
9
+ status: NodeStatus;
10
+ }
11
+ export interface GroupedSidebarProps {
12
+ items: GroupedSidebarItem[];
13
+ cycleParticipants?: Set<string>;
14
+ selectedIdx: number;
15
+ selectedRowIdx?: number;
16
+ onSelect: (idx: number) => void;
17
+ expandedGroups: Set<string>;
18
+ onToggleExpanded: (rootName: string) => void;
19
+ width: number;
20
+ focused: boolean;
21
+ renderStatusByKey?: Map<string, RenderStatus>;
22
+ previewAnnotationByKey?: Map<string, PreviewAnnotation>;
23
+ scrollOffset?: number;
24
+ visibleCount?: number;
25
+ alwaysExpanded?: boolean;
26
+ showFlatTier?: boolean;
27
+ selectionStateByKey?: Map<string, 'accepted' | 'rejected' | 'undecided'>;
28
+ aiFlaggedByKey?: Map<string, boolean>;
29
+ dimPredicate?: (componentKey: string) => boolean;
30
+ viewMode?: 'grouped' | 'flat';
31
+ visibleRows?: VisibleRow[];
32
+ graph: ComponentGraphNode[];
33
+ filterVisibleKeys?: Set<string>;
34
+ }
35
+ type RowKind = 'cycle' | 'empty' | 'group-root' | 'group-child' | 'standalone' | 'flat' | 'flat-header';
36
+ export interface VisibleRow {
37
+ kind: RowKind;
38
+ key: string;
39
+ label: string;
40
+ indent: number;
41
+ aggregateGlyph?: string | null;
42
+ sharedSuffix?: boolean;
43
+ cycleChild?: boolean;
44
+ itemIdx: number;
45
+ rootName?: string;
46
+ }
47
+ export declare function buildVisibleRows(props: {
48
+ items: GroupedSidebarItem[];
49
+ cycleParticipants: Set<string>;
50
+ expandedGroups: Set<string>;
51
+ alwaysExpanded?: boolean;
52
+ showFlatTier?: boolean;
53
+ viewMode?: 'grouped' | 'flat';
54
+ graph: ComponentGraphNode[];
55
+ filterVisibleKeys?: Set<string>;
56
+ }): VisibleRow[];
57
+ export declare function visibleItemOrder(props: {
58
+ items: GroupedSidebarItem[];
59
+ cycleParticipants: Set<string>;
60
+ expandedGroups: Set<string>;
61
+ alwaysExpanded?: boolean;
62
+ showFlatTier?: boolean;
63
+ graph: ComponentGraphNode[];
64
+ }): number[];
65
+ export declare function labelStyleFor(input: {
66
+ row: VisibleRow;
67
+ isCursor: boolean;
68
+ wouldDim: boolean;
69
+ }): {
70
+ color: string | undefined;
71
+ bold: boolean;
72
+ dim: boolean;
73
+ };
74
+ export declare function selectionGlyphStyleFor(selState: 'accepted' | 'rejected' | 'undecided' | undefined, isCycleRow: boolean): {
75
+ glyph: string | null;
76
+ color: string | undefined;
77
+ dim: boolean;
78
+ bold: boolean;
79
+ };
80
+ export declare function inheritanceGlyphStyleFor(input: {
81
+ status: RenderStatus['status'] | undefined;
82
+ isOwn: boolean;
83
+ isCursor: boolean;
84
+ }): {
85
+ glyph: string | null;
86
+ color: string | undefined;
87
+ dim: boolean;
88
+ bold: boolean;
89
+ };
90
+ export declare function GroupedSidebar(props: GroupedSidebarProps): React.ReactElement;
91
+ export {};