@contentful/experience-design-system-cli 2.35.1-dev-build-8f791e21.0 → 2.35.1-dev-build-beaac232.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
@@ -756,6 +756,7 @@ function SettingsScreen({
756
756
  // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
757
757
  import { useEffect as useEffect4, useState as useState6 } from "react";
758
758
  import { Box as Box7, Text as Text7, useInput as useInput7 } from "ink";
759
+ import TextInput3 from "ink-text-input";
759
760
 
760
761
  // packages/experience-design-system-cli/src/tui/settings/utils/v1-store.ts
761
762
  var readV1Store = readSettings;
@@ -818,6 +819,8 @@ function ConfigurationScreen({ onDone }) {
818
819
  const [config, setConfig] = useState6(null);
819
820
  const [activeField, setActiveField] = useState6("spaceId");
820
821
  const [message, setMessage] = useState6(null);
822
+ const [editing, setEditing] = useState6(false);
823
+ const [valueBeforeEdit, setValueBeforeEdit] = useState6("");
821
824
  useEffect4(() => {
822
825
  readCredentials().then((cfg) => {
823
826
  setConfig(cfg);
@@ -838,13 +841,13 @@ function ConfigurationScreen({ onDone }) {
838
841
  if (!config) return;
839
842
  setConfig({ ...config, [field]: value });
840
843
  }
841
- function handleSave() {
844
+ function saveAndLeave() {
842
845
  if (!config) return;
843
846
  setStage("saving");
844
847
  setMessage(null);
845
848
  writeCredentials(config).then(() => {
846
- setStage("saved");
847
- setMessage("Configuration saved");
849
+ void finishDebugRun({ outputs: debugFields(config), status: "success", exitMethod: "saved" });
850
+ onDone();
848
851
  }).catch((err) => {
849
852
  setMessage(err instanceof Error ? err.message : "Failed to save");
850
853
  setStage("form");
@@ -852,16 +855,15 @@ function ConfigurationScreen({ onDone }) {
852
855
  }
853
856
  useInput7((input, key) => {
854
857
  if (stage === "loading" || stage === "saving") return;
855
- if (stage === "saved") {
856
- if (key.return || key.escape || input === "q") {
857
- void finishDebugRun({ outputs: debugFields(config), status: "success", exitMethod: "saved" });
858
- onDone();
858
+ if (editing) {
859
+ if (key.escape) {
860
+ setFieldValue(activeField, valueBeforeEdit);
861
+ setEditing(false);
859
862
  }
860
863
  return;
861
864
  }
862
865
  if (key.escape || input === "q") {
863
- void finishDebugRun({ outputs: {}, status: "success", exitMethod: "discarded" });
864
- onDone();
866
+ saveAndLeave();
865
867
  return;
866
868
  }
867
869
  if (key.tab || key.downArrow) {
@@ -875,21 +877,8 @@ function ConfigurationScreen({ onDone }) {
875
877
  return;
876
878
  }
877
879
  if (key.return) {
878
- const idx = FIELD_ORDER.indexOf(activeField);
879
- if (idx < FIELD_ORDER.length - 1) {
880
- setActiveField(FIELD_ORDER[idx + 1]);
881
- } else {
882
- handleSave();
883
- }
884
- return;
885
- }
886
- if (key.backspace || key.delete) {
887
- const current = fieldValue(activeField);
888
- setFieldValue(activeField, current.slice(0, -1));
889
- return;
890
- }
891
- if (input && !key.ctrl && !key.meta) {
892
- setFieldValue(activeField, fieldValue(activeField) + input);
880
+ setValueBeforeEdit(fieldValue(activeField));
881
+ setEditing(true);
893
882
  }
894
883
  });
895
884
  if (stage === "loading") {
@@ -899,18 +888,6 @@ function ConfigurationScreen({ onDone }) {
899
888
  /* @__PURE__ */ jsx7(Text7, { color: PALETTE.accent, children: "Loading..." })
900
889
  ] });
901
890
  }
902
- if (stage === "saved") {
903
- return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
904
- /* @__PURE__ */ jsx7(Text7, { bold: true, children: "Configuration" }),
905
- /* @__PURE__ */ jsx7(Text7, { children: " " }),
906
- /* @__PURE__ */ jsxs7(Text7, { color: PALETTE.success, children: [
907
- "\u2713 ",
908
- message
909
- ] }),
910
- /* @__PURE__ */ jsx7(Text7, { children: " " }),
911
- /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "[Enter] Back to Settings" })
912
- ] });
913
- }
914
891
  return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
915
892
  /* @__PURE__ */ jsx7(Text7, { bold: true, children: "Configuration" }),
916
893
  /* @__PURE__ */ jsx7(Text7, { children: " " }),
@@ -926,7 +903,15 @@ function ConfigurationScreen({ onDone }) {
926
903
  FIELD_LABELS[field],
927
904
  ":"
928
905
  ] }),
929
- /* @__PURE__ */ jsx7(Text7, { children: display || /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "(empty)" }) })
906
+ isActive && editing ? /* @__PURE__ */ jsx7(
907
+ TextInput3,
908
+ {
909
+ value,
910
+ onChange: (next) => setFieldValue(field, next),
911
+ onSubmit: () => setEditing(false),
912
+ mask: field === "cmaToken" ? "\u2022" : void 0
913
+ }
914
+ ) : /* @__PURE__ */ jsx7(Text7, { children: display || /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "(empty)" }) })
930
915
  ] }, field);
