@contentful/experience-design-system-cli 2.37.1-dev-build-444a2d6a.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
@@ -7846,7 +7846,6 @@ function GroupedSidebar(props) {
7846
7846
  showFlatTier,
7847
7847
  viewMode,
7848
7848
  selectionStateByKey,
7849
- excludedSlotEdges,
7850
7849
  aiFlaggedByKey,
7851
7850
  dimPredicate,
7852
7851
  visibleRows: providedRows,
@@ -7877,8 +7876,7 @@ function GroupedSidebar(props) {
7877
7876
  const badge = itemName ? previewBadge(previewAnnotationByKey?.get(itemName)) : null;
7878
7877
  const showInheritance = rs !== void 0 && row.kind !== "cycle" && row.kind !== "empty" && row.kind !== "group-root";
7879
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");
7880
- const edgeExcluded = row.kind === "group-child" && row.parentName !== void 0 && itemName !== void 0 && excludedSlotEdges?.some((edge) => edge.parent === row.parentName && edge.child === itemName) === true;
7881
- const selState = supportsSelectionGlyph ? edgeExcluded ? "undecided" : selectionStateByKey.get(itemName) ?? "undecided" : void 0;
7879
+ const selState = supportsSelectionGlyph ? selectionStateByKey.get(itemName) ?? "undecided" : void 0;
7882
7880
  const isCycleRow = row.kind === "cycle";
7883
7881
  const selStyle = selectionGlyphStyleFor(selState, isCycleRow);
7884
7882
  const selGlyph = selStyle.glyph;
@@ -8551,6 +8549,7 @@ function resolveKey(mode, key, ctx) {
8551
8549
  function resolveMain(key, ctx) {
8552
8550
  const { input } = key;
8553
8551
  const inMain = ctx.focusedColumn === "main";
8552
+ if (key.ctrl && input === "z") return { type: "undo" };
8554
8553
  if (input === "q" || key.escape) {
8555
8554
  if (key.escape && ctx.jumpFilterActive) return { type: "clear-jump-filter" };
8556
8555
  if (key.escape && ctx.searchActive) return { type: "clear-search" };
@@ -8809,11 +8808,21 @@ function rejectNeedsConfirmation(graph, name, state) {
8809
8808
  const ancestors = toReject.filter((n) => n !== name);
8810
8809
  return ancestors.length + toDeselect.length >= 2;
8811
8810
  }
8812
- function withEdgeExcluded(edges, edge, excluded) {
8813
- const others = edges.filter((e) => e.parent !== edge.parent || e.child !== edge.child);
8814
- return excluded ? [...others, edge] : others;
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);
8815
8824
  }
8816
- function partitionDecisions(components, state, excludedEdges) {
8825
+ function partitionDecisions(components, state, removedEdges) {
8817
8826
  const accepted = [];
8818
8827
  const rejected = [];
8819
8828
  for (const c2 of components) {
@@ -8821,16 +8830,20 @@ function partitionDecisions(components, state, excludedEdges) {
8821
8830
  else rejected.push(c2.name);
8822
8831
  }
8823
8832
  const rejectedNames = new Set(rejected);
8824
- const excludedSlotEdges = excludedEdges.filter((e) => !rejectedNames.has(e.parent) && !rejectedNames.has(e.child));
8833
+ const excludedSlotEdges = removedEdges.filter((e) => !rejectedNames.has(e.parent) && !rejectedNames.has(e.child));
8825
8834
  return { accepted, rejected, excludedSlotEdges };
8826
8835
  }
8827
8836
 
8828
8837
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
8829
- function useScopeGate({ components, onConfirm, onQuit }) {
8838
+ function useScopeGate({ components: loadedComponents, onConfirm, onQuit }) {
8830
8839
  const { columns: totalWidth, rows: terminalRows } = useTerminalSize();
8831
8840
  const columnPlan = useMemo2(() => computeColumnWidths(totalWidth), [totalWidth]);
8832
8841
  const [decisions, setDecisions] = useState12(/* @__PURE__ */ new Map());
8833
- const [excludedEdges, setExcludedEdges] = useState12([]);
8842
+ const [removedEdges, setRemovedEdges] = useState12([]);
8843
+ const components = useMemo2(
8844
+ () => withoutSlotChildren(loadedComponents, removedEdges),
8845
+ [loadedComponents, removedEdges]
8846
+ );
8834
8847
  const [nav, setNav] = useState12({ cursor: 0, scrollOffset: 0 });
8835
8848
  const [focusedColumn, setFocusedColumn] = useState12("main");
8836
8849
  const [addedComponentsCursor, setAddedComponentsCursor] = useState12(0);
@@ -9008,7 +9021,8 @@ function useScopeGate({ components, onConfirm, onQuit }) {
9008
9021
  const child = groupedItems[row.itemIdx]?.key;
9009
9022
  return child ? { parent: row.parentName, child } : void 0;
9010
9023
  };
9011
- const setEdgeExcluded = (edge, excluded) => setExcludedEdges((prev) => withEdgeExcluded(prev, edge, excluded));
9024
+ const removeFromParentSlot = (edge) => setRemovedEdges((edges) => [...edges, edge]);
9025
+ const undoSlotRemoval = () => setRemovedEdges((edges) => edges.slice(0, -1));
9012
9026
  const jumpCursorTo = (name) => {
9013
9027
  let idx = -1;
9014
9028
  for (let i = 0; i < visibleRows.length; i++) {
@@ -9108,7 +9122,7 @@ function useScopeGate({ components, onConfirm, onQuit }) {
9108
9122
  onQuit();
9109
9123
  return;
9110
9124
  case "confirm":
9111
- onConfirm(partitionDecisions(components, decisions, excludedEdges));
9125
+ onConfirm(partitionDecisions(components, decisions, removedEdges));
9112
9126
  return;
9113
9127
  case "close-help":
9114
9128
  setShowHelp(false);
@@ -9156,8 +9170,6 @@ function useScopeGate({ components, onConfirm, onQuit }) {
9156
9170
  }
9157
9171
  return;
9158
9172
  case "accept": {
9159
- const edge = focusedNestedEdge();
9160
- if (edge) setEdgeExcluded(edge, false);
9161
9173
  const key = focusedRowKey();
9162
9174
  if (key) decide({ type: "accept", name: key });
9163
9175
  return;
@@ -9165,7 +9177,7 @@ function useScopeGate({ components, onConfirm, onQuit }) {
9165
9177
  case "reject": {
9166
9178
  const edge = focusedColumn === "main" ? focusedNestedEdge() : void 0;
9167
9179
  if (edge) {
9168
- setEdgeExcluded(edge, true);
9180
+ removeFromParentSlot(edge);
9169
9181
  return;
9170
9182
  }
9171
9183
  const key = focusedColumn === "added-components" ? addedComponents[safeAddedComponentsCursor]?.name : focusedRowKey();
@@ -9175,6 +9187,9 @@ function useScopeGate({ components, onConfirm, onQuit }) {
9175
9187
  case "toggle-all":
9176
9188
  decide({ type: "toggle-all" });
9177
9189
  return;
9190
+ case "undo":
9191
+ undoSlotRemoval();
9192
+ return;
9178
9193
  case "accept-unflagged":
9179
9194
  decide({ type: "accept-unflagged" });
9180
9195
  return;
@@ -9269,7 +9284,6 @@ function useScopeGate({ components, onConfirm, onQuit }) {
9269
9284
  visibleCount,
9270
9285
  panelMaxRows,
9271
9286
  // sidebar
9272
- excludedEdges,
9273
9287
  groupedItems,
9274
9288
  graph,
9275
9289
  hasGroupRoots,
@@ -9395,7 +9409,6 @@ function ScopeGateView({ components, onConfirm, onQuit }) {
9395
9409
  visibleCount: gate.visibleCount,
9396
9410
  showFlatTier: false,
9397
9411
  selectionStateByKey: gate.selectionStateByKey,
9398
- excludedSlotEdges: gate.excludedEdges,
9399
9412
  aiFlaggedByKey: gate.aiFlaggedByKey,
9400
9413
  dimPredicate: gate.dimPredicate,
9401
9414
  visibleRows: gate.visibleRows,
package/dist/index.js CHANGED
@@ -10596,7 +10596,6 @@ function GroupedSidebar(props) {
10596
10596
  showFlatTier,
10597
10597
  viewMode,
10598
10598
  selectionStateByKey,
10599
- excludedSlotEdges,
10600
10599
  aiFlaggedByKey,
10601
10600
  dimPredicate,
10602
10601
  visibleRows: providedRows,
@@ -10627,8 +10626,7 @@ function GroupedSidebar(props) {
10627
10626
  const badge = itemName ? previewBadge(previewAnnotationByKey?.get(itemName)) : null;
10628
10627
  const showInheritance = rs !== void 0 && row.kind !== "cycle" && row.kind !== "empty" && row.kind !== "group-root";
10629
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");
10630
- const edgeExcluded = row.kind === "group-child" && row.parentName !== void 0 && itemName !== void 0 && excludedSlotEdges?.some((edge) => edge.parent === row.parentName && edge.child === itemName) === true;
10631
- const selState = supportsSelectionGlyph ? edgeExcluded ? "undecided" : selectionStateByKey.get(itemName) ?? "undecided" : void 0;
10629
+ const selState = supportsSelectionGlyph ? selectionStateByKey.get(itemName) ?? "undecided" : void 0;
10632
10630
  const isCycleRow = row.kind === "cycle";
10633
10631
  const selStyle = selectionGlyphStyleFor(selState, isCycleRow);
10634
10632
  const selGlyph = selStyle.glyph;
@@ -11393,6 +11391,7 @@ function resolveKey(mode, key, ctx) {
11393
11391
  function resolveMain(key, ctx) {
11394
11392
  const { input } = key;
11395
11393
  const inMain = ctx.focusedColumn === "main";
11394
+ if (key.ctrl && input === "z") return { type: "undo" };
11396
11395
  if (input === "q" || key.escape) {
11397
11396
  if (key.escape && ctx.jumpFilterActive) return { type: "clear-jump-filter" };
11398
11397
  if (key.escape && ctx.searchActive) return { type: "clear-search" };
@@ -11691,11 +11690,21 @@ function rejectNeedsConfirmation(graph, name, state) {
11691
11690
  const ancestors = toReject.filter((n) => n !== name);
11692
11691
  return ancestors.length + toDeselect.length >= 2;
11693
11692
  }
11694
- function withEdgeExcluded(edges, edge, excluded) {
11695
- const others = edges.filter((e) => e.parent !== edge.parent || e.child !== edge.child);
11696
- return excluded ? [...others, edge] : others;
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);
11697
11706
  }
11698
- function partitionDecisions(components, state, excludedEdges) {
11707
+ function partitionDecisions(components, state, removedEdges) {
11699
11708
  const accepted = [];
11700
11709
  const rejected = [];
11701
11710
  for (const c2 of components) {
@@ -11703,7 +11712,7 @@ function partitionDecisions(components, state, excludedEdges) {
11703
11712
  else rejected.push(c2.name);
11704
11713
  }
11705
11714
  const rejectedNames = new Set(rejected);
11706
- const excludedSlotEdges = excludedEdges.filter((e) => !rejectedNames.has(e.parent) && !rejectedNames.has(e.child));
11715
+ const excludedSlotEdges = removedEdges.filter((e) => !rejectedNames.has(e.parent) && !rejectedNames.has(e.child));
11707
11716
  return { accepted, rejected, excludedSlotEdges };
11708
11717
  }
11709
11718
  var init_state = __esm({
@@ -11716,11 +11725,15 @@ var init_state = __esm({
11716
11725
 
11717
11726
  // packages/experience-design-system-cli/src/tui/import/steps/07-scope-gate/use-scope-gate.ts
11718
11727
  import { useEffect as useEffect7, useMemo as useMemo2, useRef as useRef4, useState as useState12 } from "react";
11719
- function useScopeGate({ components, onConfirm, onQuit }) {
11728
+ function useScopeGate({ components: loadedComponents, onConfirm, onQuit }) {
11720
11729
  const { columns: totalWidth, rows: terminalRows } = useTerminalSize();
11721
11730
  const columnPlan = useMemo2(() => computeColumnWidths(totalWidth), [totalWidth]);
11722
11731
  const [decisions, setDecisions] = useState12(/* @__PURE__ */ new Map());
11723
- const [excludedEdges, setExcludedEdges] = useState12([]);
11732
+ const [removedEdges, setRemovedEdges] = useState12([]);
11733
+ const components = useMemo2(
11734
+ () => withoutSlotChildren(loadedComponents, removedEdges),
11735
+ [loadedComponents, removedEdges]
11736
+ );
11724
11737
  const [nav, setNav] = useState12({ cursor: 0, scrollOffset: 0 });
11725
11738
  const [focusedColumn, setFocusedColumn] = useState12("main");
11726
11739
  const [addedComponentsCursor, setAddedComponentsCursor] = useState12(0);
@@ -11898,7 +11911,8 @@ function useScopeGate({ components, onConfirm, onQuit }) {
11898
11911
  const child = groupedItems[row.itemIdx]?.key;
11899
11912
  return child ? { parent: row.parentName, child } : void 0;
11900
11913
  };
11901
- const setEdgeExcluded = (edge, excluded) => setExcludedEdges((prev) => withEdgeExcluded(prev, edge, excluded));
11914
+ const removeFromParentSlot = (edge) => setRemovedEdges((edges) => [...edges, edge]);
11915
+ const undoSlotRemoval = () => setRemovedEdges((edges) => edges.slice(0, -1));
11902
11916
  const jumpCursorTo = (name) => {
11903
11917
  let idx = -1;
11904
11918
  for (let i = 0; i < visibleRows.length; i++) {
@@ -11998,7 +12012,7 @@ function useScopeGate({ components, onConfirm, onQuit }) {
11998
12012
  onQuit();
11999
12013
  return;
12000
12014
  case "confirm":
12001
- onConfirm(partitionDecisions(components, decisions, excludedEdges));
12015
+ onConfirm(partitionDecisions(components, decisions, removedEdges));
12002
12016
  return;
12003
12017
  case "close-help":
12004
12018
  setShowHelp(false);
@@ -12046,8 +12060,6 @@ function useScopeGate({ components, onConfirm, onQuit }) {
12046
12060
  }
12047
12061
  return;
12048
12062
  case "accept": {
12049
- const edge = focusedNestedEdge();
12050
- if (edge) setEdgeExcluded(edge, false);
12051
12063
  const key = focusedRowKey();
12052
12064
  if (key) decide({ type: "accept", name: key });
12053
12065
  return;
@@ -12055,7 +12067,7 @@ function useScopeGate({ components, onConfirm, onQuit }) {
12055
12067
  case "reject": {
12056
12068
  const edge = focusedColumn === "main" ? focusedNestedEdge() : void 0;
12057
12069
  if (edge) {
12058
- setEdgeExcluded(edge, true);
12070
+ removeFromParentSlot(edge);
12059
12071
  return;
12060
12072
  }
12061
12073
  const key = focusedColumn === "added-components" ? addedComponents[safeAddedComponentsCursor]?.name : focusedRowKey();
@@ -12065,6 +12077,9 @@ function useScopeGate({ components, onConfirm, onQuit }) {
12065
12077
  case "toggle-all":
12066
12078
  decide({ type: "toggle-all" });
12067
12079
  return;
12080
+ case "undo":
12081
+ undoSlotRemoval();
12082
+ return;
12068
12083
  case "accept-unflagged":
12069
12084
  decide({ type: "accept-unflagged" });
12070
12085
  return;
@@ -12159,7 +12174,6 @@ function useScopeGate({ components, onConfirm, onQuit }) {
12159
12174
  visibleCount,
12160
12175
  panelMaxRows,
12161
12176
  // sidebar
12162
- excludedEdges,
12163
12177
  groupedItems,
12164
12178
  graph,
12165
12179
  hasGroupRoots,
@@ -12272,7 +12286,6 @@ function ScopeGateView({ components, onConfirm, onQuit }) {
12272
12286
  visibleCount: gate.visibleCount,
12273
12287
  showFlatTier: false,
12274
12288
  selectionStateByKey: gate.selectionStateByKey,
12275
- excludedSlotEdges: gate.excludedEdges,
12276
12289
  aiFlaggedByKey: gate.aiFlaggedByKey,
12277
12290
  dimPredicate: gate.dimPredicate,
12278
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-444a2d6a.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;
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { CDFComponentEntry } from '@contentful/experience-design-system-types';
3
3
  import { type ComponentGraphNode, type NodeStatus } from '../../graph/composite-closure.js';
4
- import type { ParentChildEdge } from '../../types.js';
5
4
  import type { PreviewAnnotation, RenderStatus } from '../types.js';
6
5
  export interface GroupedSidebarItem {
7
6
  key: string;
@@ -28,8 +27,6 @@ export interface GroupedSidebarProps {
28
27
  alwaysExpanded?: boolean;
29
28
  showFlatTier?: boolean;
30
29
  selectionStateByKey?: Map<string, 'accepted' | 'rejected' | 'undecided'>;
31
- /** Slot edges the user removed; their nested rows render unchecked. */
32
- excludedSlotEdges?: ParentChildEdge[];
33
30
  aiFlaggedByKey?: Map<string, boolean>;
34
31
  dimPredicate?: (componentKey: string) => boolean;
35
32
  viewMode?: 'grouped' | 'flat';
@@ -15,6 +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 withEdgeExcluded(edges: ParentChildEdge[], edge: ParentChildEdge, excluded: boolean): ParentChildEdge[];
18
+ export declare function withoutSlotChildren(components: ScopeComponent[], removedEdges: ParentChildEdge[]): ScopeComponent[];
19
19
  /** Everything not accepted counts as rejected, as legacy's `partition` did. */
20
- export declare function partitionDecisions(components: ScopeComponent[], state: DecisionState, excludedEdges: ParentChildEdge[]): ScopeDecisions;
20
+ export declare function partitionDecisions(components: ScopeComponent[], state: DecisionState, removedEdges: ParentChildEdge[]): ScopeDecisions;
@@ -1,4 +1,4 @@
1
- import type { ParentChildEdge, ScopeComponent, ScopeDecisions } from './types.js';
1
+ import type { ScopeComponent, ScopeDecisions } from './types.js';
2
2
  interface UseScopeGateOptions {
3
3
  components: ScopeComponent[];
4
4
  onConfirm: (decisions: ScopeDecisions) => void;
@@ -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: ParentChildEdge[];
24
23
  groupedItems: import("./graph/index.js").SidebarItem[];
25
24
  graph: import("./graph/index.js").ScopeGraph;
26
25
  hasGroupRoots: boolean;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.37.1-dev-build-444a2d6a.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-444a2d6a.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-generation": "2.37.1-dev-build-444a2d6a.0",
49
- "@contentful/experience-design-system-types": "2.37.1-dev-build-444a2d6a.0",
50
- "@contentful/experience-design-system-backend-pipeline": "2.37.1-dev-build-444a2d6a.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",