@gallop.software/studio 1.5.7 → 1.5.9

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.
@@ -1967,12 +1967,14 @@ function StudioToolbar() {
1967
1967
  const hasSelection2 = selectedItems.size > 0;
1968
1968
  if (hasSelection2) {
1969
1969
  const selectedPaths2 = Array.from(selectedItems);
1970
- const imageExtensions = ["jpg", "jpeg", "png", "gif", "webp", "svg", "ico", "bmp", "tiff", "tif"];
1971
- const selectedImagePaths = selectedPaths2.filter((p) => {
1972
- const ext = _optionalChain([p, 'access', _14 => _14.split, 'call', _15 => _15("."), 'access', _16 => _16.pop, 'call', _17 => _17(), 'optionalAccess', _18 => _18.toLowerCase, 'call', _19 => _19()]) || "";
1973
- return imageExtensions.includes(ext);
1970
+ const selectedFilePaths = selectedPaths2.filter((p) => {
1971
+ const lastPart = p.split("/").pop() || "";
1972
+ return lastPart.includes(".") && !p.endsWith("/");
1973
+ });
1974
+ const selectedFolders = selectedPaths2.filter((p) => {
1975
+ const lastPart = p.split("/").pop() || "";
1976
+ return !lastPart.includes(".") || p.endsWith("/");
1974
1977
  });
1975
- const selectedFolders = selectedPaths2.filter((p) => !p.includes(".") || p.endsWith("/"));
1976
1978
  if (selectedFolders.length > 0) {
1977
1979
  try {
1978
1980
  const response = await fetch(`/api/studio/folder-images?folders=${encodeURIComponent(selectedFolders.join(","))}`);
@@ -1980,23 +1982,23 @@ function StudioToolbar() {
1980
1982
  if (data.images) {
1981
1983
  for (const img of data.images) {
1982
1984
  const fullPath = `public/${img}`;
1983
- if (!selectedImagePaths.includes(fullPath)) {
1984
- selectedImagePaths.push(fullPath);
1985
+ if (!selectedFilePaths.includes(fullPath)) {
1986
+ selectedFilePaths.push(fullPath);
1985
1987
  }
1986
1988
  }
1987
1989
  }
1988
1990
  } catch (error) {
1989
- console.error("Failed to get folder images:", error);
1991
+ console.error("Failed to get folder files:", error);
1990
1992
  }
1991
1993
  }
1992
- if (selectedImagePaths.length === 0) {
1994
+ if (selectedFilePaths.length === 0) {
1993
1995
  setAlertMessage({
1994
- title: "No Images Found",
1995
- message: "No images found in the selected items."
1996
+ title: "No Files Found",
1997
+ message: "No files found in the selected items."
1996
1998
  });
1997
1999
  return;
1998
2000
  }
1999
- requestProcess(selectedImagePaths);
2001
+ requestProcess(selectedFilePaths);
2000
2002
  } else {
2001
2003
  try {
2002
2004
  const response = await fetch("/api/studio/count-images");
@@ -2089,12 +2091,14 @@ function StudioToolbar() {
2089
2091
  const handleSyncClick = _react.useCallback.call(void 0, async () => {
2090
2092
  if (selectedItems.size === 0) return;
2091
2093
  const selectedPaths2 = Array.from(selectedItems);
2092
- const imageExtensions = ["jpg", "jpeg", "png", "gif", "webp", "svg", "ico", "bmp", "tiff", "tif"];
2093
- const selectedImagePaths = selectedPaths2.filter((p) => {
2094
- const ext = _optionalChain([p, 'access', _20 => _20.split, 'call', _21 => _21("."), 'access', _22 => _22.pop, 'call', _23 => _23(), 'optionalAccess', _24 => _24.toLowerCase, 'call', _25 => _25()]) || "";
2095
- return imageExtensions.includes(ext);
2094
+ const selectedFilePaths = selectedPaths2.filter((p) => {
2095
+ const lastPart = p.split("/").pop() || "";
2096
+ return lastPart.includes(".") && !p.endsWith("/");
2097
+ });
2098
+ const selectedFolders = selectedPaths2.filter((p) => {
2099
+ const lastPart = p.split("/").pop() || "";
2100
+ return !lastPart.includes(".") || p.endsWith("/");
2096
2101
  });
2097
- const selectedFolders = selectedPaths2.filter((p) => !p.includes(".") || p.endsWith("/"));
2098
2102
  if (selectedFolders.length > 0) {
2099
2103
  try {
2100
2104
  const response = await fetch(`/api/studio/folder-images?folders=${encodeURIComponent(selectedFolders.join(","))}`);
@@ -2102,26 +2106,26 @@ function StudioToolbar() {
2102
2106
  if (data.images) {
2103
2107
  for (const img of data.images) {
2104
2108
  const fullPath = `public/${img}`;
2105
- if (!selectedImagePaths.includes(fullPath)) {
2106
- selectedImagePaths.push(fullPath);
2109
+ if (!selectedFilePaths.includes(fullPath)) {
2110
+ selectedFilePaths.push(fullPath);
2107
2111
  }
2108
2112
  }
2109
2113
  }
2110
2114
  } catch (error) {
2111
- console.error("Failed to get folder images:", error);
2115
+ console.error("Failed to get folder files:", error);
2112
2116
  }
2113
2117
  }
2114
- if (selectedImagePaths.length === 0) {
2118
+ if (selectedFilePaths.length === 0) {
2115
2119
  setAlertMessage({
2116
- title: "No Images Found",
2117
- message: "No images found in the selected items."
2120
+ title: "No Files Found",
2121
+ message: "No files found in the selected items."
2118
2122
  });
2119
2123
  return;
2120
2124
  }
2121
2125
  let hasRemote = false;
2122
2126
  let hasLocal = false;
2123
- for (const imgPath of selectedImagePaths) {
2124
- const item = fileItems.find((f) => f.path === imgPath);
2127
+ for (const filePath of selectedFilePaths) {
2128
+ const item = fileItems.find((f) => f.path === filePath);
2125
2129
  if (item) {
2126
2130
  if (item.isRemote) {
2127
2131
  hasRemote = true;
@@ -2130,7 +2134,7 @@ function StudioToolbar() {
2130
2134
  }
2131
2135
  }
2132
2136
  }
2133
- setSyncImageCount(selectedImagePaths.length);
2137
+ setSyncImageCount(selectedFilePaths.length);
2134
2138
  setSyncHasRemote(hasRemote);
2135
2139
  setSyncHasLocal(hasLocal);
2136
2140
  setShowSyncConfirm(true);
@@ -2138,12 +2142,14 @@ function StudioToolbar() {
2138
2142
  const handleSyncConfirm = _react.useCallback.call(void 0, async () => {
2139
2143
  setShowSyncConfirm(false);
2140
2144
  const selectedPaths2 = Array.from(selectedItems);
2141
- const imageExtensions = ["jpg", "jpeg", "png", "gif", "webp", "svg", "ico", "bmp", "tiff", "tif"];
2142
- const selectedImagePaths = selectedPaths2.filter((p) => {
2143
- const ext = _optionalChain([p, 'access', _26 => _26.split, 'call', _27 => _27("."), 'access', _28 => _28.pop, 'call', _29 => _29(), 'optionalAccess', _30 => _30.toLowerCase, 'call', _31 => _31()]) || "";
2144
- return imageExtensions.includes(ext);
2145
+ const selectedFilePaths = selectedPaths2.filter((p) => {
2146
+ const lastPart = p.split("/").pop() || "";
2147
+ return lastPart.includes(".") && !p.endsWith("/");
2148
+ });
2149
+ const selectedFolders = selectedPaths2.filter((p) => {
2150
+ const lastPart = p.split("/").pop() || "";
2151
+ return !lastPart.includes(".") || p.endsWith("/");
2145
2152
  });
2146
- const selectedFolders = selectedPaths2.filter((p) => !p.includes(".") || p.endsWith("/"));
2147
2153
  if (selectedFolders.length > 0) {
2148
2154
  try {
2149
2155
  const response = await fetch(`/api/studio/folder-images?folders=${encodeURIComponent(selectedFolders.join(","))}`);
@@ -2151,16 +2157,16 @@ function StudioToolbar() {
2151
2157
  if (data.images) {
2152
2158
  for (const img of data.images) {
2153
2159
  const fullPath = `public/${img}`;
2154
- if (!selectedImagePaths.includes(fullPath)) {
2155
- selectedImagePaths.push(fullPath);
2160
+ if (!selectedFilePaths.includes(fullPath)) {
2161
+ selectedFilePaths.push(fullPath);
2156
2162
  }
2157
2163
  }
2158
2164
  }
2159
2165
  } catch (error) {
2160
- console.error("Failed to get folder images:", error);
2166
+ console.error("Failed to get folder files:", error);
2161
2167
  }
2162
2168
  }
2163
- const imageKeys = selectedImagePaths.map((p) => "/" + p.replace(/^public\//, ""));
2169
+ const imageKeys = selectedFilePaths.map((p) => "/" + p.replace(/^public\//, ""));
2164
2170
  setProgressTitle("Pushing to CDN");
2165
2171
  setProgressState({
2166
2172
  current: 0,
@@ -2194,16 +2200,16 @@ function StudioToolbar() {
2194
2200
  });
2195
2201
  const data = await response.json();
2196
2202
  if (!response.ok) {
2197
- if (_optionalChain([data, 'access', _32 => _32.error, 'optionalAccess', _33 => _33.includes, 'call', _34 => _34("R2 not configured")]) || _optionalChain([data, 'access', _35 => _35.error, 'optionalAccess', _36 => _36.includes, 'call', _37 => _37("CLOUDFLARE_R2")])) {
2203
+ if (_optionalChain([data, 'access', _14 => _14.error, 'optionalAccess', _15 => _15.includes, 'call', _16 => _16("R2 not configured")]) || _optionalChain([data, 'access', _17 => _17.error, 'optionalAccess', _18 => _18.includes, 'call', _19 => _19("CLOUDFLARE_R2")])) {
2198
2204
  setShowProgress(false);
2199
2205
  setShowR2SetupModal(true);
2200
2206
  return;
2201
2207
  }
2202
2208
  lastError = data.error || `Failed: ${imageKey}`;
2203
- } else if (_optionalChain([data, 'access', _38 => _38.pushed, 'optionalAccess', _39 => _39.length]) > 0) {
2209
+ } else if (_optionalChain([data, 'access', _20 => _20.pushed, 'optionalAccess', _21 => _21.length]) > 0) {
2204
2210
  pushed++;
2205
2211
  success = true;
2206
- } else if (_optionalChain([data, 'access', _40 => _40.errors, 'optionalAccess', _41 => _41.length]) > 0) {
2212
+ } else if (_optionalChain([data, 'access', _22 => _22.errors, 'optionalAccess', _23 => _23.length]) > 0) {
2207
2213
  for (const errMsg of data.errors) {
2208
2214
  lastError = errMsg;
2209
2215
  }
@@ -2247,30 +2253,28 @@ function StudioToolbar() {
2247
2253
  const handleDownloadClick = _react.useCallback.call(void 0, async () => {
2248
2254
  if (selectedItems.size === 0) return;
2249
2255
  const selectedPaths2 = Array.from(selectedItems);
2250
- const imageExtensions = ["jpg", "jpeg", "png", "gif", "webp", "svg", "ico", "bmp", "tiff", "tif"];
2251
- const selectedImagePaths = selectedPaths2.filter((p) => {
2252
- const ext = _optionalChain([p, 'access', _42 => _42.split, 'call', _43 => _43("."), 'access', _44 => _44.pop, 'call', _45 => _45(), 'optionalAccess', _46 => _46.toLowerCase, 'call', _47 => _47()]) || "";
2253
- return imageExtensions.includes(ext);
2256
+ const selectedFilePaths = selectedPaths2.filter((p) => {
2257
+ const lastPart = p.split("/").pop() || "";
2258
+ return lastPart.includes(".") && !p.endsWith("/");
2254
2259
  });
2255
- if (selectedImagePaths.length === 0) {
2260
+ if (selectedFilePaths.length === 0) {
2256
2261
  setAlertMessage({
2257
- title: "No Images Found",
2258
- message: "No images found in the selected items."
2262
+ title: "No Files Found",
2263
+ message: "No files found in the selected items."
2259
2264
  });
2260
2265
  return;
2261
2266
  }
2262
- setDownloadImageCount(selectedImagePaths.length);
2267
+ setDownloadImageCount(selectedFilePaths.length);
2263
2268
  setShowDownloadConfirm(true);
2264
2269
  }, [selectedItems]);
2265
2270
  const handleDownloadConfirm = _react.useCallback.call(void 0, async () => {
2266
2271
  setShowDownloadConfirm(false);
2267
2272
  const selectedPaths2 = Array.from(selectedItems);
2268
- const imageExtensions = ["jpg", "jpeg", "png", "gif", "webp", "svg", "ico", "bmp", "tiff", "tif"];
2269
- const selectedImagePaths = selectedPaths2.filter((p) => {
2270
- const ext = _optionalChain([p, 'access', _48 => _48.split, 'call', _49 => _49("."), 'access', _50 => _50.pop, 'call', _51 => _51(), 'optionalAccess', _52 => _52.toLowerCase, 'call', _53 => _53()]) || "";
2271
- return imageExtensions.includes(ext);
2273
+ const selectedFilePaths = selectedPaths2.filter((p) => {
2274
+ const lastPart = p.split("/").pop() || "";
2275
+ return lastPart.includes(".") && !p.endsWith("/");
2272
2276
  });
2273
- const imageKeys = selectedImagePaths.map((p) => "/" + p.replace(/^public\//, ""));
2277
+ const imageKeys = selectedFilePaths.map((p) => "/" + p.replace(/^public\//, ""));
2274
2278
  setProgressTitle("Downloading from CDN");
2275
2279
  setShowProgress(true);
2276
2280
  setProgressState({
@@ -4639,7 +4643,7 @@ function StudioDetailView() {
4639
4643
  });
4640
4644
  return;
4641
4645
  }
4642
- const reader = _optionalChain([response, 'access', _54 => _54.body, 'optionalAccess', _55 => _55.getReader, 'call', _56 => _56()]);
4646
+ const reader = _optionalChain([response, 'access', _24 => _24.body, 'optionalAccess', _25 => _25.getReader, 'call', _26 => _26()]);
4643
4647
  const decoder = new TextDecoder();
4644
4648
  if (reader) {
4645
4649
  let buffer = "";
@@ -5603,7 +5607,7 @@ function useStudioActions({
5603
5607
  });
5604
5608
  return;
5605
5609
  }
5606
- const reader = _optionalChain([response, 'access', _57 => _57.body, 'optionalAccess', _58 => _58.getReader, 'call', _59 => _59()]);
5610
+ const reader = _optionalChain([response, 'access', _27 => _27.body, 'optionalAccess', _28 => _28.getReader, 'call', _29 => _29()]);
5607
5611
  const decoder = new TextDecoder();
5608
5612
  if (reader) {
5609
5613
  let buffer = "";
@@ -5633,7 +5637,7 @@ function useStudioActions({
5633
5637
  status: "complete",
5634
5638
  message: `Moved ${data.moved} file${data.moved !== 1 ? "s" : ""}${data.errors > 0 ? `, ${data.errors} error${data.errors !== 1 ? "s" : ""}` : ""}`
5635
5639
  }));
5636
- if (data.errors > 0 && _optionalChain([data, 'access', _60 => _60.errorMessages, 'optionalAccess', _61 => _61.length]) > 0) {
5640
+ if (data.errors > 0 && _optionalChain([data, 'access', _30 => _30.errorMessages, 'optionalAccess', _31 => _31.length]) > 0) {
5637
5641
  showError("Move Failed", data.errorMessages.join("\n"));
5638
5642
  }
5639
5643
  clearSelection();
@@ -5761,7 +5765,7 @@ function useStudioActions({
5761
5765
  });
5762
5766
  return;
5763
5767
  }
5764
- const reader = _optionalChain([response, 'access', _62 => _62.body, 'optionalAccess', _63 => _63.getReader, 'call', _64 => _64()]);
5768
+ const reader = _optionalChain([response, 'access', _32 => _32.body, 'optionalAccess', _33 => _33.getReader, 'call', _34 => _34()]);
5765
5769
  const decoder = new TextDecoder();
5766
5770
  if (reader) {
5767
5771
  let buffer = "";
@@ -5850,7 +5854,7 @@ function useStudioActions({
5850
5854
  setProgressState((prev) => ({
5851
5855
  ...prev,
5852
5856
  orphanedFiles: void 0,
5853
- message: _optionalChain([prev, 'access', _65 => _65.message, 'optionalAccess', _66 => _66.replace, 'call', _67 => _67(/Found \d+ orphaned thumbnail\(s\).*/, "Orphaned thumbnails deleted.")])
5857
+ message: _optionalChain([prev, 'access', _35 => _35.message, 'optionalAccess', _36 => _36.replace, 'call', _37 => _37(/Found \d+ orphaned thumbnail\(s\).*/, "Orphaned thumbnails deleted.")])
5854
5858
  }));
5855
5859
  triggerRefresh();
5856
5860
  } else {
@@ -6493,4 +6497,4 @@ var StudioUI_default = StudioUI;
6493
6497
 
6494
6498
 
6495
6499
  exports.StudioUI = StudioUI; exports.default = StudioUI_default;
6496
- //# sourceMappingURL=StudioUI-O53YFD6Q.js.map
6500
+ //# sourceMappingURL=StudioUI-GJK45R3T.js.map