@tutti-os/workspace-file-manager 0.0.49 → 0.0.51

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
@@ -10,6 +10,7 @@ import {
10
10
  formatWorkspaceFileModifiedTime,
11
11
  isWorkspaceApplicationBundle,
12
12
  isWorkspaceFileBrowserOpenable,
13
+ isWorkspaceFileExternalLocation,
13
14
  isWorkspaceFileRecentLocation,
14
15
  isWorkspaceTextFileTooLarge,
15
16
  looksLikeBinaryText,
@@ -32,7 +33,7 @@ import {
32
33
  workspaceFileSearchEntryToEntry,
33
34
  workspaceFileTextMaxBytes,
34
35
  writeWorkspaceFileManagerArrangeMode
35
- } from "./chunk-M7G5F5PL.js";
36
+ } from "./chunk-PSD3KFJP.js";
36
37
  import {
37
38
  createWorkspaceFileManagerI18nRuntime,
38
39
  resolveRevealInFolderLabel,
@@ -727,9 +728,15 @@ function resolveWorkspaceFileManagerRootViewState(input) {
727
728
  state.selectedLocationId
728
729
  )
729
730
  );
731
+ const isExternalLocation = isWorkspaceFileExternalLocation(
732
+ findWorkspaceFileLocationById(
733
+ state.locationSections,
734
+ state.selectedLocationId
735
+ )
736
+ );
730
737
  const isSearchMode = state.searchQuery.trim().length > 0;
731
738
  return {
732
- canImportFromDrop: state.capabilities.canImportFromDrop && !isRecentLocation && !isSearchMode,
739
+ canImportFromDrop: state.capabilities.canImportFromDrop && !isRecentLocation && !isExternalLocation && !isSearchMode,
733
740
  currentDirectoryPath: state.currentDirectoryPath,
734
741
  isBusy: state.busyAction !== null,
735
742
  locationSections: state.locationSections,
@@ -769,8 +776,14 @@ function resolveWorkspaceFileManagerPanelsViewState(input) {
769
776
  state.selectedLocationId
770
777
  )
771
778
  );
779
+ const isExternalLocation = isWorkspaceFileExternalLocation(
780
+ findWorkspaceFileLocationById(
781
+ state.locationSections,
782
+ state.selectedLocationId
783
+ )
784
+ );
772
785
  return {
773
- canMove: state.capabilities.canMove && !isRecentLocation,
786
+ canMove: state.capabilities.canMove && !isRecentLocation && !isExternalLocation,
774
787
  contextMenuEntryPath: state.contextMenuEntryPath,
775
788
  entries: state.entries,
776
789
  error: state.error,
@@ -787,7 +800,7 @@ function resolveWorkspaceFileManagerPanelsViewState(input) {
787
800
  searchQuery: state.searchQuery,
788
801
  selectedEntry: findSelectedEntry(state),
789
802
  selectedPath: state.selectedPath,
790
- showDropOverlay: state.capabilities.canImportFromDrop && state.dragDepth > 0 && state.busyAction === null
803
+ showDropOverlay: state.capabilities.canImportFromDrop && !isExternalLocation && state.dragDepth > 0 && state.busyAction === null
791
804
  };
792
805
  }
793
806
  function resolveWorkspaceFileManagerDialogsViewState(input) {
@@ -819,6 +832,12 @@ function resolveWorkspaceFileManagerContextMenuViewState(input) {
819
832
  state.selectedLocationId
820
833
  )
821
834
  );
835
+ const isExternalLocation = isWorkspaceFileExternalLocation(
836
+ findWorkspaceFileLocationById(
837
+ state.locationSections,
838
+ state.selectedLocationId
839
+ )
840
+ );
822
841
  const isSearchMode = state.searchQuery.trim().length > 0;
823
842
  const contextMenuEntry = state.contextMenu?.entryPath ? findEntry(state, state.contextMenu.entryPath) : null;
824
843
  const isContextMenuFile = contextMenuEntry?.kind === "file";