931
916
  }) }),
932
917
  message && /* @__PURE__ */ jsxs7(Fragment, { children: [
@@ -937,7 +922,7 @@ function ConfigurationScreen({ onDone }) {
937
922
  ] })
938
923
  ] }),
939
924
  /* @__PURE__ */ jsx7(Text7, { children: " " }),
940
- /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "[\u2191/\u2193] Switch field \xB7 [Enter] Save/Next \xB7 [Esc/q] Back" })
925
+ /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: editing ? "[type] Edit \xB7 [\u2190/\u2192] Move cursor \xB7 [Enter] Done \xB7 [Esc] Cancel edit" : "[\u2191/\u2193] Switch field \xB7 [Enter] Edit \xB7 [Esc/q] Save & back" })
941
926
  ] });
942
927
  }
943
928
 
package/dist/index.js CHANGED
@@ -933,6 +933,7 @@ var init_config_store = __esm({
933
933
  // packages/experience-design-system-cli/src/tui/settings/contentful-configuration/ContentfulConfigScreen.tsx
934
934
  import { useEffect as useEffect4, useState as useState6 } from "react";
935
935
  import { Box as Box7, Text as Text7, useInput as useInput7 } from "ink";
936
+ import TextInput3 from "ink-text-input";
936
937
  import { Fragment, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
937
938
  function debugFields(config) {
938
939
  return {
@@ -949,6 +950,8 @@ function ConfigurationScreen({ onDone }) {
949
950
  const [config, setConfig] = useState6(null);
950
951
  const [activeField, setActiveField] = useState6("spaceId");
951
952
  const [message, setMessage] = useState6(null);
953
+ const [editing, setEditing] = useState6(false);
954
+ const [valueBeforeEdit, setValueBeforeEdit] = useState6("");
952
955
  useEffect4(() => {
953
956
  readCredentials().then((cfg) => {
954
957
  setConfig(cfg);
@@ -969,13 +972,13 @@ function ConfigurationScreen({ onDone }) {
969
972
  if (!config) return;
970
973
  setConfig({ ...config, [field]: value });
971
974
  }
972
- function handleSave() {
975
+ function saveAndLeave() {
973
976
  if (!config) return;
974
977
  setStage("saving");
975
978
  setMessage(null);
976
979
  writeCredentials(config).then(() => {
977
- setStage("saved");
978
- setMessage("Configuration saved");
980
+ void finishDebugRun({ outputs: debugFields(config), status: "success", exitMethod: "saved" });
981
+ onDone();
979
982
  }).catch((err) => {
980
983
  setMessage(err instanceof Error ? err.message : "Failed to save");
981
984
  setStage("form");
@@ -983,16 +986,15 @@ function ConfigurationScreen({ onDone }) {
983
986
  }
984
987
  useInput7((input, key) => {
985
988
  if (stage === "loading" || stage === "saving") return;
986
- if (stage === "saved") {
987
- if (key.return || key.escape || input === "q") {
988
- void finishDebugRun({ outputs: debugFields(config), status: "success", exitMethod: "saved" });
989
- onDone();
989
+ if (editing) {
990
+ if (key.escape) {
991
+ setFieldValue(activeField, valueBeforeEdit);
992
+ setEditing(false);
990
993
  }
991
994
  return;
992
995
  }
993
996
  if (key.escape || input === "q") {
994
- void finishDebugRun({ outputs: {}, status: "success", exitMethod: "discarded" });
995
- onDone();
997
+ saveAndLeave();
996
998
  return;
997
999
  }
998
1000
  if (key.tab || key.downArrow) {
@@ -1006,21 +1008,8 @@ function ConfigurationScreen({ onDone }) {
1006
1008
  return;
1007
1009
  }
1008
1010
  if (key.return) {
1009
- const idx = FIELD_ORDER.indexOf(activeField);
1010
- if (idx < FIELD_ORDER.length - 1) {
1011
- setActiveField(FIELD_ORDER[idx + 1]);
1012
- } else {
1013
- handleSave();
1014
- }
1015
- return;
1016
- }
1017
- if (key.backspace || key.delete) {
1018
- const current = fieldValue(activeField);
1019
- setFieldValue(activeField, current.slice(0, -1));
1020
- return;
1021
- }
1022
- if (input && !key.ctrl && !key.meta) {
1023
- setFieldValue(activeField, fieldValue(activeField) + input);
1011
+ setValueBeforeEdit(fieldValue(activeField));
1012
+ setEditing(true);
1024
1013
  }
1025
1014
  });
1026
1015
  if (stage === "loading") {
@@ -1030,18 +1019,6 @@ function ConfigurationScreen({ onDone }) {
1030
1019
  /* @__PURE__ */ jsx7(Text7, { color: PALETTE.accent, children: "Loading..." })
1031
1020
  ] });
1032
1021
  }
1033
- if (stage === "saved") {
1034
- return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1035
- /* @__PURE__ */ jsx7(Text7, { bold: true, children: "Configuration" }),
1036
- /* @__PURE__ */ jsx7(Text7, { children: " " }),
1037
- /* @__PURE__ */ jsxs7(Text7, { color: PALETTE.success, children: [
1038
- "\u2713 ",
1039
- message
1040
- ] }),
1041
- /* @__PURE__ */ jsx7(Text7, { children: " " }),
1042
- /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "[Enter] Back to Settings" })
1043
- ] });
1044
- }
1045
1022
  return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1046
1023
  /* @__PURE__ */ jsx7(Text7, { bold: true, children: "Configuration" }),
1047
1024
  /* @__PURE__ */ jsx7(Text7, { children: " " }),
@@ -1057,7 +1034,15 @@ function ConfigurationScreen({ onDone }) {
1057
1034
  FIELD_LABELS[field],
1058
1035
  ":"
1059
1036
  ] }),
1060
- /* @__PURE__ */ jsx7(Text7, { children: display || /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "(empty)" }) })
1037
+ isActive && editing ? /* @__PURE__ */ jsx7(
1038
+ TextInput3,
1039
+ {
1040
+ value,
1041
+ onChange: (next) => setFieldValue(field, next),
1042
+ onSubmit: () => setEditing(false),
1043
+ mask: field === "cmaToken" ? "\u2022" : void 0
1044
+ }
1045
+ ) : /* @__PURE__ */ jsx7(Text7, { children: display || /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "(empty)" }) })
1061
1046
  ] }, field);
1062
1047
  }) }),
