@contentful/experience-design-system-cli 2.37.1-dev-build-c3291210.0 → 2.37.1-dev-build-bdf99669.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/dist/index.js CHANGED
@@ -263,14 +263,9 @@ var init_home = __esm({
263
263
  });
264
264
 
265
265
  // packages/experience-design-system-cli/src/tui/import/PageContainer.tsx
266
- import { useEffect as useEffect3 } from "react";
267
- import { Box as Box2, Text as Text3, useInput as useInput2, useStdout as useStdout2 } from "ink";
266
+ import { Box as Box2, Text as Text3, useInput as useInput2 } from "ink";
268
267
  import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
269
268
  function ImportScreen({ exitCode, onDone }) {
270
- const { stdout } = useStdout2();
271
- useEffect3(() => {
272
- stdout.write("\x1B[H\x1B[0J");
273
- }, [stdout]);
274
269
  useInput2((input, key) => {
275
270
  if (key.return || key.escape || input === "q") {
276
271
  onDone();
@@ -19721,7 +19716,7 @@ var init_scan_files = __esm({
19721
19716
  });
19722
19717
 
19723
19718
  // packages/experience-design-system-cli/src/tui/import/steps/03-path-validation/screen.tsx
19724
- import { useEffect as useEffect4, useMemo, useState as useState5 } from "react";
19719
+ import { useEffect as useEffect3, useMemo, useState as useState5 } from "react";
19725
19720
  import { Box as Box5, Text as Text6 } from "ink";
19726
19721
  import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
19727
19722
  function Row({ row }) {
@@ -19772,7 +19767,7 @@ function PathValidationScreen({
19772
19767
  }) {
19773
19768
  const resolvedPath = useMemo(() => resolveUserPath(projectPath), [projectPath]);
19774
19769
  const [scan, setScan] = useState5();
19775
- useEffect4(() => {
19770
+ useEffect3(() => {
19776
19771
  setScan(scanFiles(resolvedPath));
19777
19772
  }, [resolvedPath]);
19778
19773
  const phase = phaseOf(scan);
@@ -20222,10 +20217,10 @@ var init_theme = __esm({
20222
20217
  });
20223
20218
 
20224
20219
  // packages/experience-design-system-cli/src/tui/import/shared/running-step/use-elapsed.ts
20225
- import { useEffect as useEffect5, useState as useState7 } from "react";
20220
+ import { useEffect as useEffect4, useState as useState7 } from "react";
20226
20221
  function useElapsed() {
20227
20222
  const [seconds, setSeconds] = useState7(0);
20228
- useEffect5(() => {
20223
+ useEffect4(() => {
20229
20224
  const timer = setInterval(() => setSeconds((current) => current + 1), 1e3);
20230
20225
  return () => clearInterval(timer);
20231
20226
  }, []);
@@ -20811,11 +20806,11 @@ var init_run = __esm({
20811
20806
  });
20812
20807
 
20813
20808
  // packages/experience-design-system-cli/src/tui/import/steps/06-extraction/use-extraction.ts
20814
- import { useEffect as useEffect6, useRef as useRef2, useState as useState8 } from "react";
20809
+ import { useEffect as useEffect5, useRef as useRef2, useState as useState8 } from "react";
20815
20810
  function useExtraction(input) {
20816
20811
  const [state, setState] = useState8();
20817
20812
  const current = useRef2();
20818
- useEffect6(() => {
20813
+ useEffect5(() => {
20819
20814
  current.current = input;
20820
20815
  if (!input) {
20821
20816
  setState(void 0);
@@ -21051,7 +21046,7 @@ var init_windowed_panel = __esm({
21051
21046
  });
21052
21047
 
21053
21048
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/panels/added-column.tsx
21054
- import React7 from "react";
21049
+ import React6 from "react";
21055
21050
  import { Box as Box11, Text as Text12 } from "ink";
21056
21051
  import figures from "figures";
21057
21052
  import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
@@ -21069,7 +21064,7 @@ function AddedColumn(props) {
21069
21064
  const aiFlagged = aiFlaggedByKey?.get(entry.name) === true;
21070
21065
  const showSeparator = firstNonCycleIdx > 0 && i === firstNonCycleIdx;
21071
21066
  const style = sideColumnLabelStyle({ isCycle: entry.isCycle, isSelected, focused });
21072
- return /* @__PURE__ */ jsxs11(React7.Fragment, { children: [
21067
+ return /* @__PURE__ */ jsxs11(React6.Fragment, { children: [
21073
21068
  showSeparator && /* @__PURE__ */ jsx14(Text12, { dimColor: true, children: "\u2500".repeat(Math.max(0, width - 2)) }),
21074
21069
  /* @__PURE__ */ jsxs11(Box11, { children: [
21075
21070
  isCursor ? /* @__PURE__ */ jsx14(Text12, { color: PALETTE2.info, bold: true, children: figures.pointer }) : /* @__PURE__ */ jsx14(Text12, { children: " " }),
@@ -22250,8 +22245,8 @@ var init_useImmediateInput = __esm({
22250
22245
  });
22251
22246
 
22252
22247
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/hooks/use-terminal-size.ts
22253
- import { useStdout as useStdout3 } from "ink";
22254
- import { useEffect as useEffect7, useState as useState9 } from "react";
22248
+ import { useStdout as useStdout2 } from "ink";
22249
+ import { useEffect as useEffect6, useState as useState9 } from "react";
22255
22250
  function readTerminalSize(stdout) {
22256
22251
  return {
22257
22252
  columns: stdout?.columns ?? 80,
@@ -22259,9 +22254,9 @@ function readTerminalSize(stdout) {
22259
22254
  };
22260
22255
  }
22261
22256
  function useTerminalSize() {
22262
- const { stdout } = useStdout3();
22257
+ const { stdout } = useStdout2();
22263
22258
  const [size, setSize] = useState9(() => readTerminalSize(stdout));
22264
- useEffect7(() => {
22259
+ useEffect6(() => {
22265
22260
  const updateSize = () => setSize(readTerminalSize(stdout));
22266
22261
  stdout?.on("resize", updateSize);
22267
22262
  updateSize();
@@ -22278,7 +22273,7 @@ var init_use_terminal_size = __esm({
22278
22273
  });
22279
22274
 
22280
22275
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/components/HelpOverlay.tsx
22281
- import React8 from "react";
22276
+ import React7 from "react";
22282
22277
  import { Box as Box18, Text as Text20 } from "ink";
22283
22278
  import { Fragment as Fragment2, jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
22284
22279
  function HelpOverlay(props) {
@@ -22302,7 +22297,7 @@ function HelpOverlay(props) {
22302
22297
  overflowY: "hidden",
22303
22298
  children: [
22304
22299
  /* @__PURE__ */ jsx22(Text20, { bold: true, children: "\u2500".repeat(titleRule) + " Help " + "\u2500".repeat(titleRule) }),
22305
- props.sections.map((section) => /* @__PURE__ */ jsxs19(React8.Fragment, { children: [
22300
+ props.sections.map((section) => /* @__PURE__ */ jsxs19(React7.Fragment, { children: [
22306
22301
  /* @__PURE__ */ jsx22(Text20, { children: " " }),
22307
22302
  /* @__PURE__ */ jsx22(Text20, { bold: true, children: section.title }),
22308
22303
  section.entries.map((entry) => /* @__PURE__ */ jsx22(Text20, { children: entry.keys ? " " + entry.keys.padEnd(16) + " " + entry.label : " " + entry.label }, entry.keys + entry.label))
@@ -23206,7 +23201,7 @@ var init_state = __esm({
23206
23201
  });
23207
23202
 
23208
23203
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
23209
- import { useEffect as useEffect8, useMemo as useMemo2, useRef as useRef4, useState as useState12 } from "react";
23204
+ import { useEffect as useEffect7, useMemo as useMemo2, useRef as useRef4, useState as useState12 } from "react";
23210
23205
  function useScopeGate({ components, onConfirm, onQuit }) {
23211
23206
  const { columns: totalWidth, rows: terminalRows } = useTerminalSize();
23212
23207
  const columnPlan = useMemo2(() => computeColumnWidths(totalWidth), [totalWidth]);
@@ -23250,7 +23245,7 @@ function useScopeGate({ components, onConfirm, onQuit }) {
23250
23245
  return seed;
23251
23246
  });
23252
23247
  const seededGroupsRef = useRef4(closures.size > 0 || cycleParticipants.size > 0);
23253
- useEffect8(() => {
23248
+ useEffect7(() => {
23254
23249
  if (seededGroupsRef.current) return;
23255
23250
  if (closures.size === 0 && cycleParticipants.size === 0) return;
23256
23251
  seededGroupsRef.current = true;
@@ -23340,7 +23335,7 @@ function useScopeGate({ components, onConfirm, onQuit }) {
23340
23335
  entryCount: 0
23341
23336
  });
23342
23337
  const panelLayout = useMemo2(() => computePanelLayout(visibleCount), [visibleCount]);
23343
- useEffect8(() => {
23338
+ useEffect7(() => {
23344
23339
  setNav((prev) => {
23345
23340
  const maxIdx = Math.max(0, visibleRows.length - 1);
23346
23341
  const nextCursor = Math.min(prev.cursor, maxIdx);
@@ -23902,13 +23897,13 @@ var init_load = __esm({
23902
23897
  });
23903
23898
 
23904
23899
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate-flow.ts
23905
- import { useEffect as useEffect9, useMemo as useMemo3, useRef as useRef5, useState as useState13 } from "react";
23900
+ import { useEffect as useEffect8, useMemo as useMemo3, useRef as useRef5, useState as useState13 } from "react";
23906
23901
  function useScopeGateFlow(input, deps = realDeps2) {
23907
23902
  const sessionId = input?.sessionId;
23908
23903
  const loaded = useMemo3(() => sessionId ? deps.load(sessionId) : void 0, [sessionId]);
23909
23904
  const cacheCheck = useRef5(void 0);
23910
23905
  const [confirmed, setConfirmed] = useState13();
23911
- useEffect9(() => {
23906
+ useEffect8(() => {
23912
23907
  if (!input || !loaded?.ok || cacheCheck.current) return;
23913
23908
  cacheCheck.current = deps.checkCache(input.cache);
23914
23909
  }, [input, loaded]);
@@ -24183,11 +24178,11 @@ var init_run2 = __esm({
24183
24178
  });
24184
24179
 
24185
24180
  // packages/experience-design-system-cli/src/tui/import/steps/08-generation/use-generation.ts
24186
- import { useEffect as useEffect10, useRef as useRef6, useState as useState14 } from "react";
24181
+ import { useEffect as useEffect9, useRef as useRef6, useState as useState14 } from "react";
24187
24182
  function useGeneration(input) {
24188
24183
  const [state, setState] = useState14();
24189
24184
  const current = useRef6();
24190
- useEffect10(() => {
24185
+ useEffect9(() => {
24191
24186
  current.current = input;
24192
24187
  if (!input) {
24193
24188
  setState(void 0);
@@ -25062,7 +25057,7 @@ var init_scroll_offset = __esm({
25062
25057
  });
25063
25058
 
25064
25059
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/components/FieldEditor.tsx
25065
- import React9, { useEffect as useEffect11, useLayoutEffect as useLayoutEffect2, useState as useState15 } from "react";
25060
+ import React8, { useEffect as useEffect10, useLayoutEffect as useLayoutEffect2, useState as useState15 } from "react";
25066
25061
  import figures5 from "figures";
25067
25062
  import { Box as Box21, measureElement, Text as Text23 } from "ink";
25068
25063
  import { Fragment as Fragment5, jsx as jsx27, jsxs as jsxs22 } from "react/jsx-runtime";
@@ -25742,9 +25737,9 @@ function FieldEditor({
25742
25737
  const [editorState, setEditorState] = useState15(initialState);
25743
25738
  const [parseErr] = useState15(parseError);
25744
25739
  const [listScrollStart, setListScrollStart] = useState15(0);
25745
- const initialFocusScrollApplied = React9.useRef(false);
25740
+ const initialFocusScrollApplied = React8.useRef(false);
25746
25741
  const [rowHeights, setRowHeights] = useState15({});
25747
- const rowMeasureRefs = React9.useRef(/* @__PURE__ */ new Map());
25742
+ const rowMeasureRefs = React8.useRef(/* @__PURE__ */ new Map());
25748
25743
  const initialFocus = (() => {
25749
25744
  if (initialFocusTarget?.kind === "description") {
25750
25745
  return {
@@ -25831,23 +25826,23 @@ function FieldEditor({
25831
25826
  const [showHelp, setShowHelp] = useState15(false);
25832
25827
  const props = editorState.props;
25833
25828
  const slots = editorState.slots;
25834
- const contentPropIndexes = React9.useMemo(
25829
+ const contentPropIndexes = React8.useMemo(
25835
25830
  () => props.flatMap((prop, index) => prop.category === "content" ? [index] : []),
25836
25831
  [props]
25837
25832
  );
25838
- const designPropIndexes = React9.useMemo(
25833
+ const designPropIndexes = React8.useMemo(
25839
25834
  () => props.flatMap((prop, index) => prop.category === "design" ? [index] : []),
25840
25835
  [props]
25841
25836
  );
25842
- const hiddenPropIndexes = React9.useMemo(
25837
+ const hiddenPropIndexes = React8.useMemo(
25843
25838
  () => showHiddenProps ? props.flatMap((prop, index) => prop.category === "state" || prop.category === "unattached" ? [index] : []) : [],
25844
25839
  [props, showHiddenProps]
25845
25840
  );
25846
- const visiblePropIndexes = React9.useMemo(
25841
+ const visiblePropIndexes = React8.useMemo(
25847
25842
  () => [...contentPropIndexes, ...designPropIndexes, ...hiddenPropIndexes],
25848
25843
  [contentPropIndexes, designPropIndexes, hiddenPropIndexes]
25849
25844
  );
25850
- const propGroups = React9.useMemo(
25845
+ const propGroups = React8.useMemo(
25851
25846
  () => [
25852
25847
  {
25853
25848
  kind: "content",
@@ -25867,7 +25862,7 @@ function FieldEditor({
25867
25862
  ],
25868
25863
  [contentPropIndexes, designPropIndexes, hiddenPropIndexes]
25869
25864
  );
25870
- const selectableRows = React9.useMemo(
25865
+ const selectableRows = React8.useMemo(
25871
25866
  () => [
25872
25867
  ...contentPropIndexes.map((idx) => ({ kind: "prop", idx })),
25873
25868
  ...designPropIndexes.map((idx) => ({ kind: "prop", idx })),
@@ -25877,7 +25872,7 @@ function FieldEditor({
25877
25872
  [contentPropIndexes, designPropIndexes, hiddenPropIndexes, slots]
25878
25873
  );
25879
25874
  const visiblePropPosition = visiblePropIndexes.indexOf(propIdx);
25880
- const selectedSelectableIndex = React9.useMemo(
25875
+ const selectedSelectableIndex = React8.useMemo(
25881
25876
  () => selectableRows.findIndex(
25882
25877
  (row) => inSlots ? row.kind === "slot" && row.idx === slotIdx : row.kind === "prop" && row.idx === propIdx
25883
25878
  ),
@@ -25896,12 +25891,12 @@ function FieldEditor({
25896
25891
  }
25897
25892
  };
25898
25893
  const textEntryActive = focusLevel === "field" && editingField && activeField === "description" || focusLevel === "field" && editingField && activeField === "default" && (editorState.props[propIdx]?.type === "string" || editorState.props[propIdx]?.type === "token") || editingValue != null;
25899
- React9.useEffect(() => {
25894
+ React8.useEffect(() => {
25900
25895
  onTextEntryActiveChange?.(textEntryActive);
25901
25896
  }, [textEntryActive, onTextEntryActiveChange]);
25902
25897
  const currentProp = props[propIdx] ?? null;
25903
25898
  const currentSlot = slots[slotIdx] ?? null;
25904
- React9.useEffect(() => {
25899
+ React8.useEffect(() => {
25905
25900
  if (showHiddenProps || inSlots || inComponentDesc || visiblePropPosition >= 0) return;
25906
25901
  if (visiblePropIndexes.length > 0) {
25907
25902
  setPropIdx(visiblePropIndexes[0]);
@@ -25920,22 +25915,22 @@ function FieldEditor({
25920
25915
  setEditorState(next);
25921
25916
  onChange(serializeState(next, value));
25922
25917
  };
25923
- const canonicalize = React9.useCallback((json) => {
25918
+ const canonicalize = React8.useCallback((json) => {
25924
25919
  try {
25925
25920
  return JSON.stringify(JSON.parse(json));
25926
25921
  } catch {
25927
25922
  return `__unparseable__:${json}`;
25928
25923
  }
25929
25924
  }, []);
25930
- const initialStateRef = React9.useRef(initialState);
25925
+ const initialStateRef = React8.useRef(initialState);
25931
25926
  const baselineCanonical = canonicalize(serializeState(initialStateRef.current, value));
25932
25927
  const currentCanonical = canonicalize(serializeState(editorState, value));
25933
25928
  const isDirty = currentCanonical !== baselineCanonical;
25934
- React9.useEffect(() => {
25929
+ React8.useEffect(() => {
25935
25930
  onDirtyChange?.(isDirty);
25936
25931
  }, [isDirty, onDirtyChange]);
25937
- const lastDiscardTriggerRef = React9.useRef(discardTrigger);
25938
- React9.useEffect(() => {
25932
+ const lastDiscardTriggerRef = React8.useRef(discardTrigger);
25933
+ React8.useEffect(() => {
25939
25934
  if (discardTrigger === void 0) return;
25940
25935
  if (discardTrigger === lastDiscardTriggerRef.current) return;
25941
25936
  lastDiscardTriggerRef.current = discardTrigger;
@@ -26534,7 +26529,7 @@ function FieldEditor({
26534
26529
  }
26535
26530
  return Math.max(start + 1, end2);
26536
26531
  };
26537
- useEffect11(() => {
26532
+ useEffect10(() => {
26538
26533
  if (focusLevel === "field" || selectedRowIdx < 0) return;
26539
26534
  setListScrollStart((previous) => {
26540
26535
  if (initialFocusTarget && !initialFocusScrollApplied.current) {
@@ -27905,7 +27900,7 @@ var init_FinalizeDialog = __esm({
27905
27900
  });
27906
27901
 
27907
27902
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-finalize-preview.ts
27908
- import { useEffect as useEffect12, useRef as useRef7, useState as useState16 } from "react";
27903
+ import { useEffect as useEffect11, useRef as useRef7, useState as useState16 } from "react";
27909
27904
  function useReviewFinalizePreview({
27910
27905
  components,
27911
27906
  ...options
@@ -27922,7 +27917,7 @@ function useFinalizePreview(opts) {
27922
27917
  const [scrollOffset, setScrollOffset] = useState16(0);
27923
27918
  const generationRef = useRef7(0);
27924
27919
  const acceptedKey = [...acceptedKeys].sort().join("\0");
27925
- useEffect12(() => {
27920
+ useEffect11(() => {
27926
27921
  if (!open) {
27927
27922
  setStatus("idle");
27928
27923
  setRemoved([]);
@@ -27974,7 +27969,7 @@ var init_use_finalize_preview = __esm({
27974
27969
  });
27975
27970
 
27976
27971
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-session.ts
27977
- import { useCallback as useCallback2, useEffect as useEffect13, useRef as useRef8, useState as useState17 } from "react";
27972
+ import { useCallback as useCallback2, useEffect as useEffect12, useRef as useRef8, useState as useState17 } from "react";
27978
27973
  function useReviewSession({
27979
27974
  loadSession,
27980
27975
  tokensPath,
@@ -27993,7 +27988,7 @@ function useReviewSession({
27993
27988
  }));
27994
27989
  return { result, catalog };
27995
27990
  }, [loadSession, tokensPath]);
27996
- useEffect13(() => {
27991
+ useEffect12(() => {
27997
27992
  let disposed = false;
27998
27993
  void (async () => {
27999
27994
  try {
@@ -28046,7 +28041,7 @@ function useReviewSession({
28046
28041
  function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
28047
28042
  const [reviewMetadata, setReviewMetadata] = useState17(null);
28048
28043
  const [componentRationale, setComponentRationale] = useState17(null);
28049
- useEffect13(() => {
28044
+ useEffect12(() => {
28050
28045
  const current = components[selectedIdx];
28051
28046
  if (!current) {
28052
28047
  setReviewMetadata(null);
@@ -28078,7 +28073,7 @@ function useReviewMetadata({ components, selectedIdx, extractSessionId }) {
28078
28073
  function useReviewHistory({ loading, components, createSnapshot, applySnapshot }) {
28079
28074
  const historyRef = useRef8(null);
28080
28075
  const historySeededRef = useRef8(false);
28081
- useEffect13(() => {
28076
+ useEffect12(() => {
28082
28077
  if (loading || historySeededRef.current) return;
28083
28078
  historySeededRef.current = true;
28084
28079
  historyRef.current = createHistoryStack(createSnapshot(components));
@@ -28160,7 +28155,7 @@ var init_token_suggestions = __esm({
28160
28155
  });
28161
28156
 
28162
28157
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-editor.ts
28163
- import { useEffect as useEffect14, useRef as useRef9, useState as useState18 } from "react";
28158
+ import { useEffect as useEffect13, useRef as useRef9, useState as useState18 } from "react";
28164
28159
  function parseReviewEntry(draftValue) {
28165
28160
  const parsed = JSON.parse(draftValue);
28166
28161
  const keys = Object.keys(parsed);
@@ -28194,7 +28189,7 @@ function useReviewEditor({
28194
28189
  const [tokenReviewEditSelection, setTokenReviewEditSelection] = useState18(/* @__PURE__ */ new Set());
28195
28190
  const tokenReviewSuggestedRef = useRef9(/* @__PURE__ */ new Map());
28196
28191
  const pendingGRef = useRef9(false);
28197
- useEffect14(() => {
28192
+ useEffect13(() => {
28198
28193
  setTokenReviewRow(0);
28199
28194
  setTokenReviewEditing(false);
28200
28195
  setTokenReviewEditCursor(0);
@@ -28667,7 +28662,7 @@ var init_preview_annotations = __esm({
28667
28662
  });
28668
28663
 
28669
28664
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-live-preview.ts
28670
- import { useCallback as useCallback3, useEffect as useEffect15, useRef as useRef10, useState as useState20 } from "react";
28665
+ import { useCallback as useCallback3, useEffect as useEffect14, useRef as useRef10, useState as useState20 } from "react";
28671
28666
  function useLivePreview(opts) {
28672
28667
  const debounceMs = opts.debounceMs ?? DEFAULT_DEBOUNCE_MS;
28673
28668
  const [status, setStatus] = useState20("idle");
@@ -28677,14 +28672,14 @@ function useLivePreview(opts) {
28677
28672
  const latestRef = useRef10(0);
28678
28673
  const inflightRef = useRef10(0);
28679
28674
  const optsRef = useRef10(opts);
28680
- useEffect15(() => {
28675
+ useEffect14(() => {
28681
28676
  optsRef.current = opts;
28682
28677
  });
28683
28678
  const disabledRef = useRef10(disabled);
28684
- useEffect15(() => {
28679
+ useEffect14(() => {
28685
28680
  disabledRef.current = disabled;
28686
28681
  }, [disabled]);
28687
- useEffect15(() => {
28682
+ useEffect14(() => {
28688
28683
  return () => {
28689
28684
  if (timerRef.current) {
28690
28685
  clearTimeout(timerRef.current);
@@ -28765,7 +28760,7 @@ var init_use_live_preview = __esm({
28765
28760
  });
28766
28761
 
28767
28762
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/use-review-preview.ts
28768
- import { useCallback as useCallback4, useEffect as useEffect16, useState as useState21 } from "react";
28763
+ import { useCallback as useCallback4, useEffect as useEffect15, useState as useState21 } from "react";
28769
28764
  function useReviewPreview({
28770
28765
  components,
28771
28766
  loading,
@@ -28807,13 +28802,13 @@ function useReviewPreview({
28807
28802
  deleteAllComponents
28808
28803
  });
28809
28804
  const [spinnerTick, setSpinnerTick] = useState21(0);
28810
- useEffect16(() => {
28805
+ useEffect15(() => {
28811
28806
  if (livePreviewHook.status !== "running") return;
28812
28807
  const id = setInterval(() => setSpinnerTick((tick) => tick + 1), 80);
28813
28808
  return () => clearInterval(id);
28814
28809
  }, [livePreviewHook.status]);
28815
28810
  const livePreviewSpinner = SPINNER_FRAMES[spinnerTick % SPINNER_FRAMES.length];
28816
- useEffect16(() => {
28811
+ useEffect15(() => {
28817
28812
  if (loading) return;
28818
28813
  if (!livePreview) return;
28819
28814
  if (components.length === 0) return;
@@ -28870,7 +28865,7 @@ var init_LivePreviewSummary = __esm({
28870
28865
  });
28871
28866
 
28872
28867
  // packages/experience-design-system-cli/src/tui/import/steps/09-review/generate-review-step.tsx
28873
- import { useCallback as useCallback5, useEffect as useEffect17, useMemo as useMemo4, useRef as useRef11, useState as useState22 } from "react";
28868
+ import { useCallback as useCallback5, useEffect as useEffect16, useMemo as useMemo4, useRef as useRef11, useState as useState22 } from "react";
28874
28869
  import figures7 from "figures";
28875
28870
  import { Box as Box33, Text as Text36 } from "ink";
28876
28871
  import { Fragment as Fragment13, jsx as jsx43, jsxs as jsxs34 } from "react/jsx-runtime";
@@ -29191,7 +29186,7 @@ function GenerateReviewStepView({
29191
29186
  [components]
29192
29187
  );
29193
29188
  const closures = useMemo4(() => computeAllClosures(componentGraph), [componentGraph]);
29194
- useEffect17(() => {
29189
+ useEffect16(() => {
29195
29190
  if (seededGroupsRef.current) return;
29196
29191
  if (closures.size === 0 && slotCycles.length === 0) return;
29197
29192
  seededGroupsRef.current = true;
@@ -29218,7 +29213,7 @@ function GenerateReviewStepView({
29218
29213
  suggestedBreak: cycle.edges.length > 0 ? suggestCycleBreakEdge2(cycle, cycleView.pushBlocking) : null
29219
29214
  }));
29220
29215
  }, [slotCycles, cycleView]);
29221
- useEffect17(() => {
29216
+ useEffect16(() => {
29222
29217
  const decision = computeAutoRejectDecision({
29223
29218
  loading,
29224
29219
  autoRejectFired: autoRejectFiredRef.current,
@@ -29262,7 +29257,7 @@ function GenerateReviewStepView({
29262
29257
  applySnapshot: applyHistorySnapshot
29263
29258
  });
29264
29259
  const autoRejectPushedRef = useRef11(false);
29265
- useEffect17(() => {
29260
+ useEffect16(() => {
29266
29261
  if (loading) return;
29267
29262
  if (!historySeededRef.current) return;
29268
29263
  if (!autoRejectFiredRef.current) return;
@@ -29346,7 +29341,7 @@ function GenerateReviewStepView({
29346
29341
  const panelHeight = leftPanelHeight + 2;
29347
29342
  const panelContentHeight = Math.max(1, panelHeight - 3);
29348
29343
  const cycleViewportHeight = Math.max(1, panelHeight - 4);
29349
- useEffect17(() => {
29344
+ useEffect16(() => {
29350
29345
  if (selectableRowPositions.length === 0) return;
29351
29346
  const cursorInRange = selectableRowPositions.includes(cursorRowIdx);
29352
29347
  const maxScroll = Math.max(0, visibleRowsMemo.length - visibleCount);
@@ -30446,10 +30441,10 @@ var init_path_utils = __esm({
30446
30441
  });
30447
30442
 
30448
30443
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-blinking-cursor.ts
30449
- import { useEffect as useEffect18, useState as useState23 } from "react";
30444
+ import { useEffect as useEffect17, useState as useState23 } from "react";
30450
30445
  function useBlinkingCursor() {
30451
30446
  const [visible, setVisible] = useState23(true);
30452
- useEffect18(() => {
30447
+ useEffect17(() => {
30453
30448
  const interval = setInterval(() => setVisible((current) => !current), 500);
30454
30449
  return () => clearInterval(interval);
30455
30450
  }, []);
@@ -30576,12 +30571,12 @@ var init_StepHeader = __esm({
30576
30571
  });
30577
30572
 
30578
30573
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/support/use-timed-spinner.tsx
30579
- import { useEffect as useEffect19, useState as useState25 } from "react";
30574
+ import { useEffect as useEffect18, useState as useState25 } from "react";
30580
30575
  import { Spinner as Spinner2 } from "@inkjs/ui";
30581
30576
  import { jsx as jsx49 } from "react/jsx-runtime";
30582
30577
  function useTimedSpinner() {
30583
30578
  const [elapsedSeconds, setElapsedSeconds] = useState25(0);
30584
- useEffect19(() => {
30579
+ useEffect18(() => {
30585
30580
  const timer = setInterval(() => setElapsedSeconds((current) => current + 1), 1e3);
30586
30581
  return () => {
30587
30582
  clearInterval(timer);
@@ -30827,7 +30822,7 @@ var init_preview_confirmation_input = __esm({
30827
30822
  });
30828
30823
 
30829
30824
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/screens/WizardPreviewStep.tsx
30830
- import { useEffect as useEffect20, useState as useState26, useMemo as useMemo5 } from "react";
30825
+ import { useEffect as useEffect19, useState as useState26, useMemo as useMemo5 } from "react";
30831
30826
  import { Box as Box40, Text as Text43 } from "ink";
30832
30827
  import { Fragment as Fragment15, jsx as jsx51, jsxs as jsxs41 } from "react/jsx-runtime";
30833
30828
  function buildPreviewSummaryLines(preview) {
@@ -31039,7 +31034,7 @@ function WizardPreviewStep({
31039
31034
  const activeLines = diffExpanded ? diffLines : summaryLines;
31040
31035
  const maxScroll = Math.max(0, activeLines.length - viewportHeight);
31041
31036
  const boundedScrollOffset = Math.min(scrollOffset, maxScroll);
31042
- useEffect20(() => {
31037
+ useEffect19(() => {
31043
31038
  setScrollOffset((previous) => Math.min(previous, maxScroll));
31044
31039
  }, [maxScroll]);
31045
31040
  useImmediateInput((input, key) => {
@@ -31143,7 +31138,6 @@ var init_run_teaser = __esm({
31143
31138
  });
31144
31139
 
31145
31140
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/screen.tsx
31146
- import { useEffect as useEffect21, useRef as useRef12 } from "react";
31147
31141
  import { Box as Box41 } from "ink";
31148
31142
  import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
31149
31143
  function totalStepsFor(state) {
@@ -31159,18 +31153,10 @@ function FlowScreen({
31159
31153
  controller,
31160
31154
  livePreview = true,
31161
31155
  generatePromptPath,
31162
- onExit,
31163
- onStepChange
31156
+ onExit
31164
31157
  }) {
31165
31158
  const totalSteps = totalStepsFor(state);
31166
31159
  const quit = () => onExit(0);
31167
- const previousStep = useRef12(state.step);
31168
- useEffect21(() => {
31169
- if (previousStep.current !== state.step) {
31170
- onStepChange?.();
31171
- previousStep.current = state.step;
31172
- }
31173
- }, [state.step, onStepChange]);
31174
31160
  const content = (() => {
31175
31161
  switch (state.step) {
31176
31162
  case "final-review":
@@ -31938,6 +31924,12 @@ function createFlowController(start, deps) {
31938
31924
  deps.log({ update: sanitizeForLog(patch) });
31939
31925
  } catch {
31940
31926
  }
31927
+ if (patch.step !== void 0 && patch.step !== state.step) {
31928
+ try {
31929
+ deps.beforeStepChange?.();
31930
+ } catch {
31931
+ }
31932
+ }
31941
31933
  state = { ...state, ...patch };
31942
31934
  for (const listener of listeners) listener();
31943
31935
  };
@@ -32090,22 +32082,26 @@ var init_controller = __esm({
32090
32082
  });
32091
32083
 
32092
32084
  // packages/experience-design-system-cli/src/tui/import/steps/10-flow/flow/use-flow.ts
32093
- import { useEffect as useEffect22, useRef as useRef13, useSyncExternalStore } from "react";
32094
- function useFlow(start, deps = realFlowDeps) {
32095
- const controller = useRef13();
32085
+ import { useEffect as useEffect20, useRef as useRef12, useSyncExternalStore } from "react";
32086
+ function useFlow(start, options = {}) {
32087
+ const controller = useRef12();
32096
32088
  if (start && !controller.current) {
32097
32089
  try {
32098
32090
  startWizardLog();
32099
32091
  } catch {
32100
32092
  }
32101
- controller.current = createFlowController(start, deps());
32093
+ const flowDeps = (options.deps ?? realFlowDeps)();
32094
+ controller.current = createFlowController(start, {
32095
+ ...flowDeps,
32096
+ ...options.beforeStepChange ? { beforeStepChange: options.beforeStepChange } : {}
32097
+ });
32102
32098
  }
32103
32099
  const current = controller.current;
32104
32100
  const state = useSyncExternalStore(
32105
32101
  (listener) => current?.subscribe(listener) ?? (() => void 0),
32106
32102
  () => current?.getState()
32107
32103
  );
32108
- useEffect22(() => {
32104
+ useEffect20(() => {
32109
32105
  if (!start) controller.current = void 0;
32110
32106
  }, [start]);
32111
32107
  return current && state ? { controller: current, state } : void 0;
@@ -32318,7 +32314,7 @@ var init_help_info = __esm({
32318
32314
  });
32319
32315
 
32320
32316
  // packages/experience-design-system-cli/src/tui/help/PageContainer.tsx
32321
- import { useEffect as useEffect23, useState as useState27 } from "react";
32317
+ import { useEffect as useEffect21, useState as useState27 } from "react";
32322
32318
  import { Box as Box42, Text as Text44, useInput as useInput9 } from "ink";
32323
32319
  import { Fragment as Fragment16, jsx as jsx53, jsxs as jsxs43 } from "react/jsx-runtime";
32324
32320
  function Section({ title, rows }) {
@@ -32332,7 +32328,7 @@ function Section({ title, rows }) {
32332
32328
  }
32333
32329
  function HelpScreen({ onDone }) {
32334
32330
  const [info, setInfo] = useState27();
32335
- useEffect23(() => {
32331
+ useEffect21(() => {
32336
32332
  startDebugRun({ flow: "help", step: "01-help", menuOption: "Help", inputs: {} });
32337
32333
  void readHelpInfo().then(setInfo);
32338
32334
  }, []);
@@ -32481,7 +32477,7 @@ var init_config_store = __esm({
32481
32477
  });
32482
32478
 
32483
32479
  // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
32484
- import { useEffect as useEffect24, useState as useState29 } from "react";
32480
+ import { useEffect as useEffect22, useState as useState29 } from "react";
32485
32481
  import { Box as Box44, Text as Text46, useInput as useInput11 } from "ink";
32486
32482
  import TextInput4 from "ink-text-input";
32487
32483
  import { Fragment as Fragment17, jsx as jsx55, jsxs as jsxs45 } from "react/jsx-runtime";
@@ -32503,7 +32499,7 @@ function ConfigurationScreen({ onDone }) {
32503
32499
  const [lastSaved, setLastSaved] = useState29(null);
32504
32500
  const [editing, setEditing] = useState29(false);
32505
32501
  const [valueBeforeEdit, setValueBeforeEdit] = useState29("");
32506
- useEffect24(() => {
32502
+ useEffect22(() => {
32507
32503
  readCredentials().then((cfg) => {
32508
32504
  setConfig(cfg);
32509
32505
  setStage("form");
@@ -32687,13 +32683,13 @@ var init_analytics_store = __esm({
32687
32683
  });
32688
32684
 
32689
32685
  // packages/experience-design-system-cli/src/tui/settings/opt-in-analytics/screen.tsx
32690
- import { useEffect as useEffect25, useState as useState30 } from "react";
32686
+ import { useEffect as useEffect23, useState as useState30 } from "react";
32691
32687
  import { Box as Box45, Text as Text47, useInput as useInput12 } from "ink";
32692
32688
  import { Fragment as Fragment18, jsx as jsx56, jsxs as jsxs46 } from "react/jsx-runtime";
32693
32689
  function OptInAnalyticsScreen({ onDone }) {
32694
32690
  const [loading, setLoading] = useState30(true);
32695
32691
  const [enabled, setEnabled] = useState30(true);
32696
- useEffect25(() => {
32692
+ useEffect23(() => {
32697
32693
  readAnalyticsSetting().then((setting) => {
32698
32694
  setEnabled(setting.enabled);
32699
32695
  setLoading(false);
@@ -32756,12 +32752,12 @@ var init_screen11 = __esm({
32756
32752
  });
32757
32753
 
32758
32754
  // packages/experience-design-system-cli/src/tui/upgrade/PageContainer.tsx
32759
- import { useEffect as useEffect26, useState as useState31 } from "react";
32755
+ import { useEffect as useEffect24, useState as useState31 } from "react";
32760
32756
  import { Box as Box46, Text as Text48, useInput as useInput13 } from "ink";
32761
32757
  import { jsx as jsx57, jsxs as jsxs47 } from "react/jsx-runtime";
32762
32758
  function UpgradeScreen({ onDone }) {
32763
32759
  const [upgradeCheck, setUpgradeCheck] = useState31();
32764
- useEffect26(() => {
32760
+ useEffect24(() => {
32765
32761
  startDebugRun({
32766
32762
  flow: "upgrade",
32767
32763
  step: "01-upgrade",
@@ -32836,13 +32832,13 @@ var init_PageContainer4 = __esm({
32836
32832
  });
32837
32833
 
32838
32834
  // packages/experience-design-system-cli/src/tui/settings/debug-mode/screen.tsx
32839
- import { useEffect as useEffect27, useState as useState32 } from "react";
32835
+ import { useEffect as useEffect25, useState as useState32 } from "react";
32840
32836
  import { Box as Box47, Text as Text49, useInput as useInput14 } from "ink";
32841
32837
  import { jsx as jsx58, jsxs as jsxs48 } from "react/jsx-runtime";
32842
32838
  function DebugModeScreen({ onDone }) {
32843
32839
  const [loading, setLoading] = useState32(true);
32844
32840
  const [enabled, setEnabled] = useState32(true);
32845
- useEffect27(() => {
32841
+ useEffect25(() => {
32846
32842
  readDebugModeSetting().then((setting) => {
32847
32843
  setEnabled(setting.enabled);
32848
32844
  setLoading(false);
@@ -32905,7 +32901,7 @@ __export(app_exports, {
32905
32901
  runApp: () => runApp
32906
32902
  });
32907
32903
  import { join as join27 } from "node:path";
32908
- import { useEffect as useEffect28, useState as useState33 } from "react";
32904
+ import { useEffect as useEffect26, useState as useState33 } from "react";
32909
32905
  import { Fragment as Fragment19, jsx as jsx59 } from "react/jsx-runtime";
32910
32906
  function App({ importOptions, inkClear }) {
32911
32907
  const [screen, setScreen] = useState33("start");
@@ -32935,9 +32931,9 @@ function App({ importOptions, inkClear }) {
32935
32931
  const [generationInput, setGenerationInput] = useState33();
32936
32932
  const generation = useGeneration(generationInput);
32937
32933
  const [flowStart, setFlowStart] = useState33();
32938
- const flow = useFlow(flowStart);
32934
+ const flow = useFlow(flowStart, { beforeStepChange: inkClear });
32939
32935
  const [importDefaults, setImportDefaults] = useState33();
32940
- useEffect28(() => {
32936
+ useEffect26(() => {
32941
32937
  if (screen !== "import") {
32942
32938
  setImportDefaults(void 0);
32943
32939
  return;
@@ -32995,12 +32991,12 @@ function App({ importOptions, inkClear }) {
32995
32991
  }
32996
32992
  });
32997
32993
  };
32998
- useEffect28(() => {
32994
+ useEffect26(() => {
32999
32995
  if (!extractionRun || extraction?.status !== "done" || !extraction.result.ok) return;
33000
32996
  setExtractionRun(void 0);
33001
32997
  setScopeRun({ ...extractionRun, extraction: extraction.result.extraction });
33002
32998
  }, [extraction, extractionRun]);
33003
- useEffect28(() => {
32999
+ useEffect26(() => {
33004
33000
  if (!scopeRun || scopeFlow?.status !== "confirmed" || generationInput) return;
33005
33001
  const { extraction: produced, input, generatePromptPath } = scopeRun;
33006
33002
  setGenerationInput({
@@ -33018,7 +33014,7 @@ function App({ importOptions, inkClear }) {
33018
33014
  ...generatePromptPath ? { generatePromptPath } : {}
33019
33015
  });
33020
33016
  }, [scopeFlow, scopeRun, generationInput]);
33021
- useEffect28(() => {
33017
+ useEffect26(() => {
33022
33018
  if (!scopeRun || generation?.status !== "done" || !generation.result.ok) return;
33023
33019
  const { credentialsSkipped, tokenStrategy, extraction: produced, input, generatePromptPath } = scopeRun;
33024
33020
  inkClear();
@@ -33069,11 +33065,7 @@ function App({ importOptions, inkClear }) {
33069
33065
  state: flow.state,
33070
33066
  controller: flow.controller,
33071
33067
  generatePromptPath: flowStart.generatePromptPath,
33072
- onExit: (code) => {
33073
- inkClear();
33074
- setImportExitCode(code);
33075
- },
33076
- onStepChange: inkClear
33068
+ onExit: setImportExitCode
33077
33069
  }
33078
33070
  );
33079
33071
  }