@@ -832,19 +851,19 @@ function resolveWorkspaceFileManagerContextMenuViewState(input) {
832
851
  isBusy: state.busyAction !== null,
833
852
  isLoading: state.isLoading,
834
853
  isMutating: state.isMutating,
835
- showCreateAction: !isRecentLocation && !isSearchMode && (state.capabilities.canCreateDirectory || state.capabilities.canCreateFile),
854
+ showCreateAction: !isExternalLocation && !isRecentLocation && !isSearchMode && (state.capabilities.canCreateDirectory || state.capabilities.canCreateFile),
836
855
  showCopyAction: state.capabilities.canCopy,
837
- showDeleteAction: state.capabilities.canDelete && !isRecentLocation && !isSearchMode,
838
- showExportAction: state.capabilities.canExport,
839
- showImportAction: state.capabilities.canImportFromPicker && !isRecentLocation && !isSearchMode,
840
- showMoveAction: state.capabilities.canMove && !isRecentLocation && !isSearchMode,
841
- showOpenInAppBrowserAction: state.capabilities.canOpenInAppBrowser,
842
- showOpenInDefaultBrowserAction: state.capabilities.canOpenInDefaultBrowser,
856
+ showDeleteAction: state.capabilities.canDelete && !isExternalLocation && !isRecentLocation && !isSearchMode,
857
+ showExportAction: state.capabilities.canExport && !isExternalLocation,
858
+ showImportAction: state.capabilities.canImportFromPicker && !isExternalLocation && !isRecentLocation && !isSearchMode,
859
+ showMoveAction: state.capabilities.canMove && !isExternalLocation && !isRecentLocation && !isSearchMode,
860
+ showOpenInAppBrowserAction: state.capabilities.canOpenInAppBrowser && !isExternalLocation,
861
+ showOpenInDefaultBrowserAction: state.capabilities.canOpenInDefaultBrowser && !isExternalLocation,
843
862
  showOpenInFileViewerAction: contextMenuEntry !== null && isContextMenuFile && resolveWorkspaceFileActivationTarget(contextMenuEntry) !== null,
844
863
  showOpenWithAction: state.capabilities.canOpenWith && isContextMenuFile,
845
864
  showOpenWithOtherAction: state.capabilities.canPickOtherOpenWithApplication && isContextMenuFile,
846
- showRevealInFolderAction: state.capabilities.canRevealInFolder,
847
- showRenameAction: state.capabilities.canRename && !isRecentLocation && !isSearchMode
865
+ showRevealInFolderAction: state.capabilities.canRevealInFolder && !isExternalLocation,
866
+ showRenameAction: state.capabilities.canRename && !isExternalLocation && !isRecentLocation && !isSearchMode
848
867
  };
849
868
  }
850
869
  function findSelectedEntry(state) {
@@ -3659,7 +3678,7 @@ function WorkspaceFileManagerSidebarLocation({
3659
3678
  onSelectLocation(location);
3660
3679
  },
3661
3680
  children: [
3662
- /* @__PURE__ */ jsx8(Icon, { className: "size-4 flex-none" }),
3681
+ location.kind === "external" && location.iconUrl ? /* @__PURE__ */ jsx8(ExternalLocationIcon, { location }) : /* @__PURE__ */ jsx8(Icon, { className: "size-4 flex-none" }),
3663
3682
  /* @__PURE__ */ jsx8("span", { className: "min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap", children: location.label })
3664
3683
  ]
3665
3684
  }
@@ -3672,6 +3691,18 @@ function WorkspaceFileManagerSidebarLocation({
3672
3691
  /* @__PURE__ */ jsx8(TooltipContent2, { side: "right", children: location.contextLabel })
3673
3692
  ] });
3674
3693
  }
3694
+ function ExternalLocationIcon({
3695
+ location
3696
+ }) {
3697
+ return /* @__PURE__ */ jsx8(
3698
+ "img",
3699
+ {
3700
+ alt: "",
3701
+ className: "size-4 flex-none rounded-[3px] object-cover",
3702
+ src: location.iconUrl ?? void 0
3703
+ }
3704
+ );
3705
+ }
3675
3706
 
3676
3707
  // src/ui/useWorkspaceFileManagerArrangeMode.ts
3677
3708
  import { useCallback as useCallback3, useState as useState5 } from "react";
