@contentful/experience-design-system-cli 2.37.1-dev-build-7a46c9e6.0 → 2.37.1-dev-build-5fe4d4be.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/app.js CHANGED
@@ -7429,9 +7429,6 @@ function PreviewBadge({
7429
7429
 
7430
7430
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/sidebar/components/GroupedSidebar.tsx
7431
7431
  import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
7432
- function slotEdgeKey(parent, child) {
7433
- return `${parent}\u2192${child}`;
7434
- }
7435
7432
  var GLYPH_EXPAND_COLLAPSED = "\u25B8";
7436
7433
  var GLYPH_EXPAND_EXPANDED = "\u25BE";
7437
7434
  var GLYPH_TREE_MID = "\u251C\u2500";
@@ -7849,7 +7846,6 @@ function GroupedSidebar(props) {
7849
7846
  showFlatTier,
7850
7847
  viewMode,
7851
7848
  selectionStateByKey,
7852
- excludedSlotEdges,
7853
7849
  aiFlaggedByKey,
7854
7850
  dimPredicate,
7855
7851
  visibleRows: providedRows,
@@ -7880,8 +7876,7 @@ function GroupedSidebar(props) {
7880
7876
  const badge = itemName ? previewBadge(previewAnnotationByKey?.get(itemName)) : null;
7881
7877
  const showInheritance = rs !== void 0 && row.kind !== "cycle" && row.kind !== "empty" && row.kind !== "group-root";
7882
7878
  const supportsSelectionGlyph = selectionStateByKey !== void 0 && itemName !== void 0 && (row.kind === "standalone" || row.kind === "group-root" || row.kind === "group-child" || row.kind === "flat" || row.kind === "empty" || row.kind === "cycle");
7883
- const edgeExcluded = row.kind === "group-child" && row.parentName !== void 0 && itemName !== void 0 && excludedSlotEdges?.has(slotEdgeKey(row.parentName, itemName)) === true;
7884
- const selState = supportsSelectionGlyph ? edgeExcluded ? "undecided" : selectionStateByKey.get(itemName) ?? "undecided" : void 0;
7879
+ const selState = supportsSelectionGlyph ? selectionStateByKey.get(itemName) ?? "undecided" : void 0;
7885
7880
  const isCycleRow = row.kind === "cycle";
7886
7881
  const selStyle = selectionGlyphStyleFor(selState, isCycleRow);
7887
7882
  const selGlyph = selStyle.glyph;
@@ -8554,6 +8549,7 @@ function resolveKey(mode, key, ctx) {
8554
8549
  function resolveMain(key, ctx) {
8555
8550
  const { input } = key;
8556
8551
  const inMain = ctx.focusedColumn === "main";
8552
+ if (key.ctrl && input === "z") return { type: "undo" };
8557
8553
  if (input === "q" || key.escape) {
8558
8554
  if (key.escape && ctx.jumpFilterActive) return { type: "clear-jump-filter" };
8559
8555
  if (key.escape && ctx.searchActive) return { type: "clear-search" };
@@ -8812,22 +8808,42 @@ function rejectNeedsConfirmation(graph, name, state) {
8812
8808
  const ancestors = toReject.filter((n) => n !== name);
8813
8809
  return ancestors.length + toDeselect.length >= 2;
8814
8810
  }
8815
- function partitionDecisions(components, state) {
8811
+ function removeSlotChild(components, edge) {
8812
+ return components.map(
8813
+ (component) => component.name === edge.parent ? {
8814
+ ...component,
8815
+ slots: component.slots?.map((slot) => ({
8816
+ ...slot,
8817
+ allowedComponents: slot.allowedComponents.filter((name) => name !== edge.child)
8818
+ }))
8819
+ } : component
8820
+ );
8821
+ }
8822
+ function withoutSlotChildren(components, removedEdges) {
8823
+ return removedEdges.reduce(removeSlotChild, components);
8824
+ }
8825
+ function partitionDecisions(components, state, removedEdges) {
8816
8826
  const accepted = [];
8817
8827
  const rejected = [];
8818
8828
  for (const c2 of components) {
8819
8829
  if (state.get(c2.name) === "accepted") accepted.push(c2.name);
8820
8830
  else rejected.push(c2.name);
8821
8831
  }
8822
- return { accepted, rejected, excludedSlotEdges: [] };
8832
+ const rejectedNames = new Set(rejected);
8833
+ const excludedSlotEdges = removedEdges.filter((e) => !rejectedNames.has(e.parent) && !rejectedNames.has(e.child));
8834
+ return { accepted, rejected, excludedSlotEdges };
8823
8835
  }
8824
8836
 
8825
8837
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
8826
- function useScopeGate({ components, onConfirm, onQuit }) {
8838
+ function useScopeGate({ components: loadedComponents, onConfirm, onQuit }) {
8827
8839
  const { columns: totalWidth, rows: terminalRows } = useTerminalSize();
8828
8840
  const columnPlan = useMemo2(() => computeColumnWidths(totalWidth), [totalWidth]);
8829
8841
  const [decisions, setDecisions] = useState12(/* @__PURE__ */ new Map());
8830
- const [excludedEdges, setExcludedEdges] = useState12(/* @__PURE__ */ new Set());
8842
+ const [removedEdges, setRemovedEdges] = useState12([]);
8843
+ const components = useMemo2(
8844
+ () => withoutSlotChildren(loadedComponents, removedEdges),
8845
+ [loadedComponents, removedEdges]
8846
+ );
8831
8847
  const [nav, setNav] = useState12({ cursor: 0, scrollOffset: 0 });
8832
8848
  const [focusedColumn, setFocusedColumn] = useState12("main");
8833
8849
  const [addedComponentsCursor, setAddedComponentsCursor] = useState12(0);
@@ -9005,22 +9021,8 @@ function useScopeGate({ components, onConfirm, onQuit }) {
9005
9021
  const child = groupedItems[row.itemIdx]?.key;
9006
9022
  return child ? { parent: row.parentName, child } : void 0;
9007
9023
  };
9008
- const setEdgeExcluded = (edge, excluded) => {
9009
- setExcludedEdges((prev) => {
9010
- const next = new Set(prev);
9011
- const key = slotEdgeKey(edge.parent, edge.child);
9012
- if (excluded) next.add(key);
9013
- else next.delete(key);
9014
- return next;
9015
- });
9016
- };
9017
- const confirmedEdges = (rejected) => {
9018
- const rejectedSet = new Set(rejected);
9019
- return [...excludedEdges].map((key) => {
9020
- const [parent, child] = key.split("\u2192");
9021
- return { parent, child };
9022
- }).filter((edge) => !rejectedSet.has(edge.parent) && !rejectedSet.has(edge.child));
9023
- };
9024
+ const removeFromParentSlot = (edge) => setRemovedEdges((edges) => [...edges, edge]);
9025
+ const undoSlotRemoval = () => setRemovedEdges((edges) => edges.slice(0, -1));
9024
9026
  const jumpCursorTo = (name) => {
9025
9027
  let idx = -1;
9026
9028
  for (let i = 0; i < visibleRows.length; i++) {
@@ -9120,10 +9122,7 @@ function useScopeGate({ components, onConfirm, onQuit }) {
9120
9122
  onQuit();
9121
9123
  return;
9122
9124
  case "confirm":
9123
- {
9124
- const partition = partitionDecisions(components, decisions);
9125
- onConfirm({ ...partition, excludedSlotEdges: confirmedEdges(partition.rejected) });
9126
- }
9125
+ onConfirm(partitionDecisions(components, decisions, removedEdges));
9127
9126
  return;
9128
9127
  case "close-help":
9129
9128
  setShowHelp(false);
@@ -9171,8 +9170,6 @@ function useScopeGate({ components, onConfirm, onQuit }) {
9171
9170
  }
9172
9171
  return;
9173
9172
  case "accept": {
9174
- const edge = focusedNestedEdge();
9175
- if (edge) setEdgeExcluded(edge, false);
9176
9173
  const key = focusedRowKey();
9177
9174
  if (key) decide({ type: "accept", name: key });
9178
9175
  return;
@@ -9180,7 +9177,7 @@ function useScopeGate({ components, onConfirm, onQuit }) {
9180
9177
  case "reject": {
9181
9178
  const edge = focusedColumn === "main" ? focusedNestedEdge() : void 0;
9182
9179
  if (edge) {
9183
- setEdgeExcluded(edge, true);
9180
+ removeFromParentSlot(edge);
9184
9181
  return;
9185
9182
  }
9186
9183
  const key = focusedColumn === "added-components" ? addedComponents[safeAddedComponentsCursor]?.name : focusedRowKey();
@@ -9190,6 +9187,9 @@ function useScopeGate({ components, onConfirm, onQuit }) {
9190
9187
  case "toggle-all":
9191
9188
  decide({ type: "toggle-all" });
9192
9189
  return;
9190
+ case "undo":
9191
+ undoSlotRemoval();
9192
+ return;
9193
9193
  case "accept-unflagged":
9194
9194
  decide({ type: "accept-unflagged" });
9195
9195
  return;
@@ -9284,7 +9284,6 @@ function useScopeGate({ components, onConfirm, onQuit }) {
9284
9284
  visibleCount,
9285
9285
  panelMaxRows,
9286
9286
  // sidebar
9287
- excludedEdges,
9288
9287
  groupedItems,
9289
9288
  graph,
9290
9289
  hasGroupRoots,
@@ -9410,7 +9409,6 @@ function ScopeGateView({ components, onConfirm, onQuit }) {
9410
9409
  visibleCount: gate.visibleCount,
9411
9410
  showFlatTier: false,
9412
9411
  selectionStateByKey: gate.selectionStateByKey,
9413
- excludedSlotEdges: gate.excludedEdges,
9414
9412
  aiFlaggedByKey: gate.aiFlaggedByKey,
9415
9413
  dimPredicate: gate.dimPredicate,
9416
9414
  visibleRows: gate.visibleRows,
package/dist/index.js CHANGED
@@ -10185,9 +10185,6 @@ var init_badge = __esm({
10185
10185
  import figures4 from "figures";
10186
10186
  import { Box as Box17, Text as Text19 } from "ink";
10187
10187
  import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
10188
- function slotEdgeKey(parent, child) {
10189
- return `${parent}\u2192${child}`;
10190
- }
10191
10188
  function isEmpty(entry) {
10192
10189
  return Object.keys(entry.$properties ?? {}).length === 0 && Object.keys(entry.$slots ?? {}).length === 0;
10193
10190
  }
@@ -10599,7 +10596,6 @@ function GroupedSidebar(props) {
10599
10596
  showFlatTier,
10600
10597
  viewMode,
10601
10598
  selectionStateByKey,
10602
- excludedSlotEdges,
10603
10599
  aiFlaggedByKey,
10604
10600
  dimPredicate,
10605
10601
  visibleRows: providedRows,
@@ -10630,8 +10626,7 @@ function GroupedSidebar(props) {
10630
10626
  const badge = itemName ? previewBadge(previewAnnotationByKey?.get(itemName)) : null;
10631
10627
  const showInheritance = rs !== void 0 && row.kind !== "cycle" && row.kind !== "empty" && row.kind !== "group-root";
10632
10628
  const supportsSelectionGlyph = selectionStateByKey !== void 0 && itemName !== void 0 && (row.kind === "standalone" || row.kind === "group-root" || row.kind === "group-child" || row.kind === "flat" || row.kind === "empty" || row.kind === "cycle");
10633
- const edgeExcluded = row.kind === "group-child" && row.parentName !== void 0 && itemName !== void 0 && excludedSlotEdges?.has(slotEdgeKey(row.parentName, itemName)) === true;
10634
- const selState = supportsSelectionGlyph ? edgeExcluded ? "undecided" : selectionStateByKey.get(itemName) ?? "undecided" : void 0;
10629
+ const selState = supportsSelectionGlyph ? selectionStateByKey.get(itemName) ?? "undecided" : void 0;
10635
10630
  const isCycleRow = row.kind === "cycle";
10636
10631
  const selStyle = selectionGlyphStyleFor(selState, isCycleRow);
10637
10632
  const selGlyph = selStyle.glyph;
@@ -11396,6 +11391,7 @@ function resolveKey(mode, key, ctx) {
11396
11391
  function resolveMain(key, ctx) {
11397
11392
  const { input } = key;
11398
11393
  const inMain = ctx.focusedColumn === "main";
11394
+ if (key.ctrl && input === "z") return { type: "undo" };
11399
11395
  if (input === "q" || key.escape) {
11400
11396
  if (key.escape && ctx.jumpFilterActive) return { type: "clear-jump-filter" };
11401
11397
  if (key.escape && ctx.searchActive) return { type: "clear-search" };
@@ -11694,14 +11690,30 @@ function rejectNeedsConfirmation(graph, name, state) {
11694
11690
  const ancestors = toReject.filter((n) => n !== name);
11695
11691
  return ancestors.length + toDeselect.length >= 2;
11696
11692
  }
11697
- function partitionDecisions(components, state) {
11693
+ function removeSlotChild(components, edge) {
11694
+ return components.map(
11695
+ (component) => component.name === edge.parent ? {
11696
+ ...component,
11697
+ slots: component.slots?.map((slot) => ({
11698
+ ...slot,
11699
+ allowedComponents: slot.allowedComponents.filter((name) => name !== edge.child)
11700
+ }))
11701
+ } : component
11702
+ );
11703
+ }
11704
+ function withoutSlotChildren(components, removedEdges) {
11705
+ return removedEdges.reduce(removeSlotChild, components);
11706
+ }
11707
+ function partitionDecisions(components, state, removedEdges) {
11698
11708
  const accepted = [];
11699
11709
  const rejected = [];
11700
11710
  for (const c2 of components) {
11701
11711
  if (state.get(c2.name) === "accepted") accepted.push(c2.name);
11702
11712
  else rejected.push(c2.name);
11703
11713
  }
11704
- return { accepted, rejected, excludedSlotEdges: [] };
11714
+ const rejectedNames = new Set(rejected);
11715
+ const excludedSlotEdges = removedEdges.filter((e) => !rejectedNames.has(e.parent) && !rejectedNames.has(e.child));
11716
+ return { accepted, rejected, excludedSlotEdges };
11705
11717
  }
11706
11718
  var init_state = __esm({
11707
11719
  "packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/state.ts"() {
@@ -11713,11 +11725,15 @@ var init_state = __esm({
11713
11725
 
11714
11726
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
11715
11727
  import { useEffect as useEffect7, useMemo as useMemo2, useRef as useRef4, useState as useState12 } from "react";
11716
- function useScopeGate({ components, onConfirm, onQuit }) {
11728
+ function useScopeGate({ components: loadedComponents, onConfirm, onQuit }) {
11717
11729
  const { columns: totalWidth, rows: terminalRows } = useTerminalSize();
11718
11730
  const columnPlan = useMemo2(() => computeColumnWidths(totalWidth), [totalWidth]);
11719
11731
  const [decisions, setDecisions] = useState12(/* @__PURE__ */ new Map());
11720
- const [excludedEdges, setExcludedEdges] = useState12(/* @__PURE__ */ new Set());
11732
+ const [removedEdges, setRemovedEdges] = useState12([]);
11733
+ const components = useMemo2(
11734
+ () => withoutSlotChildren(loadedComponents, removedEdges),
11735
+ [loadedComponents, removedEdges]
11736
+ );
11721
11737
  const [nav, setNav] = useState12({ cursor: 0, scrollOffset: 0 });
11722
11738
  const [focusedColumn, setFocusedColumn] = useState12("main");
11723
11739
  const [addedComponentsCursor, setAddedComponentsCursor] = useState12(0);
@@ -11895,22 +11911,8 @@ function useScopeGate({ components, onConfirm, onQuit }) {
11895
11911
  const child = groupedItems[row.itemIdx]?.key;
11896
11912
  return child ? { parent: row.parentName, child } : void 0;
11897
11913
  };
11898
- const setEdgeExcluded = (edge, excluded) => {
11899
- setExcludedEdges((prev) => {
11900
- const next = new Set(prev);
11901
- const key = slotEdgeKey(edge.parent, edge.child);
11902
- if (excluded) next.add(key);
11903
- else next.delete(key);
11904
- return next;
11905
- });
11906
- };
11907
- const confirmedEdges = (rejected) => {
11908
- const rejectedSet = new Set(rejected);
11909
- return [...excludedEdges].map((key) => {
11910
- const [parent, child] = key.split("\u2192");
11911
- return { parent, child };
11912
- }).filter((edge) => !rejectedSet.has(edge.parent) && !rejectedSet.has(edge.child));
11913
- };
11914
+ const removeFromParentSlot = (edge) => setRemovedEdges((edges) => [...edges, edge]);
11915
+ const undoSlotRemoval = () => setRemovedEdges((edges) => edges.slice(0, -1));
11914
11916
  const jumpCursorTo = (name) => {
11915
11917
  let idx = -1;
11916
11918
  for (let i = 0; i < visibleRows.length; i++) {
@@ -12010,10 +12012,7 @@ function useScopeGate({ components, onConfirm, onQuit }) {
12010
12012
  onQuit();
12011
12013
  return;
12012
12014
  case "confirm":
12013
- {
12014
- const partition = partitionDecisions(components, decisions);
12015
- onConfirm({ ...partition, excludedSlotEdges: confirmedEdges(partition.rejected) });
12016
- }
12015
+ onConfirm(partitionDecisions(components, decisions, removedEdges));
12017
12016
  return;
12018
12017
  case "close-help":
12019
12018
  setShowHelp(false);
@@ -12061,8 +12060,6 @@ function useScopeGate({ components, onConfirm, onQuit }) {
12061
12060
  }
12062
12061
  return;
12063
12062
  case "accept": {
12064
- const edge = focusedNestedEdge();
12065
- if (edge) setEdgeExcluded(edge, false);
12066
12063
  const key = focusedRowKey();
12067
12064
  if (key) decide({ type: "accept", name: key });
12068
12065
  return;
@@ -12070,7 +12067,7 @@ function useScopeGate({ components, onConfirm, onQuit }) {
12070
12067
  case "reject": {
12071
12068
  const edge = focusedColumn === "main" ? focusedNestedEdge() : void 0;
12072
12069
  if (edge) {
12073
- setEdgeExcluded(edge, true);
12070
+ removeFromParentSlot(edge);
12074
12071
  return;
12075
12072
  }
12076
12073
  const key = focusedColumn === "added-components" ? addedComponents[safeAddedComponentsCursor]?.name : focusedRowKey();
@@ -12080,6 +12077,9 @@ function useScopeGate({ components, onConfirm, onQuit }) {
12080
12077
  case "toggle-all":
12081
12078
  decide({ type: "toggle-all" });
12082
12079
  return;
12080
+ case "undo":
12081
+ undoSlotRemoval();
12082
+ return;
12083
12083
  case "accept-unflagged":
12084
12084
  decide({ type: "accept-unflagged" });
12085
12085
  return;
@@ -12174,7 +12174,6 @@ function useScopeGate({ components, onConfirm, onQuit }) {
12174
12174
  visibleCount,
12175
12175
  panelMaxRows,
12176
12176
  // sidebar
12177
- excludedEdges,
12178
12177
  groupedItems,
12179
12178
  graph,
12180
12179
  hasGroupRoots,
@@ -12287,7 +12286,6 @@ function ScopeGateView({ components, onConfirm, onQuit }) {
12287
12286
  visibleCount: gate.visibleCount,
12288
12287
  showFlatTier: false,
12289
12288
  selectionStateByKey: gate.selectionStateByKey,
12290
- excludedSlotEdges: gate.excludedEdges,
12291
12289
  aiFlaggedByKey: gate.aiFlaggedByKey,
12292
12290
  dimPredicate: gate.dimPredicate,
12293
12291
  visibleRows: gate.visibleRows,
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.37.1-dev-build-7a46c9e6.0",
3
+ "version": "2.37.1-dev-build-5fe4d4be.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -80,5 +80,7 @@ export type GateAction = {
80
80
  type: 'toggle-jump-filter';
81
81
  } | {
82
82
  type: 'toggle-view';
83
+ } | {
84
+ type: 'undo';
83
85
  };
84
86
  export declare function resolveKey(mode: GateMode, key: KeyPress, ctx: GateContext): GateAction;
@@ -27,8 +27,6 @@ export interface GroupedSidebarProps {
27
27
  alwaysExpanded?: boolean;
28
28
  showFlatTier?: boolean;
29
29
  selectionStateByKey?: Map<string, 'accepted' | 'rejected' | 'undecided'>;
30
- /** `parent→child` slot edges the user removed; their nested rows render unchecked. */
31
- excludedSlotEdges?: Set<string>;
32
30
  aiFlaggedByKey?: Map<string, boolean>;
33
31
  dimPredicate?: (componentKey: string) => boolean;
34
32
  viewMode?: 'grouped' | 'flat';
@@ -36,7 +34,6 @@ export interface GroupedSidebarProps {
36
34
  graph: ComponentGraphNode[];
37
35
  filterVisibleKeys?: Set<string>;
38
36
  }
39
- export declare function slotEdgeKey(parent: string, child: string): string;
40
37
  type RowKind = 'cycle' | 'empty' | 'group-root' | 'group-child' | 'standalone' | 'flat' | 'flat-header';
41
38
  export interface VisibleRow {
42
39
  kind: RowKind;
@@ -48,7 +45,7 @@ export interface VisibleRow {
48
45
  cycleChild?: boolean;
49
46
  itemIdx: number;
50
47
  rootName?: string;
51
- /** Direct parent of a nested row; identifies the slot edge the row stands for. */
48
+ /** The parent whose slot the nested row sits in. */
52
49
  parentName?: string;
53
50
  }
54
51
  export declare function buildVisibleRows(props: {
@@ -1,5 +1,5 @@
1
1
  import { type ScopeGraph } from './graph/index.js';
2
- import type { Decision, ScopeComponent, ScopeDecisions } from './types.js';
2
+ import type { Decision, ParentChildEdge, ScopeComponent, ScopeDecisions } from './types.js';
3
3
  export type DecisionState = Map<string, Decision>;
4
4
  export type DecisionAction = {
5
5
  type: 'accept';
@@ -15,5 +15,6 @@ export type DecisionAction = {
15
15
  export declare function reduceDecisions(state: DecisionState, action: DecisionAction, components: ScopeComponent[], graph: ScopeGraph): DecisionState;
16
16
  /** Whether rejecting `name` touches 2 or more other components, so the screen has to ask first. */
17
17
  export declare function rejectNeedsConfirmation(graph: ScopeGraph, name: string, state: DecisionState): boolean;
18
+ export declare function withoutSlotChildren(components: ScopeComponent[], removedEdges: ParentChildEdge[]): ScopeComponent[];
18
19
  /** Everything not accepted counts as rejected, as legacy's `partition` did. */
19
- export declare function partitionDecisions(components: ScopeComponent[], state: DecisionState): ScopeDecisions;
20
+ export declare function partitionDecisions(components: ScopeComponent[], state: DecisionState, removedEdges: ParentChildEdge[]): ScopeDecisions;
@@ -10,7 +10,7 @@ export interface PendingRejectCascade {
10
10
  ancestors: string[];
11
11
  descendants: string[];
12
12
  }
13
- export declare function useScopeGate({ components, onConfirm, onQuit }: UseScopeGateOptions): {
13
+ export declare function useScopeGate({ components: loadedComponents, onConfirm, onQuit }: UseScopeGateOptions): {
14
14
  totalWidth: number;
15
15
  columnPlan: {
16
16
  layout: "single" | "two-column";
@@ -20,7 +20,6 @@ export declare function useScopeGate({ components, onConfirm, onQuit }: UseScope
20
20
  panelLayout: import("./columns.js").ScopeGatePanelLayout;
21
21
  visibleCount: number;
22
22
  panelMaxRows: number;
23
- excludedEdges: Set<string>;
24
23
  groupedItems: import("./graph/index.js").SidebarItem[];
25
24
  graph: import("./graph/index.js").ScopeGraph;
26
25
  hasGroupRoots: boolean;
@@ -28,7 +28,6 @@ export interface GroupedSidebarProps {
28
28
  alwaysExpanded?: boolean;
29
29
  showFlatTier?: boolean;
30
30
  selectionStateByKey?: Map<string, 'accepted' | 'rejected' | 'undecided'>;
31
- excludedSlotEdges?: Set<string>;
32
31
  aiFlaggedByKey?: Map<string, boolean>;
33
32
  dimPredicate?: (componentKey: string) => boolean;
34
33
  viewMode?: 'grouped' | 'flat';
@@ -36,7 +35,6 @@ export interface GroupedSidebarProps {
36
35
  graph: ComponentGraphNode[];
37
36
  filterVisibleKeys?: Set<string>;
38
37
  }
39
- export declare function slotEdgeKey(parent: string, child: string): string;
40
38
  type RowKind = 'cycle' | 'empty' | 'group-root' | 'group-child' | 'standalone' | 'flat' | 'flat-header';
41
39
  export interface VisibleRow {
42
40
  kind: RowKind;
@@ -48,7 +46,7 @@ export interface VisibleRow {
48
46
  cycleChild?: boolean;
49
47
  itemIdx: number;
50
48
  rootName?: string;
51
- /** Direct parent of a nested row; identifies the slot edge the row stands for. */
49
+ /** The parent whose slot the nested row sits in. */
52
50
  parentName?: string;
53
51
  }
54
52
  export declare function buildVisibleRows(props: {
@@ -1,4 +1,5 @@
1
1
  import { type ImportHandoff } from '@contentful/experience-design-system-types/handoff';
2
+ import type { ParentChildEdge } from '../../session/db.js';
2
3
  /** The wizard state the early stages produce. Every field is one the stage used to write. */
3
4
  export interface HandoffState {
4
5
  credentialsSkipped: boolean;
@@ -18,10 +19,7 @@ export interface HandoffScope {
18
19
  decisions: {
19
20
  accepted: string[];
20
21
  rejected: string[];
21
- excludedSlotEdges: Array<{
22
- parent: string;
23
- child: string;
24
- }>;
22
+ excludedSlotEdges: ParentChildEdge[];
25
23
  };
26
24
  /** Components the cache check (finished and restored before the wizard started) found already generated. */
27
25
  cachedNames: string[];
@@ -19418,9 +19418,6 @@ var init_Sidebar = __esm({
19418
19418
  import figures from "figures";
19419
19419
  import { Box as Box18, Text as Text19 } from "ink";
19420
19420
  import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
19421
- function slotEdgeKey(parent, child) {
19422
- return `${parent}\u2192${child}`;
19423
- }
19424
19421
  function isEmpty(entry) {
19425
19422
  return Object.keys(entry.$properties ?? {}).length === 0 && Object.keys(entry.$slots ?? {}).length === 0;
19426
19423
  }
@@ -19832,7 +19829,6 @@ function GroupedSidebar(props) {
19832
19829
  showFlatTier,
19833
19830
  viewMode,
19834
19831
  selectionStateByKey,
19835
- excludedSlotEdges,
19836
19832
  aiFlaggedByKey,
19837
19833
  dimPredicate,
19838
19834
  visibleRows: providedRows,
@@ -19863,8 +19859,7 @@ function GroupedSidebar(props) {
19863
19859
  const badge = itemName ? previewBadge(previewAnnotationByKey?.get(itemName)) : null;
19864
19860
  const showInheritance = rs !== void 0 && row.kind !== "cycle" && row.kind !== "empty" && row.kind !== "group-root";
19865
19861
  const supportsSelectionGlyph = selectionStateByKey !== void 0 && itemName !== void 0 && (row.kind === "standalone" || row.kind === "group-root" || row.kind === "group-child" || row.kind === "flat" || row.kind === "empty" || row.kind === "cycle");
19866
- const edgeExcluded = row.kind === "group-child" && row.parentName !== void 0 && itemName !== void 0 && excludedSlotEdges?.has(slotEdgeKey(row.parentName, itemName)) === true;
19867
- const selState = supportsSelectionGlyph ? edgeExcluded ? "undecided" : selectionStateByKey.get(itemName) ?? "undecided" : void 0;
19862
+ const selState = supportsSelectionGlyph ? selectionStateByKey.get(itemName) ?? "undecided" : void 0;
19868
19863
  const isCycleRow = row.kind === "cycle";
19869
19864
  const selStyle = selectionGlyphStyleFor(selState, isCycleRow);
19870
19865
  const selGlyph = selStyle.glyph;
@@ -25279,55 +25274,50 @@ function GenerateReviewStepView({
25279
25274
  const cycle = cycleRows[cyclesCursor];
25280
25275
  return cycle ? enumerateCycleBreaks(cycle, components) : [];
25281
25276
  }, [cycleRows, cyclesCursor, components]);
25282
- const handleBreakEdge = (edge) => {
25283
- const target = components.find((component) => component.key === edge.fromComponent);
25284
- const slot = target?.entry.$slots?.[edge.slotName];
25285
- if (!target || !slot || !Array.isArray(slot.$allowedComponents)) return;
25286
- const nextEntry = {
25287
- ...target.entry,
25288
- $slots: {
25289
- ...target.entry.$slots,
25290
- [edge.slotName]: {
25291
- ...slot,
25292
- $allowedComponents: slot.$allowedComponents.filter((value) => value !== edge.toComponent)
25293
- }
25294
- }
25295
- };
25277
+ const saveSlotChange = (parentKey, nextEntry, historyLabel) => {
25296
25278
  const next = components.map(
25297
- (component) => component.key === target.key ? { ...component, entry: nextEntry } : component
25279
+ (component) => component.key === parentKey ? { ...component, entry: nextEntry } : component
25298
25280
  );
25299
25281
  setComponents(next);
25300
25282
  const db = openPipelineDb();
25301
25283
  try {
25302
- storeCDFComponents(db, extractSessionId, [{ key: target.key, entry: nextEntry }]);
25284
+ storeCDFComponents(db, extractSessionId, [{ key: parentKey, entry: nextEntry }]);
25303
25285
  } finally {
25304
25286
  db.close();
25305
25287
  }
25306
25288
  recomputeCycles(next);
25307
25289
  livePreviewHook.trigger();
25308
- pushHistorySnapshot(next, "break-cycle-edge");
25290
+ pushHistorySnapshot(next, historyLabel);
25291
+ };
25292
+ const handleBreakEdge = (edge) => {
25293
+ const target = components.find((component) => component.key === edge.fromComponent);
25294
+ const slot = target?.entry.$slots?.[edge.slotName];
25295
+ if (!target || !slot || !Array.isArray(slot.$allowedComponents)) return;
25296
+ saveSlotChange(
25297
+ target.key,
25298
+ {
25299
+ ...target.entry,
25300
+ $slots: {
25301
+ ...target.entry.$slots,
25302
+ [edge.slotName]: {
25303
+ ...slot,
25304
+ $allowedComponents: slot.$allowedComponents.filter((value) => value !== edge.toComponent)
25305
+ }
25306
+ }
25307
+ },
25308
+ "break-cycle-edge"
25309
+ );
25309
25310
  };
25310
25311
  const handleRemoveSlotChild = (parentKey, childKey) => {
25311
25312
  const parent = components.find((component) => component.key === parentKey);
25312
25313
  if (!parent?.entry.$slots) return;
25313
- const slots = {};
25314
- for (const [slotName, slot] of Object.entries(parent.entry.$slots)) {
25315
- slots[slotName] = Array.isArray(slot.$allowedComponents) ? { ...slot, $allowedComponents: slot.$allowedComponents.filter((value) => value !== childKey) } : slot;
25316
- }
25317
- const nextEntry = { ...parent.entry, $slots: slots };
25318
- const next = components.map(
25319
- (component) => component.key === parentKey ? { ...component, entry: nextEntry } : component
25314
+ const slots = Object.fromEntries(
25315
+ Object.entries(parent.entry.$slots).map(([slotName, slot]) => [
25316
+ slotName,
25317
+ Array.isArray(slot.$allowedComponents) ? { ...slot, $allowedComponents: slot.$allowedComponents.filter((value) => value !== childKey) } : slot
25318
+ ])
25320
25319
  );
25321
- setComponents(next);
25322
- const db = openPipelineDb();
25323
- try {
25324
- storeCDFComponents(db, extractSessionId, [{ key: parentKey, entry: nextEntry }]);
25325
- } finally {
25326
- db.close();
25327
- }
25328
- recomputeCycles(next);
25329
- livePreviewHook.trigger();
25330
- pushHistorySnapshot(next, "remove-slot-child");
25320
+ saveSlotChange(parentKey, { ...parent.entry, $slots: slots }, "remove-slot-child");
25331
25321
  };
25332
25322
  const handleRejectComponent = (key) => {
25333
25323
  const rejectCascade = computeRejectCascade(key, componentGraph);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.37.1-dev-build-7a46c9e6.0",
3
+ "version": "2.37.1-dev-build-5fe4d4be.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.37.1-dev-build-7a46c9e6.0",
3
+ "version": "2.37.1-dev-build-5fe4d4be.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -45,9 +45,9 @@
45
45
  "ts-morph": "^27.0.2",
46
46
  "typescript": "^5.9.3",
47
47
  "zod": "^4.6.5",
48
- "@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-7a46c9e6.0",
49
- "@contentful/experience-design-system-generation": "2.37.1-dev-build-7a46c9e6.0",
50
- "@contentful/experience-design-system-types": "2.37.1-dev-build-7a46c9e6.0"
48
+ "@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-5fe4d4be.0",
49
+ "@contentful/experience-design-system-generation": "2.37.1-dev-build-5fe4d4be.0",
50
+ "@contentful/experience-design-system-types": "2.37.1-dev-build-5fe4d4be.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@tsconfig/node24": "^24.0.4",