1063
1048
  message && /* @__PURE__ */ jsxs7(Fragment, { children: [
@@ -1068,7 +1053,7 @@ function ConfigurationScreen({ onDone }) {
1068
1053
  ] })
1069
1054
  ] }),
1070
1055
  /* @__PURE__ */ jsx7(Text7, { children: " " }),
1071
- /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: "[\u2191/\u2193] Switch field \xB7 [Enter] Save/Next \xB7 [Esc/q] Back" })
1056
+ /* @__PURE__ */ jsx7(Text7, { dimColor: true, children: editing ? "[type] Edit \xB7 [\u2190/\u2192] Move cursor \xB7 [Enter] Done \xB7 [Esc] Cancel edit" : "[\u2191/\u2193] Switch field \xB7 [Enter] Edit \xB7 [Esc/q] Save & back" })
1072
1057
  ] });
1073
1058
  }
1074
1059
  var FIELD_ORDER, FIELD_LABELS;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.35.1-dev-build-8f791e21.0",
3
+ "version": "2.35.1-dev-build-beaac232.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-cli",
3
- "version": "2.35.1-dev-build-8f791e21.0",
3
+ "version": "2.35.1-dev-build-beaac232.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.35.1-dev-build-8f791e21.0",
3
+ "version": "2.35.1-dev-build-beaac232.0",
4
4
  "description": "Contentful Experiences design system import CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -42,7 +42,7 @@
42
42
  "svelte": "^5.56.4",
43
43
  "ts-morph": "^27.0.2",
44
44
  "typescript": "^5.9.3",
45
- "@contentful/experience-design-system-types": "2.35.1-dev-build-8f791e21.0"
45
+ "@contentful/experience-design-system-types": "2.35.1-dev-build-beaac232.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@tsconfig/node24": "^24.0.4",