@handylib/kai-code 0.1.0 → 0.1.2

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/index.js CHANGED
@@ -35,6 +35,63 @@ function createMemoryFileSystem(initialFiles = {}) {
35
35
  const notify = () => {
36
36
  listeners.forEach((listener) => listener());
37
37
  };
38
+ const moveFile = async (oldPath, newPath) => {
39
+ const oldNormalized = normalizePath(oldPath);
40
+ const newNormalized = normalizePath(newPath);
41
+ const contents = files.get(oldNormalized);
42
+ if (contents === void 0) {
43
+ throw new Error(`File not found: ${oldNormalized}`);
44
+ }
45
+ if (!newNormalized) throw new Error("Destination file path must not be empty.");
46
+ if (oldNormalized === newNormalized) return;
47
+ if (files.has(newNormalized) || directories.has(newNormalized)) {
48
+ throw new Error(`Path already exists: ${newNormalized}`);
49
+ }
50
+ addParentDirectories(newNormalized);
51
+ files.delete(oldNormalized);
52
+ files.set(newNormalized, contents);
53
+ notify();
54
+ };
55
+ const moveDirectory = async (oldPath, newPath) => {
56
+ const oldNormalized = normalizePath(oldPath);
57
+ const newNormalized = normalizePath(newPath);
58
+ if (!directories.has(oldNormalized)) {
59
+ throw new Error(`Directory not found: ${oldNormalized}`);
60
+ }
61
+ if (!newNormalized) {
62
+ throw new Error("Destination directory path must not be empty.");
63
+ }
64
+ if (oldNormalized === newNormalized) return;
65
+ if (newNormalized.startsWith(`${oldNormalized}/`)) {
66
+ throw new Error("A directory cannot be moved inside itself.");
67
+ }
68
+ if (files.has(newNormalized) || directories.has(newNormalized)) {
69
+ throw new Error(`Path already exists: ${newNormalized}`);
70
+ }
71
+ addParentDirectories(newNormalized);
72
+ const oldPrefix = `${oldNormalized}/`;
73
+ const directoriesToMove = [...directories].filter(
74
+ (path) => path === oldNormalized || path.startsWith(oldPrefix)
75
+ );
76
+ const filesToMove = [...files.entries()].filter(
77
+ ([path]) => path.startsWith(oldPrefix)
78
+ );
79
+ for (const [path] of filesToMove) {
80
+ const destination = `${newNormalized}${path.slice(oldNormalized.length)}`;
81
+ if (files.has(destination) || directories.has(destination)) {
82
+ throw new Error(`Path already exists: ${destination}`);
83
+ }
84
+ }
85
+ directoriesToMove.forEach((path) => directories.delete(path));
86
+ filesToMove.forEach(([path]) => files.delete(path));
87
+ directoriesToMove.forEach(
88
+ (path) => directories.add(`${newNormalized}${path.slice(oldNormalized.length)}`)
89
+ );
90
+ filesToMove.forEach(
91
+ ([path, contents]) => files.set(`${newNormalized}${path.slice(oldNormalized.length)}`, contents)
92
+ );
93
+ notify();
94
+ };
38
95
  return {
39
96
  async readDirectory(directory = "") {
40
97
  const base = normalizePath(directory);
@@ -146,24 +203,9 @@ function createMemoryFileSystem(initialFiles = {}) {
146
203
  }
147
204
  notify();
148
205
  },
149
- async renameFile(oldPath, newPath) {
150
- const oldNormalized = normalizePath(oldPath);
151
- const newNormalized = normalizePath(newPath);
152
- const contents = files.get(oldNormalized);
153
- if (contents === void 0) {
154
- throw new Error(`File not found: ${oldNormalized}`);
155
- }
156
- if (files.has(newNormalized)) {
157
- throw new Error(`File already exists: ${newNormalized}`);
158
- }
159
- if (!newNormalized || directories.has(newNormalized)) {
160
- throw new Error(`Invalid file path: ${newNormalized}`);
161
- }
162
- files.delete(oldNormalized);
163
- addParentDirectories(newNormalized);
164
- files.set(newNormalized, contents);
165
- notify();
166
- },
206
+ moveFile,
207
+ moveDirectory,
208
+ renameFile: moveFile,
167
209
  watch(listener) {
168
210
  listeners.add(listener);
169
211
  return () => listeners.delete(listener);
@@ -220,6 +262,13 @@ function getFileGlyph(path) {
220
262
  if (extension === "css" || extension === "scss") return "#";
221
263
  return "\xB7";
222
264
  }
265
+ function getFileIcon(path, fileIcons, icons) {
266
+ const extension = path.split(".").pop()?.toLowerCase() ?? "";
267
+ return fileIcons?.[extension] ?? fileIcons?.default ?? icons?.file ?? getFileGlyph(path);
268
+ }
269
+ function getIcon(icons, name, fallback) {
270
+ return icons?.[name] ?? fallback;
271
+ }
223
272
  function errorMessage(error) {
224
273
  return error instanceof Error ? error.message : String(error);
225
274
  }
@@ -281,6 +330,8 @@ function FileTree({
281
330
  collapsedFolders,
282
331
  onToggleDirectory,
283
332
  onContextMenu,
333
+ icons,
334
+ fileIcons,
284
335
  depth = 0
285
336
  }) {
286
337
  return /* @__PURE__ */ jsx(Fragment, { children: nodes.map(
@@ -298,7 +349,7 @@ function FileTree({
298
349
  style: { "--tree-depth": depth },
299
350
  children: [
300
351
  /* @__PURE__ */ jsx("span", { className: "kai-code__chevron", "aria-hidden": "true", children: "\u25B8" }),
301
- /* @__PURE__ */ jsx("span", { className: "kai-code__folder-icon", "aria-hidden": "true", children: "\u25B0" }),
352
+ /* @__PURE__ */ jsx("span", { className: "kai-code__folder-icon", "aria-hidden": "true", children: getIcon(icons, "folder", "\u25B0") }),
302
353
  node.name
303
354
  ]
304
355
  }
@@ -312,6 +363,8 @@ function FileTree({
312
363
  collapsedFolders,
313
364
  onToggleDirectory,
314
365
  onContextMenu,
366
+ icons,
367
+ fileIcons,
315
368
  depth: depth + 1
316
369
  }
317
370
  )
@@ -327,7 +380,7 @@ function FileTree({
327
380
  style: { "--tree-depth": depth },
328
381
  type: "button",
329
382
  children: [
330
- /* @__PURE__ */ jsx("span", { className: "kai-code__file-icon", "aria-hidden": "true", children: getFileGlyph(node.path) }),
383
+ /* @__PURE__ */ jsx("span", { className: "kai-code__file-icon", "aria-hidden": "true", children: getFileIcon(node.path, fileIcons, icons) }),
331
384
  node.name
332
385
  ]
333
386
  },
@@ -340,8 +393,13 @@ function KaiCode({
340
393
  initialFiles,
341
394
  initialActiveFile,
342
395
  theme = "vs-dark",
396
+ workspaceName = "Workspace",
343
397
  options,
344
- height = 640,
398
+ height = "min(80dvh, 760px)",
399
+ colors,
400
+ rounded = true,
401
+ icons,
402
+ fileIcons,
345
403
  readOnly = false,
346
404
  className,
347
405
  onFileChange,
@@ -365,6 +423,8 @@ function KaiCode({
365
423
  const [creationRequest, setCreationRequest] = useState(null);
366
424
  const [creationName, setCreationName] = useState("");
367
425
  const [deleteTarget, setDeleteTarget] = useState(null);
426
+ const [moveTarget, setMoveTarget] = useState(null);
427
+ const [moveDestination, setMoveDestination] = useState("");
368
428
  const [loadingTree, setLoadingTree] = useState(true);
369
429
  const [loadingDocument, setLoadingDocument] = useState(false);
370
430
  const [failedDocument, setFailedDocument] = useState(null);
@@ -373,9 +433,12 @@ function KaiCode({
373
433
  const saveRef = useRef(async () => void 0);
374
434
  const activeFileRef = useRef(null);
375
435
  const resizeStartRef = useRef(null);
436
+ const suppressWatchRef = useRef(false);
376
437
  const createInputId = useId();
377
438
  const createTitleId = useId();
378
439
  const deleteTitleId = useId();
440
+ const moveInputId = useId();
441
+ const moveTitleId = useId();
379
442
  const isLight = theme === "light";
380
443
  const reloadFiles = useCallback(async () => {
381
444
  setLoadingTree(true);
@@ -402,6 +465,7 @@ function KaiCode({
402
465
  useEffect(() => {
403
466
  void reloadFiles();
404
467
  return fs.watch?.(() => {
468
+ if (suppressWatchRef.current) return;
405
469
  void reloadFiles();
406
470
  });
407
471
  }, [fs, reloadFiles]);
@@ -439,6 +503,7 @@ function KaiCode({
439
503
  setContextMenu(null);
440
504
  setCreationRequest(null);
441
505
  setDeleteTarget(null);
506
+ setMoveTarget(null);
442
507
  }
443
508
  const modifierPressed = event.ctrlKey || event.metaKey;
444
509
  if (awaitingCollapseChord) {
@@ -538,7 +603,8 @@ function KaiCode({
538
603
  event.preventDefault();
539
604
  event.stopPropagation();
540
605
  const canDelete = entry.type === "file" ? fs.deleteFile : fs.deleteDirectory;
541
- if (readOnly || !fs.createFile && !fs.createDirectory && !canDelete) {
606
+ const canMove = entry.type === "file" ? fs.moveFile || fs.renameFile : fs.moveDirectory;
607
+ if (readOnly || !fs.createFile && !fs.createDirectory && !canDelete && !canMove) {
542
608
  return;
543
609
  }
544
610
  setContextMenu({
@@ -639,6 +705,69 @@ function KaiCode({
639
705
  setError(`Unable to delete ${target.path}: ${errorMessage(deleteError)}`);
640
706
  }
641
707
  }, [deleteTarget, documents, fs, reloadFiles, tree]);
708
+ const moveEntry = useCallback(
709
+ async (event) => {
710
+ event.preventDefault();
711
+ if (!moveTarget) return;
712
+ const rawDestination = moveDestination.trim().replace(/\\/g, "/");
713
+ const destination = normalizePath(rawDestination);
714
+ if (!destination || rawDestination.startsWith("/") || destination.split("/").some((part) => !part || part === "." || part === "..")) {
715
+ setError("Enter a valid relative destination path.");
716
+ return;
717
+ }
718
+ const oldPath = moveTarget.path;
719
+ const newPath = destination;
720
+ const updatePath = (path) => moveTarget.type === "file" ? path === oldPath ? newPath : path : path === oldPath || path.startsWith(`${oldPath}/`) ? `${newPath}${path.slice(oldPath.length)}` : path;
721
+ try {
722
+ suppressWatchRef.current = true;
723
+ try {
724
+ if (moveTarget.type === "file") {
725
+ if (fs.moveFile) {
726
+ await fs.moveFile(oldPath, newPath);
727
+ } else if (fs.renameFile) {
728
+ await fs.renameFile(oldPath, newPath);
729
+ } else {
730
+ throw new Error("File moving is not supported.");
731
+ }
732
+ } else {
733
+ if (!fs.moveDirectory) {
734
+ throw new Error("Folder moving is not supported.");
735
+ }
736
+ await fs.moveDirectory(oldPath, newPath);
737
+ }
738
+ } finally {
739
+ suppressWatchRef.current = false;
740
+ }
741
+ setDocuments((current) => {
742
+ const next = { ...current };
743
+ Object.keys(current).forEach((path) => {
744
+ const updatedPath = updatePath(path);
745
+ if (updatedPath !== path) {
746
+ const contents = current[path];
747
+ if (contents !== void 0) {
748
+ next[updatedPath] = contents;
749
+ delete next[path];
750
+ }
751
+ }
752
+ });
753
+ return next;
754
+ });
755
+ setDirtyFiles((current) => new Set([...current].map(updatePath)));
756
+ setOpenFiles((current) => current.map(updatePath));
757
+ if (activeFileRef.current) {
758
+ const updatedActiveFile = updatePath(activeFileRef.current);
759
+ activeFileRef.current = updatedActiveFile;
760
+ setActiveFile(updatedActiveFile);
761
+ }
762
+ setMoveTarget(null);
763
+ setError(null);
764
+ await reloadFiles();
765
+ } catch (moveError) {
766
+ setError(`Unable to move ${oldPath}: ${errorMessage(moveError)}`);
767
+ }
768
+ },
769
+ [fs, moveDestination, moveTarget, reloadFiles]
770
+ );
642
771
  const editorOptions = useMemo(
643
772
  () => ({
644
773
  automaticLayout: true,
@@ -655,18 +784,33 @@ function KaiCode({
655
784
  [options, readOnly]
656
785
  );
657
786
  const activeLanguage = activeFile ? findFileEntry(tree, activeFile)?.language ?? getLanguage(activeFile) : null;
787
+ const rootStyle = {
788
+ height,
789
+ borderRadius: rounded ? 6 : 0,
790
+ "--kc-background": colors?.background,
791
+ "--kc-sidebar": colors?.sidebarBackground,
792
+ "--kc-titlebar": colors?.titlebarBackground,
793
+ "--kc-panel": colors?.panelBackground,
794
+ "--kc-text": colors?.foreground,
795
+ "--kc-muted": colors?.mutedForeground,
796
+ "--kc-border": colors?.border,
797
+ "--kc-accent": colors?.accent,
798
+ "--kc-status-background": colors?.statusBarBackground,
799
+ "--kc-status-foreground": colors?.statusBarForeground,
800
+ "--kc-selection": colors?.fileSelectionBackground
801
+ };
658
802
  return /* @__PURE__ */ jsxs(
659
803
  "section",
660
804
  {
661
805
  className: `kai-code${isLight ? " kai-code--light" : ""}${className ? ` ${className}` : ""}`,
662
- style: { height },
806
+ style: rootStyle,
663
807
  "aria-label": "KaiCode editor",
664
808
  children: [
665
809
  /* @__PURE__ */ jsxs("header", { className: "kai-code__titlebar", children: [
666
- /* @__PURE__ */ jsx("div", { className: "kai-code__brand-mark", "aria-hidden": "true", children: "K" }),
810
+ /* @__PURE__ */ jsx("div", { className: "kai-code__brand-mark", "aria-hidden": "true", children: getIcon(icons, "brand", "K") }),
667
811
  /* @__PURE__ */ jsx("span", { className: "kai-code__brand", children: "KaiCode" }),
668
812
  /* @__PURE__ */ jsx("span", { className: "kai-code__title-divider" }),
669
- /* @__PURE__ */ jsx("span", { className: "kai-code__workspace-title", children: "Workspace" }),
813
+ /* @__PURE__ */ jsx("span", { className: "kai-code__workspace-title", children: workspaceName }),
670
814
  /* @__PURE__ */ jsx("div", { className: "kai-code__title-actions", children: /* @__PURE__ */ jsx(
671
815
  "button",
672
816
  {
@@ -694,10 +838,18 @@ function KaiCode({
694
838
  title: "Explorer (Ctrl+B)",
695
839
  onClick: () => setExplorerVisible((visible) => !visible),
696
840
  type: "button",
697
- children: /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: [
698
- /* @__PURE__ */ jsx("path", { d: "M3.5 5.5h6l2 2h9v11h-17z" }),
699
- /* @__PURE__ */ jsx("path", { d: "M3.5 8h17" })
700
- ] })
841
+ children: /* @__PURE__ */ jsx("span", { className: "kai-code__activity-icon", "aria-hidden": "true", children: icons?.explorer ?? /* @__PURE__ */ jsxs(
842
+ "svg",
843
+ {
844
+ className: "kai-code__default-explorer-icon",
845
+ viewBox: "0 0 24 24",
846
+ "aria-hidden": "true",
847
+ children: [
848
+ /* @__PURE__ */ jsx("path", { d: "M3.5 5.5h6l2 2h9v11h-17z" }),
849
+ /* @__PURE__ */ jsx("path", { d: "M3.5 8h17" })
850
+ ]
851
+ }
852
+ ) })
701
853
  }
702
854
  ),
703
855
  /* @__PURE__ */ jsx("div", { className: "kai-code__activity-spacer" }),
@@ -721,7 +873,7 @@ function KaiCode({
721
873
  title: "New File",
722
874
  onClick: () => beginCreate("file", ""),
723
875
  type: "button",
724
- children: "+"
876
+ children: getIcon(icons, "newFile", "+")
725
877
  }
726
878
  ),
727
879
  fs.createDirectory && !readOnly && /* @__PURE__ */ jsx(
@@ -732,7 +884,7 @@ function KaiCode({
732
884
  title: "New Folder",
733
885
  onClick: () => beginCreate("directory", ""),
734
886
  type: "button",
735
- children: "\u25B0+"
887
+ children: getIcon(icons, "newFolder", "\u25B0+")
736
888
  }
737
889
  ),
738
890
  /* @__PURE__ */ jsx(
@@ -743,14 +895,14 @@ function KaiCode({
743
895
  title: "Collapse All (Ctrl+K Ctrl+0)",
744
896
  onClick: collapseAll,
745
897
  type: "button",
746
- children: "\u229F"
898
+ children: getIcon(icons, "collapseAll", "\u229F")
747
899
  }
748
900
  )
749
901
  ] })
750
902
  ] }),
751
903
  /* @__PURE__ */ jsxs("div", { className: "kai-code__workspace-row", children: [
752
904
  /* @__PURE__ */ jsx("span", { className: "kai-code__chevron", "aria-hidden": "true", children: "\u25BE" }),
753
- /* @__PURE__ */ jsx("span", { children: "WORKSPACE" })
905
+ /* @__PURE__ */ jsx("span", { children: workspaceName })
754
906
  ] }),
755
907
  /* @__PURE__ */ jsx("div", { className: "kai-code__file-tree", children: loadingTree && tree.length === 0 ? /* @__PURE__ */ jsx("div", { className: "kai-code__empty", children: "Loading files\u2026" }) : tree.length ? /* @__PURE__ */ jsx(
756
908
  FileTree,
@@ -760,7 +912,9 @@ function KaiCode({
760
912
  onOpen: openFile,
761
913
  collapsedFolders,
762
914
  onToggleDirectory: toggleDirectory,
763
- onContextMenu: openContextMenu
915
+ onContextMenu: openContextMenu,
916
+ icons,
917
+ fileIcons
764
918
  }
765
919
  ) : /* @__PURE__ */ jsx("div", { className: "kai-code__empty", children: "No files in this workspace" }) })
766
920
  ]
@@ -822,7 +976,7 @@ function KaiCode({
822
976
  onClick: (event) => event.stopPropagation(),
823
977
  onContextMenu: (event) => event.preventDefault(),
824
978
  children: [
825
- fs.createFile && !readOnly && /* @__PURE__ */ jsx(
979
+ fs.createFile && !readOnly && /* @__PURE__ */ jsxs(
826
980
  "button",
827
981
  {
828
982
  role: "menuitem",
@@ -831,10 +985,13 @@ function KaiCode({
831
985
  contextMenu.entry.type === "directory" ? contextMenu.entry.path : parentDirectory(contextMenu.entry.path)
832
986
  ),
833
987
  type: "button",
834
- children: "New File"
988
+ children: [
989
+ getIcon(icons, "newFile", "\uFF0B"),
990
+ " New File"
991
+ ]
835
992
  }
836
993
  ),
837
- fs.createDirectory && !readOnly && /* @__PURE__ */ jsx(
994
+ fs.createDirectory && !readOnly && /* @__PURE__ */ jsxs(
838
995
  "button",
839
996
  {
840
997
  role: "menuitem",
@@ -843,12 +1000,32 @@ function KaiCode({
843
1000
  contextMenu.entry.type === "directory" ? contextMenu.entry.path : parentDirectory(contextMenu.entry.path)
844
1001
  ),
845
1002
  type: "button",
846
- children: "New Folder"
1003
+ children: [
1004
+ getIcon(icons, "newFolder", "\u25B0"),
1005
+ " New Folder"
1006
+ ]
1007
+ }
1008
+ ),
1009
+ (contextMenu.entry.type === "file" && (fs.moveFile || fs.renameFile) || contextMenu.entry.type === "directory" && fs.moveDirectory) && !readOnly && /* @__PURE__ */ jsxs(
1010
+ "button",
1011
+ {
1012
+ role: "menuitem",
1013
+ onClick: () => {
1014
+ setMoveTarget(contextMenu.entry);
1015
+ setMoveDestination("");
1016
+ setError(null);
1017
+ setContextMenu(null);
1018
+ },
1019
+ type: "button",
1020
+ children: [
1021
+ getIcon(icons, "move", "\u2197"),
1022
+ " Move\u2026"
1023
+ ]
847
1024
  }
848
1025
  ),
849
1026
  (contextMenu.entry.type === "file" && fs.deleteFile || contextMenu.entry.type === "directory" && fs.deleteDirectory) && !readOnly && /* @__PURE__ */ jsxs(Fragment, { children: [
850
1027
  /* @__PURE__ */ jsx("div", { className: "kai-code__context-divider" }),
851
- /* @__PURE__ */ jsx(
1028
+ /* @__PURE__ */ jsxs(
852
1029
  "button",
853
1030
  {
854
1031
  className: "is-danger",
@@ -859,7 +1036,10 @@ function KaiCode({
859
1036
  setContextMenu(null);
860
1037
  },
861
1038
  type: "button",
862
- children: "Delete"
1039
+ children: [
1040
+ getIcon(icons, "delete", "\u232B"),
1041
+ " Delete"
1042
+ ]
863
1043
  }
864
1044
  )
865
1045
  ] })
@@ -884,7 +1064,7 @@ function KaiCode({
884
1064
  "aria-selected": activeFile === path,
885
1065
  type: "button",
886
1066
  children: [
887
- /* @__PURE__ */ jsx("span", { className: "kai-code__file-icon", "aria-hidden": "true", children: getFileGlyph(path) }),
1067
+ /* @__PURE__ */ jsx("span", { className: "kai-code__file-icon", "aria-hidden": "true", children: getFileIcon(path, fileIcons, icons) }),
888
1068
  fileName,
889
1069
  dirtyFiles.has(path) && /* @__PURE__ */ jsx("span", { className: "kai-code__dirty-dot", "aria-label": "Unsaved" })
890
1070
  ]
@@ -897,7 +1077,7 @@ function KaiCode({
897
1077
  "aria-label": `Close ${fileName}`,
898
1078
  onClick: () => closeFile(path),
899
1079
  type: "button",
900
- children: "\xD7"
1080
+ children: getIcon(icons, "close", "\xD7")
901
1081
  }
902
1082
  )
903
1083
  ]
@@ -957,7 +1137,7 @@ function KaiCode({
957
1137
  },
958
1138
  activeFile
959
1139
  ) : /* @__PURE__ */ jsxs("div", { className: "kai-code__welcome", children: [
960
- /* @__PURE__ */ jsx("div", { className: "kai-code__welcome-mark", children: "K" }),
1140
+ /* @__PURE__ */ jsx("div", { className: "kai-code__welcome-mark", children: getIcon(icons, "brand", "K") }),
961
1141
  /* @__PURE__ */ jsx("h1", { children: "KaiCode" }),
962
1142
  /* @__PURE__ */ jsx("p", { children: "Select a file from the Explorer to start editing." })
963
1143
  ] }) })
@@ -1049,6 +1229,58 @@ function KaiCode({
1049
1229
  )
1050
1230
  }
1051
1231
  ),
1232
+ moveTarget && /* @__PURE__ */ jsx(
1233
+ "div",
1234
+ {
1235
+ className: "kai-code__dialog-backdrop",
1236
+ onMouseDown: (event) => {
1237
+ if (event.target === event.currentTarget) setMoveTarget(null);
1238
+ },
1239
+ children: /* @__PURE__ */ jsxs(
1240
+ "form",
1241
+ {
1242
+ className: "kai-code__dialog",
1243
+ role: "dialog",
1244
+ "aria-modal": "true",
1245
+ "aria-labelledby": moveTitleId,
1246
+ onSubmit: (event) => void moveEntry(event),
1247
+ children: [
1248
+ /* @__PURE__ */ jsxs("h2", { id: moveTitleId, children: [
1249
+ "Move ",
1250
+ moveTarget.type === "file" ? "File" : "Folder"
1251
+ ] }),
1252
+ /* @__PURE__ */ jsx("p", { children: moveTarget.path }),
1253
+ /* @__PURE__ */ jsx("label", { htmlFor: moveInputId, children: "Destination path" }),
1254
+ /* @__PURE__ */ jsx(
1255
+ "input",
1256
+ {
1257
+ id: moveInputId,
1258
+ autoFocus: true,
1259
+ value: moveDestination,
1260
+ onChange: (event) => setMoveDestination(event.target.value),
1261
+ placeholder: moveTarget.type === "file" ? "src/components/Example.tsx" : "src/components"
1262
+ }
1263
+ ),
1264
+ error && /* @__PURE__ */ jsx("p", { className: "kai-code__dialog-error", role: "alert", children: error }),
1265
+ /* @__PURE__ */ jsxs("div", { className: "kai-code__dialog-actions", children: [
1266
+ /* @__PURE__ */ jsx(
1267
+ "button",
1268
+ {
1269
+ onClick: () => {
1270
+ setMoveTarget(null);
1271
+ setError(null);
1272
+ },
1273
+ type: "button",
1274
+ children: "Cancel"
1275
+ }
1276
+ ),
1277
+ /* @__PURE__ */ jsx("button", { className: "is-primary", type: "submit", children: "Move" })
1278
+ ] })
1279
+ ]
1280
+ }
1281
+ )
1282
+ }
1283
+ ),
1052
1284
  /* @__PURE__ */ jsxs("footer", { className: "kai-code__statusbar", children: [
1053
1285
  /* @__PURE__ */ jsxs("div", { className: "kai-code__status-left", children: [
1054
1286
  /* @__PURE__ */ jsx("span", { className: "kai-code__status-branch", children: "\u2442 main" }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@handylib/kai-code",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "publishConfig": {