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