@contentful/experience-design-system-cli 2.38.1-dev-build-dda16770.0 → 2.38.1-dev-build-a2bc858b.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
@@ -23373,6 +23373,7 @@ function FieldEditor({
23373
23373
  const [rationaleOpen, setRationaleOpen] = useState19(false);
23374
23374
  const [rationaleScrollOffset, setRationaleScrollOffset] = useState19(0);
23375
23375
  const [showHelp, setShowHelp] = useState19(false);
23376
+ const [pendingDelete, setPendingDelete] = useState19(null);
23376
23377
  const props = editorState.props;
23377
23378
  const slots = editorState.slots;
23378
23379
  const contentPropIndexes = React13.useMemo(
@@ -23464,6 +23465,46 @@ function FieldEditor({
23464
23465
  setEditorState(next);
23465
23466
  onChange(serializeState(next, value));
23466
23467
  };
23468
+ const deleteRow = (row) => {
23469
+ if (row.kind === "prop") {
23470
+ const nextProps = removeAt(editorState.props, row.idx);
23471
+ commit({ ...editorState, props: nextProps });
23472
+ setPropIdx(Math.max(0, Math.min(row.idx, nextProps.length - 1)));
23473
+ const rowsAfter2 = selectableRows.filter((r) => !(r.kind === "prop" && r.idx === row.idx));
23474
+ const neighbour2 = rowsAfter2[Math.max(0, selectableRows.findIndex((r) => r.kind === row.kind && r.idx === row.idx) - 1)];
23475
+ if (!neighbour2) {
23476
+ setInSlots(false);
23477
+ setInComponentDesc(true);
23478
+ setFocusLevel("componentDescription");
23479
+ } else if (neighbour2.kind === "prop") {
23480
+ setInSlots(false);
23481
+ setPropIdx(neighbour2.idx > row.idx ? neighbour2.idx - 1 : neighbour2.idx);
23482
+ setFocusLevel("prop");
23483
+ } else {
23484
+ setInSlots(true);
23485
+ setSlotIdx(neighbour2.idx);
23486
+ setFocusLevel("slot");
23487
+ }
23488
+ return;
23489
+ }
23490
+ const nextSlots = removeAt(editorState.slots, row.idx);
23491
+ commit({ ...editorState, slots: nextSlots });
23492
+ const rowsAfter = selectableRows.filter((r) => !(r.kind === "slot" && r.idx === row.idx));
23493
+ const neighbour = rowsAfter[Math.max(0, selectableRows.findIndex((r) => r.kind === row.kind && r.idx === row.idx) - 1)];
23494
+ if (!neighbour) {
23495
+ setInSlots(false);
23496
+ setInComponentDesc(true);
23497
+ setFocusLevel("componentDescription");
23498
+ } else if (neighbour.kind === "slot") {
23499
+ setInSlots(true);
23500
+ setSlotIdx(neighbour.idx > row.idx ? neighbour.idx - 1 : neighbour.idx);
23501
+ setFocusLevel("slot");
23502
+ } else {
23503
+ setInSlots(false);
23504
+ setPropIdx(neighbour.idx);
23505
+ setFocusLevel("prop");
23506
+ }
23507
+ };
23467
23508
  const canonicalize = React13.useCallback((json) => {
23468
23509
  try {
23469
23510
  return JSON.stringify(JSON.parse(json));
@@ -23500,6 +23541,11 @@ function FieldEditor({
23500
23541
  onSave();
23501
23542
  return;
23502
23543
  }
23544
+ if (pendingDelete) {
23545
+ if (input === "y") deleteRow(pendingDelete);
23546
+ setPendingDelete(null);
23547
+ return;
23548
+ }
23503
23549
  const inDescriptionTextEntryForHelp = focusLevel === "field" && editingField && activeField === "description";
23504
23550
  const inStringDefaultTextEntryForHelp = focusLevel === "field" && editingField && activeField === "default" && currentProp != null && (currentProp.type === "string" || currentProp.type === "token");
23505
23551
  const inValueListTextEntry = editingValue != null;
@@ -23699,6 +23745,11 @@ function FieldEditor({
23699
23745
  }
23700
23746
  return;
23701
23747
  }
23748
+ if (input === "d" && !key.ctrl && !key.meta) {
23749
+ if (focusLevel === "prop" && currentProp) setPendingDelete({ kind: "prop", idx: propIdx });
23750
+ if (focusLevel === "slot" && currentSlot) setPendingDelete({ kind: "slot", idx: slotIdx });
23751
+ return;
23752
+ }
23702
23753
  if (focusLevel === "slot" && key.return && currentSlot) {
23703
23754
  setFocusLevel("field");
23704
23755
  setActiveField(SLOT_FIELDS[0] ?? null);
@@ -24005,6 +24056,10 @@ function FieldEditor({
24005
24056
  }
24006
24057
  const hasEmptyProperties = props.length === 0 && slots.length === 0;
24007
24058
  const modeLabel = (() => {
24059
+ if (pendingDelete) {
24060
+ const name = pendingDelete.kind === "prop" ? props[pendingDelete.idx]?.name : slots[pendingDelete.idx]?.name;
24061
+ return `Delete ${pendingDelete.kind} "${name}"? [y] delete \xB7 any other key cancels`;
24062
+ }
24008
24063
  if (editingValue) {
24009
24064
  return editingValue.mode === "add" ? "Enter to add \xB7 [Esc] to cancel" : "Enter to save edit \xB7 [Esc] to cancel";
24010
24065
  }
@@ -24026,7 +24081,7 @@ function FieldEditor({
24026
24081
  if (rationaleOpen) {
24027
24082
  return "[\u2191\u2193] scroll [i/Esc] close rationale panel";
24028
24083
  }
24029
- return `[\u2191\u2193] navigate [Enter] edit fields [h] help [s] source [Esc] exit panel`;
24084
+ return `[\u2191\u2193] navigate [Enter] edit fields [d] delete property [h] help [s] source [Esc] exit panel`;
24030
24085
  })();
24031
24086
  const rows = [];
24032
24087
  rows.push({ kind: "component-description" });
@@ -24292,6 +24347,7 @@ function FieldEditor({
24292
24347
  /* @__PURE__ */ jsx32(Text27, { bold: true, children: "Row navigation" }),
24293
24348
  /* @__PURE__ */ jsx32(Text27, { children: " \u2191/\u2193 move between rows" }),
24294
24349
  /* @__PURE__ */ jsx32(Text27, { children: " Enter edit fields on the current row" }),
24350
+ /* @__PURE__ */ jsx32(Text27, { children: " d delete the current prop or slot (asks to confirm)" }),
24295
24351
  /* @__PURE__ */ jsx32(Text27, { children: " Esc exit the panel" }),
24296
24352
  /* @__PURE__ */ jsx32(Text27, { children: " " }),
24297
24353
  /* @__PURE__ */ jsx32(Text27, { bold: true, children: "Field editing" }),
@@ -24315,7 +24371,7 @@ function FieldEditor({
24315
24371
  /* @__PURE__ */ jsx32(Text27, { color: PALETTE.muted, children: "press ? or Esc to close" })
24316
24372
  ] }),
24317
24373
  validationError && /* @__PURE__ */ jsx32(Text27, { color: PALETTE.error, children: "\u2717 " + validationError }),
24318
- /* @__PURE__ */ jsx32(Box26, { paddingTop: 1, children: /* @__PURE__ */ jsx32(Text27, { color: PALETTE.muted, children: modeLabel }) })
24374
+ /* @__PURE__ */ jsx32(Box26, { paddingTop: 1, children: /* @__PURE__ */ jsx32(Text27, { color: pendingDelete ? PALETTE.text : PALETTE.muted, children: modeLabel }) })
24319
24375
  ]
24320
24376
  }
24321
24377
  );
package/dist/index.js CHANGED
@@ -26401,6 +26401,7 @@ function FieldEditor({
26401
26401
  const [rationaleOpen, setRationaleOpen] = useState19(false);
26402
26402
  const [rationaleScrollOffset, setRationaleScrollOffset] = useState19(0);
26403
26403
  const [showHelp, setShowHelp] = useState19(false);
26404
+ const [pendingDelete, setPendingDelete] = useState19(null);
26404
26405
  const props = editorState.props;
26405
26406
  const slots = editorState.slots;
26406
26407
  const contentPropIndexes = React13.useMemo(
@@ -26492,6 +26493,46 @@ function FieldEditor({
26492
26493
  setEditorState(next);
26493
26494
  onChange(serializeState(next, value));
26494
26495
  };
26496
+ const deleteRow = (row) => {
26497
+ if (row.kind === "prop") {
26498
+ const nextProps = removeAt(editorState.props, row.idx);
26499
+ commit({ ...editorState, props: nextProps });
26500
+ setPropIdx(Math.max(0, Math.min(row.idx, nextProps.length - 1)));
26501
+ const rowsAfter2 = selectableRows.filter((r) => !(r.kind === "prop" && r.idx === row.idx));
26502
+ const neighbour2 = rowsAfter2[Math.max(0, selectableRows.findIndex((r) => r.kind === row.kind && r.idx === row.idx) - 1)];
26503
+ if (!neighbour2) {
26504
+ setInSlots(false);
26505
+ setInComponentDesc(true);
26506
+ setFocusLevel("componentDescription");
26507
+ } else if (neighbour2.kind === "prop") {
26508
+ setInSlots(false);
26509
+ setPropIdx(neighbour2.idx > row.idx ? neighbour2.idx - 1 : neighbour2.idx);
26510
+ setFocusLevel("prop");
26511
+ } else {
26512
+ setInSlots(true);
26513
+ setSlotIdx(neighbour2.idx);
26514
+ setFocusLevel("slot");
26515
+ }
26516
+ return;
26517
+ }
26518
+ const nextSlots = removeAt(editorState.slots, row.idx);
26519
+ commit({ ...editorState, slots: nextSlots });
26520
+ const rowsAfter = selectableRows.filter((r) => !(r.kind === "slot" && r.idx === row.idx));
26521
+ const neighbour = rowsAfter[Math.max(0, selectableRows.findIndex((r) => r.kind === row.kind && r.idx === row.idx) - 1)];
26522
+ if (!neighbour) {
26523
+ setInSlots(false);
26524
+ setInComponentDesc(true);
26525
+ setFocusLevel("componentDescription");
26526
+ } else if (neighbour.kind === "slot") {
26527
+ setInSlots(true);
26528
+ setSlotIdx(neighbour.idx > row.idx ? neighbour.idx - 1 : neighbour.idx);
26529
+ setFocusLevel("slot");
26530
+ } else {
26531
+ setInSlots(false);
26532
+ setPropIdx(neighbour.idx);
26533
+ setFocusLevel("prop");
26534
+ }
26535
+ };
26495
26536
  const canonicalize = React13.useCallback((json) => {
26496
26537
  try {
26497
26538
  return JSON.stringify(JSON.parse(json));
@@ -26528,6 +26569,11 @@ function FieldEditor({
26528
26569
  onSave();
26529
26570
  return;
26530
26571
  }
26572
+ if (pendingDelete) {
26573
+ if (input === "y") deleteRow(pendingDelete);
26574
+ setPendingDelete(null);
26575
+ return;
26576
+ }
26531
26577
  const inDescriptionTextEntryForHelp = focusLevel === "field" && editingField && activeField === "description";
26532
26578
  const inStringDefaultTextEntryForHelp = focusLevel === "field" && editingField && activeField === "default" && currentProp != null && (currentProp.type === "string" || currentProp.type === "token");
26533
26579
  const inValueListTextEntry = editingValue != null;
@@ -26727,6 +26773,11 @@ function FieldEditor({
26727
26773
  }
26728
26774
  return;
26729
26775
  }
26776
+ if (input === "d" && !key.ctrl && !key.meta) {
26777
+ if (focusLevel === "prop" && currentProp) setPendingDelete({ kind: "prop", idx: propIdx });
26778
+ if (focusLevel === "slot" && currentSlot) setPendingDelete({ kind: "slot", idx: slotIdx });
26779
+ return;
26780
+ }
26730
26781
  if (focusLevel === "slot" && key.return && currentSlot) {
26731
26782
  setFocusLevel("field");
26732
26783
  setActiveField(SLOT_FIELDS[0] ?? null);
@@ -27033,6 +27084,10 @@ function FieldEditor({
27033
27084
  }
27034
27085
  const hasEmptyProperties = props.length === 0 && slots.length === 0;
27035
27086
  const modeLabel = (() => {
27087
+ if (pendingDelete) {
27088
+ const name = pendingDelete.kind === "prop" ? props[pendingDelete.idx]?.name : slots[pendingDelete.idx]?.name;
27089
+ return `Delete ${pendingDelete.kind} "${name}"? [y] delete \xB7 any other key cancels`;
27090
+ }
27036
27091
  if (editingValue) {
27037
27092
  return editingValue.mode === "add" ? "Enter to add \xB7 [Esc] to cancel" : "Enter to save edit \xB7 [Esc] to cancel";
27038
27093
  }
@@ -27054,7 +27109,7 @@ function FieldEditor({
27054
27109
  if (rationaleOpen) {
27055
27110
  return "[\u2191\u2193] scroll [i/Esc] close rationale panel";
27056
27111
  }
27057
- return `[\u2191\u2193] navigate [Enter] edit fields [h] help [s] source [Esc] exit panel`;
27112
+ return `[\u2191\u2193] navigate [Enter] edit fields [d] delete property [h] help [s] source [Esc] exit panel`;
27058
27113
  })();
27059
27114
  const rows = [];
27060
27115
  rows.push({ kind: "component-description" });
@@ -27320,6 +27375,7 @@ function FieldEditor({
27320
27375
  /* @__PURE__ */ jsx32(Text27, { bold: true, children: "Row navigation" }),
27321
27376
  /* @__PURE__ */ jsx32(Text27, { children: " \u2191/\u2193 move between rows" }),
27322
27377
  /* @__PURE__ */ jsx32(Text27, { children: " Enter edit fields on the current row" }),
27378
+ /* @__PURE__ */ jsx32(Text27, { children: " d delete the current prop or slot (asks to confirm)" }),
27323
27379
  /* @__PURE__ */ jsx32(Text27, { children: " Esc exit the panel" }),
27324
27380
  /* @__PURE__ */ jsx32(Text27, { children: " " }),
27325
27381
  /* @__PURE__ */ jsx32(Text27, { bold: true, children: "Field editing" }),
@@ -27343,7 +27399,7 @@ function FieldEditor({
27343
27399
  /* @__PURE__ */ jsx32(Text27, { color: PALETTE.muted, children: "press ? or Esc to close" })
27344
27400
  ] }),
27345
27401
  validationError && /* @__PURE__ */ jsx32(Text27, { color: PALETTE.error, children: "\u2717 " + validationError }),
27346
- /* @__PURE__ */ jsx32(Box26, { paddingTop: 1, children: /* @__PURE__ */ jsx32(Text27, { color: PALETTE.muted, children: modeLabel }) })
27402
+ /* @__PURE__ */ jsx32(Box26, { paddingTop: 1, children: /* @__PURE__ */ jsx32(Text27, { color: pendingDelete ? PALETTE.text : PALETTE.muted, children: modeLabel }) })
27347
27403
  ]
27348
27404
  }
27349
27405
  );
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.38.1-dev-build-dda16770.0",
3
+ "version": "2.38.1-dev-build-a2bc858b.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.38.1-dev-build-dda16770.0",
3
+ "version": "2.38.1-dev-build-a2bc858b.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -45,8 +45,8 @@
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.38.1-dev-build-dda16770.0",
49
- "@contentful/experience-design-system-types": "2.38.1-dev-build-dda16770.0"
48
+ "@contentful/experience-design-system-backend-pipeline": "2.38.1-dev-build-a2bc858b.0",
49
+ "@contentful/experience-design-system-types": "2.38.1-dev-build-a2bc858b.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@tsconfig/node24": "^24.0.4",