@@ -4049,6 +4080,7 @@ function WorkspaceFileManager({
4049
4080
  openInAppBrowserIcon,
4050
4081
  resolveOpenWithApplicationIcon,
4051
4082
  resolveEntryIconUrl,
4083
+ renderExternalLocationContent,
4052
4084
  hostOs = "linux",
4053
4085
  session,
4054
4086
  surface = "card"
@@ -4058,6 +4090,13 @@ function WorkspaceFileManager({
4058
4090
  const { layoutMode, setLayoutMode } = useWorkspaceFileManagerLayoutMode();
4059
4091
  const rootView = useWorkspaceFileManagerRootView(session);
4060
4092
  const { state: panelsState, view: panelsView } = useWorkspaceFileManagerPanelsView(session);
4093
+ const selectedExternalLocation = useMemo3(() => {
4094
+ const location = findWorkspaceFileLocationById(
4095
+ rootView.locationSections,
4096
+ rootView.selectedLocationId
4097
+ );
4098
+ return location?.kind === "external" ? location : null;
4099
+ }, [rootView.locationSections, rootView.selectedLocationId]);
4061
4100
  useEffect7(() => {
4062
4101
  function handleCopyShortcut(event) {
4063
4102
  if (!(event.metaKey || event.ctrlKey) || event.key !== "c" || event.shiftKey) {
@@ -4069,6 +4108,9 @@ function WorkspaceFileManager({
4069
4108
  if (!rootRef.current?.contains(event.target)) {
4070
4109
  return;
4071
4110
  }
4111
+ if (selectedExternalLocation) {
4112
+ return;
4113
+ }
4072
4114
  if (!panelsState.capabilities.canCopy || panelsState.busyAction !== null || panelsState.isLoading || panelsState.isMutating) {
4073
4115
  return;
4074
4116
  }
@@ -4086,7 +4128,13 @@ function WorkspaceFileManager({
4086
4128
  return () => {
4087
4129
  window.removeEventListener("keydown", handleCopyShortcut);
4088
4130
  };
4089
- }, [onCopyEntry, panelsState, panelsView.selectedEntry, session]);
4131
+ }, [
4132
+ onCopyEntry,
4133
+ panelsState,
4134
+ panelsView.selectedEntry,
4135
+ selectedExternalLocation,
4136
+ session
4137
+ ]);
4090
4138
  useEffect7(() => {
4091
4139
  function handleRenameShortcut(event) {
4092
4140
  if (event.key !== "Enter" || event.metaKey || event.ctrlKey || event.altKey) {
@@ -4098,6 +4146,9 @@ function WorkspaceFileManager({
4098
4146
  if (!rootRef.current?.contains(event.target)) {
4099
4147
  return;
4100
4148
  }
4149
+ if (selectedExternalLocation) {
4150
+ return;
4151
+ }
4101
4152
  if (!panelsState.capabilities.canRename || panelsState.busyAction !== null || panelsState.isLoading || panelsState.isMutating || panelsState.inlineRenameEntryPath !== null || panelsState.searchQuery.trim().length > 0) {
4102
4153
  return;
4103
4154
  }
@@ -4112,7 +4163,12 @@ function WorkspaceFileManager({
4112
4163
  return () => {
4113
4164
  window.removeEventListener("keydown", handleRenameShortcut);
4114
4165
  };
4115
- }, [panelsState, panelsView.selectedEntry, session]);
4166
+ }, [
4167
+ panelsState,
4168
+ panelsView.selectedEntry,
4169
+ selectedExternalLocation,
4170
+ session
4171
+ ]);
4116
4172
  useEffect7(() => {
4117
4173
  function resetDropOverlay() {
4118
4174
  session.resetDragDepth();
@@ -4226,7 +4282,7 @@ function WorkspaceFileManager({
4226
4282
  }
4227
4283
  }
4228
4284
  ),
4229
- /* @__PURE__ */ jsxs8("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden", children: [
4285
+ /* @__PURE__ */ jsx9("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden", children: selectedExternalLocation ? renderExternalLocationContent?.(selectedExternalLocation) ?? null : /* @__PURE__ */ jsxs8(Fragment3, { children: [
4230
4286
  /* @__PURE__ */ jsx9(
4231
4287
  WorkspaceFileManagerToolbarContainer,
4232
4288
  {
@@ -4263,20 +4319,22 @@ function WorkspaceFileManager({
4263
4319
  )
4264
4320
  }
4265
4321
  )
4266
- ] }),
4267
- /* @__PURE__ */ jsx9(WorkspaceFileManagerDialogsContainer, { i18n, session }),
4268
- /* @__PURE__ */ jsx9(
4269
- WorkspaceFileManagerContextMenuContainer,
4270
- {
4271
- hostOs,
4272
- i18n,
4273
- onCopyEntry,
4274
- onCopyPath,
4275
- openInAppBrowserIcon,
4276
- resolveOpenWithApplicationIcon,
4277
- session
4278
- }
4279
- )
4322
+ ] }) }),
4323
+ !selectedExternalLocation ? /* @__PURE__ */ jsxs8(Fragment3, { children: [
4324
+ /* @__PURE__ */ jsx9(WorkspaceFileManagerDialogsContainer, { i18n, session }),
4325
+ /* @__PURE__ */ jsx9(
4326
+ WorkspaceFileManagerContextMenuContainer,
4327
+ {
4328
+ hostOs,
4329
+ i18n,
4330
+ onCopyEntry,
4331
+ onCopyPath,
4332
+ openInAppBrowserIcon,
4333
+ resolveOpenWithApplicationIcon,
4334
+ session
4335
+ }
4336
+ )
4337
+ ] }) : null
4280
4338
  ]
4281
4339
  }
4282
4340
  );
@@ -4593,6 +4651,7 @@ export {
4593
4651
  decodeWorkspaceTextFile,
4594
4652
  findWorkspaceFileLocationById,
4595
4653
  flattenWorkspaceFileLocations,
4654
+ isWorkspaceFileExternalLocation,
4596
4655
  isWorkspaceFileRecentLocation,
4597
4656
  isWorkspaceTextFileTooLarge,
4598
4657
  looksLikeBinaryText,